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

2020/6/24

Illegal start of expression

Salllm Salllm

2020/6/24

#
I am working on the crab game and i have to make my crabs look for worms. I have an error at “public void lookForWorm()” and the error says “illegal start of expression”. What do i have to do? This is what i have public void act() { If ( isAtEdge() ) { turn(45); If ( Greenfoot.getRandomNumber(100) < 10 ) { turn(15); } move(5); lookForWorm(); public void lookForWorm() { if ( isTouching(Worm.class) ) { removeTouching(Worm.Class); }
Super_Hippo Super_Hippo

2020/6/24

#
You need to end the act method with } before starting the next method. You also need to end your if-blocks like that.
You need to login to post a reply.