[Resolved] Need help with storyboards agian

From the previous discussion at: http://developer.coronalabs.com/forum/2012/11/24/simple-storyboard-question-really-simple-0

I need help! To explain what I have so far go to the link above but basicly I have a game with a menu and a main game screen. In the lost thread you guys helped fix my problem of the physics stopping and not switching back to the main menu when I press the home button. You helped me figure that out but now when I switch back to home and switch back to the game I have that same problem of the physics not working.
Please help and an “simple” explanation would be appreciated.

Avery [import]uid: 184688 topic_id: 33335 reply_id: 333335[/import]

Still looking for a solution :frowning: [import]uid: 184688 topic_id: 33335 reply_id: 132529[/import]

Hello,
Can you explain in more detail what “physics not working” means? Do you receive an error or crash? Do the physics objects and bodies get created, but just don’t move?

Brent Sorrentino [import]uid: 9747 topic_id: 33335 reply_id: 132550[/import]

Thanks for the reply,

Yes everything is created and will move but just not respond to physics. It also may help to look at the other thread in the link above. [import]uid: 184688 topic_id: 33335 reply_id: 132551[/import]

I’ve had some issues with storyboard and physics. Without seeing exactly where it’s happening in code, I can only offer a couple of tips/potential directions to look in.

  1. If you are preserving the game state (not destroying the scene when you exit to the main menu), make sure you call physics.start() in enterScene.

  2. If you are destroying the scene, make sure that when you call either storyBoard:removeScene( former_scene ) or storyBoard.removeAll() when the scene has had time to resolve anything it may be in the middle of. You can use timer.performWithDelay to help with that.

  3. Make sure you have the following in your destroyScene event for the game:

 if physics then  
 package.loaded[physics] = nil  
 physics = nil  
 end  
  1. Make sure you are adding everything into groups and then removing the groups in destroyScene. [import]uid: 181948 topic_id: 33335 reply_id: 132558[/import]

Still looking for a solution :frowning: [import]uid: 184688 topic_id: 33335 reply_id: 132529[/import]

Hello,
Can you explain in more detail what “physics not working” means? Do you receive an error or crash? Do the physics objects and bodies get created, but just don’t move?

Brent Sorrentino [import]uid: 9747 topic_id: 33335 reply_id: 132550[/import]

Thanks for the reply,

Yes everything is created and will move but just not respond to physics. It also may help to look at the other thread in the link above. [import]uid: 184688 topic_id: 33335 reply_id: 132551[/import]

I’ve had some issues with storyboard and physics. Without seeing exactly where it’s happening in code, I can only offer a couple of tips/potential directions to look in.

  1. If you are preserving the game state (not destroying the scene when you exit to the main menu), make sure you call physics.start() in enterScene.

  2. If you are destroying the scene, make sure that when you call either storyBoard:removeScene( former_scene ) or storyBoard.removeAll() when the scene has had time to resolve anything it may be in the middle of. You can use timer.performWithDelay to help with that.

  3. Make sure you have the following in your destroyScene event for the game:

 if physics then  
 package.loaded[physics] = nil  
 physics = nil  
 end  
  1. Make sure you are adding everything into groups and then removing the groups in destroyScene. [import]uid: 181948 topic_id: 33335 reply_id: 132558[/import]

So I finally figured out how to do it, and it took a lot of guess and check. I finally decided to just start deleting things that look weird so finally I deleted a line of code in exit scene that says physics stop and it worked and now my physics always work even when I enter exit and then reenter the scene.

Thanks for your help I guess,

Avery [import]uid: 184688 topic_id: 33335 reply_id: 132717[/import]

So I finally figured out how to do it, and it took a lot of guess and check. I finally decided to just start deleting things that look weird so finally I deleted a line of code in exit scene that says physics stop and it worked and now my physics always work even when I enter exit and then reenter the scene.

Thanks for your help I guess,

Avery [import]uid: 184688 topic_id: 33335 reply_id: 132717[/import]