User Tag List

Results 1 to 5 of 5

Thread: Dealing with the app going into the background

  1. #1
    Clicker

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export ModuleUnicode Add-on
    mobichan's Avatar
    Join Date
    Oct 2007
    Location
    Buffalo, NY
    Posts
    3,310
    Mentioned
    28 Post(s)
    Tagged
    0 Thread(s)

    Dealing with the app going into the background

    I have recently started testing the different states my app can be in when going to the background (pressing the home button). It seems that the exact state of the game is not preserved, since I have a custom pause that is lost when going to the background. If the app returns from the background my pause routine (which is done through groups being enabled/disabled) is always unpaused when returning from the background.

    Can anyone explain what happens when the game resumes from a background state? Is the game loop run like a "restart" frame event being called or something similar? This is especially troublesome for dealing with sounds.

  2. #2
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)

    Join Date
    Apr 2007
    Location
    Australia
    Posts
    1,152
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Don't run your pause when the app goes into the background, the iOS should automatically save the current state for you so nothing runs until it returns to the foreground.

    Instead, using the iOS object use the reactivation event to check when the app is opened again, then run your pause menu.

  3. #3
    Clicker

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export ModuleUnicode Add-on
    mobichan's Avatar
    Join Date
    Oct 2007
    Location
    Buffalo, NY
    Posts
    3,310
    Mentioned
    28 Post(s)
    Tagged
    0 Thread(s)
    I actually do check on reactivation and pause the game if it wasn't before going to the background. The problem is if a player manually pauses the game, then goes to background, when they return to the game, the game is no longer in a pause state. My code actively checks for the player pressing a "resume" button when the game is paused, so there should be nothing unpausing the game. But some unusual code seems to run when returning to the game from background.

    Any idea why?

  4. #4
    Clicker Fusion 2.5 DeveloperFusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleXNA Export Module
    DistantJ's Avatar
    Join Date
    Jan 2008
    Location
    Gloucester, UK
    Posts
    2,144
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)

    Dealing with the app going into the background

    Perhaps it's toggling the pause so the pause turns off when you return to the paused app? Try maybe "App reactivated + App is NOT paused: Pause app"?

  5. #5
    Clickteam Clickteam
    Olivier's Avatar
    Join Date
    Jun 2006
    Posts
    3,000
    Mentioned
    9 Post(s)
    Tagged
    1 Thread(s)
    I'm also using a custom pause by enabling/disabling groups and I don't have any problems with the app going to the background/foreground. Basically when the app goes into the background and the game is running, the pause is activated. When the app goes into the background and the pause is already activated, do nothing. When the pause is activated, the user has to push a button to resume the game. Can be seen in action in CrazyCrab. Pseudo-code:
    Code:
    Group.Game{
    • [iOS] Application has been deactivated
    --> Activate Group.Pause
    --> Deactivate Group.Game
    
    • [Button.Pause] Has been Clicked
    --> Activate Group.Pause
    --> Deactivate Group.Game
    }
    
    Group.Pause{
    • [Button.Resume] Has been Clicked
    --> Activate Group.Game
    --> Deactivate Group.Pause
    }

Similar Threads

  1. Still having trouble dealing with multiple instances of one object
    By Outcast in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 31st December 2013, 10:33 PM
  2. Dealing with Lag Caused by Sample Loading?
    By pinacoladaxb in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 7th February 2011, 03:16 AM
  3. Tip for dealing with sound distortion
    By Ryan in forum SWF/Flash Export Module Version 2.0
    Replies: 8
    Last Post: 5th September 2010, 10:39 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •