I have added a bombing skill into my game that on key pressed Q with enough coins bombs spawn and shoot up the screen destroying enemies and asteroids on collision. I have a variable bombSkill that is set to 0, on key pressed is set to 1 and when bombSkill is set to 1 the bombs start to spawn.
On the first Q keypress it works perfectly fine, when you hit it the second time only 2 or 3 bombs spawn, but then on the third press it works fine again. here is a screenshot of the code.
Develop games in your browser. Powerful, performant & highly capable.
You have "Wait 7 seconds" inside of "Every random() seconds" loop, this can cause all kinds of problems..
You basically start lots of delayed "set bombSkill=0" actions. When you press Q the second time, some of those delayed actions may still be running, that's why your bombing stops early.
Try not to use long running "Waits" for tasks like this, use Timer behavior instead.
On Q pressed
skillSpawn start Timer "StopBombing" for 7 seconds
Every random(02, 04) seconds -> Spawn bombs
skillSpawn On Timer "StopBombing"
dop2000 awesome, thank you works like a charm