Recommended Posts

Hello.
I'm creating a space arcade game with SDL and i'm having trouble with the timing for shooting. The keyboard updates through every game loop and it makes it so that if i press a key to fire it shoots multiple bullets. How could i time it?

0

Share this post

Link to post

Share on other sites

I generally have a variable holding the last time (as returned by SDLGetTicks()) the weapon was fired, and in the mainloop, check that variable each time the user hits the fire key. Something like this...