Creating a “Zero Ammo” Negative Pickup in Unity

Objective: Create a pickup and when the player collects it set the ammo to 0

For this pickup I gonna duplicate the “Hacked Movement” prefab to use the same sprite and animation and set a new power ID.

In the Player Script I create a public function to set the ammo to 0 and update the UI.

Next in the powerup script I added the new case for the power ID within it we call the function of the player script to set the ammo to 0.

In the Unity editor I selected the Spawn Manager object and added the Zero_Ammo_Prefab to the array of powerups.

And that’s it!!! The player now have to wait until collect another power to be able to attack again

--

--

--

A Software Engineer passionate about game dev and interactive products with Unity. I consider video games to be the artistic expression of programming.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

The Honest Truth About App Development (from a founder that lost $50k hiring his first developers)

Preventing & Handling Errors in Python

Code Wars is best platform for learning algorithm from programming language, here I want to write…

Connecting the dots in style: Build your own Dropbox Sync in 10 minutes!

The Escape Button is a Feature

Using Git LFS in your Unity Project

Activate/Deactivate Game Objects with Activation Track in Unity

RTC Conversation with Megan Seel: My 17 Years at General Electric from Coder to Product Manager

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
Rusben Guzman

Rusben Guzman

A Software Engineer passionate about game dev and interactive products with Unity. I consider video games to be the artistic expression of programming.

More from Medium

Enemies Straight Ahead!

Adding a burst laser powerup

Sci-fi Lab — Collider

Live, die and respawn