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 :)
@ Gevater_Tod4711: Yes you are right, I am trying to fix that.
@Jet_Lennit: Maybe your cables aren't updated. That happens if you connect an activated switch with a gate. I will fix that, but that's the only way I am able to explain your message. For me it works fine.
It is really nice to have a Story here. Maybe you can make you worlds unbordered, so that it seems, that the player falls out of the world, when he is falling down. Then you could make an auto reset, so that the player hasn't to press enter. Good job!
2013/9/15
little-crab
2013/9/15
Enscathe (Build 2.0)
2013/9/14
CombinatorialCircuitEditor
2013/9/14
CombinatorialCircuitEditor
2013/9/14
Paintshop
2013/9/13
Enscathe (Build 2.0)
2013/9/12
Labyrinth
2013/9/11
World Wrapping
2013/9/11
World Wrapping