Frame 1
stop();
bombNum = 0;
lives = 3;
score = 0;
speed = 10;
_global.initAliens = function (mc) {
var _local3 = mc;
depth = 0;
var _local2 = 0;
while (_local2 < 3) {
var _local1 = 0;
while (_local1 < 10) {
attachMovie(_local3, ((_local3 + _local2) + "_") + _local1, 100 + depth);
_root[((_local3 + _local2) + "_") + _local1]._x = _local1 * 40;
_root[((_local3 + _local2) + "_") + _local1]._y = (_local2 * 40) - 80;
depth++;
_local1++;
}
_local2++;
}
};
_global.moveAliens = function (mc, frame, alspeed) {
_root.deadcount = 0;
var i = 0;
while (i < 3) {
var j = 0;
while (j < 10) {
_root[((mc + i) + "_") + j]._x = _root[((mc + i) + "_") + j]._x + speed;
if (_root[((mc + i) + "_") + j].hitTest(_root.defender)) {
cleanup(mc);
_root.gotoAndStop(8);
}
if (_root[((mc + i) + "_") + j] != null) {
_root.deadcount++;
}
bulleti = 6;
while ((--bulleti) > 0) {
if (_root[((mc + i) + "_") + j].hittest(eval ("_root.bullet" + bulleti))) {
_root[((mc + i) + "_") + j].removeMovieClip();
eval ("_root.bullet" + bulleti).removeMovieClip();
_root.score = _root.score + 1;
}
}
if (_root[((mc + i) + "_") + j]._x < 0) {
speed = alspeed;
dropdown = true;
break;
}
if (_root[((mc + i) + "_") + j]._x > Stage.width) {
speed = -alspeed;
dropdown = true;
break;
}
j++;
}
i++;
}
if (dropdown) {
var i = 0;
while (i < 3) {
var j = 0;
while (j < 10) {
_root[((mc + i) + "_") + j]._y = _root[((mc + i) + "_") + j]._y + 20;
j++;
}
i++;
}
}
dropdown = false;
if (_root.deadcount == 0) {
_root.bombspeed = 0;
_root.gotoAndStop(frame);
}
};
_global.initBombs = function (bombspeed) {
if (Math.random() < bombspeed) {
attachMovie("bomb", "bomb" + bombNum, 200 + bombNum);
eval ("_root.bomb" + bombNum)._x = random(700);
eval ("_root.bomb" + bombNum)._y = 300 * Math.random();
bombNum++;
if (bombNum > 10) {
bombNum = 0;
}
}
};
_global.moveBombs = function (mc) {
var _local2 = _root;
var bombi = 0;
while (bombi < 11) {
_local2["bomb" + bombi]._y = _local2["bomb" + bombi]._y + 5;
if (_local2["bomb" + bombi].hittest(_local2.defender)) {
_local2["bomb" + bombi].removeMovieClip();
_local2.lives = _local2.lives - 1;
if (_local2.lives <= 0) {
Mouse.show();
_local2.bombspeed = 0;
_local2.gotoAndStop(8);
var _local3 = 0;
while (_local3 < 3) {
var _local1 = 0;
while (_local1 < 10) {
_local2[((mc + _local3) + "_") + _local1]._visible = false;
_local1++;
}
_local3++;
}
return;
}
}
if (_local2["bomb" + bombi]._y > Stage.height) {
_local2["bomb" + bombi].removeMovieClip();
}
bombi++;
}
};
_global.cleanup = function (mc) {
var _local3 = _root;
_local3.bombspeed = 0;
var _local2 = 0;
while (_local2 < 3) {
var _local1 = 0;
while (_local1 < 10) {
_local3[((mc + _local2) + "_") + _local1]._visible = false;
_local1++;
}
_local2++;
}
};
Stage.showMenu = false;
Frame 2
stop();
bulletNum = 0;
dropdown = false;
speed = 10;
_root.bombspeed = 0.1;
initAliens("alien");
_root.onLoad = function () {
Mouse.hide();
};
_root.onEnterFrame = function () {
_root.defender._x = _root._xmouse;
_root.defender._y = 385;
var y = 0;
while (y < 6) {
eval ("_root.bullet" + y)._y = eval ("_root.bullet" + y)._y - 30;
y++;
}
moveBombs("alien");
moveAliens("alien", 3, 10);
initBombs(_root.bombspeed);
};
_root.onMouseDown = function () {
attachMovie("bullet", "bullet" + bulletNum, bulletNum);
eval ("_root.bullet" + bulletNum)._x = _root.defender._x;
eval ("_root.bullet" + bulletNum)._y = _root.defender._y;
bulletNum++;
if (bulletNum > 5) {
bulletNum = 0;
}
};
Frame 3
stop();
bulletNum = 0;
dropdown = false;
speed = 15;
_root.bombspeed = 0.1;
initAliens("bug");
_root.onLoad = function () {
Mouse.hide();
};
_root.onEnterFrame = function () {
_root.defender._x = _root._xmouse;
_root.defender._y = 385;
var y = 0;
while (y < 6) {
eval ("_root.bullet" + y)._y = eval ("_root.bullet" + y)._y - 30;
y++;
}
moveBombs("bug");
moveAliens("bug", 4, 15);
initBombs(_root.bombspeed);
};
_root.onMouseDown = function () {
attachMovie("bullet", "bullet" + bulletNum, bulletNum);
eval ("_root.bullet" + bulletNum)._x = _root.defender._x;
eval ("_root.bullet" + bulletNum)._y = _root.defender._y;
bulletNum++;
if (bulletNum > 5) {
bulletNum = 0;
}
};
Frame 4
stop();
stop();
bulletNum = 0;
dropdown = false;
speed = 20;
_root.bombspeed = 0.1;
initAliens("skull");
_root.onLoad = function () {
Mouse.hide();
};
_root.onEnterFrame = function () {
_root.defender._x = _root._xmouse;
_root.defender._y = 385;
var y = 0;
while (y < 6) {
eval ("_root.bullet" + y)._y = eval ("_root.bullet" + y)._y - 30;
y++;
}
moveBombs("skull");
moveAliens("skull", 5, 20);
initBombs(_root.bombspeed);
};
_root.onMouseDown = function () {
attachMovie("bullet", "bullet" + bulletNum, bulletNum);
eval ("_root.bullet" + bulletNum)._x = _root.defender._x;
eval ("_root.bullet" + bulletNum)._y = _root.defender._y;
bulletNum++;
if (bulletNum > 5) {
bulletNum = 0;
}
};
Frame 5
stop();
Symbol 53 Button
on (release) {
getURL ("http://www.newgrounds.com", "_blank");
}
Symbol 62 Button
on (release) {
_root.gotoAndStop(6);
}
Symbol 64 MovieClip Frame 1
function timerHandler() {
var _local2 = this;
if (!loadingComplete) {
var _local3 = _root.getBytesLoaded() / _root.getBytesTotal();
bar._xscale = 100 * _local3;
if (_local3 == 1) {
loadingComplete = true;
if (AUTO_PLAY) {
startMovie();
} else {
gotoAndStop ("loaded");
}
return;
}
} else {
dt = getTimer() - time;
time = time + dt;
frameAccum = frameAccum + dt;
var _local1 = 0;
while ((frameAccum >= FRAME_TIME) && (_local1 < MAX_FRAME_SKIP)) {
advanceFrame(tankLogo, true, true);
advanceFrame(loadingText, false, true);
advanceFrame(barGfx, false, true);
if (loadingComplete) {
advanceFrame(_local2, false, false);
}
(frameAccum = frameAccum - FRAME_TIME);
_local1++;
}
updateAfterEvent();
}
}
function advanceFrame(clip, recurse, loop) {
var _local1 = clip;
var _local2 = loop;
var _local3 = recurse;
if (!_local1) {
} else {
_local1.stop();
if (_local1._currentframe == _local1._totalframes) {
if (_local2) {
_local1.gotoAndStop(1);
}
} else {
_local1.nextFrame();
}
if (_local3) {
for (childName in _local1) {
if (typeof(_local1[childName]) == "movieclip") {
advanceFrame(_local1[childName], _local3, _local2);
}
}
}
}
}
function startMovie() {
clearInterval(intervalId);
_root.play();
}
_root.stop();
stop();
var FRAME_TIME = 33.3333333333333;
var AUTO_PLAY = false;
var MAX_FRAME_SKIP = 5;
var loadingComplete;
var intervalId;
var time;
var frameAccum;
loadingComplete = false;
intervalId = setInterval(this, "timerHandler", FRAME_TIME / 2);
frameAccum = 0;
time = getTimer();
timerHandler();
Symbol 64 MovieClip Frame 2
stop();
Symbol 76 Button
on (release) {
_root.lives = 3;
_root.score = 0;
_root.gotoAndStop(2);
}
Symbol 82 Button
on (release) {
gotoAndStop (2);
}
Symbol 86 Button
on (release) {
nextFrame();
}
Symbol 91 Button
on (release) {
prevFrame();
}