Best way to set a delay for projectiles

Hello, I’m making my first game at the moment and was wondering if there was a better way to do what I’m doing.

I have a projectile system set up, with booleans that allow the player to only shoot once a second.

Any recommendations for a better system?

Nothing wrong with using delays but I would use timers instead

1 Like

Just to add, for accurate timing, you are gonna want to preserve any leftover time on the counter each time it gets reset. Why? Because your ticks will never land exactly on the triggered time.

For example, you have a timer that a weapon can shoot exactly every 1000 ms (1 second).

During any particular game thread tick your timer will probably at like 1020 milliseconds when the weapon can shoot.

At this point the timer needs to reset to 20 milliseconds and not 0 milliseconds.