roodNode Multiple file access


i’ve tried to set up my game as the following sheme: ←

(The terrain…) (Set up the sounds)

Now i want to attach the sounds from the SoundSystem File to the rootNode from the Main. I can’t access the rootNode from the game. And i’ll also have to access the assetManager from the Main. Any ideas?


Tom ? Its pretty basic object oriented programming stuff you’re asking for really. Just pass the application reference to your other objects.

You should add some code examples to clarify what you want to do.

If you want to access the rootNode and the assetManager in, you have to create a reference there and when you initialize the Sound-class, make sure the reference is created.

Okay, thanks it works, my solution:

[java]SoundSystem mysound = new SoundSystem(this.rootNode, this.assetManager);[/java]


[java]public SoundSystem (Node rootNode, AssetManager assetManager) { … }[/java]