Problem with Enemys Firing

Hi all

My tank game is now over 3mb so i cannot share my project im signed up to github but dont have a clue how to use it so for now i have just print screened it.

Anyway i have a timer for the enemy to shoot (Reload speed) but if i create more than one instance of the enemy they all use the same timer, therefore only 1 enemy can shoot at any 1 time.

Im just wondering if their is a way to create a timer of each instance created. Heres what i got anyway




Any help will be much appreciated, Thanks

Hi, as it seems that you know how object variables works, it will be easy :sunglasses:

Instead global timers, use object variables as instance timers :slight_smile:
The expression “TimeDelta()” returns the time elapsed since the last frame, then for every enemy (without conditions), do:

No conditions         ||          Do + TimeDelta() to the variable TimeSinceFire of Enemy

The variable TimeSinceFire will be increased as a timer (in seconds), now you can test the variable, and it will work for every instance, per-instance :smiley:

Variable TimeSinceFire of Enemy is > Enemy.Variable(FireRate)         ||          Shoot and Set variable TimeSinceFire of Enemy = 0

wow thankyou lizard ur the best :wink: got it working, now all the fundamentals are in place i can start making my base and missions :slight_smile: