2 questions , sort of related.
In my current game, I simply stop when all the hero's lives are gone, I just display a simple "game over".
My beta-tester reported that the app is still there and he can't relaunch or exit it, he has to go to his phone's home page, eject the app, then relaunch.
So I thought may be I should add 2 new options when the game is over: replay and exit game.
- exit game simply kills everything, so the game can be relaunched. How would I do that?
- replay would start the game from the beginning. I use scenemanager and scenecontroller, if I go back a page and go forward again, the game continues and not starting from the beginning. How can I re-initialize everything so the game restarts? Or if going back a page is not the best way, then what is the better way?
Would appreciate all pointers.
Comments
you've tried this @ar2rsawseen ' s Game Template http://giderosmobile.com/forum/discussion/480/gideros-game-template/p1
I hope it can help
[-] Liasoft
--------> fine if you go for android but in ios it is not allowed also replay and go back to home screen would be fine for both
replay would start the game from the beginning.
---------> basically changing the scene will take care of this however if you had used global variables you need to explicitly handle those. if you are using physics body make sure to destroy them before replay
http://appcodingeasy.com/Gideros-Mobile/Manage-Scenes-in-Gideros-Mobile
@ar2rsawseen: Thanks, I thought of that. I used self.scenes:changeScene(pages[currpage], ...) in scenecontroller to go to the same page, but the graphics redisplayed and overlaid the old graphics. Also if I changeScene to the first page, my game on page3 continues to run. I thought when you call a page, everything re-executes and all variables would re-initialize. Will have to play around more.
If that is not happening:
1) maybe you are using incorrect version of scenemanager
2) maybe you are adding everything to the stage and not to the scene
2) I have the page-turn buttons and the music toggle in scenecontroller, and those stay when pages are changed. The rest of the graphics are in the individual page, so I believe I added them to the scene and not to the stage. And I manually remove them on exitBegin with self:removeChild(layer7), etc...Some of them are spawned onterFrame, but I remove them manually also.
1) I had scenemanager v1.0.3 previously, I downloaded v1.0.4 today. The behaviour is still the same.
Thanks for your response anyhow, will look at it more.
If you use Scene.variable = 5 this value stands, but if you use scene = Scene.new()
scene.variable = 5, this value is removed.