So I try to create a small Zombie-Shooter game. I use a GTurtle class from ACM package (jtf.acm.org). I have additional thread for a GTurtle, which is a GObject. I have a run method with while loop, that is checking if boolean is true, if it is - this.forward() method gets executed.

I tried running game and pressing button, if it is W or D, boolean in GTurtle object gets changed and Thread executes action. Then I get this exception:

java.lang.NullPointerException
at java.util.Hashtable.put(Hashtable.java:394)
at acm.util.JTFTools.pause(JTFTools.java)
at acm.util.Animator.delay(Animator.java)
at acm.graphics.GTurtle.setLocation(GTurtle.java)
at acm.graphics.GObject.move(GObject.java)
at acm.graphics.GTurtle.move(GTurtle.java)
at acm.graphics.GObject.movePolar(GObject.java)
at acm.graphics.GTurtle.forward(GTurtle.java)
at anotherTryJava.Player.run(Player.java:20)
at java.lang.Thread.run(Thread.java:662)

It's interesting to see that your quote is an exact copypaste from my answer's source.
–
BalusCApr 4 '11 at 21:29

1

shameless copy paste of ONLY the javadoc quote part @BalusC, i admit. to my avail, was to avoid copying/trimming it all over again from oracle website. if i could +1 you for the work on that i would!
–
sminkApr 4 '11 at 21:53

I solved the problem by changing logic of the game. I used variables for location X and Y, and created method to do a step. Thanks for the answer. I found some new things on Hashtabels.
–
XeosApr 8 '11 at 21:12