How do I Control Gravity

Get help using Construct 2

Post » Tue Jun 02, 2015 1:38 am

So I'm making a game where I want all the objects to interact with each other gravitationally. It seems to be working but for some reason even if I set the world gravity to zero the objects still fall to the bottom of the screen. Anybody know how to fix this our just a way to do this that won't cause this issue?
Last edited by bbjGames on Tue Jun 02, 2015 7:31 pm, edited 1 time in total.
B
22
S
8
Posts: 203
Reputation: 2,059

Post » Tue Jun 02, 2015 8:58 am

If you want certain objects not to move while using physics, you can set immovable to yes in the physics properties..

If I didn't understand you question correctly, please rephrase..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Tue Jun 02, 2015 7:30 pm

I want all the objects to move and attract each other like planets and such
B
22
S
8
Posts: 203
Reputation: 2,059

Post » Wed Jun 03, 2015 7:38 am

When setting world gravity to 0, objects shouldn't fall, unless you have created events that make them do so..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Wed Jun 03, 2015 11:00 am

In the how do I FAQ there is an example named "Simulating gravity affected orbits between celestial objects" (link) that sounds like what you are trying to achieve.
You should check it out.

For your issue, are you sure you haven't added an extra behavior to your object like "platform" alongside "physics" ?
Are you sure you are setting the world gravity in a "On start of layout" event, or an event that is to be executed right away, and not some event awaiting for a user action or something ?

To make sure, consider posting your capx so we can check it out further.
New to Construct ? Where to start

Image Image

Image Image

Please attach a capx to any help request or bug report !
Moderator
B
284
S
109
G
91
Posts: 7,317
Reputation: 87,483

Post » Wed Jun 03, 2015 8:42 pm

Ok I fixed that issue but if I want multiples of the same sprite to attract each other it doesn't work like they'll both just start moving in one direction
B
22
S
8
Posts: 203
Reputation: 2,059

Post » Wed Jun 03, 2015 9:23 pm

without seeing your events it's very hard to answer that question..

Are you referencing the objects in the event?
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Thu Jun 04, 2015 7:47 pm

Yes, I have sprite 1 apply force towards sprite1.y,sprite1.x and this method works but only if I use different sprite instead of the same one. Also on a bit of a different topic is there a way to move the character without it stopping the effect of gravity? Like if I wanted a rocket but while it moves or even when it stops moving itself forward it still drifts and is affected by gravity
B
22
S
8
Posts: 203
Reputation: 2,059


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 14 guests