Organizing your project and files

I was just wondering how to you guys go about making a more complex game than say the tutorial “mini games” in terms of organization. If you are adding many objects to the game and making many initializations, can you break it up into other files? The problem i am finding when i want to break up the project in a number of files is that when i create new classes, i am forced to extend the class to a simpleApplication to get some of the variables to work. I hope you understand what I mean. So basically how do you separate the game into many files. How should a well made structure look like?

Well you have plenty of solutions to get “global” variables.

  • Pass them to the constructor of your classes or via setters.
  • Create static accessors to those variables in your application
  • use some injection mechanism like spring injectors or google guice
  • use app states and get the hand on the application variables by overriding the initialize(AppStateManager stateManager, Application app); method

    or…a combination of all that

    there might be other ways though.