new to Java here but i have been experimenting...
I am trying to achieve this in Greenfoot: I want to have a mouse click on an object (Actor) and it disappears from the world. This is my code so far:
public void act()
{
disappear();
}
public void disappear(){
if(Greenfoot.mouseClicked(this)){
getWorld().removeObject(this);
}
}
From my understanding, when the mouse is clicked, then it will remove the object from the world... but the object still doesn't disappear, what am i missing here?
Many thanks!