Okay following problem I have got this space invasion game and there is supposed to be this one final enemy and he is supposed to have like three lives. But he just doesn't die and I can't find why... I can shoot him as often as I want...
Please help me! What's the problem with those codes?
import greenfoot.*;
/**
*
*
*/
public class BossEnemy extends Animal
{
int Counter = 3;
/**
* Act - do whatever the BossEnemy wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
if (canSee(Bullet.class))
{
Counter--;
eat(Bullet.class);
}
if (Counter == 0)
{
getWorld().removeObject(this);
}
if (canSee(EnemyRocket.class))
{
eat(EnemyRocket.class);
getWorld().addObject(new EnemyRocket(), Greenfoot.getRandomNumber(800),Greenfoot.getRandomNumber(170));
}
}
}
