Jump to content


Member Since 18 Aug 2013
Offline Last Active Sep 14 2015 01:14 PM

#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"?