Frame 1
function tvc_tracker(url, media_id, format) {
tvc_lv = new LoadVars();
tvc_lv.media = media_id;
tvc_lv.f = format;
trace("media: " + media_id);
return(tvc_lv.sendAndLoad(url, tvc_lv, "get"));
}
Stage.height = 700;
Stage.width = 550;
System.security.allowDomain("*");
var container = createEmptyMovieClip("server_mc", -16432);
var mcLoader = new MovieClipLoader();
mcLoader.loadClip("http://cognition.viral-game.co.uk/scoreboard.swf", container);
System.security.allowDomain("*");
kv_v = {c:327, a:0, da:["distralytics.com", "distralytics.co.uk"]};
kv_v.i = 0;
while (kv_v.i < kv_v.da.length) {
System.security.allowDomain(kv_v.da[kv_v.i], (kv_v.c + ".c.") + kv_v.da[kv_v.i], "*." + kv_v.da[kv_v.i]);
kv_v.i++;
}
kv_v.lc = function () {
var _local1 = ((("http://" + kv_v.c) + ".c.") + kv_v.da[kv_v.a % kv_v.da.length]) + kv_v.lurl;
System.security.allowDomain(_local1);
kv_v.l_mcl.loadClip(_local1, kv_v.t_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_v.fpv = getVersion().split(" ")[1].split(",")[0];
kv_v.lurl = "/control/tracking/tracker.swf?r=" + Math.floor(Math.random() * 10000);
kv_v.t_mc = createEmptyMovieClip("kv_tracker", -16734);
kv_v.l_mcl = new MovieClipLoader();
kv_v.mcl_l = {onLoadError:function () {
kv_v.a++;
kv_v.lc();
}, onLoadStart:function (m) {
System.security.allowDomain(m._url);
}};
kv_v.l_mcl.addListener(kv_v.mcl_l);
kv_v.lc();
System.security.allowDomain("*");
strUrl = ((url != null) ? (url) : "http://www.viralchart.com");
_root.tvc_media = 768;
if ((_root.tvc_media != null) && (_root.tvc_media != "")) {
_root.tvc_media = (tvc_tracker(strUrl + "/tracker.php", _root.tvc_media, "F") ? null : (_root.tvc_media));
}
Frame 2
stop();
Frame 8
stop();
Frame 9
mainLoop = new Sound();
mainLoop.attachSound("musicloop");
mainLoopFast = new Sound();
mainLoopFast.attachSound("musicloopfast");
mainLoopSlow = new Sound();
mainLoopSlow.attachSound("musicloopslow");
collect_snd = new Sound();
collect_snd.attachSound("collectSound");
collect1_snd = new Sound();
collect1_snd.attachSound("beepSound");
endGame_snd = new Sound();
endGame_snd.attachSound("endGame");
reward_snd = new Sound();
reward_snd.attachSound("rewardSND");
global_snd = new Sound(this);
mute = false;
sound_mc.onPress = function () {
if (!mute) {
_root.kvEvent(506);
mute = true;
global_snd.setVolume(0);
this.gotoAndStop(30);
} else {
mute = false;
global_snd.setVolume(100);
this.gotoAndPlay(1);
}
};
Instance of Symbol 194 MovieClip "challenge_mc" in Frame 9
onClipEvent (load) {
this._visible = false;
}
Frame 28
stopAllSounds();
mainLoop.start(0, 9999);
stop();
Frame 30
mainGame_mc.resetGame();
Frame 36
stop();
Instance of Symbol 352 MovieClip "pausedGame_mc" in Frame 36
onClipEvent (load) {
this._visible = false;
}
Frame 37
gotoAndStop (28);
Symbol 13 MovieClip [tile] Frame 1
stop();
Symbol 21 MovieClip Frame 1
Symbol 29 MovieClip Frame 1
stop();
Symbol 29 MovieClip Frame 100
if (!_parent._parent.slowAI) {
_parent._parent.ai1.spawning = true;
_parent._parent.ai1.mc.gotoAndStop(5);
}
Symbol 29 MovieClip Frame 101
gotoAndPlay (100);
Symbol 36 MovieClip Frame 1
Symbol 39 MovieClip Frame 1
Symbol 39 MovieClip Frame 20
_parent._parent.spawnNewAi();
Symbol 40 MovieClip [AI] Frame 1
stop();
Symbol 46 MovieClip Frame 1
Symbol 56 MovieClip Frame 1
Symbol 57 MovieClip [char] Frame 1
stop();
Symbol 64 MovieClip [fightCloud] Frame 1
stop();
Symbol 64 MovieClip [fightCloud] Frame 57
if (_parent.lives != 0) {
_parent.resetSprites();
_parent.lostLife = false;
} else {
_parent.timeBonus = 0;
_parent.level = 6;
_parent.gameOver = true;
_parent.endGame();
}
Symbol 65 MovieClip [disappearCloud] Frame 15
removeMovieClip(this);
Symbol 84 MovieClip Frame 1
stop();
Symbol 94 MovieClip Frame 1
preloader = function () {
var _local4 = _root.getBytesLoaded();
var _local3 = _root.getBytesTotal();
var _local5 = Math.ceil((_local4 / _local3) * 100);
loaderBar_mc.gotoAndStop(_local5);
if (_local4 == _local3) {
clearInterval(preloaderINT);
_parent.play();
}
};
preloaderINT = setInterval(preloader, 40);
Symbol 101 MovieClip Frame 62
stop();
Symbol 104 MovieClip Frame 128
_root.play();
trace("END");
Symbol 104 MovieClip Frame 129
stop();
Symbol 110 Button
on (release) {
_root.kvEvent(453);
getURL ("http://www.kokodigital.co.uk", _blank);
}
Symbol 111 MovieClip Frame 65
stop();
Symbol 112 MovieClip Frame 2
stop();
Instance of Symbol 72 MovieClip in Symbol 112 MovieClip Frame 2
onClipEvent (load) {
this._width = Stage.width;
this._height = Stage.height;
}
Instance of Symbol 74 MovieClip in Symbol 112 MovieClip Frame 2
onClipEvent (load) {
this._width = Stage.width;
this._height = (Stage.height / 5) * 4;
}
Instance of Symbol 76 MovieClip in Symbol 112 MovieClip Frame 2
onClipEvent (load) {
this._width = Stage.width;
this._y = Stage.height / 2;
}
Instance of Symbol 94 MovieClip in Symbol 112 MovieClip Frame 2
onClipEvent (load) {
this._x = Stage.width / 2;
this._y = Stage.height / 2;
}
Symbol 112 MovieClip Frame 3
stop();
Instance of Symbol 102 MovieClip in Symbol 112 MovieClip Frame 3
onClipEvent (load) {
this._x = Stage.width / 2;
this._y = Stage.height / 2;
}
Instance of Symbol 104 MovieClip in Symbol 112 MovieClip Frame 3
onClipEvent (load) {
this._x = Stage.width / 2;
this._y = Stage.height / 2;
}
Instance of Symbol 111 MovieClip in Symbol 112 MovieClip Frame 3
onClipEvent (load) {
this._x = Stage.width / 2;
this._y = (Stage.height / 2) + 60;
}
Symbol 121 MovieClip Frame 115
_parent.play();
stop();
Symbol 142 Button
on (release) {
_parent.play();
}
Symbol 147 Button
on (release) {
_root.kvEvent(495);
getURL ("http://www.t-f-m.co.uk/moreinfo/", "_blank");
}
Symbol 151 Button
on (release) {
_root.challenge_mc._visible = true;
}
Symbol 154 Button
on (release) {
_root.kvEvent(497);
nextFrame();
}
Symbol 155 Button
on (release) {
_root.kvEvent(495);
getURL ("http://www.t-f-m.co.uk/moreinfo/", "_blank");
}
Symbol 159 Button
on (release) {
nextFrame();
}
Symbol 169 MovieClip Frame 1
stop();
Symbol 169 MovieClip Frame 2
stop();
Symbol 169 MovieClip Frame 3
stop();
Symbol 169 MovieClip Frame 4
stop();
Symbol 169 MovieClip Frame 5
stop();
Symbol 186 Button
on (release) {
if (yourName.text == "") {
error = "PLEASE ENTER YOUR NAME";
}
if (yourEmail.text == "") {
error = "PLEASE ENTER YOUR EMAIL ADDRESS";
}
if (friendName.text == "") {
error = "PLEASE ENTER YOUR FRIENDS NAME";
}
if (friendEmail.text == "") {
error = "PLEASE ENTER YOUR FRIENDS EMAIL ADDRESS";
}
if (((((!allowSend) && (yourName.text != "")) && (yourEmail.text != "")) && (friendEmail.text != "")) && (friendName.text != "")) {
allowSend = true;
_root.kvEvent(499);
var sendMailReq = new LoadVars();
sendMailReq.onLoad = function (success) {
if (success) {
trace("MAIL SENT");
} else {
trace("FAIL");
}
};
var sendMail = new LoadVars();
sendMail.yourname = yourName.text;
sendMail.youremail = yourEmail.text;
sendMail.friendemail = friendEmail.text;
sendMail.friendname = friendName.text;
sendMail.sendAndLoad("http://cognition.viral-game.co.uk/email/mail.php", sendMailReq, "POST");
var sendMailReq1 = new LoadVars();
sendMailReq1.onLoad = function (success) {
if (success) {
trace("MAIL SENT1");
}
};
var sendMail1 = new LoadVars();
sendMail1.email = yourEmail.text;
sendMail1.sendAndLoad("http://cognition.viral-game.co.uk/logemail.php", sendMailReq1, "POST");
var sendMailReq2 = new LoadVars();
sendMailReq2.onLoad = function (success) {
if (success) {
trace("MAIL SENT1");
}
};
var sendMail2 = new LoadVars();
sendMail2.email = friendEmail.text;
sendMail2.sendAndLoad("http://cognition.viral-game.co.uk/logemail.php", sendMailReq2, "POST");
error = "";
allowSend = false;
friendName.text = "";
friendEmail.text = "";
gotoAndPlay (2);
}
}
Symbol 191 Button
on (release) {
this._visible = false;
}
Symbol 194 MovieClip Frame 1
stop();
Symbol 194 MovieClip Frame 17
stop();
Symbol 196 Button
on (release) {
_root.kvEvent(496);
getURL ("http://www.kokodigital.co.uk", _blank);
}
Symbol 200 MovieClip Frame 20
gotoAndPlay (1);
Symbol 200 MovieClip Frame 29
stop();
Symbol 206 MovieClip Frame 1
stop();
Symbol 206 MovieClip Frame 7
gotoAndPlay (2);
Symbol 217 MovieClip Frame 1
stop();
Symbol 255 MovieClip Frame 400
gotoAndPlay (1);
Symbol 268 MovieClip Frame 1
gotoAndStop(Math.ceil(Math.random() * 2) + 1);
Symbol 268 MovieClip Frame 2
stop();
Symbol 268 MovieClip Frame 3
stop();
Symbol 269 MovieClip Frame 15
if (Math.random() < 0.8) {
gotoAndPlay (1);
}
Symbol 274 MovieClip Frame 1
gotoAndStop(Math.ceil(Math.random() * 2) + 1);
Symbol 274 MovieClip Frame 2
stop();
Symbol 274 MovieClip Frame 3
stop();
Symbol 275 MovieClip Frame 15
if (Math.random() < 0.8) {
gotoAndPlay (1);
}
Symbol 284 Button
on (release) {
_root.kvEvent(496);
getURL ("http://www.kokodigital.co.uk", "_blank");
}
Symbol 288 MovieClip Frame 1
stop();
Symbol 294 Button
on (release) {
pauseGame();
}
Symbol 301 Button
on (release) {
_parent.play();
}
Symbol 317 Button
on (release) {
if (((_root.globalPos <= 50) && (_root.globalPos != "ERROR")) && (_root.globalPos != "CONNECTING")) {
gotoAndStop (7);
} else {
gotoAndStop (8);
}
}
Symbol 326 Button
on (release) {
_root.server_mc.submitName(playerName.text);
}
Symbol 338 MovieClip Frame 1
_root.server_mc.parseScoresXML();
Symbol 338 MovieClip Frame 95
_root.allowScroll = true;
stop();
Symbol 339 Button
on (release) {
_root.gotoAndStop(28);
}
Symbol 340 MovieClip Frame 1
stop();
Symbol 340 MovieClip Frame 2
stop();
Symbol 340 MovieClip Frame 3
stop();
Symbol 340 MovieClip Frame 4
stop();
Symbol 340 MovieClip Frame 5
_root.totalPoints = _parent._parent.totalPoints;
_parent._parent.gameOver = true;
_root.sessionID = 0;
_root.globalPos = 0;
_root.server_mc.submitScore();
_root.kvEvent(505);
stop();
Symbol 340 MovieClip Frame 6
_root.totalPoints = _parent._parent.totalPoints;
_parent._parent.gameOver = true;
_root.sessionID = 0;
_root.globalPos = 0;
_root.server_mc.submitScore();
_root.kvEvent(505);
stop();
Symbol 340 MovieClip Frame 7
stop();
Symbol 341 MovieClip Frame 1
stop();
Symbol 341 MovieClip Frame 2
levelComp_mc.gotoAndStop(_parent.level);
Symbol 341 MovieClip Frame 11
stop();
Symbol 341 MovieClip Frame 19
_parent.level++;
_parent.resetGame();
Symbol 341 MovieClip Frame 20
gotoAndStop (1);
Symbol 341 MovieClip Frame 21
levelComp_mc.gotoAndStop(7);
Symbol 342 MovieClip Frame 1
function template() {
r0 = new Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1);
r1 = new Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
r2 = new Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
r3 = new Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
r4 = new Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
r5 = new Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
r6 = new Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
r7 = new Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
r8 = new Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
r9 = new Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
r10 = new Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
r11 = new Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
r12 = new Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
r13 = new Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
r14 = new Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
r15 = new Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
r16 = new Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
r17 = new Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1);
}
function level1() {
_root.kvEvent(500);
noOfItems = 0;
controlGame = true;
spritesCollected = 0;
charSpeed = 9;
aiSpeed = 9;
respawnTime = 200;
maxGuards = 2;
r0 = new Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1);
r1 = new Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
r2 = new Array(1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1);
r3 = new Array(1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1);
r4 = new Array(1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1);
r5 = new Array(1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 1);
r6 = new Array(1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1);
r7 = new Array(1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 0, 1);
r8 = new Array(1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 1);
r9 = new Array(1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1);
r10 = new Array(1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 0, 1);
r11 = new Array(1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1);
r12 = new Array(1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 1);
r13 = new Array(1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1);
r14 = new Array(1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1);
r15 = new Array(1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1);
r16 = new Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
r17 = new Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1);
}
function level2() {
_root.kvEvent(501);
noOfItems = 0;
controlGame = true;
spritesCollected = 0;
charSpeed = 8;
aiSpeed = 8;
respawnTime = 150;
maxGuards = 3;
r0 = new Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1);
r1 = new Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
r2 = new Array(1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1);
r3 = new Array(1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1);
r4 = new Array(1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1);
r5 = new Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
r6 = new Array(1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1);
r7 = new Array(1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1);
r8 = new Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
r9 = new Array(1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1);
r10 = new Array(1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1);
r11 = new Array(1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1);
r12 = new Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
r13 = new Array(1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1);
r14 = new Array(1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1);
r15 = new Array(1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1);
r16 = new Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
r17 = new Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1);
}
function level3() {
_root.kvEvent(502);
noOfItems = 0;
controlGame = true;
spritesCollected = 0;
charSpeed = 8;
aiSpeed = 7;
respawnTime = 70;
maxGuards = 4;
r0 = new Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1);
r1 = new Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1);
r2 = new Array(1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1);
r3 = new Array(1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1);
r4 = new Array(1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1);
r5 = new Array(1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1);
r6 = new Array(1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1);
r7 = new Array(1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1);
r8 = new Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
r9 = new Array(1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1);
r10 = new Array(1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1);
r11 = new Array(1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1);
r12 = new Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1);
r13 = new Array(1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1);
r14 = new Array(1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
r15 = new Array(1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1);
r16 = new Array(1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1);
r17 = new Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1);
}
function level4() {
_root.kvEvent(503);
noOfItems = 0;
controlGame = true;
spritesCollected = 0;
charSpeed = 7;
aiSpeed = 6;
respawnTime = 20;
maxGuards = 5;
r0 = new Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1);
r1 = new Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
r2 = new Array(1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1);
r3 = new Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
r4 = new Array(1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1);
r5 = new Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
r6 = new Array(1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1);
r7 = new Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
r8 = new Array(1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1);
r9 = new Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
r10 = new Array(1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1);
r11 = new Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
r12 = new Array(1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1);
r13 = new Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
r14 = new Array(1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1);
r15 = new Array(1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1);
r16 = new Array(1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1);
r17 = new Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1);
}
function level5() {
_root.kvEvent(504);
noOfItems = 0;
controlGame = true;
spritesCollected = 0;
charSpeed = 6;
aiSpeed = 5;
respawnTime = 5;
maxGuards = 6;
r0 = new Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1);
r1 = new Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
r2 = new Array(1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1);
r3 = new Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
r4 = new Array(1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1);
r5 = new Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
r6 = new Array(1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1);
r7 = new Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
r8 = new Array(1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1);
r9 = new Array(1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1);
r10 = new Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
r11 = new Array(1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1);
r12 = new Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
r13 = new Array(1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1);
r14 = new Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
r15 = new Array(1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1);
r16 = new Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
r17 = new Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1);
}
function buildFloor() {
var _local14 = tileWidth;
var _local13 = tileHeight;
r = 0;
while (r < rows) {
var _local10 = floorStart_x - (r * _local14);
var _local9 = floorStart_y + (r * _local13);
c = 0;
while (c < cols) {
var _local5 = ((r * rows) + 1) + c;
var _local7 = "tile" + _local5;
var _local8 = "floor" + _local5;
var _local4 = this["r" + r][c];
this[_local7] = {};
var _local2 = this[_local7];
_local2.depth = _local5;
_local2.x = _local10 + (c * _local14);
_local2.y = _local9 + (c * _local13);
_local2.row = r;
_local2.col = c;
_local2.free = true;
_local2.cont = false;
numberOfTiles++;
if (_local4.doorway == 2) {
_local2.cont = true;
_local2.room = _local4.room;
_local2.doorTarget = _local4.targ;
}
if (_local4 == 1) {
_local2.free = false;
} else {
noOfItems++;
specialItem++;
itemDepth = 10000 + (9 * _local5);
var _local6 = ("item" + noOfItems) + "_mc";
_local2.itemCollected = false;
_local2.whatItem = _local6;
if (specialItem == 33) {
specialItem = 0;
attachMovie("item2MC", _local6, itemDepth, {_x:_local2.x, _y:_local2.y});
_local2.special = true;
} else {
attachMovie("itemMC", _local6, itemDepth, {_x:_local2.x, _y:_local2.y});
}
}
if (showTiles) {
attachMovie("tile", _local8, _local5 + 200);
var _local3 = this[_local8];
_local3._x = _local2.x;
_local3._y = _local2.y;
_local3.tileName = _local2.depth;
if (_local4 == 1) {
_local3._alpha = 10;
_local3.tileName = "";
}
}
c++;
}
r++;
}
floorplan_mc.gotoAndStop(level);
}
function resetSprites() {
attachMovie("char", "char_mc", 10000);
attachMovie("AI", "ai1_mc", 10001);
char.type = "hero";
char.mc = char_mc;
char.startTile = 305;
char.currentTile = 305;
char.nexTile = 305;
char.dir = 0;
char.currentDIR = 0;
char.ymov = 0;
char.xmov = 0;
char.speed = charSpeed;
char.currentStep = 0;
char.mc._x = this["tile" + char.startTile].x;
char.mc._y = this["tile" + char.startTile].y;
ai1.type = "ai";
ai1.mc = ai1_mc;
ai1.startTile = 20;
ai1.currentTile = 20;
ai1.nexTile = 20;
ai1.dir = 0;
ai1.currentDIR = 0;
ai1.ymov = 0;
ai1.xmov = 0;
ai1.speed = aiSpeed;
ai1.respawnTime = respawnTime;
ai1.respawnTimeLeft = respawnTime;
ai1.spawning = false;
ai1.currentStep = 0;
ai1.mc._x = this["tile" + ai1.startTile].x;
ai1.mc._y = this["tile" + ai1.startTile].y;
aiSprites = 2;
}
function controlHero() {
keyControl();
moveSprite(char);
}
function controlai() {
i = 1;
while (i < aiSprites) {
whatObject = this["ai" + i];
chooseDirai(whatObject);
if (!whatObject.spawning) {
moveSprite(whatObject);
}
if ((i == 1) && (!slowAI)) {
ai1.respawnTimeLeft--;
if ((ai1.respawnTimeLeft == 0) && (aiSprites <= maxGuards)) {
ai1.mc.countdown_mc.play();
}
}
if ((whatObject.currentTile == char.currentTile) && (!lostLife)) {
loseLife();
}
if (((whatObject.currentTile == char.oldTile) && (whatObject.oldTile == char.currentTile)) && (!lostLife)) {
if (whatObject.currentTile == char.oldTile) {
whatObject.xmov = 0;
whatObject.ymov = 0;
whatObject.currentTile = char.oldTile;
}
if (whatObject.oldTile == char.currentTile) {
char.xmov = 0;
char.ymov = 0;
char.currentTile = whatObject.oldTile;
}
loseLife();
}
i++;
}
}
function spawnNewAi() {
ai1.respawnTimeLeft = ai1.respawnTime;
ai1.spawning = false;
ai1.mc.gotoAndStop(ai1.currentDIR);
var _local3 = ("ai" + aiSprites) + "_mc";
var _local4 = 10000 + aiSprites;
attachMovie("AI", _local3, _local4);
this["ai" + aiSprites] = new Object();
var _local2 = this["ai" + aiSprites];
_local2.ai = true;
_local2.mc = this[_local3];
_local2.startTile = ai1.currentTile;
_local2.currentTile = ai1.currentTile;
_local2.dir = oppositeDirection();
_local2.currentDIR = oppositeDirection();
_local2.ymov = 0;
_local2.xmov = 0;
_local2.speed = aiSpeed;
_local2.currentStep = 0;
_local2.hitChar = false;
_local2.mc._x = this["tile" + _local2.startTile].x;
_local2.mc._y = this["tile" + _local2.startTile].y;
moveSprite(_local2);
aiSprites++;
}
function checkGameOver() {
if (lostLife) {
countdownFight--;
if (countdownFight == 0) {
var _local2 = this[("life" + lives) + "_mc"];
_local2.gotoAndStop(2);
lives--;
livesLeft = "X" + lives;
fight_mc._x = char.mc._x;
fight_mc._y = char.mc._y;
fight_mc.gotoAndPlay(2);
removeSprites();
}
}
}
function removeSprites() {
i = 1;
while (i < aiSprites) {
whatMC = this[("ai" + i) + "_mc"];
var _local2 = "cloud" + i;
var _local3 = 10000 + i;
removeMovieClip(whatMC);
i++;
}
if (gameOver) {
t = 0;
while (t < noOfItems) {
var whatMC = this[("item" + t) + "_mc"];
removeMovieClip(whatMC);
t++;
}
}
removeMovieClip(char_mc);
}
function loseLife() {
stopAllSounds();
_parent.endGame_snd.start(0, 0);
if (lives == 2) {
_parent.endGame_snd.onSoundComplete = function () {
currentMusic = _parent.mainLoopFast;
currentMusic.start(0, 9999);
};
} else {
_parent.endGame_snd.onSoundComplete = function () {
currentMusic = _parent.mainLoop;
currentMusic.start(0, 9999);
};
}
lostLife = true;
countdownFight = 7;
}
function moveSprite(whatObject) {
if (whatObject.currentStep == 0) {
whatObject.mc._y = this["tile" + whatObject.currentTile].y;
whatObject.mc._x = this["tile" + whatObject.currentTile].x;
createSteps(whatObject);
}
whatObject.currentStep--;
whatObject.mc._y = whatObject.mc._y + whatObject.ymov;
whatObject.mc._x = whatObject.mc._x + whatObject.xmov;
}
function oppositeDirection() {
if (whatObject.currentDIR == 1) {
return(3);
}
if (whatObject.currentDIR == 2) {
return(4);
}
if (whatObject.currentDIR == 3) {
return(1);
}
if (whatObject.currentDIR == 4) {
return(2);
}
}
function chooseDirai(whatObject) {
var _local2 = false;
var _local4 = oppositeDirection();
while (!_local2) {
var _local1 = Math.ceil(Math.random() * 4);
if ((_local1 != whatObject.currentDIR) && (_local1 != _local4)) {
whatObject.dir = _local1;
_local2 = true;
}
}
}
function keyControl() {
if (Key.isDown(38)) {
char.dir = 1;
var _local1 = true;
}
if (Key.isDown(37) && (!_local1)) {
char.dir = 4;
var _local1 = true;
}
if (Key.isDown(40) && (!_local1)) {
char.dir = 3;
var _local1 = true;
}
if (Key.isDown(39) && (!_local1)) {
char.dir = 2;
var _local1 = true;
}
}
function createSteps(whatObject) {
if (!lostLife) {
var _local6 = nextTile(whatObject.dir, whatObject);
var _local5 = this["tile" + _local6];
var _local4 = this["tile" + whatObject.currentTile];
var _local7 = 10000 + (10 * whatObject.currentTile);
whatObject.mc.swapDepths(_local7);
whatObject.oldTile = whatObject.currentTile;
if (whatObject.type == "hero") {
if (whatObject.xmov != 0) {
_parent.collect_snd.start(0, 0);
}
if (!_local4.itemCollected) {
if (_local4.special) {
_parent.reward_snd.start(0, 0);
slowAI = true;
AICountdown = 120;
setAISpeed(false);
points = points + 100;
} else {
points = points + 20;
}
_local4.itemCollected = true;
removeMovieClip(_local4.whatItem);
noOfItemsCollected++;
if (noOfItemsCollected == noOfItems) {
var _local8 = Math.ceil(Math.random() * 4);
endTile = int(doorwayArray[level]);
this["endTile" + level].gotoAndPlay(2);
finalSquare = true;
trace("COLLECTED ALL");
trace(endTile);
}
}
if (finalSquare && (whatObject.currentTile == endTile)) {
endGame();
}
}
if (_local5.free) {
whatObject.currentDIR = whatObject.dir;
whatObject.mc.gotoAndStop(whatObject.currentDIR);
whatObject.ymov = (_local5.y - _local4.y) / whatObject.speed;
whatObject.xmov = (_local5.x - _local4.x) / whatObject.speed;
whatObject.currentTile = _local6;
} else {
_local6 = nextTile(whatObject.currentDIR, whatObject);
_local5 = this["tile" + _local6];
whatObject.ymov = (_local5.y - _local4.y) / whatObject.speed;
whatObject.xmov = (_local5.x - _local4.x) / whatObject.speed;
if (!_local5.free) {
whatObject.ymov = 0;
whatObject.xmov = 0;
} else {
whatObject.currentTile = _local6;
}
}
whatObject.currentStep = whatObject.speed;
} else {
whatObject.ymov = 0;
whatObject.xmov = 0;
}
}
function setAISpeed(normalSpeed) {
i = 1;
while (i < aiSprites) {
whatObject = this["ai" + i];
stopAllSounds();
if (normalSpeed) {
currentMusic.start(0, 9999);
whatObject.speed = aiSpeed;
} else {
whatObject.speed = aiSpeed * 3;
_parent.mainLoopSlow.start(0, 9999);
}
i++;
}
}
function nextTile(whatDIR, whatObject) {
var _local3 = this["tile" + whatObject.currentTile].row;
var _local5 = this["tile" + whatObject.currentTile].col;
if (whatDIR == 1) {
var _local6 = (((_local3 - 1) * rows) + 1) + _local5;
}
if (whatDIR == 3) {
var _local6 = (((_local3 + 1) * rows) + 1) + _local5;
}
if (whatDIR == 4) {
var _local6 = whatObject.currentTile - 1;
}
if (whatDIR == 2) {
var _local6 = whatObject.currentTile + 1;
}
return(_local6);
}
function resetGame() {
this["level" + level]();
buildFloor();
resetSprites();
i = 0;
while (i <= 4) {
this["endTile" + i].gotoAndStop(1);
i++;
}
timeBonus = 6000;
frame = 0;
points = 0;
finalSquare = false;
noOfItemsCollected = 0;
beginGame();
}
function beginGame() {
this.onEnterFrame = function () {
if (controlGame) {
controlHero();
controlai();
checkGameOver();
timeBonus--;
slowAISprites();
countdown();
}
};
}
function slowAISprites() {
if (slowAI) {
AICountdown--;
if (AICountdown == 0) {
setAISpeed(true);
slowAI = false;
}
}
}
function countdown() {
frame++;
currentTime = Math.floor(frame / 24);
minutes = Math.floor(currentTime / 60);
seconds = currentTime - (minutes * 60);
if (seconds < 10) {
seconds = "0" + seconds;
}
time.text = (minutes + ":") + seconds;
time1.text = (minutes + ":") + seconds;
}
function endGame() {
i = 0;
while (i <= 4) {
this["endTile" + i].gotoAndStop(1);
i++;
}
totalPoints = totalPoints + (timeBonus + points);
controlGame = false;
delete this.onEnterFrame;
levelMask_mc.gotoAndPlay(2);
removeSprites();
}
function pauseGame() {
if (!pausedGame) {
stopAllSounds();
_root.kvEvent(498);
delete this.onEnterFrame;
pausedGame = true;
_parent.pausedGame_mc._visible = true;
} else {
beginGame();
currentMusic.start(0, 9999);
pausedGame = false;
_parent.pausedGame_mc._visible = false;
}
}
var points = 0;
var totalPoints = 0;
var timeBonus = 6000;
var rows = 18;
var cols = 18;
var floorStart_x = 348;
var floorStart_y = 112;
var tileWidth = 18;
var tileHeight = 9;
var showTiles = false;
var numberOfTiles = 0;
var depthOffset = 400;
var lives = 5;
var livesLeft = ("X" + lives);
var gameOver = false;
var currentMusic = _parent.mainLoop;
var noOfItems = 0;
var specialItem = 0;
var controlGame = true;
var spritesCollected = 0;
var level = 1;
var charSpeed = 9;
var aiSpeed = 9;
var respawnTime = 200;
var maxGuards = 3;
char = new Object();
ai1 = new Object();
attachMovie("fightCloud", "fight_mc", 100000);
var noOfItemsCollected = 0;
var doorwayArray = new Array(0, 236, 128, 26, 32, 20);
var endTile = 0;
var finalSquare = false;
stop();
Symbol 344 Button
on (release) {
_root.kvEvent(495);
getURL ("http://www.t-f-m.co.uk/moreinfo/", "_blank");
}
Symbol 347 Button
on (release) {
_parent.gotoAndStop(28);
}
Symbol 350 Button
on (release) {
_parent.mainGame_mc.pauseGame();
}