I am making a game and in the game i need it so when you have a key in your inventory and you press space when your by the door the door opens. ive gotten pretty far with it so far, ive made it so the door will open when you press space and i have it so you can pick up the key, but i cant get it so i cant go through the door when its closed, my character just goes right through the door.
I need help to make it so i cant go through door without the door being opened.
These are the codes im using right now:
code on the door:
onClipEvent(enterFrame){
if(_root.char.hitTest(this) && (Key.isDown(Key.SPACE)) && (_root.key._alpha >=100)){_root.key._alpha= 0;_root.door.gotoAndStop(2);}
}
the pickup key code:
onClipEvent(enterFrame){if(_root.char.hi tTest(this)){unloadMovie(this);_root.key ._alpha>=100;
}}
Any help would be great, thank you in advance