Pause physics and keep speed on unpause

Get help using Construct 2

Post » Wed Jan 29, 2014 4:21 pm

Hi everyone,


I have been trying to fix this for a while.
I have a physics ball, when it hits something specific, i want it to pause (immovable) and when i unpause (movable) i want it to keep goind on the path that it did before i paused it.

So to put it simply, i just want it to keep the speed, angle and so on after i unpause it.


Any ideas?
B
37
S
9
G
8
Posts: 541
Reputation: 8,554

Post » Wed Jan 29, 2014 4:37 pm

When I do this sort of thing I put the physics parameters into object variables. Then, when it's time to resume, I just put them back into the object's physics parameters. Something like this should work if I understood your question fully:

A big fan of JavaScript.
B
76
S
20
G
74
Posts: 2,255
Reputation: 46,484

Post » Wed Jan 29, 2014 4:38 pm

Thanks a lot Colludium, that should work.. Smart idea.
I'll give it a go!


Cheers
B
37
S
9
G
8
Posts: 541
Reputation: 8,554

Post » Wed Jan 29, 2014 4:42 pm

By the way, Xvel, Yvel, Rotvel are those global variables you created? or is it private variables?
B
37
S
9
G
8
Posts: 541
Reputation: 8,554

Post » Wed Jan 29, 2014 4:47 pm

nevermind, i got it ;)
B
37
S
9
G
8
Posts: 541
Reputation: 8,554

Post » Wed Jan 29, 2014 4:47 pm

They are all object variables inside the Sprite object. So with the event system you could manage lots of different instances all using the same handful of events.

Edit - glad you got it - I'm too slow at typing again!!Colludium2014-01-29 16:48:09
A big fan of JavaScript.
B
76
S
20
G
74
Posts: 2,255
Reputation: 46,484

Post » Wed Jan 29, 2014 5:44 pm

Yeah, i figured it out, its really a great system, im gonna use this a lot in my games from now on :D


Thanks again!
B
37
S
9
G
8
Posts: 541
Reputation: 8,554


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 20 guests