2.5D Platformer — Collectables and Lives #4
Don’t die while collecting coins throughout your journey!
It’s quite typical (and basic) to see lives and some sort of collectables in platformers. Classic, if I do say so myself. And even now, beginners start by implementing these mechanics into their learning projects.
This is a requirement for my project, and given my experience, this took mere minutes to set up.
Collectables / Coins
Collectables are just small (or big) items with no collision. However, they use Trigger colliders to allow a character to pick them up without being stopped as a physical force. Once the collectable is picked up, in my project, it will increase the number of picked up collectables or coins, and then, it will destroy itself.
You only live once, or cheat death with multiple lives. As a basic platformer, the player will have 3 chances to not screw up.
So, what exactly will kill the player? For now, some OOB (Out-of-Bounds) triggers. If the player misses a jump and falls to the void, it will make contact with those triggers, remove 1 live, and respawn the player at a checkpoint.
And how does the Checkpoints work? Exactly like the Death Trigger, but this time, it sets in the controller the last checkpoint reached.