I can post a quick code example if required.
I've an object that can fire lightning bolts by holding the mouse down. To limit the number of bolts fired per second, I use OnMouseHit(1) and a local timer: every shot sets the timer to zero.
Each game loop increments the timer.
When the timer reaches 10, another shot is allowed.
This works fine.
My problem is simply that using MouseDown(1) fires 2 shots simultaneously. MouseHit() does not do this (but is unsuitable because it requires repetitive clicking).
Because my shots are instant (i.e. they do not travel but hit the target instantly) I use the same function to make an explosion, of which 2 are also created simultaneously.
How can I correct this so only one lightning bolt and one explosion is created?
Note: The only way I could tell two were created is by using a random image for each bolt and each explosion. Two images appear onscreen.
I've an object that can fire lightning bolts by holding the mouse down. To limit the number of bolts fired per second, I use OnMouseHit(1) and a local timer: every shot sets the timer to zero.
Each game loop increments the timer.
When the timer reaches 10, another shot is allowed.
This works fine.
My problem is simply that using MouseDown(1) fires 2 shots simultaneously. MouseHit() does not do this (but is unsuitable because it requires repetitive clicking).
Because my shots are instant (i.e. they do not travel but hit the target instantly) I use the same function to make an explosion, of which 2 are also created simultaneously.
How can I correct this so only one lightning bolt and one explosion is created?
Note: The only way I could tell two were created is by using a random image for each bolt and each explosion. Two images appear onscreen.