I want to display a message when you run out of clicks and can no longer add a ball in the world. I want it to briefly appear and then disappear. The message I am referring to is message3 but it won't disappear with this code. Thanks in advance!
public void gameEnd()
{
Message message= new Message("Gameover! You ran out of time!");
Message message2= new Message("Final Score: " + score.getPoints());
Message message3= new Message("You ran out of clicks!");
if (time.getPoints()==0)
{
Greenfoot.stop();
addObject(message, getWidth()/2, getHeight()/2-20);
addObject(message2, getWidth()/2, getHeight()/2+20);
}
if (clicks.getPoints()==0 && clickMessageTime <=20)
{
clickMessageTime++;
addObject(message3, getWidth()/2, getHeight()/2);
if (clickMessageTime>=20)
{
removeObject(message3);
}
}
}

