Everything is compiled and in theory, should work but it doesn't. Can anyone help me?
public class Player extends Actor
{
boolean touchingEnemy = false;
/**
* Act - do whatever the Player wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
move(5);
hitEnemy();
}
public void hitEnemy()
{
Actor enemy = getOneIntersectingObject(Enemy.class);
if(enemy != null)
{
World myWorld = getWorld();
Earth earth = (Earth)myWorld;
HealthBar healthbar = earth.getHealthBar();
if(touchingEnemy == false)
{
healthbar.loseHealth();
touchingEnemy = true;
if(healthbar.health <=0)
{
myWorld.removeObject(this);
}
}
}
else
{
touchingEnemy = false;
}
}
}

