so Im having problems turning my "touched" statement true I dont know where I should put it, wherever I put it it says it cant be boolean and its odd anyways I was wondering if someone could turn it true when he makes contact with actor ninja heres all the coding in the "good" class which stands for good barrel
please and thank you!
public class good extends barrels
{
public boolean touched;
private int life = 25;
private GreenfootImage explode = new GreenfootImage("explode.png");
public void act()
{
Healup();
if(life <= 0) {
getWorld().removeObject(this);
{
if(isTouched);
life--;
}
}
}
public void Healup()
{
Ninja ninja = (Ninja) getOneIntersectingObject(Ninja.class);
if (ninja != null){
Floor bg = (Floor) getWorld();
bg.bar.add(5);
setImage(explode);
getImage();
bg.goodbarrel--;
}
}
public boolean isTouched()
{
return touched;
}
}

