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
29
S
12
G
7
Posts: 740
Reputation: 7,849

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
247
S
85
G
40
Posts: 6,999
Reputation: 57,793

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
79
S
24
G
54
Posts: 4,743
Reputation: 40,749

Post » Tue Dec 06, 2011 2:12 pm

Thanks guys got it working now :)
B
29
S
12
G
7
Posts: 740
Reputation: 7,849


Return to How do I....?

Who is online

Users browsing this forum: gregorysforster and 23 guests