Here's an idea to get you started:
The main concept is to create and Area node which will act as a trigger-zone. By entering the trigger-zone, the key will be picked. Later, when approaching the door, which will have its own Area node, the door will open providing that the key was previously picked.
I do not know what type of game you are making (2D/3D), but it should generally work the same.
1) Supposing you have a 3D game, you can create an Area node. Select the Area node and add a new script
2) you will notice that on the right side of the editor (Godot 3.1 default settings) there are two tabs: Inspector and Node.
3) Go to Node and double click the onAreabody_entered() signal. Connect it to the newly added script
4) Now your script has this signal attached to it. Here's where you put your logic. Create a new variable in the beginning of the script. Name it key_acquired
or something informative.
5) Now the idea is that when you enter the Area of the key, the key_acquired
variable should be set to true
.
6) Similarly, whenever you enter the door Area, and providing you have acquired the key (thus setting the key_acquired
varibale to true
), the door should open.
Is that what you're aiming for? Upvote this answer if it is.