How do I detect overlap entry/exit correctly?

0 favourites
  • 4 posts
  • Hello all

    My events are:

    [ul]	[li]If Frog is overlapping portal AND IsInPortal = 0 (touching a portal for the first time)[/li]
    [/ul]             IsInPortal = 1
                 For each portal Alert portal.Type
    
    [ul]
    	[li]If Frog is overlapping portal at offset(-Frog.Height, 0) IsInPortal = 0 (finished operlapping)[/li]
    [/ul][/code:1qbydeiy]
    
    I would have expected the loop to occur only once, at the entry. However, it happens on entry, and when it fully overlaps, it runs the loop each frame until it exists the portal... so I thought if the pivot of the frog is 0,0 then that would explain it, since it does overlap a lot. but the pivot is in the middle of the frog (16, 16)
    
    What am I missing?
    
    Thanks!
  • What is happening and what did you expect to be happening?

    the way these events are now is that the system will check every tick if the collision-polygon of the frog is overlapping the collision-polygon of the portal and if the collision-polygon of the frog is overlapping the collision-polygon of the portal at offset..

  • LittleStain yeah, but since the loop is a sub event, so if IsInPortal is 1, it shouldn't have looped again, until the frog exited the portal...

    I've shortened my code above to a more logic way, still occurs...

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Well, I'm ashamed of myself... I just found out there's an "invert" command on events... It sure looked strange there isn't any "NOT" condition...

    Thanks LittleStain for the help

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