I have a native.alert when the game ends and one of the buttons I have says EXIT. What is the code to exit a game application? Basically the person is finish with the game and wants to leave. I want to take them out of the game. [import]uid: 72372 topic_id: 12866 reply_id: 312866[/import]
Here is the code you are looking for:
[lua]os.exit()[/lua]
Make sure to check the API list. All the code is right there for you to look through.
http://developer.anscamobile.com/reference/index
Regards,
Jordan Schuetz
Ninja Pig Studios [import]uid: 29181 topic_id: 12866 reply_id: 47249[/import]
You will run the risk of getting it rejected by Apple. They forbid developers from killing/exiting the app as it seems like the app crashed. They want the user to press Home button to exit/kill the app.
however there are a few apps that have escaped the Apple Scrutiny. So take your chances
cheers,
?
[import]uid: 3826 topic_id: 12866 reply_id: 47269[/import]
Jayantv,
Thanks I don’t need the button. I will leave it off but I do have a question for you. In regards to buttons that pop up on a native alert. How do you tie an action to that button. For instance I have a reset button on my gameboard that you can reset the game or basically start it over. when you finish the game positive or negative outcome the alert comes up with three buttons on it. How can I tie an action to one of the buttons on the alert? Like for instance on the play again I want it to reset the game. I have the code to reset but not sure if you use an if then statement or something else.
[lua]then
native.showAlert(“UH-OH”,“Somethings not right. Go back and take a closer look.”,{“Try Again”})
–this stops our alert box from showing
return false
end
–DO STUFF HERE WHEN LEVEL IS COMPLETED, LIKE CHECKING FOR NEARBY COLORS
native.showAlert(“CONGRATULATIONS!”,“Now that you’ve beaten GRIDLOGIC try our other exciting games! We guarantee they’re a lot harder.”,{“Menu”, “Play Again?”, “Okay?”});
return true
end[/lua] [import]uid: 72372 topic_id: 12866 reply_id: 47287[/import]