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

Planet and SpatioTemporal Asset Catalogs

Benefits of Coding

Build a Basic Recommendation Engine in Python

Creating A Ledge Grab in Unity — Part 2: Stop player movement on ledge collision.

Guide to CSS Grid Layout Fr Unit

CanIUse Grid Layout

Why we chose Freemius over EasyDigitalDownload and WooCommerce?

Principles of Database Schema Design

Advent Of Code — All in a Single Night — Puzzle 9

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

Unity — new input system create an action map

Learn to code by making 2.5 D Space Shooter

I think you dropped something — Creating a simple loot drop system in Unity2D

Monetize Your Game With Admob — Beginner Friendly — Unity3D