I am trying to get my weapons to fire once every 5 secs while pressing the spacebar. I used the Wait event but as long as i keep pressing spacebar, it still keeps firing. How do i set a reload time so that even after firing, pressing the spacebar will have no effect till the 5 sec reload is up.
Thanks for any advice !
Every X seconds
Run the event regularly at a given time interval in seconds. This can also be used beneath other conditions to only run the event at a given time interval while the other conditions are true, e.g. "Player is holding spacebar AND every 0.5 seconds: fire laser".
The best and easiest way to do this.
Put a var onto your player called. NextShot and make in a number.
When you fire the weapon
If(NextShot < time)
Fire the weapon stuff
NextShot = time + 5 seconds
Develop games in your browser. Powerful, performant & highly capable.
How to you make the var for the time? Like i set reload to 5. How to set a timer to count down to 0 so i can fire the next shot?