i have a spawner which spawns tanks but only one tank shoots at a time until u kill that tank then a different one will shoot
It happens because the timer is a global counter, there is only one timer, so there is not independency for each tank, the result is that only one tank fires or (if you put a “For each” event) all the tanks shoot at the same time
To solve it you have to put a timer for each tank, of course using real timers would be painfull, use object variables:
The expression TimeDelta() return the time elapsed in seconds since the last frame, so if always do:
Conditions: No conditions
Actions: Do + TimeDelta() to variable TimeSinceFire of tank
The variable TimeSinceFire of the tank object will be a timer, you can test it, reset it (i.e. set it = 0), and it will be independent for each tank instance. Now you can do:
For each object tank
Conditions: Variable TimeSinceFire of tank is >= 2
Actions: Create bullet, add to bullet a force, etc.
Do = 0 to variable TimeSinceFire of tank //or Do - 2 to variable for full time precision
Maybe you should use something like this in the object tankdeath too, but with a variable Lifetime or something, otherwise objects are cleaned in “waves”
thanks worked great