Jump to content

  • Log In with Google      Sign In   
  • Create Account

#ActualBambooCatfish

Posted 06 January 2013 - 04:23 PM

Right on, thank you guys for this info!

 

I actually had the L Spiro one saved in my bookmarks byt forgot about it (wayy to many folders/nesting :-/ ). I read through them both a couple of times and am still tryin to wrap my head around it.

 

So in the L Spiro one each state is a class/object inherited from a base class "GameState" or something and the information is passed from a instance/pointer of the Game class/object, with each state grabbing what it needs? I like this approach if thats the case.

 

The other one is alot to read and I have to read it a few times to get more of a understanding from it.

 

A follow up question... I am using scenes right now, similar to the states TitleScene, GameScene, OptionsScene, etc. I had thought the scenes would handle the states internally but from these approaches I should ditch scenes and make each scene a state? Would that mean its better to keep all my data inside the main game class instead of some sort of scene Object?

 

Right now i have something that looks like this ( in general)

 

class MainGame()
{
   
     SceneObject scene;

   public MainGame(){} //constructor

    pubic void init(){} // init method.
 

    public void update()
   {
     scene.update();
   }

   public  void draw()
  {
       scene.draw();
   }

   
  void changeScene(SceneObject newScene){}

}

 

class GameScene: SceneObject
{
      List<Enemies> enemies;
      PlayerObject playerObject;
     TIleMap map;
 
     public SceneObject() {} // constuctor

     public void init() {}   // init method.
      
     pubic void update(){}   //update stuff
     
     public void draw() {}   //daw stuff.
}

 

If this doesnt make sense let me know and I will try to explain better.


#1BambooCatfish

Posted 06 January 2013 - 04:22 PM

Right on, thank you guys for this info!

 

I actually had the L Spiro one saved in my bookmarks byt forgot about it (wayy to many folders/nesting :-/ ). I read through them both a couple of times and am still tryin to wrap my head around it.

 

So in the L Spiro one each state is a class/object inherited from a base class "GameState" or something and the information is passed from a instance/pointer of the Game class/object, with each state grabbing what it needs? I like this approach if thats the case.

 

The other one is alot to read and I have to read it a few times to get more of a understanding from it.

 

A follow up question... I am using scenes right now, similar to the states TitleScene, GameScene, OptionsScene, etc. I had thought the scenes would handle the states internally but from these approaches I should ditch scenes and make each scene a state? Would that mean its better to keep all my data inside the main game class instead of some sort of scene Object?

 

Right now i have something that looks like this ( in general)

 

class MainGame()
{
   
     SceneObject scene;

   public MainGame(){} //constructor

    pubic void init(){} // init method.
 

    public void update()
   {
     scene.update();
   }

   public  void draw()
  {
       scene.draw();
   }

   
  void changeScene(SceneObject newScene){}

}

 

class SceneObject
{
      List<Enemies> enemies;
      PlayerObject playerObject;
     TIleMap map;
 
     public SceneObject() {} // constuctor

     public void init() {}   // init method.
      
     pubic void update(){}   //update stuff
     
     public void draw() {}   //daw stuff.
}

 

If this doesnt make sense let me know and I will try to explain better.


PARTNERS