Hi!
It's me again.I don't understand why my code for my game doesn't work.In my game there are two actors called
Frosch and Snake.I want the snake to eat the Frosch and after the snake eats the frog to show a gamover and tryagain text
and remove the snake too.I tried this code in the snake classBut my problem is that the snake doesn't disappear.
Could you please help me? I'm just a beginner in greenfoot.
Thank you!
Fifilein
Actor getFrosch = getOneIntersectingObject (Frosch.class);
if (getFrosch != null)
{
World myWorld = getWorld();
GameOver gameover = new GameOver();
myWorld.addObject(gameover, myWorld.getWidth()/2, myWorld.getHeight()/2);
TryAgain tryagain = new TryAgain();
myWorld.addObject(tryagain, 300, 300);
myWorld.removeObject(getFrosch);
myWorld.removeObject(this);
}
