Ammo Collected!- Game Dev Series 36

Objective: Create a collectable ammo powerup to refill.

Since we have limited the ammo, it should be better if we add an ammo powerup.

Here are what we should do to create an ammo powerup:

  1. Create a functional prefab(including collider, rigidbody, audio source, animation, and script).
  2. Add extra lines to code to make this powerup works.

Create a functional prefab

Drag the first sprite that you prepared for this powerup into hierarchy as a gameobject. Rename it and add every component you need.

And also set the animation!

Don’t forget to drag the ammo powerup back to Project window as a prefab.

Add lines of code to scripts

First, in the Player script, create a public method to update the ammo and also update the UI.

Don’t forget to send the ammo counts to UIManager.

Add another switch case in Powerups script to access the method we just created in Player.

Then we can assign the ID number to ammo prefab.

And make the ammo prefab in SpawnManager routine.

All done! We can test it now!




A passionate gamer whose goal is to work in video game development.

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

Recommended from Medium

Publish Your Game to Google Play- Game Dev Series 117

State Descriptions on Android

Image showing media controls and the text “Play/pause button — paused, double tap to play”. “Play/pause button — paused” is highlighted as content description and “play” in “double tap to play” is highlighted as the click label

Setup Android App Pen-testing environment on Mac-book M1

Project 7: ESP32 Bluetooth

Android — Shortcut Manager

How to run an expensive calculation with Kotlin Coroutines on the Android Main Thread without…

Clean Your Android Studio to Fix Issues

AIR / Apache Flex 2021: How to prep & upload Android App Bundle

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
S.J. Jason Liu

S.J. Jason Liu

A passionate gamer whose goal is to work in video game development.

More from Medium

What is a Control Track in Timeline

Using Height Maps and Pixel Displacement in Unity3D

Unity : AI && NavMesh [FSM : (Finite State Machine with Enum)]

Create A White Noise Shader With Shader Graph In Unity