I'm trying to remove a moving object every time I click on it, but it stops the game every time I click on the object(after it's been removed). Do any of you know why this is happening?
This is my code for that method:
public void removeM()
{
if(Greenfoot.mouseClicked(this))
{
getWorld().removeObject(this);
}
}