Hey,
I want to make an object disappear when I walk past a lever. But it the object has to appear again when I'm away from the lever.
Apart from that how does the methode "delay" work? How do I use this methode without freezing the whole game for a moment.
Schalter = lever
Thanks ;)
public int status = 1;
public void act()
{
falle();
}
public boolean schalterAktiviert(){
Actor unter = getOneObjectAtOffset(0, getImage().getHeight(), Siggi.class);
return unter != null;
}
public void falle(){
if(schalterAktiviert() && status == 1){
getWorld().removeObjects(getWorld().getObjects(FalleZacken.class));
status = 2;
Greenfoot.delay(100);
}
else if (schalterAktiviert() && status == 2){
getWorld().addObject(new FalleZacken(), 400, 510);
status = 1;
}
}
