Well, I'm not a pro programmer and everything, but I might be able to help you...
I guess one way to "stack" your object would be with a global variable. Example: global.key = 0; Also, if you don't want the player to have too many keys, just do that: if (global.key >= 3) global.key = 3; (3 is just an example, put 5,6,7,etc if you want)
Make it that when you pick up the object, that variable upgrades by 1. Just like that: global.key = global.key + 1; Also, when you unlock a door: global.key = global.key - 1;
So with that, you can stack objects. Of course, you will need to say that;
Code:
if (global.key > 0)
{
global.key = global.key - 1;
}
You should put that code when the doors get unlocked, destroyed, something like that.
Now, to unlock doors with keys, say that you can only unlock doors when that global.key is greater than 0. You could put that in an key_press event or something,like'U'.
Also, you don't want to open those doors where ever you are in the game, so you will need an extra condition to it. For example, I suggest you to use collisions, like place_meeting or something like that.
Code:
if (global.key > 0)
{
//Unlock door commands, it could simply be to destroy
the doors, and add a condition to it, like when the player is close to the door, or with collision or something.
}
Hope that helps, I'm not pro though, so there are maybe better ways to do it, but since I saw nobody replied to you yet, I said to myself that I could try to help him and maybe give him some ideas how to do it. Also, huh, sorry if I don't give more explanations with collisions, you know, with that extra condition, since I'm not a pro, not a "beginner", but still, I will let that part to someone else more experienced than me to help you on that, I don't really want to give you some false explanations, if you know what I mean...