Combined Code
frame 1 {
scorenumber = 0;
highscorenumber = 0;
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 2 {
}
instance PlayerShotT of movieClip 2 {
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 13 {
frame 10 {
this.onEnterFrame = function () {
this.removeMovieClip();
};
}
}
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 21 {
frame 1 {
if (!_root.suit) {
if (_root.armour) {
gotoAndPlay(5);
} else {
if (_root.naked) {
gotoAndPlay(3);
}
}
}
}
frame 2 {
gotoAndPlay(1);
}
frame 3 {
if (!_root.naked) {
if (_root.armour) {
gotoAndPlay(5);
} else {
if (_root.suit) {
gotoAndPlay(1);
}
}
}
}
frame 4 {
gotoAndPlay(3);
}
frame 5 {
if (!_root.armour) {
if (_root.suit) {
gotoAndPlay(1);
} else {
if (_root.naked) {
gotoAndPlay(3);
}
}
}
}
frame 6 {
gotoAndPlay(5);
}
}
movieClip 25 {
frame 1 {
if (_root.messy != 0) {
if (_root.messy == 1) {
gotoAndPlay('mess1');
} else {
if (_root.messy == 2) {
gotoAndPlay('mess2');
} else {
if (_root.messy >= 3) {
gotoAndPlay('mess3');
}
}
}
}
}
frame 2 {
gotoAndPlay('mess0');
}
frame 3 {
if (_root.messy != 1) {
if (_root.messy == 0) {
gotoAndPlay('mess0');
} else {
if (_root.messy == 2) {
gotoAndPlay('mess2');
} else {
if (_root.messy >= 3) {
gotoAndPlay('mess3');
}
}
}
}
}
frame 4 {
gotoAndPlay('mess1');
}
frame 5 {
if (_root.messy != 2) {
if (_root.messy == 0) {
gotoAndPlay('mess0');
} else {
if (_root.messy == 1) {
gotoAndPlay('mess1');
} else {
if (_root.messy >= 3) {
gotoAndPlay('mess3');
}
}
}
}
}
frame 6 {
gotoAndPlay('mess2');
}
frame 7 {
if (_root.messy < 3) {
if (_root.messy == 0) {
gotoAndPlay('mess0');
} else {
if (_root.messy == 1) {
gotoAndPlay('mess1');
} else {
if (_root.messy == 2) {
gotoAndPlay('mess2');
}
}
}
}
}
frame 8 {
gotoAndPlay('mess3');
}
}
movieClip 30 {
}
movieClip 34 {
}
movieClip 35 {
}
instance Alien of movieClip 35 {
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);
}
}
}
movieClip 40 {
}
movieClip 41 {
}
instance AlienShotT of movieClip 41 {
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();
}
}
}