Combined Code
movieClip 12 rocket {
#initclip
Object.registerClass('rocket', rocket);
#endinitclip
}
movieClip 14 preLoaderBar {
}
movieClip 17 powerup {
#initclip
Object.registerClass('powerup', powerup);
#endinitclip
}
movieClip 20 pill2 {
#initclip
Object.registerClass('pill2', pill2);
#endinitclip
}
movieClip 23 noxar {
#initclip
Object.registerClass('noxar', noxar);
#endinitclip
}
movieClip 27 miniBar {
}
movieClip 28 miniboss {
#initclip
Object.registerClass('miniboss', miniboss);
#endinitclip
}
movieClip 30 loadBar {
#initclip
Object.registerClass('loadBar', loadBar);
#endinitclip
}
movieClip 33 lazer {
#initclip
Object.registerClass('lazer', lazer);
#endinitclip
}
movieClip 54 {
}
movieClip 55 explosion {
#initclip
Object.registerClass('explosion', explosion);
#endinitclip
}
movieClip 58 enemy {
#initclip
Object.registerClass('enemy', enemy);
#endinitclip
}
// unknown tag 88 length 75
movieClip 65 GameOverMenu {
#initclip
Object.registerClass('GameOverMenu', GameOverMenu);
#endinitclip
}
movieClip 68 {
}
movieClip 69 ufo {
#initclip
Object.registerClass('ufo', ufo);
#endinitclip
}
movieClip 72 background {
#initclip
Object.registerClass('background', background);
#endinitclip
}
movieClip 73 background2 {
#initclip
Object.registerClass('background2', background2);
#endinitclip
}
// unknown tag 88 length 146
movieClip 80 {
}
movieClip 81 {
}
movieClip 84 {
}
movieClip 87 {
}
movieClip 88 pill {
#initclip
Object.registerClass('pill', pill);
#endinitclip
}
movieClip 89 __Packages.powerup {
#initclip
if (!_global.powerup) {
var v1 = function () {
super();
};
_global.powerup = v1;
_global.powerup extends MovieClip;
var v2 = v1.prototype;
v2.onLoad = function () {
this.speed = 2;
this.type = Math.floor(Math.random() * 3 + 1);
this._x = 650;
this._y = Math.random() * 500 + 50;
};
v2.onEnterFrame = function () {
this._x -= this.speed;
this._rotation += 85;
if (this.hitTest(_root.UFO)) {
if (this.type == 1) {
if (_root.UFO.hp == 70) {
_root.UFO.resetHP();
}
if (_root.UFO.hp > 70) {
_root.UFO.resetHP();
}
if (_root.UFO.hp < 70) {
_root.UFO.updateHP(-30);
}
}
if (this.type == 2) {
for (var v3 in _root.UFO.enemies) {
_root.UFO.enemies[v3].takeDamage(20);
}
}
if (this.type == 3) {
_root.UFO.shield._visible = true;
}
this.removeMovieClip();
}
if (this._x < -500) {
this.removeMovieClip();
}
};
ASSetPropFlags(_global.powerup.prototype, null, 1);
}
#endinitclip
}
movieClip 90 __Packages.pill {
#initclip
if (!_global.pill) {
var v1 = function () {
super();
};
_global.pill = v1;
_global.pill extends MovieClip;
var v2 = v1.prototype;
v2.onLoad = function () {
this.Speed = -20;
};
v2.onEnterFrame = function () {
this._x += this.Speed;
if (this.hitTest(_root.UFO)) {
this.removeMovieClip();
if (_root.UFO.shield._visible == false) {
_root.UFO.updateHP(10);
}
}
if (this._x < -10) {
this.removeMovieClip();
}
if (this._x > 610) {
this.removeMovieClip();
}
};
ASSetPropFlags(_global.pill.prototype, null, 1);
}
#endinitclip
}
movieClip 91 __Packages.pill2 {
#initclip
if (!_global.pill2) {
var v1 = function () {
super();
};
_global.pill2 = v1;
_global.pill2 extends pill;
var v2 = v1.prototype;
v2.onLoad = function () {
this.Speed = 20;
};
ASSetPropFlags(_global.pill2.prototype, null, 1);
}
#endinitclip
}
movieClip 92 __Packages.noxar {
#initclip
if (!_global.noxar) {
var v1 = function () {
super();
};
_global.noxar = v1;
_global.noxar extends MovieClip;
var v2 = v1.prototype;
v2.takeDamage = function (damage) {
this.hp -= damage;
if (this.hp < 1) {
this.explode();
}
};
v2.onLoad = function () {
this.rocketList = [];
this.shoot = 0;
this.rpm3 = 0;
this.rocketTimer = 0;
this.elite = 0;
this.nextElite = 300;
this.rpm = 120;
this._x = 650;
this.rpm2 = 0;
this._y = Math.random() * 100 + 100;
this.speed = 8;
this.ySpeed = 8;
this.yTimer = 0;
this.shoot = 0;
this.hp = 250;
_root.miniBoss.explode();
_root.UFO.updateScore(-200);
_root.soundEffects.attachSound('noxarSpawn');
_root.soundEffects.start();
};
v2.explode = function () {
for (var v4 in _root.noxar.rocketList) {
this.rocketList[v4].explode();
}
var v3 = _root.attachMovie('explosion', 'explosion' + _root.getNextHighestDepth(), _root.getNextHighestDepth());
v3._x = this._x;
v3._y = this._y;
v3._xscale = 500;
v3._yscale = 500;
this.removeMovieClip();
_root.UFO.updateScore(1000);
_root.UFO.kills += 1;
_root.UFO.updateHP(40);
_root.bossMeter._visible = false;
if (_root.UFO._visible == true) {
_root.soundEffects.attachSound('noxarDie');
_root.soundEffects.start();
_root.UFO.bossKills += 1;
trace(_root.UFO.bossKills);
}
};
v2.onEnterFrame = function () {
if (_root.UFO._visible == false) {
this.explode();
_root.UFO.updateScore(-10000);
_root.UFO.kills -= 1;
}
this.elite += 1;
if (this.elite > this.nextElite) {
this.elite = 0;
this.nextElite += 150;
var v5 = _root.attachMovie('miniboss', 'miniboss' + _root.getNextHighestDepth(), _root.getNextHighestDepth());
_root.UFO.enemies.push(v5);
_root.soundEffects.attachSound('helpMe');
_root.soundEffects.start();
}
this.rpm2 += 5;
if (this.rpm2 > 30 && this.rpm > 3) {
this.rpm -= 1;
this.rpm2 = 0;
this.rpm3 += 1;
}
this.rocketTimer += 1;
if (this.rocketTimer > 90) {
var v3 = _root.attachMovie('rocket', 'rocket' + _root.getNextHighestDepth(), _root.getNextHighestDepth());
v3._x = this._x;
v3._y = this._y;
this.rocketList.push(v3);
this.rocketTimer = 0;
}
_root.bossMeter.bossBar._xscale = this.hp / 2.5;
this.shoot += 1;
if (this.shoot > this.rpm) {
this.shoot = 0;
var v4 = _root.attachMovie('pill', 'pill' + _root.getNextHighestDepth(), _root.getNextHighestDepth());
v4._x = this._x - 50;
v4._y = this._y - 50 + Math.random() * 120;
_root.soundEffects.attachSound('pew');
_root.soundEffects.start();
}
if (this.hitTest(_root.UFO)) {
if (_root.UFO.shield._visible == false) {
_root.UFO.updateHP(80);
}
if (_root.UFO.shield._visible == true) {
_root.UFO.updateHP(55);
}
}
this._x -= this.speed;
if (this._x < 400) {
this.speed = 0;
}
this._y += this.ySpeed;
if (this._y > 540) {
this.ySpeed *= -1;
}
if (this._y < 60) {
this.ySpeed *= -1;
}
this.yTimer += 1;
if (this.yTimer > 30) {
this.ySpeed += Math.random() * 2 - 1;
}
};
ASSetPropFlags(_global.noxar.prototype, null, 1);
}
#endinitclip
}
movieClip 93 __Packages.miniboss {
#initclip
if (!_global.miniboss) {
var v1 = function () {
super();
};
_global.miniboss = v1;
_global.miniboss extends MovieClip;
var v2 = v1.prototype;
v2.takeDamage = function (damage) {
this.hp -= damage;
if (this.hp < 1) {
this.explode();
}
};
v2.onLoad = function () {
this.shoot = 0;
this._x = 650;
this._y = Math.random() * 100 + 100;
this.speed = 2;
this.ySpeed = 8;
this.yTimer = 0;
this.shoot = 0;
this.hp = 100;
};
v2.explode = function () {
var v3 = _root.attachMovie('explosion', 'explosion' + _root.getNextHighestDepth(), _root.getNextHighestDepth());
v3._x = this._x;
v3._y = this._y;
this.removeMovieClip();
_root.UFO.updateScore(200);
_root.UFO.kills += 1;
_root.soundEffects.attachSound('poof');
_root.soundEffects.start();
};
v2.onEnterFrame = function () {
this.hpBar._xscale = this.hp;
this.shoot += 1;
this.yTimer += 1;
if (_root.UFO._visible == false) {
this.explode();
_root.UFO.updateScore(-200);
_root.UFO.kills -= 1;
}
if (this.ySpeed > 0) {
if (this.shoot > 30 - this.ySpeed * 2) {
this.shoot = 0;
var v3 = _root.attachMovie('pill', 'pill' + _root.getNextHighestDepth(), _root.getNextHighestDepth());
v3._x = this._x - 50;
v3._y = this._y + 2;
_root.soundEffects.attachSound(this.shotsound);
_root.soundEffects.start();
}
if (this.yTimer > 120) {
this.ySpeed = Math.random() * 8 + 3;
this.yTimer = 0;
}
}
if (this.ySpeed < 0) {
if (this.shoot > 30 + this.ySpeed * 2) {
this.shoot = 0;
v3 = _root.attachMovie('pill', 'pill' + _root.getNextHighestDepth(), _root.getNextHighestDepth());
v3._x = this._x - 50;
v3._y = this._y + 2;
_root.soundEffects.attachSound(this.shotsound);
_root.soundEffects.start();
}
if (this.yTimer > 120) {
this.ySpeed = Math.random() * -8 - 3;
this.yTimer = 0;
}
}
if (this.hitTest(_root.UFO)) {
this.takeDamage(50);
if (_root.UFO.shield._visible == false) {
_root.UFO.updateHP(20);
}
if (_root.UFO.shield._visible == true) {
_root.UFO.updateHP(10);
}
}
this._x -= this.speed;
if (this._x < 400) {
this.speed = 0;
}
this._y += this.ySpeed;
if (this.ySpeed > 0 && this._y > 450) {
this.ySpeed *= -1;
}
if (this.ySpeed < 0 && this._y < 50) {
this.ySpeed *= -1;
}
};
v2.shotsound = 'pew';
ASSetPropFlags(_global.miniboss.prototype, null, 1);
}
#endinitclip
}
movieClip 94 __Packages.loadBar {
#initclip
if (!_global.loadBar) {
var v1 = function () {
super();
};
_global.loadBar = v1;
_global.loadBar extends MovieClip;
var v2 = v1.prototype;
v2.onEnterFrame = function () {
this.loaderC = _root.getBytesLoaded();
this.loaderT = _root.getBytesTotal();
this.percent = (this.loaderC / this.loaderT) * 100;
this._xscale = Math.floor(this.percent);
if (this.loaderC == this.loaderT) {
_root.gotoAndStop(2);
}
_root.loadPercent = 'Loading - ' + this.percent + '% complete';
};
ASSetPropFlags(_global.loadBar.prototype, null, 1);
}
#endinitclip
}
movieClip 95 __Packages.lazer {
#initclip
if (!_global.lazer) {
var v1 = function () {
super();
};
_global.lazer = v1;
_global.lazer extends MovieClip;
var v2 = v1.prototype;
v2.onLoad = function () {
this.speed = 20;
};
v2.onEnterFrame = function () {
this._x += this.speed;
for (var v3 in _root.UFO.enemies) {
if (this.hitTest(_root.UFO.enemies[v3])) {
this.removeMovieClip();
_root.UFO.enemies[v3].takeDamage(5);
}
}
if (this._x > 600) {
this.removeMovieClip();
}
for (v3 in _root.noxar.rocketList) {
if (this.hitTest(_root.noxar.rocketList[v3])) {
this.removeMovieClip();
_root.noxar.rocketList[v3].explode();
}
}
};
ASSetPropFlags(_global.lazer.prototype, null, 1);
}
#endinitclip
}
movieClip 96 __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
}
movieClip 97 __Packages.enemy {
#initclip
if (!_global.enemy) {
var v1 = function () {
super();
};
_global.enemy = v1;
_global.enemy extends MovieClip;
var v2 = v1.prototype;
v2.onLoad = function () {
this.shoot = 0;
this.shots = [];
this._x = 600;
this._y = Math.random() * 580 + 10;
this.speed = Math.random() * 5 + 5;
this.ySpeed = Math.random() * 5 - 1;
this.yTimer = 0;
};
v2.explode = function () {
var v3 = _root.attachMovie('explosion', 'explosion' + _root.getNextHighestDepth(), _root.getNextHighestDepth());
v3._x = this._x;
v3._y = this._y;
this.removeMovieClip();
_root.UFO.updateScore(50);
_root.UFO.kills += 1;
_root.soundEffects.attachSound('poof');
_root.soundEffects.start();
};
v2.takeDamage = function () {
this.explode();
};
v2.onEnterFrame = function () {
this.yTimer += 1;
this.shoot += 1;
if (this.shoot > 15) {
this.shoot = 0;
if (this._x > _root.UFO._x) {
var v3 = _root.attachMovie('pill', 'pill' + _root.getNextHighestDepth(), _root.getNextHighestDepth());
this.shots.push(v3);
v3._x = this._x - 50;
v3._y = this._y + 2;
}
if (this._x < _root.UFO._x) {
v3 = _root.attachMovie('pill2', 'pill2' + _root.getNextHighestDepth(), _root.getNextHighestDepth());
this.shots.push(v3);
v3._x = this._x + 50;
v3._y = this._y + 2;
}
_root.soundEffects.attachSound('pew');
_root.soundEffects.start();
}
if (this.hitTest(_root.UFO)) {
this.explode();
if (_root.UFO.shield._visible == false) {
_root.UFO.updateHP(20);
}
if (_root.UFO.shield._visible == true) {
_root.UFO.updateHP(10);
}
}
this._x -= this.speed;
if (this._x < 0) {
this.speed *= -1;
}
if (this._x > 600) {
this.speed *= -1;
}
this._y += this.ySpeed;
if (this._y > 0) {
this.ySpeed *= -1;
}
if (this._y < 600) {
this.ySpeed *= -1;
}
if (_root.retryMenu._visible == true) {
this.explode();
}
};
ASSetPropFlags(_global.enemy.prototype, null, 1);
}
#endinitclip
}
movieClip 98 __Packages.GameOverMenu {
#initclip
if (!_global.GameOverMenu) {
var v1 = function () {
super();
};
_global.GameOverMenu = v1;
_global.GameOverMenu extends MovieClip;
var v2 = v1.prototype;
ASSetPropFlags(_global.GameOverMenu.prototype, null, 1);
}
#endinitclip
}
movieClip 99 __Packages.ufo {
#initclip
if (!_global.ufo) {
var v1 = function () {
super();
};
_global.ufo = v1;
_global.ufo extends MovieClip;
var v2 = v1.prototype;
v2.resetScore = function () {
this.score = 0;
_root.scoreText.text = this.score;
};
v2.explode = function () {
this._visible = false;
var v4 = _root.attachMovie('Explosion', 'Explosion' + _root.getNextHighestDepth(), _root.getNextHighestDepth());
v4._x = this._x;
v4._y = this._y;
_root.gameMusic.stop();
_root.loseMusic.attachSound('loseMusic');
_root.loseMusic.start(0, this.playLoops);
this.rpm = 0;
_root.kongregateStats.submit('score', this.score);
_root.kongregateStats.submit('Enemies Killed', this.kills);
_root.kongregateStats.submit('Bosses Killed', this.bossKills);
for (var v3 in this.enemies) {
this.enemies[v3].explode();
}
for (v3 in this.miniBossBars) {
this.miniBossBars[v3].removeMovieClip();
}
};
v2.newGame = function () {
this.onLoad();
};
v2.updateScore = function (points) {
this.score += points;
_root.scoreText.text = this.score;
};
v2.updateHP = function (damage) {
this.hp -= damage;
if (damage > 0) {
_root.soundEffects.attachSound('ouch');
_root.soundEffects.start();
}
_root.health_meter.bar._xscale = this.hp;
if (this.hp < 1) {
this.hp = 0;
_root.retryMenu._visible = true;
this.explode();
}
};
v2.resetHP = function () {
this.hp = 1000;
_root.health_meter.bar._xscale = this.hp;
};
v2.onLoad = function () {
this.miniBossBars = [];
this.bossKills = 0;
_root.kongregateServices.connect();
this._visible = true;
_root.bossMeter._visible = false;
this.enemies = [];
this.shots = [];
this.playLoops = 10;
this.velocity = 10;
this.rpm = 0;
this.respawn = 0;
this.resetScore();
this.resetHP();
this.powerupTimer = 0;
this.miniTimer = 0;
this.bossCount = 3;
this.nextBoss = 3;
this.kills = 0;
_root.soundEffects = new Sound();
_root.loseMusic = new Sound();
_root.gameMusic = new Sound();
_root.gameMusic.attachSound('playMusic');
_root.gameMusic.start(0, 999);
_root.retryMenu._visible = false;
_root.UFO.shield._visible = false;
_root.retryMenu.retryButton.onPress = function () {
_root.retryMenu._visible = false;
_root.loseMusic.stop();
_root.UFO.newGame();
};
};
v2.onEnterFrame = function () {
if (!_root.miniBoss && this._visible == true) {
this.miniTimer += 1;
if (this.miniTimer > 450) {
this.miniTimer = 0;
if (!_root.noxar) {
_root.attachMovie('miniBoss', 'miniBoss', _root.getNextHighestDepth());
this.enemies.push(_root.miniBoss);
this.bossCount -= 1;
}
if (this.bossCount == 0) {
_root.attachMovie('noxar', 'noxar', _root.getNextHighestDepth());
this.enemies.push(_root.noxar);
_root.bossMeter._visible = true;
this.bossCount = 3;
}
}
}
if (this._visible == true) {
this.rpm += 1;
this.powerupTimer += 1;
}
if (_root.retryMenu._visible == false) {
this.respawn += 1;
}
if (_root.UFO.shield._visible == true) {
_root.UFO.shield._alpha -= 1;
if (_root.UFO.shield._alpha < 30) {
_root.UFO.shield._visible = false;
_root.UFO.shield._alpha = 100;
}
}
if (this.powerupTimer > 300) {
this.powerupTimer = 0;
var v5 = _root.attachMovie('powerup', 'powerup' + _root.getNextHighestDepth(), _root.getNextHighestDepth());
this.playLoops = 10;
}
if (!_root.noxar && !_root.miniBoss) {
if (this.respawn > 45) {
this.respawn = 0;
var v4 = _root.attachMovie('enemy', 'enemy' + _root.getNextHighestDepth(), _root.getNextHighestDepth());
this.enemies.push(v4);
}
}
if (_root.miniBoss) {
if (this.respawn > 90) {
this.respawn = 0;
v4 = _root.attachMovie('enemy', 'enemy' + _root.getNextHighestDepth(), _root.getNextHighestDepth());
this.enemies.push(v4);
}
}
if (_root.noxar) {
if (this.respawn > 120) {
this.respawn = 0;
v4 = _root.attachMovie('enemy', 'enemy' + _root.getNextHighestDepth(), _root.getNextHighestDepth());
this.enemies.push(v4);
}
}
if (Key.isDown(39) && this._x < 585) {
this._x += this.velocity;
}
if (Key.isDown(37) && this._x > 15) {
this._x -= this.velocity;
}
if (Key.isDown(38) && this._y > 10) {
this._y -= this.velocity;
}
if (Key.isDown(40) && this._y < 590) {
this._y += this.velocity;
}
if (Key.isDown(32) && this.rpm > 8) {
this.rpm = 0;
var v3 = _root.attachMovie('lazer', 'lazer' + _root.getNextHighestDepth(), _root.getNextHighestDepth());
this.shots.push(v3);
_root.soundEffects.attachSound('plasma');
_root.soundEffects.start();
v3._x = this._x + 15;
v3._y = this._y + 15;
}
};
ASSetPropFlags(_global.ufo.prototype, null, 1);
}
#endinitclip
}
movieClip 100 __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 < -1200) {
this._x = 0;
}
};
ASSetPropFlags(_global.background.prototype, null, 1);
}
#endinitclip
}
movieClip 101 __Packages.background2 {
#initclip
if (!_global.background2) {
var v1 = function () {
super();
};
_global.background2 = v1;
_global.background2 extends MovieClip;
var v2 = v1.prototype;
v2.onEnterFrame = function () {
if (this._x < -600) {
this._x = 0;
}
};
ASSetPropFlags(_global.background2.prototype, null, 1);
}
#endinitclip
}
movieClip 102 __Packages.rocket {
#initclip
if (!_global.rocket) {
var v1 = function () {
super();
};
_global.rocket = v1;
_global.rocket extends MovieClip;
var v2 = v1.prototype;
v2.onLoad = function () {
this.xSpeed = 0;
this.ySpeed = 0;
this._rotation = 180;
};
v2.explode = function () {
var v3 = _root.attachMovie('explosion', 'explosion' + _root.getNextHighestDepth(), _root.getNextHighestDepth());
v3._x = this._x;
v3._y = this._y;
this.removeMovieClip();
_root.soundEffects.attachSound('poof');
_root.soundEffects.start();
};
v2.onEnterFrame = function () {
this.yDif = _root.UFO._y - this._y;
this.xDif = _root.UFO._x - this._x;
if (this.xDif > 0) {
this.xSpeed = this.xDif * 3 / this.xDif;
}
if (this.xDif < 0) {
this.xSpeed = (this.xDif * 3 / this.xDif) * -1;
}
if (this.yDif > 0) {
this.ySpeed = this.yDif * 3 / this.yDif;
}
if (this.yDif < 0) {
this.ySpeed = (this.yDif * 3 / this.yDif) * -1;
}
if (this.xDif > 0 && this.yDif < 0) {
this._rotation = 315;
}
if (this.xDif < 0 && this.yDif > 0) {
this._rotation = 135;
}
if (this.xDif < 0 && this.yDif < 0) {
this._rotation = 225;
}
if (this.xDif > 0 && this.yDif > 20) {
this._rotation = 45;
}
if (this.xDif > 0 && this.yDif < 35 && this.yDif > -35) {
this._rotation = 0;
}
if (this.xDif < 0 && this.yDif < 35 && this.yDif > -35) {
this._rotation = 180;
}
if (this.yDif > 0 && this.xDif < 20 && this.xDif > -20) {
this._rotation = 90;
}
if (this.yDif < 0 && this.xDif < 20 && this.xDif > -20) {
this._rotation = 270;
}
this._x += this.xSpeed;
this._y += this.ySpeed;
if (this.hitTest(_root.UFO)) {
this.explode();
_root.UFO.updateHP(20);
}
};
ASSetPropFlags(_global.rocket.prototype, null, 1);
}
#endinitclip
}