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

2013/3/10

cannot find symbol method canSee

sfr123 sfr123

2013/3/10

#
Hi, I'm new to greenfoot and I'm trying to program a turtle to eat lettuce. But when I press compile it gives me the message "cannot find symbol method canSee." I don't see why it cant find the method. If someone could explain all this to me that would be nice. public class turtle extends animal { /** * Act - do whatever the turtle wants to do. This method is called whenever * the 'Act' or 'Run' button gets pressed in the environment. */ public void act() { move(4); trytoEatLeaf(); } public void trytoEatLeaf() { if (canSee (leaf.class) ) { eat(leaf.class); } }}
danpost danpost

2013/3/11

#
Change the first line to the following and try again.
public class turtle extends Animal
sfr123 sfr123

2013/3/11

#
Now it says "cannot find symbol class Animal."
danpost danpost

2013/3/11

#
Did you import the Animal class into your scenario? On the menubar, click on Edit>Import class..., choose Animal and click Import.
You need to login to post a reply.