Created
September 15, 2016 03:06
-
-
Save KinnaT/df04a78875a12c94c6f42bb856e7c3c0 to your computer and use it in GitHub Desktop.
Glitch locked door functions - embedded in .fla
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import flash.utils.setTimeout; | |
// public! | |
// key_id is a string number, 1 though 12, which corresponds to the keyhole(1-12) symbols on the stage | |
function showLock(key_id:String):void { | |
chains.visible = true; | |
showKeyhole(key_id); | |
} | |
// public! | |
function hideLock():void { | |
chains.visible = false; | |
} | |
// public! | |
function unlock():void { | |
// this method should start the animation that displays when the door is unlocked, an animation | |
// that should stop and its last frame and pause there. | |
gotoAndPlay(2); | |
chains.gotoAndPlay(2); | |
} | |
// public! | |
function relock():void { | |
// this method should reset to default state | |
gotoAndStop(1); | |
chains.gotoAndStop(1); | |
stopAll(); | |
} | |
function hideKeyholes():void { | |
for (var i:int=1;i<=12;i++) { | |
if (this['keyhole'+i]) this['keyhole'+i].visible = false; | |
} | |
} | |
function showKeyhole(which:String):void { | |
hideKeyholes(); | |
if (this['keyhole'+which]) { | |
this['keyhole'+which].visible = true; | |
} | |
} | |
function stopAll():void { | |
stop(); | |
chains.stop(); | |
} | |
stopAll(); | |
var inited:Boolean; | |
if (!inited) { | |
trace(1) | |
hideLock(); | |
hideKeyholes(); | |
/* | |
showLock('2'); | |
unlock(); | |
setTimeout(function():void { | |
relock() | |
}, 2000); | |
*/ | |
inited = true; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment