Hello, iI'm making a 3D game and I want when enemy's life reaches 0 this disappear and respanw in the same area where started when the game starts.
Here I put the script of life
Thank you
1 var saludActual=100; var
saludMaxima=100.00;
var largoBarra=0.0;
5
function Start () {
largoBarra=Screen.width/10; }
10 function Update () { AjustarSalud(0);
}
function OnGUI() { GUI.Box(new
15 Rect(1150,30,largoBarra,20),saludActual+'/'+saludMaxima);
}
function AjustarSalud(salud) {
20 saludActual+=salud;
if(saludActual<0) {
25 saludActual=0; }
if(saludActual>saludMaxima) {
saludActual=saludMaxima; }
30 if(saludMaxima<1){ saludMaxima=1;
}
largoBarra=(Screen.width/10)*saludActual/saludMaxima;
35
}
↧