nak3ddogs Posted November 2, 2014 Share Posted November 2, 2014 Hi! pls help with state restart. i wanna switch back from game to main menu.after the switchback the groups of mainmenu are not exists. this.game.game.state.start('MainMenu', true, false); this.menu_group = this.add.group(); this.menu_group.add(this.bg_popup); this.menu_group.x = this.world.centerX; this.menu_group.y = this.world.centerY-10; this.add.tween(this.menu_group).to({y:this.world.centerY+10}, 2000, Phaser.Easing.Quadratic.InOut, true, 0, 10000, true); this.menu_items_group = this.add.group(); this.menu_group.add(this.menu_items_group); this.alap_group = this.add.group(); this.options_group = this.add.group(); this.credits_group = this.add.group(); this.menu_items_group.add(this.alap_group); this.menu_items_group.add(this.options_group); this.menu_items_group.add(this.credits_group);ty for any advice Link to comment Share on other sites More sharing options...
nak3ddogs Posted November 2, 2014 Author Share Posted November 2, 2014 nobody know how can i reset a group? Link to comment Share on other sites More sharing options...
nak3ddogs Posted November 2, 2014 Author Share Posted November 2, 2014 okey i solved but it is not a nice solution.i made a global var(mainmenuhelper = false) at the mainmenu create function's start i checkif (mainMenuHelpBoolean == true) { mainMenuHelpBoolean = false; console.log(mainMenuHelpBoolean) this.state.restart(); };and when i want to go back to main menu i use the global var if (this.life <= 0) { mainMenuHelpBoolean = true; this.game.game.state.start('MainMenu', false, false); };and now the groups are work Link to comment Share on other sites More sharing options...
Recommended Posts