Combined Code
movieClip 13 Explosion {
#initclip
Object.registerClass('Explosion', Explosion);
#endinitclip
}
movieClip 15 Missile {
#initclip
Object.registerClass('Missile', Missile);
#endinitclip
}
movieClip 18 EnemyShip {
#initclip
Object.registerClass('EnemyShip', EnemyShip);
#endinitclip
}
movieClip 20 EnemyMissile {
#initclip
Object.registerClass('EnemyMissile', EnemyMissile);
#endinitclip
}
movieClip 23 Ship {
}
movieClip 26 Background {
#initclip
Object.registerClass('Background', Background);
#endinitclip
}
// unknown tag 88 length 95
movieClip 29 __Packages.Missile {
#initclip
if (!_global.Missile) {
var v1 = function () {
super();
};
_global.Missile = v1;
_global.Missile extends MovieClip;
var v2 = v1.prototype;
v2.onLoad = function () {
this.speed = 20;
};
v2.onEnterFrame = function () {
this._x += this.speed;
if (this._x > 600) {
this.removeMovieClip();
}
for (var v3 in _root.ship.enemies) {
if (this.hitTest(_root.ship.enemies[v3])) {
this.removeMovieClip();
_root.ship.enemies[v3].explode();
}
}
};
ASSetPropFlags(_global.Missile.prototype, null, 1);
}
#endinitclip
}
movieClip 30 __Packages.EnemyShip {
#initclip
if (!_global.EnemyShip) {
var v1 = function () {
super();
};
_global.EnemyShip = v1;
_global.EnemyShip extends MovieClip;
var v2 = v1.prototype;
v2.onLoad = function () {
this._x = 700;
this._y = Math.random() * 270;
this.speed = Math.random() * 5 + 5;
this.shootTimer = 0;
};
v2.onEnterFrame = function () {
this.shootTimer += 1;
if (this.shootTimer > 30) {
this.shootTimer = 0;
var v3 = _root.attachMovie('EnemyMissile', 'EnemyMissile' + _root.getNextHighestDepth(), _root.getNextHighestDepth());
v3._x = this._x - 50;
v3._y = this._y + 13;
}
this._x -= this.speed;
if (this._x < -100) {
this.removeMovieClip();
}
if (this.hitTest(_root.ship)) {
this.explode();
}
};
v2.explode = function () {
var v3 = _root.attachMovie('Explosion', 'Explosion' + _root.getNextHighestDepth(), _root.getNextHighestDepth());
v3._x = this._x;
v3._y = this._y;
_root.ship.updateScore(50);
this.removeMovieClip();
};
ASSetPropFlags(_global.EnemyShip.prototype, null, 1);
}
#endinitclip
}
movieClip 31 __Packages.EnemyMissile {
#initclip
if (!_global.EnemyMissile) {
var v1 = function () {
super();
};
_global.EnemyMissile = v1;
_global.EnemyMissile extends MovieClip;
var v2 = v1.prototype;
v2.onLoad = function () {
this.speed = -20;
};
v2.onEnterFrame = function () {
this._x += this.speed;
if (this.hitTest(_root.ship)) {
this.removeMovieClip();
}
if (this._x < 0) {
this.removeMovieClip();
}
};
ASSetPropFlags(_global.EnemyMissile.prototype, null, 1);
}
#endinitclip
}
movieClip 32 __Packages.Ship {
#initclip
if (!_global.Ship) {
var v1 = function () {
super();
};
_global.Ship = v1;
_global.Ship extends MovieClip;
var v2 = v1.prototype;
v2.onLoad = function () {
this.velocity = 10;
this.shootLimiter = 0;
this.enemyTimer = 0;
this.enemies = [];
resetScore();
};
v2.onEnterFrame = function () {
function updateScore(points) {
this.score += points;
_root.scoreText.text = this.score;
}
function resetScore() {
this.score = 0;
_root.scoreText.text = this.score;
}
this.shootLimiter += 1;
if (Key.isDown(39)) {
if (this._x <= 510) {
this._x += this.velocity;
}
}
if (Key.isDown(37)) {
if (this._x >= 10) {
this._x -= this.velocity;
}
}
if (Key.isDown(38)) {
if (this._y >= 0) {
this._y -= this.velocity;
}
}
if (Key.isDown(40)) {
if (this._y <= 250) {
this._y += this.velocity;
}
}
if (Key.isDown(32) && this.shootLimiter > 8) {
this.shootLimiter = 0;
var v3 = _root.attachMovie('Missile', 'Missile' + _root.getNextHighestDepth(), _root.getNextHighestDepth());
v3._x = this._x + 85;
v3._y = this._y + 20;
}
this.enemyTimer += 1;
if (this.enemyTimer > 60) {
this.enemyTimer = 0;
var v4 = _root.attachMovie('EnemyShip', 'EnemyShip' + _root.getNextHighestDepth(), _root.getNextHighestDepth());
this.enemies.push(v4);
}
};
ASSetPropFlags(_global.Ship.prototype, null, 1);
}
#endinitclip
}
movieClip 33 __Packages.Background {
#initclip
if (!_global.Background) {
var v1 = function () {
super();
};
_global.Background = v1;
_global.Background extends MovieClip;
var v2 = v1.prototype;
v2.onEnterFrame = function () {
this._x -= 1;
if (this._x < -615) {
this._x = 0;
}
};
ASSetPropFlags(_global.Background.prototype, null, 1);
}
#endinitclip
}
movieClip 34 __Packages.Explosion {
#initclip
if (!_global.Explosion) {
var v1 = function () {
super();
};
_global.Explosion = v1;
_global.Explosion extends MovieClip;
var v2 = v1.prototype;
v2.onEnterFrame = function () {
if (this._currentframe == this._totalframes) {
this.removeMovieClip();
}
};
ASSetPropFlags(_global.Explosion.prototype, null, 1);
}
#endinitclip
}