Hey guys,
I have to create a game with Greenfoot for school. It's about a cat which has to catch birds to get through a meadow to finally bring a cookie monster a cookie. I'm pretty far with that game but now I need an command. This command should cause that when the cat ate a bird (in game named Börd) a randomly choosen wall (in game named Wand) should disappear. I tried to do this with a for-loop, but no syntax errors were shown and also the command didn't work. Could you tell me what I've done wrong?
My command was:
/**
* Act - do whatever the Cooookieee wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
Wand aktWand = (Wand)this.getOneObjectAtOffset(0, 0, Wand.class);
if (BördAufFeld () == true)
{
BördAufnehmen ();
for (int Zauber=0; Zauber<Greenfoot.getRandomNumber (40); Zauber++)
{
getWorld().removeObject(aktWand);
}
}
Cooookieee is the cat in the game.
BördAufnehmen means that the cat eats the bird.
BörAufFeld means that a bird is on the cat's field.
Zauber just is a variable.
I'm very grateful for all your help.
Greetings
Kutariyo

