I am new to Unity3d and I’m making a game called “The Capsules”. I have a health system that I made but I can’t make a respawn system. I just want a simple code that makes me respawn after my health hits 0. ![]()
My heath code:
var curHealth : int = 100;
var maxHealth : int = 100;
var healthtext : GUIText;
function Start () {
healthRegen();
}
function Update () {
healthtext.text = curHealth + " / " + maxHealth;
if(curHealth < 0 ) {
curHealth = 0;
}
if(curHealth > 100) {
curHealth = 100;
}
if(Input.GetKeyDown(“e”)) {
curHealth -= 1;
}
}
function healthRegen () {
for(i=1;i>0;i++) {
yield WaitForSeconds(2.5);
if(curHealth < maxHealth) {
curHealth++;
}
}
}
…sorry, I know it is long. Please, I know I’m a noob. ![]()
~Max
this question is exactly the same as every other question with 'respawn' as a tag
– Loius