thiezar Posted February 24, 2014 Share Posted February 24, 2014 I have a game with a MainMenu state and a Play state.I want to keep my animated background without reloading it (the animation should loop without interruptions) when I change from MainMenu state to Play state.How can I do this? Link to comment Share on other sites More sharing options...
rich Posted February 24, 2014 Share Posted February 24, 2014 When you switch states, set the parameter that clears the world to FALSE, so the display list isn't changed at all. And then you'll have to clear away the things you don't need yourself, keeping the background going. Also the background object will either need creating outside of your state, or passed over as the state changes, so the reference isn't lost. jerome 1 Link to comment Share on other sites More sharing options...
thiezar Posted February 24, 2014 Author Share Posted February 24, 2014 Good! I knew Phaser wouldn't have disappointed me on this Thank you and keep on making this great engine more awesome! Link to comment Share on other sites More sharing options...
omarojo Posted June 18, 2015 Share Posted June 18, 2015 When you switch states, set the parameter that clears the world to FALSE, so the display list isn't changed at all. And then you'll have to clear away the things you don't need yourself, keeping the background going. Also the background object will either need creating outside of your state, or passed over as the state changes, so the reference isn't lost. Hi Rich, so what is the point of having the second parameter to FALSE if you have to manually pass over the objects to the next state so that those objects can be re-added. I mean.. you are actually re adding the objects again in the second state, then what is the second parameter set to FALSE doing anyway ? I am changing it to True and False, and I see it keeps cleaning the screen... there is no difference. georgejfrick 1 Link to comment Share on other sites More sharing options...
Recommended Posts