Can't invert the "On Collision with Sprite" condition.

0 favourites
  • 5 posts
  • Problem Description

    Can't invert the "On Collision with Sprite" condition.

    Attach a Capx

    https://dl.dropboxusercontent.com/u/6074572/runner.capx

    Description of Capx

    If Sprite4 (green sprite) collides with an enemy, it can fall behind until it goes off the screen. However, I want it to recover once no collisions are made, up until some point (e.g. run faster than the camera, thus positioning itself towards the center of the screen). Try standing on an enemy's head to fall behind.

    Steps to Reproduce Bug

    • Stand on enemy head to fall behind a bit.
    • Jump off his head to gain speed.
    • Issue is, it gains speed even when it's on the enemy's head, I want it to gain speed only when his not in collision with any enemies...

    Observed Result

    I can't invert the "On Collision with Sprite" to "On Not Collision with Sprite"

    Expected Result

    "On Not Collision with Sprite" should be available

    Affected Browsers

    • Chrome: YES
    • FireFox: YES
    • Internet Explorer: YES

    Operating System and Service Pack

    Windows 8.1 Pro

    Construct 2 Version ID

    R185 64Bit

  • triggers can not be inverted, since they just happen outside thé normal events timeline (an inverted trigger would basically run constantly, like a inninterupted while loop, which you do not want)

    try to use the is overllaping instead

  • Thanks Aphrodite, however, how is "is overlapping" any different? when I invert it, doesn't it run constantly as well?

    In addition, when I'm on top of the overlapping sprite, the event is not met for some reason... I'm guessing "overlap" means X AND Y overlap?

    Also, if I want to perform an action is the position is less then 200 AND isn't overlapping a sprite, I better of putting the X condition first, right?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • overlaps and collision are calculated according to the collision mask you define on your sprite.

    You should use on collision or trigger once for overlapping to check for collision.

    and !overlapping for everything else

    you can calculate the distance with the distance expression

    distance(obj1.X,obj1.Y,obj2.X,obj2.Y)

  • Closing as by design. I'm not sure how the engine ought to handle a trigger that says "On not colliding with a sprite" anyway. I think what you're after is just the first tick of an inverted 'is overlapping' condition.

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