Habacucc Posted August 5, 2014 Share Posted August 5, 2014 Hello . I created my game like this: var game= new Phaser.Game(800,600, Phaser.AUTO, '', {preload:preload, create:create, update:update}); If I'm not wrong, I created an initial state ( {preload:preload, create:create, update:update} ) which is called automatically at the beginning of the game. How can I reference this initial state from other states I created? Like, if I start my game with: game.state.start('MainMenu'); How can I call the initial state from the MainMenu state? Link to comment Share on other sites More sharing options...
lewster32 Posted August 5, 2014 Share Posted August 5, 2014 Because you've set the initial state as an object literal I don't think you can retrieve it. If you look at this basic example project (specifically the index.html file), you'll see that the states are all set up with game.state.add, and the 'Boot' state becomes the initial state. Doing it this way ensures all of them have a name you can reference. Link to comment Share on other sites More sharing options...
Habacucc Posted August 5, 2014 Author Share Posted August 5, 2014 Oh, I see. Guess I will have to redefine my initial state in order to be able to call it. Thanks for your answer . Link to comment Share on other sites More sharing options...
Recommended Posts