Pause a physical game?

Get help using Construct 2

Post » Fri Jul 13, 2012 1:03 pm

Hello,

I make a game with a ball. The ball is rolling:



I want to make a pause option. If you set the game to pause, i make the ball immovable. If you stop the pause, i make the ball again movable. But if the ball is at the position H, the ball stops with rolling. How can i make in this situation a pause option?

Thnaksjelmer112012-07-13 13:08:39
B
6
Posts: 17
Reputation: 448

Post » Fri Jul 13, 2012 1:19 pm

One option is to use the action "Set immovable" to "immovable". This freezes the physics object. And you can make it move again with the same action and set the object to "Movable". But this option doesn't keep any linear or angular velocities.

You can also set the time scale to 0, that will pause all objects in the layout, and when you want to "unpause" you just set the time scale to 1.
B
38
S
13
G
9
Posts: 151
Reputation: 8,437

Post » Fri Jul 13, 2012 1:24 pm

[QUOTE=CodeMasterMike] One option is to use the action "Set immovable" to "immovable". This freezes the physics object. And you can make it move again with the same action and set the object to "Movable". But this option doesn't keep any linear or angular velocities.

You can also set the time scale to 0, that will pause all objects in the layout, and when you want to "unpause" you just set the time scale to 1.[/QUOTE]

Thank you! It works!
B
6
Posts: 17
Reputation: 448

Post » Fri Jul 13, 2012 1:27 pm

You really should just set the time scale to 0 to pause. It will make your life so much easier.
B
90
S
30
G
24
Posts: 3,189
Reputation: 32,400

Post » Sat Sep 08, 2012 9:59 am

Sorry to revive the old thread, but is there any way to pause physics objects other than set immoveable, set time scale?

In my game, when you press the pause button, all the physics should paused and then a menu screen moving up using lerp. So i cant use timescale because it pause even the menu screen. And the "set immoveable" is very buggy when you pause and unpause rapidly.
B
19
S
5
Posts: 51
Reputation: 1,883

Post » Sat Sep 08, 2012 1:55 pm

You can set the time scale for individual objects. So you could set the game time scale to 0 and then set the menu to 1.
B
54
S
28
G
18
Posts: 1,520
Reputation: 25,020

Post » Sat Sep 08, 2012 2:26 pm

@ramones: sadly time scale for object does not affected physics object.
B
19
S
5
Posts: 51
Reputation: 1,883

Post » Sat Sep 08, 2012 3:10 pm

@hylists Hmm I see what you mean, unless physics mode is set to framerate independent. But what about setting the menu timescale to 1? Unless the menu is a physics object too?

pauseMenu.capx (r102)
B
54
S
28
G
18
Posts: 1,520
Reputation: 25,020

Post » Sun Sep 09, 2012 2:56 am

@ramones: Wow it works, much thanks!
B
19
S
5
Posts: 51
Reputation: 1,883


Return to How do I....?

Who is online

Users browsing this forum: Yahoo [Bot], YoHoho and 12 guests