[Tools][Expand/Collapse All]Note that automatic extraction of ActionScript 3 is still pretty much unsupported by swfchan. AS1/AS2 works okay most of the time.Frame 1 (367 B)
myBackgroundSound = new Sound();
myBackgroundSound.loadSound("http://audio.ngfiles.com/109000/109650_Operation_Evolution.mp3", true);
myBackgroundSound.start;
muted = false;
myMuteButton.onRelease = function () {
if (muted == false) {
myBackgroundSound.setVolume(0);
muted = true;
} else {
myBackgroundSound.setVolume(100);
muted = false;
}
};
Symbol 3 MovieClip [Explosion] Frame 1 (74 B)
#initclip 20
Object.registerClass("Explosion", Explosion);
#endinitclip
Symbol 6 MovieClip [Missile] Frame 1 (70 B)
#initclip 11
Object.registerClass("Missile", Missile);
#endinitclip
Symbol 9 MovieClip [EnemyShip] Frame 1 (74 B)
#initclip 12
Object.registerClass("EnemyShip", EnemyShip);
#endinitclip
Symbol 12 MovieClip [EnemyMissile] Frame 1 (80 B)
#initclip 13
Object.registerClass("EnemyMissile", EnemyMissile);
#endinitclip
Symbol 15 MovieClip [PowerUp] Frame 1 (70 B)
#initclip 14
Object.registerClass("PowerUp", PowerUp);
#endinitclip
Symbol 18 MovieClip [MiniBoss] Frame 1 (72 B)
#initclip 15
Object.registerClass("MiniBoss", MiniBoss);
#endinitclip
Symbol 21 MovieClip [Boss] Frame 1 (64 B)
#initclip 16
Object.registerClass("Boss", Boss);
#endinitclip
Symbol 24 MovieClip [RewardPoints] Frame 1 (80 B)
#initclip 17
Object.registerClass("RewardPoints", RewardPoints);
#endinitclip
Symbol 31 MovieClip [Ship] Frame 1 (64 B)
#initclip 18
Object.registerClass("Ship", Ship);
#endinitclip
Symbol 38 MovieClip [Background] Frame 1 (76 B)
#initclip 19
Object.registerClass("Background", Background);
#endinitclip
Symbol 62 MovieClip [__Packages.Missile] Frame 0 (563 B)
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 63 MovieClip [__Packages.EnemyShip] Frame 0 (1.92 KiB) ●
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 > 70) {
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 64 MovieClip [__Packages.EnemyMissile] Frame 0 (712 B)
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 65 MovieClip [__Packages.PowerUp] Frame 0 (1.25 KiB) ●
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 66 MovieClip [__Packages.MiniBoss] Frame 0 (2.71 KiB) ●
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.barr._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 67 MovieClip [__Packages.Boss] Frame 0 (2.66 KiB) ●
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("BossMissile", "BossMissile" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
_local3._x = _x + 100;
_local3._y = _y;
_local3 = _root.attachMovie("BossMissile", "BossMissile" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
_local3._x = _x + 100;
_local3._y = _y;
_local3.yDirection = -1;
_local3 = _root.attachMovie("BossMissile", "BossMissile" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
_local3._x = _x + 100;
_local3._y = _y;
_local3.yDirection = 1;
}
}
function takeDamage() {
health = health - 5;
_root.enemyHealthMeter.barr._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 68 MovieClip [__Packages.RewardPoints] Frame 0 (450 B)
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 69 MovieClip [__Packages.Ship] Frame 0 (5.09 KiB) ● ●
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.missionCompletedBanner._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 + 80;
_local3._y = _y - 10;
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 > 15) {
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._visible = true;
_visible = false;
destroyAllEnemies();
_root.missionCompletedBanner.EndGameButton.onPress = function () {
_root.missionCompletedBanner._visible = false;
_root.ship.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 70 MovieClip [__Packages.Background] Frame 0 (183 B)
class Background extends MovieClip
{
var _x;
function Background () {
super();
}
function onEnterFrame() {
_x = _x - 6;
if (_x < -1055) {
_x = 0;
}
}
}
Symbol 71 MovieClip [__Packages.Explosion] Frame 0 (234 B)
class Explosion extends MovieClip
{
var _totalframes, _currentframe, removeMovieClip;
function Explosion () {
super();
}
function onEnterFrame() {
if (_currentframe == _totalframes) {
removeMovieClip();
}
}
}