Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


jakson15

Member Since 18 Aug 2013
Offline Last Active Today, 04:12 AM

#5199450 Passing information between states?

Posted by jakson15 on 21 December 2014 - 04:41 PM

So I've been learning about gamestates lately.

Learning from here: http://gamedevgeek.com/tutorials/managing-game-states-in-c/

 

And I get the idea of how you can 'push' new states onto the stack and resume for later, but I'm concerned about passing relative information between them.

 

Say I have a 'menuState' showing available levels and the user clicks 'level1' starting a new state 'gameState'.

How would the gameState I just created know what level to load, and also how would it send data back once I returned to the menu to say "hey, he completed level 1, and can now play level 2"?




PARTNERS