My crab, in my case Nyan Cat ignores the enemies if it gets touched. Nothing happens it's like the lobsters are just moving Images. But it works with the non-moving enemies if it touches them the game stops as expected.
What's wrong with my Lobsters do you got any ideas? Here is the code of my Lobsters,Crab and a non-moving enemie. Some words are german. ^^
That's the Lobsters
Thats's the Crab/Nyan Cats:
And the one of the non-moving object which is the same but works:
public void act() { move(-7); if (atWorldEdge()){ turn (17) ; } int Zufallz = Greenfoot.getRandomNumber (100); if (Greenfoot.getRandomNumber (100)<5) if (Zufallz <5) { turn (45); turn (45) ; } } public void LookForCrab() { if (canSee(Crab.class)) { eat(Crab.class); Greenfoot.stop () ; } }
public void LookForLobster () { if (canSee (Lobster.class)) { Actor Lobster=sees (Actor.class) ; GreenfootSound ton=new GreenfootSound ("smb_mariodie.wav") ; ton.play () ; Greenfoot.stop () ; } }
public void lookForEvilShroom () { if (canSee(EvilShroom.class)){ Actor EvilShroom=sees (Actor.class); GreenfootSound ton=new GreenfootSound ("smb_mariodie.wav") ; ton.play () ; EvilShroom.setLocation( Greenfoot.getRandomNumber (450 ), Greenfoot.getRandomNumber (450)); Greenfoot.stop () ; } }