Frame 1
loadedBytes = ((int(this.getBytesLoaded() / 1000) + "k / ") + int(this.getBytesTotal() / 1000)) + "k";
Frame 2
loadedBytes = ((int(this.getBytesLoaded() / 1000) + "k / ") + int(this.getBytesTotal() / 1000)) + "k";
Frame 3
loadedBytes = ((int(this.getBytesLoaded() / 1000) + "k / ") + int(this.getBytesTotal() / 1000)) + "k";
Frame 4
loadedBytes = ((int(this.getBytesLoaded() / 1000) + "k / ") + int(this.getBytesTotal() / 1000)) + "k";
Frame 5
loadedBytes = ((int(this.getBytesLoaded() / 1000) + "k / ") + int(this.getBytesTotal() / 1000)) + "k";
Frame 6
loadedBytes = ((int(this.getBytesLoaded() / 1000) + "k / ") + int(this.getBytesTotal() / 1000)) + "k";
Frame 7
loadedBytes = ((int(this.getBytesLoaded() / 1000) + "k / ") + int(this.getBytesTotal() / 1000)) + "k";
Frame 8
loadedBytes = ((int(this.getBytesLoaded() / 1000) + "k / ") + int(this.getBytesTotal() / 1000)) + "k";
Frame 9
loadedBytes = ((int(this.getBytesLoaded() / 1000) + "k / ") + int(this.getBytesTotal() / 1000)) + "k";
Frame 10
loadedBytes = ((int(this.getBytesLoaded() / 1000) + "k / ") + int(this.getBytesTotal() / 1000)) + "k";
Frame 11
loadedBytes = ((int(this.getBytesLoaded() / 1000) + "k / ") + int(this.getBytesTotal() / 1000)) + "k";
Frame 12
loadedBytes = ((int(this.getBytesLoaded() / 1000) + "k / ") + int(this.getBytesTotal() / 1000)) + "k";
ifFrameLoaded (111) {
loaded = 1;
}
if (loaded == 1) {
gotoAndPlay (13);
} else {
gotoAndPlay (2);
}
Frame 110
stop();
Instance of Symbol 144 MovieClip "loki" in Frame 111
onClipEvent (mouseMove) {
if (this._currentFrame < _root.Functions.lokiDeathFrame) {
_root.Functions.moveDog(this);
}
}
onClipEvent (mouseDown) {
if ((this._currentFrame < _root.Functions.lokiDeathFrame) and (_root.Functions.fireEnabled == 1)) {
_root.Functions.dogFire(this);
this.gotoAndPlay("lokiFire");
}
}
onClipEvent (load) {
function getx() {
return(this._x - (this._width / 2));
}
function getxx() {
return(this._x + (this._width / 2));
}
function gety() {
return(this._y - (this._height / 2));
}
function getyy() {
return(this._y + (this._height / 2));
}
}
onClipEvent (enterFrame) {
}
Instance of Symbol 146 MovieClip "Functions" in Frame 111
onClipEvent (load) {
function dogFire(clip) {
if (this.currentShots < this.maxShots) {
this.currentShots++;
dogShots++;
this.levelShots++;
if (dogShots == 1000) {
dogShots = 1;
}
x = getClipX(clip);
duplicateMovieClip ("/dogfire", "fire" add dogShots, dogShots + 2000);
setProperty("/fire" add dogShots, _x , x);
setProperty("/fire" add dogShots, _y , clip._y - (clip._height / 2));
tellTarget ("/fire" add dogShots) {
gotoAndPlay (2);
};
}
}
function catFire(clip) {
if (this.fireEnabled == 1) {
catShots++;
if (catShots == 1000) {
catShots = 1;
}
x = getClipX(clip);
duplicateMovieClip ("/catfire", "catfire" add catShots, catShots + 1000);
if (clip._name == "boss1") {
temp = random(2);
if (clip._currentFrame >= 21) {
temp = 1;
}
if ((temp == 0) && (clip._currentFrame < 21)) {
setProperty("/catfire" add catShots, _x , x - 47);
setProperty("/catfire" add catShots, _y , clip._y + 20);
} else if ((temp == 1) && (clip._currentFrame < 31)) {
setProperty("/catfire" add catShots, _x , x + 41);
setProperty("/catfire" add catShots, _y , clip._y + 20);
}
} else {
setProperty("/catfire" add catShots, _x , x);
setProperty("/catfire" add catShots, _y , clip._y + (clip._height / 2));
}
tellTarget ("/catfire" add catShots) {
gotoAndPlay (2);
};
}
}
function moveDog(clip) {
lastX = clip._x;
if (_root._xmouse < leftBound) {
setProperty(clip, _x , leftBound);
} else if (rightBound < _root._xmouse) {
setProperty(clip, _x , rightBound);
} else {
setProperty(clip, _x , _root._xmouse);
}
if ((lastX < clip._x) and (clip._currentFrame < this.lokiDeathFrame)) {
tellTarget (clip) {
gotoAndPlay ("walkRight");
};
}
if ((clip._x < lastX) and (clip._currentFrame < this.lokiDeathFrame)) {
tellTarget (clip) {
gotoAndPlay ("walkLeft");
};
}
}
function getClipX(clip) {
return(getProperty(clip, _x));
}
function getClipY(clip) {
return(getProperty(clip, _y));
}
function growClip(clip, size) {
setProperty(clip, _xscale , clip._xscale + size);
setProperty(clip, _yscale , clip._yscale + size);
}
function setSize(clip, size) {
setProperty(clip, _xscale , size);
setProperty(clip, _yscale , size);
}
function moveClip(clip, x, y) {
setProperty(clip, _x , clip._x + x);
setProperty(clip, _y , clip._y + y);
}
function rotateClip(clip, angle) {
setProperty(clip, _rotation , clip._rotation + angle);
}
function moveFire(clip) {
rotateClip(clip, 15);
moveClip(clip, 0, -getBulletSpeed());
if (isBossLevel()) {
temp = "/boss1.hitArea";
if (((this.fireEnabled == 1) and clip.hitTest(eval (temp))) and (eval (temp)._currentFrame == 1)) {
this.bossHits++;
/scoreBox.addScore(5 + (this.level * 2));
if ((this.bossHits / this.bossShotsToDestroy) == int(this.bossHits / this.bossShotsToDestroy)) {
if (this.bossState < 41) {
this.bossState = this.bossState + 10;
tellTarget (/boss1) {
gotoAndPlay(this.bossState);
};
}
}
removeMovieClip(clip);
this.currentShots--;
tellTarget (eval (temp)) {
gotoAndPlay (2);
};
}
} else {
i = 0;
while (i < cats) {
temp = "/cat" add i;
if (((this.fireEnabled == 1) and clip.hitTest(eval (temp))) and (eval (temp)._currentFrame == 1)) {
tellTarget (eval (temp)) {
gotoAndPlay ("dead");
removeMovieClip(clip);
/scoreBox.addScore(this.defaultScore + (this.level * 5));
this.deadCats++;
this.currentShots--;
if (this.deadCats == this.cats) {
this.clearCatShots();
this.loadLevel(this.level + 1);
}
};
}
i++;
}
}
}
function moveCatFire(clip) {
moveClip(clip, 0, getBulletSpeed(clip));
clip._rotation = clip._rotation - 30;
temp = "/loki";
if (clip.hitTest(eval (temp)) and (eval (temp)._currentFrame < this.lokiDeathFrame)) {
this.lives--;
lifeCount = this.defaultLives - this.lives;
duplicateMovieClip ("/lifeLost", "lostLife" add lifeCount, 3 + lifeCount);
setProperty("/lostLife" add lifeCount, _x , getProperty("/life" add lifeCount, _x));
setProperty("/lostLife" add lifeCount, _y , getProperty("/life" add lifeCount, _y));
tellTarget (eval (temp)) {
gotoAndPlay ("dead");
};
removeMovieClip(clip);
i = 0;
while (cats >= i) {
removeMovieClip("/cat" add i);
i++;
}
removeMovieClip("/boss1");
i = 0;
while (1000 >= i) {
removeMovieClip("/catfire" add i);
removeMovieClip("/fire" add i);
i++;
}
}
}
function moveCat(clip) {
thisDir = 0;
temp = random(101);
if ((temp >= 0) and (temp < 85)) {
thisDir = clip.lastDir + 0;
} else if ((temp >= 85) and (temp < 88)) {
thisDir = clip.lastDir + 1;
} else if ((temp >= 88) and (temp < 91)) {
thisDir = clip.lastDir - 1;
} else if ((temp >= 91) and (temp < 93)) {
thisDir = clip.lastDir + 2;
} else if ((temp >= 93) and (temp < 95)) {
thisDir = clip.lastDir - 2;
} else if ((temp >= 95) and (temp < 97)) {
thisDir = clip.lastDir - 3;
} else if ((temp >= 97) and (temp < 99)) {
thisDir = clip.lastDir + 3;
} else if ((temp >= 99) and (100 >= temp)) {
thisDir = clip.lastDir + 4;
}
if (thisDir < 1) {
thisDir = thisDir + 8;
} else if (8 < thisDir) {
thisDir = thisDir - 8;
}
if (thisDir == 1) {
moveN(clip);
} else if (thisDir == 2) {
moveNE(clip);
} else if (thisDir == 3) {
moveE(clip);
} else if (thisDir == 4) {
moveSE(clip);
} else if (thisDir == 5) {
moveS(clip);
} else if (thisDir == 6) {
moveSW(clip);
} else if (thisDir == 7) {
moveW(clip);
} else if (thisDir == 8) {
moveNW(clip);
}
temp = random(this.fireRate / this.level) + 30;
if (/levelSplash._currentFrame < 73) {
removeMovieClip(this);
}
if (temp == 30) {
catFire(clip);
}
}
function moveN(clip) {
if (clip._y >= lowerBound) {
moveClip(clip, 0, -getCatMoves());
clip.lastDir = 1;
} else {
clip.lastDir = 5;
}
}
function moveS(clip) {
if (upperBound >= (clip._y + (clip._width / 2))) {
moveClip(clip, 0, getCatMoves());
clip.lastDir = 5;
} else {
clip.lastDir = 1;
}
}
function moveE(clip) {
if (rightBound >= (clip._x + (clip._width / 2))) {
moveClip(clip, getCatMoves(), 0);
clip.lastDir = 3;
} else {
clip.lastDir = 7;
}
}
function moveW(clip) {
if ((clip._x - (clip._width / 2)) >= leftBound) {
moveClip(clip, -getCatMoves(), 0);
clip.lastDir = 7;
} else {
clip.lastDir = 3;
}
}
function moveNW(clip) {
if (((clip._x - (clip._width / 2)) >= leftBound) and (clip._y >= lowerBound)) {
moveClip(clip, -getCatMoves(), -getCatMoves());
clip.lastDir = 8;
} else {
clip.lastDir = 4;
}
}
function moveNE(clip) {
if ((rightBound >= (clip._x + (clip._width / 2))) and (clip._y >= lowerBound)) {
moveClip(clip, getCatMoves(), -getCatMoves());
clip.lastDir = 2;
} else {
clip.lastDir = 6;
}
}
function moveSE(clip) {
if ((rightBound >= (clip._x + (clip._width / 2))) and (upperBound >= (clip._y + (clip._width / 2)))) {
moveClip(clip, getCatMoves(), getCatMoves());
clip.lastDir = 4;
} else {
clip.lastDir = 8;
}
}
function moveSW(clip) {
if (((clip._x - (clip._width / 2)) >= leftBound) and (upperBound >= (clip._y + (clip._width / 2)))) {
moveClip(clip, -getCatMoves(), getCatMoves());
clip.lastDir = 6;
} else {
clip.lastDir = 2;
}
}
function loadLevel(lev) {
if (lev == 1) {
this.highScore = _root.highScoreBox.score;
}
this.fireEnabled = 0;
this.level = lev;
tellTarget ("/levelSplash") {
gotoAndPlay (1);
};
}
function startLevel(lev) {
tellTarget ("/levelSplash") {
gotoAndStop (1);
};
clearDogShots();
this.fireEnabled = 1;
this.currentShots = 0;
if (this.justDied == 0) {
this.levelShots = 0;
this.levelIdealShots = 0;
this.cats = lev;
while (0 < this.cats) {
this.cats = this.cats - this.bossLevelEvery;
}
this.cats = this.cats + this.bossLevelEvery;
if (5 < this.cats) {
this.cats = 5;
}
this.catsToCreate = this.cats;
this.deadCats = 0;
} else {
this.catsToCreate = this.cats - this.deadCats;
}
if (isBossLevel()) {
if (this.justDied == 0) {
this.bossHits = 0;
this.bossState = 1;
this.levelIdealShots = 4 * this.bossShotsToDestroy;
}
duplicateMovieClip ("/boss", "boss1", 700);
tellTarget ("/boss1") {
gotoAndPlay(this.bossState);
};
setProperty("/boss1", _x , random((rightBound - (2 * /boss1._width)) - leftBound) + leftBound);
setProperty("/boss1", _y , random(upperBound - lowerBound) + lowerBound);
} else {
i = 0;
while (i < catsToCreate) {
if (this.justDied == 0) {
this.levelIdealShots++;
}
duplicateMovieClip ("/fat", "cat" add i, 400 + i);
eval ("/cat" add i).lastDir = 0;
setProperty("/cat" add i, _x , random(rightBound - leftBound) + leftBound);
setProperty("/cat" add i, _y , random(upperBound - lowerBound) + lowerBound);
tellTarget ("/cat" add i) {
gotoAndPlay (1);
};
i++;
}
}
if (this.justDied == 1) {
this.justDied = 0;
}
}
function isBossLevel() {
if ((this.level / this.bossLevelEvery) == int(this.level / this.bossLevelEvery)) {
return(true);
}
return(false);
}
function clearDogShots() {
i = 0;
while (1000 >= i) {
removeMovieClip("/fire" add i);
i++;
}
}
function clearCatShots() {
i = 0;
while (1000 >= i) {
removeMovieClip("/catfire" add i);
i++;
}
}
function endGame() {
trace("in end game function");
this.fireEnabled = 0;
setProperty("/endOfGame", _x , 250);
/endOfGame.score = this.score;
if (_root.highScoreBox.score < this.score) {
trace((("new score : " + score) + " old HS = ") + _root.highScoreBox.score);
this.highScore = this.score;
/endOfGame.hs = "You got the new High Score !";
setProperty("/highScoreForm", _x , 250);
setProperty("/highScoreForm", _y , 200);
/highScoreBox.setHighScore(this.score);
} else {
/endOfGame.hs = "";
}
}
function restartGame() {
setProperty("/endOfGame", _x , -250);
i = 1;
while (this.defaultLives >= i) {
removeMovieClip("/lostLife" add i);
i++;
}
/scoreBox.resetScore();
this.score = 0;
this.cats = 0;
this.currentShots = 0;
this.deadCats = 0;
this.level = 1;
this.lives = this.defaultLives;
this.gameOver = 0;
this.endGameFunctionCalled = 0;
_root.highScoreBox.hsLoaded = 0;
loadLevel(1);
}
function getBulletSpeed(clip) {
bulletspeed = 4 + int(this.level / 5);
if (10 < bulletspeed) {
bulletspeed = 10;
}
if ((400 - /loki._height) < clip._y) {
bulletspeed = bulletspeed * 2;
}
return(bulletspeed);
}
function getCatMoves() {
catMoves = 3 + int(this.level / 8);
if (7 < catMoves) {
catMoves = 7;
}
return(catMoves);
}
leftBound = 40;
rightBound = 460;
upperBound = 257;
lowerBound = 108;
dogShots = 500;
this.lokiDeathFrame = 35;
this.defaultScore = 5;
this.defaultBossScore = 50;
this.defaultLives = 3;
this.bossShotsToDestroy = 3;
this.validURL = "http://www.cedalion.co.uk/loki/cat_invaders.swf";
this.fireRate = 200;
this.levelShots = 0;
this.score = 0;
this.initialCats = 1;
this.bossHits = 0;
this.bossState = 1;
this.currentShots = 0;
this.justDied = 0;
this.maxShots = 5;
this.bossLevelEvery = 5;
this.cats = 0;
this.fireEnabled = 0;
this.endGameFunctionCalled = 0;
this.deadCats = 0;
this.level = 1;
this.lives = this.defaultLives;
this.gameOver = 0;
loadLevel(1);
tellTarget ("/fat") {
gotoAndPlay (5);
};
}
onClipEvent (enterFrame) {
}
Instance of Symbol 148 MovieClip "dogfire" in Frame 111
/* no clip actions */
Instance of Symbol 149 MovieClip "fat" in Frame 111
onClipEvent (load) {
}
onClipEvent (enterFrame) {
if (this._name == "fat") {
gotoAndPlay (120);
} else {
_root.Functions.moveCat(this);
}
}
Instance of Symbol 152 MovieClip "scoreBox" in Frame 111
/* no clip actions */
Instance of Symbol 156 MovieClip "highScoreBox" in Frame 111
onClipEvent (load) {
function getHighScoreFromURL() {
this.hsLoaded = 1;
if (this._url == _root.Functions.validURL) {
trace("loading from url ");
loadVariables ("http://www.cedalion.co.uk/loki/get_high_score.asp", _root.highScoreBox);
} else {
trace("setting endOfGame to 3");
tellTarget ("/endOfGame") {
gotoAndStop (3);
};
if (0 < score) {
} else {
score = 0;
}
}
}
function setHighScore(sc) {
score = sc;
_root.Functions.highScore = score;
}
this.hsLoaded = 0;
}
onClipEvent (enterFrame) {
if ((this.hsLoaded == 0) && (_root.Functions._framesloaded == _root.Functions._totalframes)) {
getHighScoreFromURL();
}
_root.Functions.highScore = score;
}
Instance of Symbol 203 MovieClip "boss" in Frame 111
onClipEvent (enterFrame) {
if (this._name == "boss") {
gotoAndStop (111);
this.stopAllSounds();
} else {
_root.Functions.moveCat(this);
}
}
Instance of Symbol 238 MovieClip "endOfGame" in Frame 111
onClipEvent (load) {
this.name = "";
this.email = "";
}
onClipEvent (enterFrame) {
finalScore = _root.Functions.score;
}
Frame 112
if (_root.Functions.gameOver == 1) {
if (_root.Functions.endGameFunctionCalled == 0) {
_root.Functions.endGame();
_root.Functions.endGameFunctionCalled = 1;
}
}
gotoAndPlay (111);
Symbol 61 Button
on (release) {
gotoAndPlay (111);
}
Symbol 97 MovieClip Frame 1
stop();
Symbol 97 MovieClip Frame 10
removeMovieClip(this);
Symbol 142 MovieClip Frame 5
stop();
Symbol 144 MovieClip Frame 2
if (this._currentFrame < _root.Functions.lokiDeathFrame) {
gotoAndPlay (1);
}
Symbol 144 MovieClip Frame 6
if (this._currentFrame < _root.Functions.lokiDeathFrame) {
gotoAndPlay (5);
}
Symbol 144 MovieClip Frame 12
gotoAndPlay (1);
Symbol 144 MovieClip Frame 50
if (0 < _root.Functions.lives) {
gotoAndPlay (1);
_root.Functions.justDied = 1;
_root.Functions.loadLevel(_root.Functions.level);
} else {
_root.Functions.gameOver = 1;
}
Symbol 148 MovieClip Frame 1
stop();
Symbol 148 MovieClip Frame 2
play();
Symbol 148 MovieClip Frame 3
if (this._y < 0) {
_root.Functions.currentShots--;
removeMovieClip(this);
} else {
gotoAndPlay (3);
_root.Functions.moveFire(this);
}
Symbol 148 MovieClip Frame 4
gotoAndPlay (3);
Symbol 149 MovieClip Frame 1
stop();
Symbol 149 MovieClip Frame 10
removeMovieClip(this);
Symbol 152 MovieClip Frame 1
function addScore(points) {
score = Number(score) + Number(points);
_root.Functions.score = score;
}
function resetScore() {
score = 0;
_root.Functions.score = score;
}
Symbol 154 MovieClip Frame 1
stop();
Symbol 154 MovieClip Frame 2
play();
Symbol 154 MovieClip Frame 3
_root.Functions.moveCatFire(this);
Symbol 154 MovieClip Frame 4
if (400 < this._y) {
removeMovieClip(this);
} else {
gotoAndPlay (3);
}
Symbol 169 MovieClip Frame 1
stop();
Symbol 169 MovieClip Frame 2
play();
Symbol 169 MovieClip Frame 5
gotoAndPlay (1);
Instance of Symbol 169 MovieClip "hitArea" in Symbol 203 MovieClip Frame 1
onClipEvent (load) {
}
Symbol 203 MovieClip Frame 10
gotoAndPlay (1);
Symbol 203 MovieClip Frame 20
gotoAndPlay (11);
Symbol 203 MovieClip Frame 30
gotoAndPlay (21);
Symbol 203 MovieClip Frame 40
gotoAndPlay (31);
Symbol 203 MovieClip Frame 41
this.stopAllSounds();
Symbol 203 MovieClip Frame 81
stop();
_root.Functions.loadLevel(_root.Functions.level + 1);
/scoreBox.addScore(_root.Functions.defaultBossScore + (_root.Functions.level * 5));
Symbol 211 Button
on (release) {
if (((name != "") and (email != "")) and (email.indexOf("@") != -1)) {
getURL ("http://www.cedalion.co.uk/loki/saveHighScore.asp", "bottomMainFrame", "POST");
getURL ("http://www.cedalion.co.uk/loki/cat_side.asp", "SideFrame");
gotoAndStop (2);
}
}
Symbol 222 Button
on (release) {
gotoAndStop (1);
_root.Functions.restartGame();
}
Symbol 227 Button
on (release) {
getURL ("http://www.cedalion.co.uk/", "_top");
}
Symbol 232 Button
on (release) {
_root.Functions.restartGame();
}
Symbol 237 Button
on (release) {
getURL ("http://www.cedalion.co.uk/loki/", "_blank");
}
Symbol 238 MovieClip Frame 1
stop();
Symbol 238 MovieClip Frame 2
stop();
Symbol 238 MovieClip Frame 3
stop();
Symbol 253 MovieClip Frame 2
this._alpha = 100;
this.levelText = _root.Functions.level;
if (((_root.Functions.deadCats == _root.Functions.cats) and (1 < _root.Functions.level)) or (((((_root.Functions.level - 1) / _root.Functions.bossLevelEvery) == int((_root.Functions.level - 1) / _root.Functions.bossLevelEvery)) and (_root.Functions.bossState >= 41)) and (1 < _root.Functions.level))) {
this.idealShots = _root.Functions.levelIdealShots;
this.levelShots = _root.Functions.levelShots;
trace((idealShots + " ") + levelShots);
this.hitRate = int((idealShots / levelShots) * 100);
this.bonusScore = hitrate;
this.currentScore = _root.Functions.score;
this.newScore = _root.Functions.score + this.bonusScore;
/scoreBox.addScore(this.bonusScore);
} else {
gotoAndPlay (56);
}
Symbol 253 MovieClip Frame 90
stop();
_root.Functions.startLevel(_root.Functions.level);