Trigger action when collision finished?

Get help using Construct 2

Post » Wed Mar 13, 2013 1:48 am

How would you trigger an action when two objects stop colliding?
B
11
S
4
G
1
Posts: 159
Reputation: 1,803

Post » Wed Mar 13, 2013 4:53 am

On collision set a variable like collided = 1. Then check for the inverse of collided, and if collided = 1 (they did collide) and if not colliding (not currently colliding) then do your action...
B
49
S
11
G
10
Posts: 1,833
Reputation: 14,418

Post » Wed Mar 13, 2013 5:08 am

@Yttermayn ok you can't do an inverse of colliding with another object, so you can either test how far they are from eachother, or do an inverse of is overlapping (with an offset if needed). Like this:


B
49
S
11
G
10
Posts: 1,833
Reputation: 14,418

Post » Wed Mar 13, 2013 1:37 pm

Ahhh, thank you, that looks like it may work. I was not aware of the invert option. Pity it's not available with collide, but I can make overlap work. Kudos!
B
11
S
4
G
1
Posts: 159
Reputation: 1,803

Post » Wed Mar 13, 2013 1:44 pm

As far as I remember, it is not possible to make an inverse from a trigger-event, i.e. the OnSomething-Events with the tiny green arrows next to them. This is a restriction that kind of makes sense, since triggers do not describe a state (like IsOverlapping), but rather a "once-in-a-moment"-event that can hardly be inversed ;o)
However, BluePhaze's approach looks pretty solid! Hope it works for your game!!! ;-)

Regards,
Chris
B
6
Posts: 33
Reputation: 816

Post » Wed Mar 13, 2013 5:28 pm

I'm thinking more of it like, rather than inverting a condition, it's more like a key state: you can trigger something on key-down, and you can trigger something on key-up. Soooo... trigger on collision, trigger on end of collision. I'm about to try the inverted overlap trigger, will post on how it goes.
B
11
S
4
G
1
Posts: 159
Reputation: 1,803

Post » Wed Mar 13, 2013 11:44 pm

Thanks, BluePhaze, using inverted overlap works good.
B
11
S
4
G
1
Posts: 159
Reputation: 1,803


Return to How do I....?

Who is online

Users browsing this forum: bluemonkey, MarkThomas and 22 guests