Gun's Rate of fire

Blitz3D Forums/Blitz3D Beginners Area/Gun's Rate of fire

Sanosake1(Posted 2009) [#1]
Heya, I can't get my head around how to set up a rate of fire for a gun in my tank game. As it stands, my gun fires by creating a sprite at the gun's position then it updates all bullets types by using MoveEntity. I can make some fast bullets but I can't set up a three round burst or even a controlled automatic rate of fire.
Idealy, I'd like to have a cannon that fires at 1 round per second and a machine gun that fires 5-10 rounds per second.

I have been looking into delta timing and tweening, but I haven't used it yet.
I hope to make this a networked game later on as well.

Any advice would be useful and oh-so-dearly-appreciated.



tags: ROF ,gun timing, bullet rate, time, gun


Ross C(Posted 2009) [#2]
Just set up a timer. Change the rate_of_fire value to see the different speed. As for a burst shot, again a timer. Set one up to allow so many shots, at a certain rate of fire, before introducing a larger pause. Some code to demonstrate simply rate of fire:

Press SPACEBAR to fire.




Sanosake1(Posted 2009) [#3]
This works wonderfully. Thanks ALOT!