So I have an DamageActor that will move for a specific amount of time, and then remove itself from the world. However, I can't see to figure that out. I followed the information on this discussion: http://www.greenfoot.org/topics/1462 but it didn't seem to work.
Here's my code:
I keep getting a NullPointerException.
Other note: I'm testing my code using a DamageActor subclass.
public void act()
{
if(getWorld() == null)
return;
if(isFlipped)
moveLeft();
else
moveRight();
update();
}
public void update()
{
myDistance--;
if(myDistance <= 0)
{
removeSelf();
return;
}
}
public void removeSelf()
{
myWorld.removeObject(this);
}

