Phase I — Progress report –Ammo system

Luke Duckett
3 min readApr 28, 2021

--

I’ve added an ammo system into the game to add another degree of difficulty for the player. The player was previously able to shoot as much as they wanted with only a determined fire rate slowing them down.

The player can now hold a maximum of 15 ammo at a time and cannot shoot when empty. When the ammo reserve is empty the ammo text flashes and a sound effect will play.

I have added in a check so the flicker and sound effects can only be played after the flicker text routine has run.

I have done this in the update ammo function by calling a bool return type function before calling the flicker effect. If the flicker effect is currently running the sound effect will not play again and the flicker effect will not be called.

We, of course, need a way to replenish the ammo count so I have created an ammo powerup that maxes the player's ammo out.

As the powerup script is already modular all I had to do was set the powerup id in the inspector.

Then call a new function on the player.

This maxes their ammo out and updates the UI.

The spawn manager is also modular allowing us to just drag and drop our new powerup into the array which will allow it to be spawned in the routine with no added new code.

All that is left is to test our functionality.

That’s all for now.

--

--

Luke Duckett
Luke Duckett

Written by Luke Duckett

🎮 First Nations Unity Dev from Wonnarua country 🏞️ | From Player to Lifelong Learner: Crafting Games, Debugging Code, and Embracing New Technology

No responses yet