[SOLVED] Check if Player already collided with an object

Hi guys, as you can read in the title i need to check if my player collided with a lever.
For example, i start the scene/level with the lever red and i can jump normally.
If player collided with lever , the animation of lever skip to green and i can double jump but i have no idea how to do this… any help/idea?
Only if player already collided with lever i can double jump, else i can only jump 1 time
Thanks in advance!

You can use the collision condition which Checks if an object Is in collision with another.

Thanks for reply mate, may you write a piece of code so i can undestand better?

Ps: Good Youtuber :+1:t2::blush:

1 Like

I am not on pc presently but the event is something similar to.
Player is in collision with enemy.
If you still can’t find it in the conditions search you might have to select the object in the first row and search for it in the second.

Thanks :blush:

Try something like:

Condition: at the beginning of scene
Action: set variable Lever to red

Condition: variable Lever is red
Actions: (1) set animation of Lever to red (2) set normal jump parameters

Condition: Player is in collision with Lever
Action: set variable Lever to green

Condition: variable Layer is green
Actions: (1) set animation of Lever to green (2) set double jump parameters

2 Likes

Worked good, thanks.