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

2017/6/26

Error in Class

Gugeek Gugeek

2017/6/26

#
message reads "Class has to be compiled to set breakpoints". Please help, public class Crab extends Actor { /** * Act - do whatever the Crab wants to do. This method is called whenever * the 'Act' or 'Run' button gets pressed in the environment. */ public void act() { move(4); if (Greenfoot.isKeyDown("left")) { turn(-3); } if (Greenfoot.isKeyDown("right")) { turn(3); } } (error shows here)
danpost danpost

2017/6/26

#
That error message should not show unless you press 'Ctrl-B' or click on the line numbering somewhere. Try moving the cursor to the last line, move right until just passed to closing bracket ( '{' ) and hitting the delete key until the system beeps (telling you there is nothing more to delete there). Then compile and try again.
Gugeek Gugeek

2017/6/27

#
Thanks. I did everything you told but it doesn't change anything. Nice to know about any hidden items to delete. Any other help. I repaste the whole edition. import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) public class Crab extends Actor { /** * Act - do whatever the Crab wants to do. This method is called whenever * the 'Act' or 'Run' button gets pressed in the environment. */ public void act() { move(4); if (Greenfoot.isKeyDown("left")) { turn(-3); } if (Greenfoot.isKeyDown("right")) { turn(3); } }
danpost danpost

2017/6/27

#
Are you missing the squiggly bracket that closes out the class? In nether code posting do I see the last one.
Gugeek Gugeek

2017/6/27

#
Thank you so much! I tried the squiggly bracket and it worked. I appreciate your help.
You need to login to post a reply.