Frame 1
_root.debug = true;
if (_root.advert == undefined) {
_root.advert = true;
} else {
_root.advert = _root.advert.toLowerCase() == "yes";
}
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 = "Jaller";
}
this.onEnterFrame = function () {
var _local2 = this.getBytesLoaded();
var _local4 = this.getBytesTotal();
if ((_local2 > 0) && (_local4 > 0)) {
var _local3 = Math.round((100 * _local2) / _local4);
if ((_local3 > 0) && (_local3 <= 100)) {
this.preloader_mc.gotoAndStop(_local3);
}
if (_local2 >= _local4) {
this.preloader_mc.gotoAndPlay(101);
delete this.onEnterFrame;
}
}
};
stop();
Frame 21
i = -16734;
createEmptyMovieClip("kv_mc", i);
kv_mc.kv_v = {c:187, td:"187.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 2 MovieClip [rockfall] Frame 79
removeMe();
stop();
Symbol 83 MovieClip Frame 156
_root.gotoAndStop("main");
Symbol 111 MovieClip [explosion] Frame 12
removeMe(this);
stop();
Symbol 147 MovieClip [implosion] Frame 24
removeMe();
stop();
Symbol 256 MovieClip [enemy_dodge] Frame 1
stop();
Symbol 275 MovieClip [enemy_movefire] Frame 1
stop();
Symbol 290 MovieClip [enemy_ninja] Frame 1
stop();
Symbol 298 MovieClip [enemy_simple] Frame 1
stop();
Symbol 301 MovieClip [code_icon] Frame 1
stop();
Symbol 489 MovieClip Frame 57
main.SM.instance().playSound("sfx_power_fireball");
Symbol 489 MovieClip Frame 111
main.SM.instance().playSound("sfx_big_squark");
Symbol 489 MovieClip Frame 287
main.SM.instance().playSound("sfx_cordak");
Symbol 490 MovieClip [cutscene_success] Frame 344
removeMe();
stop();
Symbol 579 MovieClip Frame 21
main.SM.instance().playSound("sfx_cordak");
Symbol 579 MovieClip Frame 62
main.SM.instance().playSound("sfx_squid_impact");
Symbol 579 MovieClip Frame 262
main.SM.instance().playSound("sfx_big_explosion");
Symbol 580 MovieClip [cutscene_failure] Frame 406
removeMe();
stop();
Symbol 610 MovieClip Frame 1
stop();
Symbol 963 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 964 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 setVolume(_id, _vol) {
soundList[_id].setVolume(_vol);
}
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 965 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();
fade.stop();
sweep.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 966 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");
};
}
}
static var version = "1.1.0.52";
}
Symbol 967 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++;
}
}
static var version = "1.1.0.52";
}
Symbol 968 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 version = "1.1.0.52";
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 969 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 970 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 971 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_cheater", "sfx_click", "sfx_score_tick", "sfx_beam", "sfx_fireball", "sfx_power_fireball", "sfx_collect", "sfx_powerup", "sfx_squid_impact", "sfx_squid_fire", "sfx_big_squark", "sfx_cordak", "sfx_squark1", "sfx_squark2", "sfx_squark3", "sfx_big_explosion", "sfx_small_explosion"]);
maskUnlocked = false;
cheatModeOn = false;
if (_root.debug) {
keyListener = {};
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(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(true);
}
static function advertLinkIsInSameDomainAsHost() {
var _local2 = _root._url.toLowerCase();
return(_local2.indexOf(_root.advert.toLowerCase()) >= 0);
}
static function showAdvert() {
return(_root.advert);
}
static var KEY = "e83d1cb44af53f2bc821225a3d2e76fd363e55e4";
static var instance = null;
var _interval = -1;
}
Symbol 972 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.lockdownMode()) {
_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 = "JON";
static var NEXT_ACTION_PLAY_GAME = 0;
static var NEXT_ACTION_HIGH_SCORE = 1;
var _enteredCode = null;
var _na = -1;
var _maskUnlocked = false;
}
Symbol 973 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 974 MovieClip [__Packages.main.Game] Frame 0
class main.Game
{
function Game (mc, maskUnlocked) {
if (_instance == null) {
_instance = this;
_clip = mc;
_maskUnlocked = maskUnlocked;
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!");
}
}
static function instance() {
return(_instance);
}
function _doFirstAction() {
main.EnemyFactory.instance().addEventListener(main.EnemyFactory.EVENT_ENEMY_SPAWNED, this);
_setMaskPowerState();
_openPanel(PANEL_FRAME_INSTRUCTIONS);
_clip.wall_mc._visible = false;
}
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 :
Key.addListener(this);
_clip.panel_mc.play_btn.onRelease = (_foo = EventDelegate.create(this, _onPanelInstructionsPlayClicked));
break;
case PANEL_FRAME_NEXT_LEVEL :
_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.goToAdvert_btn.enabled = (_clip.panel_mc.goToAdvert_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 = "www.BIONICLE.com";
_clip.panel_mc.advert_mc.link_btn.onRelease = EventDelegate.create(this, _onPanelAdvertLinkClicked);
var _local2 = function () {
this.link_txt.text = "www.BIONICLE.com";
};
_clip.panel_mc.advert_mc.link_btn.onRollOver = _local2;
_clip.panel_mc.advert_mc.link_btn.onRollOut = _local2;
_clip.panel_mc.advert_mc.link_btn.onReleaseOutside = _local2;
break;
}
}
function _cleanLevel() {
main.EnemyFactory.instance().switchOff();
main.SM.instance().fadeSound("game_loop", 0, 1);
_clip.container_mc._visible = false;
_jaller.y = _clip.bounds_mc._height / 2;
_jaller.draw();
_cordakSpawned = false;
if (_beam != null) {
removeBeam();
}
if (_mgun != null) {
removeMachineGun();
}
_f0 = -1;
_m0 = -1;
_jaller.resetTimer();
_cc.resetTimer();
var _local3 = main.EnemyBase.first;
while (_local3 != null) {
_local3.dispose();
_local3 = _local3.next;
}
main.EnemyBase.first = null;
var _local2 = main.Shot.first;
while (_local2 != null) {
_local2.dispose();
_local2 = _local2.next;
}
main.Shot.first = null;
Mouse.removeListener(this);
Mouse.show();
_crosshair.__set__visible(false);
}
function _onPanelInstructionsPlayClicked() {
main.SM.instance().playSound("sfx_click");
Key.removeListener(this);
_clip.panel_mc.play_btn.enabled = false;
_closePanel(EventDelegate.create(this, _startGame));
}
function _startGame() {
main.ScoreManager.instance().resetGame();
_failed = false;
_succeeded = false;
_level = 0;
_crosshair = new main.Crosshair(_clip.containerLight_mc, _clip.bounds_mc, _clip.containerLight_mc.getNextHighestDepth());
_crosshair.__set__visible(false);
_jaller = new main.Jaller(_clip.container_mc, _clip.bounds_mc, main.Depths.JALLER, 25, _clip.bounds_mc._height / 2);
_cc = new main.CrabCollector(_clip.container_mc, _clip.bounds_mc, main.Depths.CRAB_COLLECTOR, _jaller);
_refreshPowerupIndicators();
_hud = new main.Hud(_clip.hud_mc);
_updateHud();
_startLevel();
}
function _startLevel() {
_hud.setScore(main.ScoreManager.instance().__get__score());
main.EnemyFactory.instance().switchOn();
_level_t0 = getTimer();
Mouse.addListener(this);
Mouse.hide();
_crosshair.__set__visible(true);
_clip.container_mc._visible = true;
main.SM.instance().playSound("game_loop", 50, 99999);
startWork();
}
function onEnemySpawned(eventObject) {
eventObject.enemy.addEventListener(main.EnemyBase.EVENT_FIRE_SHOT, this);
main.EnemyBase.addToList(eventObject.enemy);
}
function onFireShot(eventObject) {
var _local3 = new main.Shot(_clip.container_mc, _clip.bounds_mc, "shot", getNextDepth(main.Depths.SHOTS), eventObject.x, eventObject.y, 0, eventObject.damage, eventObject.target);
main.SM.instance().playSound("sfx_squid_fire");
_local3.vx = eventObject.vx;
_local3.vy = eventObject.vy;
_local3.setVelocityVector();
main.Shot.addToList(_local3);
}
function onKeyDown() {
if (Key.getCode() == 32) {
_foo();
}
}
function onMouseDown() {
var _local2 = getTimer();
if (_mgun != null) {
_mgun.beginFiring();
} else if (((!_jaller.__get__stunned()) && ((_local2 - _lastShot_t0) > _jaller.__get__recharge())) && (_beam == null)) {
_m0 = getTimer();
}
}
function onMouseUp() {
if (_mgun != null) {
_mgun.stopFiring();
return(undefined);
}
if (_m0 == -1) {
return(undefined);
}
var _local4 = getTimer();
var _local3 = 0;
if ((_local4 - _m0) > POWER_CHARGE_OFFSET) {
_local3 = ((_local4 - _m0) - POWER_CHARGE_OFFSET) / MAX_CHARGE_TIME;
_local3 = Math.min(1, _local3);
main.ScoreManager.instance().registerHit();
main.SM.instance().playSound("sfx_power_fireball");
} else {
main.ScoreManager.instance().registerMiss();
main.SM.instance().playSound("sfx_fireball");
}
_m0 = -1;
var _local2 = new main.Shot(_clip.container_mc, _clip.bounds_mc, "fireball", getNextDepth(main.Depths.SHOTS), _jaller.x, _jaller.y, _local3, _jaller.__get__damage(), _jaller);
_local2.setScale(_jaller._damage);
_local2.increaseScale(100 * _local3);
if ((_theta > 0) && (_theta > MAX_ANGLE)) {
_theta = MAX_ANGLE;
} else if ((_theta < 0) && (_theta < (-MAX_ANGLE))) {
_theta = -MAX_ANGLE;
}
_local2.vx = _jaller.__get__shotSpeed() * Math.cos(_theta);
_local2.vy = _jaller.__get__shotSpeed() * Math.sin(_theta);
_local2.setVelocityVector();
main.Shot.addToList(_local2);
_jaller._pulse_t0 = -1;
_lastShot_t0 = _local4;
}
function fireMachineGunShot() {
main.ScoreManager.instance().registerMiss();
main.SM.instance().playSound("sfx_fireball");
var _local2 = new main.Shot(_clip.container_mc, _clip.bounds_mc, "fireball", getNextDepth(main.Depths.SHOTS), _jaller.x, _jaller.y, 0.1, _jaller.__get__damage() / 4, _jaller);
_local2.setScale(_jaller._damage);
if ((_theta > 0) && (_theta > MAX_ANGLE)) {
_theta = MAX_ANGLE;
} else if ((_theta < 0) && (_theta < (-MAX_ANGLE))) {
_theta = -MAX_ANGLE;
}
_local2.vx = _jaller.__get__shotSpeed() * Math.cos(_theta);
_local2.vy = _jaller.__get__shotSpeed() * Math.sin(_theta);
_local2.setVelocityVector();
main.Shot.addToList(_local2);
_lastShot_t0 = getTimer();
}
function startWork() {
_f0 = getTimer();
_clip.onEnterFrame = EventDelegate.create(this, loop);
}
function stopWork() {
delete _clip.onEnterFrame;
}
function loop() {
step();
draw();
}
function step() {
var _local9 = getTimer();
if (_beam != null) {
_beam.step();
}
if (_mgun != null) {
_mgun.step();
}
var _local4 = main.EnemyBase.first;
while (_local4 != null) {
_local4.step();
_local4 = _local4.next;
}
_crosshair.x = _clip.container_mc._xmouse;
_crosshair.y = _clip.bounds_mc._height - _clip.container_mc._ymouse;
var _local3 = main.Powerup.first;
while (_local3 != null) {
_local3.step();
_local3 = _local3.next;
}
if ((!_jaller.__get__stunned()) && (_f0 >= 0)) {
var _local6 = _crosshair.x - _jaller.x;
var _local5 = _crosshair.y - _jaller.y;
if (Math.abs(_local5) > 1) {
_theta = Math.atan2(_local5, _local6);
var _local11 = _local5 > 0;
var _local8 = (_local11 ? 1 : -1);
var _local10 = _local6 < 0;
_local6 = Math.abs(_local6);
_local5 = Math.abs(_local5);
var _local7 = Math.abs(_theta);
if ((_local7 > MAX_ANGLE) || (_local10)) {
_jaller.y = _jaller.y + (((_local8 * _jaller.__get__speed()) * (_local9 - _f0)) / 1000);
_jaller.setRotation((((-_local8) * 180) * MAX_ANGLE) / Math.PI);
} else if ((_local7 <= MAX_ANGLE) && (!_local10)) {
_jaller.setRotation((((-_local8) * 180) * _local7) / Math.PI);
}
}
}
var _local2 = main.Shot.first;
while (_local2 != null) {
_local2.step();
_local2 = _local2.next;
}
_local2 = main.Shot.first;
while (_local2 != null) {
if ((_local2.__get__originator() != _jaller) && (_local2.hitTest(_clip.wall_mc))) {
_damageWall(_local2.__get__damage());
_local2.implode();
} else {
_hitTestEnemies(_local2);
}
_local2 = _local2.next;
}
_jaller.step();
_cc.step();
_regenWall(_local9);
_f0 = _local9;
}
function _regenWall(f) {
if (_f0 >= 0) {
var _local2 = (_jaller.__get__regen() * (f - _f0)) / 1000;
_wallHP = _wallHP + _local2;
if (_wallHP > FULL_WALL_HP) {
_wallHP = FULL_WALL_HP;
}
_setWallGraphics();
_updateHud();
}
}
function _setWallGraphics() {
var _local2 = 9;
var _local3 = (_local2 - Math.ceil((_local2 * _wallHP) / 100)) + 1;
_clip.wallGraphics_mc.wall_mc.gotoAndStop(_local3);
_clip.wallGraphicsBG_mc.wall_mc.gotoAndStop(_local3);
}
function _hitTestEnemies(shot) {
var _local2 = main.EnemyBase.first;
var _local4 = false;
while (_local2 != null) {
if (((shot.__get__originator() instanceof main.Jaller) && (!_local2.isSwimmingAway())) && (!_local2.isCloaked())) {
if (shot.hitTest(_local2.__get__hitarea())) {
_local2.takeDamage(shot);
_checkEnemyDead(_local2);
_checkFireball(shot, _local2);
main.Shot.removeFromList(shot);
shot.dispose();
_local4 = true;
break;
}
if ((shot.__get__originator() == _jaller) && (_local2.canDodge())) {
_local2.dodge(shot);
}
}
_local2 = _local2.next;
}
return(_local4);
}
function _checkFireball(shot, enemyHit) {
if (shot.__get__fullPower()) {
var _local6 = getNextDepth(main.Depths.FIREBALLS);
var _local5 = _clip.container_mc.attachMovie("explosion", ("explosion" + String(_local6)) + "_mc", _local6, {_x:enemyHit.x, _y:_clip.bounds_mc._height - enemyHit.y});
_local5.cacheAsBitmap = true;
_local5.removeMe = EventDelegate.create(this, _removeExplosion);
main.SM.instance().playSound("sfx_small_explosion");
var _local2 = main.EnemyBase.first;
while (_local2 != null) {
if (_local2 != enemyHit) {
if (_enemyDistanceSquared(_local2, enemyHit) < FIREBALL_BLAST_RADIUS_SQUARED) {
_local2.takeSpecificDamage(shot.__get__damage() / 2, true);
}
}
_local2 = _local2.next;
}
_local2 = main.EnemyBase.first;
while (_local2 != null) {
if (_local2 != enemyHit) {
_checkEnemyDead(_local2);
}
_local2 = _local2.next;
}
}
}
function _removeExplosion(clip) {
clip.removeMovieClip();
}
function _enemyDistanceSquared(e1, e2) {
var _local2 = e2.x - e1.x;
var _local1 = e2.y - e1.y;
return((_local2 * _local2) + (_local1 * _local1));
}
function beamDamageEnemy(enemy, damage) {
enemy.takeSpecificDamage(damage, false);
_checkEnemyDead(enemy);
}
function _checkEnemyDead(enemy) {
if (enemy.isDead() && (!enemy.isSwimmingAway())) {
_spawnPowerup(enemy.x, enemy.y);
enemy.swimAway();
main.ScoreManager.instance().registerSwimAway();
}
}
function _spawnPowerup(x, y) {
var _local3 = (!_cordakSpawned) && ((getTimer() - _level_t0) > _getSurviveTime());
var _local5 = Math.floor(POWERUP_DROP_PROBABILITY * Math.random()) == 0;
if (!(_local3 || (_local5))) {
return(undefined);
}
var _local2 = [];
if (_local3) {
_local2.push(main.Powerup.CORDAK);
_cordakSpawned = true;
} else {
if (_beam == null) {
_local2.push(main.Powerup.BEAM);
_local2.push(main.Powerup.BEAM);
}
if (_mgun == null) {
_local2.push(main.Powerup.MGUN);
_local2.push(main.Powerup.MGUN);
}
if (!SPAWN_SPECIALS_ONLY) {
if (!_jaller.maxRegen()) {
_local2.push(main.Powerup.REGEN);
}
if (!_jaller.maxSpeed()) {
_local2.push(main.Powerup.SPEED);
}
if (!_jaller.maxDamage()) {
_local2.push(main.Powerup.DAMAGE);
}
}
}
if (_local2.length > 0) {
var _local6 = _local2[Math.floor(_local2.length * Math.random())];
var _local4 = new main.Powerup(_clip.container_mc, _clip.bounds_mc, getNextDepth(main.Depths.POWERUPS), x, y, _local6);
main.Powerup.addToList(_local4);
_cc.collect(_local4);
}
}
function activatePowerup(powerup) {
var _local2 = true;
switch (powerup.__get__type()) {
case main.Powerup.BEAM :
if (_beam == null) {
removeMachineGun();
_beam = new main.Beam(_clip.container_mc, _clip.bounds_mc, _jaller);
_crosshair.__set__visible(false);
} else {
_beam.extendTime();
}
_local2 = false;
break;
case main.Powerup.MGUN :
if (_mgun == null) {
removeBeam();
_mgun = new main.MachineGun();
_m0 = -1;
} else {
_mgun.extendTime();
}
_local2 = false;
break;
case main.Powerup.SPEED :
_jaller.increaseSpeed();
break;
case main.Powerup.DAMAGE :
_jaller.increaseDamage();
_jaller.increaseRecharge();
break;
case main.Powerup.REGEN :
_jaller.increaseRegen();
_clip.wallDefense_mc.play();
break;
case main.Powerup.CORDAK :
main.SM.instance().playSound("sfx_collect");
_local2 = false;
break;
default :
_local2 = false;
}
if (_local2) {
main.SM.instance().playSound("sfx_powerup");
}
_refreshPowerupIndicators();
}
function _refreshPowerupIndicators() {
_clip.damage_txt.text = String(_jaller._damage - 1);
_clip.regen_txt.text = String(_jaller._regen - 1);
_clip.speed_txt.text = String(_jaller._speed - 1);
}
function removeBeam() {
if (_beam != null) {
_beam.dispose();
_beam = null;
_crosshair.__set__visible(true);
}
}
function removeMachineGun() {
if (_mgun != null) {
_mgun.dispose();
_mgun = null;
}
}
function _damageWall(damage) {
main.ScoreManager.instance().registerWallHit();
_wallHP = _wallHP - damage;
if (_wallHP < 0) {
_wallHP = 0;
playerDead();
}
_setWallGraphics();
_updateHud();
}
function draw() {
if (_root.debug) {
_clip.debug_txt.text = "";
_clip.debug_txt.text = _clip.debug_txt.text + ((((((("lvl=" + String(_level)) + ",spd=") + String(_jaller._speed)) + ",dam=") + String(_jaller._damage)) + ",rch=") + String(_jaller._recharge));
_clip.debug_txt.text = _clip.debug_txt.text + ((((((",rgn=" + String(_jaller._regen)) + ",wal=") + String(Math.round(_wallHP))) + ",rem=") + String(Math.round((_getSurviveTime() - (getTimer() - _level_t0)) / 1000))) + "s");
}
if (_beam != null) {
_beam.draw();
}
var _local5 = main.EnemyBase.first;
while (_local5 != null) {
_local5.draw();
_local5 = _local5.next;
}
_crosshair.draw();
_drawPowerBar();
_jaller.draw();
_cc.draw();
_clip.gradient_mc._y = 171 + ((_clip.bounds_mc._height / 2) - _jaller.y);
var _local4 = main.Powerup.first;
while (_local4 != null) {
_local4.draw();
_local4 = _local4.next;
}
var _local3 = main.Shot.first;
while (_local3 != null) {
_local3.draw();
_local3 = _local3.next;
}
}
function _drawPowerBar() {
var _local5 = 0;
var _local4 = 0;
var _local3 = 100;
if ((_m0 >= 0) && ((getTimer() - _m0) > POWER_CHARGE_OFFSET)) {
var _local2 = ((getTimer() - _m0) - POWER_CHARGE_OFFSET) / MAX_CHARGE_TIME;
if (_local2 > 1) {
_local2 = 1;
}
_local4 = 14 + (86 * _local2);
_local3 = 100 + (250 * _local2);
}
_jaller.setGlow(_local4, _local3, _local2 == 1);
}
function removeShot(shot) {
main.Shot.removeFromList(shot);
main.ScoreManager.instance().registerMiss();
}
function removePowerup(powerup) {
main.Powerup.removeFromList(powerup);
if (powerup.__get__type() == main.Powerup.CORDAK) {
nextLevel();
}
}
function removeEnemy(enemy) {
main.EnemyBase.removeFromList(enemy);
}
function unlockMask() {
_maskUnlocked = true;
_updateHud();
_setMaskPowerState();
}
function _setMaskPowerState() {
_clip.blackBox_mc.cacheAsBitmap = !_maskUnlocked;
_clip.gradient_mc.cacheAsBitmap = !_maskUnlocked;
_clip.blackBox_mc.setMask((_maskUnlocked ? null : (_clip.gradient_mc)));
_clip.blackBox_mc._visible = !_maskUnlocked;
_clip.gradient_mc._visible = !_maskUnlocked;
}
function _updateHud() {
var _local2 = Math.round((main.Hud.ENERGY_SEGMENTS * _wallHP) / FULL_WALL_HP);
_hud.setEnergy(_local2);
if (_maskUnlocked) {
_hud.setMaskLight(100);
} else {
_hud.setMaskDark();
}
}
function getNextDepth(startDepth) {
var _local2 = startDepth;
while (_clip.container_mc.getInstanceAtDepth(_local2) != undefined) {
_local2++;
}
return(_local2);
}
function _getSurviveTime() {
return(7500 * (_level + 6));
}
function get level() {
return(_level);
}
function get clip() {
return(_clip);
}
function prevLevel() {
if ((_level > 0) && (_clip.onEnterFrame != undefined)) {
_hud.setCordakIndicator(_level - 2);
stopWork();
_cleanLevel();
_level--;
_killInterval();
_interval = setInterval(this, "_showEndOfLevelPopup", 500);
}
}
function nextLevel() {
if ((_level < NUMBER_OF_LEVELS) && (_clip.onEnterFrame != undefined)) {
_hud.setCordakIndicator(_level);
stopWork();
_cleanLevel();
_level++;
_succeeded = _level >= NUMBER_OF_LEVELS;
if (!_succeeded) {
_killInterval();
_interval = setInterval(this, "_showEndOfLevelPopup", 500);
} else {
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 _startSuccessSoundLoops() {
main.SM.instance().playSound("success_short", 75, 99999);
}
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 autoComplete() {
_level = NUMBER_OF_LEVELS - 1;
nextLevel();
}
function fillEnergy() {
_wallHP = FULL_WALL_HP;
_setWallGraphics();
_updateHud();
}
function giveAllPowerups() {
trace("TODO! give all powerups");
}
function emptyEnergy() {
if (_clip.onEnterFrame != undefined) {
_damageWall(99999);
}
}
function _showEndOfLevelPopup() {
_killInterval();
_openPanel(PANEL_FRAME_NEXT_LEVEL);
}
function _scoreLevel() {
_clip.panel_mc.score_mc.overall_txt.text = String(main.ScoreManager.instance().__get__score());
_clip.panel_mc.score_mc.swim_txt.text = String(main.ScoreManager.instance().__get__swimAwayBonus());
_clip.panel_mc.score_mc.wall_txt.text = String(main.ScoreManager.instance().__get__wallHitBonus());
_clip.panel_mc.score_mc.multi_txt.text = String(main.ScoreManager.instance().__get__accuracyBonus());
_tempScore = main.ScoreManager.instance().score;
var _local2 = main.ScoreManager.instance().__get__score();
_local2 = _local2 + main.ScoreManager.instance().swimAwayBonus;
_local2 = _local2 + main.ScoreManager.instance().wallHitBonus;
_local2 = _local2 + main.ScoreManager.instance().accuracyBonus;
main.ScoreManager.instance().__set__score(_local2);
_killInterval();
_interval = setInterval(this, "_beginTickerSoundAndTransferScores", 1500);
}
function _beginTickerSoundAndTransferScores() {
_killInterval();
main.SM.instance().playSound("sfx_score_tick", 100, 99999);
Key.addListener(this);
_foo = EventDelegate.create(this, _scoringFinished);
_transferScores();
}
function _scoringFinished() {
Key.removeListener(this);
_clip.panel_mc.score_mc.swim_txt.text = "0";
_clip.panel_mc.score_mc.wall_txt.text = "0";
_clip.panel_mc.score_mc.multi_txt.text = "0";
_clip.panel_mc.score_mc.overall_txt.text = String(main.ScoreManager.instance().__get__score());
_hud.setScore(main.ScoreManager.instance().__get__score());
main.SM.instance().stopSound("sfx_score_tick");
main.ScoreManager.instance().resetLevel();
_killInterval();
Key.addListener(this);
if ((_level < NUMBER_OF_LEVELS) && (!_failed)) {
_clip.panel_mc.play_btn.enabled = (_clip.panel_mc.play_btn._visible = true);
_clip.panel_mc.play_btn.onRelease = (_foo = EventDelegate.create(this, _onPanelNextLevelPlayClicked));
} else {
if (!main.Main.showAdvert()) {
_clip.panel_mc.play_btn.enabled = (_clip.panel_mc.play_btn._visible = true);
_clip.panel_mc.play_btn.onRelease = (_foo = EventDelegate.create(this, _onPanelSuccessPlayClicked));
} else {
_clip.panel_mc.goToAdvert_btn.enabled = (_clip.panel_mc.goToAdvert_btn._visible = true);
_clip.panel_mc.goToAdvert_btn.onRelease = (_foo = EventDelegate.create(this, _onPanelSuccessPlayClicked));
}
if (!main.Main.lockdownMode()) {
_clip.panel_mc.highScore_btn.enabled = (_clip.panel_mc.highScore_btn._visible = true);
_clip.panel_mc.highScore_btn.onRelease = EventDelegate.create(this, _onPanelSuccessHighScoreClicked);
}
}
}
function _transferScores() {
_killInterval();
_interval = setInterval(this, "_transferScores", 10);
var _local4 = true;
var _local3 = 100;
var _local2 = _tempScore;
_clip.panel_mc.score_mc.overall_txt.text = String(_local2);
_hud.setScore(_local2);
var _local5 = parseInt(_clip.panel_mc.score_mc.swim_txt.text);
if (_local5 > 0) {
_local2 = _local2 + _local3;
_clip.panel_mc.score_mc.swim_txt.text = String(_local5 - _local3);
_local4 = false;
} else {
var _local6 = parseInt(_clip.panel_mc.score_mc.wall_txt.text);
if (_local6 < 0) {
_local2 = _local2 - _local3;
_clip.panel_mc.score_mc.wall_txt.text = String(_local6 + _local3);
_local4 = false;
} else {
var _local7 = parseInt(_clip.panel_mc.score_mc.multi_txt.text);
if (_local7 > 0) {
_local2 = _local2 + _local3;
_clip.panel_mc.score_mc.multi_txt.text = String(_local7 - _local3);
_local4 = false;
}
}
}
_tempScore = _local2;
_clip.panel_mc.score_mc.overall_txt.text = String(_local2);
_hud.setScore(_local2);
if (_local4) {
_scoringFinished();
}
updateAfterEvent();
}
function _killInterval() {
if (_interval >= 0) {
clearInterval(_interval);
_interval = -1;
}
}
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;
if (!main.Main.showAdvert()) {
_closePanel(EventDelegate.create(this, _showOpening));
} else {
_closePanel(EventDelegate.create(this, _showAdvertPopup));
}
}
function _showAdvertPopup() {
_killInterval();
_openPanel(PANEL_FRAME_ADVERT);
}
function _onPanelAdvertPlayClicked() {
main.SM.instance().playSound("sfx_click");
Key.removeListener(this);
_clip.panel_mc.play_btn.enabled = false;
_closePanel(EventDelegate.create(this, _showOpening));
}
function _onPanelAdvertLinkClicked() {
getURL ("http://www.BIONICLE.com", "_blank");
_clip.panel_mc.advert_mc.link_btn.link_txt.text = "www.BIONICLE.com";
}
function _onPanelSuccessHighScoreClicked() {
HighScore.instance().addEventListener(HighScore.EVENT_SCORES_SAVED, this);
HighScore.instance().saveHighScore(0, main.Main.KEY);
}
function onHighScoresSaved(eventObject) {
HighScore.instance().removeEventListener(HighScore.EVENT_SCORES_SAVED, this);
_dispatchShowHighScoreTable();
}
function _dispatchShowHighScoreTable() {
dispatchEvent({type:"showHighScoreTable", target:this});
}
function _showOpening() {
_clip.gotoAndPlay("out");
_clip.doLastAction = EventDelegate.create(this, _dispatchShowOpening);
}
function _dispatchShowOpening() {
dispatchEvent({type:"showOpening", target:this});
}
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 playerDead() {
_failed = true;
stopWork();
_cleanLevel();
var _local2 = ((Math.random() < 0.5) ? "failure1" : "failure2");
main.SM.instance().playSound(_local2);
main.SM.instance().setSoundComplete(_local2, EventDelegate.create(this, _startFailureSoundLoops));
_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 _startFailureSoundLoops() {
main.SM.instance().playSound(((Math.random() < 0.5) ? "failure1_short" : "failure2_short"), 75, 99999);
}
function dispose() {
main.EnemyFactory.instance().removeEventListener(main.EnemyFactory.EVENT_ENEMY_SPAWNED, this);
_instance = null;
}
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 POWERUP_DROP_PROBABILITY = 8;
static var SPAWN_SPECIALS_ONLY = false;
static var SYMBOL_CUTSCENE_SUCCESS = "cutscene_success";
static var SYMBOL_CUTSCENE_FAILURE = "cutscene_failure";
static var NUMBER_OF_LEVELS = 6;
static var FIREBALL_BLAST_RADIUS_SQUARED = 10000;
static var _instance = null;
static var MAX_CHARGE_TIME = 750;
static var FULL_WALL_HP = 100;
static var POWER_CHARGE_OFFSET = 100;
static var SYMBOL_CROSSHAIR = "crosshair";
static var MAX_ANGLE = 0.261799387799149;
var _clip = null;
var _crosshair = null;
var _jaller = null;
var _f0 = -1;
var _m0 = -1;
var _theta = 0;
var _level = 0;
var _lastShot_t0 = -1;
var _level_t0 = -1;
var _cordakSpawned = false;
var _interval = -1;
var _cutscene = null;
var _beam = null;
var _mgun = null;
var _tempScore = 0;
var _cc = null;
var _maskUnlocked = false;
var _hud = null;
var _wallHP = FULL_WALL_HP;
var _failed = false;
var _succeeded = false;
var _foo = null;
}
Symbol 975 MovieClip [__Packages.main.IStepable] Frame 0
interface main.IStepable
{
}
Symbol 976 MovieClip [__Packages.main.IDrawable] Frame 0
interface main.IDrawable
{
}
Symbol 977 MovieClip [__Packages.main.ContainedObject] Frame 0
class main.ContainedObject implements main.IStepable, main.IDrawable
{
function ContainedObject (bounds) {
v = new Vector();
_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 v = null;
var _bounds = null;
var _f0 = -1;
}
Symbol 978 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);
}
static function crossProductMagnitude(v1, v2) {
return((v1.x * v2.y) - (v1.y * v2.x));
}
function get length() {
return(Math.sqrt((x * x) + (y * y)));
}
function toString() {
return(((("(" + x) + ",") + y) + ")");
}
var x = 0;
var y = 0;
}
Symbol 979 MovieClip [__Packages.main.Crosshair] Frame 0
class main.Crosshair extends main.ContainedObject
{
var x, y, _transformY, _f0, __get__visible;
function Crosshair (parent, bounds, depth, x, y) {
super(bounds);
_clip = parent.attachMovie(SYMBOL_CROSSHAIR, "crosshair_mc", depth);
this.x = x;
this.y = _transformY(y);
draw();
}
function step() {
var _local2 = getTimer();
if (_f0 >= 0) {
}
_f0 = _local2;
}
function draw() {
_clip._x = x;
_clip._y = _transformY(y);
}
function set visible(state) {
_clip._visible = state;
//return(__get__visible());
}
static var SYMBOL_CROSSHAIR = "crosshair";
var _clip = null;
}
Symbol 980 MovieClip [__Packages.main.Jaller] Frame 0
class main.Jaller extends main.ContainedObject
{
var x, y, _transformY, _f0, _bounds;
function Jaller (parent, bounds, depth, x, y) {
super(bounds);
_clip = parent.attachMovie(SYMBOL_JALLER, "jaller_mc", depth);
this.x = x;
this.y = _transformY(y);
draw();
}
function step() {
var _local2 = getTimer();
if (_f0 >= 0) {
if (_stunned && ((_local2 - _stunned_t0) > STUN_PERIOD)) {
_stunned = false;
}
}
_f0 = _local2;
}
function draw() {
if (y < 40) {
y = 40;
} else if (y > (_bounds._height - 20)) {
y = _bounds._height - 20;
}
_clip._x = x;
_clip._y = _transformY(y);
}
function stun() {
if (!_stunned) {
_stunned_t0 = getTimer();
_stunned = true;
}
}
function setRotation(angle) {
_clip.turret_mc._rotation = angle;
var _local3 = 70;
var _local2 = (Math.PI * angle) / 180;
_clip.flames_mc._x = _local3 * Math.cos(_local2);
_clip.flames_mc._y = _local3 * Math.sin(_local2);
}
function getRotation() {
return(_clip.turret_mc._rotation);
}
function hideArm() {
_clip.flames_mc._visible = false;
}
function showArm() {
_clip.flames_mc._visible = true;
}
function maxDamage() {
return(_damage == POWERUP_INCREMENTS);
}
function increaseDamage() {
if (_damage < POWERUP_INCREMENTS) {
_damage++;
}
_clip.flames_mc._xscale = _clip.flames_mc._xscale + 10;
_clip.flames_mc._yscale = _clip.flames_mc._yscale + 5;
}
function get damage() {
return(20 + (8 * _damage));
}
function maxSpeed() {
return(_speed == POWERUP_INCREMENTS);
}
function increaseSpeed() {
if (_speed < POWERUP_INCREMENTS) {
_speed++;
}
}
function get speed() {
return(20 + (8 * _speed));
}
function maxRecharge() {
return(_recharge == POWERUP_INCREMENTS);
}
function increaseRecharge() {
if (_recharge < POWERUP_INCREMENTS) {
_recharge++;
}
}
function get recharge() {
return(350 - (35 * _recharge));
}
function maxRegen() {
return(_regen == POWERUP_INCREMENTS);
}
function increaseRegen() {
if (_regen < POWERUP_INCREMENTS) {
_regen++;
}
}
function get regen() {
return(0.25 * (_regen - 1));
}
function get shotSpeed() {
return(1200);
}
function get hitarea() {
return(_clip);
}
function resetTimer() {
_f0 = -1;
}
function setGlow(alpha, yscale, isPulsing) {
if (!isPulsing) {
_clip.turret_mc.glow_mc._alpha = alpha;
_clip.turret_mc.glow_mc._yscale = yscale;
} else if (isPulsing && (_pulse_t0 == -1)) {
_pulse_t0 = getTimer();
_clip.turret_mc.glow_mc._alpha = 100;
_clip.turret_mc.glow_mc._yscale = 350;
} else if (isPulsing) {
var _local2 = getTimer() - _pulse_t0;
var _local3 = Math.sin((Math.PI*2) * (_local2 / 1000));
_clip.turret_mc.glow_mc._yscale = 350 + (50 * _local3);
}
}
function get stunned() {
return(_stunned);
}
static var SYMBOL_JALLER = "jaller";
static var STUN_PERIOD = 1000;
static var POWERUP_INCREMENTS = 5;
var _clip = null;
var _stunned = false;
var _stunned_t0 = 0;
var _speed = 1;
var _damage = 1;
var _recharge = 1;
var _regen = 1;
var _pulse_t0 = -1;
}
Symbol 981 MovieClip [__Packages.main.Beam] Frame 0
class main.Beam extends main.ContainedObject
{
var x, y, _f0, _transformY;
function Beam (parent, bounds, jaller) {
super(bounds);
_clip = parent.attachMovie(SYMBOL, "beam_mc", main.Depths.BEAM);
_clip.cacheAsBitmap = true;
x = jaller.x + H_OFFSET;
y = jaller.y - V_OFFSET;
_t0 = getTimer();
_jaller = jaller;
_jaller.hideArm();
main.SM.instance().playSound("sfx_beam", 100, 99999);
draw();
}
function step() {
var _local3 = getTimer();
y = _jaller.y - V_OFFSET;
_clip._rotation = _jaller.getRotation();
if (_f0 >= 0) {
if ((_local3 - _t0) > BEAM_TIME) {
_jaller.showArm();
main.Game.instance().removeBeam();
} else {
var _local2 = main.EnemyBase.first;
while (_local2 != null) {
if (_local2.fullHitTest(_clip)) {
main.Game.instance().beamDamageEnemy(_local2, 4);
}
_local2 = _local2.next;
}
}
}
_f0 = _local3;
}
function draw() {
_clip._x = x;
_clip._y = _transformY(y);
}
function extendTime() {
_t0 = getTimer();
}
function dispose() {
main.SM.instance().stopSound("sfx_beam");
_clip.removeMovieClip();
}
static var BEAM_TIME = 7000;
static var SYMBOL = "beam";
static var H_OFFSET = 20;
static var V_OFFSET = 0;
var _clip = null;
var _jaller = null;
var _t0 = -1;
}
Symbol 982 MovieClip [__Packages.main.Depths] Frame 0
class main.Depths
{
function Depths () {
}
static var JALLER = 1000;
static var ENEMIES = 2000;
static var POWERUPS = 6000;
static var SHOTS = 7000;
static var CRAB_COLLECTOR = 9000;
static var BEAM = 9001;
static var FIREBALLS = 9002;
}
Symbol 983 MovieClip [__Packages.main.EnemyBase] Frame 0
class main.EnemyBase extends main.ContainedObject
{
var x, y, _bounds, vx, vy, v, _transformY;
function EnemyBase (parent, bounds, depth, wallX, symbol) {
super(bounds);
_wallX = wallX;
_clip = parent.attachMovie(symbol, ("enemy" + String(depth)) + "_mc", depth);
_clip.hitarea_mc._visible = false;
x = bounds._width + 100;
y = 10 + Math.floor((_bounds._height - 20) * Math.random());
_velocityCache = new Vector();
mx.events.EventDispatcher.initialize(this);
draw();
}
function setStats(maxHP, damage, range, reloadTime, shotSpeed, speed) {
_maxHP = (_currentHP = maxHP);
_damage = damage;
_range = range;
_reloadTime = reloadTime;
_shotSpeed = shotSpeed;
_speed = speed;
vx = -speed;
}
function step() {
var _local3 = getTimer();
if (_isDodging) {
var _local2 = _local3 - _dodge_t0;
if (_local2 > (2 * DODGE_TIME)) {
vx = _velocityCache.x;
vy = _velocityCache.y;
_isDodging = false;
_dodge_fsm = 0;
} else if ((_dodge_fsm == 1) && (_local2 > (DODGE_TIME / 5))) {
vx = 0;
vy = 0;
_dodge_fsm = 2;
} else if ((_dodge_fsm == 2) && (_local2 > ((9 * DODGE_TIME) / 5))) {
v = Vector.multiplyScalar(v, -1);
vx = v.x;
vy = v.y;
_dodge_fsm = 3;
}
}
}
function draw() {
_clip._x = x;
_clip._y = _transformY(y);
}
function canDodge() {
return(false);
}
function isCloaked() {
return(false);
}
function dodge(shot) {
if ((!_swimmingAway) && (!_isDodging)) {
v.x = x - shot.x;
v.y = y - shot.y;
var _local3 = Vector.crossProductMagnitude(shot.dir, v);
if (Math.abs(_local3) < (2 * shot.__get__radius())) {
var _local4 = v.__get__length() / shot.v.__get__length();
if (_local4 < (DODGE_TIME / 1000)) {
_velocityCache.x = vx;
_velocityCache.y = vy;
if (_local3 > 0) {
v.x = -shot.vy;
v.y = shot.vx;
} else {
v.x = shot.vy;
v.y = -shot.vx;
}
v = Vector.normalize(v);
v = Vector.multiplyScalar(v, 425);
vx = v.x;
vy = v.y;
_dodge_fsm = 1;
_dodge_t0 = getTimer();
_isDodging = true;
}
}
}
}
function takeSpecificDamage(damage, doSound) {
_doDamage(damage, doSound);
}
function takeDamage(shot) {
_doDamage(shot.__get__damage(), true);
if (shot.__get__powered()) {
var _local2 = new Vector(shot.vx, shot.vy);
_local2 = Vector.normalize(_local2);
_local2 = Vector.multiplyScalar(_local2, 5);
x = x + _local2.x;
y = y + _local2.y;
}
}
function _doDamage(d, doSound) {
_currentHP = _currentHP - d;
if (_currentHP <= 0) {
_currentHP = 0;
} else if (doSound) {
main.SM.instance().playSound("sfx_squark1", 50);
}
_clip.energy_mc._xscale = (100 * _currentHP) / _maxHP;
}
function isDead() {
return(_currentHP <= 0);
}
function isSwimmingAway() {
return(_swimmingAway);
}
function swimAway() {
if (!_swimmingAway) {
_isDodging = false;
_dodge_fsm = 0;
_clip.gotoAndStop("swim_away");
_swimToX = (x + 100) + Math.floor(100 * Math.random());
_swimToY = ((y > (_bounds._height / 2)) ? (_bounds._height + 50) : -50);
var _local4 = _swimToX - x;
var _local3 = _swimToY - y;
var _local2 = new Vector(_local4, _local3);
_local2 = Vector.normalize(_local2);
_local2 = Vector.multiplyScalar(_local2, 300);
vx = _local2.x;
vy = _local2.y;
main.SM.instance().playSound("sfx_squark3", 50);
_swimAway_t0 = getTimer();
_swimmingAway = true;
}
}
static function addToList(enemy) {
if (first == null) {
first = enemy;
} else {
var _local1 = first;
while (_local1.next != null) {
_local1 = _local1.next;
}
_local1.next = enemy;
}
}
static function removeFromList(enemy) {
if (first != null) {
if (first == enemy) {
if (first.next != null) {
first = first.next;
} else {
first = null;
}
} else {
var _local2 = first;
var _local1 = first.next;
while (_local1 != null) {
if (_local1 == enemy) {
_local2.next = enemy.next;
break;
}
_local2 = _local1;
_local1 = _local1.next;
}
}
}
}
static function numberOfEnemies() {
var _local1 = first;
var _local2 = ((_local1 == null) ? 0 : 1);
while (_local1.next != null) {
_local1 = _local1.next;
_local2++;
}
return(_local2);
}
function _fire() {
_shot_t0 = getTimer();
var _local2 = {};
_local2.type = EVENT_FIRE_SHOT;
_local2.target = this;
_local2.x = x;
_local2.y = y - 20;
_local2.vx = -_shotSpeed;
_local2.vy = 0;
_local2.damage = _damage;
dispatchEvent(_local2);
}
function fullHitTest(clip) {
var _local9 = false;
var _local2 = _clip.asset_mc;
var _local11 = _local2._width / 2;
var _local8 = _local2._height / 2;
var _local10 = {x:0, y:0};
var _local7 = {x:_local11, y:0};
var _local6 = {x:-_local11, y:0};
var _local5 = {x:0, y:_local8};
var _local3 = {x:0, y:-_local8};
_local2.localToGlobal(_local7);
_local2.localToGlobal(_local6);
_local2.localToGlobal(_local5);
_local2.localToGlobal(_local3);
if ((((clip.hitTest(_local10.x, _local10.y, true) || (clip.hitTest(_local7.x, _local7.y, true))) || (clip.hitTest(_local6.x, _local6.y, true))) || (clip.hitTest(_local5.x, _local5.y, true))) || (clip.hitTest(_local3.x, _local3.y, true))) {
_local9 = true;
}
return(_local9);
}
function get hitarea() {
return(_clip.hitarea_mc);
}
function dispose() {
_clip.removeMovieClip();
}
function dispatchEvent(eventObject) {
}
function addEventListener(event, listener) {
}
function removeEventListener(event, listener) {
}
static var EVENT_FIRE_SHOT = "onFireShot";
static var DODGE_TIME = 500;
var _clip = null;
var _wallX = 0;
var _maxHP = 0;
var _currentHP = 0;
var _damage = 0;
var _range = 0;
var _reloadTime = 0;
var _shotSpeed = 0;
var _speed = 0;
var _shot_t0 = -1;
var _dodge_t0 = -1;
var _closingToRange = true;
var _swimmingAway = false;
var _isDodging = false;
var _velocityCache = null;
var _dodge_fsm = 0;
var _swimToX = 0;
var _swimToY = 0;
var _swimAway_t0 = 0;
static var first = null;
var next = null;
}
Symbol 984 MovieClip [__Packages.main.Shot] Frame 0
class main.Shot extends main.ContainedObject
{
var x, y, _t0, _f0, vx, vy, _bounds, _transformY, v;
function Shot (parent, bounds, symbol, depth, x, y, powerFactor, damage, originator) {
super(bounds);
var _local3 = ("shot" + String(depth)) + "_mc";
_clip = parent.attachMovie(symbol, _local3, depth, {_alpha:0});
_clip.cacheAsBitmap = true;
_clip.hitarea_mc._visible = false;
this.x = x;
this.y = y;
_powerFactor = powerFactor;
_damage = damage;
_originator = originator;
_t0 = getTimer();
draw();
}
function setScale(damage) {
_clip._xscale = (_clip._yscale = 100 + (25 * (damage - 1)));
}
function increaseScale(scale) {
var _local2 = _clip._xscale;
_clip._xscale = (_clip._yscale = _local2 + scale);
}
function step() {
if (_imploding) {
return(undefined);
}
var _local3 = getTimer();
if (_f0 >= 0) {
var _local4 = (_local3 - _f0) / 1000;
var _local6 = vx * _local4;
var _local5 = vy * _local4;
x = x + _local6;
y = y + _local5;
if ((_local3 - _t0) < 250) {
_clip._alpha = (100 * (_local3 - _t0)) / 150;
} else {
_clip._alpha = 100;
}
}
var _local2 = 50;
if ((((y < (-_local2)) || (y > (_bounds._height + _local2))) || (x < (-_local2))) || (x > (_bounds._width + _local2))) {
_clip.removeMovieClip();
main.Game.instance().removeShot(this);
}
_f0 = _local3;
}
function draw() {
_clip._x = x;
_clip._y = _transformY(y);
}
static function addToList(shot) {
if (first == null) {
first = shot;
} else {
var _local1 = first;
while (_local1.next != null) {
_local1 = _local1.next;
}
_local1.next = shot;
}
}
static function removeFromList(shot) {
if (first != null) {
if (first == shot) {
if (first.next != null) {
first = first.next;
} else {
first = null;
}
} else {
var _local2 = first;
var _local1 = first.next;
while (_local1 != null) {
if (_local1 == shot) {
_local2.next = shot.next;
break;
}
_local2 = _local1;
_local1 = _local1.next;
}
}
}
}
static function numberOfShots() {
var _local1 = first;
var _local2 = ((_local1 == null) ? 0 : 1);
while (_local1.next != null) {
_local1 = _local1.next;
_local2++;
}
return(_local2);
}
function get radius() {
return(_clip._width / 2);
}
function hitTest(clip) {
return((!_imploding) && (_clip.hitarea_mc.hitTest(clip)));
}
function get damage() {
var _local2 = _damage + ((FULL_POWER_MULTIPLIER * _damage) * _powerFactor);
return(_local2);
}
function get originator() {
return(_originator);
}
function get powered() {
return(_powerFactor > 0);
}
function get fullPower() {
return(_powerFactor == 1);
}
function setVelocityVector() {
v.x = vx;
v.y = vy;
dir = Vector.normalize(v);
var _local2 = Math.atan2(v.y, v.x);
_clip._rotation = (-180 * _local2) / Math.PI;
}
function implode() {
_imploding = true;
_clip = _clip._parent.attachMovie("implosion", "implosion_mc", _clip.getDepth());
_clip.cacheAsBitmap = true;
main.SM.instance().playSound("sfx_squid_impact");
_clip.removeMe = EventDelegate.create(this, _removeImplosion);
}
function _removeImplosion() {
if (Math.floor(Math.random() * 3) == 0) {
_clip = _clip._parent.attachMovie("rockfall", "rockfall_mc", _clip.getDepth());
_clip.cacheAsBitmap = true;
_clip.removeMe = EventDelegate.create(this, _removeMe);
} else {
_removeMe();
}
}
function _removeMe() {
removeFromList(this);
dispose();
}
function dispose() {
_clip.removeMovieClip();
}
static var FULL_POWER_MULTIPLIER = 2;
var _clip = null;
var _powerFactor = 0;
var _damage = 0;
var _originator = null;
var dir = null;
static var first = null;
var next = null;
var _imploding = false;
}
Symbol 985 MovieClip [__Packages.main.MachineGun] Frame 0
class main.MachineGun
{
function MachineGun () {
_t0 = getTimer();
}
function beginFiring() {
if (_interval == -1) {
_interval = setInterval(this, "_fireShot", FREQUENCY);
}
}
function stopFiring() {
_killInterval();
}
function _fireShot() {
main.Game.instance().fireMachineGunShot();
}
function step() {
if ((getTimer() - _t0) > MACHINE_GUN_TIME) {
main.Game.instance().removeMachineGun();
}
}
function extendTime() {
_t0 = getTimer();
}
function dispose() {
_killInterval();
}
function _killInterval() {
if (_interval >= 0) {
clearInterval(_interval);
_interval = -1;
}
}
static var FREQUENCY = 130;
static var MACHINE_GUN_TIME = 10000;
var _interval = -1;
var _t0 = -1;
}
Symbol 986 MovieClip [__Packages.main.CrabCollector] Frame 0
class main.CrabCollector extends main.ContainedObject
{
var x, y, _f0, vx, vy, v, _transformY;
function CrabCollector (parent, bounds, depth, jaller) {
super(bounds);
_clip = parent.attachMovie("crab_collector", "ccollector_mc", depth);
_jaller = jaller;
x = _jaller.x;
y = _jaller.y - JALLER_OFFSET;
_collecting = [];
draw();
}
function collect(powerup) {
_collecting.push(powerup);
}
function step() {
var _local3 = getTimer();
if (_f0 >= 0) {
var _local2 = (_local3 - _f0) / 1000;
var _local5 = vx * _local2;
var _local4 = vy * _local2;
x = x + _local5;
y = y + _local4;
}
switch (_fsm) {
case 0 :
if (!_checkStartCollect()) {
y = _jaller.y - JALLER_OFFSET;
}
break;
case 1 :
_checkReachedPowerup();
break;
case 2 :
_checkReachedDest();
break;
}
_f0 = _local3;
}
function _checkStartCollect() {
if ((_collecting.length > 0) && ((getTimer() - _rest_t0) > 1000)) {
v.x = (_collecting[0].x - x) - 35;
v.y = (_collecting[0].y - y) + 25;
var _local2 = v.__get__length();
v = Vector.normalize(v);
v = Vector.multiplyScalar(v, SPEED_OUTGOING);
vx = v.x;
vy = v.y;
_fsm = 1;
_outTime = (1000 * _local2) / SPEED_OUTGOING;
if (_outTime > 5000) {
_outTime = 5000;
}
_t0 = getTimer();
return(true);
}
return(false);
}
function _checkReachedPowerup() {
if ((getTimer() - _t0) > _outTime) {
v.x = _jaller.x - x;
v.y = (_jaller.y - y) - JALLER_OFFSET;
var _local2 = v.__get__length();
v = Vector.normalize(v);
v = Vector.multiplyScalar(v, SPEED_INCOMING);
vx = v.x;
vy = v.y;
_fsm = 2;
_returnTime = (1000 * _local2) / SPEED_INCOMING;
if (_returnTime > 5000) {
_returnTime = 5000;
}
_t0 = getTimer();
}
}
function _checkReachedDest() {
if ((getTimer() - _t0) > _returnTime) {
_collecting[0].tweenOut();
main.Game.instance().activatePowerup(_collecting[0]);
_collecting.shift();
x = _jaller.x;
y = _jaller.y - JALLER_OFFSET;
vx = 0;
vy = 0;
_rest_t0 = getTimer();
_fsm = 0;
} else {
_collecting[0].x = (x + 35) + (_collecting[0].width / 2);
_collecting[0].y = (y - 10) - (_collecting[0].height / 2);
}
}
function draw() {
_clip._x = x;
_clip._y = _transformY(y);
}
function resetTimer() {
_f0 = -1;
}
function dispose() {
_clip.removeMovieClip();
}
static var SPEED_OUTGOING = 150;
static var SPEED_INCOMING = 120;
static var JALLER_OFFSET = 50;
var _clip = null;
var _fsm = 0;
var _collecting = null;
var _jaller = null;
var _rest_t0 = 0;
var _t0 = 0;
var _outTime = 0;
var _returnTime = 0;
}
Symbol 987 MovieClip [__Packages.main.Powerup] Frame 0
class main.Powerup extends main.ContainedObject
{
var x, y, _f0, _transformY;
function Powerup (parent, bounds, depth, x, y, type) {
super(bounds);
_clip = parent.attachMovie(SYMBOL[type], ("powerup" + String(depth)) + "_mc", depth, {_xscale:0, _yscale:0});
this.x = x;
this.y = y;
_type = type;
_t0 = getTimer();
draw();
}
static function addToList(powerup) {
if (first == null) {
first = powerup;
} else {
var _local1 = first;
while (_local1.next != null) {
_local1 = _local1.next;
}
_local1.next = powerup;
}
}
static function removeFromList(powerup) {
if (first != null) {
if (first == powerup) {
if (first.next != null) {
first = first.next;
} else {
first = null;
}
} else {
var _local2 = first;
var _local1 = first.next;
while (_local1 != null) {
if (_local1 == powerup) {
_local2.next = powerup.next;
break;
}
_local2 = _local1;
_local1 = _local1.next;
}
}
}
}
static function numberOfPowerups() {
var _local1 = first;
var _local2 = ((_local1 == null) ? 0 : 1);
while (_local1.next != null) {
_local1 = _local1.next;
_local2++;
}
return(_local2);
}
function step() {
var _local3 = getTimer();
if (_f0 >= 0) {
var _local2 = _local3 - _t0;
if (_tweeningIn) {
if (_local2 > TWEEN_PERIOD) {
_clip._xscale = (_clip._yscale = 100);
_tweeningIn = false;
} else {
_clip._xscale = (_clip._yscale = com.robertpenner.easing.Back.easeOut(_local2, 0, 100, TWEEN_PERIOD));
}
}
if (_tweeningOut) {
if (_local2 > TWEEN_PERIOD) {
_clip._xscale = (_clip._yscale = 0);
_tweeningOut = false;
_clip.removeMovieClip();
main.Game.instance().removePowerup(this);
} else {
_clip._alpha = com.robertpenner.easing.Quart.easeOut(_local2, 100, -100, TWEEN_PERIOD);
_clip._xscale = (_clip._yscale = com.robertpenner.easing.Quart.easeOut(_local2, 100, 200, TWEEN_PERIOD));
}
}
}
_f0 = _local3;
}
function tweenOut() {
if (!_tweeningOut) {
_t0 = getTimer();
_tweeningOut = true;
}
}
function draw() {
_clip._x = x;
_clip._y = _transformY(y);
}
function get width() {
return(40);
}
function get height() {
return(40);
}
function get type() {
return(_type);
}
function hitTest(clip) {
return(_clip.hitTest(clip));
}
function dispose() {
_clip.removeMovieClip();
}
static var TWEEN_PERIOD = 400;
static var SYMBOL = ["powerup_beam", "powerup_speed", "powerup_damage", "powerup_recharge", "powerup_regen", "powerup_cordak", "powerup_mgun"];
static var BEAM = 0;
static var SPEED = 1;
static var DAMAGE = 2;
static var RECHARGE = 3;
static var REGEN = 4;
static var CORDAK = 5;
static var MGUN = 6;
var _clip = null;
var _t0 = -1;
var _type = -1;
var _tweeningIn = true;
var _tweeningOut = false;
static var first = null;
var next = null;
}
Symbol 988 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 989 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 990 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 991 MovieClip [__Packages.main.EnemyFactory] Frame 0
class main.EnemyFactory
{
function EnemyFactory () {
mx.events.EventDispatcher.initialize(this);
}
static function instance() {
if (_instance == null) {
_instance = new main.EnemyFactory();
}
return(_instance);
}
function switchOn() {
if (!_isOn) {
_killInterval();
_interval = setInterval(this, "_create", _getTimeTilNextSpawn());
_isOn = true;
}
}
function _getTimeTilNextSpawn() {
var _local2 = 300 * (10 - main.Game.instance().__get__level());
if (_local2 < 0) {
_local2 = 0;
}
var _local1 = _local2 * Math.random();
if (_local1 < 0) {
_local1 = 0;
}
_local1 = Math.round(_local1);
return(_local1);
}
function _getMaxEnemies() {
return(3 + Math.floor(main.Game.instance().__get__level() / 2));
}
function switchOff() {
if (_isOn) {
_killInterval();
_isOn = false;
}
}
function _create() {
if (main.EnemyBase.numberOfEnemies() < _getMaxEnemies()) {
var _local3 = _spawnEnemy();
dispatchEvent({target:this, type:EVENT_ENEMY_SPAWNED, enemy:_local3});
}
_killInterval();
_interval = setInterval(this, "_create", _getTimeTilNextSpawn());
}
function _spawnEnemy() {
var _local6 = -1;
var _local5 = SPAWN_PROBABILITY[main.Game.instance().__get__level()];
var _local9 = Math.random();
var _local3 = 0;
var _local2 = 0;
while (_local2 < _local5.length) {
_local3 = _local3 + _local5[_local2];
if (_local9 < _local3) {
_local6 = _local2;
break;
}
_local2++;
}
var _local4 = main.Game.instance().__get__clip();
var _local7 = null;
var _local8 = "spawning \"";
switch (_local6) {
case ENEMY_SIMPLE :
_local8 = _local8 + "simple";
_local7 = new main.EnemySimple(_local4.container_mc, _local4.bounds_mc, main.Game.instance().getNextDepth(main.Depths.ENEMIES), _local4.wall_mc._x);
break;
case ENEMY_MOVE_AND_FIRE :
_local8 = _local8 + "move and fire";
_local7 = new main.EnemyMoveFire(_local4.container_mc, _local4.bounds_mc, main.Game.instance().getNextDepth(main.Depths.ENEMIES), _local4.wall_mc._x);
break;
case ENEMY_DODGE :
_local8 = _local8 + "dodge";
_local7 = new main.EnemyDodge(_local4.container_mc, _local4.bounds_mc, main.Game.instance().getNextDepth(main.Depths.ENEMIES), _local4.wall_mc._x);
break;
case ENEMY_NINJA :
_local8 = _local8 + "ninja";
_local7 = new main.EnemyNinja(_local4.container_mc, _local4.bounds_mc, main.Game.instance().getNextDepth(main.Depths.ENEMIES), _local4.wall_mc._x);
break;
default :
trace("$$$ enemy factory could not create an enemy with unknown id " + _local6);
_local8 = _local8 + "ERROR!";
}
if (_local7 != null) {
_setStats(_local7, _local6);
}
_local8 = _local8 + "\" enemy ...";
return(_local7);
}
function _setStats(enemy, id) {
var _local1 = main.Game.instance().__get__level();
var _local2 = 0;
var _local4 = _local1 / 4;
var _local6 = (150 * Math.random()) - 100;
var _local5 = Math.floor(200 * Math.random()) - (25 * _local1);
var _local7 = 750;
var _local3 = 13 * _local1;
switch (id) {
case ENEMY_SIMPLE :
_local2 = _local2 + (40 + (5 * _local1));
_local4 = _local4 + 0.4;
_local6 = _local6 + 150;
_local5 = _local5 + 1000;
_local3 = _local3 + (40 + (40 * Math.random()));
break;
case ENEMY_MOVE_AND_FIRE :
_local2 = _local2 + (55 + (5 * _local1));
_local4 = _local4 + 0.7;
_local6 = _local6 + 400;
_local5 = _local5 + 1200;
_local3 = _local3 + (20 + (20 * Math.random()));
break;
case ENEMY_DODGE :
_local2 = _local2 + (40 + (5 * _local1));
_local4 = _local4 + 0.5;
_local6 = _local6 + 150;
_local5 = _local5 + 800;
_local3 = _local3 + (45 + (45 * Math.random()));
break;
case ENEMY_NINJA :
_local2 = _local2 + (60 + (5 * _local1));
_local4 = _local4 + 0.8;
_local6 = _local6 + 250;
_local5 = _local5 + 3000;
_local3 = _local3 + (50 + (50 * Math.random()));
break;
}
enemy.setStats(_local2, _local4, _local6, _local5, _local7, _local3);
}
function _killInterval() {
if (_interval >= 0) {
clearInterval(_interval);
_interval = -1;
}
}
function dispatchEvent(eventObject) {
}
function addEventListener(event, listener) {
}
function removeEventListener(event, listener) {
}
static var _instance = null;
static var EVENT_ENEMY_SPAWNED = "onEnemySpawned";
static var ENEMY_SIMPLE = 0;
static var ENEMY_MOVE_AND_FIRE = 1;
static var ENEMY_DODGE = 2;
static var ENEMY_NINJA = 3;
static var SPAWN_PROBABILITY = [[1, 0, 0, 0], [0.8, 0, 0.2, 0], [0.7, 0.3, 0, 0], [0.4, 0.3, 0.3, 0], [0.2, 0.3, 0.3, 0.2], [0.15, 0.2, 0.2, 0.45]];
var _isOn = false;
var _interval = -1;
}
Symbol 992 MovieClip [__Packages.main.EnemySimple] Frame 0
class main.EnemySimple extends main.EnemyBase
{
var _f0, vx, vy, _swimmingAway, x, y, _swimToX, _swimToY, _swimAway_t0, _clip, _isDodging, _shot_t0, _reloadTime, _closingToRange, _fire, _range, _wallX;
function EnemySimple (parent, bounds, depth, wallX) {
super(parent, bounds, depth, wallX, "enemy_simple");
}
function step() {
var _local5 = getTimer();
var _local7 = (_local5 - _f0) / 1000;
var _local4 = vx * _local7;
var _local6 = vy * _local7;
if (_swimmingAway) {
x = x + _local4;
y = y + _local6;
var _local3 = 5;
if (((((x > (_swimToX - _local3)) && (x < (_swimToX + _local3))) && (y > (_swimToY - _local3))) && (y < (_swimToY + _local3))) || ((getTimer() - _swimAway_t0) > 5000)) {
_clip.removeMovieClip();
main.Game.instance().removeEnemy(this);
}
} else if (_isDodging) {
x = x + _local4;
y = y + _local6;
} else {
if ((_shot_t0 >= 0) && ((_local5 - _shot_t0) > _reloadTime)) {
_shot_t0 = -1;
}
if (!_closingToRange) {
if (_shot_t0 == -1) {
_fire();
}
} else if ((_f0 >= 0) && (_closingToRange)) {
x = x + _local4;
if ((x - _wallX) <= _range) {
_closingToRange = false;
}
}
}
super.step();
_f0 = _local5;
}
}
Symbol 993 MovieClip [__Packages.main.EnemyMoveFire] Frame 0
class main.EnemyMoveFire extends main.EnemyBase
{
var _f0, vx, vy, _swimmingAway, x, y, _swimToX, _swimToY, _swimAway_t0, _clip, _isDodging, _shot_t0, _reloadTime, _range, _fire, _closingToRange, _wallX;
function EnemyMoveFire (parent, bounds, depth, wallX) {
super(parent, bounds, depth, wallX, "enemy_movefire");
}
function step() {
var _local5 = getTimer();
var _local7 = (_local5 - _f0) / 1000;
var _local4 = vx * _local7;
var _local6 = vy * _local7;
if (_swimmingAway) {
x = x + _local4;
y = y + _local6;
var _local3 = 5;
if (((((x > (_swimToX - _local3)) && (x < (_swimToX + _local3))) && (y > (_swimToY - _local3))) && (y < (_swimToY + _local3))) || ((getTimer() - _swimAway_t0) > 5000)) {
_clip.removeMovieClip();
main.Game.instance().removeEnemy(this);
}
} else if (_isDodging) {
x = x + _local4;
y = y + _local6;
} else {
if ((_shot_t0 >= 0) && ((_local5 - _shot_t0) > _reloadTime)) {
_shot_t0 = -1;
}
if (x <= _range) {
if (_shot_t0 == -1) {
_fire();
}
}
if ((_f0 >= 0) && (_closingToRange)) {
if ((x - _wallX) > 100) {
x = x + _local4;
} else {
_closingToRange = false;
}
}
}
super.step();
_f0 = _local5;
}
}
Symbol 994 MovieClip [__Packages.main.EnemyDodge] Frame 0
class main.EnemyDodge extends main.EnemyBase
{
var _f0, vx, vy, _swimmingAway, x, y, _swimToX, _swimToY, _swimAway_t0, _clip, _isDodging, _shot_t0, _reloadTime, _closingToRange, _fire, _range, _wallX, _dodge_t0;
function EnemyDodge (parent, bounds, depth, wallX) {
super(parent, bounds, depth, wallX, "enemy_dodge");
}
function step() {
var _local5 = getTimer();
var _local7 = (_local5 - _f0) / 1000;
var _local4 = vx * _local7;
var _local6 = vy * _local7;
if (_swimmingAway) {
x = x + _local4;
y = y + _local6;
var _local3 = 5;
if (((((x > (_swimToX - _local3)) && (x < (_swimToX + _local3))) && (y > (_swimToY - _local3))) && (y < (_swimToY + _local3))) || ((getTimer() - _swimAway_t0) > 5000)) {
_clip.removeMovieClip();
main.Game.instance().removeEnemy(this);
}
} else if (_isDodging) {
x = x + _local4;
y = y + _local6;
} else {
if ((_shot_t0 >= 0) && ((_local5 - _shot_t0) > _reloadTime)) {
_shot_t0 = -1;
}
if (!_closingToRange) {
if (_shot_t0 == -1) {
_fire();
}
} else if ((_f0 >= 0) && (_closingToRange)) {
x = x + _local4;
if ((x - _wallX) <= _range) {
_closingToRange = false;
}
}
}
super.step();
_f0 = _local5;
}
function canDodge() {
var _local2 = false;
if (_dodge_t0 == -1) {
_local2 = true;
} else {
var _local4 = getTimer();
var _local3 = _local4 - _dodge_t0;
_local2 = ((!_swimmingAway) && (!_isDodging)) && (_local3 > 2500);
}
return(_local2);
}
}
Symbol 995 MovieClip [__Packages.main.EnemyNinja] Frame 0
class main.EnemyNinja extends main.EnemyBase
{
var _clip, _f0, vx, vy, _fire, _swimmingAway, x, y, _swimToX, _swimToY, _swimAway_t0, _isDodging, _shot_t0, _reloadTime, _closingToRange, _range, _wallX;
function EnemyNinja (parent, bounds, depth, wallX) {
super(parent, bounds, depth, wallX, "enemy_ninja");
_clip._alpha = MIN_ALPHA;
}
function step() {
var _local3 = getTimer();
var _local7 = (_local3 - _f0) / 1000;
var _local5 = vx * _local7;
var _local6 = vy * _local7;
if (_stealth_fsm == 1) {
if ((_local3 - _stealth_t0) > UNCLOAK_TIME) {
_stealth_fsm = 2;
_stealth_t0 = getTimer();
_clip._alpha = FULL_ALPHA;
} else {
_clip._alpha = MIN_ALPHA + (((FULL_ALPHA - MIN_ALPHA) * (_local3 - _stealth_t0)) / UNCLOAK_TIME);
}
} else if (_stealth_fsm == 2) {
if ((_local3 - _stealth_t0) > (VISIBLE_TIME / 2)) {
_stealth_fsm = 3;
_stealth_t0 = getTimer();
_fire();
}
} else if (_stealth_fsm == 3) {
if ((_local3 - _stealth_t0) > (VISIBLE_TIME / 2)) {
_stealth_fsm = 4;
_stealth_t0 = getTimer();
}
} else if (_stealth_fsm == 4) {
if ((_local3 - _stealth_t0) > UNCLOAK_TIME) {
_stealth_fsm = 0;
_clip._alpha = MIN_ALPHA;
} else {
_clip._alpha = FULL_ALPHA - (((FULL_ALPHA - MIN_ALPHA) * (_local3 - _stealth_t0)) / UNCLOAK_TIME);
}
}
if (_swimmingAway) {
x = x + _local5;
y = y + _local6;
var _local4 = 5;
if (((((x > (_swimToX - _local4)) && (x < (_swimToX + _local4))) && (y > (_swimToY - _local4))) && (y < (_swimToY + _local4))) || ((getTimer() - _swimAway_t0) > 5000)) {
_clip.removeMovieClip();
main.Game.instance().removeEnemy(this);
}
} else if (_isDodging) {
x = x + _local5;
y = y + _local6;
} else {
if ((_shot_t0 >= 0) && ((_local3 - _shot_t0) > _reloadTime)) {
_shot_t0 = -1;
}
if (!_closingToRange) {
if ((_stealth_fsm == 0) && (_shot_t0 == -1)) {
_stealth_t0 = getTimer();
_stealth_fsm = 1;
}
} else if ((_f0 >= 0) && (_closingToRange)) {
x = x + _local5;
if ((x - _wallX) <= _range) {
_closingToRange = false;
}
}
}
super.step();
_f0 = _local3;
}
function swimAway() {
if (!_swimmingAway) {
_stealth_fsm = 5;
_clip._alpha = FULL_ALPHA;
super.swimAway();
}
}
function isCloaked() {
return(_stealth_fsm == 0);
}
static var FULL_ALPHA = 100;
static var MIN_ALPHA = 15;
static var UNCLOAK_TIME = 500;
static var VISIBLE_TIME = 750;
var _stealth_fsm = 0;
var _stealth_t0 = 0;
}
Symbol 996 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() {
_consecutiveHits = 0;
_multiplierBonus = 0;
_swimAway = 0;
_wallHit = 0;
}
function registerMiss() {
_consecutiveHits = 0;
}
function registerHit() {
if (_consecutiveHits < 6) {
_consecutiveHits++;
}
_multiplierBonus = _multiplierBonus + (100 * (_consecutiveHits - 1));
}
function registerWallHit() {
_wallHit++;
}
function registerSwimAway() {
_swimAway++;
}
function get swimAwayBonus() {
return(300 * _swimAway);
}
function get wallHitBonus() {
return(-100 * _wallHit);
}
function get accuracyBonus() {
return(_multiplierBonus);
}
function get score() {
return(_score);
}
function set score(s) {
_score = s;
//return(score);
}
static var _instance = null;
var _consecutiveHits = 0;
var _multiplierBonus = 0;
var _swimAway = 0;
var _wallHit = 0;
var _score = 0;
}
Symbol 997 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 998 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 999 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 696 MovieClip Frame 1
stop();
Symbol 699 MovieClip Frame 1
gotoAndPlay (46);
Symbol 699 MovieClip Frame 46
setupPlayAndHighScoreButtons(false);
Symbol 699 MovieClip Frame 100
setupAll();
stop();
Symbol 699 MovieClip Frame 126
nextAction();
stop();
Symbol 797 MovieClip Frame 462
main.SM.instance().playSound("sfx_squid_fire");
Symbol 797 MovieClip Frame 501
main.SM.instance().playSound("sfx_squid_impact");
Symbol 797 MovieClip Frame 644
main.SM.instance().playSound("sfx_power_fireball");
Symbol 806 MovieClip Frame 15
stop();
Symbol 806 MovieClip Frame 75
stop();
Symbol 807 MovieClip Frame 1
Key.addListener(this);
onKeyDown = function () {
if (Key.getCode() == 32) {
initGame();
}
};
skip_mc.skip_btn.onRelease = function () {
initGame();
};
Symbol 807 MovieClip Frame 670
skip_mc.gotoAndPlay("out");
Symbol 807 MovieClip Frame 693
Key.removeListener(this);
initGame();
stop();
Symbol 817 MovieClip Frame 1
stop();
Symbol 817 MovieClip Frame 13
stop();
Symbol 817 MovieClip Frame 38
stop();
Symbol 817 MovieClip Frame 61
stop();
Symbol 817 MovieClip Frame 86
stop();
Symbol 817 MovieClip Frame 114
stop();
Symbol 817 MovieClip Frame 140
stop();
Symbol 826 MovieClip Frame 1
stop();
Symbol 854 MovieClip Frame 1
stop();
Symbol 915 MovieClip Frame 1
stop();
Symbol 926 MovieClip Frame 1
stop();
Symbol 926 MovieClip Frame 15
openPanel();
stop();
Symbol 926 MovieClip Frame 16
stop();
Symbol 926 MovieClip Frame 26
stop();
Symbol 926 MovieClip Frame 36
stop();
Symbol 926 MovieClip Frame 46
stop();
Symbol 926 MovieClip Frame 71
stop();
closePanel();
Symbol 947 MovieClip Frame 1
stop();
Symbol 950 MovieClip Frame 1
stop();
Symbol 950 MovieClip Frame 17
gotoAndStop (1);
Symbol 961 MovieClip Frame 45
doFirstAction();
stop();
Symbol 961 MovieClip Frame 99
doLastAction();
stop();
Symbol 962 MovieClip Frame 1
main.Main.getInstance().init(this);
stop();