Frame 1
NewgroundsAPI.connectMovie(6852);
Frame 2
goto_after_verification = "intro";
stop();
this.createEmptyMovieClip("ClashHighscores", 0);
fc_verified = true;
onEnterFrame = function () {
if (fc_verified) {
play();
onEnterFrame = undefined;
}
};
Frame 10
gotoAndPlay(goto_after_verification);
Frame 113
gotoAndPlay ("gameintro");
Frame 114
Mouse.show();
stop();
if (_root.music == undefined) {
_root.music = "ON";
}
if ((_root.music == "ON") && (_root.setmusic != "Menu")) {
stopAllSounds();
menuMusic = new Sound();
menuMusic.attachSound("menu");
menuMusic.start(0, 100);
_root.setmusic = "Menu";
}
arcadebut.onRelease = function () {
gotoAndStop ("arcade");
};
arcadebut.onRollOver = function () {
uitleg.gotoAndStop("uitleg3");
};
arcadebut.onRollOut = function () {
uitleg.gotoAndStop("niets");
};
settingsbut.onRelease = function () {
gotoAndStop ("settings");
};
specialbut.onRelease = function () {
gotoAndStop ("special");
};
specialbut.onRollOver = function () {
uitleg.gotoAndStop("uitleg1");
};
specialbut.onRollOut = function () {
uitleg.gotoAndStop("niets");
};
creditsbut.onRelease = function () {
gotoAndStop ("credits");
};
helpbut.onRelease = function () {
gotoAndStop ("help");
};
originalbut.onRelease = function () {
gotoAndStop ("orginalmode");
};
originalbut.onRollOver = function () {
uitleg.gotoAndStop("uitleg2");
};
originalbut.onRollOut = function () {
uitleg.gotoAndStop("niets");
};
Frame 115
function startGame() {
fps = 24;
x = int(gameWidth / 2);
y = gameHeight - 2;
moveTimer = 0;
xVelocity = [-1, 0, 1, 0];
yVelocity = [0, -1, 0, 1];
map = new Array();
var _local2 = 0;
while (_local2 < gameWidth) {
map[_local2] = new Array();
_local2++;
}
turnQueue = new Array();
game.createEmptyMovieClip("food", 1);
game.createEmptyMovieClip("s", 2);
game.createEmptyMovieClip("fireballs", 5);
game.createEmptyMovieClip("bonuses", 4);
scoreTextField.text = "Score: 0";
foodCounter = 0;
snakeBlockCounter = 0;
currentDirection = 1;
snakeEraseCounter = -4;
score = 0;
curBonus = "none";
fireballCounter = 0;
fireBallInterval = 50;
pointBonusInterval = 80;
bonusTimeCounter = 0;
bonusCounter = 0;
pointsPerBlock = 10;
pointsPer50PointsBonus = 50;
tailIncrease = 2;
targetTailLength = 35;
tailDropAmnt = 20;
targetHeartScore = 220;
heartTailDropAmnt = 6;
startFoodAmnt = 2;
targetFoodblockBonusScore = 150;
foodblockBonusIncFactor = 1.5;
fireballTimer = 7 * fps;
pointBonusTimer = 7 * fps;
heartTimer = 7 * fps;
foodblockTimer = 7 * fps;
curBonusses = new Array();
flyingBalls = new Array();
tailWalls = new Array();
textMC.gotoAndStop("hide");
game.onEnterFrame = main;
gameRunning = true;
game.createEmptyMovieClip("wall", 3);
wallCounter = 0;
fireballTargetPoints = fireBallInterval;
pointBonusTargetPoints = pointBonusInterval;
targetTailScorePoints = targetTailScore;
targetHeartScorePoints = targetHeartScore;
foodblockBonusTargetPoints = targetFoodblockBonusScore;
foodblockBonussesEaten = 0;
placeWall(20, 0, "wallMC");
placeWall(20, 1, "wallMC");
placeWall(20, 2, "wallMC");
placeWall(20, 3, "wallMC");
placeWall(20, 6, "wallMC");
placeWall(20, 7, "wallMC");
placeWall(20, 8, "wallMC");
placeWall(20, 9, "wallMC");
placeWall(20, 10, "wallMC");
placeWall(19, 10, "wallMC");
placeWall(18, 10, "wallMC");
placeWall(17, 10, "wallMC");
placeWall(16, 10, "wallMC");
placeWall(15, 10, "wallMC");
placeWall(14, 10, "wallMC");
placeWall(13, 10, "wallMC");
placeWall(12, 10, "wallMC");
placeWall(9, 10, "wallMC");
placeWall(8, 10, "wallMC");
placeWall(7, 10, "wallMC");
placeWall(6, 10, "wallMC");
placeWall(5, 10, "wallMC");
placeWall(4, 10, "wallMC");
placeWall(3, 10, "wallMC");
placeWall(2, 10, "wallMC");
placeWall(1, 10, "wallMC");
placeWall(0, 10, "wallMC");
placeWall(43, 29, "wallMC");
placeWall(43, 28, "wallMC");
placeWall(44, 28, "wallMC");
placeWall(44, 29, "wallMC");
placeWall(42, 29, "wallMC");
placeWall(44, 27, "wallMC");
placeWall(32, 15, "wallMC");
placeWall(32, 8, "wallMC");
placeWall(35, 24, "wallMC");
var _local3 = 0;
while (_local3 < startFoodAmnt) {
placeFood();
_local3++;
}
_root.bonusindi.gotoAndStop("none");
}
function fireball() {
fireballs--;
var _local1 = game.fireballs.attachMovie("fireball_powerup", "fireball_" + fireballCounter, fireballCounter);
_local1._x = (x * blockSize) + ((blockSize / 2) * Math.abs(yVelocity[currentDirection]));
_local1._y = (y * blockSize) + ((blockSize / 2) * Math.abs(xVelocity[currentDirection]));
_local1.x = x + xVelocity[currentDirection];
_local1.y = y + yVelocity[currentDirection];
if (xVelocity[currentDirection] != 0) {
_local1._rotation = xVelocity[currentDirection] * 90;
} else if (yVelocity[currentDirection] > 0) {
_local1._rotation = yVelocity[currentDirection] * 180;
}
fireballCounter++;
_local1.xVelocity = xVelocity[currentDirection];
_local1.yVelocity = yVelocity[currentDirection];
flyingBalls.push(_local1);
}
function flyballs() {
var _local3;
var _local1 = 0;
while (_local1 < flyingBalls.length) {
_local3 = false;
if (map[flyingBalls[_local1].x][flyingBalls[_local1].y].blockClass == "wall") {
map[flyingBalls[_local1].x][flyingBalls[_local1].y].blockClass = "destroyed";
map[flyingBalls[_local1].x][flyingBalls[_local1].y].gotoAndStop("explode");
var _local2 = 0;
while (_local2 < tailWalls.length) {
if (((tailWalls[_local2]._x / blockSize) == flyingBalls[_local1].x) && ((tailWalls[_local2]._y / blockSize) == flyingBalls[_local1].y)) {
tailWalls.splice(_local2, 1);
}
_local2++;
}
_local3 = true;
}
if ((((_local3 || (flyingBalls[_local1].x < -1)) || (flyingBalls[_local1].x >= gameWidth)) || (flyingBalls[_local1].y < -1)) || (flyingBalls[_local1].y >= gameHeight)) {
flyingBalls[_local1].removeMovieClip();
flyingBalls.splice(_local1, 1);
_local1--;
} else {
flyingBalls[_local1]._x = flyingBalls[_local1]._x + (flyingBalls[_local1].xVelocity * blockSize);
flyingBalls[_local1].x = flyingBalls[_local1].x + flyingBalls[_local1].xVelocity;
flyingBalls[_local1]._y = flyingBalls[_local1]._y + (flyingBalls[_local1].yVelocity * blockSize);
flyingBalls[_local1].y = flyingBalls[_local1].y + flyingBalls[_local1].yVelocity;
}
_local1++;
}
}
function useBonus() {
switch (curBonus) {
case "fireball" :
fireball();
break;
default :
}
curBonus = "none";
_root.bonusindi.gotoAndStop(curBonus);
}
function controlBonusses() {
if (score >= fireballTargetPoints) {
fireballTargetPoints = fireballTargetPoints + fireBallInterval;
placeBonus("fireball");
}
if ((score >= pointBonusTargetPoints) && (tailWalls.length)) {
pointBonusTargetPoints = pointBonusTargetPoints + pointBonusInterval;
placeBonus("pointBonus");
}
if (score >= targetHeartScore) {
targetHeartScore = targetHeartScore + targetHeartScorePoints;
placeBonus("heart");
}
if (score >= foodblockBonusTargetPoints) {
foodblockBonussesEaten++;
foodblockBonusTargetPoints = foodblockBonusTargetPoints + (targetFoodblockBonusScore * Math.pow(foodblockBonusIncFactor, foodblockBonussesEaten));
placeBonus("foodblock");
}
}
function removeBonusses() {
var _local1 = 0;
while (_local1 < curBonusses.length) {
if (map[curBonusses[_local1].x][curBonusses[_local1].y].deleteTimer == 0) {
map[curBonusses[_local1].x][curBonusses[_local1].y].removeMovieClip();
curBonusses.splice(_local1, 1);
_local1--;
} else {
if (((map[curBonusses[_local1].x][curBonusses[_local1].y].deleteTimer - 1) < (curBonusses[_local1].maxTime / 2)) && (map[curBonusses[_local1].x][curBonusses[_local1].y].deleteTimer >= (curBonusses[_local1].maxTime / 2))) {
map[curBonusses[_local1].x][curBonusses[_local1].y].gotoAndPlay(2);
}
map[curBonusses[_local1].x][curBonusses[_local1].y].deleteTimer--;
}
_local1++;
}
}
function controlTimeSpecials() {
if ((bonusTimeCounter % bombTimer) == 0) {
}
bonusTimeCounter++;
}
function main() {
flyballs();
removeBonusses();
if ((moveTimer % moveSpeed) == 0) {
if (turnQueue.length > 0) {
var _local3 = turnQueue.pop();
if ((_local3 % 2) != (currentDirection % 2)) {
currentDirection = _local3;
}
}
x = x + xVelocity[currentDirection];
y = y + yVelocity[currentDirection];
moveTimer = 0;
if ((((((map[x][y].blockClass != "snakeTail") && (map[x][y].blockClass != "wall")) && (x > -1)) && (x < gameWidth)) && (y > -1)) && (y < gameHeight)) {
game.s.attachMovie("snakeMC", snakeBlockCounter, snakeBlockCounter, {_x:x * blockSize, _y:y * blockSize});
game.s[snakeBlockCounter].gotoAndStop(2);
game.s[snakeBlockCounter].blockClass = "snakeHead";
game.s[snakeBlockCounter - 1].gotoAndStop(1);
game.s[snakeBlockCounter - 1].blockClass = "snakeTail";
snakeBlockCounter++;
if (map[x][y].blockClass == "food") {
score = score + pointsPerBlock;
scoreTextField.text = "Score: " + score;
snakeEraseCounter = snakeEraseCounter - tailIncrease;
placeFood(map[x][y]);
controlBonusses();
map[x][y].removeMovieClip();
}
if (map[x][y].blockClass == "bonus_fireball") {
curBonus = "fireball";
map[x][y].removeMovieClip();
_root.bonusindi.gotoAndStop(curBonus);
}
if (map[x][y].blockClass == "bonus_pointBonus") {
map[x][y].removeMovieClip();
score = score + pointsPer50PointsBonus;
scoreTextField.text = "Score: " + score;
controlBonusses();
}
if (map[x][y].blockClass == "bonus_foodblock") {
map[x][y].removeMovieClip();
placeFood();
}
if (map[x][y].blockClass == "bonus_heart") {
map[x][y].removeMovieClip();
var _local2 = 0;
while (_local2 < heartTailDropAmnt) {
tailMC = game.s[snakeEraseCounter];
if (tailMC) {
delete map[tailMC._x / blockSize][tailMC._y / blockSize];
tailMC.removeMovieClip();
}
snakeEraseCounter++;
_local2++;
}
}
map[x][y] = game.s[snakeBlockCounter - 1];
var tailMC;
if ((snakeBlockCounter - snakeEraseCounter) >= targetTailLength) {
var _local2 = 0;
while (_local2 < tailDropAmnt) {
tailMC = game.s[snakeEraseCounter];
if (tailMC) {
placeWall(tailMC._x / blockSize, tailMC._y / blockSize, "wallMCTail", "tail");
tailMC.removeMovieClip();
}
snakeEraseCounter++;
_local2++;
}
}
tailMC = game.s[snakeEraseCounter];
if (tailMC) {
delete map[tailMC._x / blockSize][tailMC._y / blockSize];
tailMC.removeMovieClip();
}
snakeEraseCounter++;
} else {
gameOver();
}
}
moveTimer++;
}
function gameOver() {
textMC.gotoAndStop("gameOver");
delete game.onEnterFrame;
gameRunning = false;
}
function placeWall(x, y, type, walllabel) {
if (walllabel == undefined) {
walllabel = "wall";
}
wallMC = game.wall.attachMovie(type, wallCounter, wallCounter);
wallCounter++;
wallMC._x = x * blockSize;
wallMC._y = y * blockSize;
wallMC.blockClass = "wall";
wallMC.blockLabel = walllabel;
map[x][y] = wallMC;
if (walllabel == "tail") {
tailWalls.push(wallMC);
}
}
function placeFood() {
do {
var xFood = random(gameWidth);
var yFood = random(gameHeight);
} while (map[xFood][yFood] != undefined);
var _local1 = game.food.attachMovie("foodMC", foodCounter, foodCounter);
foodCounter++;
_local1._x = xFood * blockSize;
_local1._y = yFood * blockSize;
_local1.blockClass = "food";
map[xFood][yFood] = _local1;
}
function placeBonus(bonustype) {
var _local5;
var _local3;
var _local2;
if (bonustype == "pointBonus") {
_local5 = Math.floor(Math.random() * tailWalls.length);
_local3 = tailWalls[_local5]._x / blockSize;
_local2 = tailWalls[_local5]._y / blockSize;
tailWalls[_local5].removeMovieClip();
tailWalls.splice(_local5, 1);
} else {
do {
_local3 = random(gameWidth);
_local2 = random(gameHeight);
} while (map[_local3][_local2] != undefined);
}
var _local4 = game.bonuses.attachMovie("bonus_" + bonustype, bonusCounter, bonusCounter);
bonusCounter++;
_local4._x = _local3 * blockSize;
_local4._y = _local2 * blockSize;
_local4.blockClass = "bonus_" + bonustype;
_local4.deleteTimer = _root[bonustype + "Timer"];
curBonusses.push({x:_local3, y:_local2, maxTime:_root[bonustype + "Timer"]});
map[_local3][_local2] = _local4;
}
Mouse.show();
stop();
lvl1buts.onRelease = function () {
gotoAndStop ("lvl1s");
};
lvl2buts.onRelease = function () {
gotoAndStop ("lvl2s");
};
lvl3buts.onRelease = function () {
gotoAndStop ("lvl3s");
};
keyListener = new Object();
keyListener.onKeyDown = function () {
var _local1 = Key.getCode();
if ((_local1 > 36) && (_local1 < 41)) {
if (game.onEnterFrame != undefined) {
if ((_local1 - 37) != turnQueue[0]) {
turnQueue.unshift(_local1 - 37);
}
}
} else if (_local1 == 32) {
if (!gameRunning) {
startGame();
} else {
useBonus();
}
} else if (_local1 == 80) {
if (gameRunning) {
if (game.onEnterFrame) {
delete game.onEnterFrame;
textMC.gotoAndStop("paused");
} else {
game.onEnterFrame = main;
textMC.gotoAndStop("hide");
}
}
}
};
Key.addListener(keyListener);
_root.kongregateStats.submit("Points", _root.points);
Frame 116
Mouse.show();
stop();
if ((_root.music == "ON") && (_root.setmusic != "tiesto")) {
stopAllSounds();
menuMusic = new Sound();
menuMusic.attachSound("tiesto");
menuMusic.start(0, 100);
_root.setmusic = "tiesto";
}
back.onRelease = function () {
gotoAndStop ("menu");
};
Frame 117
Mouse.show();
stop();
back.onRelease = function () {
gotoAndStop ("menu");
};
gamequal.gotoAndStop(_quality);
gfxbut.onRelease = function () {
switch (_quality) {
case "HIGH" :
_quality = "MEDIUM";
break;
case "MEDIUM" :
_quality = "LOW";
break;
case "LOW" :
_quality = "HIGH";
break;
}
gamequal.gotoAndStop(_quality);
};
mus.gotoAndStop(_root.music);
soundsbut.onRelease = function () {
switch (_root.music) {
case "ON" :
_root.music = "OFF";
stopAllSounds();
break;
case "OFF" :
_root.music = "ON";
menuMusic = new Sound();
menuMusic.attachSound("menu");
menuMusic.start(0, 100);
_root.setmusic = "menu";
break;
}
mus.gotoAndStop(_root.music);
};
Frame 118
Mouse.show();
stop();
back.onRelease = function () {
gotoAndStop ("menu");
};
Frame 119
Mouse.show();
stop();
lvl1but.onRelease = function () {
gotoAndStop ("lvl1");
};
if (_root.level2unlocked) {
lvl2but.onRelease = function () {
gotoAndStop ("lvl2");
};
locked2.gotoAndStop(2);
}
if (_root.level3unlocked) {
lvl3but.onRelease = function () {
gotoAndStop ("lvl3");
};
locked3.gotoAndStop(2);
}
if (_root.level4unlocked) {
lvl4but.onRelease = function () {
gotoAndStop ("lvl4");
};
locked4.gotoAndStop(2);
}
if (_root.level5unlocked) {
lvl5but.onRelease = function () {
gotoAndStop ("lvl5");
};
locked5.gotoAndStop(2);
}
if (_root.level6unlocked) {
lvl6but.onRelease = function () {
gotoAndStop ("lvl6");
};
locked6.gotoAndStop(2);
}
if (_root.level7unlocked) {
lvl7but.onRelease = function () {
gotoAndStop ("lvl7");
};
locked7.gotoAndStop(2);
}
if (_root.level8unlocked) {
lvl8but.onRelease = function () {
gotoAndStop ("lvl8");
};
locked8.gotoAndStop(2);
}
if (_root.level9unlocked) {
speciallvlbut.onRelease = function () {
gotoAndStop ("speciallvl");
};
locked9.gotoAndStop(2);
}
Frame 120
Mouse.show();
stop();
easy.onRelease = function () {
gotoAndStop ("game_easy");
};
medium.onRelease = function () {
gotoAndStop ("game_medium");
};
hard.onRelease = function () {
gotoAndStop ("game_hard");
};
Frame 121
function startGame() {
x = int(gameWidth / 2);
y = gameHeight - 2;
moveTimer = 0;
xVelocity = [-1, 0, 1, 0];
yVelocity = [0, -1, 0, 1];
map = new Array();
var _local1 = 0;
while (_local1 < gameWidth) {
map[_local1] = new Array();
_local1++;
}
turnQueue = new Array();
game.createEmptyMovieClip("food", 1);
game.createEmptyMovieClip("s", 2);
scoreTextField.text = "Score: 0";
foodCounter = 0;
snakeBlockCounter = 0;
currentDirection = 1;
snakeEraseCounter = -5;
score = 0;
placeFood("new");
textMC.gotoAndStop("hide");
game.onEnterFrame = main;
gameRunning = true;
}
function main() {
if ((moveTimer % moveSpeed) == 0) {
if (turnQueue.length > 0) {
var _local2 = turnQueue.pop();
if ((_local2 % 2) != (currentDirection % 2)) {
currentDirection = _local2;
}
}
x = x + xVelocity[currentDirection];
y = y + yVelocity[currentDirection];
moveTimer = 0;
if (((((map[x][y] != SNAKE_BLOCK) && (x > -1)) && (x < gameWidth)) && (y > -1)) && (y < gameHeight)) {
game.s.attachMovie("snakeMC", snakeBlockCounter, snakeBlockCounter, {_x:x * blockSize, _y:y * blockSize});
game.s[snakeBlockCounter].gotoAndStop(2);
game.s[snakeBlockCounter - 1].gotoAndStop(1);
snakeBlockCounter++;
if (typeof(map[x][y]) == "movieclip") {
score = score + 10;
scoreTextField.text = "Score: " + score;
snakeEraseCounter = snakeEraseCounter - 1;
placeFood(map[x][y]);
}
map[x][y] = SNAKE_BLOCK;
var _local1 = game.s[snakeEraseCounter];
if (_local1) {
delete map[_local1._x / blockSize][_local1._y / blockSize];
_local1.removeMovieClip();
}
snakeEraseCounter++;
} else {
gameOver();
}
}
moveTimer++;
}
function gameOver() {
textMC.gotoAndStop("gameOver");
delete game.onEnterFrame;
gameRunning = false;
}
function placeFood(foodMC) {
do {
var xFood = random(gameWidth);
var yFood = random(gameHeight);
} while (map[xFood][yFood]);
if (foodMC == "new") {
foodMC = game.food.attachMovie("foodMC", foodCounter, foodCounter);
foodCounter++;
}
foodMC._x = xFood * blockSize;
foodMC._y = yFood * blockSize;
map[xFood][yFood] = foodMC;
}
Mouse.show();
if ((_root.music == "ON") && (_root.setmusic != "ocean")) {
stopAllSounds();
menuMusic = new Sound();
menuMusic.attachSound("ocean");
menuMusic.start(0, 100);
_root.setmusic = "ocean";
}
blockSize = 8;
gameHeight = 30;
gameWidth = 45;
SNAKE_BLOCK = 1;
moveSpeed = 3;
keyListener = new Object();
keyListener.onKeyDown = function () {
var _local1 = Key.getCode();
if ((_local1 > 36) && (_local1 < 41)) {
if (game.onEnterFrame != undefined) {
if ((_local1 - 37) != turnQueue[0]) {
turnQueue.unshift(_local1 - 37);
}
}
} else if (_local1 == 32) {
if (!gameRunning) {
startGame();
}
} else if (_local1 == 80) {
if (gameRunning) {
if (game.onEnterFrame) {
delete game.onEnterFrame;
textMC.gotoAndStop("paused");
} else {
game.onEnterFrame = main;
textMC.gotoAndStop("hide");
}
}
}
};
Key.addListener(keyListener);
Frame 122
function startGame() {
x = int(gameWidth / 2);
y = gameHeight - 2;
moveTimer = 0;
xVelocity = [-1, 0, 1, 0];
yVelocity = [0, -1, 0, 1];
map = new Array();
var _local1 = 0;
while (_local1 < gameWidth) {
map[_local1] = new Array();
_local1++;
}
turnQueue = new Array();
game.createEmptyMovieClip("food", 1);
game.createEmptyMovieClip("s", 2);
scoreTextField.text = "Score: 0";
foodCounter = 0;
snakeBlockCounter = 0;
currentDirection = 1;
snakeEraseCounter = -3;
score = 0;
placeFood("new");
textMC.gotoAndStop("hide");
game.onEnterFrame = main;
gameRunning = true;
game.createEmptyMovieClip("wall", 3);
wallCounter = 0;
placeWall(5, 5, "wallMC");
placeWall(6, 5, "wallMC");
placeWall(7, 5, "wallMC");
placeWall(8, 5, "wallMC");
placeWall(9, 5, "wallMC");
placeWall(10, 5, "wallMC");
placeWall(11, 5, "wallMC");
placeWall(12, 5, "wallMC");
placeWall(13, 5, "wallMC");
placeWall(14, 5, "wallMC");
placeWall(15, 5, "wallMC");
placeWall(16, 5, "wallMC");
placeWall(17, 5, "wallMC");
placeWall(18, 5, "wallMC");
placeWall(19, 5, "wallMC");
placeWall(20, 5, "wallMC");
placeWall(21, 5, "wallMC");
placeWall(22, 5, "wallMC");
placeWall(23, 5, "wallMC");
placeWall(24, 5, "wallMC");
placeWall(25, 5, "wallMC");
placeWall(26, 5, "wallMC");
placeWall(27, 5, "wallMC");
placeWall(28, 5, "wallMC");
placeWall(29, 5, "wallMC");
placeWall(30, 5, "wallMC");
placeWall(31, 5, "wallMC");
placeWall(32, 5, "wallMC");
placeWall(33, 5, "wallMC");
placeWall(34, 5, "wallMC");
placeWall(35, 5, "wallMC");
placeWall(36, 5, "wallMC");
placeWall(37, 5, "wallMC");
placeWall(38, 5, "wallMC");
placeWall(39, 5, "wallMC");
placeWall(5, 24, "wallMC");
placeWall(6, 24, "wallMC");
placeWall(7, 24, "wallMC");
placeWall(8, 24, "wallMC");
placeWall(9, 24, "wallMC");
placeWall(10, 24, "wallMC");
placeWall(11, 24, "wallMC");
placeWall(12, 24, "wallMC");
placeWall(13, 24, "wallMC");
placeWall(14, 24, "wallMC");
placeWall(15, 24, "wallMC");
placeWall(16, 24, "wallMC");
placeWall(17, 24, "wallMC");
placeWall(18, 24, "wallMC");
placeWall(19, 24, "wallMC");
placeWall(20, 24, "wallMC");
placeWall(21, 24, "wallMC");
placeWall(23, 24, "wallMC");
placeWall(24, 24, "wallMC");
placeWall(25, 24, "wallMC");
placeWall(26, 24, "wallMC");
placeWall(27, 24, "wallMC");
placeWall(28, 24, "wallMC");
placeWall(29, 24, "wallMC");
placeWall(30, 24, "wallMC");
placeWall(31, 24, "wallMC");
placeWall(32, 24, "wallMC");
placeWall(33, 24, "wallMC");
placeWall(34, 24, "wallMC");
placeWall(35, 24, "wallMC");
placeWall(36, 24, "wallMC");
placeWall(37, 24, "wallMC");
placeWall(38, 24, "wallMC");
placeWall(39, 24, "wallMC");
}
function main() {
if ((moveTimer % moveSpeed) == 0) {
if (turnQueue.length > 0) {
var _local2 = turnQueue.pop();
if ((_local2 % 2) != (currentDirection % 2)) {
currentDirection = _local2;
}
}
x = x + xVelocity[currentDirection];
y = y + yVelocity[currentDirection];
moveTimer = 0;
if (((((map[x][y] != SNAKE_BLOCK) && (x > -1)) && (x < gameWidth)) && (y > -1)) && (y < gameHeight)) {
game.s.attachMovie("snakeMC", snakeBlockCounter, snakeBlockCounter, {_x:x * blockSize, _y:y * blockSize});
game.s[snakeBlockCounter].gotoAndStop(2);
game.s[snakeBlockCounter - 1].gotoAndStop(1);
snakeBlockCounter++;
if (typeof(map[x][y]) == "movieclip") {
score = score + 10;
scoreTextField.text = "Score: " + score;
snakeEraseCounter = snakeEraseCounter - 3;
placeFood(map[x][y]);
}
map[x][y] = SNAKE_BLOCK;
var _local1 = game.s[snakeEraseCounter];
if (_local1) {
delete map[_local1._x / blockSize][_local1._y / blockSize];
_local1.removeMovieClip();
}
snakeEraseCounter++;
} else {
gameOver();
}
}
moveTimer++;
}
function gameOver() {
textMC.gotoAndStop("gameOver");
delete game.onEnterFrame;
gameRunning = false;
}
function placeFood(foodMC) {
do {
var xFood = random(gameWidth);
var yFood = random(gameHeight);
} while (map[xFood][yFood]);
if (foodMC == "new") {
foodMC = game.food.attachMovie("foodMC", foodCounter, foodCounter);
foodCounter++;
}
foodMC._x = xFood * blockSize;
foodMC._y = yFood * blockSize;
map[xFood][yFood] = foodMC;
}
function placeWall(x, y, type) {
wallMC = game.wall.attachMovie(type, wallCounter, wallCounter);
wallCounter++;
wallMC._x = x * blockSize;
wallMC._y = y * blockSize;
map[x][y] = 1;
}
Mouse.show();
if ((_root.music == "ON") && (_root.setmusic != "ocean")) {
stopAllSounds();
menuMusic = new Sound();
menuMusic.attachSound("ocean");
menuMusic.start(0, 100);
_root.setmusic = "ocean";
}
blockSize = 8;
gameHeight = 30;
gameWidth = 45;
SNAKE_BLOCK = 1;
moveSpeed = 2;
keyListener = new Object();
keyListener.onKeyDown = function () {
var _local1 = Key.getCode();
if ((_local1 > 36) && (_local1 < 41)) {
if (game.onEnterFrame != undefined) {
if ((_local1 - 37) != turnQueue[0]) {
turnQueue.unshift(_local1 - 37);
}
}
} else if (_local1 == 32) {
if (!gameRunning) {
startGame();
}
} else if (_local1 == 80) {
if (gameRunning) {
if (game.onEnterFrame) {
delete game.onEnterFrame;
textMC.gotoAndStop("paused");
} else {
game.onEnterFrame = main;
textMC.gotoAndStop("hide");
}
}
}
};
Key.addListener(keyListener);
Frame 123
function startGame() {
x = int(gameWidth / 2);
y = gameHeight - 2;
moveTimer = 0;
xVelocity = [-1, 0, 1, 0];
yVelocity = [0, -1, 0, 1];
map = new Array();
var _local1 = 0;
while (_local1 < gameWidth) {
map[_local1] = new Array();
_local1++;
}
turnQueue = new Array();
game.createEmptyMovieClip("food", 1);
game.createEmptyMovieClip("s", 2);
scoreTextField.text = "Score: 0";
foodCounter = 0;
snakeBlockCounter = 0;
currentDirection = 1;
snakeEraseCounter = -1;
score = 0;
placeFood("new");
textMC.gotoAndStop("hide");
game.onEnterFrame = main;
gameRunning = true;
game.createEmptyMovieClip("wall", 3);
wallCounter = 0;
placeWall(5, 5, "wallMC");
placeWall(6, 5, "wallMC");
placeWall(7, 5, "wallMC");
placeWall(8, 5, "wallMC");
placeWall(9, 5, "wallMC");
placeWall(10, 5, "wallMC");
placeWall(11, 5, "wallMC");
placeWall(12, 5, "wallMC");
placeWall(13, 5, "wallMC");
placeWall(14, 5, "wallMC");
placeWall(5, 6, "wallMC");
placeWall(5, 7, "wallMC");
placeWall(5, 8, "wallMC");
placeWall(5, 9, "wallMC");
placeWall(5, 10, "wallMC");
placeWall(5, 11, "wallMC");
placeWall(39, 11, "wallMC");
placeWall(39, 10, "wallMC");
placeWall(39, 9, "wallMC");
placeWall(39, 8, "wallMC");
placeWall(39, 7, "wallMC");
placeWall(39, 6, "wallMC");
placeWall(30, 5, "wallMC");
placeWall(31, 5, "wallMC");
placeWall(32, 5, "wallMC");
placeWall(33, 5, "wallMC");
placeWall(34, 5, "wallMC");
placeWall(35, 5, "wallMC");
placeWall(36, 5, "wallMC");
placeWall(37, 5, "wallMC");
placeWall(38, 5, "wallMC");
placeWall(39, 5, "wallMC");
placeWall(5, 24, "wallMC");
placeWall(6, 24, "wallMC");
placeWall(7, 24, "wallMC");
placeWall(8, 24, "wallMC");
placeWall(9, 24, "wallMC");
placeWall(10, 24, "wallMC");
placeWall(11, 24, "wallMC");
placeWall(12, 24, "wallMC");
placeWall(13, 24, "wallMC");
placeWall(14, 24, "wallMC");
placeWall(5, 23, "wallMC");
placeWall(5, 22, "wallMC");
placeWall(5, 21, "wallMC");
placeWall(5, 20, "wallMC");
placeWall(5, 19, "wallMC");
placeWall(5, 18, "wallMC");
placeWall(39, 18, "wallMC");
placeWall(39, 19, "wallMC");
placeWall(39, 20, "wallMC");
placeWall(39, 21, "wallMC");
placeWall(39, 22, "wallMC");
placeWall(39, 23, "wallMC");
placeWall(30, 24, "wallMC");
placeWall(31, 24, "wallMC");
placeWall(32, 24, "wallMC");
placeWall(33, 24, "wallMC");
placeWall(34, 24, "wallMC");
placeWall(35, 24, "wallMC");
placeWall(36, 24, "wallMC");
placeWall(37, 24, "wallMC");
placeWall(38, 24, "wallMC");
placeWall(39, 24, "wallMC");
placeWall(20, 12, "wallMC");
placeWall(21, 12, "wallMC");
placeWall(20, 13, "wallMC");
placeWall(21, 13, "wallMC");
placeWall(23, 12, "wallMC");
placeWall(24, 12, "wallMC");
placeWall(23, 13, "wallMC");
placeWall(24, 13, "wallMC");
placeWall(20, 15, "wallMC");
placeWall(21, 15, "wallMC");
placeWall(20, 16, "wallMC");
placeWall(21, 16, "wallMC");
placeWall(23, 15, "wallMC");
placeWall(24, 15, "wallMC");
placeWall(23, 16, "wallMC");
placeWall(24, 16, "wallMC");
}
function main() {
if ((moveTimer % moveSpeed) == 0) {
if (turnQueue.length > 0) {
var _local2 = turnQueue.pop();
if ((_local2 % 2) != (currentDirection % 2)) {
currentDirection = _local2;
}
}
x = x + xVelocity[currentDirection];
y = y + yVelocity[currentDirection];
moveTimer = 0;
if (((((map[x][y] != SNAKE_BLOCK) && (x > -1)) && (x < gameWidth)) && (y > -1)) && (y < gameHeight)) {
game.s.attachMovie("snakeMC", snakeBlockCounter, snakeBlockCounter, {_x:x * blockSize, _y:y * blockSize});
game.s[snakeBlockCounter].gotoAndStop(2);
game.s[snakeBlockCounter - 1].gotoAndStop(1);
snakeBlockCounter++;
if (typeof(map[x][y]) == "movieclip") {
score = score + 10;
scoreTextField.text = "Score: " + score;
snakeEraseCounter = snakeEraseCounter - 8;
placeFood(map[x][y]);
}
map[x][y] = SNAKE_BLOCK;
var _local1 = game.s[snakeEraseCounter];
if (_local1) {
delete map[_local1._x / blockSize][_local1._y / blockSize];
_local1.removeMovieClip();
}
snakeEraseCounter++;
} else {
gameOver();
}
}
moveTimer++;
}
function gameOver() {
textMC.gotoAndStop("gameOver");
delete game.onEnterFrame;
gameRunning = false;
}
function placeFood(foodMC) {
do {
var xFood = random(gameWidth);
var yFood = random(gameHeight);
} while (map[xFood][yFood]);
if (foodMC == "new") {
foodMC = game.food.attachMovie("foodMC", foodCounter, foodCounter);
foodCounter++;
}
foodMC._x = xFood * blockSize;
foodMC._y = yFood * blockSize;
map[xFood][yFood] = foodMC;
}
function placeWall(x, y, type) {
wallMC = game.wall.attachMovie(type, wallCounter, wallCounter);
wallCounter++;
wallMC._x = x * blockSize;
wallMC._y = y * blockSize;
map[x][y] = 1;
}
Mouse.show();
if ((_root.music == "ON") && (_root.setmusic != "ocean")) {
stopAllSounds();
menuMusic = new Sound();
menuMusic.attachSound("ocean");
menuMusic.start(0, 100);
_root.setmusic = "ocean";
}
blockSize = 8;
gameHeight = 30;
gameWidth = 45;
SNAKE_BLOCK = 1;
moveSpeed = 1;
keyListener = new Object();
keyListener.onKeyDown = function () {
var _local1 = Key.getCode();
if ((_local1 > 36) && (_local1 < 41)) {
if (game.onEnterFrame != undefined) {
if ((_local1 - 37) != turnQueue[0]) {
turnQueue.unshift(_local1 - 37);
}
}
} else if (_local1 == 32) {
if (!gameRunning) {
startGame();
}
} else if (_local1 == 80) {
if (gameRunning) {
if (game.onEnterFrame) {
delete game.onEnterFrame;
textMC.gotoAndStop("paused");
} else {
game.onEnterFrame = main;
textMC.gotoAndStop("hide");
}
}
}
};
Key.addListener(keyListener);
Frame 124
function startGame() {
x = int(gameWidth / 2);
y = gameHeight - 2;
moveTimer = 0;
xVelocity = [-1, 0, 1, 0];
yVelocity = [0, -1, 0, 1];
map = new Array();
var _local1 = 0;
while (_local1 < gameWidth) {
map[_local1] = new Array();
_local1++;
}
turnQueue = new Array();
game.createEmptyMovieClip("food", 1);
game.createEmptyMovieClip("s", 2);
scoreTextField.text = "Score: 0";
foodCounter = 0;
snakeBlockCounter = 0;
currentDirection = 1;
snakeEraseCounter = -10;
score = 0;
placeFood("new");
textMC.gotoAndStop("hide");
game.onEnterFrame = main;
gameRunning = true;
}
function main() {
if ((moveTimer % moveSpeed) == 0) {
if (turnQueue.length > 0) {
var _local3 = turnQueue.pop();
if ((_local3 % 2) != (currentDirection % 2)) {
currentDirection = _local3;
}
}
x = x + xVelocity[currentDirection];
y = y + yVelocity[currentDirection];
moveTimer = 0;
if (((((map[x][y] != SNAKE_BLOCK) && (x > -1)) && (x < gameWidth)) && (y > -1)) && (y < gameHeight)) {
game.s.attachMovie("snakeMC", snakeBlockCounter, snakeBlockCounter, {_x:x * blockSize, _y:y * blockSize});
game.s[snakeBlockCounter].gotoAndStop(2);
game.s[snakeBlockCounter - 1].gotoAndStop(1);
snakeBlockCounter++;
if (typeof(map[x][y]) == "movieclip") {
score = score + 10;
if (score >= 50) {
_root.level2unlocked = true;
gameOver(true);
}
scoreTextField.text = "Score: " + score;
snakeEraseCounter = snakeEraseCounter - 3;
placeFood(map[x][y]);
}
map[x][y] = SNAKE_BLOCK;
var _local2 = game.s[snakeEraseCounter];
if (_local2) {
delete map[_local2._x / blockSize][_local2._y / blockSize];
_local2.removeMovieClip();
}
snakeEraseCounter++;
} else {
gameOver();
}
}
moveTimer++;
}
function gameOver(win) {
if (win) {
textMC.gotoAndStop("win");
} else {
textMC.gotoAndStop("gameOver");
}
delete game.onEnterFrame;
gameRunning = false;
}
function placeFood(foodMC) {
do {
var xFood = random(gameWidth);
var yFood = random(gameHeight);
} while (map[xFood][yFood]);
if (foodMC == "new") {
foodMC = game.food.attachMovie("foodMC", foodCounter, foodCounter);
foodCounter++;
}
foodMC._x = xFood * blockSize;
foodMC._y = yFood * blockSize;
map[xFood][yFood] = foodMC;
}
function placeWall(x, y, type) {
wallMC = game.wall.attachMovie(type, wallCounter, wallCounter);
wallCounter++;
wallMC._x = x * blockSize;
wallMC._y = y * blockSize;
map[x][y] = 1;
}
Mouse.show();
if ((_root.music == "ON") && (_root.setmusic != "ocean")) {
stopAllSounds();
menuMusic = new Sound();
menuMusic.attachSound("ocean");
menuMusic.start(0, 100);
_root.setmusic = "ocean";
}
blockSize = 8;
gameHeight = 30;
gameWidth = 45;
SNAKE_BLOCK = 1;
moveSpeed = 2;
keyListener = new Object();
keyListener.onKeyDown = function () {
var _local1 = Key.getCode();
if ((_local1 > 36) && (_local1 < 41)) {
if (game.onEnterFrame != undefined) {
if ((_local1 - 37) != turnQueue[0]) {
turnQueue.unshift(_local1 - 37);
}
}
} else if (_local1 == 32) {
if (!gameRunning) {
startGame();
}
} else if (_local1 == 80) {
if (gameRunning) {
if (game.onEnterFrame) {
delete game.onEnterFrame;
textMC.gotoAndStop("paused");
} else {
game.onEnterFrame = main;
textMC.gotoAndStop("hide");
}
}
}
};
Key.addListener(keyListener);
Frame 125
function startGame() {
x = int(gameWidth / 2);
y = gameHeight - 2;
moveTimer = 0;
xVelocity = [-1, 0, 1, 0];
yVelocity = [0, -1, 0, 1];
map = new Array();
var _local1 = 0;
while (_local1 < gameWidth) {
map[_local1] = new Array();
_local1++;
}
turnQueue = new Array();
game.createEmptyMovieClip("food", 1);
game.createEmptyMovieClip("s", 2);
scoreTextField.text = "Score: 0";
foodCounter = 0;
snakeBlockCounter = 0;
currentDirection = 1;
snakeEraseCounter = -4;
score = 0;
placeFood("new");
textMC.gotoAndStop("hide");
game.onEnterFrame = main;
gameRunning = true;
game.createEmptyMovieClip("wall", 3);
wallCounter = 0;
placeWall(5, 5, "wallMC");
placeWall(7, 5, "wallMC");
placeWall(9, 5, "wallMC");
placeWall(11, 5, "wallMC");
placeWall(13, 5, "wallMC");
placeWall(15, 5, "wallMC");
placeWall(17, 5, "wallMC");
placeWall(19, 5, "wallMC");
placeWall(21, 5, "wallMC");
placeWall(23, 5, "wallMC");
placeWall(25, 5, "wallMC");
placeWall(27, 5, "wallMC");
placeWall(29, 5, "wallMC");
placeWall(31, 5, "wallMC");
placeWall(33, 5, "wallMC");
placeWall(35, 5, "wallMC");
placeWall(37, 5, "wallMC");
placeWall(39, 5, "wallMC");
placeWall(5, 24, "wallMC");
placeWall(6, 24, "wallMC");
placeWall(7, 24, "wallMC");
placeWall(8, 24, "wallMC");
placeWall(9, 24, "wallMC");
placeWall(10, 24, "wallMC");
placeWall(11, 24, "wallMC");
placeWall(12, 24, "wallMC");
placeWall(13, 24, "wallMC");
placeWall(14, 24, "wallMC");
placeWall(15, 24, "wallMC");
placeWall(16, 24, "wallMC");
placeWall(17, 24, "wallMC");
placeWall(18, 24, "wallMC");
placeWall(19, 24, "wallMC");
placeWall(20, 24, "wallMC");
placeWall(21, 24, "wallMC");
placeWall(23, 24, "wallMC");
placeWall(24, 24, "wallMC");
placeWall(25, 24, "wallMC");
placeWall(26, 24, "wallMC");
placeWall(27, 24, "wallMC");
placeWall(28, 24, "wallMC");
placeWall(29, 24, "wallMC");
placeWall(30, 24, "wallMC");
placeWall(31, 24, "wallMC");
placeWall(32, 24, "wallMC");
placeWall(33, 24, "wallMC");
placeWall(34, 24, "wallMC");
placeWall(35, 24, "wallMC");
placeWall(36, 24, "wallMC");
placeWall(37, 24, "wallMC");
placeWall(38, 24, "wallMC");
placeWall(39, 24, "wallMC");
}
function main() {
if ((moveTimer % moveSpeed) == 0) {
if (turnQueue.length > 0) {
var _local3 = turnQueue.pop();
if ((_local3 % 2) != (currentDirection % 2)) {
currentDirection = _local3;
}
}
x = x + xVelocity[currentDirection];
y = y + yVelocity[currentDirection];
moveTimer = 0;
if (((((map[x][y] != SNAKE_BLOCK) && (x > -1)) && (x < gameWidth)) && (y > -1)) && (y < gameHeight)) {
game.s.attachMovie("snakeMC", snakeBlockCounter, snakeBlockCounter, {_x:x * blockSize, _y:y * blockSize});
game.s[snakeBlockCounter].gotoAndStop(2);
game.s[snakeBlockCounter - 1].gotoAndStop(1);
snakeBlockCounter++;
if (typeof(map[x][y]) == "movieclip") {
score = score + 10;
if (score >= 100) {
_root.level3unlocked = true;
gameOver(true);
}
scoreTextField.text = "Score: " + score;
snakeEraseCounter = snakeEraseCounter - 4;
placeFood(map[x][y]);
}
map[x][y] = SNAKE_BLOCK;
var _local2 = game.s[snakeEraseCounter];
if (_local2) {
delete map[_local2._x / blockSize][_local2._y / blockSize];
_local2.removeMovieClip();
}
snakeEraseCounter++;
} else {
gameOver();
}
}
moveTimer++;
}
function gameOver(win) {
if (win) {
textMC.gotoAndStop("win");
} else {
textMC.gotoAndStop("gameOver");
}
delete game.onEnterFrame;
gameRunning = false;
}
function placeFood(foodMC) {
do {
var xFood = random(gameWidth);
var yFood = random(gameHeight);
} while (map[xFood][yFood]);
if (foodMC == "new") {
foodMC = game.food.attachMovie("foodMC", foodCounter, foodCounter);
foodCounter++;
}
foodMC._x = xFood * blockSize;
foodMC._y = yFood * blockSize;
map[xFood][yFood] = foodMC;
}
function placeWall(x, y, type) {
wallMC = game.wall.attachMovie(type, wallCounter, wallCounter);
wallCounter++;
wallMC._x = x * blockSize;
wallMC._y = y * blockSize;
map[x][y] = 1;
}
Mouse.show();
if ((_root.music == "ON") && (_root.setmusic != "muziek2")) {
stopAllSounds();
menuMusic = new Sound();
menuMusic.attachSound("muziek2");
menuMusic.start(0, 100);
_root.setmusic = "muziek2";
}
blockSize = 8;
gameHeight = 30;
gameWidth = 45;
SNAKE_BLOCK = 1;
moveSpeed = 2;
keyListener = new Object();
keyListener.onKeyDown = function () {
var _local1 = Key.getCode();
if ((_local1 > 36) && (_local1 < 41)) {
if (game.onEnterFrame != undefined) {
if ((_local1 - 37) != turnQueue[0]) {
turnQueue.unshift(_local1 - 37);
}
}
} else if (_local1 == 32) {
if (!gameRunning) {
startGame();
}
} else if (_local1 == 80) {
if (gameRunning) {
if (game.onEnterFrame) {
delete game.onEnterFrame;
textMC.gotoAndStop("paused");
} else {
game.onEnterFrame = main;
textMC.gotoAndStop("hide");
}
}
}
};
Key.addListener(keyListener);
Frame 126
function startGame() {
x = int(gameWidth / 2);
y = gameHeight - 2;
moveTimer = 0;
xVelocity = [-1, 0, 1, 0];
yVelocity = [0, -1, 0, 1];
map = new Array();
var _local1 = 0;
while (_local1 < gameWidth) {
map[_local1] = new Array();
_local1++;
}
turnQueue = new Array();
game.createEmptyMovieClip("food", 1);
game.createEmptyMovieClip("s", 2);
scoreTextField.text = "Score: 0";
foodCounter = 0;
snakeBlockCounter = 0;
currentDirection = 1;
snakeEraseCounter = -4;
score = 0;
placeFood("new");
textMC.gotoAndStop("hide");
game.onEnterFrame = main;
gameRunning = true;
game.createEmptyMovieClip("wall", 3);
wallCounter = 0;
placeWall(20, 0, "wallMC");
placeWall(20, 1, "wallMC");
placeWall(20, 2, "wallMC");
placeWall(20, 4, "wallMC");
placeWall(20, 5, "wallMC");
placeWall(20, 6, "wallMC");
placeWall(19, 6, "wallMC");
placeWall(18, 6, "wallMC");
placeWall(17, 6, "wallMC");
placeWall(16, 6, "wallMC");
placeWall(15, 6, "wallMC");
placeWall(14, 6, "wallMC");
placeWall(13, 6, "wallMC");
placeWall(12, 6, "wallMC");
placeWall(9, 6, "wallMC");
placeWall(8, 6, "wallMC");
placeWall(7, 6, "wallMC");
placeWall(6, 6, "wallMC");
placeWall(5, 6, "wallMC");
placeWall(4, 6, "wallMC");
placeWall(3, 6, "wallMC");
placeWall(2, 6, "wallMC");
placeWall(1, 6, "wallMC");
placeWall(0, 6, "wallMC");
placeWall(43, 29, "wallMC");
placeWall(43, 28, "wallMC");
placeWall(44, 28, "wallMC");
placeWall(44, 29, "wallMC");
placeWall(42, 29, "wallMC");
placeWall(44, 27, "wallMC");
placeWall(32, 15, "wallMC");
placeWall(32, 8, "wallMC");
placeWall(35, 24, "wallMC");
}
function main() {
if ((moveTimer % moveSpeed) == 0) {
if (turnQueue.length > 0) {
var _local3 = turnQueue.pop();
if ((_local3 % 2) != (currentDirection % 2)) {
currentDirection = _local3;
}
}
x = x + xVelocity[currentDirection];
y = y + yVelocity[currentDirection];
moveTimer = 0;
if (((((map[x][y] != SNAKE_BLOCK) && (x > -1)) && (x < gameWidth)) && (y > -1)) && (y < gameHeight)) {
game.s.attachMovie("snakeMC", snakeBlockCounter, snakeBlockCounter, {_x:x * blockSize, _y:y * blockSize});
game.s[snakeBlockCounter].gotoAndStop(2);
game.s[snakeBlockCounter - 1].gotoAndStop(1);
snakeBlockCounter++;
if (typeof(map[x][y]) == "movieclip") {
score = score + 10;
if (score >= 150) {
_root.level4unlocked = true;
gameOver(true);
}
scoreTextField.text = "Score: " + score;
snakeEraseCounter = snakeEraseCounter - 4;
placeFood(map[x][y]);
}
map[x][y] = SNAKE_BLOCK;
var _local2 = game.s[snakeEraseCounter];
if (_local2) {
delete map[_local2._x / blockSize][_local2._y / blockSize];
_local2.removeMovieClip();
}
snakeEraseCounter++;
} else {
gameOver();
}
}
moveTimer++;
}
function gameOver(win) {
if (win) {
textMC.gotoAndStop("win");
} else {
textMC.gotoAndStop("gameOver");
}
delete game.onEnterFrame;
gameRunning = false;
}
function placeFood(foodMC) {
do {
var xFood = random(gameWidth);
var yFood = random(gameHeight);
} while (map[xFood][yFood]);
if (foodMC == "new") {
foodMC = game.food.attachMovie("foodMC", foodCounter, foodCounter);
foodCounter++;
}
foodMC._x = xFood * blockSize;
foodMC._y = yFood * blockSize;
map[xFood][yFood] = foodMC;
}
function placeWall(x, y, type) {
wallMC = game.wall.attachMovie(type, wallCounter, wallCounter);
wallCounter++;
wallMC._x = x * blockSize;
wallMC._y = y * blockSize;
map[x][y] = 1;
}
Mouse.show();
if ((_root.music == "ON") && (_root.setmusic != "ocean")) {
stopAllSounds();
menuMusic = new Sound();
menuMusic.attachSound("ocean");
menuMusic.start(0, 100);
_root.setmusic = "ocean";
}
blockSize = 8;
gameHeight = 30;
gameWidth = 45;
SNAKE_BLOCK = 1;
moveSpeed = 2;
keyListener = new Object();
keyListener.onKeyDown = function () {
var _local1 = Key.getCode();
if ((_local1 > 36) && (_local1 < 41)) {
if (game.onEnterFrame != undefined) {
if ((_local1 - 37) != turnQueue[0]) {
turnQueue.unshift(_local1 - 37);
}
}
} else if (_local1 == 32) {
if (!gameRunning) {
startGame();
}
} else if (_local1 == 80) {
if (gameRunning) {
if (game.onEnterFrame) {
delete game.onEnterFrame;
textMC.gotoAndStop("paused");
} else {
game.onEnterFrame = main;
textMC.gotoAndStop("hide");
}
}
}
};
Key.addListener(keyListener);
Frame 127
function startGame() {
x = int(gameWidth / 2);
y = gameHeight - 2;
moveTimer = 0;
xVelocity = [-1, 0, 1, 0];
yVelocity = [0, -1, 0, 1];
map = new Array();
var _local1 = 0;
while (_local1 < gameWidth) {
map[_local1] = new Array();
_local1++;
}
turnQueue = new Array();
game.createEmptyMovieClip("food", 1);
game.createEmptyMovieClip("s", 2);
scoreTextField.text = "Score: 0";
foodCounter = 0;
snakeBlockCounter = 0;
currentDirection = 1;
snakeEraseCounter = -3;
score = 0;
placeFood("new");
textMC.gotoAndStop("hide");
game.onEnterFrame = main;
gameRunning = true;
game.createEmptyMovieClip("wall", 3);
wallCounter = 0;
placeWall(15, 9, "wallMC");
placeWall(19, 4, "wallMC");
placeWall(9, 13, "wallMC");
placeWall(21, 4, "wallMC");
placeWall(27, 19, "wallMC");
placeWall(7, 5, "wallMC");
placeWall(8, 18, "wallMC");
placeWall(12, 28, "wallMC");
placeWall(30, 25, "wallMC");
placeWall(31, 23, "wallMC");
placeWall(23, 6, "wallMC");
placeWall(33, 17, "wallMC");
placeWall(17, 17, "wallMC");
placeWall(35, 8, "wallMC");
placeWall(21, 29, "wallMC");
placeWall(13, 18, "wallMC");
}
function main() {
if ((moveTimer % moveSpeed) == 0) {
if (turnQueue.length > 0) {
var _local3 = turnQueue.pop();
if ((_local3 % 2) != (currentDirection % 2)) {
currentDirection = _local3;
}
}
x = x + xVelocity[currentDirection];
y = y + yVelocity[currentDirection];
moveTimer = 0;
if (((((map[x][y] != SNAKE_BLOCK) && (x > -1)) && (x < gameWidth)) && (y > -1)) && (y < gameHeight)) {
game.s.attachMovie("snakeMC", snakeBlockCounter, snakeBlockCounter, {_x:x * blockSize, _y:y * blockSize});
game.s[snakeBlockCounter].gotoAndStop(2);
game.s[snakeBlockCounter - 1].gotoAndStop(1);
snakeBlockCounter++;
if (typeof(map[x][y]) == "movieclip") {
score = score + 10;
if (score >= 150) {
_root.level5unlocked = true;
gameOver(true);
}
scoreTextField.text = "Score: " + score;
snakeEraseCounter = snakeEraseCounter - 4;
placeFood(map[x][y]);
}
map[x][y] = SNAKE_BLOCK;
var _local2 = game.s[snakeEraseCounter];
if (_local2) {
delete map[_local2._x / blockSize][_local2._y / blockSize];
_local2.removeMovieClip();
}
snakeEraseCounter++;
} else {
gameOver();
}
}
moveTimer++;
}
function gameOver(win) {
if (win) {
textMC.gotoAndStop("win");
} else {
textMC.gotoAndStop("gameOver");
}
delete game.onEnterFrame;
gameRunning = false;
}
function placeFood(foodMC) {
do {
var xFood = random(gameWidth);
var yFood = random(gameHeight);
} while (map[xFood][yFood]);
if (foodMC == "new") {
foodMC = game.food.attachMovie("foodMC", foodCounter, foodCounter);
foodCounter++;
}
foodMC._x = xFood * blockSize;
foodMC._y = yFood * blockSize;
map[xFood][yFood] = foodMC;
}
function placeWall(x, y, type) {
wallMC = game.wall.attachMovie(type, wallCounter, wallCounter);
wallCounter++;
wallMC._x = x * blockSize;
wallMC._y = y * blockSize;
map[x][y] = 1;
}
Mouse.show();
if ((_root.music == "ON") && (_root.setmusic != "muziek")) {
stopAllSounds();
menuMusic = new Sound();
menuMusic.attachSound("muziek");
menuMusic.start(0, 100);
_root.setmusic = "muziek";
}
blockSize = 8;
gameHeight = 30;
gameWidth = 45;
SNAKE_BLOCK = 1;
moveSpeed = 2;
keyListener = new Object();
keyListener.onKeyDown = function () {
var _local1 = Key.getCode();
if ((_local1 > 36) && (_local1 < 41)) {
if (game.onEnterFrame != undefined) {
if ((_local1 - 37) != turnQueue[0]) {
turnQueue.unshift(_local1 - 37);
}
}
} else if (_local1 == 32) {
if (!gameRunning) {
startGame();
}
} else if (_local1 == 80) {
if (gameRunning) {
if (game.onEnterFrame) {
delete game.onEnterFrame;
textMC.gotoAndStop("paused");
} else {
game.onEnterFrame = main;
textMC.gotoAndStop("hide");
}
}
}
};
Key.addListener(keyListener);
Frame 128
function startGame() {
x = int(gameWidth / 2);
y = gameHeight - 2;
moveTimer = 0;
xVelocity = [-1, 0, 1, 0];
yVelocity = [0, -1, 0, 1];
map = new Array();
var _local1 = 0;
while (_local1 < gameWidth) {
map[_local1] = new Array();
_local1++;
}
turnQueue = new Array();
game.createEmptyMovieClip("food", 1);
game.createEmptyMovieClip("s", 2);
scoreTextField.text = "Score: 0";
foodCounter = 0;
snakeBlockCounter = 0;
currentDirection = 1;
snakeEraseCounter = -1;
score = 0;
placeFood("new");
textMC.gotoAndStop("hide");
game.onEnterFrame = main;
gameRunning = true;
game.createEmptyMovieClip("wall", 3);
wallCounter = 0;
placeWall(5, 5, "wallMC");
placeWall(6, 5, "wallMC");
placeWall(7, 5, "wallMC");
placeWall(8, 5, "wallMC");
placeWall(9, 5, "wallMC");
placeWall(10, 5, "wallMC");
placeWall(11, 5, "wallMC");
placeWall(12, 5, "wallMC");
placeWall(13, 5, "wallMC");
placeWall(14, 5, "wallMC");
placeWall(5, 6, "wallMC");
placeWall(5, 7, "wallMC");
placeWall(5, 8, "wallMC");
placeWall(5, 9, "wallMC");
placeWall(5, 10, "wallMC");
placeWall(5, 11, "wallMC");
placeWall(39, 11, "wallMC");
placeWall(39, 10, "wallMC");
placeWall(39, 9, "wallMC");
placeWall(39, 8, "wallMC");
placeWall(39, 7, "wallMC");
placeWall(39, 6, "wallMC");
placeWall(30, 5, "wallMC");
placeWall(31, 5, "wallMC");
placeWall(32, 5, "wallMC");
placeWall(33, 5, "wallMC");
placeWall(34, 5, "wallMC");
placeWall(35, 5, "wallMC");
placeWall(36, 5, "wallMC");
placeWall(37, 5, "wallMC");
placeWall(38, 5, "wallMC");
placeWall(39, 5, "wallMC");
placeWall(5, 24, "wallMC");
placeWall(6, 24, "wallMC");
placeWall(7, 24, "wallMC");
placeWall(8, 24, "wallMC");
placeWall(9, 24, "wallMC");
placeWall(10, 24, "wallMC");
placeWall(11, 24, "wallMC");
placeWall(12, 24, "wallMC");
placeWall(13, 24, "wallMC");
placeWall(14, 24, "wallMC");
placeWall(5, 23, "wallMC");
placeWall(5, 22, "wallMC");
placeWall(5, 21, "wallMC");
placeWall(5, 20, "wallMC");
placeWall(5, 19, "wallMC");
placeWall(5, 18, "wallMC");
placeWall(39, 18, "wallMC");
placeWall(39, 19, "wallMC");
placeWall(39, 20, "wallMC");
placeWall(39, 21, "wallMC");
placeWall(39, 22, "wallMC");
placeWall(39, 23, "wallMC");
placeWall(30, 24, "wallMC");
placeWall(31, 24, "wallMC");
placeWall(32, 24, "wallMC");
placeWall(33, 24, "wallMC");
placeWall(34, 24, "wallMC");
placeWall(35, 24, "wallMC");
placeWall(36, 24, "wallMC");
placeWall(37, 24, "wallMC");
placeWall(38, 24, "wallMC");
placeWall(39, 24, "wallMC");
}
function main() {
if ((moveTimer % moveSpeed) == 0) {
if (turnQueue.length > 0) {
var _local3 = turnQueue.pop();
if ((_local3 % 2) != (currentDirection % 2)) {
currentDirection = _local3;
}
}
x = x + xVelocity[currentDirection];
y = y + yVelocity[currentDirection];
moveTimer = 0;
if (((((map[x][y] != SNAKE_BLOCK) && (x > -1)) && (x < gameWidth)) && (y > -1)) && (y < gameHeight)) {
game.s.attachMovie("snakeMC", snakeBlockCounter, snakeBlockCounter, {_x:x * blockSize, _y:y * blockSize});
game.s[snakeBlockCounter].gotoAndStop(2);
game.s[snakeBlockCounter - 1].gotoAndStop(1);
snakeBlockCounter++;
if (typeof(map[x][y]) == "movieclip") {
score = score + 10;
if (score >= 150) {
_root.level8unlocked = true;
gameOver(true);
}
scoreTextField.text = "Score: " + score;
snakeEraseCounter = snakeEraseCounter - 4;
placeFood(map[x][y]);
}
map[x][y] = SNAKE_BLOCK;
var _local2 = game.s[snakeEraseCounter];
if (_local2) {
delete map[_local2._x / blockSize][_local2._y / blockSize];
_local2.removeMovieClip();
}
snakeEraseCounter++;
} else {
gameOver();
}
}
moveTimer++;
}
function gameOver(win) {
if (win) {
textMC.gotoAndStop("win");
} else {
textMC.gotoAndStop("gameOver");
}
delete game.onEnterFrame;
gameRunning = false;
}
function placeFood(foodMC) {
do {
var xFood = random(gameWidth);
var yFood = random(gameHeight);
} while (map[xFood][yFood]);
if (foodMC == "new") {
foodMC = game.food.attachMovie("foodMC", foodCounter, foodCounter);
foodCounter++;
}
foodMC._x = xFood * blockSize;
foodMC._y = yFood * blockSize;
map[xFood][yFood] = foodMC;
}
function placeWall(x, y, type) {
wallMC = game.wall.attachMovie(type, wallCounter, wallCounter);
wallCounter++;
wallMC._x = x * blockSize;
wallMC._y = y * blockSize;
map[x][y] = 1;
}
Mouse.show();
if ((_root.music == "ON") && (_root.setmusic != "pokemon")) {
stopAllSounds();
menuMusic = new Sound();
menuMusic.attachSound("pokemon");
menuMusic.start(0, 100);
_root.setmusic = "pokemon";
}
blockSize = 8;
gameHeight = 30;
gameWidth = 45;
SNAKE_BLOCK = 1;
moveSpeed = 1;
keyListener = new Object();
keyListener.onKeyDown = function () {
var _local1 = Key.getCode();
if ((_local1 > 36) && (_local1 < 41)) {
if (game.onEnterFrame != undefined) {
if ((_local1 - 37) != turnQueue[0]) {
turnQueue.unshift(_local1 - 37);
}
}
} else if (_local1 == 32) {
if (!gameRunning) {
startGame();
}
} else if (_local1 == 80) {
if (gameRunning) {
if (game.onEnterFrame) {
delete game.onEnterFrame;
textMC.gotoAndStop("paused");
} else {
game.onEnterFrame = main;
textMC.gotoAndStop("hide");
}
}
}
};
Key.addListener(keyListener);
Frame 129
function startGame() {
x = int(gameWidth / 2);
y = gameHeight - 2;
moveTimer = 0;
xVelocity = [-1, 0, 1, 0];
yVelocity = [0, -1, 0, 1];
map = new Array();
var _local1 = 0;
while (_local1 < gameWidth) {
map[_local1] = new Array();
_local1++;
}
turnQueue = new Array();
game.createEmptyMovieClip("food", 1);
game.createEmptyMovieClip("s", 2);
scoreTextField.text = "Score: 0";
foodCounter = 0;
snakeBlockCounter = 0;
currentDirection = 1;
snakeEraseCounter = -1;
score = 0;
placeFood("new");
textMC.gotoAndStop("hide");
game.onEnterFrame = main;
gameRunning = true;
game.createEmptyMovieClip("wall", 3);
wallCounter = 0;
placeWall(0, 0, "wallMC");
placeWall(0, 1, "wallMC");
placeWall(1, 0, "wallMC");
placeWall(1, 1, "wallMC");
placeWall(43, 0, "wallMC");
placeWall(44, 0, "wallMC");
placeWall(43, 1, "wallMC");
placeWall(44, 1, "wallMC");
placeWall(0, 28, "wallMC");
placeWall(0, 29, "wallMC");
placeWall(1, 28, "wallMC");
placeWall(1, 29, "wallMC");
placeWall(43, 28, "wallMC");
placeWall(43, 29, "wallMC");
placeWall(44, 28, "wallMC");
placeWall(44, 29, "wallMC");
placeWall(21, 0, "wallMC");
placeWall(21, 1, "wallMC");
placeWall(21, 2, "wallMC");
placeWall(21, 3, "wallMC");
placeWall(21, 4, "wallMC");
placeWall(21, 5, "wallMC");
placeWall(21, 6, "wallMC");
placeWall(21, 9, "wallMC");
placeWall(21, 10, "wallMC");
placeWall(21, 11, "wallMC");
placeWall(21, 12, "wallMC");
placeWall(21, 13, "wallMC");
placeWall(21, 14, "wallMC");
placeWall(21, 15, "wallMC");
placeWall(21, 16, "wallMC");
placeWall(21, 17, "wallMC");
placeWall(21, 18, "wallMC");
placeWall(21, 19, "wallMC");
placeWall(21, 20, "wallMC");
placeWall(21, 23, "wallMC");
placeWall(21, 24, "wallMC");
placeWall(21, 25, "wallMC");
placeWall(21, 26, "wallMC");
placeWall(21, 27, "wallMC");
placeWall(21, 28, "wallMC");
placeWall(21, 29, "wallMC");
placeWall(22, 15, "wallMC");
placeWall(23, 15, "wallMC");
placeWall(24, 15, "wallMC");
placeWall(25, 15, "wallMC");
placeWall(26, 15, "wallMC");
placeWall(27, 15, "wallMC");
placeWall(28, 15, "wallMC");
placeWall(29, 15, "wallMC");
placeWall(30, 15, "wallMC");
placeWall(31, 15, "wallMC");
placeWall(32, 15, "wallMC");
placeWall(33, 15, "wallMC");
placeWall(34, 15, "wallMC");
placeWall(35, 15, "wallMC");
placeWall(36, 15, "wallMC");
placeWall(37, 15, "wallMC");
placeWall(38, 15, "wallMC");
placeWall(39, 15, "wallMC");
placeWall(40, 15, "wallMC");
placeWall(41, 15, "wallMC");
placeWall(42, 15, "wallMC");
placeWall(43, 15, "wallMC");
placeWall(44, 15, "wallMC");
}
function main() {
if ((moveTimer % moveSpeed) == 0) {
if (turnQueue.length > 0) {
var _local3 = turnQueue.pop();
if ((_local3 % 2) != (currentDirection % 2)) {
currentDirection = _local3;
}
}
x = x + xVelocity[currentDirection];
y = y + yVelocity[currentDirection];
moveTimer = 0;
if (((((map[x][y] != SNAKE_BLOCK) && (x > -1)) && (x < gameWidth)) && (y > -1)) && (y < gameHeight)) {
game.s.attachMovie("snakeMC", snakeBlockCounter, snakeBlockCounter, {_x:x * blockSize, _y:y * blockSize});
game.s[snakeBlockCounter].gotoAndStop(2);
game.s[snakeBlockCounter - 1].gotoAndStop(1);
snakeBlockCounter++;
if (typeof(map[x][y]) == "movieclip") {
score = score + 10;
if (score >= 150) {
_root.level9unlocked = true;
gameOver(true);
}
scoreTextField.text = "Score: " + score;
snakeEraseCounter = snakeEraseCounter - 4;
placeFood(map[x][y]);
}
map[x][y] = SNAKE_BLOCK;
var _local2 = game.s[snakeEraseCounter];
if (_local2) {
delete map[_local2._x / blockSize][_local2._y / blockSize];
_local2.removeMovieClip();
}
snakeEraseCounter++;
} else {
gameOver();
}
}
moveTimer++;
}
function gameOver(win) {
if (win) {
textMC.gotoAndStop("win");
} else {
textMC.gotoAndStop("gameOver");
}
delete game.onEnterFrame;
gameRunning = false;
}
function placeFood(foodMC) {
do {
var xFood = random(gameWidth);
var yFood = random(gameHeight);
} while (map[xFood][yFood]);
if (foodMC == "new") {
foodMC = game.food.attachMovie("foodMC", foodCounter, foodCounter);
foodCounter++;
}
foodMC._x = xFood * blockSize;
foodMC._y = yFood * blockSize;
map[xFood][yFood] = foodMC;
}
function placeWall(x, y, type) {
wallMC = game.wall.attachMovie(type, wallCounter, wallCounter);
wallCounter++;
wallMC._x = x * blockSize;
wallMC._y = y * blockSize;
map[x][y] = 1;
}
Mouse.show();
if ((_root.music == "ON") && (_root.setmusic != "tiesto")) {
stopAllSounds();
menuMusic = new Sound();
menuMusic.attachSound("tiesto");
menuMusic.start(0, 100);
_root.setmusic = "tiesto";
}
blockSize = 8;
gameHeight = 30;
gameWidth = 45;
SNAKE_BLOCK = 1;
moveSpeed = 1;
keyListener = new Object();
keyListener.onKeyDown = function () {
var _local1 = Key.getCode();
if ((_local1 > 36) && (_local1 < 41)) {
if (game.onEnterFrame != undefined) {
if ((_local1 - 37) != turnQueue[0]) {
turnQueue.unshift(_local1 - 37);
}
}
} else if (_local1 == 32) {
if (!gameRunning) {
startGame();
}
} else if (_local1 == 80) {
if (gameRunning) {
if (game.onEnterFrame) {
delete game.onEnterFrame;
textMC.gotoAndStop("paused");
} else {
game.onEnterFrame = main;
textMC.gotoAndStop("hide");
}
}
}
};
Key.addListener(keyListener);
Frame 130
function startGame() {
x = int(gameWidth / 2);
y = gameHeight - 2;
moveTimer = 0;
xVelocity = [-1, 0, 1, 0];
yVelocity = [0, -1, 0, 1];
map = new Array();
var _local1 = 0;
while (_local1 < gameWidth) {
map[_local1] = new Array();
_local1++;
}
turnQueue = new Array();
game.createEmptyMovieClip("food", 1);
game.createEmptyMovieClip("s", 2);
scoreTextField.text = "Score: 0";
foodCounter = 0;
snakeBlockCounter = 0;
currentDirection = 1;
snakeEraseCounter = -1;
score = 0;
placeFood("new");
textMC.gotoAndStop("hide");
game.onEnterFrame = main;
gameRunning = true;
game.createEmptyMovieClip("wall", 3);
wallCounter = 0;
placeWall(0, 0, "wallMC");
placeWall(0, 1, "wallMC");
placeWall(1, 0, "wallMC");
placeWall(1, 1, "wallMC");
placeWall(43, 0, "wallMC");
placeWall(44, 0, "wallMC");
placeWall(43, 1, "wallMC");
placeWall(44, 1, "wallMC");
placeWall(0, 28, "wallMC");
placeWall(0, 29, "wallMC");
placeWall(1, 28, "wallMC");
placeWall(1, 29, "wallMC");
placeWall(43, 28, "wallMC");
placeWall(43, 29, "wallMC");
placeWall(44, 28, "wallMC");
placeWall(44, 29, "wallMC");
placeWall(21, 15, "wallMC");
placeWall(21, 16, "wallMC");
placeWall(21, 17, "wallMC");
placeWall(21, 18, "wallMC");
placeWall(21, 19, "wallMC");
placeWall(21, 20, "wallMC");
placeWall(21, 23, "wallMC");
placeWall(21, 24, "wallMC");
placeWall(21, 25, "wallMC");
placeWall(21, 26, "wallMC");
placeWall(21, 27, "wallMC");
placeWall(21, 28, "wallMC");
placeWall(21, 29, "wallMC");
placeWall(22, 15, "wallMC");
placeWall(23, 15, "wallMC");
placeWall(24, 15, "wallMC");
placeWall(25, 15, "wallMC");
placeWall(26, 15, "wallMC");
placeWall(27, 15, "wallMC");
placeWall(28, 15, "wallMC");
placeWall(29, 15, "wallMC");
placeWall(30, 15, "wallMC");
placeWall(31, 15, "wallMC");
placeWall(32, 15, "wallMC");
placeWall(33, 15, "wallMC");
placeWall(34, 15, "wallMC");
placeWall(35, 15, "wallMC");
placeWall(36, 15, "wallMC");
placeWall(37, 15, "wallMC");
placeWall(38, 15, "wallMC");
placeWall(39, 15, "wallMC");
placeWall(40, 15, "wallMC");
placeWall(41, 15, "wallMC");
placeWall(42, 15, "wallMC");
placeWall(43, 15, "wallMC");
placeWall(44, 15, "wallMC");
}
function main() {
if ((moveTimer % moveSpeed) == 0) {
if (turnQueue.length > 0) {
var _local3 = turnQueue.pop();
if ((_local3 % 2) != (currentDirection % 2)) {
currentDirection = _local3;
}
}
x = x + xVelocity[currentDirection];
y = y + yVelocity[currentDirection];
moveTimer = 0;
if (((((map[x][y] != SNAKE_BLOCK) && (x > -1)) && (x < gameWidth)) && (y > -1)) && (y < gameHeight)) {
game.s.attachMovie("snakeMC", snakeBlockCounter, snakeBlockCounter, {_x:x * blockSize, _y:y * blockSize});
game.s[snakeBlockCounter].gotoAndStop(2);
game.s[snakeBlockCounter - 1].gotoAndStop(1);
snakeBlockCounter++;
if (typeof(map[x][y]) == "movieclip") {
score = score + 10;
if (score >= 200) {
_root.level6unlocked = true;
gameOver(true);
}
scoreTextField.text = "Score: " + score;
snakeEraseCounter = snakeEraseCounter - 4;
placeFood(map[x][y]);
}
map[x][y] = SNAKE_BLOCK;
var _local2 = game.s[snakeEraseCounter];
if (_local2) {
delete map[_local2._x / blockSize][_local2._y / blockSize];
_local2.removeMovieClip();
}
snakeEraseCounter++;
} else {
gameOver();
}
}
moveTimer++;
}
function gameOver(win) {
if (win) {
textMC.gotoAndStop("win");
} else {
textMC.gotoAndStop("gameOver");
}
delete game.onEnterFrame;
gameRunning = false;
}
function placeFood(foodMC) {
do {
var xFood = random(gameWidth);
var yFood = random(gameHeight);
} while (map[xFood][yFood]);
if (foodMC == "new") {
foodMC = game.food.attachMovie("foodMC", foodCounter, foodCounter);
foodCounter++;
}
foodMC._x = xFood * blockSize;
foodMC._y = yFood * blockSize;
map[xFood][yFood] = foodMC;
}
function placeWall(x, y, type) {
wallMC = game.wall.attachMovie(type, wallCounter, wallCounter);
wallCounter++;
wallMC._x = x * blockSize;
wallMC._y = y * blockSize;
map[x][y] = 1;
}
Mouse.show();
if ((_root.music == "ON") && (_root.setmusic != "muziek")) {
stopAllSounds();
menuMusic = new Sound();
menuMusic.attachSound("muziek");
menuMusic.start(0, 100);
_root.setmusic = "muziek";
}
blockSize = 8;
gameHeight = 30;
gameWidth = 45;
SNAKE_BLOCK = 1;
moveSpeed = 2;
keyListener = new Object();
keyListener.onKeyDown = function () {
var _local1 = Key.getCode();
if ((_local1 > 36) && (_local1 < 41)) {
if (game.onEnterFrame != undefined) {
if ((_local1 - 37) != turnQueue[0]) {
turnQueue.unshift(_local1 - 37);
}
}
} else if (_local1 == 32) {
if (!gameRunning) {
startGame();
}
} else if (_local1 == 80) {
if (gameRunning) {
if (game.onEnterFrame) {
delete game.onEnterFrame;
textMC.gotoAndStop("paused");
} else {
game.onEnterFrame = main;
textMC.gotoAndStop("hide");
}
}
}
};
Key.addListener(keyListener);
Frame 131
function startGame() {
x = int(gameWidth / 2);
y = gameHeight - 2;
moveTimer = 0;
xVelocity = [-1, 0, 1, 0];
yVelocity = [0, -1, 0, 1];
map = new Array();
var _local1 = 0;
while (_local1 < gameWidth) {
map[_local1] = new Array();
_local1++;
}
turnQueue = new Array();
game.createEmptyMovieClip("food", 1);
game.createEmptyMovieClip("s", 2);
scoreTextField.text = "Score: 0";
foodCounter = 0;
snakeBlockCounter = 0;
currentDirection = 1;
snakeEraseCounter = -1;
score = 0;
placeFood("new");
textMC.gotoAndStop("hide");
game.onEnterFrame = main;
gameRunning = true;
game.createEmptyMovieClip("wall", 3);
wallCounter = 0;
placeWall(4, 10, "wallMC");
placeWall(5, 10, "wallMC");
placeWall(6, 10, "wallMC");
placeWall(7, 10, "wallMC");
placeWall(8, 10, "wallMC");
placeWall(9, 10, "wallMC");
placeWall(10, 10, "wallMC");
placeWall(11, 10, "wallMC");
placeWall(12, 10, "wallMC");
placeWall(13, 10, "wallMC");
placeWall(14, 10, "wallMC");
placeWall(15, 10, "wallMC");
placeWall(4, 27, "wallMC");
placeWall(5, 27, "wallMC");
placeWall(6, 27, "wallMC");
placeWall(7, 27, "wallMC");
placeWall(8, 27, "wallMC");
placeWall(9, 27, "wallMC");
placeWall(10, 27, "wallMC");
placeWall(11, 27, "wallMC");
placeWall(12, 27, "wallMC");
placeWall(13, 27, "wallMC");
placeWall(14, 27, "wallMC");
placeWall(15, 27, "wallMC");
placeWall(41, 17, "wallMC");
placeWall(40, 17, "wallMC");
placeWall(39, 17, "wallMC");
placeWall(38, 17, "wallMC");
placeWall(37, 17, "wallMC");
placeWall(36, 17, "wallMC");
placeWall(35, 17, "wallMC");
placeWall(34, 17, "wallMC");
placeWall(33, 17, "wallMC");
placeWall(32, 17, "wallMC");
placeWall(31, 17, "wallMC");
placeWall(30, 17, "wallMC");
}
function main() {
if ((moveTimer % moveSpeed) == 0) {
if (turnQueue.length > 0) {
var _local3 = turnQueue.pop();
if ((_local3 % 2) != (currentDirection % 2)) {
currentDirection = _local3;
}
}
x = x + xVelocity[currentDirection];
y = y + yVelocity[currentDirection];
moveTimer = 0;
if (((((map[x][y] != SNAKE_BLOCK) && (x > -1)) && (x < gameWidth)) && (y > -1)) && (y < gameHeight)) {
game.s.attachMovie("snakeMC", snakeBlockCounter, snakeBlockCounter, {_x:x * blockSize, _y:y * blockSize});
game.s[snakeBlockCounter].gotoAndStop(2);
game.s[snakeBlockCounter - 1].gotoAndStop(1);
snakeBlockCounter++;
if (typeof(map[x][y]) == "movieclip") {
score = score + 10;
if (score >= 200) {
_root.level7unlocked = true;
gameOver(true);
}
scoreTextField.text = "Score: " + score;
snakeEraseCounter = snakeEraseCounter - 4;
placeFood(map[x][y]);
}
map[x][y] = SNAKE_BLOCK;
var _local2 = game.s[snakeEraseCounter];
if (_local2) {
delete map[_local2._x / blockSize][_local2._y / blockSize];
_local2.removeMovieClip();
}
snakeEraseCounter++;
} else {
gameOver();
}
}
moveTimer++;
}
function gameOver(win) {
if (win) {
textMC.gotoAndStop("win");
} else {
textMC.gotoAndStop("gameOver");
}
delete game.onEnterFrame;
gameRunning = false;
}
function placeFood(foodMC) {
do {
var xFood = random(gameWidth);
var yFood = random(gameHeight);
} while (map[xFood][yFood]);
if (foodMC == "new") {
foodMC = game.food.attachMovie("foodMC", foodCounter, foodCounter);
foodCounter++;
}
foodMC._x = xFood * blockSize;
foodMC._y = yFood * blockSize;
map[xFood][yFood] = foodMC;
}
function placeWall(x, y, type) {
wallMC = game.wall.attachMovie(type, wallCounter, wallCounter);
wallCounter++;
wallMC._x = x * blockSize;
wallMC._y = y * blockSize;
map[x][y] = 1;
}
Mouse.show();
if ((_root.music == "ON") && (_root.setmusic != "muziek2")) {
stopAllSounds();
menuMusic = new Sound();
menuMusic.attachSound("muziek2");
menuMusic.start(0, 100);
_root.setmusic = "muziek2";
}
blockSize = 8;
gameHeight = 30;
gameWidth = 45;
SNAKE_BLOCK = 1;
moveSpeed = 2;
keyListener = new Object();
keyListener.onKeyDown = function () {
var _local1 = Key.getCode();
if ((_local1 > 36) && (_local1 < 41)) {
if (game.onEnterFrame != undefined) {
if ((_local1 - 37) != turnQueue[0]) {
turnQueue.unshift(_local1 - 37);
}
}
} else if (_local1 == 32) {
if (!gameRunning) {
startGame();
}
} else if (_local1 == 80) {
if (gameRunning) {
if (game.onEnterFrame) {
delete game.onEnterFrame;
textMC.gotoAndStop("paused");
} else {
game.onEnterFrame = main;
textMC.gotoAndStop("hide");
}
}
}
};
Key.addListener(keyListener);
Frame 132
function startGame() {
x = int(gameWidth / 2);
y = gameHeight - 2;
moveTimer = 0;
xVelocity = [-1, 0, 1, 0];
yVelocity = [0, -1, 0, 1];
map = new Array();
var _local1 = 0;
while (_local1 < gameWidth) {
map[_local1] = new Array();
_local1++;
}
turnQueue = new Array();
game.createEmptyMovieClip("food", 1);
game.createEmptyMovieClip("s", 2);
scoreTextField.text = "Score: 0";
foodCounter = 0;
snakeBlockCounter = 0;
currentDirection = 1;
snakeEraseCounter = -1;
score = 0;
placeFood("new");
textMC.gotoAndStop("hide");
game.onEnterFrame = main;
gameRunning = true;
game.createEmptyMovieClip("wall", 3);
wallCounter = 0;
placeWall(3, 3, "wallMC");
placeWall(3, 4, "wallMC");
placeWall(3, 5, "wallMC");
placeWall(3, 6, "wallMC");
placeWall(3, 7, "wallMC");
placeWall(3, 8, "wallMC");
placeWall(3, 9, "wallMC");
placeWall(3, 10, "wallMC");
placeWall(3, 11, "wallMC");
placeWall(3, 12, "wallMC");
placeWall(3, 13, "wallMC");
placeWall(3, 14, "wallMC");
placeWall(4, 3, "wallMC");
placeWall(5, 3, "wallMC");
placeWall(6, 3, "wallMC");
placeWall(7, 3, "wallMC");
placeWall(8, 3, "wallMC");
placeWall(9, 3, "wallMC");
placeWall(10, 3, "wallMC");
placeWall(11, 3, "wallMC");
placeWall(12, 3, "wallMC");
placeWall(13, 3, "wallMC");
placeWall(13, 2, "wallMC");
placeWall(13, 4, "wallMC");
placeWall(13, 15, "wallMC");
placeWall(13, 16, "wallMC");
placeWall(13, 17, "wallMC");
placeWall(13, 18, "wallMC");
placeWall(13, 19, "wallMC");
placeWall(13, 20, "wallMC");
placeWall(13, 21, "wallMC");
placeWall(13, 22, "wallMC");
placeWall(13, 23, "wallMC");
placeWall(13, 24, "wallMC");
placeWall(13, 25, "wallMC");
placeWall(13, 26, "wallMC");
placeWall(3, 15, "wallMC");
placeWall(4, 15, "wallMC");
placeWall(5, 15, "wallMC");
placeWall(6, 15, "wallMC");
placeWall(7, 15, "wallMC");
placeWall(8, 15, "wallMC");
placeWall(9, 15, "wallMC");
placeWall(10, 15, "wallMC");
placeWall(11, 15, "wallMC");
placeWall(12, 15, "wallMC");
placeWall(13, 15, "wallMC");
placeWall(3, 27, "wallMC");
placeWall(4, 27, "wallMC");
placeWall(5, 27, "wallMC");
placeWall(6, 27, "wallMC");
placeWall(7, 27, "wallMC");
placeWall(8, 27, "wallMC");
placeWall(9, 27, "wallMC");
placeWall(10, 27, "wallMC");
placeWall(11, 27, "wallMC");
placeWall(12, 27, "wallMC");
placeWall(13, 27, "wallMC");
placeWall(3, 26, "wallMC");
placeWall(3, 28, "wallMC");
placeWall(31, 3, "wallMC");
placeWall(31, 4, "wallMC");
placeWall(31, 5, "wallMC");
placeWall(31, 6, "wallMC");
placeWall(31, 7, "wallMC");
placeWall(31, 8, "wallMC");
placeWall(31, 9, "wallMC");
placeWall(31, 10, "wallMC");
placeWall(31, 11, "wallMC");
placeWall(31, 12, "wallMC");
placeWall(31, 13, "wallMC");
placeWall(31, 14, "wallMC");
placeWall(31, 15, "wallMC");
placeWall(31, 3, "wallMC");
placeWall(32, 3, "wallMC");
placeWall(33, 3, "wallMC");
placeWall(34, 3, "wallMC");
placeWall(35, 3, "wallMC");
placeWall(36, 3, "wallMC");
placeWall(37, 3, "wallMC");
placeWall(38, 3, "wallMC");
placeWall(39, 3, "wallMC");
placeWall(40, 3, "wallMC");
placeWall(41, 2, "wallMC");
placeWall(41, 3, "wallMC");
placeWall(41, 4, "wallMC");
placeWall(31, 15, "wallMC");
placeWall(32, 15, "wallMC");
placeWall(33, 15, "wallMC");
placeWall(34, 15, "wallMC");
placeWall(35, 15, "wallMC");
placeWall(36, 15, "wallMC");
placeWall(37, 15, "wallMC");
placeWall(38, 15, "wallMC");
placeWall(39, 15, "wallMC");
placeWall(40, 15, "wallMC");
placeWall(41, 15, "wallMC");
placeWall(41, 15, "wallMC");
placeWall(41, 16, "wallMC");
placeWall(41, 17, "wallMC");
placeWall(41, 18, "wallMC");
placeWall(41, 19, "wallMC");
placeWall(41, 20, "wallMC");
placeWall(41, 21, "wallMC");
placeWall(41, 22, "wallMC");
placeWall(41, 23, "wallMC");
placeWall(41, 24, "wallMC");
placeWall(41, 25, "wallMC");
placeWall(41, 26, "wallMC");
placeWall(41, 27, "wallMC");
placeWall(31, 27, "wallMC");
placeWall(32, 27, "wallMC");
placeWall(33, 27, "wallMC");
placeWall(34, 27, "wallMC");
placeWall(35, 27, "wallMC");
placeWall(36, 27, "wallMC");
placeWall(37, 27, "wallMC");
placeWall(38, 27, "wallMC");
placeWall(39, 27, "wallMC");
placeWall(40, 27, "wallMC");
placeWall(41, 27, "wallMC");
placeWall(31, 26, "wallMC");
placeWall(31, 28, "wallMC");
}
function main() {
if ((moveTimer % moveSpeed) == 0) {
if (turnQueue.length > 0) {
var _local3 = turnQueue.pop();
if ((_local3 % 2) != (currentDirection % 2)) {
currentDirection = _local3;
}
}
x = x + xVelocity[currentDirection];
y = y + yVelocity[currentDirection];
moveTimer = 0;
if (((((map[x][y] != SNAKE_BLOCK) && (x > -1)) && (x < gameWidth)) && (y > -1)) && (y < gameHeight)) {
game.s.attachMovie("snakeMC", snakeBlockCounter, snakeBlockCounter, {_x:x * blockSize, _y:y * blockSize});
game.s[snakeBlockCounter].gotoAndStop(2);
game.s[snakeBlockCounter - 1].gotoAndStop(1);
snakeBlockCounter++;
if (typeof(map[x][y]) == "movieclip") {
score = score + 10;
if (score >= 200) {
_root.level10unlocked = true;
gameOver(true);
}
scoreTextField.text = "Score: " + score;
snakeEraseCounter = snakeEraseCounter - 4;
placeFood(map[x][y]);
}
map[x][y] = SNAKE_BLOCK;
var _local2 = game.s[snakeEraseCounter];
if (_local2) {
delete map[_local2._x / blockSize][_local2._y / blockSize];
_local2.removeMovieClip();
}
snakeEraseCounter++;
} else {
gameOver();
}
}
moveTimer++;
}
function gameOver(win) {
if (win) {
textMC.gotoAndStop("win");
} else {
textMC.gotoAndStop("gameOver");
}
delete game.onEnterFrame;
gameRunning = false;
}
function placeFood(foodMC) {
do {
var xFood = random(gameWidth);
var yFood = random(gameHeight);
} while (map[xFood][yFood]);
if (foodMC == "new") {
foodMC = game.food.attachMovie("foodMC", foodCounter, foodCounter);
foodCounter++;
}
foodMC._x = xFood * blockSize;
foodMC._y = yFood * blockSize;
map[xFood][yFood] = foodMC;
}
function placeWall(x, y, type) {
wallMC = game.wall.attachMovie(type, wallCounter, wallCounter);
wallCounter++;
wallMC._x = x * blockSize;
wallMC._y = y * blockSize;
map[x][y] = 1;
}
Mouse.show();
if ((_root.music == "ON") && (_root.setmusic != "seagal")) {
stopAllSounds();
menuMusic = new Sound();
menuMusic.attachSound("seagal");
menuMusic.start(0, 100);
_root.setmusic = "seagal";
}
blockSize = 8;
gameHeight = 30;
gameWidth = 45;
SNAKE_BLOCK = 1;
moveSpeed = 2;
keyListener = new Object();
keyListener.onKeyDown = function () {
var _local1 = Key.getCode();
if ((_local1 > 36) && (_local1 < 41)) {
if (game.onEnterFrame != undefined) {
if ((_local1 - 37) != turnQueue[0]) {
turnQueue.unshift(_local1 - 37);
}
}
} else if (_local1 == 32) {
if (!gameRunning) {
startGame();
}
} else if (_local1 == 80) {
if (gameRunning) {
if (game.onEnterFrame) {
delete game.onEnterFrame;
textMC.gotoAndStop("paused");
} else {
game.onEnterFrame = main;
textMC.gotoAndStop("hide");
}
}
}
};
Key.addListener(keyListener);
Frame 133
Mouse.show();
if ((_root.music == "ON") && (_root.setmusic != "muziek")) {
stopAllSounds();
menuMusic = new Sound();
menuMusic.attachSound("muziek");
menuMusic.start(0, 100);
_root.setmusic = "muziek";
}
blockSize = 8;
gameHeight = 30;
gameWidth = 45;
SNAKE_BLOCK = 1;
moveSpeed = 3;
Frame 134
Mouse.show();
if ((_root.music == "ON") && (_root.setmusic != "ocean")) {
stopAllSounds();
menuMusic = new Sound();
menuMusic.attachSound("ocean");
menuMusic.start(0, 100);
_root.setmusic = "ocean";
}
blockSize = 8;
gameHeight = 30;
gameWidth = 45;
SNAKE_BLOCK = 1;
moveSpeed = 2;
Frame 135
Mouse.show();
if ((_root.music == "ON") && (_root.setmusic != "muziek2")) {
stopAllSounds();
menuMusic = new Sound();
menuMusic.attachSound("muziek2");
menuMusic.start(0, 100);
_root.setmusic = "muziek2";
}
blockSize = 8;
gameHeight = 30;
gameWidth = 45;
SNAKE_BLOCK = 1;
moveSpeed = 1;
Symbol 12 MovieClip Frame 55
this._parent.removeMovieClip();
Symbol 13 MovieClip [wallMCTail] Frame 1
stop();
Symbol 16 MovieClip [snakeMC] Frame 1
stop();
Symbol 16 MovieClip [snakeMC] Frame 2
stop();
Symbol 20 MovieClip [bonus_heart] Frame 1
stop();
Symbol 20 MovieClip [bonus_heart] Frame 18
gotoAndPlay (2);
Symbol 22 MovieClip [bonus_pointBonus] Frame 1
stop();
Symbol 22 MovieClip [bonus_pointBonus] Frame 18
gotoAndPlay (2);
Symbol 24 MovieClip [bonus_foodblock] Frame 1
stop();
Symbol 24 MovieClip [bonus_foodblock] Frame 18
gotoAndPlay (2);
Symbol 27 MovieClip [bonus_fireball] Frame 1
stop();
Symbol 27 MovieClip [bonus_fireball] Frame 18
gotoAndPlay (2);
Symbol 28 MovieClip [wallMC] Frame 1
stop();
Symbol 32 MovieClip Frame 1
var counter = 0;
var interval = 3;
var speed = 50;
var stripeArray = new Array();
onEnterFrame = function () {
if (counter == 0) {
stripeArray.push(this.attachMovie("preload_stripe", "preload_stripe", this.getNextHighestDepth(), 0, 0));
counter = Math.ceil(Math.random() * interval);
stripeArray[stripeArray.length - 1]._y = (((Math.random() * (this._height - (stripeArray[stripeArray.length - 1]._height * 4))) + (stripeArray[stripeArray.length - 1]._height * 2)) / this._yscale) * 100;
} else {
counter--;
}
var _local3 = 0;
while (_local3 < stripeArray.length) {
if (stripeArray[_local3]._x < (_root._width + stripeArray[_local3]._width)) {
stripeArray[_local3]._x = stripeArray[_local3]._x + speed;
} else {
delete stripeArray[_local3];
}
_local3++;
}
};
Symbol 38 Button
on (release) {
NewgroundsAPI.loadNewgrounds();
}
Symbol 40 MovieClip Frame 1
function startAd(ngad_url) {
trace("opening " + ngad_url);
System.security.allowDomain("70.87.128.99");
System.security.allowInsecureDomain("70.87.128.99");
System.security.allowDomain("ads.shizmoo.com");
System.security.allowInsecureDomain("ads.shizmoo.com");
System.security.allowDomain("www.cpmstar.com");
System.security.allowInsecureDomain("www.cpmstar.com");
System.security.allowDomain("server.cpmstar.com");
System.security.allowInsecureDomain("server.cpmstar.com");
var ngads_redirect = new XML();
ngads_redirect.ignoreWhite = true;
ngads_redirect.onLoad = function (success) {
trace("[NEWGROUNDS FLASH ADS] :: You may get a 'Security Sandbox Violation' ... this is normal, do not freak out!");
if (success) {
ng_ad.loadMovie(ngads_redirect.toString(), "GET");
}
};
ngads_redirect.load(ngad_url);
}
if (NewgroundsAPI.getAdURL()) {
startAd(NewgroundsAPI.getAdURL());
}
NewgroundsAPI.onAdsApproved = function (ad_url) {
startAd(ad_url);
};
stop();
Symbol 44 Button
on (release) {
getURL ("http://www.clashflash.com", "_blank");
}
Symbol 47 Button
on (release) {
getURL ("http://www.clashflash.com", "_blank");
}
Symbol 67 MovieClip Frame 40
stop();
Symbol 81 Button
on (press) {
tellTarget (_root) {
nextFrame();
};
}
Symbol 82 Button
on (press) {
gotoAndStop ("end");
_root.play();
}
Instance of Symbol 57 MovieClip in Symbol 83 MovieClip Frame 1
onClipEvent (load) {
_root.stop();
PercentLoaded = int((_root.getBytesLoaded() / _root.getBytesTotal()) * 100);
if (PercentLoaded != 100) {
_parent.gotoAndStop(PercentLoaded);
} else {
_parent.gotoAndStop("lastframe");
}
}
onClipEvent (enterFrame) {
PercentLoaded = int((_root.getBytesLoaded() / _root.getBytesTotal()) * 100);
if (PercentLoaded != 100) {
_parent.gotoAndStop(PercentLoaded);
} else {
_parent.gotoAndPlay("loaded");
}
}
Symbol 83 MovieClip Frame 101
play();
Symbol 83 MovieClip Frame 165
stop();
Symbol 515 MovieClip [__Packages.NewgroundsAPI] Frame 0
class NewgroundsAPI
{
static var tracker_id, host, version, debug, error_format, header_format, normal_format, link_format;
function NewgroundsAPI () {
}
static function connectMovie(id) {
if (!id) {
SendError("Missing required 'id' parameter in NewgroundsAPI.connectMovie(id:Number)");
} else if (!tracker_id) {
SendMessage("Connecting to API gateway...");
tracker_id = id;
host = _url.split("/")[2].toLowerCase();
if (host.length < 1) {
host = "localhost";
}
var _local2 = new Object();
SendEvent(MOVIE_VIEWS);
}
}
static function setMovieVersion(movie_version) {
if (!movie_version) {
SendError("Missing required 'version' in NewgroundsAPI.setMovieVersion(version:String)");
} else {
version = movie_version;
}
}
static function debugMode() {
debug = true;
}
static function addCustomEvent(stat_id, stat_name) {
if (!stat_id) {
SendError("Missing required 'id' parameter in NewgroundsAPI.AddCustomEvent(id:Number, event_name:String)");
} else if (!stat_name) {
SendError("Missing required 'event_name' parameter in NewgroundsAPI.AddCustomEvent(id:Number, event_name:String)");
} else {
custom_events[stat_name] = CUSTOM_STATS + stat_id;
SendMessage("Created custom event: " + stat_name);
}
}
static function addCustomLink(stat_id, stat_name) {
if (!stat_id) {
SendError("Missing required 'id' parameter in NewgroundsAPI.AddCustomLink(id:Number, link_name:String)");
} else if (!stat_name) {
SendError("Missing required 'link_name' parameter in NewgroundsAPI.AddCustomLink(id:Number, link_name:String)");
} else {
custom_links[stat_name] = CUSTOM_STATS + stat_id;
SendMessage((("Created custom link " + stat_id) + ": ") + stat_name);
}
}
static function loadMySite() {
SendLink(AUTHOR_SITE);
}
static function loadNewgrounds(special) {
if (special) {
var _local1 = {page:special};
}
SendLink(NEWGROUNDS, _local1);
}
static function logCustomEvent(event_name) {
if (!event_name) {
SendError("Missing required 'event_name' parameter in NewgroundsAPI.logCustomEvent(event_name:String)");
} else if (!custom_events[event_name]) {
SendError("Attempted to log undefined custom event: " + event_name);
} else {
SendEvent(custom_events[event_name]);
}
}
static function loadCustomLink(link_name) {
if (!link_name) {
SendError("Missing required 'link_name' parameter in NewgroundsAPI.loadCustomLink(link_name:String)");
} else if (!custom_links[link_name]) {
SendError("Attempted to open undefined custom link: " + link_name);
} else {
SendLink(custom_links[link_name]);
}
}
static function getAdURL() {
return(movie_options.ad_url);
}
static function getMovieURL() {
if (movie_options.movie_url) {
return(movie_options.movie_url);
}
return("Newgrounds.com");
}
static function getNewVersionURL() {
return((((((GATEWAY_URL + "?&id=") + tracker_id) + "&host=") + escape(host)) + "&stat=") + NEW_VERSION);
}
static function SendEvent(id) {
SendStat(id, false);
}
static function SendLink(id, extra) {
SendStat(id, true, extra);
}
static function ReadGatewayData(params) {
for (var _local2 in params) {
params[_local2] = unescape(params[_local2]);
movie_options[_local2] = params[_local2];
}
if (params.settings_loaded) {
SendMessage("You have successfully connected to the Newgrounds API gateway!");
SendMessage(("Movie Identified as '" + movie_options.movie_name) + "'");
if (movie_options.message) {
SendMessage(movie_options.message);
}
if (movie_options.ad_url) {
SendMessage("Your movie has been approved to run Flash Ads");
onAdsApproved(movie_options.ad_url);
}
if (movie_options.movie_version and (movie_options.movie_version.toString() != version.toString())) {
SendMessage("WARNING: The movie version configured in your API settings does not match this movie's version!");
onNewVersionAvailable(movie_options.movie_version, getMovieURL(), getNewVersionURL());
}
if (movie_options.deny_host) {
SendMessage("You have blocked 'localHost' in your API settings.");
SendMessage("If you wish to test your movie you will need to remove this block.");
onDenyHost(host, getMovieURL(), getNewVersionURL());
}
if (movie_options.request_portal_url == 1) {
var _local4 = (((GATEWAY_URL + "?&id=") + tracker_id) + "&portal_url=") + escape(_url);
var _local3 = new XML();
_local3.ignoreWhite = true;
_local3.load(_local4);
}
} else if (!movie_options.settings_loaded) {
SendError("Could not establish connection to the API gateway.");
}
}
static function SendStat(stat_id, open_in_browser, extra) {
if (!tracker_id) {
SendError("API calls cannot be made without a valid movie id.");
SendError("Did you remember to add the \"NewgroundsAPI.connectMovie()\" code?");
} else {
var _local7 = (((((GATEWAY_URL + "?&id=") + tracker_id) + "&host=") + escape(host)) + "&stat=") + stat_id;
for (var _local9 in extra) {
_local7 = _local7 + ((("&" + escape(_local9)) + "=") + escape(extra[_local9]));
}
trace(_local7);
if (debug) {
_local7 = _local7 + "&debug=1";
}
if (open_in_browser) {
getURL (_local7, "_blank");
} else {
var _local10 = new XML();
_local10.ignoreWhite = true;
_local10.onLoad = function (success) {
var _local6 = new Object();
var _local3 = 0;
while (_local3 < this.firstChild.childNodes.length) {
var _local4 = this.firstChild.childNodes[_local3];
var _local5 = _local4.nodeName;
var _local2 = _local4.attributes.value;
if (_local2 == Number(_local2)) {
_local2 = Number(_local2);
}
_local6[_local5] = _local2;
_local3++;
}
NewgroundsAPI.ReadGatewayData(_local6);
};
_local10.load(_local7);
}
}
}
static function SendError(msg) {
trace("[NEWGROUNDS API ERROR] :: " + msg);
}
static function SendMessage(msg) {
trace("[NEWGROUNDS API] :: " + msg);
}
static function InitTextFormats() {
if (!error_format) {
error_format = new TextFormat();
error_format.font = "Arial Black";
error_format.size = 48;
error_format.color = 16711680 /* 0xFF0000 */;
}
if (!header_format) {
header_format = new TextFormat();
header_format.font = "Arial Black";
header_format.size = 24;
header_format.color = 16777215 /* 0xFFFFFF */;
}
if (!normal_format) {
normal_format = new TextFormat();
normal_format.font = "Arial";
normal_format.bold = true;
normal_format.size = 12;
normal_format.color = 16777215 /* 0xFFFFFF */;
}
if (!link_format) {
link_format = new TextFormat();
link_format.color = 16776960 /* 0xFFFF00 */;
link_format.underline = true;
}
}
static function onNewVersionAvailable(version, movie_url, redirect_url) {
InitTextFormats();
var _local2 = new Object();
_local2.x = Stage.width / 2;
_local2.y = Stage.height / 2;
_root.createEmptyMovieClip("NGAPI_new_version_overlay", _root.getNextHighestDepth());
_root.NGAPI_new_version_overlay.lineStyle(1, 0, 100);
_root.NGAPI_new_version_overlay.beginFill(0, 70);
_root.NGAPI_new_version_overlay.moveTo(-10, -10);
_root.NGAPI_new_version_overlay.lineTo(-10, 1000);
_root.NGAPI_new_version_overlay.lineTo(1000, 1000);
_root.NGAPI_new_version_overlay.lineTo(1000, -10);
_root.NGAPI_new_version_overlay.lineTo(-10, -10);
_root.NGAPI_new_version_overlay.endFill();
_root.NGAPI_new_version_overlay.lineStyle(10, 0, 100);
_root.NGAPI_new_version_overlay.beginFill(51);
_root.NGAPI_new_version_overlay.moveTo(_local2.x - 240, _local2.y - 120);
_root.NGAPI_new_version_overlay.lineTo(_local2.x + 240, _local2.y - 120);
_root.NGAPI_new_version_overlay.lineTo(_local2.x + 240, _local2.y + 80);
_root.NGAPI_new_version_overlay.lineTo(_local2.x - 240, _local2.y + 80);
_root.NGAPI_new_version_overlay.lineTo(_local2.x - 240, _local2.y - 120);
_root.NGAPI_new_version_overlay.endFill();
_root.NGAPI_new_version_overlay.createEmptyMovieClip("exit", 1000);
_root.NGAPI_new_version_overlay.exit.lineStyle(2, 39423, 100);
_root.NGAPI_new_version_overlay.exit.beginFill(0, 50);
_root.NGAPI_new_version_overlay.exit.moveTo(_local2.x + 210, _local2.y - 110);
_root.NGAPI_new_version_overlay.exit.lineTo(_local2.x + 230, _local2.y - 110);
_root.NGAPI_new_version_overlay.exit.lineTo(_local2.x + 230, _local2.y - 90);
_root.NGAPI_new_version_overlay.exit.lineTo(_local2.x + 210, _local2.y - 90);
_root.NGAPI_new_version_overlay.exit.lineTo(_local2.x + 210, _local2.y - 110);
_root.NGAPI_new_version_overlay.exit.endFill();
_root.NGAPI_new_version_overlay.exit.moveTo(_local2.x + 214, _local2.y - 106);
_root.NGAPI_new_version_overlay.exit.lineTo(_local2.x + 226, _local2.y - 94);
_root.NGAPI_new_version_overlay.exit.moveTo(_local2.x + 226, _local2.y - 106);
_root.NGAPI_new_version_overlay.exit.lineTo(_local2.x + 214, _local2.y - 94);
_root.NGAPI_new_version_overlay.exit.onMouseUp = function () {
if (_root.NGAPI_new_version_overlay.exit.hitTest(_root._xmouse, _root._ymouse)) {
_root.NGAPI_new_version_overlay.removeMovieClip();
}
};
var _local3 = (("Version " + version) + " is now available at:") + newline;
var _local5 = _local3.length;
_local3 = _local3 + movie_url;
var _local4 = _local3.length;
_root.NGAPI_new_version_overlay.createTextField("mouseblocker", 99, -10, -10, 1000, 1000);
_root.NGAPI_new_version_overlay.createTextField("newversion", 100, _local2.x - 210, _local2.y - 90, 400, 80);
_root.NGAPI_new_version_overlay.newversion.text = "New Version Available!";
_root.NGAPI_new_version_overlay.newversion.setTextFormat(header_format);
_root.NGAPI_new_version_overlay.createTextField("message", 101, (Stage.width - 400) / 2, Stage.height / 2, 400, 40);
_root.NGAPI_new_version_overlay.message.text = _local3;
_root.NGAPI_new_version_overlay.message.multiline = true;
_root.NGAPI_new_version_overlay.message.wordWrap = true;
_root.NGAPI_new_version_overlay.message.html = true;
_root.NGAPI_new_version_overlay.message.setTextFormat(normal_format);
link_format.url = redirect_url;
_root.NGAPI_new_version_overlay.message.setTextFormat(_local5, _local4, link_format);
}
static function onDenyHost(hostname, movie_url, redirect_url) {
InitTextFormats();
_root.createEmptyMovieClip("NGAPI_deny_host_overlay", _root.getNextHighestDepth());
_root.NGAPI_deny_host_overlay.lineStyle(20, 0, 100);
_root.NGAPI_deny_host_overlay.beginFill(6684672);
_root.NGAPI_deny_host_overlay.moveTo(0, 0);
_root.NGAPI_deny_host_overlay.lineTo(Stage.width, 0);
_root.NGAPI_deny_host_overlay.lineTo(Stage.width, Stage.height);
_root.NGAPI_deny_host_overlay.lineTo(0, Stage.height);
_root.NGAPI_deny_host_overlay.lineTo(0, 0);
_root.NGAPI_deny_host_overlay.endFill();
var _local2 = ("This movie has not been approved for use on " + hostname) + ".";
_local2 = _local2 + "\r\rFor an aproved copy, please visit:\r";
var _local4 = _local2.length;
_local2 = _local2 + movie_url;
var _local3 = _local2.length;
_root.NGAPI_deny_host_overlay.createTextField("mousekill", 100, 0, 0, Stage.width, Stage.height);
_root.NGAPI_deny_host_overlay.createTextField("error", 101, (Stage.width - 400) / 2, (Stage.height / 2) - 100, 400, 200);
_root.NGAPI_deny_host_overlay.error.text = "ERROR!";
_root.NGAPI_deny_host_overlay.error.setTextFormat(error_format);
_root.NGAPI_deny_host_overlay.createTextField("message", 102, (Stage.width - 400) / 2, Stage.height / 2, 400, 200);
_root.NGAPI_deny_host_overlay.message.text = _local2;
_root.NGAPI_deny_host_overlay.message.multiline = true;
_root.NGAPI_deny_host_overlay.message.wordWrap = true;
_root.NGAPI_deny_host_overlay.message.html = true;
_root.NGAPI_deny_host_overlay.message.setTextFormat(normal_format);
link_format.url = redirect_url;
_root.NGAPI_deny_host_overlay.message.setTextFormat(_local4, _local3, link_format);
}
static function isInstalled() {
return(true);
}
static function onAdsApproved(ad_url) {
}
static var movie_options = new Object();
static var custom_events = new Object();
static var custom_links = new Object();
static var MOVIE_VIEWS = 1;
static var AUTHOR_SITE = 2;
static var NEWGROUNDS = 3;
static var NEW_VERSION = 4;
static var CUSTOM_STATS = 50;
static var GATEWAY_URL = "http://www.ngads.com/gateway.php";
}
Symbol 147 MovieClip Frame 38
stop();
Symbol 153 MovieClip Frame 1
stop();
Symbol 158 Button
on (release) {
getURL ("http://www.clashflash.com", "_blank");
}
Symbol 165 MovieClip Frame 1
stop();
Symbol 165 MovieClip Frame 2
stop();
Symbol 165 MovieClip Frame 3
stop();
Symbol 165 MovieClip Frame 4
stop();
Symbol 188 Button
on (release) {
_root.gotoAndStop("menu");
}
Symbol 192 MovieClip Frame 15
stop();
Symbol 214 Button
on (release) {
getURL ("http://www.clashflash.com", "_blank");
}
Symbol 218 MovieClip Frame 695
stop();
Symbol 227 MovieClip Frame 1
stop();
Symbol 241 MovieClip Frame 1
stop();
Symbol 244 MovieClip Frame 21
stop();
Symbol 257 MovieClip Frame 415
stop();
Symbol 272 Button
on (release) {
_root.cpuSpeed = 10;
gotoAndStop ("play");
}
on (release) {
_root.naamSpelerA = speler.spelerA.text;
_root.spelerA = speler._currentframe;
_root.pongA = (speler._currentframe * 2) - 1;
_root.naamSpelerB = "Mr. G&W";
gotoAndStop ("lvl9");
}
Symbol 303 MovieClip Frame 1
stop();
Symbol 306 MovieClip Frame 21
stop();
Symbol 319 MovieClip Frame 21
stop();
Symbol 344 MovieClip Frame 1
stop();
back.onRelease = function () {
_root.gotoAndStop("menu");
};
Symbol 344 MovieClip Frame 2
stop();
back.onRelease = function () {
_root.gotoAndStop("menu");
};
Symbol 344 MovieClip Frame 3
stop();
back.onRelease = function () {
_root.gotoAndStop("menu");
};
Symbol 427 MovieClip Frame 310
stop();
Symbol 485 MovieClip Frame 1
stop();