I have this first code build on to my player im wanting to make it so the player has a set amount of respaws. Once the player has reached that amount of respawns the game will load game over.
function Die(){
//play death sound if it exists
if(deathSound)
{
audio.clip = deathSound;
audio.Play();
}
print("dead!");
playerController.isControllable = false;
animationState = GetComponent(Widget_Animation);
animationState.PlayDie();
yield WaitForSeconds(animation["Die"].length -0.2);
HideCharacter();
yield WaitForSeconds(1);
//restart player at last respawn check point and give max life
if(CheckPoint.isActivePt){
controller.transform.position = CheckPoint.isActivePt.transform.position;
controller.transform.position.y += 0.5; //so not to get stuck in the platform itself
}
ShowCharacter();
health = maxHealth;
I would like to make it so that it shows on screen with this some how.
GUI.Label (Rect (25, 25, 100, 30), "Life: "+Life);
That works thanks now I just have to find out why each time I get killed the bunnies are killing me another 4-7 time during the play dead code.
– anon70884200Ok thanks
– anon70884200