I am creating a room escape game, similar to those Adventure games. Three rooms: kitchen, living room, bath. Each room is in one scene. There are buttons connecting them. For instance in the kitchen is a little arrow to the right sight, clicking on it will move you to the living room, thus playing the scene living room.
Each scene consists of a backgroundpicturelayer, objects (inventory) layer, button layer, and a actionscript layer.
In the kitchen there is a key you can grab and put in your inventory. I do it with key1_mc
and key2_mc
. Key2 is the version of key1 that sits invisible in the inventory until key1 is grabbed. When clicking on key1, key1 becomes invisible and key2 becomes visible, thus giving the impression I grabbed it and put it in the inventory. I can copypaste the inventorylayer from kitchen in every other scene. Would it be possible to define that layer to show up in all other scenes?
In AS I say
key2_mc._visible = false;
key1_mc._visible = true;
key1_mc.onPress = function() {
key2_mc._visible = true;
key1_mc._visible = false;
keylocated = "keyfound"
}
The problem: Once I've grabbed the key, I want it to stay in my inventory, no matter how many times I walk around the three rooms, until I use it on the keyhole in the living room. But currently, after grabbing the key, leaving and re-entering the kitchen, it starts from the beginning.
But so far, whenever I enter any of those three rooms, they play from the beginning and don't care what I did in the other roomscenes. So I want to say in AS:
if in Scene kitchen key2_mc.visible = true
, then in [name of scene, or all other scenes] scene key2_mc = visible
. Or in livingroom AS: Check if in scene kitchen key2 was enabled visible. If, then here visible too.
Or have one meta AS Valid for all scenes?