Frame 1
setVariable(mosuser, "error");
serVariable(livesite, "error");
stop();
Stage.showMenu = false;
this.onEnterFrame = function () {
sofar = this.getBytesLoaded();
total = this.getBytesTotal();
if (sofar == total) {
delete this.onEnterFrame;
nextFrame();
}
};
Frame 2
game_so = SharedObject.getLocal("neaveSnake");
score = 0;
level = 2;
f1_mc.onEnterFrame = (f2_mc.onEnterFrame = (f3_mc.onEnterFrame = (f4_mc.onEnterFrame = function () {
this._rotation = this._rotation + 5;
})));
slug_btn.onRollOver = function () {
slug_mc.gotoAndStop(2);
};
slug_btn.onRollOut = (slug_btn.onDragOut = function () {
slug_mc.gotoAndStop(1);
});
slug_btn.onRelease = function () {
level = 2;
play();
};
worm_btn.onRollOver = function () {
worm_mc.gotoAndStop(2);
};
worm_btn.onRollOut = (worm_btn.onDragOut = function () {
worm_mc.gotoAndStop(1);
});
worm_btn.onRelease = function () {
level = 1;
play();
};
python_btn.onRollOver = function () {
python_mc.gotoAndStop(2);
};
python_btn.onRollOut = (python_btn.onDragOut = function () {
python_mc.gotoAndStop(1);
});
python_btn.onRelease = function () {
level = 0;
play();
};
highScores_btn.onRollOver = function () {
highScores_mc._alpha = 100;
};
highScores_btn.onRollOut = (highScores_btn.onDragOut = function () {
highScores_mc._alpha = 40;
});
highScores_btn.onRelease = function () {
gotoAndStop (44);
};
neave_btn.onRelease = function () {
getURL ("http://www.neave.com/games/", "_blank");
};
Frame 3
Key.removeListener(keyListener);
score = 0;
len = 2;
gx = 21;
gy = 15;
max = ((gx - 2) * (gy - 2)) - 3;
vx = 0;
vy = 1;
x = 11;
y = 4;
gameOver = (paused = (moved = false));
levelName = "LEVEL: " + ["PYTHON", "WORM", "SLUG"][level];
var i = 0;
while (i <= gx) {
s_mc.createEmptyMovieClip(i, i);
var j = 0;
while (j <= gy) {
s_mc[i].attachMovie("snake", j, j, {_x:i * 12, _y:j * 12, _visible:false, fuse:0});
j++;
}
i++;
}
makeFood = function () {
do {
fx = int(Math.random() * (gx - 1)) + 1;
fy = int(Math.random() * (gy - 1)) + 1;
} while (s_mc[fx][fy]._visible);
with (s_mc[fx][fy]) {
fuse = 75;
gotoAndStop(2);
_visible = true;
}
};
Frame 42
stop();
makeFood();
lc = level;
this.onEnterFrame = function () {
if (paused) {
return(undefined);
}
if (lc) {
lc--;
return(undefined);
}
lc = level;
x = x + vx;
y = y + vy;
if ((x == fx) && (y == fy)) {
score = score + (s_mc[x][y].fuse + 1);
len++;
with (s_mc[x][y]) {
fuse = len;
gotoAndStop(1);
}
for (var i in s_mc) {
for (var j in s_mc[i]) {
if (s_mc[i][j]._visible) {
s_mc[i][j].fuse++;
}
}
}
makeFood();
} else if (((((s_mc[x][y]._visible || (x == 0)) || (x == gx)) || (y == 0)) || (y == gy)) || (len > max)) {
gameOver = true;
s_mc._alpha = 25;
Key.removeListener(keyListener);
nextFrame();
delete this.onEnterFrame;
}
with (s_mc[x][y]) {
fuse = len;
_visible = true;
}
moved = false;
updateAfterEvent();
};
keyListener = new Object();
keyListener.onKeyDown = function () {
if (gameOver) {
return(undefined);
}
var keyCode = Key.getCode();
switch (keyCode) {
case Key.SPACE :
case 80 :
case 112 :
paused = !paused;
s_mc._alpha = (paused ? 25 : 100);
}
if ((!paused) && (!moved)) {
switch (keyCode) {
case Key.UP :
if (vy == 0) {
vx = 0;
vy = -1;
moved = true;
}
return;
case Key.DOWN :
if (vy == 0) {
vx = 0;
vy = 1;
moved = true;
}
return;
case Key.LEFT :
if (vx == 0) {
vx = -1;
vy = 0;
moved = true;
}
return;
case Key.RIGHT :
if (vx != 0) {
break;
}
vx = 1;
vy = 0;
moved = true;
}
}
};
Key.addListener(keyListener);
Frame 43
stop();
name_txt.restrict = "A-Z 0-9.:\\-";
tempName = game_so.data.playerName;
Selection.setFocus(name_txt);
Selection.setSelection(name_txt.length, name_txt.length);
ok_btn.onRollOver = function () {
ok_mc._alpha = 100;
};
ok_btn.onRollOut = (ok_btn.onDragOut = function () {
ok_mc._alpha = 40;
});
ok_btn.onRelease = function () {
if (name_txt.length > 0) {
game_so.data.playerName = name_txt.text;
}
delete tempName;
nextFrame();
};
ok_btn.onKeyDown = function () {
if (Key.getCode() == 13) {
Key.removeListener(this);
this.onRelease();
}
};
Key.addListener(ok_btn);
Frame 44
stop();
showScores = function () {
var i = 5;
while (i > 0) {
var n = scoreboard_lv["name" + (page + i)];
var s = scoreboard_lv["score" + (page + i)];
var l_mc = this[("line" + i) + "_mc"];
var lbg_mc = this[("line" + i) + "bg_mc"];
l_mc.rank_txt.text = (lbg_mc.rank_txt.text = (page + i) + ".");
l_mc.name_txt.text = (lbg_mc.name_txt.text = (n.length ? (n.toUpperCase()) : "-"));
l_mc.score_txt.text = (lbg_mc.score_txt.text = (s.length ? (s) : "-"));
l_mc._visible = (lbg_mc._visible = true);
loading_mc._visible = false;
i--;
}
};
loadScores = function (num) {
next_btn._visible = (back_btn._visible = (slug_btn.enabled = (worm_btn.enabled = (python_btn.enabled = false))));
slug_mc._alpha = (worm_mc._alpha = (python_mc._alpha = 40));
switch (num) {
case 2 :
slug_mc._alpha = 100;
break;
case 1 :
worm_mc._alpha = 100;
break;
default :
python_mc._alpha = 100;
}
var i = 5;
while (i > 0) {
this[("line" + i) + "_mc"]._visible = (this[("line" + i) + "bg_mc"]._visible = false);
i--;
}
loading_mc.gotoAndStop(1);
loading_mc._visible = true;
page = 0;
maxScore = 100;
scoreboard_lv = new LoadVars();
if ((score > 0) && (game_so.data.playerName.length > 0)) {
scoreboard_lv.score = score;
scoreboard_lv.name = game_so.data.playerName.toLowerCase();
}
scoreboard_lv.game = "snake" + (3 - num);
scoreboard_lv.mosuser = mosuser;
relativepath = "/components/com_puarcade/game_scores.php";
flashurl = livesite + relativepath;
scoreboard_lv.sendAndLoad(flashurl, scoreboard_lv, "POST");
scoreboard_lv.onLoad = function (success) {
if (success) {
if (Boolean(scoreboard_lv.success)) {
next_btn._visible = true;
if (scoreboard_lv.maxScore.length > 0) {
maxScore = Number(scoreboard_lv.maxScore);
}
showScores();
} else {
loading_mc.errorMsg = scoreboard_lv.errorMsg.toUpperCase();
loading_mc.gotoAndStop(2);
}
} else {
loading_mc.errorMsg = "COULD NOT ACCESS SCORES.";
loading_mc.gotoAndStop(2);
}
switch (num) {
case 2 :
worm_btn.enabled = (python_btn.enabled = true);
return;
case 1 :
slug_btn.enabled = (python_btn.enabled = true);
return;
default :
slug_btn.enabled = (worm_btn.enabled = true);
}
};
score = 0;
};
back_btn.onPress = function () {
page = page - 5;
if (page < 0) {
page = 0;
}
if (page < 5) {
back_btn._visible = false;
}
next_btn._visible = true;
showScores();
};
next_btn.onPress = function () {
page = page + 5;
if (page > maxScore) {
page = maxScore;
}
if (page > (maxScore - 10)) {
next_btn._visible = false;
}
back_btn._visible = true;
showScores();
};
newGame_btn.onRelease = function () {
gotoAndStop (2);
};
slug_btn.onRollOver = function () {
slug_mc._alpha = 100;
};
slug_btn.onRollOut = (slug_btn.onDragOut = function () {
slug_mc._alpha = 40;
});
slug_btn.onRelease = function () {
loadScores(2);
};
worm_btn.onRollOver = function () {
worm_mc._alpha = 100;
};
worm_btn.onRollOut = (worm_btn.onDragOut = function () {
worm_mc._alpha = 40;
});
worm_btn.onRelease = function () {
loadScores(1);
};
python_btn.onRollOver = function () {
python_mc._alpha = 100;
};
python_btn.onRollOut = (python_btn.onDragOut = function () {
python_mc._alpha = 40;
});
python_btn.onRelease = function () {
loadScores(0);
};
loadScores(level);
Symbol 3 MovieClip Frame 4
stop();
Symbol 5 MovieClip [snake] Frame 1
stop();
this.onEnterFrame = function () {
if (_root.lc) {
return(undefined);
}
if ((!_root.gameOver) && (!_root.paused)) {
if (fuse) {
fuse--;
} else {
_visible = false;
}
}
};
Symbol 5 MovieClip [snake] Frame 2
this.onEnterFrame = function () {
if (((!_root.gameOver) && (!_root.paused)) && (fuse)) {
fuse--;
FoodBG._rotation = (Food._rotation = Food._rotation + (fuse / 4));
}
};
Symbol 13 MovieClip Frame 1
if (_parent._name == "worm_mc") {
step = 2;
} else if (_parent._name == "python_mc") {
step = 3;
} else {
step = 1;
}
this.onEnterFrame = function () {
gotoAndStop(_currentframe + step);
};
Symbol 13 MovieClip Frame 41
gotoAndPlay (2);
Symbol 13 MovieClip Frame 42
gotoAndPlay (2);
Symbol 14 MovieClip Frame 1
stop();
Symbol 16 MovieClip Frame 1
stop();
Symbol 18 MovieClip Frame 1
stop();
Symbol 57 MovieClip Frame 1
stop();
errorMsg = "";
Symbol 63 Button
on (rollOver) {
NG._alpha = 100;
}
on (rollOut, dragOut) {
NG._alpha = 40;
}
on (release) {
gotoAndStop (2);
}