I dont understand how does the timer works. for example : i want a enemy to shoot every 5 seconds. but i dont know how to do that [size=150]can u help me[/size]?
Iâm not sure how to use them either.
You can âcheatâ, however, if you make a Sprite with 2 frames and make each frame play for 2.5 seconds, then activate it when the animation finishes.
I was confused too at the start, since timers have no list or editor where they are collected, they just exist under a name if you use the âreset timerâ action. Thatâs basically how you start a timer.
For fire rate youâll want to reset the timer whenever your event fired a weapon. Youâll also need the same timer as a condition that prevents the fire event from being execute, unless the timer has reached a certain value. In your case five seconds.
As the example shows you can also have dynamically adjusting fire rates by using variables for the required timer values.
Thatâs really all there is too it: the âreset timerâ action essentially starts the timer, âtimer valueâ condition checks the timer and governs if something you want to be timed can be executed.
The animation thing is a cool workaround though, I used that to destroy projectiles without the need for timers. Pretty neat.
sleeper_service covered it pretty well here.
I actually learned about timers from Matthew Corneliusâ space shooter tutorial on YouTube a few months back. You should check out his entire Shooter series if youâre new to GDevelop.
I used âunpause timerâ to start a timer. Im not sure if it is correct but it worked for me.
Condition:
Action: unpause timer "enemyfire"
Condition: if enemyfire timer > 5 seconds
Action: create bullet
Action: reset timer "enemyfire"
Action: pause timer "enemyfire"