Combined Code
frame 1 {
Explosions = new Array();
BadShots = new Array();
PlayerShots = new Array();
PShotID = 0;
BShotID = 0;
ExplosionID = 0;
PShotTimer = 0;
UniqueID = 10;
stop();
this.onEnterFrame = function () {
if (PShotTimer > 0) {
--PShotTimer;
}
if (Key.isDown(32)) {
if (PShotTimer < 1) {
PShotID += 1;
UniqueID += 1;
if (PShotID == 10) {
PShotID = 1;
}
PlayerShots[PShotID] = MakeObject('PShot', PlayerShotT, UniqueID, PlayerShip._x, PlayerShip._y);
PShotTimer = 10;
}
}
};
md = function (x1, y1, x2, y2) {
x = x1 - x2;
y = y1 - y2;
var v1 = Math.sqrt(x * x + y * y);
if (v1 == 0) {
v1 = 999;
}
return v1;
};
MakeObject = function (instname, template, id, x, y) {
var v2;
var v1 = instname + id;
v2 = template.duplicateMovieClip(v1, id);
eval(v1)._x = x;
eval(v1)._y = y;
return v2;
};
}
movieClip 3 {
}
instance PlayerShotTa of movieClip 3 {
onClipEvent (load) {
xmove = random(5) - random(5);
ymove = (random(5) + 15) * -1;
}
onClipEvent (enterFrame) {
this._x += xmove;
this._y += ymove;
if (this._y < 0) {
this.removeMovieClip();
}
col = _root.md(_x, _y, _root.Alien._x, _root.Alien._y);
if (col < 40) {
++_root.UniqueID;
++_root.ExplosionID;
_root.Explosions[_root.ExplosionID] = _root.MakeObject('Explosion', _root.ExplosionT, _root.UniqueID, _root.Alien._x, _root.Alien._y);
_root.Alien._x = random(640);
_root.Alien._y = random(480);
_root.Alien.xmove = random(15) - random(15);
_root.Alien.ymove = random(15) - random(15);
++_root.scorenumber;
_root.score = 'Score ' + _root.scorenumber;
this.removeMovieClip();
}
}
}
movieClip 5 {
}
movieClip 7 {
}
movieClip 9 {
}
// unknown tag 88 length 73
movieClip 13 {
}
movieClip 15 {
}
instance PlayerShip of movieClip 15 {
onClipEvent (enterFrame) {
if (Key.isDown(39) and this._x < 640) {
this._x += 15;
} else {
if (Key.isDown(37) and this._x > 0) {
this._x -= 15;
}
}
}
}
movieClip 17 {
}
instance PlayerShotT of movieClip 17 {
onClipEvent (load) {
xmove = random(5) - random(5);
ymove = (random(5) + 15) * -1;
}
onClipEvent (enterFrame) {
this._x += xmove;
this._y += ymove;
if (this._y < 0) {
this.removeMovieClip();
}
col = _root.md(_x, _y, _root.Alien._x, _root.Alien._y);
if (col < 40) {
++_root.UniqueID;
++_root.ExplosionID;
_root.Explosions[_root.ExplosionID] = _root.MakeObject('Explosion', _root.ExplosionT, _root.UniqueID, _root.Alien._x, _root.Alien._y);
_root.Alien._x = random(640);
_root.Alien._y = random(480);
_root.Alien.xmove = random(15) - random(15);
_root.Alien.ymove = random(15) - random(15);
++_root.scorenumber;
_root.score = 'Score ' + _root.scorenumber;
this.removeMovieClip();
}
}
}
movieClip 19 {
}
instance ExplosionT of movieClip 19 {
}
movieClip 21 {
}
instance AlienShotT of movieClip 21 {
onClipEvent (load) {
xmove = random(5) - random(5);
ymove = random(5) + 15;
}
onClipEvent (enterFrame) {
this._x += xmove;
this._y += ymove;
if (this._y > 480) {
this.removeMovieClip();
}
col = _root.md(_x, _y, _root.PlayerShip._x, _root.PlayerShip._y);
if (col < 25) {
++_root.UniqueID;
++_root.ExplosionID;
_root.Explosions[_root.ExplosionID] = _root.MakeObject('Explosion', _root.ExplosionT, _root.UniqueID, _root.PlayerShip._x, _root.PlayerShip._y);
_root.PlayerShip._x = random(640);
if (_root.scorenumber > _root.highscorenumber) {
_root.highscorenumber = _root.scorenumber;
_root.highscore = 'High Score: ' + _root.highscorenumber;
}
_root.scorenumber = 0;
_root.score = 'Score ' + _root.scorenumber;
this.removeMovieClip();
}
}
}
movieClip 23 {
}
instance Alien of movieClip 23 {
onClipEvent (load) {
xmove = random(15) - random(15);
ymove = random(15) - random(15);
this._x = random(640);
this._y = random(480);
}
onClipEvent (enterFrame) {
this._x += xmove;
this._y += ymove;
if (this._x > 640) {
xmove = Math.abs(xmove) * -1;
}
if (this._x < 0) {
xmove = Math.abs(xmove);
}
if (this._y > 480) {
ymove = Math.abs(ymove) * -1;
}
if (this._y < 0) {
ymove = Math.abs(ymove);
}
fire = random(20);
if (fire == 1) {
_root.BShotID += 1;
_root.UniqueID += 1;
_root.BadShots[_root.BShotID] = _root.MakeObject('BShot', _root.AlienShotT, _root.UniqueID, _root.Alien._x, _root.Alien._y);
}
}
}