Cool-down variables

I decided that we needed to remedy our fast-shooty boy with a small cool-down between keypresses; variables are listed above.

So I needed to calculate how much time had passed and make sure it was greater than the fire rate variable, then I needed to set the cooldown so there is a 0.05 second pause.

Now there is a nice little delay despite mashing my keyboard!

I’m thinking maybe I’ll add an ammo count and a reload time after a certain amount of fired lasers since we’re already here. I’ll play around and see what I can do.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Andrew Lengen

If ambition and practicality amalgamated, it would be me! I am here to climb the mountains of my ambition and catalog my journey so that someone can be changed!