Sitemap

Adding Limited Ammo To Your Game

Apr 23, 2021
Press enter or click to view image in full size

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.

Press enter or click to view image in full size

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

--

--

Adam Reed
Adam Reed

Written by Adam Reed

Hi, my name is Adam Reed and I am a software engineer specializing in Unity and C# development. Feel free to scroll through and check out some of my work!

No responses yet