In my Game, I want to decrease the actor's health as time goes by.
How do i do this?
Could anyone post the code?
int health = 100;
int time = 0;
public void decreaseHealth(){
time ++;
if(time >= 10 /*You can change this*/ && health > 0){
health = health - 1;
time = 0;
}
}private int health= 500;
public void act()
{
exist();
}
private void exist()
{
health--;
if (health == 0) getWorld().removeObject(this);
}