roodNode Multiple file access

Hi,



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



Main.java ← SoundSystem.java

(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?



Thanks,

Tom

www.javabeginner.com ? 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 SoundSystem.java, 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]



and



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