Frame 1
checkloader = function () {
if (_root.getBytesLoaded() < _root.getBytesTotal()) {
_root.loadedtext.text = ("Loaded " + Math.floor((_root.getBytesLoaded() / _root.getBytesTotal()) * 100)) + "%";
_root.preloadbar._width = Math.floor((_root.getBytesLoaded() / _root.getBytesTotal()) * 100);
_root.preloadbar._x = 225 + (_root.preloadbar._width / 2);
} else {
clearInterval(checkProgress);
_root.gotoAndStop("start");
}
};
checkProgress = setInterval(checkloader, 100);
stop();
Stage.showMenu = false;
Instance of Symbol 62 MovieClip [ship] "ship" in Frame 3
onClipEvent (keyDown) {
if ((_root.disableship == false) && (_root.gamepaused == false)) {
if ((Key.getCode() == 13) || (Key.getCode() == 17)) {
if (_root.disablefire == false) {
_root.fireBullet(_root.ship._y);
_root.disablekey();
}
}
if (Key.getCode() == 32) {
if (_root.bombs > 0) {
_root.smartbomb();
}
}
}
if (Key.getCode() == 80) {
if (_root.gamepaused == false) {
_root.pausegame();
} else {
_root.unpausegame();
}
}
}
Frame 5
_root.smartoverlay._visible = false;
_root.endofwave._visible = false;
_root.startwavetext._visible = false;
_root.attachMovie("gameinterface", "gameborder", 1000);
_root.pausetext._visible = false;
startgame = function () {
_root.sfire = new Sound("shipfire");
_root.ssmart = new Sound("smartbomb");
_root.skillalien = new Sound("alienkill");
_root.sshipexplodenormal = new Sound("sexplodenormal");
_root.sshipexplodefinal = new Sound("sexplodefinal");
_root.totalBullets = 0;
_root.shipsafe = false;
_root.disableship = false;
_root.bombs = 2;
_root.lives = 3;
_root.score = 0;
_root.alienfrequency = 48;
_root.aliencounter = alienfrequency + Math.floor(Math.random() * alienfrequency);
_root.eventtimer = 0;
_root.weaponuptime = 1500;
_root.targettime = 1000;
_root.endwavetime = 1050;
_root.maxbullets = 20;
_root.currentweapon = 0;
_root.whichbulletclip = "bullet1";
_root.nextlifeup = 500;
_root.nextbombup = 1000;
_root.wave = 0;
_root.alienList = new Array(40);
_root.bulletList = new Array(40);
_root.alienBulletList = new Array(40);
_root.smarttimer = 0;
_root.targetdestroyed = false;
_root.maxaliens = 20;
_root.gamepaused = false;
_root.gameborder.gotoAndStop(2);
_root.disablefire = false;
shownewwave();
i = 0;
while (i < 40) {
alienList[i] = "";
i++;
}
i = 0;
while (i < 40) {
bulletList[i] = "";
i++;
}
i = 0;
while (i < 40) {
alienBulletList[i] = "";
i++;
}
_root.terrain1._x = 0;
_root.terrain2._x = 550;
_root.terrain1._y = 310;
_root.terrain2._y = 310;
_root.ship._y = 250;
_root.ship._x = 50;
_root.ship.gotoAndStop(1);
_root.gameborder.myscore.text = 0;
_root.gameborder.mybombs.text = 2;
_root.gameborder.mylives.text = 2;
_root.terrain1._visible = true;
_root.terrain2._visible = true;
_root.stars1._x = 0;
_root.stars2._x = 550;
_root.stars1._y = 0;
_root.stars2._y = 0;
_root.ship._visible = true;
_root.myscore._visible = true;
_root.mylives._visible = true;
_root.mybombs._visible = true;
_root.gameover._visible = false;
};
MovieClip.prototype.shipbullet = function (sx, ex, y, xs) {
this._x = sx;
this._y = y;
this.speed = s;
this.endx = ex;
this.removebullet = function () {
i = 0;
while (i < maxbullets) {
if (_root.bulletList[i] == this._name) {
_root.bulletList[i] = "";
removeMovieClip(this);
return;
}
i++;
}
};
this.onEnterFrame = function () {
if (_root.gamepaused == false) {
if (this._x > this.endx) {
this.removebullet();
}
this._x = this._x + xs;
i = 0;
while (i < maxaliens) {
if (this.hitTest(_root[alienList[i]]) && (_root[alienList[i]].ishit == false)) {
if (_root[alienList[i]].alientype != "weaponup") {
_root[alienList[i]].killAlien();
_root.addscore(_root[alienList[i]].alientype);
this.removebullet();
return;
}
}
i++;
}
}
};
};
fireBullet = function (ypos) {
i = 0;
while (i < _root.maxbullets) {
if (_root.bulletList[i] == "") {
thisName = "bullet" + i.toString();
_root.bulletList[i] = thisName;
_root.attachMovie(_root.whichbulletclip, thisName, i);
_root[thisName].shipbullet(_root.ship._x + 10, 550, ypos - 15, 10);
_root.playsound("sfire");
return;
}
i++;
}
};
MovieClip.prototype.alien = function (placeinlist, mytype) {
this._x = 580;
if ((mytype == "turret") || (mytype == "target")) {
this.speed = -10;
this._y = 355;
} else {
this.speed = -5;
this._y = Math.floor(Math.random() * 325) + 30;
}
this.alientype = mytype;
this.ishit = false;
this.removetimer = 48;
this.listslot = placeinlist;
this.myframe = 0;
if ((this.alientype == "buzzer") || (this.alientype == "turret")) {
this.firecounter = 1 + Math.floor(Math.random() * 48);
}
this.killAlien = function () {
if (this.ishit == false) {
if (_root[alienList[i]].alientype == "target") {
_root.targetdestroyed = true;
}
this.ishit = true;
if (this.alientype != "weaponup") {
playsound("skillalien");
}
this.gotoAndPlay(2);
}
};
this.removeAlien = function () {
_root.alienList[this.listslot] = "";
removeMovieClip(this);
};
this.onEnterFrame = function () {
if (_root.gamepaused == false) {
if (this.ishit == true) {
if (this.removetimer > 0) {
this.removetimer = this.removetimer - 1;
}
if (this.removetimer == 0) {
this.removeAlien();
}
}
if (this._x < -50) {
i = 0;
while (i < 20) {
if (_root.alienList[i] == this._name) {
_root.alienList[i] = "";
removeMovieClip(this);
break;
}
i++;
}
}
if ((this.ishit == false) || (this.alientype == "turret")) {
switch (this.alientype) {
case "drone" :
this._x = this._x + this.speed;
break;
case "buzzer" :
this._x = this._x + this.speed;
this._y = this._y + (5 * (Math.floor(Math.random() * 3) - 1));
if (this._y > 355) {
this._y = 355;
}
if (this._y <= 30) {
this._y = 30;
}
this.firecounter = this.firecounter - 1;
if (this.firecounter == 0) {
this.firecounter = -1;
firealienbullet(this._name, this._y);
}
break;
case "attacker" :
this._x = this._x + (2 * this.speed);
if ((this._y + 5) > _root.ship._y) {
this._y = this._y - (2 + Math.floor(Math.random() * 3));
}
if ((this._y - 5) < _root.ship._y) {
this._y = this._y + (2 + Math.floor(Math.random() * 3));
}
break;
case "turret" :
this._x = this._x + this.speed;
this.firecounter = this.firecounter - 1;
if (this.firecounter == 0) {
this.firecounter = -1;
firealienbullet(this._name, this._y - 40);
}
break;
case "weaponup" :
this._x = this._x + this.speed;
break;
case "target" :
this._x = this._x + this.speed;
}
}
if (this.hitTest(_root.ship) && (this.ishit == false)) {
if (_root.shipsafe == false) {
switch (this.alientype) {
case "drone" :
killship();
this.removeAlien();
break;
case "buzzer" :
killship();
this.removeAlien();
break;
case "attacker" :
killship();
this.removeAlien();
break;
case "turret" :
killship();
this.removeAlien();
break;
case "target" :
_root.targetdestroyed = true;
killship();
this.removealien();
}
}
if (this.alientype == "weaponup") {
doweaponup();
this.killalien();
}
}
}
};
};
newalien = function (aliennum) {
switch (aliennum) {
case 0 :
myalientype = "drone";
break;
case 1 :
myalientype = "buzzer";
break;
case 2 :
myalientype = "attacker";
break;
case 3 :
myalientype = "turret";
break;
case 5 :
myalientype = "weaponup";
break;
case 6 :
myalientype = "target";
}
i = 0;
while (i < _root.maxaliens) {
if (_root.alienList[i] == "") {
thisName = "alien" + i.toString();
_root.alienList[i] = thisName;
_root.attachMovie(myalientype, thisName, 20 + i);
_root[thisName].alien(i, myalientype);
return;
}
i++;
}
};
MovieClip.prototype.alienbullet = function (sx, ex, y, xs, ys) {
this._x = sx;
this._y = y;
this.xspeed = xs;
this.yspeed = ys;
this.endx = ex;
this.removebullet = function () {
i = 0;
while (i < 40) {
if (_root.alienBulletList[i] == this._name) {
_root.alienBulletList[i] = "";
removeMovieClip(this);
return;
}
i++;
}
};
this.onEnterFrame = function () {
if (_root.gamepaused == false) {
if (this._x < this.endx) {
this.removebullet();
}
this._x = this._x + this.xspeed;
this._y = this._y + this.yspeed;
if (this.hitTest(_root.ship) && (_root.shipsafe == false)) {
killship();
this.removebullet();
}
}
};
};
firealienbullet = function (whichalien, ypos) {
xdirection = Math.floor(_root[whichalien]._x - _root.ship._x);
ydirection = Math.floor(_root[whichalien]._y - _root.ship._y);
ydirection = 0 + ((ydirection < 0) ? 1 : -1);
i = 0;
while (i < 40) {
if (_root.alienBulletList[i] == "") {
thisName = "alienbullet" + i.toString();
_root.alienBulletList[i] = thisName;
_root.attachMovie("bullet1", thisName, i + 100);
_root[thisName].alienbullet(_root[whichalien]._x, 0, ypos, -5, ydirection);
return;
}
i++;
}
};
killship = function () {
_root.ship.gotoAndPlay(2);
_root.shipsafe = true;
_root.disableship = true;
_root.restartcounter = 60;
_root.aliencounter = _root.aliencounter + 12;
_root.lives = _root.lives - 1;
_root.currentweapon = -1;
doweaponup();
sound4.stop();
sound4.attachSound("shipexplode");
sound4.play(0, 0);
if (_root.lives > 0) {
_root.playsound("sshipexplodenormal");
_root.gameborder.mylives.text = _root.lives - 1;
}
clearall(true);
if (_root.lives == 0) {
_root.playsound("sshipexplodefinal");
_root.restartcounter = -1;
gameover();
}
};
replaceship = function () {
_root.ship._y = 250;
_root.ship.gotoAndPlay(3);
_root.disableship = false;
};
restartship = function () {
_root.ship.gotoAndPlay(1);
_root.shipsafe = false;
};
gameover = function () {
gotoAndStop (7);
};
addscore = function (whichtype) {
switch (whichtype) {
case "drone" :
_root.score = _root.score + 10;
break;
case "buzzer" :
_root.score = _root.score + 30;
break;
case "attacker" :
_root.score = _root.score + 20;
break;
case "turret" :
_root.score = _root.score + 40;
break;
case "target" :
_root.score = _root.score + 250;
}
_root.gameborder.myscore.text = _root.score;
};
clearall = function (addtoscore) {
i = 0;
while (i < 20) {
if (_root.bulletList[i] != "") {
_root[_root.bulletList[i]].removebullet();
}
i++;
}
i = 0;
while (i < _root.maxaliens) {
if (_root.alienList[i] != "") {
if (_root[alienlist[i]].alientype != "target") {
if (_root[alienList[i]].alientype != "weaponup") {
_root[_root.alienList[i]].removealien();
if ((addtoscore = true)) {
addscore(_root[alienList[i]].alientype);
}
}
}
}
i++;
}
i = 0;
while (i < 40) {
if (_root.alienBulletList[i] != "") {
_root[_root.alienBulletList[i]].removebullet();
}
i++;
}
};
smartbomb = function () {
playsound("ssmart");
_root.smarttimer = 6;
_root.bombs = _root.bombs - 1;
_root.gameborder.mybombs.text = _root.bombs.toString();
i = 0;
while (i < _root.maxaliens) {
if (_root.alienList[i] != "") {
if (_root[alienList[i]].alientype != "weaponup") {
_root[_root.alienList[i]].killAlien();
}
}
i++;
}
};
playsound = function (whichtype) {
switch (whichtype) {
case "ssmart" :
thissound = "smart.wav";
break;
case "sfire" :
thissound = "bullet.wav";
break;
case "sshipexplodenormal" :
thissound = "shipexplodenormal.wav";
break;
case "sshipexplodefinal" :
thissound = "shipexplodefinal.wav";
break;
case "skillalien" :
randvar = Math.floor(Math.random() * 4);
switch (randvar) {
case 1 :
thissound = "killalien1.wav";
break;
case 2 :
thissound = "killalien2.wav";
break;
case 3 :
thissound = "killalien3.wav";
break;
case 4 :
thissound = "killalien4.wav";
}
}
_root[whichtype].stop();
_root[whichtype].attachSound(thissound);
_root[whichtype].start();
};
doweaponup = function () {
switch (_root.currentweapon) {
case -1 :
_root.whichbulletclip = "bullet1";
break;
case 0 :
_root.whichbulletclip = "bullet2";
break;
case 1 :
_root.whichbulletclip = "bullet3";
break;
case 2 :
_root.whichbulletclip = "bullet4";
}
if (_root.currentweapon < 3) {
_root.currentweapon = _root.currentweapon + 1;
}
};
endwave = function () {
clearall(false);
_root.endofwave.endwavetextfield.text = "END OF WAVE " + _root.wave.tostring();
if (_root.targetdestroyed == true) {
_root.endofwave.endwavetargetfield.text = "TARGET DESTROYED BONUS x 250";
addscore("target");
} else if (_root.targetdestroyed == false) {
_root.endofwave.endwavetargetfield.text = "TARGET INTACT";
}
_root.endofwave._visible = true;
doshownewwave = setInterval(shownewwave, 2000);
};
shownewwave = function () {
_root.endofwave._visible = false;
clearInterval(doshownewwave);
_root.wave = _root.wave + 1;
_root.startwavetext.newwavetextfield.text = "WAVE " + _root.wave.toString();
_root.startwavetext._visible = true;
donextwave = setInterval(startnewwave, 2000);
};
startnewwave = function () {
_root.startwavetext._visible = false;
clearInterval(donextwave);
_root.alienfrequency = 48;
_root.aliencounter = alienfrequency + Math.floor(Math.random() * alienfrequency);
_root.eventtimer = 0;
_root.targettime = _root.targettime + 480;
_root.endwavetime = _root.endwavetime + 480;
_root.weaponuptime = _root.endwavetime / 2;
_root.targetdestroyed = false;
if (_root.maxaliens < 40) {
_root.maxaliens = _root.maxaliens + 5;
}
};
pausegame = function () {
_root.gamepaused = true;
_root.ship.shipunhit.stop();
_root.ship.shipexplode.stop();
_root.ship.shipsafe.stop();
_root.pausetext._visible = true;
i = 0;
while (i < _root.maxaliens) {
if (_root.alienList[i] != "") {
_root[alienList[i]].myframe = _root[alienList[i]]._currentframe;
_root[alienList[i]].stop();
}
i++;
}
};
unpausegame = function () {
_root.gamepaused = false;
_root.ship.shipunhit.play();
_root.ship.shipexplode.play();
_root.ship.shipsafe.play();
_root.pausetext._visible = false;
i = 0;
while (i < _root.maxaliens) {
if (_root.alienList[i] != "") {
if (_root[alienList[i]].myframe == 1) {
_root[alienList[i]].gotoAndStop(1);
} else {
_root[alienList[i]].gotoAndPlay(_root[alienList[i]].myframe);
}
}
i++;
}
};
_root.onEnterFrame = function () {
if (_root.lives > 0) {
if (_root.gamepaused == false) {
with (_root.ship) {
if (_root.disableship == false) {
if (key.isDown(65) || (key.isDown(38))) {
if (_root.ship._y > 45) {
_y = _y - 5;
}
}
if (key.isDown(90) || (key.isDown(40))) {
if (_root.ship._y < 350) {
_y = _y + 5;
}
}
if (key.isDown(39) || (key.isDown(191))) {
if (_root.ship._x < 550) {
_x = _x + 5;
}
}
if (key.isDown(37) || (key.isDown(190))) {
if (_root.ship._x > 50) {
_x = _x - 5;
}
}
}
}
_root.terrain1._x = _root.terrain1._x - 10;
_root.terrain2._x = _root.terrain2._x - 10;
if (_root.terrain1._x <= -550) {
_root.terrain1._x = 550;
_root.terrain1.gotoAndPlay(Math.floor(Math.random() * 4));
}
if (_root.terrain2._x <= -550) {
_root.terrain2._x = 550;
_root.terrain2.gotoAndPlay(Math.floor(Math.random() * 4));
}
_root.stars1._x = _root.stars1._x - 2;
_root.stars2._x = _root.stars2._x - 2;
if (_root.stars1._x <= -550) {
_root.stars1._x = 550;
}
if (_root.stars2._x <= -550) {
_root.stars2._x = 550;
}
if (_root.restartcounter > 0) {
_root.restartcounter = _root.restartcounter - 1;
if (_root.restartcounter == 36) {
replaceship();
}
if (_root.restartcounter == 0) {
restartship();
}
}
_root.eventtimer = _root.eventtimer + 1;
if (_root.eventtimer < _root.endwavetime) {
_root.aliencounter = _root.aliencounter - 1;
if (_root.aliencounter == 0) {
newalien(Math.floor(Math.random() * 4));
_root.aliencounter = (6 + _root.alienfrequency) + Math.floor(Math.random() * _root.alienfrequency);
}
if (((eventtimer / 100) - Math.floor(eventtimer / 100)) == 0) {
if (_root.alienfrequency > 6) {
_root.alienfrequency = _root.alienfrequency - _root.wave;
}
}
switch (_root.eventtimer) {
case _root.weaponuptime :
newalien(5);
break;
case _root.targettime :
newalien(6);
break;
case _root.endofwavetime :
endofwave();
}
} else if (_root.eventtimer == _root.endwavetime) {
endwave();
}
if (_root.smarttimer > 0) {
if (_root.smartoverlay._visible == false) {
_root.smartoverlay._visible = true;
} else {
_root.smartoverlay._visible = false;
}
_root.smarttimer = _root.smarttimer - 1;
}
if (_root.score > _root.nextlifeup) {
_root.nextlifeup = _root.nextlifeup + _root.nextlifeup;
_root.lives = _root.lives + 1;
_root.gameborder.mylives.text = _root.lives - 1;
}
if (_root.score > _root.nextbombup) {
_root.nextbombup = _root.nextbombup + _root.nextbombup;
_root.bombs = _root.bombs + 1;
_root.gameborder.mybombs.text = _root.bombs;
}
}
gotoAndPlay (3);
} else if (lives == 0) {
gameover();
}
};
disablekey = function () {
_root.disablefire = true;
enablefire = setInterval(enablekey, 125);
};
enablekey = function () {
_root.disablefire = false;
clearInterval(enablefire);
};
stop();
Frame 7
stop();
Symbol 20 MovieClip [attacker] Frame 1
stop();
Symbol 20 MovieClip [attacker] Frame 50
stop();
Symbol 27 MovieClip [bullet2] Frame 96
stop();
Symbol 29 MovieClip [bullet4] Frame 96
stop();
Symbol 30 MovieClip [buzzer] Frame 1
stop();
Symbol 30 MovieClip [buzzer] Frame 49
stop();
Symbol 32 MovieClip [drone] Frame 1
stop();
Symbol 32 MovieClip [drone] Frame 49
stop();
Symbol 33 MovieClip [explosionloop] Frame 24
stop();
Symbol 34 MovieClip [gameinterface] Frame 1
stop();
Symbol 34 MovieClip [gameinterface] Frame 2
stop();
Symbol 49 Button [gameover]
on (rollOver, release, dragOut, dragOver) {
}
Symbol 62 MovieClip [ship] Frame 1
stop();
Symbol 62 MovieClip [ship] Frame 2
stop();
Symbol 62 MovieClip [ship] Frame 3
stop();
Symbol 65 MovieClip [target] Frame 1
stop();
Symbol 65 MovieClip [target] Frame 35
stop();
Symbol 67 MovieClip [terrain] Frame 1
stop();
Symbol 67 MovieClip [terrain] Frame 2
stop();
Symbol 67 MovieClip [terrain] Frame 3
stop();
Symbol 67 MovieClip [terrain] Frame 4
stop();
Symbol 67 MovieClip [terrain] Frame 5
stop();
Symbol 73 MovieClip [turret] Frame 1
stop();
Symbol 73 MovieClip [turret] Frame 49
stop();
Symbol 75 MovieClip [weaponup] Frame 1
stop();
Symbol 75 MovieClip [weaponup] Frame 48
stop();
Symbol 86 MovieClip Frame 1
if (this.sessionstarted != 1) {
this.arcade = new LoadVars();
this.sessionvars = new LoadVars();
this.arcade.gamename = "commanderalien";
this.arcade.sessdo = "sessionstart";
this.arcade.sendAndLoad("arcade.php", sessionvars, "POST");
if (this.sessionvars.sessiontype != 2) {
_root.is_a_challenge = 0;
} else {
_root.is_a_challenge = 1;
}
this.sessionstarted = 1;
}
if (_root.gameover == 1) {
if ((this.askpermission != 1) && (this.sessionvars.connStatus == 1)) {
this.prequestvars = new LoadVars();
this.pranswer = new LoadVars();
this.prequestvars.gametime = this.sessionvars.gametime;
this.prequestvars.fakekey = this.sessionvars.initbar;
_root.score = int(Number(_root.score));
if (_root.score != 0) {
this.prequestvars.score = _root.score;
} else {
this.prequestvars.score = -1;
}
this.prequestvars.id = this.sessionvars.lastid;
this.prequestvars.sessdo = "permrequest";
this.prequestvars.note = (this.prequestvars.id * this.prequestvars.score) * this.prequestvars.fakekey;
this.prequestvars.sendAndLoad("./arcade.php", this.pranswer, "POST");
this.askpermission = 1;
}
if ((this.pranswer.validate == 1) && (this.finalsent != 1)) {
this.burnscore = new LoadVars();
this.burnscore.microone = this.pranswer.microone;
this.burnscore.gametime = this.prequestvars.gametime;
this.burnscore.id = this.prequestvars.id;
if (_root.score == 0) {
this.burnscore.noscore = 1;
}
this.burnscore.sessdo = "burn";
this.burnscore.send("./arcade.php", "_self", "POST");
this.finalsent = 1;
}
}
Symbol 97 Button
on (release) {
_root.gameover = 1;
}
Symbol 99 Button
on (release) {
_root.gameover = 1;
}
Symbol 104 MovieClip Frame 1
stop();
Symbol 104 MovieClip Frame 2
stop();
Symbol 108 Button
on (release) {
_root.gameover = 1;
}
Symbol 109 Button
on (release) {
_root.gameover = 1;
}
Symbol 123 Button
on (release) {
_root.startgame();
_root.gotoAndPlay(5);
}
Symbol 124 Button
on (release) {
_root.startgame();
_root.gotoAndPlay(5);
}
Symbol 125 Button
on (release) {
_root.gameover = 1;
}
Symbol 126 Button
on (release) {
_root.gameover = 1;
}