Member-only story

Unity2D DevLog 04 — UI Ammo Counter

Claudio Grassi
3 min readMay 6, 2021

Last time, I shared an article on how I improved my shield powerup. It’s now time to work on an ammo counter. Infinite firepower is a feature of some games, but I want to include some limitations.

Objective:

Create a replenishable ammunition system for the player. Include a way to display ammo information on the UI.

How I went about it:

I had already planned for this feature in my UI.

The space UI element for the ammo counter is ready. All I need now are some graphic elements for the numbers.

Rather than using pre-made fonts, I chose to create graphics for the numbers. I had to make sure the numbers matched the style of the background art.

After importing and slicing the Sprite Sheet, I used individual Image Elements to place each number in the UI.

The Post Processing effects already help to make the numbers look illuminated.

Now comes the fun part. I created a new Script to handle my AmmoCounter. The first thing I added was two Sprite Type Arrays to hold my numbered sprites. The neat thing about this is that each sprite’s index corresponds with the number in the image.

Create an account to read the full story.

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Already have an account? Sign in

Claudio Grassi
Claudio Grassi

Written by Claudio Grassi

Experienced digital artist, Unity game developer & coder with a knack for problem solving and a passion for video games.

No responses yet

What are your thoughts?