- Home /
The question is answered, right answer was accepted
How do I make a respawn system?
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
Answer by GamingNewBie · Apr 17, 2013 at 01:14 PM
Honestly i do not understand what actually you are trying to say. If you are looking to respawn or instantiate a game object, look into the following Url. http://docs.unity3d.com/Documentation/ScriptReference/Object.Instantiate.html Please explain your problem a bit more, so people here can help.
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Error in distance coding 1 Answer
Whats Wrong with my code? 1 Answer
help with character respawn after death (javascript) 1 Answer
Pause Button Help 2 Answers