Standard game set up

Hey there,

  I was wondering i could ask some questions about standard game.  Now i know these have been asked all over the place and i am sorry about that but i couldn't find a straight answer anywhere.



Ok



If i wanted to make a class that controlled say gui would it be defined as

public class gameGUI extends GameState {

}


And after that what i add my code what do i used to construct that when i call setActive.

Thanks

well, yes, you could. no problems… but I would reccomend this:

BasicGameState uiState = new BasicGameState("guiState");


then adding to the root node, calling set active, and finally GameStateManager.getInstance().addchild [or attach... can't remember]...

Hi, I consider it more convenient to have a GUI class that contains a StandardGame, GameState(s), etc instead of deriving from it.

The whole point of gameStates is to (be able to) have several different ones. As a little guide I give you a snippet from my code:

public class GUI {

   private StandardGame game;

   private MyGameState gameState;

   //more gamestates here

   public void initialise() {
      game = new StandardGame("TestGame"); // Create our game
      // Show settings screen
      try {
         GameSettingsPanel.prompt(game.getSettings());
      } catch (InterruptedException e) {
         e.printStackTrace();
      }
      game.start(); // Start the game thread

      // Create our game state
      gameState = new ShadowDebugGameState();
      GameStateManager.getInstance().attachChild(gameState);
      gameState.setActive(true);

      // init more gameStates here
      // do further initialisation
   }
}