Symbol 13 MovieClip [SmallExplosion] Frame 4
this.removeMovieClip();
Symbol 26 MovieClip [Explosion] Frame 15
this.removeMovieClip();
Symbol 28 MovieClip [MiniBossMissile] Frame 1
#initclip 19
Object.registerClass("MiniBossMissile", EnemyMissile);
#endinitclip
Symbol 30 MovieClip [EnemyMissile] Frame 1
#initclip 10
Object.registerClass("EnemyMissile", EnemyMissile);
#endinitclip
Symbol 46 MovieClip [Missile] Frame 1
#initclip 11
Object.registerClass("Missile", Missile);
#endinitclip
Symbol 82 MovieClip [EnemyShip] Frame 1
#initclip 12
Object.registerClass("EnemyShip", EnemyShip);
#endinitclip
Symbol 85 MovieClip [RewardPoints] Frame 1
#initclip 13
Object.registerClass("RewardPoints", RewardPoints);
#endinitclip
Symbol 87 MovieClip [MiniBoss] Frame 1
#initclip 14
Object.registerClass("MiniBoss", MiniBoss);
#endinitclip
Symbol 90 MovieClip [PowerUp] Frame 1
#initclip 15
Object.registerClass("PowerUp", PowerUp);
#endinitclip
Symbol 101 MovieClip [Boss] Frame 1
#initclip 16
Object.registerClass("Boss", Boss);
#endinitclip
Symbol 128 MovieClip [Ship] Frame 1
#initclip 17
Object.registerClass("Ship", Ship);
#endinitclip
Symbol 132 MovieClip [Background] Frame 1
#initclip 18
Object.registerClass("Background", Background);
#endinitclip
Symbol 157 MovieClip Frame 1
stop();
Symbol 159 MovieClip [__Packages.EnemyMissile] Frame 0
class EnemyMissile extends MovieClip
{
var speed, _x, yDirection, _y, hitTest, removeMovieClip;
function EnemyMissile () {
super();
}
function onLoad() {
speed = -15;
}
function onEnterFrame() {
_x = _x + speed;
if (yDirection) {
_y = _y + (yDirection * 4);
}
if (hitTest(_root.ship) && (_root.ship.shield._visible == false)) {
removeMovieClip();
_root.ship.updateHealth(-10);
_root.ship.initShake();
var _local3 = _root.attachMovie("SmallExplosion", "SmallExplosion" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
_local3._x = _root.ship._x;
_local3._y = _root.ship._y;
}
if (_x < 0) {
removeMovieClip();
}
}
}
Symbol 160 MovieClip [__Packages.Missile] Frame 0
class Missile extends MovieClip
{
var speed, _x, hitTest, removeMovieClip;
function Missile () {
super();
}
function onLoad() {
speed = 20;
_root.soundFX.attachSound("shoot_missile.wav");
_root.soundFX.start();
}
function onEnterFrame() {
_x = _x + speed;
for (var _local3 in _root.ship.enemies) {
if (hitTest(_root.ship.enemies[_local3])) {
removeMovieClip();
_root.ship.enemies[_local3].takeDamage();
}
}
if (_x > 600) {
removeMovieClip();
_root.ship.misses = _root.ship.misses + 1;
}
}
}
Symbol 161 MovieClip [__Packages.EnemyShip] Frame 0
class EnemyShip extends MovieClip
{
var yDirection, _x, _y, speed, shootTimer, removeMovieClip, hitTest;
function EnemyShip () {
super();
}
function onLoad() {
if (Math.random() < 0.4) {
yDirection = 1;
} else {
yDirection = 0;
}
_x = 700;
_y = (Math.random() * 200) + 50;
speed = (Math.random() * 3) + 3;
_root.ship.enemies.push(this);
shootTimer = Math.floor(Math.random() * 60);
}
function onEnterFrame() {
_x = _x - speed;
if (yDirection != 0) {
_y = _y + (yDirection * 3);
if ((yDirection == 1) && (_y > 275)) {
yDirection = -1;
} else if ((yDirection == -1) && (_y < 25)) {
yDirection = 1;
}
}
if (_x < -100) {
removeMovieClip();
}
if (hitTest(_root.ship)) {
explode();
if (_root.ship.shield._visible == false) {
_root.ship.updateHealth(-25);
}
var _local3 = _root.attachMovie("SmallExplosion", "SmallExplosion" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
_local3._x = _root.ship._x;
_local3._y = _root.ship._y;
}
shootTimer = shootTimer + 1;
if (shootTimer > 60) {
shootTimer = 0;
var _local4 = _root.attachMovie("EnemyMissile", "EnemyMissile" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
_local4._x = _x - 50;
_local4._y = _y + 2;
}
}
function takeDamage() {
explode();
}
function explode() {
var _local4 = _root.attachMovie("Explosion", "Explosion" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
_local4._x = _x;
_local4._y = _y;
_root.ship.updateScore(100);
_root.ship.kills = _root.ship.kills + 1;
var _local3 = _root.attachMovie("RewardPoints", "RewardPoints" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
_local3._x = _x;
_local3._y = _y;
_local3.field.text = 100;
_root.soundFX.attachSound("big_explosion.wav");
_root.soundFX.start();
removeMovieClip();
}
}
Symbol 162 MovieClip [__Packages.RewardPoints] Frame 0
class RewardPoints extends MovieClip
{
var _alpha, fadeDirection, fadeSpeed, removeMovieClip;
function RewardPoints () {
super();
}
function onLoad() {
_alpha = 25;
fadeDirection = 1;
fadeSpeed = 5;
}
function onEnterFrame() {
_alpha = _alpha + (fadeSpeed * fadeDirection);
if ((_alpha > 100) && (fadeDirection == 1)) {
fadeDirection = -1;
}
if (_alpha < 0) {
removeMovieClip();
}
}
}
Symbol 163 MovieClip [__Packages.MiniBoss] Frame 0
class MiniBoss extends MovieClip
{
var health, yDirection, _x, _y, speed, shootTimer, hitTest, removeMovieClip;
function MiniBoss () {
super();
}
function onLoad() {
health = 100;
_root.enemyHealthMeter._visible = true;
_root.enemyHealthMeter.bar._xscale = 100;
yDirection = 1;
_x = 700;
_y = (Math.random() * 200) + 50;
speed = 3;
_root.ship.enemies.push(this);
shootTimer = 0;
}
function onEnterFrame() {
if (_x > 400) {
_x = _x - speed;
}
_y = _y + (yDirection * 2);
if ((yDirection == 1) && (_y > 250)) {
yDirection = -1;
} else if ((yDirection == -1) && (_y < 50)) {
yDirection = 1;
}
if (hitTest(_root.ship)) {
_root.ship.updateHealth(-25);
var _local4 = _root.attachMovie("SmallExplosion", "SmallExplosion" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
_local4._x = _root.ship._x;
_local4._y = _root.ship._y;
}
shootTimer = shootTimer + 1;
if (shootTimer > 60) {
shootTimer = 0;
var _local3 = _root.attachMovie("MiniBossMissile", "MiniBossMissile" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
_local3._x = _x - 63;
_local3._y = _y - 8;
_local3 = _root.attachMovie("MiniBossMissile", "MiniBossMissile" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
_local3._x = _x - 63;
_local3._y = _y - 8;
_local3.yDirection = -1;
_local3 = _root.attachMovie("MiniBossMissile", "MiniBossMissile" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
_local3._x = _x - 63;
_local3._y = _y - 8;
_local3.yDirection = 1;
}
}
function takeDamage() {
health = health - 10;
_root.enemyHealthMeter.bar._xscale = health;
if (health <= 0) {
explode();
}
}
function explode() {
_root.enemyHealthMeter._visible = false;
var _local3 = _root.attachMovie("Explosion", "Explosion" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
_local3._x = _x;
_local3._y = _y;
_local3 = _root.attachMovie("Explosion", "Explosion" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
_local3._x = _x + 30;
_local3._y = _y - 10;
_local3 = _root.attachMovie("Explosion", "Explosion" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
_local3._x = _x - 40;
_local3._y = _y - 5;
_root.ship.updateScore(1000);
_root.ship.kills = _root.ship.kills + 1;
var _local4 = _root.attachMovie("RewardPoints", "RewardPoints" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
_local4._x = _x;
_local4._y = _y;
_local4.field.text = 1000;
_root.soundFX.attachSound("big_explosion.wav");
_root.soundFX.start();
removeMovieClip();
_root.ship.miniBossTimer = 0;
}
}
Symbol 164 MovieClip [__Packages.PowerUp] Frame 0
class PowerUp extends MovieClip
{
var speed, type, _x, _y, _rotation, hitTest, removeMovieClip;
function PowerUp () {
super();
}
function onLoad() {
_root.soundFX.attachSound("beepx3.mp3");
_root.soundFX.start();
speed = 2;
type = Math.floor((Math.random() * 3) + 1);
_x = 650;
_y = (Math.random() * 200) + 50;
}
function onEnterFrame() {
_x = _x - speed;
_rotation = _rotation - 5;
if (hitTest(_root.ship)) {
var _local4;
if (type == 1) {
_root.ship.updateHealth(100 - _root.ship.health);
_local4 = "health";
_root.soundFX.attachSound("bling.mp3");
_root.soundFX.start();
}
if (type == 2) {
_root.ship.damageAllEnemies();
_local4 = "nuke";
_root.soundFX.attachSound("very_big_explosion.wav");
_root.soundFX.start();
}
if (type == 3) {
_root.ship.shield._visible = true;
_local4 = "shield";
_root.soundFX.attachSound("energy.mp3");
_root.soundFX.start();
}
var _local3 = _root.attachMovie("RewardPoints", "RewardPoints" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
_local3._x = _x;
_local3._y = _y;
_local3.field.text = _local4;
removeMovieClip();
}
if (_x < -30) {
removeMovieClip();
}
}
}
Symbol 165 MovieClip [__Packages.Boss] Frame 0
class Boss extends MovieClip
{
var health, yDirection, _x, _y, speed, shootTimer, hitTest, removeMovieClip;
function Boss () {
super();
}
function onLoad() {
health = 100;
_root.enemyHealthMeter._visible = true;
_root.enemyHealthMeter.bar._xscale = 100;
yDirection = 1;
_x = 700;
_y = (Math.random() * 200) + 50;
speed = 3;
_root.ship.enemies.push(this);
shootTimer = 0;
}
function onEnterFrame() {
if (_x > 425) {
_x = _x - speed;
}
_y = _y + yDirection;
if ((yDirection == 1) && (_y > 250)) {
yDirection = -1;
} else if ((yDirection == -1) && (_y < 50)) {
yDirection = 1;
}
if (hitTest(_root.ship)) {
_root.ship.updateHealth(-25);
var _local4 = _root.attachMovie("SmallExplosion", "SmallExplosion" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
_local4._x = _root.ship._x;
_local4._y = _root.ship._y;
}
shootTimer = shootTimer + 1;
if (shootTimer > 60) {
shootTimer = 0;
var _local3 = _root.attachMovie("MiniBossMissile", "MiniBossMissile" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
_local3._x = _x - 110;
_local3._y = _y - 35;
_local3 = _root.attachMovie("MiniBossMissile", "MiniBossMissile" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
_local3._x = _x - 110;
_local3._y = _y - 35;
_local3.yDirection = -1;
_local3 = _root.attachMovie("MiniBossMissile", "MiniBossMissile" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
_local3._x = _x - 110;
_local3._y = _y - 35;
_local3.yDirection = 1;
_local3 = _root.attachMovie("MiniBossMissile", "MiniBossMissile" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
_local3._x = _x - 125;
_local3._y = _y + 45;
}
}
function takeDamage() {
health = health - 5;
_root.enemyHealthMeter.bar._xscale = health;
if (health <= 0) {
explode();
}
}
function explode() {
_root.enemyHealthMeter._visible = false;
var _local3 = _root.attachMovie("Explosion", "Explosion" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
_local3._x = _x;
_local3._y = _y;
_local3 = _root.attachMovie("Explosion", "Explosion" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
_local3._x = _x + 30;
_local3._y = _y - 10;
_local3 = _root.attachMovie("Explosion", "Explosion" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
_local3._x = _x - 40;
_local3._y = _y - 5;
_root.ship.updateScore(10000);
_root.ship.kills = _root.ship.kills + 1;
var _local4 = _root.attachMovie("RewardPoints", "RewardPoints" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
_local4._x = _x;
_local4._y = _y;
_local4.field.text = 10000;
_root.soundFX.attachSound("very_big_explosion.wav");
_root.soundFX.start();
removeMovieClip();
_root.ship.winGame();
}
}
Symbol 166 MovieClip [__Packages.Ship] Frame 0
class Ship extends MovieClip
{
var _visible, kills, misses, velocity, shootLimiter, powerUpTimer, enemyTimer, miniBossTimer, bossCountdown, enemies, score, health, _x, _y, shield, shaking, shakeDuration, _rotation, finalScore;
function Ship () {
super();
}
function onLoad() {
_root.kongregateServices.connect();
_root.soundFX = new Sound();
_root.soundFX.attachSound("very_big_explosion.wav");
_root.soundFX.start();
_visible = false;
_root.gameOverMenu._visible = false;
_root.healthMeter._visible = false;
_root.enemyHealthMeter._visible = false;
_root.playMenu.playButton.onPress = function () {
_root.ship.newGame();
};
}
function newGame() {
_root.playMenu._visible = false;
_root.gameOverMenu._visible = false;
_root.enemyHealthMeter._visible = false;
kills = 0;
misses = 0;
velocity = 10;
shootLimiter = 0;
powerUpTimer = 0;
enemyTimer = 0;
miniBossTimer = 0;
bossCountdown = 2;
enemies = [];
score = 0;
_root.scoreText.text = score;
health = 100;
_root.healthMeter._visible = true;
_root.healthMeter.bar._xscale = 100;
_x = 300;
_y = 150;
_visible = true;
shield._visible = false;
shaking = false;
shakeDuration = 10;
_rotation = 0;
}
function onEnterFrame() {
if (_visible == true) {
if (Key.isDown(37) && (_x > 40)) {
_x = _x - velocity;
}
if (Key.isDown(39) && (_x < 560)) {
_x = _x + velocity;
}
if (Key.isDown(38) && (_y > 20)) {
_y = _y - velocity;
}
if (Key.isDown(40) && (_y < 280)) {
_y = _y + velocity;
}
shootLimiter = shootLimiter + 1;
if (Key.isDown(32) && (shootLimiter > 8)) {
var _local3 = _root.attachMovie("Missile", "Missile" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
_local3._x = _x + 50;
_local3._y = _y + 2;
shootLimiter = 0;
}
if (shaking == true) {
shake();
}
if (shield._visible == true) {
shield._alpha = shield._alpha - 0.5;
if (shield._alpha < 0) {
shield._visible = false;
shield._alpha = 100;
}
}
enemyTimer = enemyTimer + 1;
if (enemyTimer > 30) {
enemyTimer = 0;
_root.attachMovie("EnemyShip", "EnemyShip" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
}
powerUpTimer = powerUpTimer + 1;
if (powerUpTimer > 300) {
powerUpTimer = 0;
_root.attachMovie("PowerUp", "PowerUp" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
}
miniBossTimer = miniBossTimer + 1;
if (miniBossTimer == 900) {
if (!_root.miniBoss) {
if (bossCountdown == 0) {
_root.attachMovie("Boss", "boss", _root.getNextHighestDepth());
} else {
_root.attachMovie("MiniBoss", "miniBoss", _root.getNextHighestDepth());
bossCountdown = bossCountdown - 1;
}
}
}
}
}
function updateScore(points) {
score = score + points;
_root.scoreText.text = score;
}
function updateHealth(points) {
if (_visible == true) {
health = health + points;
_root.healthMeter.bar._xscale = health;
_root.soundFX.attachSound("small_explosion.wav");
_root.soundFX.start();
if (health <= 0) {
health = 0;
_root.healthMeter.bar._xscale = health;
explode();
}
}
}
function explode() {
var _local3 = _root.attachMovie("Explosion", "Explosion" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
_local3._x = _x;
_local3._y = _y;
_visible = false;
_root.soundFX.attachSound("very_big_explosion.wav");
_root.soundFX.start();
destroyAllEnemies();
gameOver();
}
function destroyAllEnemies() {
var _local2 = 0;
while (_local2 < enemies.length) {
enemies[_local2].explode();
_local2++;
}
}
function damageAllEnemies() {
var _local2 = 0;
while (_local2 < enemies.length) {
enemies[_local2].takeDamage();
_local2++;
}
}
function winGame() {
_root.kongregateStats.submit("GameWon", 1);
_root.missionCompletedBanner.gotoAndPlay(2);
_visible = false;
destroyAllEnemies();
gameOver();
}
function gameOver() {
_root.gameOverMenu._visible = true;
_root.gameOverMenu.playAgainButton.onPress = function () {
_root.ship.newGame();
};
_root.gameOverMenu.killBonus.text = (kills + " x ") + 100;
_root.gameOverMenu.hitBonus.text = (Math.floor((kills / (misses + kills)) * 100) + " x ") + 100;
finalScore = (score + (kills * 100)) + (Math.floor((kills / (misses + kills)) * 100) * 100);
_root.gameOverMenu.finalScore.text = finalScore;
_root.kongregateScores.submit(finalScore);
_root.kongregateStats.submit("Kills", kills);
}
function initShake() {
shaking = true;
shakeDuration = 10;
_rotation = 5;
}
function shake() {
_rotation = _rotation * -1;
shakeDuration = shakeDuration - 1;
if (shakeDuration == 0) {
shaking = false;
_rotation = 0;
}
}
}
Symbol 167 MovieClip [__Packages.Background] Frame 0
class Background extends MovieClip
{
var _x;
function Background () {
super();
}
function onEnterFrame() {
_x = _x - 1;
if (_x < -1723) {
_x = 0;
}
}
}