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

2017/1/24

HELP ! confused on error message

rnb262 rnb262

2017/1/24

#
currently running through an example in my book and i am continuing to get an error saying class , interface or enum import greenfoot.*; /** * This class defines a crab. Crabs live on the beach. */ public class Crab extends Actor { public void act() { turnAtEdge(); randomTurn(); move(5); lookForWorm(); } } /** * Check whether we have stumbled upon a worm. * If we have, eat it. If not, do nothing. */ public void lookForWorm()) { if ( isTouching(Worm.class )) { removeToucing(Worm.class); } } /** * Crab randomly turns * -45 to 45 degrees */ public void randomTurn() { if ( Greenfoot.getRandomNumber(100)<10)// Add your action code here { turn(Greenfoot.getRandomNumber(90)-45); } } /** * Crab checks if it is at edge * If correct, turns. If not, move forward. */ public void turnAtEdge() { if ( isAtEdge()) { turn(17); } }
danpost danpost

2017/1/24

#
You have the class ending right after the act method. Everything else below needs to be moved up inside the class.
You need to login to post a reply.