This site requires JavaScript, please enable it in your browser!
Greenfoot back

Report as inappropriate.

joel presents ...



this is my frist game and i dont know the command to finish to player game. i need help

3052 views / 553 in the last 7 days

1 vote | 0 in the last 7 days

Tags: with-source

open in greenfoot
Your browser does not support the canvas tag.


use right and left arrow keys to move the upper crab and use ''A'' and ''D'' keys to move the second crab.


hi every one how can i make the game stop when the both crabs are eaten? need help thank you


To stop the game you should use Greenfoot.stop(). It's like pressing the run button again. To Count how many crabs are in the game you can use the getObjects method of the world. You can add this method to the world: public void stopWhenCrabsAreEaten(){ if(getObjects(Crab.class).size()==0) Greenfoot.stop(); } Then you have only to add the act method into the world, if you hadn't done this already. public void act(){ stopWhenCrabsAreEaten(); } I hope I was able to help you :)

Want to leave a comment? You must first log in.

Who likes this?