So here is my code:
private boolean countDown = true;
private boolean invisible = true;
private int counter = 300;
private int trans = 0;
GreenfootImage img = new GreenfootImage("beeper.png");
public Mine()
{
}
public void act()
{
explode();
}
public void explode()
{
if(invisible){
img.setTransparency(trans);
}else{
img.setTransparency(255);
}
Actor p = getOneObjectAtOffset(0, 0, Pacman.class);
if(p != null){
countDown = true;
invisible = false;
}
if(countDown){
counter = counter - 1;
}
if(counter == 0){
getWorld().addObject(new Explosion(), getX(), getY());
getWorld().removeObject(this);
}
}
I want to make it so that the countDown boolean stays true even after the mine and the pacman aren't touching anymore. Help please :(

