Creating a Collectible Coin

Going over how I implemented a collectible coin in my 2.5D game

Objective: Create a coin collectible for my 2.5D game.

Animation and VFX

To get started, the first thing I did was grab a simple coin model from CGTrader.com. This is the specific model I am using.

Once downloaded, I brought the model into my project. I then created a simple float animation, as well as gave my coin some simple VFX.

With that setup, we can now go about implementing the functionality.

Functionality

First, I went ahead and created some text UI so we can see the count increase when our player collects a coin.

Next, I simply re-used some code I built before when prototyping my 2.5D game. This is the UIManager Code I am reusing:

In my Player class, I added a private int variable named _coins to keep track of the coins the player currently has. I also created this method below:

This script is called in my CoinController class, which is attached to each coin GameObject.

CoinController script

This gave me the result we see here:

That’s all for today! Thank you for reading! In the next article, I will create a ladder system.

--

--

--

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

Recommended from Medium

Game Jamming on a Quantum Computer

5 Disruptive Technologies using IoT in the Farm

Invitation To SkillFront 5 Day Sprint, SkillFront Scrum Masterclass Live

Invitation To SkillFront 5 Day Sprint, SkillFront Scrum Masterclass Live

Introducing LinkHub App

My Skillz & Values

Why Foreign Key Constraints Are Not Optional

The Top Advantages and Disadvantages of Cloud Computing

Enemy Health System Using Interfaces in Unity

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
Gabe Gomez

Gabe Gomez

More from Medium

Platformer: Box Push

Day 98: Character Animation Part 1

Bug Fix on Model Flip

C# scripting in Unity — Day 01