joy of code lesson 5 which does not work
Joy of code tutorial 5 - problems with getOneObjectAtOffset(
I have downloaded the latest version of Greenfoot and am following the joy of code video tutorials
But I the zip file trick the turtle scenario I down loaded shows errors on opening. And crashes when using getOneObjectAtOffset
Others at my school with older versions of Greenfoot do not have this problem.
The scenario will run but as soon as I use getOneObjectAtOffset method as told to do in tutorial 5 it crashes.
Can anyone advise what to do?
Thanks
Michael
THIS IS A COPY OF THE TERMINAL WINDOW ERROR
java.lang.NoSuchMethodError: Animal.getOneObjectAtOffset(IILjava/lang/Class;)Lgreenfoot/Actor;
at Animal.canSee(Animal.java:32)
at Turtle.act(Turtle.java:8)
at greenfoot.core.Simulation.actActor(Simulation.java:594)
at greenfoot.core.Simulation.runOneLoop(Simulation.java:552)
at greenfoot.core.Simulation.runContent(Simulation.java:215)
at greenfoot.core.Simulation.run(Simulation.java:205)
Can anyone tell me what code to use instead of this?
1 2 3 4 5 6 7 8 9 | /** * Return true if we can see an object of class 'clss' right where we are. * False if there is no such object here. */ public boolean canSee(Class clss) { Actor actor = getOneObjectAtOffset( 0 , 0 , clss); return actor != null ; } |