public class Enemy2 extends Enemy
{
int timesHit=2;
/**
* Act - do whatever the Enemy2 wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
moveEnemy();
removeEnemy();
hitByProjectile();
}
public void hitByProjectile()
{
Actor projectile = getOneIntersectingObject(Projectile.class);
if (projectile != null)
{
getWorld().removeObject(projectile);
timesHit--;
}
if (timesHit == 0)
{
getWorld().removeObject(this);
}
}
}
I'm making a side-scrolling space invaders game and this error keeps showing up when the enemy touches the bottom of my world. The error says it happens on both line 20 and 24. It would be greatly appreciated if someone could help me with this.

