Alright so I’m working on a proof-of-concept escape game and I need a little help with the programming. I’m new to AS3, so keep your replies simple so I can understand them =P
First of all, when switching scenes by clicking btn_larrow, I am using:
stop();
btn_larrow.addEventListener(MouseEvent.CLICK, larrowClick);
function larrowClick(event:MouseEvent):void{
gotoAndStop("room4");
}
It’s giving me a compiler error of: 1120: Access of undefined property btn_door. Is there a way to fix this, and/or a better way to accomplish switching scenes?
When a player first clicks on an item, I want it to appear in their inventory, which is a little panel at the bottom of the screen. Ideally, the player can pick up any item, in any order. The only way I thought I could accomplish was by placing the item on screen at a visible location, and then having an instance of that item off screen. Then:
stop();
btn_key.addEventListener(MouseEvent.CLICK, keyClick);
var player_has_key:Boolean = false
function keyClick(event:MouseEvent):void{
var player_has_key:Boolean = true
if(player_has_key == true){
btn_key.x = 250
btn_key.y = 250
btn_key1.x = 0
btn_key1.y = 0
}
btn_key is the off screen instance of the item, and btn_key1 is the on screen, visible instance. As stated before, if there is a better way to do this, please let me know!
Thanks,
j. phil.