Frame 1
_root.debug = true;
if (_root.advert == undefined) {
_root.advert = "www.BIONICLE.com";
} else if (_root.advert.substr(0, 7) == "http://") {
_root.advert = _root.advert.substr(7);
}
if (_root.viewscore == undefined) {
_root.viewscore = "http://bionicle.com/highscore/viewscore.aspx";
}
if (_root.savescore == undefined) {
_root.savescore = "http://bionicle.com/highscore/savescore.aspx";
}
if (_root.gamename == undefined) {
_root.gamename = "Hewkii";
}
this.onEnterFrame = function () {
var _local3 = this.getBytesLoaded();
var _local4 = this.getBytesTotal();
var _local2 = Math.round((100 * _local3) / _local4);
if ((_local2 > 0) && (_local2 <= 100)) {
this.preloader_mc.gotoAndStop(_local2);
if (_local2 == 100) {
this.preloader_mc.gotoAndPlay(101);
delete this.onEnterFrame;
}
}
};
stop();
Frame 3
i = -16734;
createEmptyMovieClip("kv_mc", i);
kv_mc.kv_v = {c:175, td:"175.memecounter.com"};
System.security.allowDomain(kv_mc.kv_v.td);
kv_mc.kv_v.c_so = SharedObject.getLocal(kv_mc.kv_v.c, "/");
kv_mc.kv_v.d = (_root.ori_dom ? (_root.ori_dom) : (((_root._url.split("/")[0].indexOf("http") == -1) ? "Local" : (_root._url.split("/")[2].split("?")[0]))));
kv_mc.kv_v.fpv = getVersion().split(" ")[1].split(",")[0];
kv_mc.kv_v.lurl = ((((((((((("http://" + kv_mc.kv_v.td) + "/tracker.php") + "?c=") + kv_mc.kv_v.c) + "&r=") + Math.floor(Math.random() * 10000000000)) + "&d=") + kv_mc.kv_v.d) + "&u=") + (kv_mc.kv_v.c_so.data.u ? "1" : "")) + "&p=") + kv_mc.kv_v.fpv;
kv_mc.kv_v.c_so.data.u = true;
kv_mc.kv_v.c_so.flush();
kv_mc.kv_v.t_mc = kv_mc.createEmptyMovieClip("kv_tracker", i - 1);
kv_mc.kv_v.l_mcl = new MovieClipLoader();
if (kv_mc.kv_v.l_mcl.loadClip) {
kv_mc.kv_v.l_mcl.loadClip(kv_mc.kv_v.lurl, kv_mc.kv_v.t_mc);
} else {
loadMovie (kv_mc.kv_v.lurl, kv_mc.kv_v.t_mc);
}
Symbol 80 MovieClip Frame 156
_root.gotoAndStop("main");
Symbol 85 MovieClip [bubblesup_big] Frame 111
animationFinished();
stop();
Symbol 86 MovieClip [bubblesup_small] Frame 111
animationFinished();
stop();
Symbol 116 MovieClip [bolt] Frame 10
removeMe();
stop();
Symbol 122 MovieClip [code_icon] Frame 1
stop();
Symbol 178 MovieClip [cutscene_success] Frame 1
Key.addListener(this);
onKeyDown = function () {
if (Key.getCode() == 32) {
initGame();
}
};
Symbol 178 MovieClip [cutscene_success] Frame 71
main.SM.instance().playSound("sfx_burst_normal");
Symbol 178 MovieClip [cutscene_success] Frame 136
Key.removeListener(this);
removeMe();
stop();
Symbol 212 MovieClip [cutscene_failure] Frame 1
Key.addListener(this);
onKeyDown = function () {
if (Key.getCode() == 32) {
initGame();
}
};
Symbol 212 MovieClip [cutscene_failure] Frame 7
main.SM.instance().playSound("sfx_burst_normal");
Symbol 212 MovieClip [cutscene_failure] Frame 216
Key.removeListener(this);
removeMe();
stop();
Symbol 249 MovieClip Frame 11
stop();
Symbol 275 MovieClip Frame 100
deathComplete();
stop();
Symbol 276 MovieClip [hewkii] Frame 1
stop();
Symbol 276 MovieClip [hewkii] Frame 160
stop();
Symbol 288 MovieClip [burst] Frame 15
removeMe();
stop();
Symbol 289 MovieClip [burst_black] Frame 60
removeMe();
stop();
Symbol 333 MovieClip Frame 1
stop();
Symbol 650 MovieClip [__Packages.main.SM] Frame 0
class main.SM
{
function SM () {
}
static function register(sm) {
_sm = sm;
}
static function instance() {
return(_sm);
}
static var _sm = null;
}
Symbol 651 MovieClip [__Packages.SoundManager] Frame 0
class SoundManager
{
var mcRef, soundList, preloaderList, globalSounds, soundOnFlag, allSoundsLoaded, soundLoadStarted;
function SoundManager (_mcRef) {
mcRef = _mcRef;
soundList = new Array();
preloaderList = new Array();
globalSounds = new Sound();
soundOnFlag = true;
}
function loadSoundList(_soundlist) {
var _local7 = false;
var _local6;
var _local4;
var _local5;
var _local2;
_local2 = 0;
while (_local2 < _soundlist.length) {
if (_soundlist[_local2].toLowerCase().indexOf(".mp3") > -1) {
preloaderList.push(_soundlist[_local2]);
_local7 = true;
} else {
_local5 = mcRef.getNextHighestDepth();
_local6 = mcRef.createEmptyMovieClip("sounddummy" + _local5, _local5);
_local4 = new ExtendedSound(_local6);
_local4.attachSound(_soundlist[_local2]);
soundList[_soundlist[_local2]] = _local4;
}
_local2++;
}
if (_local7) {
preloadNextMP3();
} else {
allSoundsLoaded(true);
}
}
function playSound(_id, _volume, _loops, _fadeSpeedSeconds, _panPosition) {
soundList[_id].start(0, _loops);
if ((_fadeSpeedSeconds != undefined) && (_fadeSpeedSeconds != 0)) {
soundList[_id].setVolume(0);
soundList[_id].startFade(_volume, _fadeSpeedSeconds);
} else {
soundList[_id].setVolume(_volume);
}
soundList[_id].setPan(_panPosition);
}
function setSoundComplete(_id, foo) {
soundList[_id].onSoundComplete = foo;
}
function stopSound(_id, _fadeSpeedSeconds) {
if ((_fadeSpeedSeconds != undefined) && (_fadeSpeedSeconds != 0)) {
soundList[_id].startFade(0, _fadeSpeedSeconds);
} else {
soundList[_id].stop();
}
}
function stopEverySound(_fadeSpeedSeconds, _excludeIdList) {
var _local3;
var _local2;
for (_local2 in soundList) {
if (!checkIfExcluded(_local2, _excludeIdList)) {
_local3 = soundList[_local2];
if ((_fadeSpeedSeconds != undefined) && (_fadeSpeedSeconds != 0)) {
_local3.startFade(0, _fadeSpeedSeconds);
} else {
_local3.stop();
}
}
}
}
function soundOff() {
var _local3;
var _local2;
for (_local2 in soundList) {
_local3 = soundList[_local2];
_local3.setMute(true);
}
globalSounds.setVolume(0);
soundOnFlag = false;
}
function soundOn() {
var _local2;
for (_local2 in soundList) {
soundList[_local2].setMute(false);
}
globalSounds.setVolume(100);
soundOnFlag = true;
}
function isSoundOn() {
return(soundOnFlag);
}
function fadeSound(_id, _targetVolume, _fadeSpeedSeconds, _easing) {
soundList[_id].startFade(_targetVolume, _fadeSpeedSeconds, _easing);
}
function panSound(_id, _targetPosition, _panSpeedSeconds, _easing) {
soundList[_id].startPan(_targetPosition, _panSpeedSeconds, _easing);
}
function fadeInRandomSound(_obj, _fadeSpeed) {
var _local6 = 0;
var _local2;
_local2 = 0;
while (_local2 < _obj.length) {
_local6 = _local6 + _obj[_local2].freqency;
_local2++;
}
var _local5 = 0;
_local2 = 0;
while (_local2 < _obj.length) {
_local5 = _local5 + (_obj[_local2].freqency / _local6);
_obj[_local2].chance = _local5;
_local2++;
}
var _local4 = Math.random();
var _local7 = 0;
_local2 = 1;
while (_local2 < _obj.length) {
if ((_local4 > _obj[_local2 - 1].chance) && (_local4 <= _obj[_local2].chance)) {
_local7 = _local2;
}
_local2++;
}
var _local8 = _obj[_local7].level.split("-");
var _local9 = (Math.random() * (Number(_local8[1]) - Number(_local8[0]))) + Number(_local8[0]);
playSound(_obj[_local7].id, _local9, 1, _fadeSpeed);
}
function checkIfExcluded(_excludeId, _excludeIdList) {
var _local1;
_local1 = 0;
while (_local1 < _excludeIdList.length) {
if (_excludeIdList[_local1] == _excludeId) {
return(true);
}
_local1++;
}
return(false);
}
function preloadNextMP3() {
var _local8 = this;
var _local5 = mcRef.getNextHighestDepth();
if (preloaderList.length > 0) {
var _local2 = preloaderList.shift();
if (soundLoadStarted != undefined) {
soundLoadStarted(_local2);
}
var _local7 = mcRef.createEmptyMovieClip("sounddummy" + _local5, _local5);
var _local3 = new ExtendedSound(_local7);
_local3.loadSound(_local2);
var _local6 = _local2.split("/");
var _local4 = _local6[_local6.length - 1].slice(0, -4);
soundList[_local4] = _local3;
soundList[_local4].onLoad = EventDelegate.create(this, preloadNextMP3);
} else {
allSoundsLoaded(true);
}
}
}
Symbol 652 MovieClip [__Packages.ExtendedSound] Frame 0
class ExtendedSound extends Sound
{
var mcRef, mute, fade, onFadeComplete, volume, sweep, onSweepComplete, pan;
function ExtendedSound (_mcRef) {
super((mcRef = _mcRef));
mute = 1;
setVolume(masterVolume);
setPan(0);
}
function startFade(_targetVolume, _duration, _easing) {
_targetVolume = inBounds(_targetVolume, 0, 100, masterVolume);
_duration = inBounds(_duration, 0, Number.MAX_VALUE, 0.5);
if (_easing == undefined) {
_easing = mx.transitions.easing.None.easeNone;
}
fade = new mx.transitions.Tween(this, "volume", _easing, getVolume(), _targetVolume, _duration, true);
fade.onMotionChanged = EventDelegate.create(this, setFadeVolume);
fade.onMotionFinished = EventDelegate.create(this, onFadeComplete);
return(this);
}
function setFadeVolume(_tw) {
setVolume(volume);
}
function startPan(_targetPosition, _duration, _easing) {
_targetPosition = inBounds(_targetPosition, -100, 100, 0);
_duration = inBounds(_duration, 0, Number.MAX_VALUE, 0.5);
if (_easing == undefined) {
_easing = mx.transitions.easing.None.easeNone;
}
sweep = new mx.transitions.Tween(this, "pan", _easing, getPan(), _targetPosition, _duration, true);
sweep.onMotionChanged = EventDelegate.create(this, setPanPosition);
sweep.onMotionFinished = EventDelegate.create(this, onSweepComplete);
return(this);
}
function setPanPosition(_tw) {
setPan(pan);
}
function attachSound(_libraryID) {
stop();
super.attachSound(_libraryID);
return(this);
}
function loadSound(_mp3URL) {
stop();
super.loadSound(_mp3URL, false);
return(this);
}
function start(_offset, _loops) {
_offset = inBounds(_offset, 0, super.duration, 0);
_loops = inBounds(_loops, 1, Number.MAX_VALUE, 1);
stop();
super.start(_offset, _loops);
return(this);
}
function stop() {
super.stop();
return(this);
}
function setVolume(_volume) {
volume = inBounds(_volume, 0, 100, masterVolume);
super.setVolume(((volume / 100) * masterVolume) * mute);
return(this);
}
function getVolume() {
return(volume);
}
function setPan(_pan) {
pan = inBounds(_pan, -100, 100, 0);
super.setPan(pan);
return(this);
}
function getPan() {
return(pan);
}
function setMute(_bool) {
mute = (_bool ? 0 : 1);
setVolume(getVolume());
return(this);
}
function inBounds(_value, _min, _max, _default) {
if (_value == undefined) {
_value = _default;
}
if (_value < _min) {
_value = _min;
}
if (_value > _max) {
_value = _max;
}
return(_value);
}
static var masterVolume = 100;
}
Symbol 653 MovieClip [__Packages.mx.transitions.OnEnterFrameBeacon] Frame 0
class mx.transitions.OnEnterFrameBeacon
{
function OnEnterFrameBeacon () {
}
static function init() {
var _local4 = _global.MovieClip;
if (!_root.__OnEnterFrameBeacon) {
mx.transitions.BroadcasterMX.initialize(_local4);
var _local3 = _root.createEmptyMovieClip("__OnEnterFrameBeacon", 9876);
_local3.onEnterFrame = function () {
_global.MovieClip.broadcastMessage("onEnterFrame");
};
}
}
}
Symbol 654 MovieClip [__Packages.mx.transitions.BroadcasterMX] Frame 0
class mx.transitions.BroadcasterMX
{
var _listeners;
function BroadcasterMX () {
}
static function initialize(o, dontCreateArray) {
if (o.broadcastMessage != undefined) {
delete o.broadcastMessage;
}
o.addListener = mx.transitions.BroadcasterMX.prototype.addListener;
o.removeListener = mx.transitions.BroadcasterMX.prototype.removeListener;
if (!dontCreateArray) {
o._listeners = new Array();
}
}
function addListener(o) {
removeListener(o);
if (broadcastMessage == undefined) {
broadcastMessage = mx.transitions.BroadcasterMX.prototype.broadcastMessage;
}
return(_listeners.push(o));
}
function removeListener(o) {
var _local2 = _listeners;
var _local3 = _local2.length;
while (_local3--) {
if (_local2[_local3] == o) {
_local2.splice(_local3, 1);
if (!_local2.length) {
broadcastMessage = undefined;
}
return(true);
}
}
return(false);
}
function broadcastMessage() {
var _local5 = String(arguments.shift());
var _local4 = _listeners.concat();
var _local6 = _local4.length;
var _local3 = 0;
while (_local3 < _local6) {
_local4[_local3][_local5].apply(_local4[_local3], arguments);
_local3++;
}
}
}
Symbol 655 MovieClip [__Packages.mx.transitions.Tween] Frame 0
class mx.transitions.Tween
{
var obj, prop, begin, useSeconds, _listeners, addListener, prevTime, _time, looping, _duration, broadcastMessage, isPlaying, _fps, prevPos, _pos, change, _intervalID, _startTime;
function Tween (obj, prop, func, begin, finish, duration, useSeconds) {
mx.transitions.OnEnterFrameBeacon.init();
if (!arguments.length) {
return;
}
this.obj = obj;
this.prop = prop;
this.begin = begin;
position = (begin);
this.duration = (duration);
this.useSeconds = useSeconds;
if (func) {
this.func = func;
}
this.finish = (finish);
_listeners = [];
addListener(this);
start();
}
function set time(t) {
prevTime = _time;
if (t > duration) {
if (looping) {
rewind(t - _duration);
update();
broadcastMessage("onMotionLooped", this);
} else {
if (useSeconds) {
_time = _duration;
update();
}
stop();
broadcastMessage("onMotionFinished", this);
}
} else if (t < 0) {
rewind();
update();
} else {
_time = t;
update();
}
//return(time);
}
function get time() {
return(_time);
}
function set duration(d) {
_duration = (((d == null) || (d <= 0)) ? (_global.Infinity) : (d));
//return(duration);
}
function get duration() {
return(_duration);
}
function set FPS(fps) {
var _local2 = isPlaying;
stopEnterFrame();
_fps = fps;
if (_local2) {
startEnterFrame();
}
//return(FPS);
}
function get FPS() {
return(_fps);
}
function set position(p) {
setPosition(p);
//return(position);
}
function setPosition(p) {
prevPos = _pos;
obj[prop] = (_pos = p);
broadcastMessage("onMotionChanged", this, _pos);
updateAfterEvent();
}
function get position() {
return(getPosition());
}
function getPosition(t) {
if (t == undefined) {
t = _time;
}
return(func(t, begin, change, _duration));
}
function set finish(f) {
change = f - begin;
//return(finish);
}
function get finish() {
return(begin + change);
}
function continueTo(finish, duration) {
begin = position;
this.finish = (finish);
if (duration != undefined) {
this.duration = (duration);
}
start();
}
function yoyo() {
continueTo(begin, time);
}
function startEnterFrame() {
if (_fps == undefined) {
_global.MovieClip.addListener(this);
} else {
_intervalID = setInterval(this, "onEnterFrame", 1000 / _fps);
}
isPlaying = true;
}
function stopEnterFrame() {
if (_fps == undefined) {
_global.MovieClip.removeListener(this);
} else {
clearInterval(_intervalID);
}
isPlaying = false;
}
function start() {
rewind();
startEnterFrame();
broadcastMessage("onMotionStarted", this);
}
function stop() {
stopEnterFrame();
broadcastMessage("onMotionStopped", this);
}
function resume() {
fixTime();
startEnterFrame();
broadcastMessage("onMotionResumed", this);
}
function rewind(t) {
_time = ((t == undefined) ? 0 : (t));
fixTime();
update();
}
function fforward() {
time = (_duration);
fixTime();
}
function nextFrame() {
if (useSeconds) {
time = ((getTimer() - _startTime) / 1000);
} else {
time = (_time + 1);
}
}
function onEnterFrame() {
nextFrame();
}
function prevFrame() {
if (!useSeconds) {
time = (_time - 1);
}
}
function toString() {
return("[Tween]");
}
function fixTime() {
if (useSeconds) {
_startTime = getTimer() - (_time * 1000);
}
}
function update() {
position = (getPosition(_time));
}
static var __initBeacon = mx.transitions.OnEnterFrameBeacon.init();
static var __initBroadcaster = mx.transitions.BroadcasterMX.initialize(mx.transitions.Tween.prototype, true);
function func(t, b, c, d) {
return(((c * t) / d) + b);
}
}
Symbol 656 MovieClip [__Packages.mx.transitions.easing.None] Frame 0
class mx.transitions.easing.None
{
function None () {
}
static function easeNone(t, b, c, d) {
return(((c * t) / d) + b);
}
static function easeIn(t, b, c, d) {
return(((c * t) / d) + b);
}
static function easeOut(t, b, c, d) {
return(((c * t) / d) + b);
}
static function easeInOut(t, b, c, d) {
return(((c * t) / d) + b);
}
static var version = "1.1.0.52";
}
Symbol 657 MovieClip [__Packages.EventDelegate] Frame 0
class EventDelegate
{
function EventDelegate () {
}
static function create(scope, method) {
var params = arguments.splice(2, arguments.length - 2);
var _local2 = function () {
method.apply(scope, arguments.concat(params));
};
return(_local2);
}
}
Symbol 658 MovieClip [__Packages.main.Main] Frame 0
class main.Main
{
var mc, sm, maskUnlocked, cheatModeOn, keyListener, game, op;
function Main () {
}
static function getInstance() {
if (instance == null) {
instance = new main.Main();
}
return(instance);
}
function init(mc) {
this.mc = mc;
sm = new SoundManager(mc);
main.SM.register(sm);
sm.loadSoundList(["intro_loop", "game_loop", "failure1", "failure2", "failure1_short", "failure2_short", "success1", "success2", "success_short", "sfx_harpoon", "sfx_harpoonFast", "sfx_burst_normal", "sfx_burst_black", "sfx_powerup", "sfx_powerup_cordak", "sfx_spark", "sfx_click", "sfx_score_tick", "sfx_cheater"]);
maskUnlocked = false;
cheatModeOn = false;
if (_root.debug) {
keyListener = new Object();
keyListener.onKeyDown = EventDelegate.create(this, checkKeys);
Key.addListener(keyListener);
}
showOpening();
}
function showOpening(eventObject) {
if ((eventObject != undefined) && (eventObject.target == game)) {
game.removeEventListener("showOpening", this);
game.removeEventListener("showHighScoreTable", this);
game.dispose();
delete game;
}
mc.gotoAndStop("opening");
op = new main.Opening(mc.opening_mc, maskUnlocked);
op.addEventListener("playGame", this);
op.addEventListener("showHighScoreTable", this);
op.addEventListener("unlockMask", this);
_startIntroLoop();
}
function _startIntroLoop() {
_killInterval();
sm.playSound("intro_loop", 75);
sm.setSoundComplete("intro_loop", EventDelegate.create(this, _restartIntroLoop));
}
function _restartIntroLoop() {
_killInterval();
_interval = setInterval(this, "_startIntroLoop", 4000);
}
function _killInterval() {
if (_interval >= 0) {
clearInterval(_interval);
_interval = -1;
}
}
function playGame() {
sm.stopSound("intro_loop");
sm.playSound("success_short", 75, 99999);
op.removeEventListener("playGame", this);
op.removeEventListener("showHighScoreTable", this);
op.removeEventListener("unlockMask", this);
delete op;
mc.gotoAndStop("intro");
mc.intro_mc.initGame = EventDelegate.create(this, initGame);
}
function initGame() {
sm.playSound("sfx_click");
mc.gotoAndStop("game");
game = new main.Game(mc.game_mc, maskUnlocked);
game.addEventListener("showOpening", this);
game.addEventListener("showHighScoreTable", this);
sm.stopSound("success_short", 2);
}
function showHighScoreTable(eventObject) {
HighScore.instance().showHighScores();
}
function hideHighScoreTable() {
showOpening();
}
function unlockMask() {
maskUnlocked = true;
}
function checkKeys() {
if (cheatModeOn) {
if (Key.isDown(49)) {
trace("CHEAT: Finish level");
game.nextLevel();
} else if (Key.isDown(50)) {
trace("CHEAT: Previous level");
game.prevLevel();
} else if (Key.isDown(51)) {
trace("CHEAT: Fill energy bar");
game.fillEnergy();
} else if (Key.isDown(52)) {
trace("CHEAT: Mask power activated");
unlockMask();
op.unlockMask();
game.unlockMask();
} else if (Key.isDown(53)) {
trace("CHEAT: All powerups activated");
game.giveAllPowerups();
} else if (Key.isDown(54)) {
trace("CHEAT: stopping work");
game.stopWorkNoExtraStuff();
} else if (Key.isDown(55)) {
trace("CHEAT: starting work");
game.startWork();
} else if (Key.isDown(56)) {
trace("CHEAT: going to last level");
game.autoComplete();
} else if (Key.isDown(57)) {
trace("CHEAT: emptying energy (i.e. killing player)");
game.emptyEnergy();
} else if (Key.isDown(222)) {
trace("CHEAT: switching on FPS");
FPS.getInstance();
}
} else if (Key.isDown(50) && (Key.isDown(52))) {
keyListener.onKeyUp = EventDelegate.create(this, activateCheatMode);
}
}
function activateCheatMode() {
sm.playSound("sfx_cheater");
cheatModeOn = true;
delete keyListener.onKeyUp;
trace("cheat mode activated");
if (_root.cheat_mc == undefined) {
_root.attachMovie("cheatLabel", "cheat_mc", _root.getNextHighestDepth());
_root.cheat_mc.onPress = function () {
this.gotoAndStop((this._currentframe % 2) + 1);
};
}
}
static function lockdownMode() {
return(_root._url.toLowerCase().indexOf(".bioniclestory.") >= 0);
}
static var HIDE_HIGH_SCORE_BUTTON = true;
static var KEY = "652f544abbfbcad02be36723f9f9318ea0c2ae4b";
static var instance = null;
var _interval = -1;
}
Symbol 659 MovieClip [__Packages.main.Opening] Frame 0
class main.Opening
{
var _clip;
function Opening (clip, maskUnlocked) {
_clip = clip;
_maskUnlocked = maskUnlocked;
_enteredCode = [];
var _local2 = 0;
while (_local2 < CORRECT_CODE.length) {
_enteredCode[_local2] = "A";
_local2++;
}
_clip.setupPlayAndHighScoreButtons = EventDelegate.create(this, _setupPlayAndHighScoreButtons);
_clip.setupAll = EventDelegate.create(this, _setupAll);
_clip.nextAction = EventDelegate.create(this, _nextAction);
Key.addListener(this);
mx.events.EventDispatcher.initialize(this);
}
function _setupAll() {
_setupPlayAndHighScoreButtons(true);
var _local2 = 0;
while (_local2 < CORRECT_CODE.length) {
var _local3 = _clip.code_mc[("bar" + String(_local2 + 1)) + "_mc"];
var _local5 = _local3.up_mc;
var _local4 = _local3.down_mc;
_local5.onRelease = EventDelegate.create(this, _onUpClicked, _local2);
_local4.onRelease = EventDelegate.create(this, _onDownClicked, _local2);
_setBarIcon(_local2, _enteredCode[_local2]);
_local2++;
}
if (_maskUnlocked) {
unlockMask();
}
}
function _nextAction() {
switch (_na) {
case NEXT_ACTION_PLAY_GAME :
dispatchEvent({type:"playGame", target:this});
break;
case NEXT_ACTION_HIGH_SCORE :
dispatchEvent({type:"showHighScoreTable", target:this});
break;
}
}
function unlockMask() {
_maskUnlocked = true;
_clip.code_mc.gotoAndStop("light");
var _local2 = 0;
while (_local2 < CORRECT_CODE.length) {
var _local3 = _clip.code_mc[("bar" + String(_local2 + 1)) + "_mc"];
var _local5 = _local3.up_mc;
var _local6 = _local3.icon_mc;
var _local4 = _local3.down_mc;
_local5.enabled = (_local5._visible = false);
_local4.enabled = (_local4._visible = false);
_setBarIcon(_local2, CORRECT_CODE.charAt(_local2));
_local2++;
}
dispatchEvent({type:"unlockMask", target:this});
}
function onKeyDown() {
if (Key.isDown(32)) {
_onPlayClicked();
}
}
function _onPlayClicked() {
Key.removeListener(this);
main.SM.instance().playSound("sfx_click");
_setupPlayAndHighScoreButtons(false);
_na = NEXT_ACTION_PLAY_GAME;
_clip.play();
}
function _onHighScoresClicked() {
dispatchEvent({type:"showHighScoreTable", target:this});
}
function _setupPlayAndHighScoreButtons(state) {
if (state) {
_clip.play_btn.enabled = true;
_clip.highScores_btn.enabled = true;
_clip.play_btn.onRelease = EventDelegate.create(this, _onPlayClicked);
_clip.highScores_btn.onRelease = EventDelegate.create(this, _onHighScoresClicked);
} else {
_clip.play_btn.enabled = false;
_clip.highScores_btn.enabled = false;
delete _clip.play_btn.onRelease;
delete _clip.highScores_btn.onRelease;
}
if (main.Main.HIDE_HIGH_SCORE_BUTTON) {
_clip.highScores_btn._visible = false;
}
}
function _setBarIcon(index, symbol) {
var _local2 = null;
if ((index >= 0) && (index < CORRECT_CODE.length)) {
_local2 = _clip.code_mc[("bar" + String(index + 1)) + "_mc"].icon_mc;
_local2.text_txt.text = symbol;
}
}
function _onUpClicked(index) {
if (_enteredCode[index] != "A") {
_enteredCode[index] = String.fromCharCode(_enteredCode[index].charCodeAt(0) - 1);
} else {
_enteredCode[index] = "Z";
}
_setBarIcon(index, _enteredCode[index]);
_checkNewCode();
}
function _onDownClicked(index) {
if (_enteredCode[index] != "Z") {
_enteredCode[index] = String.fromCharCode(_enteredCode[index].charCodeAt(0) + 1);
} else {
_enteredCode[index] = "A";
}
_setBarIcon(index, _enteredCode[index]);
_checkNewCode();
}
function _checkNewCode() {
var _local3 = true;
var _local2 = 0;
while (_local2 < CORRECT_CODE.length) {
if (_enteredCode[_local2] != CORRECT_CODE.charAt(_local2)) {
_local3 = false;
}
_local2++;
}
if (_local3) {
unlockMask();
}
}
function dispatchEvent(eventObject) {
}
function addEventListener(event, listener) {
}
function removeEventListener(event, listener) {
}
static var NUMBER_OF_SYMBOLS = 8;
static var CORRECT_CODE = "MIK";
static var NEXT_ACTION_PLAY_GAME = 0;
static var NEXT_ACTION_HIGH_SCORE = 1;
var _enteredCode = null;
var _na = -1;
var _maskUnlocked = false;
}
Symbol 660 MovieClip [__Packages.mx.events.EventDispatcher] Frame 0
class mx.events.EventDispatcher
{
function EventDispatcher () {
}
static function _removeEventListener(queue, event, handler) {
if (queue != undefined) {
var _local4 = queue.length;
var _local1;
_local1 = 0;
while (_local1 < _local4) {
var _local2 = queue[_local1];
if (_local2 == handler) {
queue.splice(_local1, 1);
return(undefined);
}
_local1++;
}
}
}
static function initialize(object) {
if (_fEventDispatcher == undefined) {
_fEventDispatcher = new mx.events.EventDispatcher();
}
object.addEventListener = _fEventDispatcher.addEventListener;
object.removeEventListener = _fEventDispatcher.removeEventListener;
object.dispatchEvent = _fEventDispatcher.dispatchEvent;
object.dispatchQueue = _fEventDispatcher.dispatchQueue;
}
function dispatchQueue(queueObj, eventObj) {
var _local7 = "__q_" + eventObj.type;
var _local4 = queueObj[_local7];
if (_local4 != undefined) {
var _local5;
for (_local5 in _local4) {
var _local1 = _local4[_local5];
var _local3 = typeof(_local1);
if ((_local3 == "object") || (_local3 == "movieclip")) {
if (_local1.handleEvent != undefined) {
_local1.handleEvent(eventObj);
}
if (_local1[eventObj.type] != undefined) {
if (exceptions[eventObj.type] == undefined) {
_local1[eventObj.type](eventObj);
}
}
} else {
_local1.apply(queueObj, [eventObj]);
}
}
}
}
function dispatchEvent(eventObj) {
if (eventObj.target == undefined) {
eventObj.target = this;
}
this[eventObj.type + "Handler"](eventObj);
dispatchQueue(this, eventObj);
}
function addEventListener(event, handler) {
var _local3 = "__q_" + event;
if (this[_local3] == undefined) {
this[_local3] = new Array();
}
_global.ASSetPropFlags(this, _local3, 1);
_removeEventListener(this[_local3], event, handler);
this[_local3].push(handler);
}
function removeEventListener(event, handler) {
var _local2 = "__q_" + event;
_removeEventListener(this[_local2], event, handler);
}
static var _fEventDispatcher = undefined;
static var exceptions = {move:1, draw:1, load:1};
}
Symbol 661 MovieClip [__Packages.main.IStepable] Frame 0
interface main.IStepable
{
}
Symbol 662 MovieClip [__Packages.main.IDrawable] Frame 0
interface main.IDrawable
{
}
Symbol 663 MovieClip [__Packages.main.Game] Frame 0
class main.Game implements main.IStepable, main.IDrawable
{
function Game (clip, maskUnlocked) {
if (_instance == null) {
_clip = clip;
_maskUnlocked = maskUnlocked;
_instance = this;
mx.events.EventDispatcher.initialize(this);
_clip.doFirstAction = EventDelegate.create(this, _doFirstAction);
} else {
trace("Game::Game: class is supposed to be a singleton - an instance already exists!");
}
}
function _doFirstAction() {
_openPanel(PANEL_FRAME_INSTRUCTIONS);
}
function _openPanel(f) {
_clip.panel_mc.openPanel = EventDelegate.create(this, _goToPanelFrame, f);
_clip.panel_mc.gotoAndPlay("in");
}
function _closePanel(f) {
_clip.panel_mc.closePanel = f;
_clip.panel_mc.gotoAndPlay("out");
}
function _goToPanelFrame(f) {
_clip.panel_mc.gotoAndStop(f);
switch (f) {
case PANEL_FRAME_INSTRUCTIONS :
_setupGame();
Key.addListener(this);
_clip.panel_mc.play_btn.onRelease = (_foo = EventDelegate.create(this, _onPanelInstructionsPlayClicked));
break;
case PANEL_FRAME_NEXT_LEVEL :
_cleanLevel();
_setupLevel();
_scoreLevel();
_clip.panel_mc.play_btn.enabled = (_clip.panel_mc.play_btn._visible = false);
break;
case PANEL_FRAME_SUCCESS :
_showCorrectCode();
_scoreLevel();
_clip.panel_mc.play_btn.enabled = (_clip.panel_mc.play_btn._visible = false);
_clip.panel_mc.highScore_btn.enabled = (_clip.panel_mc.highScore_btn._visible = false);
break;
case PANEL_FRAME_ADVERT :
Key.addListener(this);
_clip.panel_mc.play_btn.onRelease = (_foo = EventDelegate.create(this, _onPanelAdvertPlayClicked));
_clip.panel_mc.advert_mc.link_btn.link_txt.text = _root.advert;
_clip.panel_mc.advert_mc.link_btn.onRelease = EventDelegate.create(this, _onPanelAdvertLinkClicked);
var _local3 = function () {
this.link_txt.text = _root.advert;
};
_clip.panel_mc.advert_mc.link_btn.onRollOver = _local3;
_clip.panel_mc.advert_mc.link_btn.onRollOut = _local3;
_clip.panel_mc.advert_mc.link_btn.onReleaseOutside = _local3;
break;
}
}
function _onPanelAdvertLinkClicked() {
getURL ("http://" + _root.advert, "_blank");
_clip.panel_mc.advert_mc.link_btn.link_txt.text = _root.advert;
}
function _showCorrectCode() {
_clip.panel_mc.code_mc._visible = _succeeded;
if (_succeeded) {
var _local5 = main.Opening.CORRECT_CODE;
var _local4 = null;
var _local3 = null;
var _local2 = 0;
while (_local2 < _local5.length) {
_local3 = _clip.panel_mc.code_mc[("icon" + String(_local2 + 1)) + "_mc"];
_local4 = _clip.panel_mc.code_mc.attachMovie("code_icon", _local3._name, _local3.getDepth(), {_x:_local3._x, _y:_local3._y});
_local4.text_txt.text = _local5.charAt(_local2);
_local2++;
}
}
}
function _scoreLevel() {
var _local2 = main.ScoreManager.instance();
_clip.panel_mc.score_mc.overall_txt.text = String(_local2.__get__score());
_clip.panel_mc.score_mc.time_txt.text = (_failed ? "0" : (String(_local2.__get__timeBonus())));
_clip.panel_mc.score_mc.chain_txt.text = String(_local2.__get__chainBonus());
_clip.panel_mc.score_mc.harpoon_txt.text = String(_local2.__get__harpoonBonus());
_clip.panel_mc.score_mc.multi_txt.text = String(_local2.__get__multiplierBonus());
_killInterval();
_interval = setInterval(this, "_beginTickerSoundAndTransferScores", 1500);
}
function _beginTickerSoundAndTransferScores() {
_killInterval();
main.SM.instance().playSound("sfx_score_tick", 100, 99999);
_transferScores();
}
function _transferScores() {
_killInterval();
_interval = setInterval(this, "_transferScores", 10);
var _local4 = true;
var _local2 = 100;
var _local3 = main.ScoreManager.instance().__get__score();
var _local6 = parseInt(_clip.panel_mc.score_mc.time_txt.text);
if (_local6 > 0) {
_local3 = _local3 + _local2;
_clip.panel_mc.score_mc.time_txt.text = String(_local6 - _local2);
_local4 = false;
}
var _local7 = parseInt(_clip.panel_mc.score_mc.chain_txt.text);
if (_local7 > 0) {
_local3 = _local3 + _local2;
_clip.panel_mc.score_mc.chain_txt.text = String(_local7 - _local2);
_local4 = false;
}
var _local5 = parseInt(_clip.panel_mc.score_mc.harpoon_txt.text);
if (_local5 > 0) {
_local3 = _local3 + _local2;
_clip.panel_mc.score_mc.harpoon_txt.text = String(_local5 - _local2);
_local4 = false;
}
var _local8 = parseInt(_clip.panel_mc.score_mc.multi_txt.text);
if (_local8 > 0) {
_local3 = _local3 + _local2;
_clip.panel_mc.score_mc.multi_txt.text = String(_local8 - _local2);
_local4 = false;
}
main.ScoreManager.instance().__set__score(_local3);
_clip.panel_mc.score_mc.overall_txt.text = _local3.toString();
_hud.setScore(_local3);
if (_local4) {
main.SM.instance().stopSound("sfx_score_tick");
main.ScoreManager.instance().resetLevel();
_killInterval();
Key.addListener(this);
_clip.panel_mc.play_btn.enabled = (_clip.panel_mc.play_btn._visible = true);
if ((_level < NUMBER_OF_LEVELS) && (!_failed)) {
_clip.panel_mc.play_btn.onRelease = (_foo = EventDelegate.create(this, _onPanelNextLevelPlayClicked));
} else {
_clip.panel_mc.play_btn.onRelease = (_foo = EventDelegate.create(this, _onPanelSuccessPlayClicked));
if (!main.Main.HIDE_HIGH_SCORE_BUTTON) {
_clip.panel_mc.highScore_btn.enabled = (_clip.panel_mc.highScore_btn._visible = true);
_clip.panel_mc.highScore_btn.onRelease = EventDelegate.create(this, _onPanelSuccessHighScoreClicked);
}
}
}
updateAfterEvent();
}
function onKeyDown() {
if (Key.getCode() == 32) {
_foo();
}
}
function _onPanelInstructionsPlayClicked() {
main.SM.instance().playSound("sfx_click");
Key.removeListener(this);
_clip.panel_mc.play_btn.enabled = false;
_closePanel(EventDelegate.create(this, _startGame));
}
function _onPanelNextLevelPlayClicked() {
main.SM.instance().playSound("sfx_click");
Key.removeListener(this);
if (_level >= NUMBER_OF_LEVELS) {
trace((("oops! this isn't supposed to happen! _level=" + _level) + ", yet NUMBER_OF_LEVELS=") + NUMBER_OF_LEVELS);
} else {
_clip.panel_mc.play_btn.enabled = false;
_closePanel(EventDelegate.create(this, _startLevel));
}
}
function _onPanelSuccessPlayClicked() {
main.SM.instance().playSound("sfx_click");
Key.removeListener(this);
_clip.panel_mc.play_btn.enabled = false;
_closePanel(EventDelegate.create(this, _showOpening));
}
function _onPanelAdvertPlayClicked() {
main.SM.instance().playSound("sfx_click");
Key.removeListener(this);
_clip.panel_mc.play_btn.enabled = false;
_closePanel(EventDelegate.create(this, _showOpening));
}
function _onPanelSuccessHighScoreClicked() {
HighScore.instance().addEventListener(HighScore.EVENT_SCORES_SAVED, this);
HighScore.instance().saveHighScore(main.ScoreManager.instance().__get__score(), main.Main.KEY);
}
function onHighScoresSaved(eventObject) {
HighScore.instance().removeEventListener(HighScore.EVENT_SCORES_SAVED, this);
_dispatchShowHighScoreTable();
}
function _showOpening() {
_clip.gotoAndPlay("out");
_clip.lastAction = EventDelegate.create(this, _dispatchShowOpening);
}
function _dispatchShowOpening() {
dispatchEvent({type:"showOpening", target:this});
}
function _dispatchShowHighScoreTable() {
dispatchEvent({type:"showHighScoreTable", target:this});
}
function _setupGame() {
_container = _clip.container_mc;
_bounds = _clip.bounds_mc;
main.ScoreManager.instance().resetGame();
_failed = false;
_succeeded = false;
_energy = main.Hud.ENERGY_SEGMENTS;
_level = 0;
_player = new main.Player(_container, _bounds);
_weapon = new main.Weapon(_container, _bounds);
}
function _startGame() {
_hud = new main.Hud(_clip.hud_mc);
_updateHud();
_setupLevel();
_startLevel();
}
function _setupLevel() {
_mask_t0 = -1;
_player.centre();
_bubblesCreated = (_bubblesBurst = 0);
_createRocks();
_powerups = [];
}
function _startLevel() {
_hud.setScore(main.ScoreManager.instance().__get__score());
main.ScoreManager.instance().start();
_createBubbles();
_createBubblesUp();
startWork();
}
function _cleanLevel() {
var _local3 = 0;
var _local2 = 0;
_local3 = _bubblesup.length;
_local2 = 0;
while (_local2 < _local3) {
_bubblesup[_local2].dispose();
_local2++;
}
_bubblesup = [];
_local3 = _bubbles.length;
_local2 = 0;
while (_local2 < _local3) {
_bubbles[_local2].dispose();
_local2++;
}
_bubbles = [];
_local3 = _rocks.length;
_local2 = 0;
while (_local2 < _local3) {
_rocks[_local2].dispose();
_local2++;
}
_rocks = [];
_local3 = _powerups.length;
_local2 = 0;
while (_local2 < _local3) {
_powerups[_local2].dispose();
_local2++;
}
_powerups = [];
}
function _createBubbles() {
_bubbles = [];
var _local3 = 1 + Math.ceil(_level / 2);
var _local2 = 0;
while (_local2 < _local3) {
_addBubble();
_local2++;
}
}
function _createRocks() {
_rocks = [];
switch (_level) {
case 0 :
break;
case 1 :
_addRock(210, 180, main.Rock.TYPE3);
break;
case 2 :
_addRock(100, 200, main.Rock.TYPE1);
_addRock(350, 140, main.Rock.TYPE2);
break;
case 3 :
_addRock(100, 130, main.Rock.TYPE3);
_addRock(250, 230, main.Rock.TYPE2);
break;
case 4 :
_addRock(120, 160, main.Rock.TYPE1);
_addRock(280, 200, main.Rock.TYPE3);
break;
case 5 :
_addRock(70, 180, main.Rock.TYPE1);
_addRock(160, 120, main.Rock.TYPE2);
_addRock(300, 220, main.Rock.TYPE3);
break;
}
}
function _getTimeTilNextBubble() {
var _local2 = 500 * (6 - _level);
if (_local2 < 0) {
_local2 = 0;
}
var _local3 = (_local2 / 4) + Math.floor(Math.random() * _local2);
if (_local3 < 0) {
_local3 = 0;
}
return(_local3);
}
function _getBubblesBeforeCordak() {
return(9 * (1 + _level));
}
function _getMaxBubbles() {
return(Math.min(8, 4 + _level));
}
function _createBubblesUp() {
_bubblesup = [];
_bubblesup.push(new main.BubblesUp(_container, _bounds, false, main.Depths.BUBBLESUP + 0));
_bubblesup.push(new main.BubblesUp(_container, _bounds, true, main.Depths.BUBBLESUP + 1));
_bubblesup.push(new main.BubblesUp(_container, _bounds, true, main.Depths.BUBBLESUP + 2));
}
function _addBubble() {
_killAddBubbleInterval();
_addBubbleInterval = setInterval(this, "_addBubble", _getTimeTilNextBubble());
if (_bubbles.length < _getMaxBubbles()) {
_bubblesCreated++;
var _local2 = _bubblesBurst > _getBubblesBeforeCordak();
if (_local2) {
main.ScoreManager.instance().ignoreHits();
_killAddBubbleInterval();
}
_bubbles.push(new main.Bubble(_container, _bounds, main.Depths.BUBBLES + _bubblesCreated, _local2));
}
}
function _killAddBubbleInterval() {
if (_addBubbleInterval >= 0) {
clearInterval(_addBubbleInterval);
_addBubbleInterval = -1;
}
}
function _killInterval() {
if (_interval >= 0) {
clearInterval(_interval);
_interval = -1;
}
}
function _addRock(x, y, type) {
_rocks.push(new main.Rock(_container, _bounds, x, y, type, main.Depths.ROCKS + _rocks.length));
}
function _updateHud() {
_hud.setEnergy(_energy);
if (_maskUnlocked) {
var _local3 = 100;
var _local2 = getTimer() - _mask_t0;
if ((_mask_t0 >= 0) && (_local2 < MASK_POWER_RECHARGE_TIME)) {
_local3 = (100 * _local2) / MASK_POWER_RECHARGE_TIME;
}
_hud.setMaskLight(_local3);
} else {
_hud.setMaskDark();
}
}
static function instance() {
return(_instance);
}
function startWork() {
if (!_working) {
_clip.onEnterFrame = EventDelegate.create(this, _loop);
_working = true;
Mouse.hide();
main.SM.instance().playSound("game_loop", 50, 99999);
}
}
function stopWork() {
if (_working) {
main.ScoreManager.instance().stop();
_killAddBubbleInterval();
_player.stopMoving();
_weapon.retract();
delete _clip.onEnterFrame;
_working = false;
Mouse.show();
main.SM.instance().fadeSound("game_loop", 0, 1);
}
}
function stopWorkNoExtraStuff() {
if (_working) {
delete _clip.onEnterFrame;
_working = false;
}
}
function _loop() {
step();
draw();
}
function step() {
_checkKeys();
_player.step();
_weapon.step();
var _local13 = _bubbles.slice();
var _local14 = _local13.length;
var _local11 = 0;
while (_local11 < _local14) {
var _local2 = _local13[_local11];
if (!_local2.__get__bursting()) {
var _local7 = false;
var _local3 = 0;
while (_local3 < _rocks.length) {
var _local12 = _rocks[_local3];
var _local8 = _local2.__get__point();
var _local6 = _local12.__get__point();
var _local5 = _local8.x - _local6.x;
var _local4 = _local8.y - _local6.y;
var _local9 = Math.sqrt((_local5 * _local5) + (_local4 * _local4));
if (_local9 <= (_local2.__get__radius() + _local12.__get__radius())) {
_bounceBubbleOffRock(_local2, _rocks[_local3], _local5, _local4);
main.SM.instance().playSound("sfx_bounce");
_local7 = true;
break;
}
_local3++;
}
if ((!_local7) && (_weapon.__get__firing())) {
if (_local2.hitTest(_weapon.getHarpoonHitArea())) {
main.ScoreManager.instance().registerHit(true);
_local7 = true;
if (_weapon.__get__electricChains()) {
_weapon.electricChainSpark(_local2.y, _local2.x > _weapon.x);
}
} else if (_local2.hitTest(_weapon.__get__chain())) {
main.ScoreManager.instance().registerHit(false);
_local7 = true;
}
if (_local7) {
_weapon.__set__hitSomething(true);
_bubblesBurst++;
_local2.burst();
_dropPowerup(_local2);
}
}
}
_local2.step();
_local11++;
}
_local14 = _rocks.length;
_local11 = 0;
while (_local11 < _local14) {
var _local12 = _rocks[_local11];
if (_local12.hitTest(_weapon.__get__harpoon())) {
_weapon.retract();
}
_local11++;
}
_local14 = _powerups.length;
_local11 = 0;
while (_local11 < _local14) {
var _local10 = _powerups[_local11];
if (_local10.hitTest(_player.__get__clip())) {
_pickupPowerup(_local10);
}
_local10.step();
_local11++;
}
}
function giveAllPowerups() {
_weapon.__set__electricChains(true);
_clip.chains_mc._visible = true;
}
function _pickupPowerup(powerup) {
switch (powerup.__get__type()) {
case main.Powerup.CORDAK :
break;
case main.Powerup.FAST_THROW :
_weapon.__set__fast(true);
_clip.throw_mc._visible = true;
break;
case main.Powerup.FAST_FEET :
_player.__set__fast(true);
_clip.feet_mc._visible = true;
break;
case main.Powerup.ELECTRIC_CHAINS :
_weapon.__set__electricChains(true);
_clip.chains_mc._visible = true;
}
powerup.pickup();
}
function _dropPowerup(bubble) {
var _local4 = bubble.__get__isCordak() || (Math.floor(Math.random() * POWERUP_DROP_PROBABILITY) == 0);
if (_local4) {
_powerupsCreated++;
var _local2 = [];
if (!_player.__get__fast()) {
_local2.push(main.Powerup.FAST_FEET);
}
if (!_weapon.__get__fast()) {
_local2.push(main.Powerup.FAST_THROW);
}
if (!_weapon.__get__electricChains()) {
_local2.push(main.Powerup.ELECTRIC_CHAINS);
}
if (_local2.length || (bubble.__get__isCordak())) {
_powerups.push(new main.Powerup(_container, _bounds, bubble.__get__isCordak(), bubble.x, bubble.y, main.Depths.POWERUPS + _powerupsCreated, _local2));
}
}
}
function _bounceBubbleOffRock(bubble, rock, dx, dy) {
var _local7 = bubble.__get__radius() + rock.__get__radius();
var _local5 = Math.atan2(dy, dx);
var _local8 = Math.cos(_local5);
var _local6 = Math.sin(_local5);
var _local10 = rock.__get__point().x + (_local7 * _local8);
var _local9 = rock.__get__point().y + (_local7 * _local6);
bubble.x = _local10;
bubble.y = _local9;
var _local1 = rock.__get__normal();
_local1.x = rock.__get__radius() * _local8;
_local1.y = rock.__get__radius() * _local6;
_local1 = Vector.normalize(_local1);
var _local2 = bubble.__get__velocity();
_local2 = Vector.subtract(_local2, Vector.multiplyScalar(_local1, 2 * Vector.dot(_local1, _local2)));
bubble.vx = _local2.x;
bubble.vy = _local2.y;
}
function draw() {
_player.draw();
_weapon.draw();
var _local4 = _bubbles.slice();
var _local5 = _local4.length;
var _local3 = 0;
while (_local3 < _local5) {
var _local2 = _local4[_local3];
if (((!_player.__get__dying()) && (!_player.__get__invulnerable())) && (_local2.hitTest(_player.__get__clip()))) {
if (_maskPowerAvailable()) {
_mask_t0 = getTimer();
_local2.delayedBurst();
} else {
_energy = _energy - _local2.damage;
_resetPowerups();
if (_energy < 1) {
_energy = 0;
_killPlayer();
} else {
_player.takeDamage(false);
}
_local2.burst();
}
if (_local2.__get__isCordak()) {
_spawnCordak();
}
}
_local2.draw();
_local3++;
}
_local5 = _powerups.length;
_local3 = 0;
while (_local3 < _local5) {
_powerups[_local3].draw();
_local3++;
}
_updateHud();
}
function _spawnCordak() {
_bubblesCreated++;
_bubbles.push(new main.Bubble(_container, _bounds, main.Depths.BUBBLES + _bubblesCreated, true));
}
function _maskPowerAvailable() {
return(_maskUnlocked && ((_mask_t0 == -1) || ((getTimer() - _mask_t0) > MASK_POWER_RECHARGE_TIME)));
}
function _killPlayer() {
main.SM.instance().stopSound("game_loop");
var _local2 = ((Math.random() < 0.5) ? "failure1" : "failure2");
main.SM.instance().playSound(_local2);
main.SM.instance().setSoundComplete(_local2, EventDelegate.create(this, _startFailureSoundLoops));
_resetPowerups();
_weapon.remove();
_player.die();
_killAddBubbleInterval();
}
function _startFailureSoundLoops() {
main.SM.instance().playSound(((Math.random() < 0.5) ? "failure1_short" : "failure2_short"), 75, 99999);
}
function _resetPowerups() {
if (_weapon != null) {
_weapon.__set__fast(false);
_weapon.__set__electricChains(false);
}
if (_player != null) {
_player.__set__fast(false);
}
_clip.feet_mc._visible = false;
_clip.chains_mc._visible = false;
_clip.throw_mc._visible = false;
}
function _checkKeys() {
if (!_player.__get__dying()) {
if (!_weapon.__get__firing()) {
if (Key.isDown(39)) {
_player.moveRight();
} else if (Key.isDown(37)) {
_player.moveLeft();
} else {
_player.stopMoving();
}
}
if (Key.isDown(32)) {
if ((!_weapon.__get__firing()) && (_allowFiring)) {
_allowFiring = false;
_player.fire();
_weapon.fire(_player.x);
}
} else {
_allowFiring = true;
if (_weapon.__get__firing() && (!_weapon.__get__retracting())) {
_weapon.retract();
}
}
}
}
function firingFinished() {
if (!_weapon.__get__hitSomething()) {
main.ScoreManager.instance().registerMiss();
}
if (!_player.__get__dying()) {
_player.stopMoving();
}
}
function dispose() {
if (_wave1 != null) {
_wave1.dispose();
_wave1 = null;
}
if (_wave2 != null) {
_wave2.dispose();
_wave2 = null;
}
_killInterval();
_killAddBubbleInterval();
_instance = null;
}
function removeBubble(bubble) {
var _local3 = -1;
var _local4 = _bubbles.length;
var _local2 = 0;
while (_local2 < _local4) {
if (bubble == _bubbles[_local2]) {
_local3 = _local2;
break;
}
_local2++;
}
if (_local3 >= 0) {
_bubbles.splice(_local3, 1);
}
}
function removePowerup(powerup, activated) {
if ((powerup.__get__type() == main.Powerup.CORDAK) && (!activated)) {
_spawnCordak();
}
var _local6 = (powerup.__get__type() == main.Powerup.CORDAK) && (activated);
var _local3 = -1;
var _local5 = _powerups.length;
var _local2 = 0;
while (_local2 < _local5) {
if (powerup == _powerups[_local2]) {
_local3 = _local2;
break;
}
_local2++;
}
if (_local3 >= 0) {
_powerups.splice(_local3, 1);
}
if (_local6 && (!_player.__get__dying())) {
nextLevel();
}
}
function prevLevel() {
if ((_level > 0) && (_working)) {
stopWork();
_level--;
_hud.setCordakIndicator(_level - 1);
_killInterval();
_interval = setInterval(this, "_showEndOfLevelPopup", 500);
}
}
function nextLevel() {
if ((_level < NUMBER_OF_LEVELS) && (_working)) {
_hud.setCordakIndicator(_level);
stopWork();
_level++;
if (_level >= NUMBER_OF_LEVELS) {
_succeeded = true;
_cleanLevel();
_player.__set__visible(false);
}
if (!_succeeded) {
_killInterval();
_interval = setInterval(this, "_showEndOfLevelPopup", 500);
} else {
main.SM.instance().stopSound("game_loop");
var _local2 = ((Math.random() < 0.5) ? "success1" : "success2");
main.SM.instance().playSound(_local2);
main.SM.instance().setSoundComplete(_local2, EventDelegate.create(this, _startSuccessSoundLoops));
_cutscene = _clip._parent.attachMovie(SYMBOL_CUTSCENE_SUCCESS, "cutscene_mc", _clip._parent.getNextHighestDepth());
_cutscene._x = SCREEN_WIDTH / 2;
_cutscene._y = SCREEN_HEIGHT / 2;
_cutscene.removeMe = EventDelegate.create(this, _postCutsceneSuccess);
}
}
}
function autoComplete() {
_level = NUMBER_OF_LEVELS - 1;
nextLevel();
}
function _startSuccessSoundLoops() {
}
function _showEndOfLevelPopup() {
_killInterval();
_openPanel(PANEL_FRAME_NEXT_LEVEL);
}
function _showAdvertPopup() {
_killInterval();
_openPanel(PANEL_FRAME_ADVERT);
}
function _postCutsceneSuccess() {
main.SM.instance().stopEverySound(1);
_cutscene.removeMovieClip();
_openPanel(PANEL_FRAME_SUCCESS);
}
function _postCutsceneFailure() {
main.SM.instance().stopEverySound(1);
_cutscene.removeMovieClip();
_openPanel(PANEL_FRAME_SUCCESS);
}
function fillEnergy() {
_energy = main.Hud.ENERGY_SEGMENTS;
_updateHud();
}
function emptyEnergy() {
_energy = 0;
_updateHud();
_killPlayer();
}
function unlockMask() {
_maskUnlocked = true;
_mask_t0 = -1;
_updateHud();
}
function playerDead() {
_failed = true;
stopWork();
_cleanLevel();
_player.__set__visible(false);
_cutscene = _clip._parent.attachMovie(SYMBOL_CUTSCENE_FAILURE, "cutscene_mc", _clip._parent.getNextHighestDepth());
_cutscene._x = SCREEN_WIDTH / 2;
_cutscene._y = SCREEN_HEIGHT / 2;
_cutscene.removeMe = EventDelegate.create(this, _postCutsceneFailure);
}
function dispatchEvent(eventObject) {
}
function addEventListener(event, listener) {
}
function removeEventListener(event, listener) {
}
static var SCREEN_WIDTH = 500;
static var SCREEN_HEIGHT = 300;
static var PANEL_FRAME_INSTRUCTIONS = "instructions";
static var PANEL_FRAME_NEXT_LEVEL = "next level";
static var PANEL_FRAME_SUCCESS = "success";
static var PANEL_FRAME_ADVERT = "advert";
static var SYMBOL_CUTSCENE_SUCCESS = "cutscene_success";
static var SYMBOL_CUTSCENE_FAILURE = "cutscene_failure";
static var NUMBER_OF_LEVELS = 6;
static var MASK_POWER_RECHARGE_TIME = 25000;
static var POWERUP_DROP_PROBABILITY = 7;
static var _instance = null;
var _clip = null;
var _container = null;
var _bounds = null;
var _cutscene = null;
var _maskUnlocked = false;
var _hud = null;
var _level = 0;
var _energy = 0;
var _player = null;
var _bubbles = null;
var _bubblesup = null;
var _powerups = null;
var _rocks = null;
var _interval = -1;
var _addBubbleInterval = -1;
var _bubblesCreated = 0;
var _powerupsCreated = 0;
var _bubblesBurst = 0;
var _weapon = null;
var _allowFiring = true;
var _mask_t0 = -1;
var _working = false;
var _foo = null;
var _failed = false;
var _succeeded = false;
var _wave1 = null;
var _wave2 = null;
}
Symbol 664 MovieClip [__Packages.main.Hud] Frame 0
class main.Hud
{
function Hud (clip) {
_score = clip.score_txt;
_energy = clip.energy_mc;
_mask = clip.mask_mc;
_level = clip.level_mc;
}
function setScore(score) {
_score.text = score.toString();
}
function setEnergy(energy) {
var _local2 = (ENERGY_SEGMENT_FRAMES * (ENERGY_SEGMENTS - energy)) + 1;
_energy.gotoAndStop(_local2);
}
function setMaskLight(charge) {
_mask.gotoAndStop("light");
_mask.mask_mc._height = (charge * FULL_MASK_HEIGHT) / 100;
_mask.mask_mc._y = 67.5 - _mask.mask_mc._height;
}
function setMaskDark() {
_mask.gotoAndStop("dark");
}
function setCordakIndicator(level) {
if (level == -1) {
_level.gotoAndStop(1);
} else {
level++;
_level.gotoAndPlay("level" + level.toString());
}
}
static var ENERGY_SEGMENT_FRAMES = 5;
static var FULL_MASK_HEIGHT = 43.5;
static var ENERGY_SEGMENTS = 12;
var _score = null;
var _energy = null;
var _mask = null;
var _level = null;
}
Symbol 665 MovieClip [__Packages.main.ContainedObject] Frame 0
class main.ContainedObject implements main.IStepable, main.IDrawable
{
function ContainedObject (bounds) {
_bounds = bounds;
}
function _transformY(y) {
return(_bounds._height - y);
}
function step() {
}
function draw() {
}
var x = 0;
var y = 0;
var vx = 0;
var vy = 0;
var _bounds = null;
}
Symbol 666 MovieClip [__Packages.main.Player] Frame 0
class main.Player extends main.ContainedObject
{
var y, x, _bounds, vx, _transformY;
function Player (parent, bounds) {
super(bounds);
_clip = parent.attachMovie(SYMBOL_HEWKII, SYMBOL_HEWKII + "_mc", main.Depths.PLAYER, {_scale:SCALE, _yscale:SCALE, _visible:false});
_clip.cacheAsBitmap = true;
_clip.hit_mc._visible = false;
y = FIXED_Y_COORD;
centre();
_ctWhite = new flash.geom.ColorTransform(1, 1, 1, 1, 255, 255, 255, 0);
_ctNormal = new flash.geom.ColorTransform();
_ctGold = new flash.geom.ColorTransform(1, 1, 1, 1, 129, 98, 46, 0);
}
function centre() {
x = (_bounds._width / 2) - (_clip._width / 2);
_clip._x = x;
}
function takeDamage(fromMask) {
fromMask = (undefined ? false : (fromMask));
_damage_t0 = getTimer();
_clip.transform.colorTransform = (fromMask ? (_ctGold) : (_ctWhite));
}
function step() {
if (_f0 >= 0) {
x = x + (((getTimer() - _f0) * vx) / 1000);
}
if (x < (-HALF_WIDTH)) {
x = -HALF_WIDTH;
stopMoving();
} else if ((x + HALF_WIDTH) > _bounds._width) {
x = _bounds._width - HALF_WIDTH;
stopMoving();
}
if (_damage_t0 >= 0) {
var _local2 = getTimer() - _damage_t0;
if (_local2 > 1500) {
_damage_t0 = -1;
_clip.transform.colorTransform = _ctNormal;
}
}
_f0 = getTimer();
}
function draw() {
_clip._x = x;
_clip._y = _transformY(y);
if (_damage_t0 >= 0) {
var _local2 = getTimer() - _damage_t0;
_clip._visible = (Math.floor(_local2 / 50) % 2) == 0;
} else {
_clip._visible = true;
}
}
function set visible(state) {
_clip._visible = state;
//return(visible);
}
function get visible() {
return(_clip._visible);
}
function moveRight() {
vx = (_fast ? (SPEED_FAST) : (SPEED_NORMAL));
_clip.gotoAndStop("walkright");
_clip.hit_mc._visible = false;
}
function moveLeft() {
vx = (_fast ? (-SPEED_FAST) : (-SPEED_NORMAL));
_clip.gotoAndStop("walkleft");
_clip.hit_mc._visible = false;
}
function stopMoving() {
vx = 0;
_f0 = -1;
_clip.gotoAndStop("standing front");
_clip.hit_mc._visible = false;
}
function get clip() {
return(_clip.hit_mc);
}
function die() {
_dying = true;
vx = 0;
_clip.gotoAndStop("dead");
_clip.dead_mc.deathComplete = EventDelegate.create(this, _onDeathComplete);
}
function _onDeathComplete() {
main.Game.instance().playerDead();
}
function get dying() {
return(_dying);
}
function get invulnerable() {
return(_damage_t0 >= 0);
}
function fire() {
vx = 0;
_clip.gotoAndStop("throwing");
_clip.hit_mc._visible = false;
}
function get fast() {
return(_fast);
}
function set fast(state) {
_fast = ((state == undefined) ? true : (state));
//return(fast);
}
static var SYMBOL_HEWKII = "hewkii";
static var SCALE = 110;
static var SPEED_NORMAL = 160;
static var SPEED_FAST = 270;
static var FIXED_Y_COORD = 100;
static var HALF_WIDTH = 35;
var _clip = null;
var _fast = false;
var _dying = false;
var _damage_t0 = -1;
var _ctWhite = null;
var _ctNormal = null;
var _ctGold = null;
var _f0 = -1;
}
Symbol 667 MovieClip [__Packages.main.Depths] Frame 0
class main.Depths
{
function Depths () {
}
static var ROCKS = 200;
static var PLAYER = 500;
static var WEAPON = 510;
static var BUBBLESUP = 700;
static var POWERUPS = 8000;
static var BUBBLES = 9000;
}
Symbol 668 MovieClip [__Packages.main.Weapon] Frame 0
class main.Weapon extends main.ContainedObject
{
var x, y, vx, vy, _transformY;
function Weapon (parent, bounds) {
super(bounds);
_clip = parent.attachMovie(SYMBOL, SYMBOL + "_mc", main.Depths.WEAPON, {_visible:false, _xscale:SCALE, _yscale:SCALE});
_chain = parent.createEmptyMovieClip("chain_mc", main.Depths.WEAPON + 1);
_chain._visible = false;
_clip.wideHitArea_mc._visible = false;
}
function fire(x) {
if (!_firing) {
this.x = x + FIXED_X_OFFSET;
_x0 = this.x + CHAIN_X_OFFSET;
y = (_y0 = FIXED_Y_COORD);
vx = 0;
vy = (_fast ? (SPEED_FAST) : (SPEED_NORMAL));
_firing = true;
_hitSomething = false;
_clip._visible = (_chain._visible = true);
draw();
main.SM.instance().playSound((_fast ? "sfx_harpoonFast" : "sfx_harpoon"));
if (_electricChains) {
main.SM.instance().playSound("sfx_spark", 100, 99999, 0.5);
_attachElectricSquiggle();
}
}
}
function _attachElectricSquiggle() {
if (_firing && (_electricChains)) {
var _local4 = _y0 + Math.round(Math.random() * _chain._height);
var _local3 = _chain.getNextHighestDepth();
var _local2 = _chain.attachMovie("bolt", ("bolt" + String(_local3)) + "_mc", _local3, {_x:_x0, _y:_transformY(_local4), _rotation:90});
_local2.removeMe = EventDelegate.create(this, _removeElectricSquiggle, _local2);
}
}
function _removeElectricSquiggle(clip) {
clip.removeMovieClip();
_attachElectricSquiggle();
}
function set hitSomething(state) {
if (_firing && (state)) {
_hitSomething = true;
}
//return(hitSomething);
}
function get hitSomething() {
return(_hitSomething);
}
function retract() {
if (_firing && (!_retracting)) {
vy = -1.5 * (_fast ? (SPEED_FAST) : (SPEED_NORMAL));
_retracting = true;
}
}
function step() {
if (_firing) {
if (_f0 >= 0) {
var _local2 = (getTimer() - _f0) / 1000;
vy = vy + ((_fast ? (GRAVITY_FAST) : (GRAVITY_NORMAL)) * _local2);
y = y + (vy * _local2);
}
_f0 = getTimer();
if (y < FIXED_Y_COORD) {
main.Game.instance().firingFinished();
remove();
}
}
}
function draw() {
if (_firing) {
_clip._x = x;
_clip._y = _transformY(y);
_drawChain();
}
}
function _drawChain() {
_chain.clear();
_chain.beginFill(16777215, 0);
_chain.lineStyle(0, 0);
_chain.moveTo(_x0, _transformY(_y0));
_chain.lineTo(_clip._x + CHAIN_X_OFFSET, _clip._y + _clip._height);
_chain.endFill();
}
function get firing() {
return(_firing);
}
function get retracting() {
return(_retracting);
}
function remove() {
_clip._visible = (_chain._visible = false);
_firing = (_retracting = false);
main.SM.instance().stopSound("sfx_spark");
_f0 = -1;
}
function get harpoon() {
return(_clip.harpoon_mc);
}
function getHarpoonHitArea() {
return((_electricChains ? (_clip.wideHitArea_mc) : (_clip.harpoon_mc)));
}
function get chain() {
return(_chain);
}
function get fast() {
return(_fast);
}
function set fast(state) {
_fast = ((state == undefined) ? true : (state));
//return(fast);
}
function get electricChains() {
return(_electricChains);
}
function set electricChains(state) {
_electricChains = ((state == undefined) ? true : (state));
//return(electricChains);
}
function electricChainSpark(y, toRight) {
var _local3 = _chain.getNextHighestDepth();
var _local4 = (toRight ? 0 : 180);
var _local2 = _chain.attachMovie("bolt", ("bolt" + _local3.toString()) + "_mc", _local3, {_x:_x0, _y:_transformY(y), _rotation:_local4});
_local2.removeMe = EventDelegate.create(this, _removeChainSpark, _local2);
}
function _removeChainSpark(clip) {
clip.removeMovieClip();
}
static var SYMBOL = "harpoon";
static var SCALE = 61;
static var SPEED_NORMAL = 630;
static var SPEED_FAST = 1260;
static var GRAVITY_NORMAL = -800;
static var GRAVITY_FAST = -3000;
static var FIXED_X_OFFSET = 27;
static var CHAIN_X_OFFSET = 4.5;
static var FIXED_Y_COORD = 45;
var _clip = null;
var _chain = null;
var _firing = false;
var _retracting = false;
var _fast = false;
var _electricChains = false;
var _x0 = 0;
var _y0 = 0;
var _hitSomething = false;
var _f0 = -1;
}
Symbol 669 MovieClip [__Packages.Wave] Frame 0
class Wave
{
var mc, vX, vY, numOctaves, fractalNoise, scaleX, scaleY, w, h, perlinOffsets, seed, perlin_bmp, filter;
function Wave (mc, vX) {
this.mc = mc;
this.vX = ((vX == undefined) ? 11 : (vX));
init();
mc.onEnterFrame = EventDelegate.create(this, update);
}
function init() {
var _local2;
var _local3;
var _local4;
vY = 0;
numOctaves = 2;
fractalNoise = true;
scaleX = 16;
scaleY = 0;
w = mc._width;
h = mc._height;
perlinOffsets = new Array(numOctaves);
seed = Math.round(Math.random() * 1000);
perlin_bmp = new flash.display.BitmapData(w, h, false, 0);
_local3 = new flash.geom.Point(0, 0);
_local2 = 0;
while (_local2 < 2) {
perlinOffsets[_local2] = _local3;
_local2++;
}
filter = new flash.filters.DisplacementMapFilter(perlin_bmp, _local3, 1, 1, scaleX, scaleY, "color", 0, 0);
}
function update() {
var _local2;
_local2 = 0;
while (_local2 < numOctaves) {
perlinOffsets[_local2].offset(vX, vY);
_local2++;
}
perlin_bmp.perlinNoise(w, h, numOctaves, seed, true, fractalNoise, 1, true, perlinOffsets);
mc.filters = [filter];
}
function dispose() {
delete mc.onEnterFrame;
mc.filters = [];
perlinOffsets = null;
perlin_bmp = null;
filter = null;
}
}
Symbol 670 MovieClip [__Packages.main.ScoreManager] Frame 0
class main.ScoreManager
{
function ScoreManager () {
resetGame();
}
static function instance() {
if (_instance == null) {
_instance = new main.ScoreManager();
}
return(_instance);
}
function resetGame() {
_score = 0;
resetLevel();
}
function resetLevel() {
_burstByHarpoon = 0;
_burstByChain = 0;
_consecutiveHits = 0;
_multiplierScore = 0;
_ignoreHits = false;
_t0 = -1;
_e = 0;
}
function start() {
if (_t0 == -1) {
_t0 = getTimer();
}
}
function stop() {
_e = getTimer() - _t0;
_t0 = -1;
}
function registerMiss() {
_consecutiveHits = 0;
}
function ignoreHits() {
_ignoreHits = true;
}
function registerHit(byHarpoon) {
if (_ignoreHits) {
return(undefined);
}
if (byHarpoon) {
_burstByHarpoon++;
} else {
_burstByChain++;
}
if (_consecutiveHits < MAX_CONSECUTIVE_HITS) {
_consecutiveHits++;
}
if (_consecutiveHits > BUBBLES_BURST_BEFORE_MULTIPLIER) {
var _local2 = 100 * (_consecutiveHits - BUBBLES_BURST_BEFORE_MULTIPLIER);
_multiplierScore = _multiplierScore + _local2;
}
}
function get timeBonus() {
var _local2 = 0;
if ((_e > 0) && (_e < TIME_LIMIT)) {
_local2 = 200 * Math.ceil((TIME_LIMIT - _e) / 1000);
}
return(_local2);
}
function get harpoonBonus() {
return(300 * _burstByHarpoon);
}
function get chainBonus() {
return(100 * _burstByChain);
}
function get multiplierBonus() {
return(_multiplierScore);
}
function get score() {
return(_score);
}
function set score(s) {
_score = s;
//return(score);
}
static var _instance = null;
static var BUBBLES_BURST_BEFORE_MULTIPLIER = 2;
static var MAX_CONSECUTIVE_HITS = 5 + BUBBLES_BURST_BEFORE_MULTIPLIER;
static var TIME_LIMIT = 60000;
var _score = 0;
var _burstByHarpoon = 0;
var _burstByChain = 0;
var _consecutiveHits = 0;
var _multiplierScore = 0;
var _t0 = -1;
var _e = 0;
var _ignoreHits = false;
}
Symbol 671 MovieClip [__Packages.HighScore] Frame 0
class HighScore
{
function HighScore () {
mx.events.EventDispatcher.initialize(this);
}
static function instance() {
if (_instance == null) {
_instance = new HighScore();
}
return(_instance);
}
function saveHighScore(score, key) {
trace("HighScore::saveHighScore");
var _local3 = new LoadVars();
_local3.GameName = _root.gamename;
_local3.Score = score.toString();
_local3.Hash = de.richinternet.crypto.SHA1.encode(((key + "SaveScore") + _root.gamename) + score.toString());
_lv = new LoadVars();
_lv.onLoad = EventDelegate.create(this, _onLoad);
_local3.sendAndLoad(_root.savescore, _lv, "POST");
}
function _onLoad(success) {
trace("HighScore::_onLoad: success? " + success);
_lv = null;
dispatchEvent({target:this, type:EVENT_SCORES_SAVED, success:success});
}
function showHighScores() {
trace("HighScore::showHighScores");
getURL ((_root.viewscore + "?GameName=") + _root.gamename, "_blank");
}
function dispatchEvent(eventObject) {
}
function addEventListener(event, listener) {
}
function removeEventListener(event, listener) {
}
static var EVENT_SCORES_SAVED = "onHighScoresSaved";
static var _instance = null;
var _lv = null;
}
Symbol 672 MovieClip [__Packages.de.richinternet.crypto.SHA1] Frame 0
class de.richinternet.crypto.SHA1
{
function SHA1 () {
}
static function encode(s) {
return(hex_sha1(s));
}
static function test() {
return(sha1_vm_test());
}
static function hex_sha1(s) {
return(binb2hex(core_sha1(str2binb(s), s.length * CHRSZ)));
}
static function b64_sha1(s) {
return(binb2b64(core_sha1(str2binb(s), s.length * CHRSZ)));
}
static function str_sha1(s) {
return(binb2str(core_sha1(str2binb(s), s.length * CHRSZ)));
}
static function hex_hmac_sha1(key, data) {
return(binb2hex(core_hmac_sha1(key, data)));
}
static function b64_hmac_sha1(key, data) {
return(binb2b64(core_hmac_sha1(key, data)));
}
static function str_hmac_sha1(key, data) {
return(binb2str(core_hmac_sha1(key, data)));
}
static function get upperCaseHex() {
return(HEX_CASE == 1);
}
static function set upperCaseHex(b) {
HEX_CASE = (b ? 1 : 0);
//return(upperCaseHex);
}
static function get b64PadCharacter() {
return(B64_PAD);
}
static function set b64PadCharacter(s) {
if ((s == "") || (s == "=")) {
B64_PAD = s;
}
//return(b64PadCharacter);
}
static function get bitsPerChar() {
return(CHRSZ);
}
static function set bitsPerChar(n) {
if ((n == 8) || (n == 16)) {
CHRSZ = n;
}
//return(bitsPerChar);
}
static function sha1_vm_test() {
return(hex_sha1("abc").toLowerCase() == "a9993e364706816aba3e25717850c26c9cd0d89d");
}
static function core_sha1(x, len) {
x[len >> 5] = x[len >> 5] | (128 << (24 - (len % 32)));
x[(((len + 64) >> 9) << 4) + 15] = len;
var _local2 = Array(80);
var _local6 = 1732584193 /* 0x67452301 */;
var _local5 = -271733879;
var _local4 = -1732584194;
var _local3 = 271733878 /* 0x10325476 */;
var _local7 = -1009589776;
var _local9 = 0;
while (_local9 < x.length) {
var _local15 = _local6;
var _local14 = _local5;
var _local13 = _local4;
var _local12 = _local3;
var _local11 = _local7;
var _local1 = 0;
while (_local1 < 80) {
if (_local1 < 16) {
_local2[_local1] = x[_local9 + _local1];
} else {
_local2[_local1] = rol(((_local2[_local1 - 3] ^ _local2[_local1 - 8]) ^ _local2[_local1 - 14]) ^ _local2[_local1 - 16], 1);
}
var _local8 = safe_add(safe_add(rol(_local6, 5), sha1_ft(_local1, _local5, _local4, _local3)), safe_add(safe_add(_local7, _local2[_local1]), sha1_kt(_local1)));
_local7 = _local3;
_local3 = _local4;
_local4 = rol(_local5, 30);
_local5 = _local6;
_local6 = _local8;
_local1++;
}
_local6 = safe_add(_local6, _local15);
_local5 = safe_add(_local5, _local14);
_local4 = safe_add(_local4, _local13);
_local3 = safe_add(_local3, _local12);
_local7 = safe_add(_local7, _local11);
_local9 = _local9 + 16;
}
return(Array(_local6, _local5, _local4, _local3, _local7));
}
static function sha1_ft(t, b, c, d) {
if (t < 20) {
return((b & c) | ((~b) & d));
}
if (t < 40) {
return((b ^ c) ^ d);
}
if (t < 60) {
return(((b & c) | (b & d)) | (c & d));
}
return((b ^ c) ^ d);
}
static function sha1_kt(t) {
return(((t < 20) ? 1518500249 : (((t < 40) ? 1859775393 : (((t < 60) ? -1894007588 : -899497514))))));
}
static function core_hmac_sha1(key, data) {
var _local2 = str2binb(key);
if (_local2.length > 16) {
_local2 = core_sha1(_local2, key.length * CHRSZ);
}
var _local3 = Array(16);
var _local4 = Array(16);
var _local1 = 0;
while (_local1 < 16) {
_local3[_local1] = _local2[_local1] ^ 909522486;
_local4[_local1] = _local2[_local1] ^ 1549556828;
_local1++;
}
var _local5 = core_sha1(_local3.concat(str2binb(data)), 512 + (data.length * CHRSZ));
return(core_sha1(_local4.concat(_local5), 672));
}
static function safe_add(x, y) {
var _local1 = (x & 65535) + (y & 65535);
var _local2 = ((x >> 16) + (y >> 16)) + (_local1 >> 16);
return((_local2 << 16) | (_local1 & 65535));
}
static function rol(num, cnt) {
return((num << cnt) | (num >>> (32 - cnt)));
}
static function str2binb(str) {
var _local3 = Array();
var _local4 = (1 << CHRSZ) - 1;
var _local1 = 0;
while (_local1 < (str.length * CHRSZ)) {
_local3[_local1 >> 5] = _local3[_local1 >> 5] | ((str.charCodeAt(_local1 / CHRSZ) & _local4) << (24 - (_local1 % 32)));
_local1 = _local1 + CHRSZ;
}
return(_local3);
}
static function binb2str(bin) {
var _local3 = "";
var _local4 = (1 << CHRSZ) - 1;
var _local1 = 0;
while (_local1 < (bin.length * 32)) {
_local3 = _local3 + String.fromCharCode((bin[_local1 >> 5] >>> (24 - (_local1 % 32))) & _local4);
_local1 = _local1 + CHRSZ;
}
return(_local3);
}
static function binb2hex(binarray) {
var _local3 = (HEX_CASE ? "0123456789ABCDEF" : "0123456789abcdef");
var _local4 = "";
var _local1 = 0;
while (_local1 < (binarray.length * 4)) {
_local4 = _local4 + (_local3.charAt((binarray[_local1 >> 2] >> (((3 - (_local1 % 4)) * 8) + 4)) & 15) + _local3.charAt((binarray[_local1 >> 2] >> ((3 - (_local1 % 4)) * 8)) & 15));
_local1++;
}
return(_local4);
}
static function binb2b64(binarray) {
var _local6 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
var _local4 = "";
var _local2 = 0;
while (_local2 < (binarray.length * 4)) {
var _local5 = ((((binarray[_local2 >> 2] >> (8 * (3 - (_local2 % 4)))) & 255) << 16) | (((binarray[(_local2 + 1) >> 2] >> (8 * (3 - ((_local2 + 1) % 4)))) & 255) << 8)) | ((binarray[(_local2 + 2) >> 2] >> (8 * (3 - ((_local2 + 2) % 4)))) & 255);
var _local1 = 0;
while (_local1 < 4) {
if (((_local2 * 8) + (_local1 * 6)) > (binarray.length * 32)) {
_local4 = _local4 + B64_PAD;
} else {
_local4 = _local4 + _local6.charAt((_local5 >> (6 * (3 - _local1))) & 63);
}
_local1++;
}
_local2 = _local2 + 3;
}
return(_local4);
}
static var HEX_CASE = 0;
static var B64_PAD = "";
static var CHRSZ = 8;
}
Symbol 673 MovieClip [__Packages.main.Rock] Frame 0
class main.Rock extends main.ContainedObject
{
var x, y, _transformY;
function Rock (parent, bounds, x, y, type, depth) {
super(bounds);
var _local3 = SYMBOL + type.toString();
_clip = parent.attachMovie(_local3, ((_local3 + "_") + depth.toString()) + "_mc", depth);
this.x = x;
this.y = y;
_clip._x = x;
_clip._y = _transformY(y);
_clip.hit_mc._visible = false;
_point = new flash.geom.Point();
_normal = new Vector();
}
function hitTest(clip) {
return(_clip.hit_mc.hitTest(clip));
}
function get hitArea() {
return(_clip.hit_mc);
}
function get radius() {
return(_clip.hit_mc._width / 2);
}
function get normal() {
return(_normal);
}
function get point() {
_point.x = x;
_point.y = y;
return(_point);
}
function dispose() {
if (_wave != null) {
_wave.dispose();
_wave = null;
}
_clip.removeMovieClip();
}
static var TYPE1 = 1;
static var TYPE2 = 2;
static var TYPE3 = 3;
static var SYMBOL = "rock";
var _clip = null;
var _point = null;
var _normal = null;
var _wave = null;
}
Symbol 674 MovieClip [__Packages.Vector] Frame 0
class Vector
{
function Vector (x, y) {
this.x = ((x == undefined) ? 0 : (x));
this.y = ((y == undefined) ? 0 : (y));
}
function clone() {
return(new Vector(x, y));
}
static function dot(v1, v2) {
return((v1.x * v2.x) + (v1.y * v2.y));
}
static function multiplyScalar(v, s) {
var _local1 = v.clone();
_local1.x = _local1.x * s;
_local1.y = _local1.y * s;
return(_local1);
}
static function add(v1, v2) {
var _local1 = new Vector();
_local1.x = v1.x + v2.x;
_local1.y = v1.y + v2.y;
return(_local1);
}
static function subtract(v1, v2) {
var _local1 = new Vector();
_local1.x = v1.x - v2.x;
_local1.y = v1.y - v2.y;
return(_local1);
}
static function normalize(v) {
var _local1 = v.clone();
var _local2 = _local1.__get__length();
if (_local2 != 0) {
_local1.x = _local1.x / _local2;
_local1.y = _local1.y / _local2;
return(_local1);
}
return(null);
}
function get length() {
return(Math.sqrt((x * x) + (y * y)));
}
function toString() {
return(((("(" + x) + ",") + y) + ")");
}
var x = 0;
var y = 0;
}
Symbol 675 MovieClip [__Packages.main.BubblesUp] Frame 0
class main.BubblesUp
{
function BubblesUp (parent, bounds, useSymbol1, depth) {
_bounds = bounds;
var _local2 = (useSymbol1 ? (SYMBOL_1) : (SYMBOL_2));
_clip = parent.attachMovie(_local2, (_local2 + depth.toString()) + "_mc", depth, {_visible:false, _x:_getRandomX(), _y:INITIAL_Y_COORD});
_clip.animationFinished = EventDelegate.create(this, _animationFinished);
_clip.gotoAndStop(_clip._totalframes);
}
function _animationFinished() {
_clearInterval();
var _local2 = 4000 + Math.floor(Math.random() * 6000);
_interval = setInterval(this, "_restartAnimation", _local2);
}
function _restartAnimation() {
_clearInterval();
_clip._x = _getRandomX();
_clip._visible = true;
_clip.gotoAndPlay(1);
}
function _getRandomX() {
return(25 + Math.floor(Math.random() * (_bounds._width - 50)));
}
function _clearInterval() {
if (_interval >= 0) {
clearInterval(_interval);
_interval = -1;
}
}
function dispose() {
_clearInterval();
_clip.removeMovieClip();
}
static var SYMBOL_1 = "bubblesup_big";
static var SYMBOL_2 = "bubblesup_small";
static var INITIAL_Y_COORD = 250;
var _clip = null;
var _bounds = null;
var _interval = -1;
}
Symbol 676 MovieClip [__Packages.main.Bubble] Frame 0
class main.Bubble extends main.ContainedObject
{
var y, _bounds, x, vx, vy, _transformY;
function Bubble (parent, bounds, depth, isCordak) {
super(bounds);
_isBlack = Math.floor(Math.random() * BLACK_BUBBLE_PROBABILITY) == 0;
_isCordak = isCordak;
var _local3 = (_isBlack ? (SYMBOL_BLACK) : (SYMBOL_NORMAL));
if (_isCordak) {
_size = BUBBLE_SIZE_BIG;
} else {
_size = Math.floor(Math.random() * NUMBER_OF_SIZES);
}
var _local4 = BUBBLE_SCALES[_size];
_clip = parent.attachMovie(_local3, (_local3 + depth.toString()) + "_mc", depth, {_xscale:_local4, _yscale:_local4});
if (!_isCordak) {
_clip.missile_mc._visible = false;
}
y = _bounds._height + 10;
x = 50 + (Math.random() * (_bounds._width - 100));
vx = (140 * Math.random()) - 70;
_g = _gravity();
_bv = _bounceVelocity();
_point = new flash.geom.Point();
_velocity = new Vector();
_ctGold = new flash.geom.ColorTransform(1, 1, 1, 1, 129, 98, 46, 0);
_ctNormal = new flash.geom.ColorTransform();
}
function step() {
if (_bursting) {
if (_flashing) {
if ((getTimer() - _flash_t0) > FLASH_TIME) {
_clip.transform.colorTransform = _ctNormal;
_flashing = false;
burst();
}
}
return(undefined);
}
if (_f0 >= 0) {
var _local2 = (getTimer() - _f0) / 1000;
vy = vy + (_local2 * _g);
x = x + (_local2 * vx);
y = y + (_local2 * vy);
}
if ((x - (_clip._width / 2)) < 0) {
x = _clip._width / 2;
vx = Math.abs(vx);
} else if ((x + (_clip._width / 2)) > _bounds._width) {
x = _bounds._width - (_clip._width / 2);
vx = -Math.abs(vx);
}
if ((y - (_clip._height / 2)) < 0) {
y = _clip._height / 2;
vy = _bv;
}
_f0 = getTimer();
}
function _gravity() {
var _local2 = 0;
switch (_size) {
case BUBBLE_SIZE_SMALL :
_local2 = -25;
break;
case BUBBLE_SIZE_MEDIUM :
_local2 = -35;
break;
case BUBBLE_SIZE_BIG :
_local2 = -45;
break;
}
return(_local2);
}
function _bounceVelocity() {
var _local2 = 0;
switch (_size) {
case BUBBLE_SIZE_SMALL :
_local2 = 83;
break;
case BUBBLE_SIZE_MEDIUM :
_local2 = 108;
break;
case BUBBLE_SIZE_BIG :
_local2 = 145;
break;
}
return(_local2);
}
function burst() {
var _local2 = (_isBlack ? "burst_black" : "burst");
_clip = _clip._parent.attachMovie(_local2, _clip._name, _clip.getDepth(), {_x:_clip._x, _y:_clip._y});
main.SM.instance().playSound((_isBlack ? "sfx_burst_black" : "sfx_burst_normal"));
_clip.removeMe = EventDelegate.create(this, _removeBurst);
_bursting = true;
}
function delayedBurst() {
if ((!_bursting) && (!_flashing)) {
main.SM.instance().playSound("sfx_spark");
_flash_t0 = getTimer();
_flashing = true;
_bursting = true;
}
}
function _removeBurst() {
_clip.removeMovieClip();
main.Game.instance().removeBubble(this);
}
function hitTest(clip) {
return((_bursting ? false : (_clip.hitTest(clip))));
}
function get size() {
return(_size);
}
function get damage() {
var _local2 = _size + 1;
if (_isBlack) {
_local2++;
}
return(_local2);
}
function draw() {
_clip._x = x;
_clip._y = _transformY(y);
if (_flashing) {
var _local2 = getTimer() - _flash_t0;
_clip._visible = (Math.floor(_local2 / 75) % 2) == 0;
_clip._xscale = (_clip._yscale = com.robertpenner.easing.Circ.easeIn(_local2, BUBBLE_SCALES[_size], BUBBLE_SCALES[_size] + (BUBBLE_SCALES[_size] / 2), FLASH_TIME));
}
}
function get radius() {
return(_clip._width / 2);
}
function get point() {
_point.x = x;
_point.y = y;
return(_point);
}
function get velocity() {
_velocity.x = vx;
_velocity.y = vy;
return(_velocity);
}
function get bursting() {
return(_bursting);
}
function get isCordak() {
return(_isCordak);
}
function dispose() {
_clip.removeMovieClip();
}
static var SYMBOL_NORMAL = "bubble";
static var SYMBOL_BLACK = "bubble_black";
static var BLACK_BUBBLE_PROBABILITY = 8;
static var BUBBLE_SCALES = [20, 30, 40];
static var FLASH_TIME = 500;
static var BUBBLE_SIZE_BIG = 2;
static var BUBBLE_SIZE_MEDIUM = 1;
static var BUBBLE_SIZE_SMALL = 0;
static var NUMBER_OF_SIZES = 3;
var _clip = null;
var _isBlack = false;
var _size = 0;
var _point = null;
var _velocity = null;
var _bursting = false;
var _flashing = false;
var _isCordak = false;
var _f0 = -1;
var _flash_t0 = -1;
var _g = 0;
var _bv = 0;
var _ctGold = null;
var _ctNormal = null;
}
Symbol 677 MovieClip [__Packages.com.robertpenner.easing.Circ] Frame 0
class com.robertpenner.easing.Circ
{
function Circ () {
}
static function easeIn(t, b, c, d) {
t = t / d;
return(((-c) * (Math.sqrt(1 - (t * t)) - 1)) + b);
}
static function easeOut(t, b, c, d) {
t = (t / d) - 1;
return((c * Math.sqrt(1 - (t * t))) + b);
}
static function easeInOut(t, b, c, d) {
t = t / (d / 2);
if (t < 1) {
return((((-c) / 2) * (Math.sqrt(1 - (t * t)) - 1)) + b);
}
t = t - 2;
return(((c / 2) * (Math.sqrt(1 - (t * t)) + 1)) + b);
}
}
Symbol 678 MovieClip [__Packages.main.Powerup] Frame 0
class main.Powerup extends main.ContainedObject
{
var x, y, vy, _transformY;
function Powerup (parent, bounds, isCordak, x, y, depth, chooseFrom) {
super(bounds);
_type = (isCordak ? (CORDAK) : (chooseFrom[Math.floor(Math.random() * chooseFrom.length)]));
var _local3 = _getSymbol();
_clip = parent.attachMovie(_local3, (_local3 + depth.toString()) + "_mc", depth, {_xscale:SCALE, _yscale:SCALE});
this.x = x;
this.y = y;
}
function _getSymbol() {
var _local2 = "powerup_";
switch (_type) {
case CORDAK :
_local2 = _local2 + "cordak";
break;
case FAST_THROW :
_local2 = _local2 + "throw";
break;
case FAST_FEET :
_local2 = _local2 + "feet";
break;
case ELECTRIC_CHAINS :
_local2 = _local2 + "chains";
break;
}
return(_local2);
}
function step() {
if ((!_atRest) && (!_expanding)) {
if (_f0 >= 0) {
var _local2 = (getTimer() - _f0) / 1000;
vy = vy + (_local2 * GRAVITY);
y = y + (_local2 * vy);
}
if ((y - (_clip._height / 2)) < 0) {
y = _clip._height / 2;
vy = 0;
_atRest = true;
_t0 = getTimer();
}
_f0 = getTimer();
} else if (((!_expanding) && (!_disappearing)) && ((getTimer() - _t0) > DISAPPEAR_AFTER)) {
_t0 = getTimer();
_disappearing = true;
}
}
function draw() {
_clip._x = x;
_clip._y = _transformY(y);
var _local2 = getTimer() - _t0;
if (_disappearing) {
if (_local2 > DISAPPEAR_PERIOD) {
_clip.removeMovieClip();
main.Game.instance().removePowerup(this, false);
} else {
_clip._xscale = (_clip._yscale = com.robertpenner.easing.Back.easeIn(_local2, SCALE, -SCALE, DISAPPEAR_PERIOD));
}
} else if (_expanding) {
if (_local2 > DISAPPEAR_PERIOD) {
_clip.removeMovieClip();
main.Game.instance().removePowerup(this, true);
} else {
_clip._alpha = com.robertpenner.easing.Quart.easeOut(_local2, 100, -100, DISAPPEAR_PERIOD);
_clip._xscale = (_clip._yscale = com.robertpenner.easing.Quart.easeOut(_local2, SCALE, 2 * SCALE, DISAPPEAR_PERIOD));
}
}
}
function pickup() {
main.SM.instance().playSound(((_type == CORDAK) ? "sfx_powerup_cordak" : "sfx_powerup"));
_t0 = getTimer();
_expanding = true;
}
function get type() {
return(_type);
}
function hitTest(clip) {
var _local2 = ((_expanding || (_disappearing)) ? false : (_clip.hitTest(clip)));
return(_local2);
}
function dispose() {
_clip.removeMovieClip();
}
static var FAST_THROW = 0;
static var FAST_FEET = 1;
static var ELECTRIC_CHAINS = 2;
static var CORDAK = 9;
static var GRAVITY = -100;
static var SCALE = 30;
static var DISAPPEAR_PERIOD = 300;
static var DISAPPEAR_AFTER = 3000;
var _clip = null;
var _type = -1;
var _atRest = false;
var _disappearing = false;
var _expanding = false;
var _t0 = 0;
var _f0 = -1;
}
Symbol 679 MovieClip [__Packages.com.robertpenner.easing.Back] Frame 0
class com.robertpenner.easing.Back
{
function Back () {
}
static function easeIn(t, b, c, d, s) {
if (s == undefined) {
s = 1.70158;
}
t = t / d;
return((((c * t) * t) * (((s + 1) * t) - s)) + b);
}
static function easeOut(t, b, c, d, s) {
if (s == undefined) {
s = 1.70158;
}
t = (t / d) - 1;
return((c * (((t * t) * (((s + 1) * t) + s)) + 1)) + b);
}
static function easeInOut(t, b, c, d, s) {
if (s == undefined) {
s = 1.70158;
}
t = t / (d / 2);
if (t < 1) {
s = s * 1.525;
return(((c / 2) * ((t * t) * (((s + 1) * t) - s))) + b);
}
t = t - 2;
s = s * 1.525;
return(((c / 2) * (((t * t) * (((s + 1) * t) + s)) + 2)) + b);
}
}
Symbol 680 MovieClip [__Packages.com.robertpenner.easing.Quart] Frame 0
class com.robertpenner.easing.Quart
{
function Quart () {
}
static function easeIn(t, b, c, d) {
t = t / d;
return(((((c * t) * t) * t) * t) + b);
}
static function easeOut(t, b, c, d) {
t = (t / d) - 1;
return(((-c) * ((((t * t) * t) * t) - 1)) + b);
}
static function easeInOut(t, b, c, d) {
t = t / (d / 2);
if (t < 1) {
return((((((c / 2) * t) * t) * t) * t) + b);
}
t = t - 2;
return((((-c) / 2) * ((((t * t) * t) * t) - 2)) + b);
}
}
Symbol 681 MovieClip [__Packages.FPS] Frame 0
class FPS
{
var tf, f, t;
function FPS () {
var _local3;
var _local4;
_local3 = _root.createEmptyMovieClip("fpsDisplay_mc", _root.getNextHighestDepth());
_local4 = new TextFormat("_sans", 10);
_local4.align = "center";
tf = _local3.createTextField("tf", 0, 0, 0, 22, 15);
tf._x = Stage.width - tf._width;
tf.border = true;
tf.background = true;
tf.backgroundColor = 16777215 /* 0xFFFFFF */;
tf.setNewTextFormat(_local4);
f = 0;
t = getTimer();
_local3.onEnterFrame = EventDelegate.create(this, count);
}
static function getInstance() {
if (instance == null) {
instance = new FPS();
}
return(instance);
}
function count() {
if ((getTimer() - t) > 1000) {
tf.text = String(f);
t = getTimer();
f = 0;
} else {
f++;
}
}
static var instance = null;
}
Symbol 425 MovieClip Frame 1
stop();
Symbol 428 MovieClip Frame 46
setupPlayAndHighScoreButtons(false);
Symbol 428 MovieClip Frame 100
setupAll();
stop();
Symbol 428 MovieClip Frame 126
nextAction();
stop();
Symbol 457 MovieClip Frame 15
stop();
Symbol 457 MovieClip Frame 75
stop();
Symbol 509 MovieClip Frame 1
Key.addListener(this);
onKeyDown = function () {
if (Key.getCode() == 32) {
initGame();
}
};
skip_mc.skip_btn.onRelease = function () {
initGame();
};
Symbol 509 MovieClip Frame 142
main.SM.instance().playSound("sfx_burst_normal", 100);
Symbol 509 MovieClip Frame 268
main.SM.instance().playSound("sfx_spark", 100);
Symbol 509 MovieClip Frame 338
main.SM.instance().playSound("sfx_harpoon", 100);
Symbol 509 MovieClip Frame 386
main.SM.instance().playSound("sfx_burst_normal", 100);
Symbol 509 MovieClip Frame 510
skip_mc.gotoAndPlay("out");
Symbol 509 MovieClip Frame 525
Key.removeListener(this);
initGame();
stop();
Symbol 531 MovieClip Frame 1
stop();
Symbol 531 MovieClip Frame 13
stop();
Symbol 531 MovieClip Frame 38
stop();
Symbol 531 MovieClip Frame 61
stop();
Symbol 531 MovieClip Frame 86
stop();
Symbol 531 MovieClip Frame 114
stop();
Symbol 531 MovieClip Frame 140
stop();
Symbol 539 MovieClip Frame 1
stop();
Symbol 567 MovieClip Frame 1
stop();
Symbol 635 MovieClip Frame 1
stop();
Symbol 645 MovieClip Frame 1
stop();
Symbol 645 MovieClip Frame 15
openPanel();
stop();
Symbol 645 MovieClip Frame 16
stop();
Symbol 645 MovieClip Frame 26
stop();
Symbol 645 MovieClip Frame 36
stop();
Symbol 645 MovieClip Frame 46
stop();
Symbol 645 MovieClip Frame 71
stop();
closePanel();
Symbol 648 MovieClip Frame 45
feet_mc._visible = (throw_mc._visible = (chains_mc._visible = false));
doFirstAction();
stop();
Symbol 648 MovieClip Frame 99
lastAction();
stop();
Symbol 649 MovieClip Frame 1
stop();
main.Main.getInstance().init(this);