Fully automatic weapon?

Hey :slight_smile:

I have managed to get a fully working weapon system for my game, however I have encountered a few problems. The main one is, how I can get my function to be called as long as the mouse button is pressed. Anyone know how I could do that?

Cheers, and thank you in advance for any help or advice.

Hello there :slight_smile: I implemented my automatic weapon system by having a StartFire and StopFire methods. When you press your mouse down you call StartFire, which spawns the projectile and then i set a SetTimer that calls StartFire again after the time interval between shots. When you release the mouse you call StopFire which clears the SetTimer used to create the loop.

That makes perfect sense, thanks man :slight_smile:

Check out the ShooterGame example.

Youโ€™re welcome :slight_smile: