How to tell if physics object is in air?

Get help using Construct 2

Post » Mon Dec 05, 2011 9:06 pm

I have a 2D car, like those dirt bike games, how can i tell if its in the air? :) Thanks
B
30
S
13
G
7
Posts: 740
Reputation: 7,994

Post » Mon Dec 05, 2011 9:30 pm

When it is not overlapping the ground I think.

Object car -> is overlapping object Ground.
Right-click: Invert
New to Construct ? Where to start

Image Image

Image Image

Please attach a capx to any help request or bug report !
Moderator
B
276
S
103
G
84
Posts: 7,288
Reputation: 83,091

Post » Mon Dec 05, 2011 9:44 pm

Move the sprite 1 pixel down, check for overlap with ground then move the sprite back up.

every tick:
----Sprite| set isInAir to true
----Sprite| set Y: y+1
Sprite| is overlapping ground:
----Sprite| set isInAir to false
every tick:
----Sprite| set Y: y-1
B
89
S
30
G
94
Posts: 5,153
Reputation: 62,942

Post » Tue Dec 06, 2011 2:12 pm

Thanks guys got it working now :)
B
30
S
13
G
7
Posts: 740
Reputation: 7,994


Return to How do I....?

Who is online

Users browsing this forum: marcoscodas and 15 guests