Frame 1
Stage.showMenu = false;
_focusrect = false;
Object.prototype.gameTimeline = this;
_global.ipb_get_gname = function () {
var _local4 = _root._url;
var _local5 = "";
var _local3 = "";
var _local6 = _local4.lastIndexOf("\\") + 1;
if ((_local6 == -1) || (_local6 == 0)) {
_local6 = _local4.lastIndexOf("/") + 1;
}
var _local2 = _local6;
var _local7 = String(_local4).length;
while (_local2 < String(_local4).length) {
_local3 = _local4.charAt(_local2);
if (_local3 == ".") {
break;
}
_local5 = _local5 + _local3;
_local2++;
}
return(_local5);
};
ipb_gname = _global.ipb_get_gname();
xx = new LoadVars();
xx.onLoad = function (success) {
if (success) {
_global.ipb_scoreVar = this.scoreVar;
}
};
fname = ((("arcade/gamedata/" + ipb_gname) + "/") + ipb_gname) + ".txt";
xx.load(fname);
Instance of Symbol 34 MovieClip "mcLoading" in Frame 2
onClipEvent (load) {
function preloadGame() {
var _local2 = Math.floor((_parent.getBytesLoaded() / _parent.getBytesTotal()) * 100);
if (_local2 != 100) {
_parent.mcState.txtPercent.text = _local2 + "%";
_parent.mcState.mcLoadBar.gotoAndStop(_local2);
} else {
_parent.mcState.txtPercent.text = "100%";
_parent.mcState.mcLoadBar.gotoAndStop(100);
nDelay++;
if (nDelay > DELAY_TODO) {
_parent.gotoAndStop("start");
}
}
}
_visible = false;
_parent.stop();
var DELAY_TODO = 4;
var nDelay = 0;
}
onClipEvent (enterFrame) {
preloadGame();
}
Frame 10
GC = new HighScore.BaseGameController(this);
GC.start();
new MainCTRL(this);
Frame 30
GC.title();
stop();
_global.HS_Score = 0;
_global.HS_Level = 1;
Frame 40
GC.instructions();
Frame 50
GC.play();
Frame 60
GC.play();
play();
Frame 61
GC.levelStart(_global.HS_Level, _global.HS_Score);
play();
Frame 62
stop();
Frame 70
GC.levelComplete();
Frame 80
GC.win(_global.HS_Level, _global.HS_Score);
Frame 90
GC.gameOver(_global.HS_Level, _global.HS_Score);
stop();
Symbol 1115 MovieClip Frame 1
if (yy.savescore == 1) {
if (ipb_score == undefined) {
ipb_score = eval (_global.ipb_scoreVar);
}
xx = new LoadVars();
xx.arcadegid = _root.ibpro_gameid;
xx.gscore = ipb_score;
xx.gname = _global.ipb_get_gname();
xx.enscore = (ipb_score * yy.randchar) ^ yy.randchar2;
xx.send("index.php?autocom=arcade&do=savescore", "_self", "POST");
stop();
}
_global.ipbSend = function (ipb_score) {
_root._visible = false;
_root.enabled = false;
xx = new LoadVars();
yy = new LoadVars();
xx.sendAndLoad("index.php?autocom=arcade&do=verifyscore", yy, "POST");
};
Symbol 1089 MovieClip [__Packages.HighScore.BaseGameController] Frame 0
#initclip
#endinitclip
Symbol 1090 MovieClip [__Packages.HighScore.Timer] Frame 0
class HighScore.Timer
{
function Timer () {
startTime = getTimer();
}
function restartTimer() {
startTime = getTimer();
}
function milliseconds() {
return(getTimer() - startTime);
}
function seconds() {
return(getSeconds());
}
function getSeconds() {
return(Math.floor((getTimer() - startTime) / 1000));
}
function minutes() {
return(Math.floor(getSeconds() / 60));
}
function remaining(time_allowed) {
return(time_allowed - milliseconds());
}
function expire() {
startTime = -100000;
}
function display() {
var _local2;
var _local3;
_local2 = "00" + minutes();
_local2 = _local2.substr(_local2.length - 2, 2);
_local3 = "00" + seconds();
_local3 = _local3.substr(_local3.length - 2, 2);
return((_local2 + ":") + _local3);
}
function displayRemaining(time_allowed) {
var _local2;
var _local3;
var _local4 = time_allowed - milliseconds();
var _local5 = Math.floor(_local4 / 1000);
var _local6 = Math.floor(_local5 / 60);
if (_local4 >= 0) {
_local2 = "00" + _local6;
_local2 = _local2.substr(_local2.length - 2, 2);
_local3 = "00" + _local5;
_local3 = _local3.substr(_local3.length - 2, 2);
} else {
_local2 = "00";
_local3 = "00";
}
return((_local2 + ":") + _local3);
}
var startTime = 0;
}
Symbol 1091 MovieClip [__Packages.HighScore.FrameTimeManager] Frame 0
class HighScore.FrameTimeManager
{
static var frameTimeMilliseconds;
function FrameTimeManager () {
}
static function calculateFrameTime() {
frameTimeMilliseconds = frameTimeTimer.milliseconds();
frameTimeTimer.restartTimer();
}
static function getFrameMilliseconds() {
return(frameTimeMilliseconds);
}
static function getFrameSeconds() {
return(frameTimeMilliseconds / 1000);
}
static var frameTimeTimer = new HighScore.Timer();
}
Symbol 1092 MovieClip [__Packages.HighScore.BaseInputManager] Frame 0
class HighScore.BaseInputManager
{
static var keyMap, inputState;
function BaseInputManager () {
}
static function init() {
keyMap = new Array(NUM_STATES);
inputState = new Array(NUM_STATES);
keyMap[QUIT] = 81;
inputState[QUIT] = false;
initialized = true;
}
static function processInput() {
if (!initialized) {
init();
}
processKeyboardInput();
}
static function processKeyboardInput() {
inputState[QUIT] = Key.isDown(keyMap[QUIT]);
}
static function checkInputState(keyMapIndex) {
return(inputState[keyMapIndex]);
}
static function showInputState() {
}
static var QUIT = 0;
static var NUM_STATES = 1;
static var initialized = false;
}
Symbol 1093 MovieClip [__Packages.State] Frame 0
class State
{
var mcRef, sState, nStateTotalFrame;
function State (P_mcRef) {
mcRef = P_mcRef;
}
function doEnterFrame() {
this["do" + sState]();
}
function doUnPausableEnterFrame() {
}
function isStateComplete() {
var _local2 = false;
if (mcRef.mcState._currentframe >= nStateTotalFrame) {
_local2 = true;
}
return(_local2);
}
function pause() {
mcRef.mcState.stop();
}
function unPause() {
mcRef.mcState.play();
}
function setState(P_sState) {
if (sState != P_sState) {
unloadState(sState);
sState = P_sState;
mcRef.gotoAndStop(sState);
nStateTotalFrame = mcRef.mcState._totalframes;
loadState(sState);
}
}
function loadState() {
}
function unloadState() {
}
}
Symbol 1094 MovieClip [__Packages.MainCTRL] Frame 0
class MainCTRL extends State
{
static var oMainCTRL;
var mcRef, setState, sState, nPlayerLive, __get__SetPlayerLive, STAGE_WIDTH, STAGE_HEIGHT, STAGE_FPS, TRANSITION_DEPTH, BORDER_DEPTH, sndPackaging, sndInGame;
function MainCTRL (P_mcRef) {
super(P_mcRef);
initMainVar();
oMainCTRL = this;
Library.Sound.SoundManager.doInit(mcRef.mcSound);
Library.Sound.SoundManager.setCategoryVolume("btn", 70);
Library.Sound.SoundManager.setCategoryVolume("music", 25);
Library.Sound.SoundManager.setCategoryVolume("sfx", 100);
mcRef.gotoAndStop("Loaded");
setState("Loaded");
}
static function get Instance() {
return(oMainCTRL);
}
function get Mc() {
return(mcRef);
}
function get CurrentState() {
return(sState);
}
function get PlayerLive() {
return(nPlayerLive);
}
function set SetPlayerLive(P_nLive) {
nPlayerLive = P_nLive;
//return(__get__SetPlayerLive());
}
function initMainVar() {
STAGE_WIDTH = 500;
STAGE_HEIGHT = 375;
STAGE_FPS = 35;
TRANSITION_DEPTH = 1000000 /* 0x0F4240 */;
BORDER_DEPTH = 1000001 /* 0x0F4241 */;
nPlayerLive = 3;
}
function loadState(P_sState) {
switch (P_sState) {
case "Loaded" :
mcRef.mcTransition.swapDepths(TRANSITION_DEPTH);
mcRef.mcBorder.swapDepths(BORDER_DEPTH);
new Transition(mcRef.mcTransition);
new Popup(mcRef.mcPopup);
setState("wbIntro");
break;
case "title" :
if (Library.Sound.SoundManager.isSoundPlaying("sMu_pack").bPlaying == false) {
sndPackaging = Library.Sound.SoundManager.doPlaySoundInCat("music", "sMu_pack", 100, 99999);
sndPackaging.setFadeRate(5);
}
break;
case "play" :
case "levelStart" :
if (Library.Sound.SoundManager.isSoundPlaying("sMu_game").bPlaying == false) {
sndPackaging.doFadeTo(0, true);
sndInGame = Library.Sound.SoundManager.doPlaySoundInCat("music", "sMu_game", 0, 99999);
sndInGame.setFadeRate(1);
sndInGame.doFadeTo(100, false);
}
new Timer();
new HUD(mcRef.mcState.mcHUD);
new GameCTRL(mcRef.mcState);
break;
case "levelComplete" :
_global.HS_Level++;
Transition.__get__Instance().setTransition("play");
break;
case "win" :
case "gameOver" :
mcRef.gameTimeline.hs_scripts2._visible = true;
mcRef.mcState.txtScore.text = Library.Utils.Tools.returnFormatedNumber(_global.HS_Score);
sndInGame.setFadeRate(5);
sndInGame.doFadeTo(0, true);
if (Library.Sound.SoundManager.isSoundPlaying("sMu_pack").bPlaying == false) {
sndPackaging = Library.Sound.SoundManager.doPlaySoundInCat("music", "sMu_pack", 0, 99999);
sndPackaging.setFadeRate(5);
sndPackaging.doFadeTo(100, false);
}
break;
case "Reset" :
Popup.__get__Instance().setState("Idle");
GameCTRL.__get__Instance().clearData();
HUD.__get__Instance().clearData();
Transition.__get__Instance().setTransition("title");
initMainVar();
}
}
function unloadState(P_sState) {
if (P_sState != undefined) {
}
switch (P_sState) {
case "Loaded" :
break;
case "title" :
break;
case "play" :
case "levelStart" :
Popup.__get__Instance().setState("Idle");
GameCTRL.__get__Instance().addPointToAdd();
GameCTRL.__get__Instance().clearData();
break;
case "win" :
case "gameOver" :
mcRef.GC.mcHS.HS.HSD.hideDialog();
break;
case "Reset" :
}
}
function doTransitionComplete() {
if (!(sState === "start")) {
}
}
function getQuit() {
Popup.__get__Instance().setState("QuitOpen");
}
function quitGame() {
GameCTRL.__get__Instance().pause();
Transition.__get__Instance().setTransition("gameOver");
}
function winGame() {
GameCTRL.__get__Instance().pause();
Transition.__get__Instance().setTransition("win");
}
function cancelQuit() {
Popup.__get__Instance().setState("MenuOpen");
}
function playAgain() {
Transition.__get__Instance().setTransition("Reset");
}
function getHelp(P_bOpen) {
if (P_bOpen) {
Popup.__get__Instance().setState("Help");
} else {
Popup.__get__Instance().setState("Idle");
}
}
function resumeHelp() {
if ((sState == "play") || (sState == "levelStart")) {
Popup.__get__Instance().setState("MenuOpen");
} else {
Transition.__get__Instance().setTransition("intro");
}
}
function getMenu() {
GameCTRL.__get__Instance().pause();
Popup.__get__Instance().setState("StartMenu");
}
function resumeMenu() {
Popup.__get__Instance().setState("EndMenu");
}
function playBtnSnd(P_sType) {
if (P_sType == "Over") {
Library.Sound.SoundManager.doPlaySoundInCat("btn", "sFx_btnOver", 100, 1);
} else {
Library.Sound.SoundManager.doPlaySoundInCat("btn", "sFx_btnDown", 100, 1);
}
}
function getMuteSnd() {
return(Library.Sound.SoundManager.isCategoryMuted("music"));
}
function muteGameSnd() {
Library.Sound.SoundManager.doMuteCategory("music");
Library.Sound.SoundManager.doMuteCategory("sfx");
}
function unMuteGameSnd() {
Library.Sound.SoundManager.doUnMuteCategory("music");
Library.Sound.SoundManager.doUnMuteCategory("sfx");
}
}
Symbol 1095 MovieClip [__Packages.Library.Sound.SoundItem] Frame 0
class Library.Sound.SoundItem
{
var sndObj, sLinkage, mcRef, nRemainingLoop, nCurrentVolume, nTargetVolume, nFadeRate, sCategory, bFadeAtEnd, bMuted, bPaused, bNeedFreshStart, nCurrentTime, aEventListeners, bStopAfterFade;
function SoundItem (__sndObject, __sLinkage, __nVolume, __nLoop, __sCategory, __mc) {
sndObj = __sndObject;
sLinkage = __sLinkage;
mcRef = __mc;
nRemainingLoop = __nLoop;
nCurrentVolume = __nVolume;
nTargetVolume = __nVolume;
nFadeRate = FADE_RATE;
sCategory = __sCategory;
bFadeAtEnd = false;
bMuted = false;
bPaused = false;
bNeedFreshStart = false;
sndObj.onSoundComplete = Library.Utils.Delegate.create(this, doSoundComplete);
sndObj.start(0, __nLoop);
sndObj.setVolume(returnComputedVolume(nCurrentVolume));
nCurrentTime = 0;
aEventListeners = new Array();
}
function doEnterFrame() {
if (!bPaused) {
if (nCurrentTime > sndObj.position) {
nRemainingLoop--;
}
nCurrentTime = sndObj.position;
}
doCheckFadeAtEnd();
doManageFade();
}
function doAddListener(__oListener) {
aEventListeners.push(__oListener);
}
function doRemoveListener(__oListener) {
var _local2 = 0;
while (_local2 < aEventListeners.length) {
if (aEventListeners[_local2] == __oListener) {
delete aEventListeners[_local2];
aEventListeners.splice(_local2, 1);
}
_local2++;
}
}
function doSoundComplete() {
if (bNeedFreshStart && (nRemainingLoop > 1)) {
sndObj.start(0, nRemainingLoop - 1);
} else {
doManageEndEvent();
}
}
function doUpdateSound() {
sndObj.setVolume(returnComputedVolume(nCurrentVolume));
}
function doMute() {
bMuted = true;
doUpdateSound();
}
function doUnMute() {
bMuted = false;
doUpdateSound();
}
function doPause() {
sndObj.stop();
bPaused = true;
}
function doResume() {
bPaused = false;
bNeedFreshStart = true;
sndObj.start(nCurrentTime / 1000, 1);
}
function doFadeTo(__nVolume, __bStopAndDelete) {
if (__bStopAndDelete == undefined) {
__bStopAndDelete = true;
}
bStopAfterFade = __bStopAndDelete;
nTargetVolume = __nVolume;
}
function setFadeRate(__nRate) {
if (__nRate == undefined) {
__nRate = FADE_RATE;
}
nFadeRate = __nRate;
}
function setFadeAtEnd(__bFadeAtEnd) {
bFadeAtEnd = true;
}
function setPan(__nPan) {
sndObj.setPan(__nPan);
}
function get Category() {
return(sCategory);
}
function get LinkageName() {
return(sLinkage);
}
function get Volume() {
return(sndObj.getVolume());
}
function get Position() {
return(sndObj.position);
}
function get SoundObject() {
return(sndObj);
}
function doCheckFadeAtEnd() {
if (bFadeAtEnd) {
if (nRemainingLoop == 1) {
if ((sndObj.duration - nCurrentTime) <= FADE_AT_END_TIME) {
doFadeTo(0);
}
}
}
}
function doManageEndEvent() {
var _local2 = 0;
while (_local2 < aEventListeners.length) {
aEventListeners[_local2].doSoundEvent(Library.Sound.SoundManager.EVENT_SOUND_COMPLETE, this);
_local2++;
}
aEventListeners = new Array();
mcRef.removeMovieClip();
delete mcRef;
delete aEventListeners;
delete sndObj.onSoundComplete;
delete sndObj;
}
function doManageFade() {
if (nCurrentVolume != nTargetVolume) {
nCurrentVolume = Library.Utils.MoreMath.getReachNum(nCurrentVolume, nTargetVolume, nFadeRate);
sndObj.setVolume(returnComputedVolume(nCurrentVolume));
}
if ((nCurrentVolume <= 0) && (bStopAfterFade)) {
sndObj.stop();
doManageEndEvent();
}
}
function returnComputedVolume(__nVolume) {
var _local2;
if ((!bMuted) && (!Library.Sound.SoundManager.isCategoryMuted(sCategory))) {
var _local3 = Library.Sound.SoundManager.__get__MasterVolume() / 100;
var _local4 = Library.Sound.SoundManager.getCategoryVolume(sCategory) / 100;
_local2 = __nVolume;
_local2 = _local2 * _local4;
_local2 = _local2 * _local3;
} else {
_local2 = 0;
}
return(_local2);
}
static var FADE_RATE = 8;
static var FADE_AT_END_TIME = 800;
}
Symbol 1096 MovieClip [__Packages.Library.Utils.Delegate] Frame 0
class Library.Utils.Delegate extends Object
{
var func;
function Delegate () {
super();
}
function DelegateArgs(f) {
func = f;
}
static function create(obj, func) {
var _local2 = function () {
var _local3 = arguments.callee.target;
var _local4 = arguments.callee.func;
var _local2 = arguments.callee.arg;
_local2 = _local2.concat(arguments);
return(_local4.apply(_local3, _local2));
};
_local2.target = obj;
_local2.func = func;
_local2.arg = arguments.slice(2);
return(_local2);
}
function createDelegate(obj) {
return(create(obj, func));
}
}
Symbol 1097 MovieClip [__Packages.Library.Sound.SoundManager] Frame 0
class Library.Sound.SoundManager
{
static var aSounds, nSoundNum, mcAttach, aSoundCategories, nMasterVolume, oEnterFrameListener;
function SoundManager () {
}
static function doPlaySound(__sLinkage, __nVolume, __nLoop, __bUnique) {
return(doPlaySoundInCat(DEFAULT_CATEGORY, __sLinkage, __nVolume, __nLoop, __bUnique));
}
static function doPlaySoundInCat(__sCategoryName, __sLinkage, __nVolume, __nLoop, __bUnique) {
doCheckInit();
if (__nVolume == undefined) {
__nVolume = 100;
}
if (__nLoop == undefined) {
__nLoop = 1;
}
if (__bUnique == undefined) {
__bUnique = false;
}
var _local1;
var _local2;
if (__bUnique) {
var _local4 = isSoundPlaying(__sLinkage);
_local2 = _local4.bPlaying;
if (!_local2) {
_local1 = _local4.oSound;
}
} else {
_local2 = true;
}
if (_local2) {
doManageCategory(__sCategoryName);
var _local5 = getMCForSound();
var _local3 = new Sound(_local5);
_local3.attachSound(__sLinkage);
if (_local3.duration != undefined) {
_local1 = new Library.Sound.SoundItem(_local3, __sLinkage, __nVolume, __nLoop, __sCategoryName, _local5);
}
_local1.doAddListener(Library.Sound.SoundManager);
aSounds.push(_local1);
}
return(_local1);
}
static function isSoundPlaying(__sLinkageName) {
var _local1 = new Object();
_local1.bPlaying = false;
_local1.oSound = undefined;
for (var _local3 in aSounds) {
if (aSounds[_local3].LinkageName == __sLinkageName) {
_local1.bPlaying = true;
_local1.oSound = aSounds[_local3];
}
}
return(_local1);
}
static function doManageExternalSound(__oSound) {
doCheckInit();
doManageCategory(__oSound.__get__Category());
__oSound.doAddListener(Library.Sound.SoundManager);
aSounds.push(__oSound);
}
static function getMCForSound() {
nSoundNum++;
var _local1 = mcAttach.createEmptyMovieClip("Snd" + nSoundNum, nSoundNum);
return(_local1);
}
static function doInit(__mcAttach) {
mcAttach = __mcAttach;
if (!bInited) {
bInited = true;
nSoundNum = 0;
aSounds = new Array();
aSoundCategories = new Array();
nMasterVolume = 100;
mx.transitions.OnEnterFrameBeacon.init();
oEnterFrameListener = new Object();
oEnterFrameListener.onEnterFrame = Library.Utils.Delegate.create(Library.Sound.SoundManager, doEnterFrame);
MovieClip.addListener(oEnterFrameListener);
}
}
static function doEnterFrame() {
for (var _local1 in aSounds) {
aSounds[_local1].doEnterFrame();
}
}
static function setCategoryVolume(__sCategoryName, __nVol) {
doManageCategory(__sCategoryName);
for (var _local3 in aSoundCategories) {
if (aSoundCategories[_local3].sName == __sCategoryName) {
aSoundCategories[_local3].nVolume = __nVol;
}
}
doUpdateAllSoundsVolume();
}
static function getCategoryVolume(__sCategoryName) {
doManageCategory(__sCategoryName);
var _local1;
for (var _local3 in aSoundCategories) {
if (aSoundCategories[_local3].sName == __sCategoryName) {
_local1 = aSoundCategories[_local3].nVolume;
}
}
return(_local1);
}
static function isCategoryMuted(__sCategoryName) {
doManageCategory(__sCategoryName);
var _local1;
for (var _local3 in aSoundCategories) {
if (aSoundCategories[_local3].sName == __sCategoryName) {
_local1 = aSoundCategories[_local3].bMuted;
}
}
return(_local1);
}
static function doSoundEvent(__nEvent, __oSound) {
if (!(__nEvent === EVENT_SOUND_COMPLETE)) {
} else {
for (var _local2 in aSounds) {
if (aSounds[_local2] == __oSound) {
delete aSounds[_local2];
aSounds.splice(_local2, 1);
}
}
}
}
static function doMuteCategory(__sCategoryName) {
for (var _local2 in aSoundCategories) {
if (aSoundCategories[_local2].sName == __sCategoryName) {
aSoundCategories[_local2].bMuted = true;
}
}
doUpdateAllSoundsVolume();
}
static function doUnMuteCategory(__sCategoryName) {
for (var _local2 in aSoundCategories) {
if (aSoundCategories[_local2].sName == __sCategoryName) {
aSoundCategories[_local2].bMuted = false;
}
}
doUpdateAllSoundsVolume();
}
static function setMasterVolume(__nVol) {
nMasterVolume = __nVol;
doUpdateAllSoundsVolume();
}
static function get MasterVolume() {
return(nMasterVolume);
}
static function doRemoveListenerFromAllSounds(__oListener) {
for (var _local2 in aSounds) {
aSounds[_local2].doRemoveListener(__oListener);
}
}
static function doUpdateAllSoundsVolume() {
for (var _local1 in aSounds) {
aSounds[_local1].doUpdateSound();
}
}
static function doCheckInit() {
if (!bInited) {
}
}
static function doManageCategory(__sCategoryName) {
doCheckInit();
var _local1 = false;
for (var _local4 in aSoundCategories) {
if (aSoundCategories[_local4].sName == __sCategoryName) {
_local1 = true;
}
}
if (!_local1) {
var _local3 = new Object();
_local3.sName = __sCategoryName;
_local3.nVolume = 100;
_local3.bMuted = false;
aSoundCategories.push(_local3);
}
}
static var EVENT_SOUND_COMPLETE = 1;
static var DEFAULT_CATEGORY = "SFX";
static var bInited = false;
}
Symbol 1098 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 1099 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 1100 MovieClip [__Packages.Library.Utils.MoreMath] Frame 0
class Library.Utils.MoreMath
{
function MoreMath () {
}
static function getRandomRange(__nMin, __nMax) {
return(Math.floor(Math.random() * ((__nMax + 1) - __nMin)) + __nMin);
}
static function getPolarity(__nNum) {
var _local1 = 0;
if (__nNum < 0) {
_local1 = -1;
} else if (__nNum > 0) {
_local1 = 1;
}
return(_local1);
}
static function getReachZero(__nNum, __nReducer) {
return(getReachNum(__nNum, 0, __nReducer));
}
static function getReachNum(__nNum, __nTargetNum, __nReducer) {
var _local1 = __nNum;
if (_local1 != __nTargetNum) {
if (_local1 < __nTargetNum) {
_local1 = _local1 + __nReducer;
if (_local1 > __nTargetNum) {
_local1 = __nTargetNum;
}
} else {
_local1 = _local1 - __nReducer;
if (_local1 < __nTargetNum) {
_local1 = __nTargetNum;
}
}
}
return(_local1);
}
static function getDistance(__nX1, __nY1, __nX2, __nY2) {
return(Math.sqrt(Math.pow(Math.abs(__nX2 - __nX1), 2) + Math.pow(Math.abs(__nY2 - __nY1), 2)));
}
static function getAngle(__nX1, __nY1, __nX2, __nY2) {
var _local3;
var _local2;
var _local1;
_local3 = Math.abs(__nX2) - Math.abs(__nX1);
_local2 = Math.abs(__nY2) - Math.abs(__nY1);
_local1 = Math.atan2(_local2, _local3);
_local1 = (_local1 * 180) / Math.PI;
return(_local1);
}
static function getHypotenuse(__nDX, __nDY) {
return(Math.sqrt(Math.pow(__nDX, 2) + Math.pow(__nDY, 2)));
}
static function getBoundsCenter(_oBox) {
var _local3 = (_oBox.xMin + _oBox.xMax) / 2;
var _local2 = (_oBox.yMin + _oBox.yMax) / 2;
return({x:_local3, y:_local2});
}
}
Symbol 1101 MovieClip [__Packages.Transition] Frame 0
class Transition extends State
{
static var oTransition;
var sState, mcInsideMovieClip, sNextFrameLabel, isStateComplete, mcRef, nStateTotalFrame, doEnterFrame;
function Transition (P_mcRef) {
super(P_mcRef);
setState("Idle");
initTrans();
oTransition = this;
}
static function get Instance() {
return(oTransition);
}
function get CurrentState() {
return(sState);
}
function initTrans() {
mcInsideMovieClip = undefined;
sNextFrameLabel = "";
}
function doStartTransition() {
if (isStateComplete()) {
changeSection();
setState("EndTransition");
}
}
function doEndTransition() {
if (isStateComplete()) {
setState("Idle");
MainCTRL.__get__Instance().doTransitionComplete();
}
}
function setTransition(P_sNextLabel, P_mcInsideMovieClip) {
if (sState != "Idle") {
sNextFrameLabel = P_sNextLabel;
changeSection();
} else {
sNextFrameLabel = P_sNextLabel;
if (P_mcInsideMovieClip != undefined) {
mcInsideMovieClip = P_mcInsideMovieClip;
}
setState("StartTransition");
}
}
function changeSection() {
if (mcInsideMovieClip != undefined) {
mcInsideMovieClip.gotoAndStop(sNextFrameLabel);
mcInsideMovieClip = undefined;
} else {
MainCTRL.__get__Instance().setState(sNextFrameLabel);
}
}
function setState(P_sState) {
if (P_sState != "Idle") {
sState = P_sState;
mcRef.gotoAndStop(P_sState);
nStateTotalFrame = mcRef.mcState._totalframes;
mcRef.onEnterFrame = Library.Utils.Delegate.create(this, doEnterFrame);
} else {
sState = P_sState;
mcRef.gotoAndStop(P_sState);
delete mcRef.onEnterFrame;
}
loadState();
}
function loadState() {
mcRef.mcBlocker.useHandCursor = false;
switch (sState) {
case "Idle" :
mcRef.stop();
break;
case "StartTransition" :
break;
case "EndTransition" :
}
}
}
Symbol 1102 MovieClip [__Packages.Popup] Frame 0
class Popup extends State
{
static var oPopup;
var setState, sState, isStateComplete, mcRef, nLandBonus;
function Popup (P_mcRef) {
super(P_mcRef);
setState("Idle");
oPopup = this;
}
static function get Instance() {
return(oPopup);
}
function get CurrentState() {
return(sState);
}
function doEnterFrame() {
this["do" + sState]();
}
function pause() {
}
function doUnpausableEnterFrame() {
this["do" + sState]();
}
function doStartMenu() {
if (isStateComplete()) {
setState("MenuOpen");
}
}
function doMenuOpen() {
}
function doEndMenu() {
if (isStateComplete()) {
GameCTRL.__get__Instance().unPause();
setState("Idle");
}
}
function doStartBonus() {
if (isStateComplete()) {
setState("BonusOpen");
}
}
function doBonusOpen() {
if (Key.isDown(32) == true) {
setState("EndBonus");
}
}
function doEndBonus() {
if (isStateComplete()) {
Transition.__get__Instance().setState("EndTransition");
MainCTRL.__get__Instance().setState("levelComplete");
setState("Idle");
}
}
function doIntro() {
if (isStateComplete()) {
setState("Idle");
GameCTRL.__get__Instance().startGame();
}
if (mcRef.mcState._currentframe > FRAME_GRID_BUILDER) {
Grid.__get__Instance().buildGridTile();
}
}
function doTimeAlert() {
if (isStateComplete()) {
setState("Idle");
}
}
function loadState() {
mcRef.mcBlocker.useHandCursor = false;
switch (sState) {
case "Idle" :
break;
case "StartMenu" :
break;
case "MenuOpen" :
break;
case "EndMenu" :
break;
case "Help" :
break;
case "StartBonus" :
Library.Sound.SoundManager.doPlaySoundInCat("sfx", "sFx_win", 100, 1);
MainCTRL.__get__Instance().sndInGame.setFadeRate(10);
MainCTRL.__get__Instance().sndInGame.doFadeTo(0, true);
mcRef.mcState.mcState.sLevelBonus = GameCTRL.__get__Instance().LEVEL_COMPLETE_BONUS;
GameCTRL.__get__Instance().managePoint(GameCTRL.__get__Instance().LEVEL_COMPLETE_BONUS);
nLandBonus = 250;
var _local2 = GameCTRL.__get__Instance().__get__LandGrabbed();
if (_local2 >= 95) {
nLandBonus = 5000;
} else if (_local2 >= 90) {
nLandBonus = 1000;
} else if (_local2 >= 85) {
nLandBonus = 500;
}
mcRef.mcState.mcState.sLandBonus = nLandBonus;
GameCTRL.__get__Instance().managePoint(nLandBonus);
break;
case "BonusOpen" :
mcRef.mcState.mcPoint.sLevelBonus = HUD.__get__Instance().__get__Mc().sLandGrabbed;
mcRef.mcState.mcPoint.sLandBonus = nLandBonus;
break;
case "EndBonus" :
mcRef.mcState.mcPoint.sLevelBonus = HUD.__get__Instance().__get__Mc().sLandGrabbed;
mcRef.mcState.mcPoint.sLandBonus = nLandBonus;
}
}
var FRAME_GRID_BUILDER = 20;
}
Symbol 1103 MovieClip [__Packages.GameCTRL] Frame 0
class GameCTRL extends State
{
static var oGameCTRL;
var bScreenLoaded, bPaused, nPointToAdd, bEnemyFreeze, bEnemySlow, nRebuildDone, nDelayFreezeDone, nDelaySlowDone, bZoneFinder, nObjectIndex, aBonusTileUsed, bAddEnemyWithoutTile, nItemEnable, nEnemyEnable, nLandToGrab, nLandGrabbed, oBroadcaster, oBroadcasterTile, aIndexSwapDepth, mcRef, nEnemyDuck, nEnemyPorky, nEnemyHoover, nEnemyLaser, nEnemyRocket;
function GameCTRL (P_mcRef) {
super(P_mcRef);
initGameVars();
oGameCTRL = this;
mx.transitions.OnEnterFrameBeacon.init();
MovieClip.addListener(this);
}
function onEnterFrame() {
if ((MainCTRL.__get__Instance().__get__CurrentState() == "play") || (MainCTRL.__get__Instance().__get__CurrentState() == "levelStart")) {
MainCTRL.__get__Instance().__get__Mc().GC.mainLoop();
}
if (bScreenLoaded == false) {
bScreenLoaded = true;
initGameObject();
} else if (bPaused == false) {
if (nPointToAdd > 0) {
checkPointToAdd();
}
if (bEnemyFreeze) {
manageEnemyFreeze();
}
if (bEnemySlow) {
manageEnemySlow();
}
doBroadcast("doEnterFrame");
doBroadcast("doEnterFrame", "oBroadcasterTile");
} else {
doBroadcast("doUnpausableEnterFrame");
doBroadcast("doUnpausableEnterFrame", "oBroadcasterTile");
}
}
function manageRebuild() {
nRebuildDone++;
if (nRebuildDone >= ADD_ENEMY_AFTER_REBUILD_TODO) {
nRebuildDone = 0;
if (random(2) == 0) {
generateEnemy("mcEnemyLaser", 0);
} else {
generateEnemy("mcEnemyRocket", 0);
}
}
}
function manageEnemyFreeze() {
nDelayFreezeDone++;
if (nDelayFreezeDone >= DELAY_ENEMY_FREEZE_TODO) {
nDelayFreezeDone = 0;
bEnemyFreeze = false;
doBroadcast("unFreeze");
}
}
function getEnemyFreeze() {
nDelayFreezeDone = 0;
bEnemyFreeze = true;
doBroadcast("getFreeze");
}
function manageEnemySlow() {
nDelaySlowDone++;
if (nDelaySlowDone >= DELAY_ENEMY_SLOW_TODO) {
nDelaySlowDone = 0;
bEnemySlow = false;
doBroadcast("unSlow");
}
}
function getEnemySlow() {
nDelaySlowDone = 0;
bEnemySlow = true;
doBroadcast("getSlow");
}
function initGameVars() {
bPaused = true;
bZoneFinder = false;
bScreenLoaded = false;
nObjectIndex = 0;
nPointToAdd = 0;
aBonusTileUsed = new Array();
bAddEnemyWithoutTile = true;
bEnemyFreeze = false;
nDelayFreezeDone = 0;
bEnemySlow = false;
nDelaySlowDone = 0;
nItemEnable = 3 + Math.floor(_global.HS_Level / 3);
if (nItemEnable > 10) {
nItemEnable = 10;
}
nEnemyEnable = 2 + Math.floor(_global.HS_Level / 3);
if (nEnemyEnable > 6) {
nEnemyEnable = 6;
}
nLandToGrab = 80 + (2 * Math.floor(_global.HS_Level / 3));
if (nLandToGrab > 90) {
nLandToGrab = 90;
}
nLandGrabbed = 0;
nRebuildDone = 0;
oBroadcaster = new Object();
AsBroadcaster.initialize(oBroadcaster);
oBroadcasterTile = new Object();
AsBroadcaster.initialize(oBroadcasterTile);
aIndexSwapDepth = new Array();
aIndexSwapDepth[0] = {sType:"Tile", nCurrentDepth:1000, nBaseDepth:1000, nLimitDepth:3000};
aIndexSwapDepth[1] = {sType:"HUD", nCurrentDepth:4000, nBaseDepth:4000, nLimitDepth:4000};
aIndexSwapDepth[2] = {sType:"PlayerDie", nCurrentDepth:5001, nBaseDepth:5001, nLimitDepth:5001};
aIndexSwapDepth[3] = {sType:"BonusItem", nCurrentDepth:6000, nBaseDepth:6000, nLimitDepth:7000};
aIndexSwapDepth[4] = {sType:"Smoke", nCurrentDepth:8000, nBaseDepth:8000, nLimitDepth:12000};
aIndexSwapDepth[5] = {sType:"Enemy", nCurrentDepth:13000, nBaseDepth:13000, nLimitDepth:14500};
aIndexSwapDepth[6] = {sType:"EnemyOver", nCurrentDepth:15000, nBaseDepth:15000, nLimitDepth:16500};
aIndexSwapDepth[7] = {sType:"Player", nCurrentDepth:17001, nBaseDepth:17001, nLimitDepth:17001};
aIndexSwapDepth[8] = {sType:"Laser", nCurrentDepth:18000, nBaseDepth:18000, nLimitDepth:19000};
aIndexSwapDepth[9] = {sType:"Point", nCurrentDepth:20000, nBaseDepth:20000, nLimitDepth:23000};
aIndexSwapDepth[10] = {sType:"HSBoard", nCurrentDepth:24000, nBaseDepth:24000, nLimitDepth:24000};
aIndexSwapDepth[11] = {sType:"Remove", nCurrentDepth:900000, nBaseDepth:900000, nLimitDepth:999999};
}
function initGameObject() {
addBroadcastObj(Popup.__get__Instance());
addBroadcastObj(Timer.__get__Instance());
HUD.__get__Instance().__get__Mc().swapDepths(returnDepth("HUD"));
Timer.__get__Instance().initTimer({nHour:0, nMinute:15, nSecond:0}, HUD.__get__Instance().__get__Mc().mcTimer, "Restricted");
HUD.__get__Instance().__get__Mc().mcTimer._visible = false;
new Grid();
Grid.__get__Instance().buildGridTile();
new Player(mcRef.mcPlayer);
addBroadcastObj(Player.__get__Instance());
HUD.__get__Instance().setLive();
HUD.__get__Instance().setScore();
HUD.__get__Instance().setLandGrab(nLandGrabbed, nLandToGrab);
addLevelEnemy();
pause();
Popup.__get__Instance().setState("Intro");
}
function startGame() {
unPause();
doBroadcast("setAdjacentTile", "oBroadcasterTile", true);
Player.__get__Instance().setState("Teleport");
mcRef.mcTerrain._visible = false;
}
function doTimeUp() {
endLevel(false);
}
function doTimeAlert() {
Popup.__get__Instance().setState("TimeAlert");
HUD.__get__Instance().__get__Mc().mcTimer._visible = true;
}
function manageLandGrab(P_nTileGrab, P_nTileMax) {
nLandGrabbed = nLandGrabbed + ((P_nTileGrab * 100) / P_nTileMax);
HUD.__get__Instance().setLandGrab(nLandGrabbed, nLandToGrab);
if (nLandGrabbed >= nLandToGrab) {
Instance.addPointToAdd();
HUD.__get__Instance().setScore();
endLevel(true);
}
}
function addLevelEnemy() {
nEnemyDuck = 1;
generateEnemy("mcEnemyDuck", 0);
if (_global.HS_Level > 1) {
nEnemyPorky = 1;
generateEnemy("mcEnemyPorky", 0);
} else {
nEnemyPorky = 0;
}
nEnemyHoover = Math.floor(_global.HS_Level / 4);
if (nEnemyHoover > 2) {
nEnemyHoover = 2;
}
if (_global.HS_Level > 12) {
generateEnemy("mcEnemyHoover");
}
nEnemyLaser = Math.floor(_global.HS_Level / 2);
if (nEnemyLaser > 4) {
nEnemyLaser = 4;
}
nEnemyRocket = Math.floor(_global.HS_Level / 3);
if (nEnemyRocket > 2) {
nEnemyRocket = 2;
}
if (_global.HS_Level > 10) {
generateEnemy("mcEnemyRocket");
}
bAddEnemyWithoutTile = false;
}
function generateEnemy(P_sEnemyType, P_nPercent) {
var _local16 = false;
var _local2;
if (((bEnemyFreeze == false) && (bEnemySlow == false)) && (nEnemyEnable > 0)) {
if (P_nPercent != undefined) {
var _local22 = random(100) + 1;
if (_local22 > P_nPercent) {
_local2 = P_sEnemyType;
_local16 = true;
}
} else {
var _local22 = random(100) + 1;
if (_local22 > 75) {
if (((nEnemyHoover > 0) || (nEnemyLaser > 0)) || (nEnemyRocket > 0)) {
var _local12 = false;
while (_local12 == false) {
if (P_sEnemyType != undefined) {
switch (P_sEnemyType) {
case "mcEnemyHoover" :
var _local11 = "nEnemyHoover";
break;
case "mcEnemyLaser" :
_local11 = "nEnemyLaser";
break;
case "mcEnemyRocket" :
_local11 = "nEnemyRocket";
}
if (this[_local11] > 0) {
_local2 = P_sEnemyType;
_local12 = true;
_local16 = true;
} else {
P_sEnemyType = undefined;
}
} else {
var _local15 = random(3) + 1;
switch (_local15) {
case 1 :
var _local11 = "nEnemyHoover";
_local2 = "mcEnemyHoover";
break;
case 2 :
_local11 = "nEnemyLaser";
_local2 = "mcEnemyLaser";
break;
case 3 :
_local11 = "nEnemyRocket";
_local2 = "mcEnemyRocket";
}
if (this[_local11] > 0) {
_local12 = true;
_local16 = true;
} else {
_local2 = undefined;
}
}
}
}
}
}
if (_local16 && (_local2 != undefined)) {
var _local17 = 0;
var _local8 = false;
while (_local17 <= 100) {
_local17++;
if (bAddEnemyWithoutTile) {
var _local6 = 30;
var _local4 = Library.Utils.MoreMath.getRandomRange(Grid.__get__Instance().START_X + _local6, Grid.__get__Instance().GRID_WIDTH - _local6);
var _local3 = Library.Utils.MoreMath.getRandomRange(Grid.__get__Instance().START_Y + _local6, Grid.__get__Instance().GRID_HEIGHT - _local6);
var _local5 = {posX:_local4, posY:_local3};
} else {
var _local4 = random(Grid.__get__Instance().__get__MaxTile().MAX_X);
var _local3 = random(Grid.__get__Instance().__get__MaxTile().MAX_Y);
var _local10 = Grid.__get__Instance().getTileObject({tX:_local4, tY:_local3});
var _local5 = Grid.__get__Instance().getTileCenter({tX:_local4, tY:_local3});
}
if (Library.Utils.MoreMath.getDistance(Player.__get__Instance().__get__Mc()._x, Player.__get__Instance().__get__Mc()._y, _local5.posX, _local5.posY) > NEW_ENEMY_FROM_PLAYER) {
if (bAddEnemyWithoutTile == false) {
if (_local2 == "mcEnemyLaser") {
if (((((_local10.sState == "Empty") && (_local4 != 0)) && (_local4 != (Grid.__get__Instance().__get__MaxTile().MAX_X + 1))) && (_local3 != 0)) && (_local3 != (Grid.__get__Instance().__get__MaxTile().MAX_Y + 1))) {
_local8 = true;
}
} else if (_local10.sState == "Idle") {
_local8 = true;
}
} else {
_local8 = true;
}
if (_local8) {
this[_local11]--;
var _local13 = "mcEnemy" + getObjectIndex();
if ((_local2 == "nEnemyRocket") || (_local2 == "mcEnemyPorky")) {
var _local14 = returnDepth("EnemyOver");
} else {
var _local14 = returnDepth("Enemy");
}
var _local7 = mcRef.attachMovie(_local2, _local13, _local14);
_local7._x = _local5.posX;
_local7._y = _local5.posY;
addBroadcastObj(new Enemy(_local7, _local2));
nEnemyEnable--;
break;
}
}
}
}
}
}
function generateBonusItem() {
if (nItemEnable > 0) {
var _local14 = random(100) + 1;
if (_local14 > 70) {
if (_local14 > 95) {
var _local10 = "mcBonusLive";
} else if (_local14 > 90) {
var _local10 = "mcBonusFreeze";
} else if (_local14 > 82) {
var _local10 = "mcBonusSlow";
} else if (_local14 > 70) {
var _local10 = "mcBonusSpeed";
}
var _local7 = false;
var _local8 = 0;
while (_local7 == false) {
_local8++;
var _local3 = random(Grid.__get__Instance().__get__MaxTile().MAX_X);
var _local2 = random(Grid.__get__Instance().__get__MaxTile().MAX_Y);
var _local4 = false;
if ((_local3 != 0) && (_local2 != 0)) {
for (var _local13 in aBonusTileUsed) {
if ((aBonusTileUsed[_local13].tX == _local3) && (aBonusTileUsed[_local13].tY == _local2)) {
_local4 = true;
break;
}
}
} else {
_local4 = true;
}
if (_local4 == false) {
aBonusTileUsed.push({tX:_local3, tY:_local2});
var _local6 = Grid.__get__Instance().getTileCenter({tX:_local3, tY:_local2});
var _local9 = "mcBonusItem" + getObjectIndex();
var _local5 = mcRef.attachMovie(_local10, _local9, returnDepth("BonusItem"));
_local5._x = _local6.posX;
_local5._y = _local6.posY;
addBroadcastObj(new BonusItem(_local5, _local10));
nItemEnable--;
_local7 = true;
} else {
_local8++;
if (_local8 >= 10) {
_local7 = true;
}
}
}
}
}
}
function manageBonusScore(P_nTileGrabbed, P_oPos) {
var _local4 = P_nTileGrabbed * TILE_SCORE_VALUE;
var _local2 = 1;
if (P_nTileGrabbed >= 100) {
_local2 = 10;
} else if (P_nTileGrabbed >= 50) {
_local2 = 5;
} else if (P_nTileGrabbed >= 25) {
_local2 = 3;
} else if (P_nTileGrabbed >= 10) {
_local2 = 2;
}
managePoint(_local4 * _local2);
addScoreFX(_local4, _local2, P_oPos);
}
function addScoreFX(P_nScore, P_nMultiplier, P_oPos) {
var _local4 = "mcBonusScore" + getObjectIndex();
var _local2 = mcRef.attachMovie("mcScore", _local4, returnDepth("Point"));
_local2._x = P_oPos.posX;
_local2._y = P_oPos.posY;
_local2._xscale = _local2._xscale + (5 * P_nMultiplier);
_local2._yscale = _local2._yscale + (5 * P_nMultiplier);
addBroadcastObj(new BonusScore(_local2, P_nScore, P_nMultiplier));
}
function endLevel(P_bCleared) {
pause();
if (P_bCleared == false) {
if (_global.HS_Level >= LEVEL_TO_WIN) {
MainCTRL.__get__Instance().winGame();
} else {
MainCTRL.__get__Instance().quitGame();
}
} else {
Player.__get__Instance().setState("Win");
Popup.__get__Instance().setState("StartBonus");
}
}
function getObjectIndex() {
nObjectIndex++;
return(nObjectIndex);
}
function clearData() {
doBroadcast("setAdjacentTile", "oBroadcasterTile", false);
MovieClip.removeListener(this);
doBroadcast("clearData");
delete oGameCTRL;
}
function doBroadcast(P_sMessage, P_sBroadCast, P_Argument) {
if (P_sBroadCast == undefined) {
P_sBroadCast = "oBroadcaster";
}
this[P_sBroadCast].broadcastMessage(P_sMessage, P_Argument);
}
function pause() {
bPaused = true;
doBroadcast("pause");
doBroadcast("pause", "oBroadcasterTile");
}
function unPause() {
bPaused = false;
doBroadcast("unPause");
doBroadcast("unPause", "oBroadcasterTile");
}
function addBroadcastObj(P_obj, P_sBroadCast) {
if (P_sBroadCast == undefined) {
P_sBroadCast = "oBroadcaster";
}
this[P_sBroadCast].addListener(P_obj);
}
function removeBroadcastObj(P_obj, P_sBroadCast) {
if (P_sBroadCast == undefined) {
P_sBroadCast = "oBroadcaster";
}
this[P_sBroadCast].removeListener(P_obj);
}
function removeObject(P_oInstance) {
delete this[P_oInstance];
}
function removeInstance(P_mcRef) {
P_mcRef.swapDepths(returnDepth("Remove"));
P_mcRef.removeMovieClip();
}
function returnDepth(P_sType) {
for (var _local3 in aIndexSwapDepth) {
if (aIndexSwapDepth[_local3].sType == P_sType) {
aIndexSwapDepth[_local3].nCurrentDepth++;
if (aIndexSwapDepth[_local3].nCurrentDepth > aIndexSwapDepth[_local3].nLimitDepth) {
aIndexSwapDepth[_local3].nCurrentDepth = aIndexSwapDepth[_local3].nBaseDepth;
}
return(aIndexSwapDepth[_local3].nCurrentDepth);
}
}
}
function setZoneFinder(P_bZoneFinder) {
if (P_bZoneFinder == true) {
Popup.__get__Instance().setState("Blocker");
Grid.__get__Instance().__set__ZoneFinderStep(1);
Grid.__get__Instance().doZoneFinderStep();
} else if (Popup.__get__Instance().__get__CurrentState() == "Blocker") {
Popup.__get__Instance().setState("Idle");
}
bZoneFinder = P_bZoneFinder;
}
function get LandGrabbed() {
return(nLandGrabbed);
}
static function get Instance() {
return(oGameCTRL);
}
function get Mc() {
return(mcRef);
}
function get IsPaused() {
return(bPaused);
}
function SetPaused(P_bPaused) {
bPaused = P_bPaused;
}
function managePoint(P_nPoint) {
nPointToAdd = nPointToAdd + P_nPoint;
}
function checkPointToAdd() {
if (nPointToAdd > 0) {
if (nPointToAdd < SCORE_SPEED) {
addPoint(nPointToAdd);
nPointToAdd = 0;
} else {
nPointToAdd = nPointToAdd - SCORE_SPEED;
addPoint(SCORE_SPEED);
}
}
}
function addPointToAdd() {
_global.HS_Score = _global.HS_Score + nPointToAdd;
nPointToAdd = 0;
}
function addPoint(P_nPoint) {
_global.HS_Score = _global.HS_Score + P_nPoint;
HUD.__get__Instance().setScore();
}
var LEVEL_COMPLETE_BONUS = 500;
var LEVEL_TO_WIN = 10;
var SCORE_SPEED = 120;
var TILE_SCORE_VALUE = 10;
var DELAY_ENEMY_FREEZE_TODO = 350;
var DELAY_ENEMY_SLOW_TODO = 500;
var NEW_ENEMY_FROM_PLAYER = 120;
var ADD_ENEMY_AFTER_REBUILD_TODO = 75;
}
Symbol 1104 MovieClip [__Packages.Timer] Frame 0
class Timer extends State
{
static var oTimer;
var setState, nMillisecond, nHour, nMinute, nSeconde, mcRefToSet, sTimerMode, bCanShowAlert;
function Timer () {
super();
setState("Stop");
oTimer = this;
}
function initTimer(P_objCurTime, P_mcRef, P_sTimerMode) {
nMillisecond = 0;
nHour = P_objCurTime.nHour;
nMinute = P_objCurTime.nMinute;
nSeconde = P_objCurTime.nSecond;
mcRefToSet = P_mcRef;
sTimerMode = P_sTimerMode;
getMillisecond();
showTime();
setState(sTimerMode);
bCanShowAlert = true;
}
function getMillisecond() {
nMillisecond = nMillisecond + (nHour * 3600000);
nMillisecond = nMillisecond + (nMinute * 60000);
nMillisecond = nMillisecond + (nSeconde * 1000);
}
function manageTime(P_nTime) {
nMillisecond = nMillisecond + P_nTime;
}
function doRestricted() {
var _local2 = 1000 / MainCTRL.__get__Instance().STAGE_FPS;
manageTime(-_local2);
showTime();
validTime();
}
function doOpenUp() {
var _local2 = 1000 / MainCTRL.__get__Instance().STAGE_FPS;
manageTime(_local2);
showTime();
}
function validTime() {
if (sTimerMode == "Restricted") {
if (nMillisecond <= 0) {
GameCTRL.__get__Instance().doTimeUp();
} else if ((nMillisecond < 30000) && (bCanShowAlert)) {
GameCTRL.__get__Instance().doTimeAlert();
bCanShowAlert = false;
}
}
}
function showTime() {
var _local3 = "";
var _local5 = "";
var _local7 = "";
var _local2 = nMillisecond;
if (_local2 >= 0) {
if (_local2 >= 3600000) {
var _local8 = Math.floor(_local2 / 3600000);
_local2 = _local2 - (_local8 * 3600000);
nHour = _local8;
_local3 = Library.Utils.Tools.returnFormatedNumber(_local8);
}
if (_local2 >= 60000) {
var _local4 = Math.floor(_local2 / 60000);
_local2 = _local2 - (_local4 * 60000);
nMinute = _local4;
_local5 = Library.Utils.Tools.returnFormatedNumber(_local4, 2);
} else {
nMinute = 0;
_local5 = "00";
}
if (_local2 >= 1000) {
var _local6 = Math.floor(_local2 / 1000);
_local2 = _local2 - (_local6 * 1000);
nSeconde = _local6;
_local7 = Library.Utils.Tools.returnFormatedNumber(_local6, 2);
} else {
nSeconde = 0;
_local7 = "00";
}
var _local9 = "";
if (_local3 != "") {
_local9 = _local3 + ":";
}
mcRefToSet.sTimerMin = _local5;
mcRefToSet.sTimerSec = _local7;
} else {
var _local9 = "";
nMillisecond = 0;
mcRefToSet.sTimerMin = "00";
mcRefToSet.sTimerSec = "00";
}
}
static function get Instance() {
return(oTimer);
}
}
Symbol 1105 MovieClip [__Packages.Library.Utils.Tools] Frame 0
class Library.Utils.Tools
{
function Tools () {
}
static function isItemInArray(__aArray, __oItem) {
var _local2 = false;
for (var _local4 in __aArray) {
if (__aArray[_local4] == __oItem) {
_local2 = true;
}
}
return(_local2);
}
static function doCopyArray(__aArraySource) {
var _local3 = new Array();
var _local1 = 0;
_local1 = 0;
while (_local1 < __aArraySource.length) {
if (__aArraySource[_local1] instanceof Array) {
_local3.push(doCopyArray(__aArraySource[_local1]));
} else {
_local3.push(__aArraySource[_local1]);
}
_local1++;
}
return(_local3);
}
static function returnFormatedNumber(__nNumber, __nMinimumChar) {
var _local1 = String(__nNumber);
var _local3 = "";
var _local4 = _local1.length;
_local4 = _local4 / 3;
var _local5;
var _local2;
if (_local4 <= 1) {
_local5 = _local1;
if (_local5.length < __nMinimumChar) {
_local5 = "0" + _local5;
}
} else {
_local2 = _local4;
while (_local2 > 1) {
_local3 = ("," + _local1.substr(-3)) + _local3;
_local1 = _local1.substr(0, -3);
_local2--;
}
_local5 = _local1 + _local3;
if (_local5.length < __nMinimumChar) {
_local5 = "0" + _local5;
}
}
return(_local5);
}
}
Symbol 1106 MovieClip [__Packages.HUD] Frame 0
class HUD extends State
{
static var oHUD;
var mcRef;
function HUD (P_mcRef) {
super(P_mcRef);
oHUD = this;
}
static function get Instance() {
return(oHUD);
}
function get Mc() {
return(mcRef);
}
function setLive() {
mcRef.sLive = MainCTRL.__get__Instance().PlayerLive;
}
function setScore() {
mcRef.sScore = Library.Utils.Tools.returnFormatedNumber(_global.HS_Score);
}
function setLandGrab(P_nLandGrabbed, P_nLandToGrab) {
mcRef.sLandGrabbed = Library.Utils.Tools.returnFormatedNumber(Math.floor(P_nLandGrabbed), 2);
mcRef.sLandToGrab = Library.Utils.Tools.returnFormatedNumber(Math.floor(P_nLandToGrab), 2);
}
function clearData() {
delete oHUD;
}
}
Symbol 1107 MovieClip [__Packages.Grid] Frame 0
class Grid
{
static var oGrid;
var MAX_TILE_X, MAX_TILE_Y, aGrid, aGridPath, nGridZone, bEnemyZoned, nZoneFinderStep, nContaminationRate, nCurrRow, nTileGrabbed, aGridZone1, __get__ZoneFinderStep, __get__EnemyZoned;
function Grid () {
MAX_TILE_X = Math.floor(GRID_WIDTH / TILE_WIDTH);
MAX_TILE_Y = Math.floor(GRID_HEIGHT / TILE_HEIGHT);
aGrid = new Array(MAX_TILE_Y);
aGridPath = [];
nGridZone = 1;
bEnemyZoned = false;
this["aGridZone" + nGridZone] = new Array();
nZoneFinderStep = 1;
nContaminationRate = 0;
nCurrRow = 0;
oGrid = this;
}
function buildGridTile() {
if (nCurrRow < MAX_TILE_Y) {
var _local3 = nCurrRow;
var _local2 = 0;
while (_local2 < MAX_TILE_X) {
var _local4 = GameCTRL.__get__Instance().__get__Mc().attachMovie("mcTile", (("mcTileX" + _local2) + "Y") + _local3, GameCTRL.__get__Instance().returnDepth("Tile"));
_local4._x = START_X + (_local2 * TILE_WIDTH);
_local4._y = START_Y + (_local3 * TILE_HEIGHT);
if (aGrid[_local3] == undefined) {
aGrid[_local3] = new Array();
}
if ((((_local3 == 0) || (_local2 == 0)) || (_local3 == (MAX_TILE_Y - 1))) || (_local2 == (MAX_TILE_X - 1))) {
var _local5 = "Empty";
} else {
var _local5 = "Idle";
}
this[(("mcTileX" + _local2) + "Y") + _local3] = new Tile(_local4, _local5);
aGrid[_local3].push(this[(("mcTileX" + _local2) + "Y") + _local3]);
GameCTRL.__get__Instance().addBroadcastObj(this[(("mcTileX" + _local2) + "Y") + _local3], "oBroadcasterTile");
_local2++;
}
nCurrRow++;
}
}
function managePlayerPath(P_oGridXY, P_bReset) {
if (P_bReset == true) {
var _local2 = 0;
while (_local2 < aGridPath.length) {
if (((getTileObject(aGridPath[_local2]).sState == "SmkEnd") || (getTileObject(aGridPath[_local2]).sState == "SmkBurn")) || (getTileObject(aGridPath[_local2]).sState == "SmkStartBurn")) {
getTileObject(aGridPath[_local2]).setState("SmkDisappear");
} else {
getTileObject(aGridPath[_local2]).setState("SmkVanish");
}
_local2++;
}
aGridPath = [];
} else {
aGridPath.push(P_oGridXY);
}
}
function endContamination(P_nCRate) {
nGridZone++;
this["aGridZone" + nGridZone] = new Array();
nZoneFinderStep = 1;
doZoneFinderStep();
}
function doZoneFinderStep() {
switch (nZoneFinderStep) {
case 1 :
findEmptyTile();
break;
case 2 :
var _local3 = false;
nTileGrabbed = 0;
fillEmptyZone(0);
var _local2 = 1;
while (this["aGridZone" + _local2].length > 0) {
bEnemyZoned = false;
GameCTRL.__get__Instance().doBroadcast("isZoned", "oBroadcaster", this["aGridZone" + _local2]);
fillEmptyZone(_local2);
if (bEnemyZoned == false) {
var _local4 = findZoneMid(_local2);
if (_local3 == false) {
GameCTRL.__get__Instance().manageBonusScore(this["aGridZone" + _local2].length + aGridPath.length, _local4);
_local3 = true;
} else {
GameCTRL.__get__Instance().manageBonusScore(this["aGridZone" + _local2].length, _local4);
}
}
this["aGridZone" + _local2] = new Array();
_local2++;
}
if ((aGridZone1.length == 0) && (_local3 == false)) {
var _local4 = findZoneMid(0);
GameCTRL.__get__Instance().manageBonusScore(aGridPath.length, _local4);
}
Library.Sound.SoundManager.doPlaySoundInCat("sfx", "sFx_explode" + random(3), 100, 1);
GameCTRL.__get__Instance().manageLandGrab(nTileGrabbed, (MAX_TILE_X - 2) * (MAX_TILE_Y - 2));
if (GameCTRL.__get__Instance().nLandGrabbed < GameCTRL.__get__Instance().nLandToGrab) {
if (aGridPath.length > MINIMUM_PATH_LENGTH) {
GameCTRL.__get__Instance().generateEnemy();
}
}
GameCTRL.__get__Instance().setZoneFinder(false);
aGridPath = [];
nGridZone = 1;
}
}
function fillEmptyZone(P_nZoneIndex) {
if (P_nZoneIndex == 0) {
nTileGrabbed = nTileGrabbed + aGridPath.length;
for (var _local3 in aGridPath) {
getTileObject(aGridPath[_local3]).setState("Wait");
}
} else {
if (bEnemyZoned == false) {
nTileGrabbed = nTileGrabbed + this["aGridZone" + P_nZoneIndex].length;
if (this["aGridZone" + P_nZoneIndex].length >= BONUS_TILE) {
GameCTRL.__get__Instance().generateBonusItem();
}
}
for (var _local3 in this["aGridZone" + P_nZoneIndex]) {
if (bEnemyZoned == true) {
getTileObject(this["aGridZone" + P_nZoneIndex][_local3]).setState("Idle");
}
}
}
}
function findZoneMid(P_nZoneIndex) {
var _local8 = {posX:0, posY:0};
var _local6 = GRID_WIDTH;
var _local5 = GRID_HEIGHT;
var _local4 = 0;
var _local3 = 0;
if (P_nZoneIndex == 0) {
_local8.posX = getTileCenter(aGridPath[0]).posX;
_local8.posY = getTileCenter(aGridPath[0]).posY;
} else {
for (var _local9 in this["aGridZone" + P_nZoneIndex]) {
var _local2 = getTileCenter(this["aGridZone" + P_nZoneIndex][_local9]);
if (_local2.posX < _local6) {
_local6 = _local2.posX;
}
if (_local2.posX > _local4) {
_local4 = _local2.posX;
}
if (_local2.posY < _local5) {
_local5 = _local2.posY;
}
if (_local2.posY > _local3) {
_local3 = _local2.posY;
}
}
_local8.posX = (_local6 + _local4) / 2;
_local8.posY = (_local5 + _local3) / 2;
}
return(_local8);
}
function contamineZone() {
var _local2 = 0;
while (_local2 <= this["aGridZone" + nGridZone].length) {
Instance.getTileObject(this["aGridZone" + nGridZone][_local2]).startContamination();
_local2++;
}
endContamination();
}
function makePlayerPathBurn() {
var _local2 = aGridPath.length - 1;
while (_local2 >= 0) {
if (getTileObject(aGridPath[_local2]).sState == "SmkBurn") {
if (_local2 == (aGridPath.length - 1)) {
Player.__get__Instance().setState("Die");
} else {
getTileObject(aGridPath[_local2 + 1]).setState("SmkStartBurn");
}
break;
}
_local2--;
}
}
function findEmptyTile() {
var _local2 = false;
var _local3 = 0;
while (_local3 < aGridPath.length) {
var _local4 = getTileObject({tX:aGridPath[_local3].tX - 1, tY:aGridPath[_local3].tY});
if (_local4.sState == "Idle") {
_local4.setState("Zoned");
_local2 = true;
}
if (_local2) {
contamineZone();
break;
}
_local3++;
}
if (_local2 == false) {
_local3 = 0;
while (_local3 < aGridPath.length) {
var _local4 = getTileObject({tX:aGridPath[_local3].tX + 1, tY:aGridPath[_local3].tY});
if (_local4.sState == "Idle") {
_local4.setState("Zoned");
_local2 = true;
}
if (_local2) {
contamineZone();
break;
}
_local3++;
}
}
if (_local2 == false) {
_local3 = 0;
while (_local3 < aGridPath.length) {
var _local4 = getTileObject({tX:aGridPath[_local3].tX, tY:aGridPath[_local3].tY + 1});
if (_local4.sState == "Idle") {
_local4.setState("Zoned");
_local2 = true;
}
if (_local2) {
contamineZone();
break;
}
_local3++;
}
}
if (_local2 == false) {
_local3 = 0;
while (_local3 < aGridPath.length) {
var _local4 = getTileObject({tX:aGridPath[_local3].tX, tY:aGridPath[_local3].tY - 1});
if (_local4.sState == "Idle") {
_local4.setState("Zoned");
_local2 = true;
}
if (_local2) {
contamineZone();
break;
}
_local3++;
}
}
if (_local2 == false) {
nZoneFinderStep = 2;
doZoneFinderStep();
}
}
function addObjectToGridZone(P_oTileObject) {
this["aGridZone" + nGridZone].push(P_oTileObject);
}
function set ZoneFinderStep(P_nStep) {
nZoneFinderStep = P_nStep;
//return(__get__ZoneFinderStep());
}
function getTile(P_nPosX, P_nPosY) {
var _local3 = Math.floor((P_nPosX - START_X) / TILE_WIDTH);
var _local2 = Math.floor((P_nPosY - START_Y) / TILE_HEIGHT);
return({tX:_local3, tY:_local2});
}
function getTileCenter(P_oGridXY) {
var _local3 = (START_X + (P_oGridXY.tX * TILE_WIDTH)) + (TILE_WIDTH / 2);
var _local2 = (START_Y + (P_oGridXY.tY * TILE_HEIGHT)) + (TILE_HEIGHT / 2);
return({posX:_local3, posY:_local2});
}
function getTileObject(P_oGridXY) {
return(aGrid[P_oGridXY.tY][P_oGridXY.tX]);
}
function centerPlayer(P_oGridXY) {
return(aGrid[P_oGridXY.tY][P_oGridXY.tX]);
}
static function get Instance() {
return(oGrid);
}
function get MaxTile() {
return({MAX_X:MAX_TILE_X - 1, MAX_Y:MAX_TILE_Y - 1});
}
function get IsGridPathEmpty() {
var _local2 = false;
if (aGridPath.length == 0) {
_local2 = true;
}
return(_local2);
}
function get IsEnemyZoned() {
return(bEnemyZoned);
}
function set EnemyZoned(P_bZoned) {
bEnemyZoned = P_bZoned;
//return(__get__EnemyZoned());
}
var GRID_WIDTH = 465;
var GRID_HEIGHT = 330;
var TILE_WIDTH = 15;
var TILE_HEIGHT = 15;
var START_X = 18;
var START_Y = 27;
var BONUS_TILE = 15;
var MINIMUM_PATH_LENGTH = 10;
}
Symbol 1108 MovieClip [__Packages.Tile] Frame 0
class Tile extends State
{
var mcRef, nWidth, nHeight, nDelayDone, nDelayTodo, oDrawZone, setState, bCanRebuild, oCurrTile, bCropped, oTileN, oTileW, oTileS, oTileE, oTileNE, oTileNW, oTileSE, oTileSW, sState, isStateComplete;
function Tile (P_mcRef, P_sStartState) {
super(mcRef);
mcRef = P_mcRef;
nWidth = mcRef._width;
nHeight = mcRef._height;
nDelayDone = 0;
nDelayTodo = 1;
oDrawZone = new DrawZone(mcRef.mcDrawZone, getDrawMatrix());
setState(P_sStartState);
if (P_sStartState != "Idle") {
bCanRebuild = false;
} else {
bCanRebuild = true;
}
mcRef.mcCropRight._visible = false;
mcRef.mcCropTop._visible = false;
mcRef.mcCropLeft._visible = false;
mcRef.mcCropBottom._visible = false;
oCurrTile = Grid.__get__Instance().getTile(mcRef._x, mcRef._y);
bCropped = false;
}
function setAdjacentTile(P_bSet) {
if (P_bSet) {
oTileN = Grid.__get__Instance().getTileObject({tX:oCurrTile.tX, tY:oCurrTile.tY - 1});
oTileW = Grid.__get__Instance().getTileObject({tX:oCurrTile.tX - 1, tY:oCurrTile.tY});
oTileS = Grid.__get__Instance().getTileObject({tX:oCurrTile.tX, tY:oCurrTile.tY + 1});
oTileE = Grid.__get__Instance().getTileObject({tX:oCurrTile.tX + 1, tY:oCurrTile.tY});
oTileNE = Grid.__get__Instance().getTileObject({tX:oCurrTile.tX + 1, tY:oCurrTile.tY - 1});
oTileNW = Grid.__get__Instance().getTileObject({tX:oCurrTile.tX - 1, tY:oCurrTile.tY - 1});
oTileSE = Grid.__get__Instance().getTileObject({tX:oCurrTile.tX + 1, tY:oCurrTile.tY + 1});
oTileSW = Grid.__get__Instance().getTileObject({tX:oCurrTile.tX - 1, tY:oCurrTile.tY + 1});
} else {
oTileE = undefined;
oTileN = undefined;
oTileW = undefined;
oTileS = undefined;
oTileNE = undefined;
oTileNW = undefined;
oTileSE = undefined;
oTileSW = undefined;
}
}
function pause() {
mcRef.mcState.stop();
if (sState == "Morph") {
mcRef.stop();
}
}
function unPause() {
mcRef.mcState.play();
if (sState == "Morph") {
mcRef.play();
}
}
function doUnpausableEnterFrame() {
if ((((sState == "Explosion") || (sState == "Wait")) || (sState == "Morph")) && (Popup.__get__Instance().__get__CurrentState().indexOf("Bonus") != -1)) {
mcRef.mcState.play();
if (sState == "Morph") {
mcRef.play();
}
this["do" + sState]();
}
}
function doWait() {
mcRef.play();
sState = "Morph";
}
function doMorph() {
if (bCropped == false) {
cropTerrain();
bCropped = true;
}
}
function doExplosion() {
if (bCropped == false) {
cropTerrain();
bCropped = true;
}
if (isStateComplete()) {
setState("Empty");
bCropped = false;
}
}
function doSmkAppear() {
if (isStateComplete()) {
setState("SmkIdle");
}
}
function doSmkStartBurn() {
if (isStateComplete()) {
setState("SmkBurn");
}
}
function doSmkBurn() {
if (isStateComplete()) {
setState("SmkEnd");
}
}
function doSmkVanish() {
if (isStateComplete()) {
setState("Idle");
}
}
function doSmkDisappear() {
if (isStateComplete()) {
setState("Idle");
}
}
function cropTerrain() {
if (oTileE.sState == "Idle") {
oTileE.oDrawZone.cropTerrain("Left");
}
if (oTileN.sState == "Idle") {
oTileN.oDrawZone.cropTerrain("Bottom");
}
if (oTileW.sState == "Idle") {
oTileW.oDrawZone.cropTerrain("Right");
}
if (oTileS.sState == "Idle") {
oTileS.oDrawZone.cropTerrain("Top");
}
}
function rebuildTerrain(P_bSpreadBuild) {
if (bCanRebuild) {
if (P_bSpreadBuild == true) {
setState("Idle");
}
oDrawZone.drawTerrain(getDrawMatrix());
if (P_bSpreadBuild) {
GameCTRL.__get__Instance().manageLandGrab(-1, (Grid.__get__Instance().__get__MaxTile().MAX_X - 1) * (Grid.__get__Instance().__get__MaxTile().MAX_Y - 1));
}
if (oTileE.sState != "Empty") {
if (P_bSpreadBuild) {
oTileE.rebuildTerrain(false);
}
} else {
oDrawZone.cropTerrain("Right");
}
if (oTileN.sState != "Empty") {
if (P_bSpreadBuild) {
oTileN.rebuildTerrain(false);
}
} else {
oDrawZone.cropTerrain("Top");
}
if (oTileW.sState != "Empty") {
if (P_bSpreadBuild) {
oTileW.rebuildTerrain(false);
}
} else {
oDrawZone.cropTerrain("Left");
}
if (oTileS.sState != "Empty") {
if (P_bSpreadBuild) {
oTileS.rebuildTerrain(false);
}
} else {
oDrawZone.cropTerrain("Bottom");
}
}
}
function startContamination() {
if (oTileE.sState == "Idle") {
oTileE.setState("Zoned");
}
if (oTileN.sState == "Idle") {
oTileN.setState("Zoned");
}
if (oTileW.sState == "Idle") {
oTileW.setState("Zoned");
}
if (oTileS.sState == "Idle") {
oTileS.setState("Zoned");
}
}
function clearData() {
oDrawZone.clearBitmapData();
GameCTRL.__get__Instance().removeInstance(mcRef);
GameCTRL.__get__Instance().removeBroadcastObj(this, "oBroadcasterTile");
}
function getDrawMatrix() {
var _local2 = new flash.geom.Matrix();
var _local4 = mcRef._x;
var _local3 = mcRef._y;
_local2.translate(-mcRef._x, -mcRef._y);
return(_local2);
}
function loadState() {
switch (sState) {
case "Idle" :
mcRef._visible = true;
mcRef.mcDrawZone._visible = true;
break;
case "Empty" :
mcRef._visible = false;
bCropped = false;
break;
case "SmkBurn" :
Grid.__get__Instance().makePlayerPathBurn();
break;
case "Zoned" :
Grid.__get__Instance().addObjectToGridZone(oCurrTile);
setState("Wait");
break;
case "Wait" :
break;
case "Morph" :
mcRef.play();
break;
case "Explosion" :
if (random(5) > 0) {
mcRef.mcState.gotoAndPlay("Empty");
} else {
mcRef.mcState.gotoAndPlay(random(5) + 1);
}
mcRef.mcDrawZone._visible = false;
}
}
}
Symbol 1109 MovieClip [__Packages.DrawZone] Frame 0
class DrawZone extends MovieClip
{
var mcRef;
function DrawZone (P_mcRef, P_nMatrix) {
super();
mcRef = P_mcRef;
if (MainCTRL.__get__Instance()["oBitmapData" + mcRef._parent._name] == undefined) {
MainCTRL.__get__Instance()["oBitmapData" + mcRef._parent._name] = new flash.display.BitmapData(mcRef._width, mcRef._height, true, BITMAP_COLOR);
}
attachBitmapData();
drawTerrain(P_nMatrix);
}
function drawTerrain(P_nMatrix) {
drawMc(GameCTRL.__get__Instance().__get__Mc().mcTerrain, P_nMatrix);
}
function cropTerrain(P_sDirection) {
var _local4 = mcRef._parent["mcCrop" + P_sDirection];
var _local3 = new flash.geom.Matrix();
var _local2 = 4;
switch (P_sDirection) {
case "Right" :
_local3.translate(random(_local2 / 2), random(_local2));
break;
case "Left" :
_local3.translate(-random(_local2), random(_local2));
break;
case "Top" :
_local3.translate(random(_local2), -random(_local2));
break;
case "Bottom" :
_local3.translate(random(_local2), random(_local2));
}
eraseDraw(_local4, _local3);
}
function attachBitmapData() {
mcRef.attachBitmap(MainCTRL.__get__Instance()["oBitmapData" + mcRef._parent._name], 1);
}
function drawMc(P_mcRef, P_nMatrix) {
MainCTRL.__get__Instance()["oBitmapData" + mcRef._parent._name].draw(P_mcRef, P_nMatrix);
}
function eraseDraw(P_mcRef, P_oMatrix) {
var _local2 = new flash.geom.ColorTransform(0, 0, 0, 1, 0, 0, 0, 0);
MainCTRL.__get__Instance()["oBitmapData" + mcRef._parent._name].draw(P_mcRef, P_oMatrix, _local2, "erase");
}
function clearBitmapData() {
}
var BITMAP_COLOR = 0;
}
Symbol 1110 MovieClip [__Packages.Player] Frame 0
class Player extends State
{
static var oPlayer;
var bKeyUp, bKeyDown, bKeyRight, bKeyLeft, doMoveLeft, doMoveRight, doMoveUp, doMoveDown, setState, sState, mcRef, nSpeed, nSpeedBonus, sMoveAxe, nMoveDir, nNextDest, isStateComplete, nSpeedBonusDelayDone, oCurrTile;
function Player (P_mcRef) {
super(P_mcRef);
bKeyUp = false;
bKeyDown = false;
bKeyRight = false;
bKeyLeft = false;
doMoveLeft = Library.Utils.Delegate.create(this, doMove);
doMoveRight = Library.Utils.Delegate.create(this, doMove);
doMoveUp = Library.Utils.Delegate.create(this, doMove);
doMoveDown = Library.Utils.Delegate.create(this, doMove);
oPlayer = this;
setState("Idle");
}
function doUnpausableEnterFrame() {
if (sState == "Win") {
this["do" + sState]();
}
}
static function get Instance() {
return(oPlayer);
}
function get Mc() {
return(mcRef);
}
function get isAttackable() {
var _local3;
var _local2 = Grid.__get__Instance().getTile(mcRef._x, mcRef._y);
if ((((_local2.tX != 0) && (_local2.tY != 0)) && (_local2.tX != Grid.__get__Instance().__get__MaxTile().MAX_X)) && (_local2.tY != Grid.__get__Instance().__get__MaxTile().MAX_Y)) {
if (sState.indexOf("Move") != -1) {
_local3 = true;
} else {
_local3 = false;
}
} else {
_local3 = false;
}
return(_local3);
}
function initMove() {
nSpeed = 4;
nSpeedBonus = 0;
sMoveAxe = "X";
nMoveDir = 1;
nNextDest = 0;
}
function doIdle() {
checkKey();
if (((bKeyUp || (bKeyDown)) || (bKeyLeft)) || (bKeyRight)) {
setMoveState();
getNextMove();
}
}
function doMove() {
checkKey();
setMoveState();
movePlayer();
}
function doWin() {
if (isStateComplete()) {
setState("WinIdle");
}
}
function doTeleport() {
if (isStateComplete()) {
setState("Idle");
}
}
function setMoveState() {
if ((sMoveAxe == "X") && (nMoveDir == 1)) {
setState("MoveRight");
}
if ((sMoveAxe == "X") && (nMoveDir == -1)) {
setState("MoveLeft");
}
if ((sMoveAxe == "Y") && (nMoveDir == 1)) {
setState("MoveDown");
}
if ((sMoveAxe == "Y") && (nMoveDir == -1)) {
setState("MoveUp");
}
}
function doDie() {
if (isStateComplete()) {
manageLive(-1);
}
}
function manageLive(P_nLive) {
MainCTRL.__get__Instance().__set__SetPlayerLive(MainCTRL.__get__Instance().__get__PlayerLive() + P_nLive);
if (MainCTRL.__get__Instance().__get__PlayerLive() < 0) {
GameCTRL.__get__Instance().endLevel(false);
} else {
HUD.__get__Instance().setLive();
if (P_nLive < 0) {
setState("Teleport");
}
}
}
function speedUp() {
nSpeedBonusDelayDone = 0;
nSpeedBonus++;
}
function manageSpeedBonus() {
nSpeedBonusDelayDone++;
if (nSpeedBonusDelayDone >= SPEED_BONUS_DELAY_TODO) {
nSpeedBonusDelayDone = 0;
nSpeedBonus--;
}
}
function movePlayer() {
if (nSpeedBonus > 0) {
manageSpeedBonus();
}
var _local2 = nSpeed + (nSpeedBonus * SPEED_BONUS);
if (sMoveAxe == "X") {
if (nMoveDir == 1) {
if ((mcRef._x + _local2) >= nNextDest) {
mcRef._x = nNextDest;
centerPlayer();
getNextMove();
} else {
mcRef._x = mcRef._x + _local2;
}
} else if (nMoveDir == -1) {
if ((mcRef._x - _local2) <= nNextDest) {
mcRef._x = nNextDest;
centerPlayer();
getNextMove();
} else {
mcRef._x = mcRef._x - _local2;
}
}
} else if (sMoveAxe == "Y") {
if (nMoveDir == 1) {
if ((mcRef._y + _local2) >= nNextDest) {
mcRef._y = nNextDest;
centerPlayer();
getNextMove();
} else {
mcRef._y = mcRef._y + _local2;
}
} else if (nMoveDir == -1) {
if ((mcRef._y - _local2) <= nNextDest) {
mcRef._y = nNextDest;
centerPlayer();
getNextMove();
} else {
mcRef._y = mcRef._y - _local2;
}
}
}
}
function centerPlayer(P_oTile) {
if (P_oTile == undefined) {
var _local2 = Grid.__get__Instance().getTileCenter(Grid.__get__Instance().getTile(mcRef._x, mcRef._y));
} else {
var _local2 = Grid.__get__Instance().getTileCenter(P_oTile);
}
mcRef._x = _local2.posX;
mcRef._y = _local2.posY;
oCurrTile.tX = P_oTile.tX;
oCurrTile.tY = P_oTile.tY;
}
function getNextMove() {
var _local2 = Grid.__get__Instance().getTile(mcRef._x, mcRef._y);
if ((oCurrTile.tX != _local2.tX) && (oCurrTile.tY != _local2.tY)) {
oCurrTile.tX = _local2.tX;
oCurrTile.tY = _local2.tY;
var _local4 = validTileObject({tX:_local2.tX, tY:_local2.tY});
} else {
var _local4 = true;
}
if (_local4) {
if ((bKeyUp == true) && (_local2.tY > 0)) {
sMoveAxe = "Y";
nMoveDir = -1;
_local2.tY = _local2.tY - 1;
} else if ((bKeyRight == true) && (_local2.tX < Grid.__get__Instance().__get__MaxTile().MAX_X)) {
sMoveAxe = "X";
nMoveDir = 1;
_local2.tX = _local2.tX + 1;
} else if ((bKeyDown == true) && (_local2.tY < Grid.__get__Instance().__get__MaxTile().MAX_Y)) {
sMoveAxe = "Y";
nMoveDir = 1;
_local2.tY = _local2.tY + 1;
} else if ((bKeyLeft == true) && (_local2.tX > 0)) {
sMoveAxe = "X";
nMoveDir = -1;
_local2.tX = _local2.tX - 1;
} else if (sMoveAxe == "X") {
_local2.tX = _local2.tX + nMoveDir;
if (_local2.tX < 0) {
_local2.tX = 0;
}
if (_local2.tX > Grid.__get__Instance().__get__MaxTile().MAX_X) {
_local2.tX = Grid.__get__Instance().__get__MaxTile().MAX_X;
}
} else if (sMoveAxe == "Y") {
_local2.tY = _local2.tY + nMoveDir;
if (_local2.tY < 0) {
_local2.tY = 0;
}
if (_local2.tY > Grid.__get__Instance().__get__MaxTile().MAX_Y) {
_local2.tY = Grid.__get__Instance().__get__MaxTile().MAX_Y;
}
}
var _local3 = Grid.__get__Instance().getTileCenter(_local2);
if (sMoveAxe == "X") {
nNextDest = _local3.posX;
} else if (sMoveAxe == "Y") {
nNextDest = _local3.posY;
}
}
}
function validTileObject(P_oTile) {
var _local2 = Grid.__get__Instance().getTileObject(P_oTile);
var _local3 = true;
if (_local2.sState == "Idle") {
_local2.setState("SmkAppear");
Grid.__get__Instance().managePlayerPath(P_oTile, false);
_local3 = true;
} else if (_local2.sState.indexOf("Smk") != -1) {
_local3 = false;
setState("Die");
} else if (((_local2.sState == "Empty") || (_local2.sState == "Zoned")) && (Grid.__get__Instance().__get__IsGridPathEmpty() == false)) {
GameCTRL.__get__Instance().setZoneFinder(true);
_local3 = false;
}
return(_local3);
}
function checkKey() {
checkKeyPressed();
checkKeyUnPressed();
}
function setKey(P_sKey, P_bPressed) {
this["bKey" + P_sKey] = P_bPressed;
}
function checkKeyPressed() {
if (GameCTRL.__get__Instance().__get__IsPaused() == false) {
if (Key.isDown(38)) {
setKey("Up", true);
} else if (Key.isDown(39)) {
setKey("Right", true);
} else if (Key.isDown(40)) {
setKey("Down", true);
} else if (Key.isDown(37)) {
setKey("Left", true);
}
}
}
function checkKeyUnPressed() {
if (!Key.isDown(38)) {
setKey("Up", false);
}
if (!Key.isDown(39)) {
setKey("Right", false);
}
if (!Key.isDown(40)) {
setKey("Down", false);
}
if (!Key.isDown(37)) {
setKey("Left", false);
}
}
function loadState() {
switch (sState) {
case "MoveLeft" :
break;
case "Teleport" :
initMove();
centerPlayer({tX:0, tY:0});
Grid.__get__Instance().managePlayerPath({}, true);
mcRef.swapDepths(GameCTRL.__get__Instance().returnDepth("Player"));
Library.Sound.SoundManager.doPlaySoundInCat("sfx", "sFx_teleport", 80, 1);
break;
case "Die" :
mcRef.swapDepths(GameCTRL.__get__Instance().returnDepth("PlayerDie"));
Library.Sound.SoundManager.doPlaySoundInCat("sfx", "sFx_die", 100, 1);
Grid.__get__Instance().managePlayerPath({}, true);
}
}
var SPEED_BONUS = 2;
var SPEED_BONUS_DELAY_TODO = 220;
}
Symbol 1111 MovieClip [__Packages.Collider] Frame 0
class Collider extends State
{
var mcRef, bSlow, sType, bHitNothing, aObjectCollide, nAngle, nSpeed;
function Collider (P_mcRef, P_bSlow, P_sType) {
super(mcRef);
bSlow = P_bSlow;
sType = P_sType;
bHitNothing = true;
aObjectCollide = [];
}
function detectCollision() {
bHitNothing = true;
aObjectCollide = [];
if (sType == "mcEnemyLaser") {
checkBorder();
}
if (bHitNothing) {
checkTile();
}
if (bHitNothing) {
moveEnemy();
}
}
function checkBorder() {
if (mcRef._y > LIMIT_BOTTOM) {
bHitNothing = false;
mcRef._y = LIMIT_BOTTOM - 3;
changeAngle(-nAngle);
} else if (mcRef._x > LIMIT_RIGHT) {
bHitNothing = false;
mcRef._x = LIMIT_RIGHT - 5;
var _local2 = nAngle / Math.abs(nAngle);
changeAngle((180 - Math.abs(nAngle)) * _local2);
} else if (mcRef._x < LIMIT_LEFT) {
bHitNothing = false;
mcRef._x = LIMIT_LEFT + 5;
var _local2 = nAngle / Math.abs(nAngle);
changeAngle((180 - Math.abs(nAngle)) * _local2);
} else if (mcRef._y < LIMIT_TOP) {
bHitNothing = false;
mcRef._y = LIMIT_TOP + 5;
changeAngle(-nAngle);
}
}
function checkTile() {
var _local3 = Grid.__get__Instance().getTile(mcRef._x, mcRef._y);
var _local2 = Grid.__get__Instance().getTileObject(_local3);
if (getCanMove(_local2.oTileE.sState) == false) {
detectObjectSide(_local2.oTileE);
}
if (getCanMove(_local2.oTileN.sState) == false) {
detectObjectSide(_local2.oTileN);
}
if (getCanMove(_local2.oTileS.sState) == false) {
detectObjectSide(_local2.oTileS);
}
if (getCanMove(_local2.oTileW.sState) == false) {
detectObjectSide(_local2.oTileW);
}
if (getCanMove(_local2.oTileNE.sState) == false) {
detectObjectSide(_local2.oTileNE);
}
if (getCanMove(_local2.oTileNW.sState) == false) {
detectObjectSide(_local2.oTileNW);
}
if (getCanMove(_local2.oTileSE.sState) == false) {
detectObjectSide(_local2.oTileSE);
}
if (getCanMove(_local2.oTileSW.sState) == false) {
detectObjectSide(_local2.oTileSW);
}
getNearestObject();
}
function detectObjectSide(P_oTile) {
var _local8 = nAngle * (Math.PI/180);
var _local12 = 1 * Math.cos(_local8);
var _local11 = 1 * Math.sin(_local8);
if (bSlow) {
var _local17 = (nSpeed / 2) * _local12;
var _local18 = (nSpeed / 2) * _local11;
} else {
var _local17 = nSpeed * _local12;
var _local18 = nSpeed * _local11;
}
var _local10 = P_oTile.mcRef._x;
var _local9 = P_oTile.mcRef._y;
var _local13 = P_oTile.nWidth;
var _local16 = P_oTile.nHeight;
var _local7 = mcRef._x;
var _local6 = mcRef._y;
var _local15 = mcRef._x - _local17;
var _local14 = mcRef._y - _local18;
var _local4 = fGetSlope(_local7, _local6, _local15, _local14);
var _local5 = _local6 - (_local4 * _local7);
var _local2 = new Object();
_local2.nLeft = _local10;
_local2.nRight = _local10 + _local13;
_local2.nBottom = _local9 + _local16;
_local2.nTop = _local9;
if ((nAngle >= 0) && (nAngle <= 90)) {
fDetectBottomSide(_local6, _local4, _local5, _local2, P_oTile);
fDetectRightSide(_local7, _local4, _local5, _local2, P_oTile);
} else if ((nAngle >= 90) && (nAngle <= 180)) {
fDetectBottomSide(_local6, _local4, _local5, _local2, P_oTile);
fDetectLeftSide(_local7, _local4, _local5, _local2, P_oTile);
} else if ((nAngle <= 0) && (nAngle >= -90)) {
fDetectTopSide(_local6, _local4, _local5, _local2, P_oTile);
fDetectRightSide(_local7, _local4, _local5, _local2, P_oTile);
} else if ((nAngle <= -90) && (nAngle >= -180)) {
fDetectTopSide(_local6, _local4, _local5, _local2, P_oTile);
fDetectLeftSide(_local7, _local4, _local5, _local2, P_oTile);
}
}
function getNearestObject() {
if (aObjectCollide.length != 0) {
var _local4;
var _local5;
var _local2 = 0;
while (_local2 <= aObjectCollide.length) {
if (aObjectCollide[_local2][0] != undefined) {
var _local3 = aObjectCollide[_local2][4];
if ((_local3 < _local4) || (_local4 == undefined)) {
_local4 = _local3;
_local5 = aObjectCollide[_local2];
}
}
_local2++;
}
bHitNothing = false;
switch (_local5[3]) {
case "Left" :
mcRef._x = _local5[1] - 1;
mcRef._y = _local5[2];
break;
case "Right" :
mcRef._x = _local5[1] + 1;
mcRef._y = _local5[2];
break;
case "Top" :
mcRef._x = _local5[1];
mcRef._y = _local5[2] - 1;
break;
case "Bottom" :
mcRef._x = _local5[1];
mcRef._y = _local5[2] + 1;
}
manageHit(_local5[3], _local5[0]);
}
}
function fGetSlope(X1, Y1, X2, Y2) {
var _local2 = (Y2 - Y1) / (X2 - X1);
if ((_local2 == Infinity) || (_local2 == (-Infinity))) {
_local2 = mcRef._y;
}
return(_local2);
}
function fDetectRightSide(X1, nPente, nOriginY, objBBox, P_obj) {
if (X1 >= objBBox.nRight) {
var _local3 = (nPente * objBBox.nRight) + nOriginY;
if ((_local3 >= objBBox.nTop) && (_local3 <= objBBox.nBottom)) {
var _local4 = Math.sqrt(Math.pow(objBBox.nRight - X1, 2) + Math.pow(_local3 - mcRef._y, 2));
if (_local4 < nSpeed) {
aObjectCollide.push([P_obj, objBBox.nRight, _local3, "Right", _local4]);
}
}
}
}
function fDetectBottomSide(Y1, nPente, nOriginY, objBBox, P_obj) {
if (Y1 >= objBBox.nBottom) {
var _local3 = (objBBox.nBottom - nOriginY) / nPente;
if ((_local3 >= objBBox.nLeft) && (_local3 <= objBBox.nRight)) {
var _local4 = Math.sqrt(Math.pow(_local3 - mcRef._x, 2) + Math.pow(objBBox.nBottom - Y1, 2));
if (_local4 < nSpeed) {
aObjectCollide.push([P_obj, _local3, objBBox.nBottom, "Bottom", _local4]);
}
}
}
}
function fDetectLeftSide(X1, nPente, nOriginY, objBBox, P_obj) {
if (X1 <= objBBox.nLeft) {
var _local3 = (nPente * objBBox.nLeft) + nOriginY;
if ((_local3 >= objBBox.nTop) && (_local3 <= objBBox.nBottom)) {
var _local4 = Math.sqrt(Math.pow(objBBox.nLeft - X1, 2) + Math.pow(_local3 - mcRef._y, 2));
if (_local4 < nSpeed) {
aObjectCollide.push([P_obj, objBBox.nLeft, _local3, "Left", _local4]);
}
}
}
}
function fDetectTopSide(Y1, nPente, nOriginY, objBBox, P_obj) {
if (Y1 <= objBBox.nTop) {
var _local3 = (objBBox.nTop - nOriginY) / nPente;
if ((_local3 >= objBBox.nLeft) && (_local3 <= objBBox.nRight)) {
var _local4 = Math.sqrt(Math.pow(_local3 - mcRef._x, 2) + Math.pow(objBBox.nTop - Y1, 2));
if (_local4 < nSpeed) {
aObjectCollide.push([P_obj, _local3, objBBox.nTop, "Top", _local4]);
}
}
}
}
function changeAngle() {
}
function manageHit() {
}
function getCanMove() {
}
function moveEnemy() {
}
var LIMIT_BOTTOM = 340;
var LIMIT_LEFT = 32;
var LIMIT_RIGHT = 465;
var LIMIT_TOP = 45;
}
Symbol 1112 MovieClip [__Packages.Enemy] Frame 0
class Enemy extends Collider
{
var mcRef, bSlow, sType, bFaceRight, nSpeed, nHitRange, setState, detectCollision, isStateComplete, aEnemyLaser, nAngle, nVelocityX, nVelocityY, sState;
function Enemy (P_mcRef, P_sType) {
super(mcRef, bSlow, sType);
mcRef = P_mcRef;
sType = P_sType;
bSlow = false;
bFaceRight = true;
nSpeed = (2.5 + (random(2) * 0.25)) + Math.floor((_global.HS_Level / 3) * 0.25);
if (nSpeed >= 5) {
nSpeed = 5;
}
if ((sType == "mcEnemyDuck") || (sType == "mcEnemyHoover")) {
nHitRange = 15;
}
if ((sType == "mcEnemyPorky") || (sType == "mcEnemyRocket")) {
nHitRange = 12;
}
if (sType == "mcEnemyLaser") {
nHitRange = 10;
}
var _local4 = random(180) * ((random(3) - 2) + 1);
if ((_local4 >= 0) && (_local4 < 10)) {
_local4 = 10;
}
if ((_local4 < 0) && (_local4 > -10)) {
_local4 = -10;
}
if ((_local4 >= 80) && (_local4 < 90)) {
_local4 = 80;
}
if ((_local4 >= 90) && (_local4 < 100)) {
_local4 = 100;
}
if ((_local4 > 170) && (_local4 <= 180)) {
_local4 = 170;
}
if ((_local4 < -170) && (_local4 >= -180)) {
_local4 = -170;
}
if ((_local4 < -80) && (_local4 > -90)) {
_local4 = -80;
}
if ((_local4 < -90) && (_local4 > -100)) {
_local4 = -100;
}
changeAngle(_local4);
setState("Move");
}
function doFreeze() {
doHitTest();
}
function doSlow() {
detectCollision();
doHitTest();
}
function doMove() {
detectCollision();
doHitTest();
}
function doAttack() {
if (isStateComplete()) {
setState("Move");
}
}
function clearData() {
GameCTRL.__get__Instance().removeInstance(mcRef);
GameCTRL.__get__Instance().removeBroadcastObj(this);
GameCTRL.__get__Instance().removeObject(this);
}
function manageHit(P_nDirection, P_oTile) {
if ((P_oTile.sState == "SmkAppear") || (P_oTile.sState == "SmkIdle")) {
P_oTile.setState("SmkStartBurn");
Library.Sound.SoundManager.doPlaySoundInCat("sfx", "sFx_flame", 100, 1);
} else if ((P_oTile.sState == "Empty") && ((sType == "mcEnemyDuck") || (sType == "mcEnemyHoover"))) {
var _local2 = true;
aEnemyLaser = [];
GameCTRL.__get__Instance().doBroadcast("isEnemyLaser", "oBroadcaster", this);
for (var _local3 in aEnemyLaser) {
if (Library.Utils.MoreMath.getDistance(mcRef._x, mcRef._y, aEnemyLaser[_local3].mcRef._x, aEnemyLaser[_local3].mcRef._y) < REBUILD_VS_LASER_DISTANCE) {
_local2 = false;
break;
}
}
aEnemyLaser = [];
if (_local2) {
GameCTRL.__get__Instance().manageRebuild();
P_oTile.rebuildTerrain(true);
}
}
switch (P_nDirection) {
case "Bottom" :
case "Top" :
changeAngle(-nAngle);
break;
case "Right" :
case "Left" :
var _local5 = nAngle / Math.abs(nAngle);
changeAngle((180 - Math.abs(nAngle)) * _local5);
}
}
function addLaser(P_objRef) {
aEnemyLaser.push(P_objRef);
}
function moveEnemy() {
if (bSlow == false) {
mcRef._x = mcRef._x - nVelocityX;
mcRef._y = mcRef._y - nVelocityY;
} else {
mcRef._x = mcRef._x - (nVelocityX / 2);
mcRef._y = mcRef._y - (nVelocityY / 2);
}
}
function getCanMove(_sState) {
var _local2 = true;
if (sType == "mcEnemyLaser") {
if (_sState != "Empty") {
_local2 = false;
}
} else if (_sState == "Idle") {
_local2 = true;
} else {
_local2 = false;
}
return(_local2);
}
function changeAngle(_nAngle) {
if (sType == "mcEnemyRocket") {
mcRef._rotation = _nAngle;
} else if ((bFaceRight == false) && (((_nAngle >= 90) && (_nAngle <= 180)) || ((_nAngle <= -90) && (_nAngle >= -180)))) {
bFaceRight = true;
mcRef._xscale = mcRef._xscale * -1;
} else if (bFaceRight && (((_nAngle >= 0) && (_nAngle <= 90)) || ((_nAngle <= 0) && (_nAngle >= -90)))) {
bFaceRight = false;
mcRef._xscale = mcRef._xscale * -1;
}
nAngle = _nAngle;
var _local3 = nAngle * (Math.PI/180);
var _local4 = 1 * Math.cos(_local3);
var _local5 = 1 * Math.sin(_local3);
nVelocityX = nSpeed * _local4;
nVelocityY = nSpeed * _local5;
}
function doHitTest() {
if (Player.__get__Instance().__get__isAttackable() == true) {
var _local2 = Math.sqrt(Math.pow(Math.abs(mcRef._x - Player.__get__Instance().__get__Mc()._x), 2) + Math.pow(Math.abs(mcRef._y - Player.__get__Instance().__get__Mc()._y), 2));
if (_local2 <= nHitRange) {
switch (sType) {
case "mcEnemyLaser" :
mcRef._x = Player.__get__Instance().__get__Mc()._x;
mcRef._y = Player.__get__Instance().__get__Mc()._y + 5;
Player.__get__Instance().setState("Die");
setState("Attack");
break;
default :
Player.__get__Instance().setState("Die");
}
}
}
}
function getFreeze() {
if ((sType != "mcEnemyLaser") && (sState == "Move")) {
setState("Freeze");
}
}
function unFreeze() {
if (sType != "mcEnemyLaser") {
setState("Move");
}
}
function getSlow() {
if ((sType != "mcEnemyLaser") && (sState == "Move")) {
setState("Slow");
bSlow = true;
}
}
function unSlow() {
if (sType != "mcEnemyLaser") {
setState("Move");
}
bSlow = false;
}
function isZoned(P_aZoneArray) {
var _local3 = false;
var _local4 = Grid.__get__Instance().getTileObject(Grid.__get__Instance().getTile(mcRef._x, mcRef._y));
if (Grid.__get__Instance().__get__IsEnemyZoned() == false) {
for (var _local5 in P_aZoneArray) {
if (Grid.__get__Instance().getTileObject(P_aZoneArray[_local5]).mcRef == _local4.mcRef) {
_local3 = true;
break;
}
}
} else {
_local3 = true;
}
Grid.__get__Instance().__set__EnemyZoned(_local3);
}
function isEnemyLaser(P_objRef) {
if (sType == "mcEnemyLaser") {
P_objRef.addLaser(this);
}
}
function loadState() {
switch (sState) {
case "Appear" :
break;
case "Move" :
mcRef.swapDepths(GameCTRL.__get__Instance().returnDepth("Enemy"));
break;
case "Attack" :
Library.Sound.SoundManager.doPlaySoundInCat("sfx", "sFx_laser", 100, 1);
mcRef.swapDepths(GameCTRL.__get__Instance().returnDepth("Laser"));
break;
case "Disappear" :
}
}
var REBUILD_VS_LASER_DISTANCE = 30;
}
Symbol 1113 MovieClip [__Packages.BonusItem] Frame 0
class BonusItem extends State
{
var sType, setState, sState, mcRef, isStateComplete;
function BonusItem (P_mcRef, P_sType) {
super(P_mcRef);
sType = P_sType;
setState("Appear");
}
function doUnpausableEnterFrame() {
if ((sState == "Disappear") && (Popup.__get__Instance().__get__CurrentState().indexOf("Bonus") != -1)) {
mcRef.mcState.play();
this["do" + sState]();
}
}
function doAppear() {
if (isStateComplete()) {
setState("Idle");
}
}
function doIdle() {
doHitTest();
}
function doDisappear() {
if (isStateComplete()) {
clearData();
}
}
function clearData() {
GameCTRL.__get__Instance().removeInstance(mcRef);
GameCTRL.__get__Instance().removeBroadcastObj(this);
GameCTRL.__get__Instance().removeObject(this);
}
function doHitTest() {
var _local2 = Grid.__get__Instance().getTile(mcRef._x, mcRef._y);
var _local3 = Grid.__get__Instance().getTile(Player.__get__Instance().__get__Mc()._x, Player.__get__Instance().__get__Mc()._y);
if ((_local2.tX == _local3.tX) && (_local2.tY == _local3.tY)) {
switch (sType) {
case "mcBonusLive" :
Player.__get__Instance().manageLive(1);
Library.Sound.SoundManager.doPlaySoundInCat("sfx", "sFx_bonusLife", 100, 1);
break;
case "mcBonusFreeze" :
GameCTRL.__get__Instance().getEnemyFreeze();
Library.Sound.SoundManager.doPlaySoundInCat("sfx", "sFx_bonusFreeze", 100, 1);
break;
case "mcBonusSlow" :
GameCTRL.__get__Instance().getEnemySlow();
Library.Sound.SoundManager.doPlaySoundInCat("sfx", "sFx_bonusSlow", 100, 1);
break;
case "mcBonusSpeed" :
Library.Sound.SoundManager.doPlaySoundInCat("sfx", "sFx_bonusSpeed", 100, 1);
Player.__get__Instance().speedUp();
}
GameCTRL.__get__Instance().managePoint(POINT_VALUE);
var _local4 = {posX:mcRef._x, posY:mcRef._y};
GameCTRL.__get__Instance().addScoreFX(POINT_VALUE, 0, _local4);
setState("Disappear");
}
}
function loadState() {
switch (sState) {
case "Appear" :
Library.Sound.SoundManager.doPlaySoundInCat("sfx", "sFx_itemAppear", 30, 1);
break;
case "Idle" :
break;
case "Disappear" :
}
}
var POINT_VALUE = 100;
}
Symbol 1114 MovieClip [__Packages.BonusScore] Frame 0
class BonusScore extends State
{
var nScore, nMultiplier, setState, mcRef, sState, isStateComplete;
function BonusScore (P_mcRef, P_nScore, P_nMultiplier) {
super(P_mcRef);
nScore = P_nScore;
nMultiplier = P_nMultiplier;
setState("Idle");
}
function doUnpausableEnterFrame() {
if (Popup.__get__Instance().__get__CurrentState().indexOf("Bonus") != -1) {
mcRef.mcState.play();
this["do" + sState]();
}
}
function doIdle() {
if (isStateComplete()) {
GameCTRL.__get__Instance().removeInstance(mcRef);
GameCTRL.__get__Instance().removeBroadcastObj(this);
}
}
function loadState() {
if (nMultiplier > 1) {
mcRef.mcState.mcScore.sMultiplier = "x" + nMultiplier;
} else {
mcRef.mcState.mcScore.sMultiplier = "";
}
mcRef.mcState.mcScore.sScore = nScore;
}
}
Symbol 37 MovieClip Frame 2
stop();
Symbol 124 MovieClip [mcTile] Frame 40
var _oTile = Grid.__get__Instance().getTileObject(Grid.__get__Instance().getTile(_x, _y));
_oTile.setState("Empty");
Instance of Symbol 54 MovieClip "mcState" in Symbol 124 MovieClip [mcTile] Frame 41
onClipEvent (load) {
gotoAndPlay(random(_totalframes) + 1);
}
Instance of Symbol 58 MovieClip "mcState" in Symbol 124 MovieClip [mcTile] Frame 61
onClipEvent (load) {
gotoAndPlay(random(_totalframes) + 1);
}
Instance of Symbol 54 MovieClip "mcState" in Symbol 216 MovieClip Frame 4
onClipEvent (load) {
gotoAndPlay(random(_totalframes) + 1);
}
Instance of Symbol 54 MovieClip "mcState" in Symbol 216 MovieClip Frame 7
onClipEvent (load) {
gotoAndPlay(random(_totalframes) + 1);
}
Instance of Symbol 54 MovieClip "mcState" in Symbol 216 MovieClip Frame 16
onClipEvent (load) {
gotoAndPlay(random(_totalframes) + 1);
}
Instance of Symbol 54 MovieClip "mcState" in Symbol 230 MovieClip Frame 4
onClipEvent (load) {
gotoAndPlay(random(_totalframes) + 1);
}
Instance of Symbol 54 MovieClip "mcState" in Symbol 230 MovieClip Frame 7
onClipEvent (load) {
gotoAndPlay(random(_totalframes) + 1);
}
Instance of Symbol 54 MovieClip "mcState" in Symbol 230 MovieClip Frame 16
onClipEvent (load) {
gotoAndPlay(random(_totalframes) + 1);
}
Instance of Symbol 54 MovieClip "mcState" in Symbol 287 MovieClip Frame 4
onClipEvent (load) {
gotoAndPlay(random(_totalframes) + 1);
}
Instance of Symbol 54 MovieClip "mcState" in Symbol 287 MovieClip Frame 7
onClipEvent (load) {
gotoAndPlay(random(_totalframes) + 1);
}
Instance of Symbol 54 MovieClip "mcState" in Symbol 287 MovieClip Frame 16
onClipEvent (load) {
gotoAndPlay(random(_totalframes) + 1);
}
Instance of Symbol 54 MovieClip "mcState" in Symbol 296 MovieClip Frame 4
onClipEvent (load) {
gotoAndPlay(random(_totalframes) + 1);
}
Instance of Symbol 54 MovieClip "mcState" in Symbol 296 MovieClip Frame 7
onClipEvent (load) {
gotoAndPlay(random(_totalframes) + 1);
}
Instance of Symbol 54 MovieClip "mcState" in Symbol 296 MovieClip Frame 16
onClipEvent (load) {
gotoAndPlay(random(_totalframes) + 1);
}
Symbol 384 MovieClip Frame 1
this.swapDepths(666);
this.removeMovieClip();
Symbol 423 Button
on (rollOver) {
MainCTRL.__get__Instance().playBtnSnd("Over");
}
on (release) {
MainCTRL.__get__Instance().playBtnSnd("Down");
MainCTRL.__get__Instance().resumeHelp();
}
Symbol 427 Button
on (rollOver) {
MainCTRL.__get__Instance().playBtnSnd("Over");
}
on (release) {
MainCTRL.__get__Instance().playBtnSnd("Down");
nextFrame();
}
Symbol 441 Button
on (rollOver) {
MainCTRL.__get__Instance().playBtnSnd("Over");
}
on (release) {
MainCTRL.__get__Instance().playBtnSnd("Down");
prevFrame();
}
Symbol 451 MovieClip Frame 1
stop();
Symbol 474 Button
on (rollOver) {
MainCTRL.__get__Instance().playBtnSnd("Over");
}
on (release) {
MainCTRL.__get__Instance().playBtnSnd("Down");
MainCTRL.__get__Instance().resumeMenu();
}
Symbol 478 Button
on (rollOver) {
MainCTRL.__get__Instance().playBtnSnd("Over");
}
on (release) {
MainCTRL.__get__Instance().playBtnSnd("Down");
MainCTRL.__get__Instance().getHelp(true);
}
Symbol 484 Button
on (rollOver) {
MainCTRL.__get__Instance().playBtnSnd("Over");
}
on (release) {
MainCTRL.__get__Instance().playBtnSnd("Down");
MainCTRL.__get__Instance().getQuit();
}
Symbol 489 Button
on (rollOver) {
MainCTRL.__get__Instance().playBtnSnd("Over");
}
on (release) {
MainCTRL.__get__Instance().playBtnSnd("Down");
MainCTRL.__get__Instance().muteGameSnd();
gotoAndStop ("Off");
}
Symbol 493 Button
on (rollOver) {
MainCTRL.__get__Instance().playBtnSnd("Over");
}
on (release) {
MainCTRL.__get__Instance().playBtnSnd("Down");
MainCTRL.__get__Instance().unMuteGameSnd();
gotoAndStop ("On");
}
Symbol 494 MovieClip Frame 1
stop();
Instance of Symbol 494 MovieClip in Symbol 495 MovieClip Frame 1
onClipEvent (load) {
if (MainCTRL.__get__Instance().getMuteSnd() == true) {
gotoAndStop ("Off");
}
}
Symbol 507 Button
on (rollOver) {
MainCTRL.__get__Instance().playBtnSnd("Over");
}
on (release) {
MainCTRL.__get__Instance().playBtnSnd("Down");
MainCTRL.__get__Instance().quitGame();
}
Symbol 510 Button
on (rollOver) {
MainCTRL.__get__Instance().playBtnSnd("Over");
}
on (release) {
MainCTRL.__get__Instance().playBtnSnd("Down");
MainCTRL.__get__Instance().cancelQuit();
}
Symbol 530 Button
on (rollOver) {
MainCTRL.__get__Instance().playBtnSnd("Over");
}
on (release) {
MainCTRL.__get__Instance().playBtnSnd("Down");
Popup.__get__Instance().setState("EndBonus");
}
Symbol 539 MovieClip Frame 1
gotoAndStop(_parent.nTipFrame);
Instance of Symbol 539 MovieClip in Symbol 540 MovieClip Frame 5
onClipEvent (load) {
_parent.nTipFrame = random(this._totalframes) + 1;
gotoAndStop(_parent.nTipFrame);
}
Symbol 540 MovieClip Frame 21
stop();
Symbol 550 MovieClip Frame 19
Library.Sound.SoundManager.doPlaySoundInCat("sfx", "sFx_transitionStart", 100, 1);
Symbol 553 MovieClip Frame 2
Library.Sound.SoundManager.doPlaySoundInCat("sfx", "sFx_transitionEnd", 50, 1);
Symbol 576 MovieClip Frame 1
stop();
Symbol 576 MovieClip Frame 2
gotoAndStop (1);
Symbol 602 MovieClip Frame 308
Transition.__get__Instance().setTransition("title");
Symbol 602 MovieClip Frame 352
stop();
Symbol 737 Button
on (rollOver) {
MainCTRL.__get__Instance().playBtnSnd("Over");
}
on (release) {
MainCTRL.__get__Instance().playBtnSnd("Down");
Transition.__get__Instance().setTransition("intro");
}
Symbol 739 Button
on (rollOver) {
MainCTRL.__get__Instance().playBtnSnd("Over");
}
on (release) {
MainCTRL.__get__Instance().playBtnSnd("Down");
Transition.__get__Instance().setTransition("instruction");
}
Symbol 795 Button
on (rollOver) {
MainCTRL.__get__Instance().playBtnSnd("Over");
}
on (release) {
MainCTRL.__get__Instance().playBtnSnd("Down");
Transition.__get__Instance().setTransition("levelStart");
}
Symbol 890 Button
on (rollOver) {
MainCTRL.__get__Instance().playBtnSnd("Over");
}
on (release) {
MainCTRL.__get__Instance().playBtnSnd("Down");
Transition.__get__Instance().setTransition("levelStart");
}
Symbol 893 MovieClip Frame 1
stop();
Symbol 916 Button
on (rollOver) {
MainCTRL.__get__Instance().playBtnSnd("Over");
}
on (release) {
MainCTRL.__get__Instance().playBtnSnd("Down");
MainCTRL.__get__Instance().getMenu();
}
Symbol 1118 Button
on (release) {
_root.Tay = _global.HS_Score;
_global.ipbSend();
stop();
}