Gravity flipping

Get help using Construct 2

Post » Tue Dec 13, 2011 11:14 am

Hi everyone,
using physics behaviour for sprites, i can set world gravity to a posite or negative values following the convention that positive values go from top to bottom of the screen

i was wondering if i could set world gravity along X axes (i.e. from left to right or right to left) insted of Y one.

Thanks in advance for help

B
5
G
2
Posts: 4
Reputation: 1,463

Post » Tue Dec 13, 2011 11:21 am

Use the physics object --

ON Collision with object ->
      object.setWorldGravity -> -10(or whatever you want.)
B
29
S
12
G
7
Posts: 740
Reputation: 7,839

Post » Tue Dec 13, 2011 11:37 am

[QUOTE=smitchell] Use the physics object --

ON Collision with object ->
      object.setWorldGravity -> -10(or whatever you want.) [/QUOTE]


thanks smitchell, but as i mentioned, issuing a value of "-10" flips gravity from bottom to top along Y axes, right?

i'd like to change gravity along orthogonal axes (X axes), i.e. to make falling objects from left to right of the screen
B
5
G
2
Posts: 4
Reputation: 1,463

Post » Tue Dec 13, 2011 11:54 am

Can you not apply an impulse every tick? Would that not work..
B
29
S
12
G
7
Posts: 740
Reputation: 7,839

Post » Tue Dec 13, 2011 12:50 pm

PhysicsGravity.capx

Gravity is a dark force
Last edited by Yann on Sun Sep 14, 2014 10:47 pm, edited 1 time in total.
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346

Post » Tue Dec 13, 2011 1:08 pm

[QUOTE=Yann] http://dl.dropbox.com/u/23551572/C2/PhysicsGravity.capx

Gravity is a dark force[/QUOTE]

thanks Yann i understood the trick involved in your example, it gave me the right input to my brain;

but maybe i should try a more robust way of controlling the gravity since i need to do a character/environement management with changing gravity vector
B
5
G
2
Posts: 4
Reputation: 1,463


Return to How do I....?

Who is online

Users browsing this forum: anty21ro, DamonZero, Radulepy, Yahoo [Bot] and 0 guests