- Home /
Load level with 0 health help.
When the players life is 0, they are taken back to the main menu. But when I restart the game from that menu the player has 0 health and stuck in a game over loop. Is there anyhing I can do to change this?
Below is the game I used.
var health100 : Texture2D; //full health
var health95 : Texture2D; //nineteen lives left var health90 : Texture2D; //eightteen lives left var health85 : Texture2D; //seventeen lives left var health80 : Texture2D; //sixteen lives left var health75 : Texture2D; //fifteen lives left var health70 : Texture2D; //fourteen lives left var health65 : Texture2D; //thirteen lives left var health60 : Texture2D; //twelve lives left var health55 : Texture2D; //eleven lives left var health50 : Texture2D; //ten lives left var health45 : Texture2D; //nine lives left var health40 : Texture2D; //eight lives left var health35 : Texture2D; //seven lives left var health30 : Texture2D; //six lives left var health25 : Texture2D; //five lives left var health20 : Texture2D; //four lives left var health15 : Texture2D; //three lives left var health10 : Texture2D; //two lives left var health5 : Texture2D; //one lives left var health0 : Texture2D; //no lives left
static var LIVES = 21;
function Update () { switch(LIVES) { case 21: guiTexture.texture = health100; break;
case 20:
guiTexture.texture = health95;
break;
case 19:
guiTexture.texture = health90;
break;
case 18:
guiTexture.texture = health85;
break;
case 17:
guiTexture.texture = health80;
break;
case 16:
guiTexture.texture = health75;
break;
case 15:
guiTexture.texture = health70;
break;
case 14:
guiTexture.texture = health65;
break;
case 13:
guiTexture.texture = health60;
break;
case 12:
guiTexture.texture = health55;
break;
case 11:
guiTexture.texture = health50;
break;
case 10:
guiTexture.texture = health45;
break;
case 9:
guiTexture.texture = health40;
break;
case 8:
guiTexture.texture = health35;
break;
case 7:
guiTexture.texture = health30;
break;
case 6:
guiTexture.texture = health25;
break;
case 5:
guiTexture.texture = health20;
break;
case 4:
guiTexture.texture = health15;
break;
case 3:
guiTexture.texture = health10;
break;
case 2:
guiTexture.texture = health5;
break;
case 1:
guiTexture.texture = health0;
Application.LoadLevel (0);
break;
}
}
Answer by Eli-Davis · May 22, 2011 at 03:56 PM
When you get to case 1, reset the health to 100. then have it load the main menu. I'd think that would work.
Your answer

Follow this Question
Related Questions
How to Make a "Kill Platform"? 1 Answer
PlayerHealth drops fast and wont reset 1 Answer
Death scene/screen on player Health Script Wont work! 0 Answers
How to make heart health system? 3 Answers
Lower Object Health If Collides With "Player" Tag,Lower Object Health If Collides With Player Tag 1 Answer