Simple Beginner Question

Hey guys,



I have a little beginner question:



I have the following classes:

  • mygame.Main and
  • mygame.player.Player



    Main extends SimpleApplication. My player is just a little box, but i want to give it a material.

    I’m using this code for that:

    [java]Material mat1 = new Material(assetManager, “Common/MatDefs/Misc/SolidColor.j3md”);[/java]



    Now, how can i access the assetManager from my Player class, which doesn’t extend SimpleApplictaion?



    I hope you can understand my problem.



    monsterbit

For example, you can pass the assetManager to the player in the Player constructor.

  1. Contructor;:



    Player(AssetManager manager) {

    //code

    }


  2. If you want to build serious games take a look at public/private/protected final/static after this I would build a helper class (Toolset for example) and put everything you need to access from everywhere in this class as static. As assetManager, bulletstate etc.



    If you need help :slight_smile: We are there :slight_smile:
1 Like

Thanks for the answers!

I knew it was that easy, but I just couldn’t see it.



I’m making a little FPS and I’m sure I will come back with some more questions for you:)



monsterbit