Game Framework in JMonkey

Hi, I’m begining to work in a Game, after being able to load models in JMonkey successfuly, I have a new Question, I have been programming beta games with other framework in java, that haves an Actor class to create a new classes extends from it to implement the update method and other, and the framework manage it as if it was of Actor class. The challenge that I have with jmonkey is how to implement a framework to manage Actors. I try to extends from Spatial class but when I try this code



public class Actor extends Spatial {







}



in main



Actor a = (Actor)assetManager.loadModel(“Models/mod/mod.j3o”);



in the run is appear an error saying “cant cast Spatial to Actor”



So, and need some tips to implement a Game or if somebody can show me an example of a simple game to start from it.



Thanks.

Bye.

Read the tutorials, particularly the sections on controls, the update loop, etc.

It’s probably worth separating out the Actor from a Spatial, and let the spatial just be the “view” of the Actor on the scene graph. You can link the two with an ID in UserData on the spatial. This way you can easily swap out, remove, change models for actors.

Thanks you for all, I try using Custom Control and work fine in code. Other question that I have after using SceneComposer is, when I make a new class extends from AbstractControl and implement it, when I try to add it to a mesh the SceneComposser show me a message saying “cannot find class: xxxxx make sure the name is correct and the project is compiled, best enable ‘Save on compile’…” the “Compile on save” option is active. This problem was solved when I restart the JMonkeySDK, but when I make a new class control, I must to restart the JMonkey to can use it. Other problem with this is when I make any change in the control class, no update the one asigned to the mesh in SceneComposser, in this persist the behavior of the control before I make any change.



Thanks.

Bye.