Game Development Community

[Solved] how to make a game running on background

by Rami Bokhari · in iTorque 2D · 01/16/2012 (4:06 am) · 5 replies

hey guys, I know has been answered before but I can't find the answer. When I press on the home button to exit to background and I come back to my game it starts from the beginning. I want the game to stay running (paused or something). I think it's something to do with the xcode project. thanks in advance guys :)

About the author

I love video games.. video games are my life.. playing can't satisfy me anymore.. thank you GG helping me making my dream worlds a reality


#1
01/16/2012 (4:47 am)
Games should normally pause there if they don't do it they were marked for 'exit on suspend' or used too much RAM and the device had to free them.
There is no other way to make an app exit when its suspended as thats an OS level functionality, nothing you can control or implement at all.

Also keep in mind that suspend only exists on 3GS+, the first 2 generations will always terminate applications when clicking on the home button.
#2
01/16/2012 (4:51 am)
am testing on ipod 4g
#3
01/17/2012 (5:45 am)
thanx Marc :)
#4
01/17/2012 (12:55 pm)
Hi Rami, you should use oniPhoneResignActive() which is located in scripts/game.cs to manage your game state as the user exits it with the home button.

You'll be able to then use oniPhoneBecomeActive() to reinstate it once the user returns.
#5
01/17/2012 (2:07 pm)
thank you very much David :D