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

2016/9/19

unable to compile

kaushic kaushic

2016/9/19

#
public class aligator extends Actor { /** * Act - do whatever the aligator wants to do. This method is called whenever * the 'Act' or 'Run' button gets pressed in the environment. */ public void act() { if(Greenfoot.isKeyDown("A")) { move(4); } if(Greenfoot.isKeyDown("B")) { move(-4); } if(Greenfoot.isKeyDown("c")) { turn(4); } if(Greenfoot.isKeyDown("D")) { turn(-4); } { if(canSee(hamburger.class)) { eat(Hamburger.class); } }
danpost danpost

2016/9/19

#
There are no 'canSee' and 'eat' methods in the Actor class. Use 'isTouching' and 'removeTouching', which are part of the Actor class.
You need to login to post a reply.