How do I detect overlap entry/exit correctly?

Get help using Construct 2

Post » Thu Sep 04, 2014 6:26 am

Hello all

My events are:

Code: Select all
- If Frog is overlapping portal AND IsInPortal = 0 (touching a portal for the first time)
             IsInPortal = 1
             For each portal Alert portal.Type

- If Frog is overlapping portal at offset(-Frog.Height, 0) IsInPortal = 0 (finished operlapping)


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!
Last edited by trueicecold on Thu Sep 04, 2014 6:50 am, edited 1 time in total.
B
18
S
7
G
1
Posts: 160
Reputation: 1,934

Post » Thu Sep 04, 2014 6:45 am

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..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Thu Sep 04, 2014 6:47 am

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...
B
18
S
7
G
1
Posts: 160
Reputation: 1,934

Post » Thu Sep 04, 2014 6:55 am

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 :)
B
18
S
7
G
1
Posts: 160
Reputation: 1,934


Return to How do I....?

Who is online

Users browsing this forum: Yahoo [Bot], zenox98 and 6 guests