[Tools][Expand/Collapse All]Note that automatic extraction of ActionScript 3 is still pretty much unsupported by swfchan. AS1/AS2 works okay most of the time.Frame 1 (1.33 KiB) ●
createTextField("t", 1, 1, 255, 511, 32);
t.text = "Snake Game\t-\tPress SPACE";
beginFill(15658734);
lineStyle(1);
lineTo(511, 0);
lineTo(511, 256);
lineTo(0, 256);
endFill();
Key.addListener(t);
t.onKeyDown = function () {
c = Key.getCode() - 37;
if (!(c >> 2)) {
if (c != q[0]) {
q.unshift(c);
}
return(undefined);
}
x = 16896;
q = [];
m = [];
createEmptyMovieClip("s", (w = 0));
e = 2 * ((m[x - 520] = 2 * ((r = 1))));
onEnterFrame = function () {
c = q.pop();
if ((c % 2) != (r % 2)) {
if (c != undefined) {
r = c;
}
}
x = x + ([-1, -65, 1, 65][r] * 8);
if (((m[x] == 1) or (!(x % 520))) or (!(int(x / 520) % 33))) {
delete onEnterFrame;
t.text = t.text + "\tGAME OVER!";
return(undefined);
}
with (s.createEmptyMovieClip(w, w)) {
beginFill(16711680);
if (w++) {
beginFill(5592456);
}
_x = x % 520;
_y = int(x / 520) * 8;
lineTo(-7, 0);
lineTo(-7, -7);
lineTo(0, -7);
endFill();
}
m[x] = m[x] + 1;
if (m[x] == 3) {
t.text = "Score: " + (((w - ((e = e - 5))) - 2) * 2);
do {
} while (m[(c = ((s[0]._x = 8 + (random(64) * 8))) + (((s[0]._y = 8 + (random(32) * 8))) * 65))]);
m[c] = 2;
}
if (e) {
c = s[e];
delete m[c._x + (65 * c._y)];
removeMovieClip(c);
}
e++;
};
};