Multiple classes with simpleUpdate

I have three classes; a Main, the Ship and the weapon bullet. I only extend SimpleApplication on the Main class but I need to have a simpleUpdate method in the weapon which makes it constantly move forward. Do I have to extend and import SimpleApplication on the bullet class or is there another way (apart from using a line of code in the simpleUpdate of the main class that keeps calling a method in the bullet class).
Thanks in advance!

Use a control (or AbstractControl) that you add on the bullet spatial.
https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:advanced:custom_controls

I would just make an update method in your weapon bullet class and call that from the update method in your game.

I don’t understand how to use the AbstractControl or Control, could you explain please?

https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:advanced:custom_controls

You don’t have to use controls in your game if you don’t want to. What I do is have “actors” which are classes that contain the spatial and other information about the game object, as well as perform updates and AI and everything else.

<cite>@8Keep123 said:</cite> https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:advanced:custom_controls

You don’t have to use controls in your game if you don’t want to. What I do is have “actors” which are classes that contain the spatial and other information about the game object, as well as perform updates and AI and everything else.

Do you think you could give me an example? :slight_smile:

Just read the tutorial - plenty of examples in there.

Attach a control to a spatial in the scene graph and the control update method gets called each frame…

…not complicated.

Ahh thanks so much i got it working :slight_smile: