StarBright Posted March 13, 2016 Share Posted March 13, 2016 I want to make a global variable that's saved while the player is on the menu screen and the value is later retrieved from a different state. Any hints on how to make this work? Link to comment Share on other sites More sharing options...
AzraelTycka Posted March 13, 2016 Share Posted March 13, 2016 Hello, just to make sure you can actually send data from one state to another in phaser. Apart from that it should be straightforward, you have your var game = new Phaser.Game(...); so you can just add it to your game as a property, something as game.myData or whatever you find suitable works without any problems. There is quite a number of post about it. Or one for all on the forum. Link to comment Share on other sites More sharing options...
shohan4556 Posted March 13, 2016 Share Posted March 13, 2016 var game = new Phaser(800,600,Phaser.AUTO); game.global = { score : 0, sound : false } // you can access these variable anywhere in your project no need to pass them via state to state Link to comment Share on other sites More sharing options...
Recommended Posts