seiyria Posted March 11, 2014 Share Posted March 11, 2014 So my game follows a format such that there is a menu you choose stages from, load them, complete them, and you go back to the main menu. You can see my main menu state code here, with a menu before loading here, and after completing a stage here. The way I handle finishing a level is in my play gamestates update function, shown here: @game.physics.overlap @game.player.ref, @warps, (player, warp) => if warp.offX is 0 and warp.offY is 0 @finishLevel() else @game.player.ref.x = warp.x + warp.offX @game.player.ref.y = warp.y + warp.offY#here's the function that is called abovefinishLevel: () -> @game.state.start 'MainMenu' (if the particular object does not have anywhere to go, it simply finishes the level) I am not sure if I'm doing this incorrectly, but I must be because I get a blank menu after finishing a level. I have verified that MainMenu.preload() and MainMenu.create() are both being called, and the MainMenu.buttons array is being populated in both cases as well. Just, nothing displays. Link to comment Share on other sites More sharing options...
ctmartinez1992 Posted March 11, 2014 Share Posted March 11, 2014 You seem to be doing it correctly, try calling @game.state.start 'MainMenu', false, true(not sure if that is correctly written in whatever language you are using) but basically, when you call the mainmenu state send a false and a true respectively. If i am not mistaken the first boolean is to clear the cache (if true) and the second boolean clears the world (if true). It's a wild guess but give it a shot Link to comment Share on other sites More sharing options...
seiyria Posted March 11, 2014 Author Share Posted March 11, 2014 You seem to be doing it correctly, try calling @game.state.start 'MainMenu', false, true(not sure if that is correctly written in whatever language you are using) but basically, when you call the mainmenu state send a false and a true respectively. If i am not mistaken the first boolean is to clear the cache (if true) and the second boolean clears the world (if true). It's a wild guess but give it a shotThe arguments are actually the other way around (true, false is implied so I exclude them). It does the same thing unfortunately. Link to comment Share on other sites More sharing options...
seiyria Posted March 12, 2014 Author Share Posted March 12, 2014 As it would turn out, you need to reset game.camera.follow (if set) and game.physics.gravity (if changed). All good now. Link to comment Share on other sites More sharing options...
ctmartinez1992 Posted March 13, 2014 Share Posted March 13, 2014 Ah, i guess i would have needed to see the rest of the code to get to that conclusion, glad that you managed to solve on youw own Link to comment Share on other sites More sharing options...
seiyria Posted March 13, 2014 Author Share Posted March 13, 2014 Yeah, no worries. I wouldn't've known what could have possibly affected this, but I'm glad it got figured out as well! Link to comment Share on other sites More sharing options...
Recommended Posts