Adding Limited Ammo To Your Game

When making a game, you may want to limit the number of times a player can shoot a gun, use an item, or perform an action. This is just an integer value that is checked before each use and updated after.

The code/logic below can be added to a player script along with your regular shooting code to add an ammo count.

In my next article, we will be going over the creation of an ammo refill powerup!

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