zbzzn Posted December 23, 2013 Share Posted December 23, 2013 Hi, I have an end game screen which is a state and I need to pass the score from the main game state to the end screen state. How do I do it? I didn't see a parameter for it in the StateManager.start function. Thanks,Boris. Link to comment Share on other sites More sharing options...
XekeDeath Posted December 23, 2013 Share Posted December 23, 2013 You will need to have those variables stored outside the state. Link to comment Share on other sites More sharing options...
powerfear Posted December 23, 2013 Share Posted December 23, 2013 You can also store it inside the stategame.state.states['endGameScreen'].score = 300; PadreMontoya and haden 2 Link to comment Share on other sites More sharing options...
@99golems Posted December 23, 2013 Share Posted December 23, 2013 the state manager holds a reference to the game in the property StateManager.game. In addition to that, you should have a globally accessible variable for the game object, depending what you named it when you called new Phaser.game() to load/create the game. I'd store any persistent data inside the main game object itself. Link to comment Share on other sites More sharing options...
zbzzn Posted December 23, 2013 Author Share Posted December 23, 2013 Thanks everyone for the answers. @photonstorm: Rich (if you read this) would you accept a PR to add options object to the state start function so that I can pass parameters to the created state? Link to comment Share on other sites More sharing options...
Recommended Posts