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

2016/1/7

Joy of Code tutorial 5 - problems with getOneObjectAtOffset

michaelxhermes michaelxhermes

2016/1/7

#
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
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;       
  }
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?
davmac davmac

2016/1/7

#
Just to be clear, when you say you have "the latest version of Greenfoot", which actual version is that? The latest version is 3.0.2, and I don't think it should have this problem. (If you have 3.0.2 and are still seeing this, I think we've got a bug to fix).
michaelxhermes michaelxhermes

2016/1/7

#
Thanks Dave The version I have is 3.0.1 (Java version 1.8.0_66) I downloaded this a few weeks ago,, I will try to download and install the 3.0.2 version now and get back to you ta Michael
michaelxhermes michaelxhermes

2016/1/7

#
The latest version works fine! Your prompt reply and assistance is much appreciated. Michael
You need to login to post a reply.