So... right now we've got a player that can swap between layers as much as they feel like it. But we want it so that only the enemies respawn when the player goes back to a previously visited layer. Items that they've picked up (keys, money) don't respawn. But if they haven't picked up that item before... the item should be there.
I know I could do this by making a long list of all the items and put a 'check' if the player has grabbed it in the past and then destroy it on startup if the player has gotten it. But this seems like it would be rather resource intensive, not to mention being a royal pain to implement.
Is there an easy way to accomplish this? Or a better method? I'm all for using other people's experiences and knowledge!
Im afraid a list is your best option, but you have several options for that.
What you need is a global. Global means it's carried across all layouts. So when you change a global variable, that value is carried to the next layout. same goes for arrays, incs, etc... that is if you tick global in preferences.
Develop games in your browser. Powerful, performant & highly capable.
Everything that Newt said.
I did a really simple example of what you are talking about in the Adventure tutorial part 4 using global arrays.
Look at that example and perhaps you will get some ideas for an approach that might work for you.