- Home /
Character Lives?
I'm making a 2.5D game, like Mario. I want to give my character lives. How? All answers appreciated.
Answer by Ipsquiggle · Apr 01, 2012 at 10:10 PM
The easiest way is to simple have a "lives" variable on your player character.
Put this at the top of his script:
var lives : int;
Set the value of this in the editor (to something like 3).
Then, each time he dies, do something like this:
lives -= 1;
if ( lives > 0 )
{
// Respawn the character
}
else
{
// Game over! Quit the level or something
}
You will, of course, have to decide what actually happens during the Respawn and Game Over scenarios, but this will make it choose the right scenario depending on how many lives the player has.
Answer by kkyriakos · Oct 11, 2016 at 07:59 PM
There are lots of cheap plugins out there that will help integrate lives in your game very easily. I recommend "Life System Pro - Easy Lives Integration for Freemium Games" found here https://www.assetstore.unity3d.com/en/#!/content/69842
Your answer
Follow this Question
Related Questions
character movement and animation 1 Answer
Importing Animations to Unity from maya! 1 Answer
Simple character rotation 1 Answer
Animations 0 Answers