Creating a Collectible Coin
Objective: Create a coin collectible for my 2.5D game.
Animation and VFX
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.
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.
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.