physics.pause() in Game template

Endless skateboarder doesn’t have moving objects other than the player which will stand still until you interact with the player. Sticker Knight limits where enemies move and it may not be a necessary action. Enemies don’t attack you right away. Though I would argue that sticker Knight could benefit from it. Every developer can do what they want. Things like pausing physics is what I consider a best practice. developer X might have a different opinion. Welcome to the world of programming.

EDIT: Trying to reply from my phone was an editing disaster. Sorry for the bad grammar…

Rob

Ok I see. Thanks. I just figured physics.pause was to stop the physics engine from working…like well…like pausing a video. And with the tutorial I watched using physics.pause when the game was paused and stated it ‘paused all physics in the game’ just went further to cement that belief.

The primary purpose of physics.pause() is to let you pause your game.  But this is exactly why we are doing it immediately after calling physics.start() but before any bodies are added. The simulation should be in a paused state until you’re actually ready for it to run, then you unpause it by calling physics.start() a second time.

Rob

OK I see. But I noticed that even without calling physics.start() a second time, the characters can jump endlessly and are continuously affected by physics. That’s also what confused me. Like for example with the new game template there is a crate that falls down at the beginning. But if I add a button to the crate so I touch it to make it jump, it can jump over and over and still falls back down again.

Maybe there’s something I’m not understanding quite right about how this works. It was my thinking that if physics was paused then jumping after this point should not be affected by gravity?

That can only be true if start() was called again somewhere.