Chapter 32: Ammo Collectible

Joshua Kidd
Nov 17, 2023

--

Check out these Chapters to see how to code power-ups and collectibles into the game:

Chapter 16: Creating Modular Powerup Systems | by Joshua Kidd | Oct, 2023 | Medium

Chapter 17: Switch Statements to the Rescue — Joshua Kidd — Medium

After reviewing these two Chapters implement a new power-up for reloading ammo. Use the processes in the Chapters and add variables and statements in the player script needed to activate a reload function.

Optional: use public int to max out the ammo at 15 when reloading or leave it alone to and have the character stack ammo

In the SpawnManager Script change 4 from 3 to add a slot in the hierarchy to add Ammo Sprite

In the Power-up Script add the ammo reload power-up to the switch statement so that the power-up can interact with the player like the rest of the other power-ups when collected.

Optional: Add audio to indicate the player is out of ammo

--

--