Trigger action when collision finished?

0 favourites
  • 7 posts
From the Asset Store
Game Triggers is as versatile as a Swiss army knife, and will be a great resource for any type of game you're creating.
  • How would you trigger an action when two objects stop colliding?

  • 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...

  • 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:

    <img src="http://dl.dropbox.com/u/10285716/SampleAfterCollisionCheck.png" border="0" />

  • 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!

  • 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

  • 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.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Thanks, BluePhaze, using inverted overlap works good.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)