This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Game Development and the fly likes Having serious issues trying to use ArrayList<Spatial> in JMonkeyEngine 3 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Game Development
Bookmark "Having serious issues trying to use ArrayList<Spatial> in JMonkeyEngine 3" Watch "Having serious issues trying to use ArrayList<Spatial> in JMonkeyEngine 3" New topic
Author

Having serious issues trying to use ArrayList<Spatial> in JMonkeyEngine 3

Brian Perry
Greenhorn

Joined: Sep 03, 2013
Posts: 1
Hello,
I'm trying to use JMonkeyEngine's SDK to develop a game from a book called JMonkeyEngine for beginners. I'm working on trying to trying to create an arraylist<spatial> created in an abstract application class. The class creates 6 spatials named creeps. The creeps have index and health user-data attached to them. I have special methods in the abtract app class that creates and attaches each creep one by one with user data. I have a special class besides the abstract app state called CreepControl that defines the behavior of each creep. The problem is that when I try to access the ArrayList<spatial> of the list of creeps in a node called creepNode from my CreepControl class, JMonkeyEngine is scene node based and creepNode is attached to rootNode, I get a null pointer exception. I'm sure I'm using ArrayList wrong somehow. When I create a dummy arraylist in the CreepControl class, I don't get a null pointer exception. Its only when I try to call is using gamePlayAppState.creepNode.getChildren();. I'm stuck on this. The game runs when I take out the call for the arraylist from gamePlayAppState.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Having serious issues trying to use ArrayList<Spatial> in JMonkeyEngine 3