... Invert collision

Get help using Construct 2

Post » Fri Nov 18, 2011 11:38 pm

How can I invert collision?

- Thanks
B
13
S
2
G
4
Posts: 54
Reputation: 3,882

Post » Sat Nov 19, 2011 12:50 am

It doesn't really make sense to invert an 'on collision' event. What does 'On not collided' mean?

You might want to try inverting 'is overlapping' and adding a 'trigger once' beneath that, though. It will fire once every time the sprite goes from overlapping to not overlapping.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,580

Post » Sat Nov 19, 2011 11:46 pm

Hi, I have the same question than Xanco. What about if I want to detect when the player is flying for instance, without colliding any object?
What I am doing (2 days using Construct) is a platform game using physics. For each state, walking, running, flying, falling, etc. there is a group of events and a specific object to use. So, how to know if the object is not colliding?

Thanks
B
4
G
1
Posts: 4
Reputation: 658

Post » Sat Nov 19, 2011 11:52 pm

Learner, right now it's late and i can't test anything, but you could always try making it so if the object/character overlaps an item it changes a variable that is for example named "Collision". And when it's not on, it could know it's flying? Sorry if this sounds a little badly formulated but i'm a little tired. Hope it works tho. ^^
B
22
S
3
G
6
Posts: 52
Reputation: 4,387

Post » Sun Nov 20, 2011 2:25 am

Just invert 'is overlapping'. 'On collision' cannot be inverted because it's a trigger, whereas 'is overlapping' is tested every tick.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,580

Post » Mon Nov 21, 2011 4:42 am

Thanks for your tips. About "is overlapping" it seems it does not work. It never overlaps the platform. I just used a box as player and another as platform, both using physics behavior. When the box is falling is overlapping is not triggered, as it is expected, but when it collides with platform, the same happens, it is not triggered.

Thanks anyway

Leaner
B
4
G
1
Posts: 4
Reputation: 658

Post » Sun Jan 13, 2013 12:33 am

I needed to change the char animation according to the approach or colliding with some objects in the scene. I then used this logic:



If it helps you or anyone else about it, I'll be happy.
B
39
S
6
Posts: 79
Reputation: 4,040

Post » Sun Jan 13, 2013 9:25 pm

Another approach is to give the player a instance variable called "Flying" and set that to 1 whenever he's flying

then check against that as needed.

eg: if player "flying" = 1 then do this, Else do that.

But with regards to the object not "overlapping" with the platform, try using the collision at offset condition and use something like y+20 as the offset to make sure its lower than the bottom of the character's feet. (without seeing the game im not sure how it looks)

justifun2013-01-13 21:25:51
B
50
S
21
G
8
Posts: 844
Reputation: 10,299


Return to How do I....?

Who is online

Users browsing this forum: makkancs and 24 guests