Turn off switch

Hello, dear community,

I am new to FlowLab, and I am trying to make a game. When the is on the door and hits “A”, the level shell restart (as long as I don’t have any other level added to the game). It also works fine, when the player is on the door and I press “A”, the game restarts. But here is the problem:

It does also restart when the player moves to the door but then moves away again and then presses “A”. I want it to listen for the A key when the player is on the door, only. And when he moves away, it shell stop. But no matter what I do, I don’t get it turn off the switch. Here’s an image of the behaviour of the door:

turn_off_switch

And here is the game: https://flowlab.io/html5/bin/1375248

How do I do that?

There are several ways around this but the best one would probably be this:
2020.03.15-20.38
Set to this:
2020.03.15-20.38_01

Thank you very much! I copied your behaviour settings, and it works great now! But there is only one question remaining: I would like the switch to be turned off also when the player the player is jumping. How do I do that? These are my behaviour settings right now: https://www.bilder-upload.eu/bild-250bfe-1584325105.png.html

Now you need to know info that the player has, like when it collides with the ground.
You can tell the door by messaging it, you could also add the jump button to the door.

Messaging the door (door-3) in the player:
2020.03.15-21.21

Adding to the door:
2020.03.15-21.21_02