This line of code will exit the app and kill the process.
@olegat,
Many developer here do not read the Apple guidelines for their apps, and do become a bit stubborn to a suggestion. I can tell you this..
If you quit an app, i.e. tha app drops back to the Home Screen, it is in Apple's terms equivalent of a Crash. The only way an app should go to the Home Screen is via the Home Button.
So, please let's not have a discussion on this, I am just letting you and the other know what Apples policies are. You could be lucky that the reviewer that reviews your app might not look for this and let it slip, but then if it does not, you will face unnecessary delays and change in code.
cheers,
?:)
Thanks all for responses and the "heads-up" on the quit process.
Can you explain
"director:changeScene("level1",crossfade)"
- what does it mean, what is 'director' (I assume some external class) and can similar be done in native Lua without calling external classes?
Thank you,
Oleg
@jayant Glad to know that about apple. Though I am only developing for android now. I hope to develop apps for apple in the future. Good stuff to know.
@oleglat
Yes director is an external class for switching diffrent scenes. Just do some searches for it on the forum and you will know all about it.
If you do not need to switch screens then I would make a function to set all your variables to the what they were when you started the level. Also set all your display images to where they were when you started the level then call that function when you want to reset the level.
Do some searches on the forums there are many questions that you have that have been answered.
I too had the same question as you, that was about 2 months ago I did searches found suggestions and went form there.
(you can learn from copying and pasting someone elses code but only to an extent, to fully understand whats going on you need to take that code you copied and play with it.) Mess it up even, then debug it.
Be the code, Love the code, Hate the code, Live the code. Lol
I would start small if you need to learn how to reset your level just make a sort of template of what you are trying to accomplish
Just make a new project and work on a small example of what you are trying to implement. get it working and apply it to your game.
goodLuck.