Combined Code
movieClip 2 Bullet {
frame 1 {
this.onEnterFrame = function () {
i = 0;
while (i < _root.nrEnemies) {
if (this.hitTest(_root['Enemy' + i])) {
_root['Enemy' + i].reset();
_root.sc += 10;
this.removeMovieClip();
}
++i;
}
this._x -= 12;
if (this._x > 800) {
this.removeMovieClip();
}
};
}
}
// unknown tag 88 length 148
movieClip 6 GameoverScreen {
}
movieClip 8 Enemy {
}
movieClip 15 {
}
movieClip 21 {
}
movieClip 22 dude {
}
frame 1 {
var sc = 0;
var i = 0;
var lol = 0;
var life = 1;
var nrEnemies = 5;
lol = 0;
while (lol < nrEnemies) {
_root.Enemy.duplicateMovieClip('Enemy' + i, _root.getNextHighestDepth());
++lol;
}
this.onEnterFrame = function () {
if (Key.isDown(39)) {
Ship.gotoAndStop(2);
if (Ship.hitTest(800, Ship._y, true)) {
Ship._x -= 5;
}
Ship._x += 5;
}
if (Key.isDown(37)) {
Ship.gotoAndStop(2);
if (Ship.hitTest(0, Ship._y, true)) {
Ship._x += 5;
}
Ship._x -= 5;
}
if (Key.isDown(38)) {
Ship.gotoAndStop(3);
if (Ship.hitTest(Ship._x - 40, 0, true)) {
Ship._y += 5;
}
Ship._y -= 5;
}
if (Key.isDown(40)) {
Ship.gotoAndStop(3);
if (Ship.hitTest(Ship._x - 40, 600, true)) {
Ship._y -= 5;
}
Ship._y += 5;
}
if (Ship.hitTest(800, Ship._y, true)) {
Ship._x -= 5;
}
if (Key.isDown(32)) {
++i;
_root.attachMovie('Bullet', 'Bullet' + i, _root.getNextHighestDepth());
_root['Bullet' + i]._x = Ship._x + 3;
_root['Bullet' + i]._y = Ship._y;
}
if (life == 0) {
_root.attachMovie('GameoverScreen', 'GameoverScreen', _root.getNextHighestDepth());
}
};
}
movieClip 25 {
}
instance Ship of movieClip 25 {
onClipEvent (load) {
function reset() {
this._x = 800;
this._y = 300;
}
reset();
}
onClipEvent (enterFrame) {
i = 0;
while (i < _root.nrEnemies) {
if (this.hitTest(_root['Enemy' + i])) {
_root.life -= 1;
reset();
k = 0;
while (k < _root.nrEnemies) {
_root['Enemy' + k].reset();
++k;
}
}
++i;
}
}
}
instance Enemy0 of movieClip 8 Enemy {
onClipEvent (load) {
function reset() {
var v2 = 12;
this._y = Math.random() * 300;
this._x = 0;
mySpeed = Math.ceil(Math.random() * 6) + 1;
}
reset();
}
onClipEvent (enterFrame) {
this._x += mySpeed;
if (this._x < -10) {
reset();
}
if (timer >= 12) {
var dir = Math.ceil(Math.random() * 2);
timer = 0;
}
if (dir == 1) {
this._y -= 3;
} else {
if (dir == 2) {
this._y += 3;
}
}
++timer;
}
}