Frame 1
function init() {
stat = new status(8);
}
function initGame() {
percentage = 0;
score = 0;
level = 0;
stat.update();
lifes = 3;
multiplier = 1;
}
function initLevel() {
level++;
percentage = 0;
frame.clear();
free.clear();
stix.clear();
occupied.clear();
i = 0;
while (i < spx.length) {
spx[i].clear();
i++;
}
spx = Array();
f = [[left, top], [right, top], [right, bottom], [left, bottom]];
f_ccw = f.slice(0);
f_ccw.reverse();
frame.lineStyle(linewidth, 16777215, 100);
drawPolygon(f, frame);
free.beginFill(0, 100);
drawPolygon(f, free);
free.endFill();
mrkr = new marker(7);
qix1 = new qix(5);
qix2 = new qix(6);
}
function resume() {
stix.clear();
qix1.regenerate();
i = 0;
while (i < spx.length) {
spx[i].clear();
i++;
}
spx[0] = new sparx(11, -1);
spx[1] = new sparx(12, 1);
spx[0].otherSide();
spx[1].otherSide();
mrkr.move(line[0][0], line[0][1]);
start();
}
function start() {
tl = new timeline(0);
if (spx.length == 0) {
spx[0] = new sparx(11, -1);
spx[1] = new sparx(12, 1);
}
if (soundflag) {
mode = "intro";
spawnsnd.start();
} else {
mode = "move";
}
stix.moveTo(mrkr.m._x, mrkr.m._y);
stix.lineStyle(linewidth, fastcolor, 100);
dir = "";
ix = 0;
line = [[mrkr.m._x, mrkr.m._y]];
odd = false;
slow = false;
mrkr.birth();
stat.update();
}
function end() {
var _local1 = score;
initGame();
initLevel();
mode = "demo";
cnt = 856;
lifes = 0;
if (_local1 > stat.loscorevalue) {
score = _local1;
stat.update();
stat.submitHiscore();
}
}
function kill() {
lifes--;
mrkr.death();
thefuse.clear();
thefuse = null;
ambientsnd.stop();
deadsnd.start();
mode = "dead";
if (lifes == 0) {
if (!soundflag) {
stat.gameOver();
}
} else if (!soundflag) {
stat.message(lifes + " LIFES LEFT\n\n\n\nPRESS SPACE TO CONTINUE");
}
return(undefined);
}
function marker(depth) {
_root.createEmptyMovieClip("marker" + depth, depth);
this.m = eval ("marker" + depth);
this.m.lineStyle(linewidth * 1.5, red, 100);
this.m.moveTo(markersize, 0);
this.m.lineTo(0, markersize);
this.m.lineTo(-markersize, 0);
this.m.lineTo(0, -markersize);
this.m.lineTo(markersize, 0);
this.m.lineStyle(linewidth, white, 100);
this.m.moveTo(0, -1);
this.m.lineTo(0, 1);
this.m._alpha = 0;
this.move(left + (width / 2), top + height);
}
function status(depth) {
_root.createEmptyMovieClip("status" + depth, depth);
this.m = eval ("status" + depth);
this.m.createTextField("message", 0, left, top + (height / 8), width, (height * 7) / 8);
this.m.message.embedFonts = true;
this.m.message.multiline = true;
this.m.message.wordWrap = true;
this.m.message.border = false;
this.m.message.selectable = false;
this.m.createTextField("header", 1, left, top + (height / 10), width, height * 0.9);
this.m.header.embedFonts = true;
this.m.header.multiline = true;
this.m.header.wordWrap = true;
this.m.header.border = false;
this.m.header.selectable = false;
this.m.createTextField("claim", 3, left, 25, width, top);
this.m.claim.embedFonts = true;
this.m.claim.multiline = true;
this.m.claim.wordWrap = true;
this.m.claim.border = false;
this.m.claim.selectable = false;
this.m.createTextField("hiscore", 4, left, 7, width, top);
this.m.hiscore.embedFonts = true;
this.m.hiscore.multiline = true;
this.m.hiscore.wordWrap = true;
this.m.hiscore.border = false;
this.m.hiscore.border = false;
this.m.hiscore.selectable = false;
this.m.createTextField("scored", 7, left, 8, width - 18, top);
this.m.scored.embedFonts = true;
this.m.scored.multiline = true;
this.m.scored.wordWrap = true;
this.m.scored.border = false;
this.m.scored.border = false;
this.m.scored.selectable = false;
whiteformat.align = "center";
whiteformat.size = 16;
this.m.createTextField("initials", 2, (left + (width / 2)) - 27, bottom - (height / 4), 54, 18);
this.m.initials.variable = "theinitials";
this.m.initials.type = "input";
this.m.initials.embedFonts = true;
this.m.initials.multiline = false;
this.m.initials.wordWrap = false;
this.m.initials.border = true;
this.m.initials.borderColor = white;
this.m.initials.maxChars = 3;
this.m.initials.restrict = "A-Z0-9";
this.m.initials.selectable = true;
this.m.initials.setNewTextFormat(whiteformat);
this.m.initials.text = "";
this.m.initials._visible = false;
this.m.theinitials = "";
this.loadHighscores();
}
function timeline(depth) {
_root.createEmptyMovieClip("timeline" + depth, depth);
this.m = eval ("timeline" + depth);
this.n = 0;
this.t = 1110;
this.l = 0;
this.update();
supersparx = false;
}
function fuse(depth) {
_root.createEmptyMovieClip("fuse" + depth, depth);
this.m = eval ("fuse" + depth);
this.m.attachMovie("fuse", "fs", 0);
this.m.fs._alpha = 0;
this.m.fs._x = line[0][0];
this.m.fs._y = line[0][1];
this.dx = 0;
this.dy = 0;
this.active = false;
this.point = 0;
this.counter = 0;
}
function sparx(depth, dir) {
_root.createEmptyMovieClip("sparx" + depth, depth);
this.m = eval ("sparx" + depth);
if (supersparx) {
this.m.attachMovie("supersparx", "sp" + depth, 0);
} else {
this.m.attachMovie("sparx", "sp" + depth, 0);
}
this.direction = dir;
this.depth = depth;
this.m._x = left + (width / 2);
this.m._y = top;
this.checkf = true;
if (dir == 1) {
this.dx = speed;
this.nextpoint = 2;
this.path = [[left, bottom], [right, bottom], [right, top], [left, top]];
} else {
this.dx = -speed;
this.nextpoint = 0;
this.path = [[left, top], [right, top], [right, bottom], [left, bottom]];
}
this.nextsuperpoint = "";
this.dy = 0;
}
function qix(depth) {
_root.createEmptyMovieClip("qix" + depth, depth);
this.m = eval ("qix" + depth);
this.previous = new Array(4);
this.next = new Array(4);
this.delta = new Array(4);
this.current = Array(5);
this.lines = new Array();
this.col = blue;
this.step = 0;
this.n = 10;
this.l = 0;
with (this) {
previous[0] = left + (Math.random() * width);
previous[1] = top + (Math.random() * height);
do {
foo = ((Math.random() * 2)-1);
l = (Math.random() * 60) + 20;
previous[2] = previous[0] + (foo * l);
if (Math.random() > 0.5) {
previous[3] = previous[1] + (Math.sqrt(1 - (foo * foo)) * 30);
} else {
previous[3] = previous[1] - (Math.sqrt(1 - (foo * foo)) * 30);
}
} while (!free.hitTest(previous[2], previous[3], true));
selectTarget();
}
}
function splitPolygon(p, l, slow) {
var _local6 = (l.length-1);
if ((l[0][0] == l[_local6][0]) && (l[0][1] == l[_local6][1])) {
if ((((l[1][0] - l[0][0]) * (l[_local6][1] - l[(_local6-1)][1])) - ((l[1][1] - l[0][1]) * (l[_local6][0] - l[(_local6-1)][0]))) > 0) {
l.reverse();
}
}
var _local4 = 0;
while (_local4 < p.length) {
var _local5 = (_local4+1) % p.length;
if ((p[_local4][0] == p[_local5][0]) && (p[_local4][0] == l[0][0])) {
if ((Math.min(p[_local4][1], p[_local5][1]) <= l[0][1]) && (Math.max(p[_local4][1], p[_local5][1]) >= l[0][1])) {
s = (_local4+1);
break;
}
}
if ((p[_local4][1] == p[_local5][1]) && (p[_local4][1] == l[0][1])) {
if ((Math.min(p[_local4][0], p[_local5][0]) <= l[0][0]) && (Math.max(p[_local4][0], p[_local5][0]) >= l[0][0])) {
s = (_local4+1);
break;
}
}
_local4++;
}
p.splice(s, 0, l[0]);
_local4 = 0;
while (_local4 < p.length) {
var _local5 = (_local4+1) % p.length;
if ((p[_local4][0] == p[_local5][0]) && (p[_local4][0] == l[_local6][0])) {
if ((Math.min(p[_local4][1], p[_local5][1]) <= l[_local6][1]) && (Math.max(p[_local4][1], p[_local5][1]) >= l[_local6][1])) {
e = (_local4+1);
break;
}
}
if ((p[_local4][1] == p[_local5][1]) && (p[_local4][1] == l[_local6][1])) {
if ((Math.min(p[_local4][0], p[_local5][0]) <= l[_local6][0]) && (Math.max(p[_local4][0], p[_local5][0]) >= l[_local6][0])) {
e = (_local4+1);
break;
}
}
_local4++;
}
p.splice(e, 0, l[_local6]);
if (e <= s) {
s++;
var _local7 = p.slice(0, e);
_local4 = (l.length-1);
while (_local4 >= 0) {
_local7.push(l[_local4]);
_local4--;
}
_local4 = (s+1);
while (_local4 < p.length) {
_local7.push(p[_local4]);
_local4++;
}
var _local8 = l;
_local4 = e;
while (_local4 < s) {
_local8.push(p[_local4]);
_local4++;
}
} else {
var _local7 = p.slice(0, s);
_local4 = 0;
while (_local4 < l.length) {
_local7.push(l[_local4]);
_local4++;
}
_local4 = (e+1);
while (_local4 < p.length) {
_local7.push(p[_local4]);
_local4++;
}
var _local8 = l;
_local4 = e;
while (_local4 > s) {
_local8.push(p[_local4]);
_local4--;
}
_local8.reverse();
}
free.clear();
free.beginFill(0, 100);
drawPolygon(_local7, free);
free.endFill();
if (free.hitTest(qix1.current[0], qix1.current[1], true)) {
f = _local7;
r = _local8;
var _local10 = true;
} else {
f = _local8;
r = _local7;
var _local10 = false;
}
if (level > 2) {
if (free.hitTest(qix2.current[0], qix2.current[1], true)) {
if (!_local10) {
return(splitQix());
}
} else if (_local10) {
return(splitQix());
}
}
free.clear();
_local4 = (f.length-1);
while (_local4 > 0) {
if ((f[_local4][0] == f[(_local4+1)][0]) && (f[_local4][1] == f[(_local4+1)][1])) {
f.splice((_local4+1), 1);
}
_local4--;
}
if ((f[0][0] == f[(f.length-1)][0]) && (f[0][1] == f[(f.length-1)][1])) {
f.shift();
}
f_ccw = f.slice(0);
f_ccw.reverse();
frame.clear();
frame.lineStyle(linewidth, 16777215, 100);
drawPolygon(f, frame);
free.clear();
free.beginFill(0, 100);
drawPolygon(f, free);
free.endFill();
occupied.lineStyle(linewidth, 16777215, 100);
if (slow) {
score = score + (multiplier * Math.round((polygonArea(r) - lineArea(l)) * 20000));
occupied.beginFill(slowcolor);
var _local9 = slowsnd;
} else {
score = score + (multiplier * Math.round((polygonArea(r) - lineArea(l)) * 10000));
occupied.beginFill(fastcolor);
var _local9 = fastsnd;
}
if (soundflag) {
mode = "sound";
} else {
mode = "move";
}
drawPolygon(r, occupied);
occupied.endFill();
percentage = 100 - Math.round(100 * polygonArea(f));
stat.update();
_local4 = 0;
while (_local4 < spx.length) {
spx[_local4].checkf = true;
spx[_local4].nextsuperpoint = "";
_local4++;
}
slow = false;
_local9.start();
}
function checkThreshold() {
if (mode != "demo") {
if (percentage >= threshold) {
ambientsnd.stop("ambient");
bonussnd.start();
bonussnd.bonus = true;
var _local1 = Math.round(percentage - threshold);
var _local2 = (multiplier * _local1) * 1000;
score = score + _local2;
if (_local2 == 0) {
_local2 = "NO BONUS";
}
if (_local1 < 10) {
_local1 = " " + _local1;
}
stat.message((((((("THRESHOLD: " + threshold) + "\nPERCENTAGE: ") + percentage) + "\n BONUS: ") + _local1) + " * 1000\n\n") + _local2);
mode = "sound";
initLevel();
} else {
mode = "move";
}
}
}
function splitQix() {
ambientsnd.stop("ambient");
bonussnd.start();
bonussnd.bonus = true;
multiplier++;
stat.message(("split qix\n\nall scores now\n" + multiplier) + "*\noriginal value");
mode = "sound";
initLevel();
}
function hitPoint(l, p, open) {
var _local14 = p.length;
if (open) {
_local14--;
}
if (_local14 == 0) {
return(null);
}
if (l[0] == l[2]) {
l[2] = l[2] + 0.01;
}
if (l[1] == l[3]) {
l[3] = l[3] + 0.01;
}
var _local4 = (l[3] - l[1]) / (l[2] - l[0]);
var _local6 = l[1] - (_local4 * l[0]);
var _local5 = 1 / _local4;
var _local7 = l[0] - (_local5 * l[1]);
var _local8 = Math.min(l[0], l[2]);
var _local9 = Math.max(l[0], l[2]);
var _local10 = Math.min(l[1], l[3]);
var _local11 = Math.max(l[1], l[3]);
var _local12 = 0;
while (_local12 < _local14) {
var _local13 = (_local12+1) % p.length;
if (p[_local12][0] == p[_local13][0]) {
y = (_local4 * p[_local12][0]) + _local6;
if ((y >= _local10) && (y <= _local11)) {
if ((y <= Math.max(p[_local12][1], p[_local13][1])) && (y >= Math.min(p[_local12][1], p[_local13][1]))) {
return([p[_local12][0], y]);
}
}
} else {
x = (_local5 * p[_local12][1]) + _local7;
if ((x >= _local8) && (x <= _local9)) {
if ((x <= Math.max(p[_local12][0], p[_local13][0])) && (x >= Math.min(p[_local12][0], p[_local13][0]))) {
return([x, p[_local12][1]]);
}
}
}
_local12++;
}
return(null);
}
function drawPolygon(p, m) {
m.moveTo(p[(p.length-1)][0], p[(p.length-1)][1]);
i = 0;
while (i < p.length) {
m.lineTo(p[i][0], p[i][1]);
i++;
}
}
function lineArea(l) {
var _local2 = 0;
i = 0;
while (i < (l.length-1)) {
_local2 = _local2 + Math.abs(((l[i][0] - l[(i+1)][0]) + l[i][1]) - l[(i+1)][1]);
i++;
}
return((linewidth * val) / (height * width));
}
function polygonArea(p) {
var _local2 = 0;
i = 0;
while (i < p.length) {
j = (i+1) % p.length;
_local2 = _local2 + (p[i][0] * p[j][1]);
_local2 = _local2 - (p[i][1] * p[j][0]);
i++;
}
_local2 = _local2 / 2;
if (_local2 < 0) {
_local2 = -_local2;
}
return(_local2 / (height * width));
}
function doDemo() {
cnt++;
if (cnt == 1) {
init();
initGame();
initLevel();
lifes = 0;
} else if (cnt == 2) {
mrkr.birth();
stix.lineStyle(linewidth, fastcolor, 100);
stix.moveTo(mrkr.m._x, mrkr.m._y);
stat.message("COPYRIGHT 1981 BY\nTAITO AMERICA CORP");
} else if (cnt == 70) {
stat.message("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nyour marker\n\ncontrolled with\narrow keys");
} else if (cnt < 100) {
} else if (cnt == 130) {
stat.message("\n\n\n\n\n\n\n\n\nto draw stix\n\npress fast [z]\nor slow [x]");
} else if (cnt < 135) {
mrkr.move(mrkr.m._x - speed, mrkr.m._y);
stix.moveTo(mrkr.m._x, mrkr.m._y);
} else if (cnt < 155) {
mrkr.move(mrkr.m._x, mrkr.m._y - speed);
stix.lineTo(mrkr.m._x, mrkr.m._y);
} else if (cnt < 183) {
mrkr.move(mrkr.m._x + speed, mrkr.m._y);
stix.lineTo(mrkr.m._x, mrkr.m._y);
} else if (cnt < 213) {
stat.message("\n\n\n\n\n\n\n\n\nto draw stix\n\npress fast [z]\nor slow [x]\n\n\n\n\nstix ");
} else if (cnt < 233) {
mrkr.move(mrkr.m._x, mrkr.m._y + speed);
stix.lineTo(mrkr.m._x, mrkr.m._y);
} else if (cnt == 233) {
occupied.beginFill(fastcolor);
occupied.lineStyle(linewidth, white, 100);
fastsnd.start();
stix.clear();
drawPolygon([[mrkr.m._x, mrkr.m._y], [mrkr.m._x - (speed * 28), mrkr.m._y], [mrkr.m._x - (speed * 28), mrkr.m._y - (speed * 20)], [mrkr.m._x, mrkr.m._y - (speed * 20)]], occupied);
stix.lineStyle(linewidth, slowcolor, 100);
stat.message("\n\n\n\n\n\n\n\n\n\n\nclaim areas\nby joining walls\nwith stix");
} else if (cnt < 255) {
} else if (cnt < 265) {
mrkr.move(mrkr.m._x + speed, mrkr.m._y);
stix.moveTo(mrkr.m._x, mrkr.m._y);
} else if (cnt < 305) {
mrkr.move(mrkr.m._x, mrkr.m._y - (speed / 2));
stix.lineTo(mrkr.m._x, mrkr.m._y);
} else if (cnt < 361) {
mrkr.move(mrkr.m._x + (speed / 2), mrkr.m._y);
stix.lineTo(mrkr.m._x, mrkr.m._y);
} else if (cnt < 401) {
mrkr.move(mrkr.m._x, mrkr.m._y + (speed / 2));
stix.lineTo(mrkr.m._x, mrkr.m._y);
} else if (cnt == 401) {
occupied.beginFill(slowcolor);
occupied.lineStyle(linewidth, white, 100);
slowsnd.start();
stix.clear();
drawPolygon([[mrkr.m._x, mrkr.m._y], [mrkr.m._x - (speed * 28), mrkr.m._y], [mrkr.m._x - (speed * 28), mrkr.m._y - (speed * 20)], [mrkr.m._x, mrkr.m._y - (speed * 20)]], occupied);
stix.lineStyle(linewidth, slowcolor, 100);
stat.message("\n\n\n\n\n\n\n\n\n\n\n\nscores based on area\n\n\n\nfast score slow score\n250 500");
} else if (cnt < 480) {
} else if (cnt == 480) {
stat.message("\n\n\n\n\n\n\n\n\n\nclaim more than\n75% of playfield\nfor special bonus");
} else if (cnt < 550) {
} else if (cnt == 550) {
stat.message("your enemies ");
} else if (cnt < 560) {
} else if (cnt == 560) {
qix1 = new qix(5);
qix1.previous = [right - 100, bottom - 150, right - 180, bottom - 180];
qix1.next = [right - 200, bottom - 250, right - 80, bottom - 240];
i = 0;
while (i < 4) {
qix1.delta[i] = (qix1.next[i] - qix1.previous[i]) / 8;
i++;
}
} else if (cnt < 568) {
qix1.move();
} else if (cnt == 568) {
stat.message("your enemies \n\n\n\n\n\n\n\n\n\n the qix");
spx[0] = new sparx(11, -1);
spx[1] = new sparx(12, 1);
} else if (cnt < 647) {
spx[0].move();
spx[1].move();
} else if (cnt == 647) {
stat.message("your enemies \n\n <sparx>\n\n\n\n\n\n\n\n the qix");
mrkr.move(mrkr.m._x, mrkr.m._y - (20 * speed));
stix.moveTo(mrkr.m._x, mrkr.m._y);
stix.lineStyle(linewidth, fastcolor, 100);
line = Array();
line[0] = [mrkr.m._x, mrkr.m._y];
} else if (cnt < 653) {
mrkr.move(mrkr.m._x, mrkr.m._y - speed);
stix.lineTo(mrkr.m._x, mrkr.m._y);
line[1] = [mrkr.m._x, mrkr.m._y];
} else if (cnt < 695) {
mrkr.move(mrkr.m._x - speed, mrkr.m._y);
stix.lineTo(mrkr.m._x, mrkr.m._y);
line[2] = [mrkr.m._x, mrkr.m._y];
} else if (cnt == 695) {
thefuse = new fuse(9);
} else if (cnt < 767) {
if (cnt == 700) {
stat.message("your enemies \n\n <sparx>\n\n\n\n\n\n\n\n the qix\n\n\n\n\n\n the fuse");
}
thefuse.move();
mode = "demo";
} else if (cnt == 857) {
initLevel();
stat.showHiscores();
} else if (cnt == 1000) {
cnt = 0;
}
}
_quality = "LOW";
this.createEmptyMovieClip("time", 0);
this.createEmptyMovieClip("free", 1);
this.createEmptyMovieClip("occupied", 2);
this.createEmptyMovieClip("stix", 3);
this.createEmptyMovieClip("frame", 4);
soundflag = true;
if (soundflag) {
slowsnd = new Sound();
slowsnd.attachSound("slow");
slowsnd.setVolume(50);
fastsnd = new Sound();
fastsnd.attachSound("fast");
fastsnd.setVolume(50);
ambientsnd = new Sound();
ambientsnd.attachSound("ambient");
ambientsnd.setVolume(50);
spawnsnd = new Sound();
spawnsnd.attachSound("spawn");
spawnsnd.setVolume(50);
deadsnd = new Sound();
deadsnd.attachSound("dead");
deadsnd.setVolume(50);
fusesnd = new Sound();
fusesnd.attachSound("fusesound");
fusesnd.setVolume(50);
supersparxsnd = new Sound();
supersparxsnd.attachSound("startsupersparx");
supersparxsnd.setVolume(50);
bonussnd = new Sound();
bonussnd.attachSound("bonus");
bonussnd.setVolume(50);
spawnsnd.onSoundComplete = function () {
mode = "move";
ambientsnd.start(0, 1000);
};
fastsnd.onSoundComplete = checkThreshold;
slowsnd.onSoundComplete = checkThreshold;
deadsnd.onSoundComplete = function () {
if (lifes > 0) {
resume();
} else {
stat.gameOver();
}
};
bonussnd.onSoundComplete = function () {
if ((level > 2) && (this.bonus)) {
bonussnd.start();
bonussnd.bonus = false;
stat.message("points multiply\nif stix splits\n2 qix");
} else {
stat.clear();
start();
}
};
}
left = 16;
top = 60;
width = 448;
height = 400;
right = left + width;
bottom = top + height;
linewidth = 2;
speed = 4;
markersize = 6;
threshold = 75;
slowcolor = 9511954 /* 0x912412 */;
fastcolor = 32639;
yellow = 16777033 /* 0xFFFF49 */;
green = 4849481 /* 0x49FF49 */;
blue = 4803071 /* 0x4949FF */;
red = 16730441 /* 0xFF4949 */;
white = 16777215 /* 0xFFFFFF */;
gray = 4802889 /* 0x494949 */;
yellowformat = new TextFormat();
yellowformat.color = yellow;
yellowformat.font = "QixSmall";
yellowformat.size = 16;
yellowformat.leading = 4;
yellowformat.align = "center";
whiteformat = new TextFormat();
whiteformat.color = 16777215 /* 0xFFFFFF */;
whiteformat.font = "QixBig";
whiteformat.size = 18;
whiteformat.leading = 6;
whiteformat.align = "right";
spx = Array();
lifes = 0;
cnt = 0;
mode = "demo";
this.onEnterFrame = function () {
if (mode == "loading") {
} else if (mode == "gameover") {
cnt++;
if (cnt > 60) {
end();
}
} else if (mode == "demo") {
doDemo();
if (Key.isDown(32)) {
lifes = 0;
stat.clear();
initGame();
initLevel();
start();
}
} else if (mode == "dead") {
if (Key.isDown(32) && (lifes == 0)) {
if (lifes == 0) {
stat.clear();
initGame();
initLevel();
start();
} else {
resume();
}
}
} else if (mode == "intro") {
qix1.move();
if (level > 2) {
qix2.move();
}
} else if (mode != "sound") {
qix1.move();
if (level > 2) {
qix2.move();
}
i = 0;
while (i < spx.length) {
spx[i].move();
i++;
}
if (mode == "dead") {
return(undefined);
}
with (mrkr.m) {
dx = 0;
dy = 0;
if (Key.isDown(39)) {
dx = speed;
newdir = "r";
} else if (Key.isDown(37)) {
dx = -speed;
newdir = "l;";
} else if (Key.isDown(38)) {
dy = -speed;
newdir = "u";
} else if (Key.isDown(40)) {
dy = speed;
newdir = "d";
}
halfwaytest = f.hitTest(_x + (dx / 2), _y + (dy / 2));
fulltest = f.hitTest(_x + dx, _y + dy);
if (((fulltest && (!halfwaytest)) && (Key.isDown(90) || Key.isDown(88))) && (mode == "move")) {
if (free.hitTest(_x + (dx / 2), _y + (dy / 2), true)) {
ix++;
line[ix] = [_x, _y];
dir = newdir;
_x = _x + dx;
_y = _y + dy;
stix.LineTo(_x, _y);
ix++;
line[ix] = [_x, _y];
splitPolygon(f, line, slow);
line = [[_x, _y]];
ix = 0;
dir = "";
stix.clear();
stix.moveTo(_x, _y);
stix.lineStyle(linewidth, fastcolor, 100);
}
} else if (fulltest && (halfwaytest || (mode == "cut"))) {
if (newdir != dir) {
ix++;
line[ix] = [_x, _y];
dir = newdir;
}
_x = _x + dx;
_y = _y + dy;
stix.LineTo(_x, _y);
ix++;
line[ix] = [_x, _y];
if (mode == "cut") {
if (thefuse != null) {
thefuse.clear();
thefuse = null;
}
splitPolygon(f, line, slow);
}
line = [[_x, _y]];
ix = 0;
dir = "";
stix.clear();
stix.moveTo(_x, _y);
stix.lineStyle(linewidth, fastcolor, 100);
} else if (((!line.hitTest(_x + dx, _y + dy, true)) && free.hitTest(_x + dx, _y + dy, true)) && (Key.isDown(90) || Key.isDown(88))) {
if (Key.isDown(88)) {
if (mode == "move") {
slow = true;
stix.lineStyle(linewidth, slowcolor, 100);
}
} else if (slow) {
stix.lineStyle(linewidth, fastcolor, 100);
stix.moveTo(line[0][0], line[0][1]);
i = 1;
while (i < line.length) {
stix.lineTo(line[i][0], line[i][1]);
i++;
}
stix.lineTo(_x, _y);
slow = false;
}
if (odd) {
odd = false;
if (slow) {
return(undefined);
}
} else {
odd = true;
}
if (dir == "") {
dir = newdir;
}
if (newdir != dir) {
if ((line[ix][0] != _x) || (line[ix][1] != _y)) {
ix++;
line[ix] = [_x, _y];
dir = newdir;
}
}
if (mode == "move") {
thefuse = new fuse(9);
}
mode = "cut";
_x = _x + dx;
_y = _y + dy;
line[(ix+1)] = [_x, _y];
stix.LineTo(_x, _y);
thefuse.pause();
} else if (mode == "cut") {
thefuse.move();
}
}
tl.update();
}
};
marker.prototype.birth = function () {
mrkr.m._alpha = 100;
this.m.attachMovie("birth", "birth1", 1);
};
marker.prototype.death = function () {
this.m.attachMovie("death", "death1", 1);
};
marker.prototype.move = function (x, y) {
this.m._x = x;
this.m._y = y;
};
status.prototype = new XML();
status.prototype.clear = function () {
this.m.message.text = "";
this.m.header.text = "";
this.m.clear();
};
status.prototype.update = function () {
var i;
var x;
var y;
with (this.m) {
if ((((mode != "move") && (mode != "cut")) && (mode != "sound")) && (mode != "intro")) {
claim.text = "CREDITS\n99";
} else if (percentage < 10) {
claim.text = ((("CLAIMED\n0" + percentage) + "% ") + threshold) + "%";
} else {
claim.text = ((("CLAIMED\n" + percentage) + "% ") + threshold) + "%";
}
claim.setTextFormat(yellowformat);
if (score < 10) {
scored.text = "0" + score;
} else {
scored.text = score;
}
whiteformat.align = "right";
whiteformat.size = 18;
scored.setTextFormat(whiteformat);
i = 1;
while (i < 4) {
x = right - (linewidth * 4);
y = (top - (12 * linewidth)) - ((linewidth * 4) * i);
if (i == lifes) {
lineStyle(linewidth, white, 100);
} else {
lineStyle(linewidth, red, 100);
}
this.m.moveTo(x + (linewidth * 1.5), y);
this.m.lineTo(x, y + (linewidth * 1.5));
this.m.lineTo(x - (linewidth * 1.5), y);
this.m.lineTo(x, y - (linewidth * 1.5));
this.m.lineTo(x + (linewidth * 1.5), y);
i++;
}
}
};
status.prototype.showHiscores = function () {
this.clear();
whiteformat.align = "center";
whiteformat.size = 16;
this.m.header.setTextFormat(whiteformat);
this.message("CLICK GAME THEN press spacebar to start");
};
status.prototype.gameOver = function () {
with (this.m) {
header.text = "\n\n\nGAME OVER";
whiteformat.align = "center";
whiteformat.size = 16;
header.setTextFormat(whiteformat);
beginFill(0, 100);
lineStyle(linewidth, white, 100);
moveTo((left + (width / 2)) - 80, top + 95);
lineTo((left + (width / 2)) + 80, top + 95);
lineTo((left + (width / 2)) + 80, top + 124);
lineTo((left + (width / 2)) - 80, top + 124);
lineTo((left + (width / 2)) - 80, top + 95);
endFill();
mode = "gameover";
cnt = 0;
}
};
status.prototype.onKeyDown = function () {
if (Key.getCode() == 13) {
if (this.m.initials.text.length < 1) {
this.clear();
this.message("\n\n\n\nsubmitting high score");
Key.removeListener(this);
mode = "loading";
cnt = 856;
}
}
};
status.prototype.submitHiscore = function () {
mode = "loading";
this.m.clear();
this.m.header.text = "";
whiteformat.align = "center";
whiteformat.size = 16;
this.m.header.setTextFormat(whiteformat);
this.message("\n\n\n\nsubmitting score");
gscore = score;
gname = "qix";
getURL ("index.php?act=Arcade&do=newscore", "_self", "POST");
};
status.prototype.message = function (txt) {
with (this.m) {
message.text = txt.toUpperCase();
message.setTextFormat(yellowformat);
}
};
timeline.prototype.update = function () {
var sec;
with (this) {
sec = Math.ceil(t / 30);
if ((sec >= 0) && (l != (sec * 6))) {
l = sec * 6;
m.clear();
m.lineStyle(linewidth, red, 100);
m.moveTo((left + (width / 2)) - l, top - 4);
m.lineTo((left + (width / 2)) + l, top - 4);
if (sec == 0) {
if (n == 1) {
supersparxsnd.start(0, 15);
i = 0;
while (i < spx.length) {
spx[i].makeSuper();
i++;
}
supersparx = true;
} else {
spx.push(new sparx(11 + spx.length, 1));
spx.push(new sparx(11 + spx.length, -1));
}
}
} else if (sec == -1) {
t = 600;
n++;
}
t--;
}
};
fuse.prototype.clear = function () {
fusesnd.stop("fusesound");
this.m.removeMovieClip();
};
fuse.prototype.pause = function () {
if (this.active) {
this.m.fs._alpha = 0;
fusesnd.stop("fusesound");
this.active = false;
}
};
fuse.prototype.move = function () {
with (this) {
if (!active) {
fusesnd.start(0, 1000);
active = true;
}
counter++;
m.fs._alpha = 100;
if (counter > 20) {
if ((line[point][0] == m.fs._x) && (line[point][1] == m.fs._y)) {
point++;
if (line[point][0] == m.fs._x) {
if (line[point][1] != m.fs._y) {
if (line[point][1] > m.fs._y) {
dy = speed;
} else {
dy = -speed;
}
dx = 0;
}
} else {
if (line[point][0] > m.fs._x) {
dx = speed;
} else {
dx = -speed;
}
dy = 0;
}
}
m.lineStyle(linewidth, gray, 100);
m.moveTo(m.fs._x, m.fs._y);
m.fs._x = m.fs._x + dx;
m.fs._y = m.fs._y + dy;
m.lineTo(m.fs._x, m.fs._y);
if ((m.fs._x == mrkr.m._x) && (m.fs._y == mrkr.m._y)) {
return(kill());
}
}
}
};
sparx.prototype.clear = function () {
this.m.removeMovieClip();
};
sparx.prototype.makeSuper = function () {
this.m.attachMovie("supersparx", "sp" + this.depth, 0);
};
sparx.prototype.otherSide = function () {
var _local2 = 0;
if (this.direction == 1) {
g = f_ccw;
} else {
g = f;
}
var _local8 = line[0][0];
var _local9 = line[0][1];
var _local5 = 0;
while (_local5 < g.length) {
var _local6 = (_local5+1) % g.length;
if (g[_local5][0] == g[_local6][0]) {
_local2 = _local2 + Math.abs(g[_local5][1] - g[_local6][1]);
if (_local8 == g[_local5][0]) {
if ((_local9 <= Math.max(g[_local5][1], g[_local6][1])) && (_local9 >= Math.min(g[_local5][1], g[_local6][1]))) {
var _local3 = _local5;
var _local4 = Math.abs(g[_local5][1] - _local9);
}
}
} else {
_local2 = _local2 + Math.abs(g[_local5][0] - g[_local6][0]);
if (_local9 == g[_local5][1]) {
if ((_local8 <= Math.max(g[_local5][0], g[_local6][0])) && (_local8 >= Math.min(g[_local5][0], g[_local6][0]))) {
var _local3 = _local5;
var _local4 = Math.abs(g[_local5][0] - _local8);
}
}
}
_local5++;
}
_local2 = (_local2 / 2) + _local4;
var _local7 = _local3;
while (_local7 < (g.length + _local3)) {
_local5 = _local7 % g.length;
var _local6 = (_local7+1) % g.length;
_local2 = _local2 - Math.abs(((g[_local5][0] - g[_local6][0]) + g[_local5][1]) - g[_local6][1]);
if (_local2 <= 0) {
this.path = g.slice(0);
this.nextpoint = _local5;
if (g[_local5][0] == g[_local6][0]) {
this.m._x = g[_local5][0];
this.dx = 0;
if (g[_local5][1] > g[_local6][1]) {
this.dy = speed;
this.m._y = g[_local6][1] - _local2;
} else {
this.dy = -speed;
this.m._y = g[_local6][1] + _local2;
}
return(undefined);
}
this.m._y = g[_local5][1];
this.dy = 0;
if (g[_local5][0] > g[_local6][0]) {
this.dx = speed;
this.m._x = g[_local6][0] - _local2;
} else {
this.dx = -speed;
this.m._x = g[_local6][0] + _local2;
}
return(undefined);
}
_local7++;
}
};
sparx.prototype.move = function () {
var i;
var j;
var g;
with (this) {
if (direction == 1) {
g = f_ccw;
} else {
g = f;
}
if ((m._x == mrkr.m._x) && (m._y == mrkr.m._y)) {
return(kill());
}
m._x = m._x + dx;
m._y = m._y + dy;
if ((m._x == mrkr.m._x) && (m._y == mrkr.m._y)) {
return(kill());
}
if (supersparx && (mode == "cut")) {
if ((m._x == line[0][0]) && (m._y == line[0][1])) {
nextsuperpoint = 0;
}
}
if (nextsuperpoint != "") {
if ((line[nextsuperpoint][0] == m._x) && (line[nextsuperpoint][1] == m._y)) {
nextsuperpoint++;
if (line[nextsuperpoint][0] == m._x) {
if (line[nextsuperpoint][1] != m._y) {
if (line[nextsuperpoint][1] > m._y) {
dy = speed;
} else {
dy = -speed;
}
dx = 0;
return(undefined);
}
} else {
if (line[nextsuperpoint][0] > m._x) {
dx = speed;
} else {
dx = -speed;
}
dy = 0;
return(undefined);
}
}
}
if (checkf) {
i = 0;
while (i < g.length) {
if ((g[i][0] == m._x) && (g[i][1] == m._y)) {
j = ((i + g.length)-1) % g.length;
if (g[j][0] == g[i][0]) {
if (g[j][1] != g[i][1]) {
if (g[j][1] > g[i][1]) {
dy = speed;
} else {
dy = -speed;
}
path = g.slice(0);
nextpoint = j;
checkf = false;
dx = 0;
return(undefined);
}
} else {
if (g[j][0] > g[i][0]) {
dx = speed;
} else {
dx = -speed;
}
path = g.slice(0);
nextpoint = j;
checkf = false;
dy = 0;
return(undefined);
}
}
i++;
}
}
if ((((m._x < left) || (m._x > right)) || (m._y < top)) || (m._y > bottom)) {
otherSide();
}
if ((path[nextpoint][0] == m._x) && (path[nextpoint][1] == m._y)) {
nextpoint = ((nextpoint + path.length)-1) % path.length;
if (path[nextpoint][0] == m._x) {
if (path[nextpoint][1] != m._y) {
if (path[nextpoint][1] > m._y) {
dy = speed;
} else {
dy = -speed;
}
dx = 0;
return(undefined);
}
} else {
if (path[nextpoint][0] > m._x) {
dx = speed;
} else {
dx = -speed;
}
dy = 0;
return(undefined);
}
}
}
};
qix.prototype.selectTarget = function () {
var dx;
var dy;
var minlength;
var div;
with (this) {
div = 1.8;
this.step = 1;
do {
next[0] = Math.round(previous[0] + (((Math.random() - 0.5) * width) / div));
next[1] = Math.round(previous[1] + (((Math.random() - 0.5) * height) / div));
} while ((!free.hitTest(next[0], next[1], true)) || (f.hitTest(next[0], next[1])));
minlength = 50;
do {
dx = ((Math.random() * 2)-1);
if (Math.random() > 0.5) {
dy = Math.sqrt(1 - (dx * dx));
} else {
dy = -Math.sqrt(1 - (dx * dx));
}
l = (Math.random() * 70) + minlength;
next[2] = next[0] + (dx * l);
next[3] = next[1] + (dy * l);
if (minlength > 25) {
minlength--;
}
} while (hitPoint(next, f) != null);
i = 0;
while (i < 4) {
delta[i] = (next[i] - previous[i]) / n;
i++;
}
}
};
qix.prototype.isValid = function (l) {
var i;
var d;
with (this) {
d = Math.max(Math.abs(delta[0]), Math.abs(delta[1])) / 2;
i = 1;
while (i < d) {
g = (step-1) + (i / d);
m.lineTo(previous[0] + (delta[0] * g), previous[1] + (delta[1] * g));
if (!free.hitTest(previous[0] + (delta[0] * g), previous[1] + (delta[1] * g), true)) {
return(false);
}
i = i + 2;
}
if (!free.hitTest(previous[0] + (delta[0] * step), previous[1] + (delta[1] * step), true)) {
return(false);
}
d = Math.max(Math.abs(delta[2]), Math.abs(delta[3])) / 2;
i = 1;
while (i < d) {
g = (step-1) + (i / d);
m.lineTo(previous[2] + (delta[2] * g), previous[3] + (delta[3] * g));
if (!free.hitTest(previous[2] + (delta[2] * g), previous[3] + (delta[3] * g), true)) {
return(false);
}
i = i + 2;
}
if (!free.hitTest(previous[2] + (delta[2] * step), previous[3] + (delta[3] * step), true)) {
return(false);
}
}
return(true);
};
qix.prototype.regenerate = function () {
with (this) {
previous = next.slice(0);
selectTarget();
lines = new Array();
}
};
qix.prototype.move = function () {
var i;
var hp;
with (this) {
if (mode == "cut") {
if (m.hitTest(mrkr.m._x, mrkr.m._y, true)) {
this.m.attachMovie("qix_hit", "hit", 0);
this.m.hit._x = mrkr.m._x;
this.m.hit._y = mrkr.m._y;
return(kill());
}
}
m.clear();
i = 0;
do {
if (isValid()) {
break;
}
i++;
previous = current.slice(0, 4);
selectTarget();
} while (i <= 10);
i = 0;
while (i < 4) {
current[i] = previous[i] + (step * delta[i]);
i++;
}
current[4] = col;
lines.push(current.slice(0));
if (lines.length > 7) {
lines.shift();
}
i = 0;
while (i < lines.length) {
m.lineStyle(linewidth, lines[i][4], 100);
m.moveTo(lines[i][0], lines[i][1]);
m.lineTo(lines[i][2], lines[i][3]);
i++;
}
step++;
if (step == n) {
previous = next.slice(0);
selectTarget();
}
if (Math.random() < 0.15) {
foo = Math.random();
if (foo < 0.33) {
col = blue;
} else if (foo < 0.66) {
col = red;
} else {
col = green;
}
}
hp = hitPoint(current, line, true);
if (hp != null) {
this.m.attachMovie("qix_hit", "hit", 0);
this.m.hit._x = hp[0];
this.m.hit._y = hp[1];
return(kill());
}
}
};
Array.prototype.hitTest = function (x, y, open) {
var _local7 = this.length;
if (open) {
_local7--;
}
if (_local7 == 0) {
return(null);
}
var _local5 = 0;
while (_local5 < _local7) {
var _local6 = (_local5+1) % this.length;
if (this[_local5][0] == this[_local6][0]) {
if (x == this[_local5][0]) {
if ((y <= Math.max(this[_local5][1], this[_local6][1])) && (y >= Math.min(this[_local5][1], this[_local6][1]))) {
return(true);
}
}
} else if (y == this[_local5][1]) {
if ((x <= Math.max(this[_local5][0], this[_local6][0])) && (x >= Math.min(this[_local5][0], this[_local6][0]))) {
return(true);
}
}
_local5++;
}
return(false);
};
Symbol 33 MovieClip Frame 40
stop();
Symbol 42 MovieClip [qix_hit] Frame 15
stop();
Symbol 44 MovieClip Frame 50
stop();