Frame 1
start_btn.onRelease = function () {
gotoAndStop ("start");
};
stop();
stopAllSounds();
Frame 2
stop();
var turntest = 0;
var gameOver = false;
var mainSpeed = 10;
var cTime = 1;
var cLimit = 5;
var shootAllow = false;
var enemyTime = 0;
var enemyLimit = 1;
var enemyTotal = 0;
var score = 0;
var totalBgShapes = 0;
_root.createEmptyMovieClip("bgHolder", _root.getNextHighestDepth());
_root.createEmptyMovieClip("bulletHolder", _root.getNextHighestDepth());
onEnterFrame = function () {
if (Key.isDown(37) || (Key.isDown(65))) {
mcMain._x = mcMain._x - mainSpeed;
turntest--;
}
if (Key.isDown(38) || (Key.isDown(87))) {
mcMain._y = mcMain._y - mainSpeed;
}
if (Key.isDown(39) || (Key.isDown(68))) {
mcMain._x = mcMain._x + mainSpeed;
turntest++;
}
if (Key.isDown(40) || (Key.isDown(83))) {
mcMain._y = mcMain._y + mainSpeed;
}
if (turntest != 0) {
mcMain._width = 20;
} else {
mcMain._width = 25;
}
turntest = 0;
if (mcMain._x <= 0) {
mcMain._x = mcMain._x + mainSpeed;
}
if (mcMain._y <= 0) {
mcMain._y = mcMain._y + mainSpeed;
}
if (mcMain._x >= (Stage.width - mcMain._width)) {
mcMain._x = mcMain._x - mainSpeed;
}
if (mcMain._y >= (Stage.height - mcMain._height)) {
mcMain._y = mcMain._y - mainSpeed;
}
if (Key.isDown(32) && (shootAllow)) {
var _local3 = Math.random();
bulletHolder.attachMovie("mcBullet", "Bullet" + _local3, bulletHolder.getNextHighestDepth());
bulletHolder["Bullet" + _local3]._x = (mcMain._x + (mcMain._width / 2)) - (bulletHolder["Bullet" + _local3]._width / 2);
bulletHolder["Bullet" + _local3]._y = mcMain._y;
bulletHolder["Bullet" + _local3].onEnterFrame = function () {
this._y = this._y - 10;
if (this._y < (-1 * this._height)) {
this.removeMovieClip();
}
if (gameOver) {
this.removeMovieClip();
}
};
shootAllow = false;
}
cTime++;
if (cTime == cLimit) {
shootAllow = true;
cTime = 0;
}
enemyTime++;
if (enemyTime == enemyLimit) {
_root.attachMovie("mcEnemy", "en" + enemyTotal, _root.getNextHighestDepth());
_root["en" + enemyTotal]._x = int(Math.random() * Stage.width);
_root["en" + enemyTotal]._y = -50;
_root["en" + enemyTotal].onEnterFrame = function () {
this._y = this._y + 5;
for (var _local3 in _root.bulletHolder) {
if ((this._y >= (_root.bulletHolder[_local3]._y - 30)) && (this._y <= _root.bulletHolder[_local3]._y)) {
if ((this._x <= (_root.bulletHolder[_local3]._x + 5)) && (this._x >= (_root.bulletHolder[_local3]._x - 35))) {
this.removeMovieClip();
_root.bulletHolder[_local3].removeMovieClip();
_root.score = _root.score + 5;
}
}
}
if (this.hitTest(_root.mcMain)) {
gameOver = true;
gotoAndStop ("lose");
mcMain.removeMovieClip();
}
if (gameOver || (this._y > 450)) {
this.removeMovieClip();
}
};
enemyTime = 0;
enemyTotal++;
}
txtScore.text = "Score: " + score;
bgHolder.createEmptyMovieClip("bg" + totalBgShapes, bgHolder.getNextHighestDepth());
bgHolder["bg" + totalBgShapes].beginFill(3355443);
bgHolder["bg" + totalBgShapes]._x = int(Math.random() * 550);
bgHolder["bg" + totalBgShapes]._y = -50 - bgHolder._y;
bgHolder["bg" + totalBgShapes].lineTo(int(Math.random() * 25), int(Math.random() * 25));
bgHolder["bg" + totalBgShapes].lineTo(int(Math.random() * 25), int(Math.random() * 25));
bgHolder["bg" + totalBgShapes].lineTo(int(Math.random() * 25), int(Math.random() * 25));
bgHolder["bg" + totalBgShapes].lineTo(int(Math.random() * 25), int(Math.random() * 25));
bgHolder["bg" + totalBgShapes].endFill();
bgHolder["bg" + totalBgShapes].onEnterFrame = function () {
if ((this._y > (450 - bgHolder._y)) || (_root.gameOver)) {
this.removeMovieClip();
}
};
totalBgShapes++;
bgHolder._y = bgHolder._y + 2;
};
mcMain.swapDepths(1000);
Frame 5
stop();
_root.onEnterFrame = function () {
if (Key.isDown(ENTER)) {
gotoAndStop (1);
}
};
txtFinalScore.text = "Final Score: " + score;
Symbol 5 MovieClip [mlauncher] Frame 1
stop();
Symbol 5 MovieClip [mlauncher] Frame 10
this.removeMovieClip();
Symbol 24 MovieClip [ship] Frame 3
gotoAndPlay ("start");
Symbol 24 MovieClip [ship] Frame 4
_root.shooter = null;
_root.shipmover = null;
_root.ship._width = 200;
start1_btn.onRelease = function () {
_parent.gotoAndPlay("op");
};
stop();
Symbol 42 MovieClip Frame 110
stop();