I was wondering if anyone could help me out with this.
I want the player character to slowly regenerate lost hit points (health) over time, I’m currently using the FPSPlayer script from the FPS tutorial, if someone could point me towards how to do this, it would be much appreciated.
Thanks.
tonyd
November 8, 2009, 2:12am
2
I haven’t done the FPS tutorial, but you can try to figure out what variable contains health, and add a tiny amount each update call.
Something like:
function Update(){
if (health < maxHealth){
health += .001 * Time.deltaTime;
if (health > maxHealth) health = maxHealth;
}
}
Cheers, I’ll play around with it and see what I can do
if you are using the FPSPlayer this is what you should have.
function Update(){
if (hitPoints < maximumHitPoints){
hitPoints += .4 * Time.deltaTime;
if (hitPoints > maximumHitPoints) hitPoints = maximumHitPoints;
}
}
you can change the .4 to what ever value you would like.
if you are using the FPSPlayer this is what you should have.
function Update(){
if (hitPoints < maximumHitPoints){
hitPoints += .4 * Time.deltaTime;
if (hitPoints > maximumHitPoints) hitPoints = maximumHitPoints;
}
}
you can change the .4 to what ever value you would like.
Yeah, I’d already used tonyd’s code and changed the names of the variables and such. But thanks anyway, I really do appreciate it