[SOLVED]How do I make to so that if 2 objects are in collision with each other for 2 or more seconds, then the scene changes

I have a level select page where if the player and the platform are in collision for more that 2 seconds, then it changes the scene to that level. Can anyone help me with that. I tried using timers but it is not working.

maybe try

condition -
player is in collision with 01
action - empty

then add a sub event
condition - the timer “a” is greater than 2 sec
actions - change to scene “level” reset timer

adding a timer has recently changed how they work in last update check wiki on how

1 Like

Didn’t work. I even tried using scene variables and also tried out other methods but still doesn’t change the scene.

Also the player and platform have physics behavior and in that as well I have defined the height and width of the objects but it still doesn’t work.

Hello! I made it:

You can delete the timer if the player is not collision with O1 anymore if you want (maybe for performance). Just add the last event:

I tried, it is still not working. The player is 64 by 64 and has a physics property being dynamic. The O1 platform also has physics behavior being static and is 128 by 64. I think that might be creating a problem. If you can try it and see if it is not working or is it just a problem I am facing.

There are different ways, this is how it works for me.

As you suspect, physics can be the problem. Have you tried the platform behavior?

If you drop a dynamic object on a static, you can see a 1 or 2px gap between both, depending on the speed of the collision. It stops before it’s actually in colision and your condition will not executed.
You can try Shape Offset Y 1 for the platforms and Shape Offset Y -1 for player in their physics behavior.

THANK YOU. The previous code I wrote worked but because of the offset thing you told. Thank you so much. It works perfectly. I knew the problem was the behavior but didn’t know what in that. Thank you for your help. i truly appreciate it. :clap: :raised_hands: