i want to create a hack and slash game like Diabolo or Torchlight but very simple because it’s my first own project with the jme after i read the beginners guide book.
My problem is that i become a null pointer exception when i click on the ground to move my character.
The link opens my project hostet at gitlab: My Game.
After debugging the code i found that the exception throwed here Exception.
I didn’t found any solution for my problem at google or in this forum so i would be happy if anybody has some ideas what i can do.
The Exception-link does not work.
Could you post the code that is executed when you click on the ground to move your character?
That would be better than making everyone crawl through your project directorys and files.
Just guessing now, but if
[java]System.out.println("X: " + clickPos.getX()
+ " Y: " + clickPos.getY());[/java]
works, then the thing in line 66 that could be the cause for the exception is
[java]cam.getWorldCoordinates([/java]
Maybe your camera is null?
I have never used appStates but why don’t you just use a setter for the camera?
Somewhere you extend a SimpleApplication, right?
Just set the Camera of your PlayerState there. Or you can just give the camera to the state as a parameter in the constructor.
If that’s the problem, this is very basic stuff.