Frame 1
function move() {
var _local1 = _root;
posx[0] = _local1.snake._x;
posy[0] = _local1.snake._y;
_local1.snake._x = _local1.snake._x + (4 * Math.cos((Math.PI/180) * theta));
_local1.snake._y = _local1.snake._y + (4 * Math.sin((Math.PI/180) * theta));
if (_local1.init) {
t = 0;
while (t < _local1.snakelength) {
nn = "body" + Number(t);
duplicateMovieClip ("snake", nn, t);
nn._x = -20;
nn._y = -20;
t++;
}
_local1.init = false;
_local1.specialtime.stime = 0;
_local1.specialtime.sout = false;
_local1.specialtime._visible = false;
}
_local1.ltf();
t = _local1.snakelength - 1;
while (t > 0) {
posx[t] = posx[t - 1];
posy[t] = posy[t - 1];
t--;
}
if (collide(_local1.food._x, _local1.food._y)) {
_local1.foods = false;
t = 0;
while (t < 20) {
nn = "body" + Number(_local1.snakelength);
duplicateMovieClip ("snake", nn, _local1.snakelength);
nn._x = -20;
nn._y = -20;
posx[_local1.snakelength] = posx[_local1.snakelength - 1];
posy[_local1.snakelength] = posy[_local1.snakelength - 1];
_local1.snakelength++;
t++;
}
t = 0;
while (t < _local1.snakelength) {
nn = "body" + Number(t);
setProperty(nn, _x , posx[t]);
setProperty(nn, _y , posy[t]);
t++;
}
_local1.count = 0;
_local1.score = _local1.score + 5;
}
if (collide(_local1.specialfood._x, _local1.specialfood._y)) {
_local1.score = _local1.score + Number(_local1.specialtime.spoints);
_local1.specialtime.spoints = 0;
_local1.specialtime.stime = 0;
_local1.specialfood._x = -30;
_local1.specialfood._y = -20;
_local1.specialtime.sout = false;
_local1.specialtime._visible = false;
}
if (_local1.specialtime.sout) {
_local1.specialtime.stime = _local1.specialtime.stime - 1;
_local1.specialtime.spoints = int(_local1.specialtime.stime / 10.5);
if (_local1.specialtime.stime == 0) {
_local1.specialfood._x = -30;
_local1.specialfood._y = -20;
_local1.specialtime.sout = false;
_local1.specialtime._visible = false;
}
}
if (!_local1.foods) {
x = random(292) + 19;
y = random(272) + 19;
_local1.food._x = x;
_local1.food._y = y;
if ((_local1.score != 0) && (((_local1.snakelength - 19) % 100) == 0)) {
sx = random(292) + 19;
sy = random(272) + 19;
_local1.specialfood._x = sx;
_local1.specialfood._y = sy;
_local1.specialtime.stime = 210;
_local1.specialtime.spoints = 20;
_local1.specialtime.sout = true;
_local1.specialtime._visible = true;
}
_local1.foods = true;
}
if ((((_local1.snake._x < 10) || (_local1.snake._x > 310)) || (_local1.snake._y < 10)) || (_local1.snake._y > 290)) {
_local1.destroy();
}
t = 0;
while (t < _local1.snakelength) {
if (collide(posx[t], posy[t])) {
_local1.destroy();
}
t++;
}
}
function ltf() {
var _local1 = _root;
last = (_local1.snakelength - 1) - _local1.count;
nn = "body" + Number(last);
_local1.count++;
if (last == 0) {
_local1.count = 0;
}
setProperty(nn, _x , posx[0]);
setProperty(nn, _y , posy[0]);
}
function collide(objectx, objecty) {
delta_x = _root.snake._x - objectx;
delta_y = _root.snake._y - objecty;
if (((delta_x * delta_x) + (delta_y * delta_y)) < 15) {
return(true);
}
return(false);
}
function destroy() {
var _local1 = _root;
_local1.crash._x = _local1.snake._x;
_local1.crash._y = _local1.snake._y;
t = 0;
while (t < _local1.snakelength) {
nn = "body" + Number(t);
removeMovieClip(nn);
t++;
}
_local1.snake._visible = false;
_local1.crash.gotoAndPlay(2);
if (score > _local1.scoretable.topten.SCORE9) {
gotoAndStop (5);
} else {
gotoAndStop (4);
}
}
sfile = "http://www.s4websolutions.com/rsnake/scores.php";
sview = sfile + "?filename=score.sco&scoresize=10&action=VIEW&viewtype=FLASH";
posx = new Array();
posy = new Array();
snakelength = 19;
t = 0;
while (t < snakelength) {
posx[t] = -20;
posy[t] = -20;
t++;
}
init = true;
theta = 0;
foods = false;
score = 0;
count = 0;
_root.scoretable.topten.loadVariables(_root.sview);
_root.scoretable._visible = false;
stop();
Frame 2
move();
if (Key.isDown(39)) {
theta = theta + 10;
if (theta >= 360) {
theta = theta - 360;
}
} else if (Key.isDown(37)) {
theta = theta - 10;
if (theta < 0) {
theta = theta + 360;
}
}
Frame 3
gotoAndPlay (2);
Frame 4
_root.scoretable._visible = true;
stop();
Symbol 10 Button
on (release) {
gotoAndPlay (2);
}
Symbol 12 Button
on (keyPress "<Space>") {
gotoAndPlay (2);
}
Symbol 20 Button
on (releaseOutside) {
getURL ("http://www.eggshells.tk");
}
Symbol 58 MovieClip Frame 1
stop();
Symbol 61 Button
on (keyPress "<Space>") {
gotoAndPlay (1);
}
Symbol 67 Button
on (release) {
gotoAndPlay (1);
}