Hey guys, this is my first time posting. I am having trouble finding an answer to this question. How would I make a door that requires a key to open it? The goal is to have the player search one layout for the key, and once it is found, have them go to the locked door. Once the door is unlocked, they go through and enter a new layout. Right now I just have a solid sprite with an on collision effect on it, so when you run into it, you get transferred to the new layout. That's about as far as I got. Any help would be great. Thank you!
Develop games in your browser. Powerful, performant & highly capable.
Add an instance variable to the door of KEYID. When they find the key, you would need to store the id of the key in their inventory. When they try to open the door, if they have that key (id matches) then the door is "open"
Do you have an example? I would kick the door, add an instance variable. Type in KEYID, and would I choose Boolean, Number, Or Text? ANd how would that lock the door. I'm sorry Im such a noob at this..
It could be done several ways, here is one example.
Awesome thank you! Is there a place I can see other methods? Just so I can choose the one best for my game? Thank you so much!
I found this useful, but I think the next step would be to add an inventory system.
Also, use save player data as a way to collect items and add a save game feature.
Three years later, I wonder what your game looks like now.