hello
i have made a script for the health of my player.
but i can’t make a script for te damage can you help me please
this my script
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 -= 10;
}
}
function healthRegen ()
{
for(i=1;i>0;i++)
{
yield WaitForSeconds(0.5);
if(curHealth < maxHealth)
{
curHealth++;
}
}
}