Jillis wrote...
Thanks dan for your help. And yes, I commented out those lines, and the healthbar executed once on each startup.
public void act()
{
String key = Greenfoot.getKey();
if (Greenfoot.isKeyDown("a"))
{
setRotation(180);
if (GetObjectInFront(Wall.class)==null)
move(10);
}
if (Greenfoot.isKeyDown("d"))
{
setRotation(0);
if (GetObjectInFront(Wall.class)==null)
move(10);
}
if (Greenfoot.isKeyDown("w"))
{
setRotation(270);
if (GetObjectInFront(Wall.class)==null)
move(10);
}
if (Greenfoot.isKeyDown("s"))
{
setRotation(90);
if (GetObjectInFront(Wall.class)==null)
move(10);
}
if ("left".equals(key))
{
setRotation(180);
fire();
}
if ("right".equals(key))
{
setRotation(0);
fire();
}
if ("down".equals(key))
{
setRotation(90);
fire();
}
if ("up".equals(key))
{
setRotation(270);
fire();
}
}//after line 47 hitEnemy();