Frame 1
function gameMenu(menu, obj) {
getURL (_root.authorsSite, "_blank");
}
_root.externalMusic = 0;
_root.gameTitle = "planetX";
_root.gameDesc = "SpaceCave exploration on an Alien planet";
_root.vNum = "v1.1";
_root.flashVersionsNeeded = 7;
_root.legalDomain = "http://terrypaton.dynalias.com";
_root.authorName = "Terry Paton";
_root.authorContact = "terry@terrypaton.com";
_root.authorsSite = "http://www.terrypaton.com";
_root.gameLocation = _root._url.substr(0, legalDomain.length);
_root.gameQuality = "HIGH";
var menu_cm = new ContextMenu();
menu_cm.customItems.push(new ContextMenuItem(gameTitle, gameMenu));
menu_cm.hideBuiltInItems();
_root.menu = menu_cm;
fscommand ("fullscreen", true);
Instance of Symbol 143 MovieClip in Frame 4
onClipEvent (load) {
var flashVersion = System.capabilities.version;
_root.flashVersionsinstalled = flashVersion.substr(4, 1);
if (_root.flashVersionsNeeded > _root.flashVersionsinstalled) {
_root.stop();
this.gotoAndStop(2);
}
trace(_root.gameLocation);
trace(_root.legalDomain);
if (_root.gameLocation != _root.legalDomain) {
_root.stop();
this.gotoAndStop(3);
}
}
Frame 5
level1data = new Array("player", 565, -45, 0, "fuelPad", 563, -11, 0, "fuelPad", 553, 920, 0, "escapePod", 105, 890, 0, "escapePod", 460, 254, 0, "escapePod", 547, 559, 0, "shieldCharge", 608, 253, 0, "shieldCharge", 830, 846, 0, "mine", 816, 243, 3, "miniCollect", 135, 514, 1, "miniCollect", 209, 612, 1, "miniCollect", 288, 690, 1, "miniCollect", 384, 745, 1);
level2data = new Array("player", 143, -150, 0, "fuelPad", 143, -122, 0, "fuelPad", -22, 1529, 0, "shieldCharge", 83, 1411, 0, "shieldCharge", 1145, 1436, 0, "shieldCharge", 108, 333, 0, "mine", -196, 858, 2, "mine", 1079, 926, 2, "mine", 541, 1438, 1, "mine", 541, 335, 1, "escapePod", -209, 774, 0, "escapePod", -30, 1293, 0, "escapePod", -350, 915, 0, "escapePod", 828, 1425, 0, "escapePod", 224, 423, 0, "escapePod", 828, 322, 0, "escapePod", 1125, 804, 0, "miniCollect", 448, 550, 1, "miniCollect", 597, 662, 1, "miniCollect", 481, 888, 1, "miniCollect", 597, 1050, 1, "miniCollect", 490, 1206, 1, "miniCollect", 718, 1540, 1, "miniCollect", 957, 825, 2, "miniCollect", 1273, 825, 3);
level3data = new Array("player", 817, -200, 0, "fuelPad", 817, -151, 0, "fuelPad", 207, 829, 0, "fuelPad", -105, 1845, 0, "escapePod", -253, 285, 0, "escapePod", -288, 805, 0, "escapePod", 299, 805, 0, "escapePod", 1077, 217, 0, "escapePod", 274, 1623, 0, "escapePod", -66, 1719, 0, "escapePod", 1160, 1898, 0, "miniCollect", 258, 132, 0, "miniCollect", 454, 260, 0, "miniCollect", 940, 217, 0, "miniCollect", 1177, 217, 0, "miniCollect", 1065, 498, 0, "miniCollect", 938, 606, 0, "miniCollect", 1088, 787, 0, "miniCollect", 925, 787, 0, "miniCollect", 571, 787, 0, "miniCollect", -175, 715, 0, "miniCollect", -218, 863, 0, "miniCollect", -207, 1269, 0, "miniCollect", -104, 1218, 0, "miniCollect", -134, 1332, 0, "miniCollect", 180, 1229, 0, "miniCollect", 648, 1294, 0, "miniCollect", 880, 1253, 0, "miniCollect", 985, 1313, 0, "miniCollect", 1166, 1799, 0, "miniCollect", -200, 1639, 0, "shieldCharge", -140, 192, 0, "shieldCharge", -165, 339, 0, "shieldCharge", -42, 1234, 0, "shieldCharge", 130, 1789, 0, "shieldCharge", 1088, 1860, 0, "shieldCharge", 1231, 1885, 0, " mine", 63, 272, 2, "mine", 1050, 326, 1, "mine", -4, 807, 2, "mine", 530, 1127, 3, "mine", 998, 1507, 3, "mine", 11, 1706, 1);
level4data = new Array("player", 336, -235, 0, "mine", 1175, -75, 3, "mine", -123, 487, 2, "mine", 398, 774, 1, "mine", 1171, 448, 1, "mine", 1236, 650, 1, "mine", 838, 984, 2, "mine", 316, 1372, 1, "mine", 1074, 1555, 2, "mine", -206, 1624, 2, "mine", 230, 2036, 3, "shieldCharge", 298, 936, 0, "shieldCharge", 1418, 678, 0, "shieldCharge", 1274, 1422, 0, "shieldCharge", 255, 1488, 0, "shieldCharge", 638, 2202, 0, "shieldCharge", 905, 2226, 0, "shieldCharge", 588, 344, 0, "fuelPad", 336, -162, 0, "fuelPad", 872, 632, 0, "fuelPad", 1322, 1532, 0, "fuelpad", 4, 2220, 0, "escapePod", 598, 298, 0, "escapePod", 1264, 366, 0, "escapePod", 828, 531, 0, "escapePod", 182, 852, 0, "escapePod", 1366, 1000, 0, "escapePod", -144, 1376, 0, "escapePod", 110, 1204, 0, "escapePod", 340, 1204, 0, "escapePod", 825, 1324, 0, "escapePod", 1158, 1488, 0, "escapePod", NaN, NaN, 0, "escapePod", 915, 2294, 0, "escapePod", 790, 1880, 0, "escapePod", 86, 1840, 0, "escapePod", -278, 2168, 0, "miniCollect", -25, 107, 0, "miniCollect", -133, 246, 0, "miniCollect", -60, 420, 0, "miniCollect", -196, 569, 0, "miniCollect", -158, 887, 0, "miniCollect", -268, 1073, 0, "miniCollect", -133, 1257, 0, "miniCollect", -268, 1595, 0, "miniCollect", -179, 1845, 0, "miniCollect", -289, 1981, 0, "miniCollect", -171, 2179, 0, "miniCollect", 135, 1893, 0, "miniCollect", 385, 2049, 0, "miniCollect", 424, 1553, 0, "miniCollect", 469, 1376, 0, "miniCollect", 1246, 942, 0, "miniCollect", 1299, 887, 0, "miniCollect", 1366, 852, 0, "miniCollect", 1438, 832, 0, "miniCollect", 1068, 562, 0, "miniCollect", 1038, 496, 0, "miniCollect", 994, 449, 0, "miniCollect", 958, 409, 0, "miniCollect", 315, 688, 0, "miniCollect", 399, 544, 0, "miniCollect", 315, 449, 0, "miniCollect", 255, 349, 0, "miniCollect", 255, 211, 0, "miniCollect", 315, 129, 0, "miniCollect", 983, 129, 0, "miniCollect", 983, 69, 0, "miniCollect", 1031, 70, 0, "miniCollect", 1036, 115, 0, "miniCollect", 1063, 26, 0);
level5data = new Array("player", 390, -205, 0, "shieldCharge", 211, 297, 0, "shieldCharge", 1210, 346, 0, "shieldCharge", 892, 712, 0, "shieldCharge", -223, 839, 0, "shieldCharge", 1200, 1791, 0, "shieldCharge", -101, 1902, 0, "fuelPad", 394, -162, 0, "fuelPad", 420, 644, 0, "fuelPad", 339, 1386, 0, "fuePad", 1122, 2119, 0, "miniCollect", 1087, 262, 0, "miniCollect", 1175, 432, 0, "miniCollect", 1234, 564, 0, "miniCollect", 1234, 720, 0, "miniCollect", 1288, 860, 0, "miniCollect", 563, 915, 0, "miniCollect", 683, 1048, 0, "miniCollect", 744, 1211, 0, "miniCollect", -182, 1160, 0, "miniCollect", -36, 1451, 0, "miniCollect", 77, 1623, 0, "miniCollect", 321, 1705, 0, "miniCollect", 648, 1572, 0, "escapePod", 396, 297, 0, "escapePod", -11, 644, 0, "escapePod", 411, 1226, 0, "escapePod", 1323, 1186, 0, "escapePod", 658, 2030, 0, "escapePod", 270, 2070, 0, "escapePod", -2, 2070, 0, "escapePod", -328, 2228, 0, "escapePod", -464, 2180, 0, "mine", 0, 298, 2, "mine", 922, 214, 2, "mine", -244, 942, 1, "mine", 1196, 1096, 1, "mine", 731, 1380, 2, "mine", 1162, 1455, 1, "mine", -271, 1743, 3, "mine", -454, 2043, 2);
Frame 6
escapeCSnd = new Sound();
escapeCSnd.attachSound("escapeC_Snd");
playerExplosionSnd = new Sound();
playerExplosionSnd.attachSound("playerExplosion_Snd");
damageSnd = new Sound();
damageSnd.attachSound("damage_Snd");
refuelSnd = new Sound();
refuelSnd.attachSound("refuel_Snd");
gameOverSnd = new Sound();
gameOverSnd.attachSound("gameOver_Snd");
flameSnd = new Sound();
flameSnd.attachSound("flame_Snd");
lowFuelSnd = new Sound();
lowFuelSnd.attachSound("lowFuel_Snd");
thrustSnd = new Sound();
thrustSnd.attachSound("thrust_Snd");
outOfFuelSnd = new Sound();
outOfFuelSnd.attachSound("outOfFuel_Snd");
pointCollectSnd = new Sound();
pointCollectSnd.attachSound("pointCollect_Snd");
extralife_snd = new Sound();
extralife_snd.attachSound("sound10");
if (_root.externalMusic == 0) {
intromusic = new Sound();
intromusic.attachSound("intromusic");
gamefinishedmusic = new Sound();
gamefinishedmusic.attachSound("intromusic");
} else {
var intromusic = new Sound();
var optionsmusic = new Sound();
var music1 = new Sound();
var music2 = new Sound();
var music3 = new Sound();
var gamefinishedmusic = new Sound();
var gameovermusic = new Sound();
music1.loadSound("audio/music/music_1.mp3", false);
music2.loadSound("audio/music/music_2.mp3", false);
music3.loadSound("audio/music/music_3.mp3", false);
gamefinishedmusic.loadSound("audio/music/game_finished_music.mp3", false);
intromusic.loadSound("audio/music/intro_music.mp3", false);
gameovermusic.loadSound("audio/music/game_over_music.mp3", false);
optionsmusic.loadSound("audio/music/options_music.mp3", false);
}
Frame 7
function stopmusic() {
music1.stop();
music2.stop();
music3.stop();
optionsmusic.stop();
intromusic.stop();
gameovermusic.stop();
gamefinishedmusic.stop();
}
function playmusic() {
if (musicstate == 1) {
stopmusic();
trace("playing music");
switch (gameScene) {
case "INTRO" :
intromusic.start(0, 90);
return;
case "GAME" :
return;
case "GAME OVER" :
return;
case "OPTIONS" :
return;
case "HOW TO PLAY" :
return;
case "GAME FINISHED" :
gamefinishedmusic.start(0, 90);
return;
}
}
}
storage = SharedObject.getLocal("store");
level = storage.data.uptolevel;
if (level == undefined) {
storage.data.uptolevel = 1;
level = 1;
}
yourhigh = storage.data.myhighscore;
if (yourhigh == undefined) {
storage.data.myhighscore = 0;
yourhigh = 0;
}
musicstate = storage.data.musicsetting;
if ((musicstate == undefined) || (musicstate == 2)) {
musicstate = 1;
storage.data.musicsetting = 1;
}
Frame 8
function musicon() {
this.options.on_off.gotoAndStop(1);
musicstate = 1;
storage.data.musicsetting = 1;
playmusic();
}
function musicoff() {
stopmusic();
this.options.on_off.gotoAndStop(2);
musicstate = 0;
storage.data.musicsetting = 0;
}
function playgame() {
gotoAndPlay (17);
}
function resetlevel() {
playcont.gotoAndStop(1);
_root.resetclip.gotoAndPlay(2);
storage.data.myhighscore = 0;
yourhigh = 0;
storage.flush();
}
if (musicstate == 0) {
this.options.on_off.gotoAndStop(2);
}
delete state;
_quality = "HIGH";
gameScene = "INTRO";
playmusic();
Frame 16
stop();
Frame 17
function testiflifelost() {
if (playerHealth < 0) {
playerHealth = 0;
player.gotoAndPlay("lifelost");
n = getNextHighestDepth();
displayHolder.attachMovie("lifelost", "ll", n);
displayHolder.ll._x = 320;
displayHolder.ll._y = 150;
landScape.thrustClip.thrustRightClip._visible = false;
landScape.thrustClip.thrustLeftClip._visible = false;
landScape.thrustClip.thrustUpClip._visible = false;
landScape.thrustClip.thrustDownClip._visible = false;
attachMovie("playerExplosion", "playerExplosion", 7);
playerExplosion._x = 320;
playerExplosion._y = 230;
playerExplosionSnd.start();
lives--;
if (lives < 0) {
trace("game over");
state = "game over";
} else {
state = "paused";
}
}
this.lifeMeter_clip.life_bar_clip._xscale = playerHealth;
}
function playerHitsMine() {
damageSnd.start();
mineDamage = 1.5;
playerHealth = playerHealth - mineDamage;
reduceScore();
player.playerHitClip.gotoAndPlay(2);
testiflifelost();
}
function playerHitsFlame() {
damageSnd.start();
flameDamage = 1.5;
reduceScore();
playerHealth = playerHealth - flameDamage;
testiflifelost();
player.playerHitClip.gotoAndPlay(2);
}
function reduceScore() {
score--;
if (score < 0) {
score = 0;
}
}
function playerHitsLand(whereHit) {
player.playerHitClip.gotoAndPlay(2);
wallDamage = 1;
reduceScore();
damageSnd.start();
playerYspeed = 0;
if (whereHit == "left") {
px = px + 10;
playerHealth = playerHealth - wallDamage;
}
if (whereHit == "right") {
px = px - 5;
playerHealth = playerHealth - wallDamage;
}
if (whereHit == "bottom") {
py = py - 10;
addThrust = 2;
playerHealth = playerHealth - wallDamage;
}
if (whereHit == "top") {
py = py + 10;
addThrust = 0;
playerYspeed = 0.5;
playerHealth = playerHealth - wallDamage;
}
testiflifelost();
}
function flameClass() {
}
flameClass.prototype = new MovieClip();
flameClass.prototype.onLoad = function () {
this.flameCount = 0;
this.flameDelay = 49;
};
flameClass.prototype.onEnterFrame = function () {
if (_root.state == "paused") {
}
if (this.state == "remove") {
removeMovieClip(this);
}
if (_root.state == "playing") {
if (this.hitTest(_root.player) == true) {
playerHitsFlame();
}
this.flameCount++;
if (this.flameCount > this.flameDelay) {
removeMovieClip(this);
}
}
};
Object.registerClass("volcanoflame", flameClass);
function volcanoClass() {
}
volcanoClass.prototype = new MovieClip();
volcanoClass.prototype.onLoad = function () {
this.startDelay = random(50) + 1;
this.sDelayCount = 0;
this.state = "setup";
this.x = this._x;
this.y = this._y;
this.eruptCount = 0;
this.eruptDelay = random(70) + 50;
this.gotoAndStop(this.clip.moveType);
switch (this.clip.moveType) {
case 1 :
break;
case 2 :
this._rotation = -90;
break;
case 3 :
this._rotation = 90;
break;
case 4 :
this._rotation = -180;
break;
}
};
volcanoClass.prototype.onEnterFrame = function () {
if (_root.state == "paused") {
}
if (this.state == "remove") {
removeMovieClip(this);
}
if (_root.state == "playing") {
if (this.state == "setup") {
this.sDelayCount++;
if (this.sDelayCount > this.startDelay) {
this.state = "normal";
}
}
if (this.state == "normal") {
this.eruptCount++;
if (this.eruptCount > this.eruptDelay) {
this.eruptCount = 0;
this.clip.attachMovie("volcanoFlame", "flame", 1);
flameSnd.start();
}
}
}
};
Object.registerClass("volcano", volcanoClass);
function miniTellPlayerClass() {
}
miniTellPlayerClass.prototype = new MovieClip();
miniTellPlayerClass.prototype.onLoad = function () {
this._x = px;
this._y = py - 30;
};
miniTellPlayerClass.prototype.onEnterFrame = function () {
if (_root.state == "paused") {
}
if (_root.state == "playing") {
this._alpha = this._alpha - 3;
if (this._alpha < 3) {
removeMovieClip(this);
}
}
};
Object.registerClass("miniTellPlayer", miniTellPlayerClass);
function mineClass() {
}
mineClass.prototype = new MovieClip();
mineClass.prototype.onLoad = function () {
this._rotation = random(360);
this.x = this._x;
this.y = this._y;
this.startx = this.x;
this.starty = this.y;
this.maxSpeed = 5;
this.yspeed = 0;
this.xspeed = 0;
this.moveDistance = 0;
switch (this.clip.moveType) {
case 1 :
this.x = this.startx + (100 * Math.sin(this.moveDistance));
this.y = this.starty + (100 * Math.cos(this.moveDistance));
break;
case 2 :
this.x = this.startx + (150 * Math.cos(this.moveDistance));
break;
case 3 :
this.y = this.starty + (100 * Math.sin(this.moveDistance));
break;
case 4 :
this.x = this.startx + (100 * Math.sin(this.moveDistance));
this.x = this.startx + (100 * Math.sin(this.moveDistance));
break;
case 5 :
this.x = this.startx + (100 * Math.sin(this.moveDistance));
this.y = this.starty + (100 * Math.cos(this.moveDistance));
break;
case 6 :
break;
}
this._x = int(this.x);
this._y = int(this.y);
};
mineClass.prototype.onEnterFrame = function () {
if (_root.state == "paused") {
}
if (_root.state == "playing") {
if (Math.abs(this.x - px) < 380) {
if (Math.abs(this.y - py) < 300) {
switch (this.clip.moveType) {
case 1 :
this.moveDistance = this.moveDistance + 0.05;
this.x = this.startx + (100 * Math.sin(this.moveDistance));
this.y = this.starty + (100 * Math.cos(this.moveDistance));
break;
case 2 :
this.moveDistance = this.moveDistance + 0.025;
this.x = this.startx + (150 * Math.cos(this.moveDistance));
break;
case 3 :
this.moveDistance = this.moveDistance + 0.05;
this.y = this.starty + (100 * Math.sin(this.moveDistance));
break;
case 4 :
this.moveDistance = this.moveDistance + 0.05;
this.x = this.startx + (100 * Math.sin(this.moveDistance));
this.x = this.startx + (100 * Math.sin(this.moveDistance));
break;
case 5 :
this.moveDistance = this.moveDistance + 0.05;
this.x = this.startx + (100 * Math.cos(this.moveDistance));
this.y = this.starty + (100 * Math.cos(this.moveDistance));
break;
case 6 :
this.moveDistance = this.moveDistance + 0.05;
this.x = this.startx - (100 * Math.sin(this.moveDistance));
this.y = this.starty + (100 * Math.cos(this.moveDistance));
break;
}
}
}
if (this.hitTest(_root.player) == true) {
playerHitsMine();
}
this._x = int(this.x);
this._y = int(this.y);
}
};
Object.registerClass("mine_Clip", mineClass);
function stopThrust() {
thrusting = 0;
trace("addthrust");
}
function startThrust() {
thrusting = 1;
trace("stop adding thrust");
}
function exitPadClass() {
}
exitPadClass.prototype = new MovieClip();
exitPadClass.prototype.onLoad = function () {
this.x = this._x;
this.y = this._y;
this.startx = this.x;
this.starty = this.y;
};
exitPadClass.prototype.onEnterFrame = function () {
if (_root.state == "paused") {
}
if (_root.state == "playing") {
this.ty = Math.abs(py - (this.y - 15));
if (this.ty < 15) {
this.tx = Math.abs(px - this.x);
if (this.tx < 20) {
px = this.x;
leftThrust = 0;
rightThrust = 0;
playerFuel = playerFuel + 0.15;
thrusting = 0;
addThrust = 0;
if (playerYspeed > 0) {
playerYspeed = 0;
}
playerState = "refueling";
if (playerFuel > 100) {
playerFuel = 100;
}
}
}
}
};
Object.registerClass("exitPad", exitPadClass);
function fuelPadClass() {
}
fuelPadClass.prototype = new MovieClip();
fuelPadClass.prototype.onLoad = function () {
this.x = this._x;
this.y = this._y;
this.startx = this.x;
this.starty = this.y;
this.c = 0;
this.d = 15;
};
fuelPadClass.prototype.onEnterFrame = function () {
if (_root.state == "paused") {
}
if (_root.state == "playing") {
this.ty = Math.abs(py - (this.y - 15));
if (this.ty < 15) {
this.tx = Math.abs(px - this.x);
if (this.tx < 20) {
px = this.x;
leftThrust = 0;
rightThrust = 0;
playerFuel = playerFuel + 0.25;
thrusting = 0;
addThrust = 0;
if (playerYspeed > 0) {
playerYspeed = 0;
}
playerState = "refueling";
if (playerFuel > 100) {
playerFuel = 100;
}
if (playerFuel < 100) {
this.c++;
if (this.c > this.d) {
this.c = 0;
refuelSnd.start();
}
}
}
}
}
};
Object.registerClass("fuelPad", fuelPadClass);
function miniCollectClass() {
}
miniCollectClass.prototype = new MovieClip();
miniCollectClass.prototype.onLoad = function () {
this.x = this._x;
this.y = this._y;
this.state = "normal";
};
miniCollectClass.prototype.onEnterFrame = function () {
if (_root.state == "paused") {
}
if (_root.state == "playing") {
if (this.state == "normal") {
if (this.hitTest(_root.player) == true) {
miniCollected(this.clip.typeOf);
this.state = "start collected";
}
}
if (this.state == "start collected") {
this.counter = 15;
this.state = "collected wait";
this.clip.gotoAndPlay(2);
}
if (this.state == "collected wait") {
this.counter--;
this._alpha = this._alpha - 5;
if (this.counter < 1) {
removeMovieClip(this);
}
}
}
};
Object.registerClass("miniCollect", miniCollectClass);
function escapepodClass() {
}
escapepodClass.prototype = new MovieClip();
escapepodClass.prototype.onLoad = function () {
this.x = this._x;
this.y = this._y;
this.state = "normal";
};
escapepodClass.prototype.onEnterFrame = function () {
if (_root.state == "paused") {
}
if (_root.state == "playing") {
if (this.state == "normal") {
if (this.hitTest(_root.player) == true) {
podCollected();
this.state = "start collected";
escapeCSnd.start();
}
}
if (this.state == "start collected") {
this.counter = 15;
this.state = "collected wait";
this.gotoAndPlay(2);
}
if (this.state == "collected wait") {
this.counter--;
this._alpha = this._alpha - 6;
if (this.counter < 1) {
removeMovieClip(this);
}
}
}
};
Object.registerClass("escapePod", escapepodClass);
function customFunction(varName) {
if (_root.state == "paused") {
}
if (_root.state == "playing") {
i = 0;
while (i < 100) {
i++;
}
if (varName == 3) {
}
switch (varName) {
case 1 :
break;
case 2 :
break;
case 3 :
break;
case 4 :
break;
case 5 :
break;
case 6 :
break;
}
savegame.flush();
i = 1;
while (i < 500) {
removeMovieClip(eval ("holder.clip" + i));
i++;
}
switch (varName) {
case 10 :
tellplayer(1);
break;
case 20 :
tellplayer(2);
break;
case 30 :
tellplayer(3);
break;
case 40 :
tellplayer(4);
break;
case 50 :
tellplayer(5);
break;
case 60 :
tellplayer(6);
}
attachMovie("clip", "clip", clipLevel);
with (clip) {
_x = 320;
_y = 430;
}
state = "begin";
if ((score > 30000) && (extralives == 0)) {
extralives++;
lives++;
tellplayer(9);
}
if ((score > 60000) && (extralives == 1)) {
extralives++;
lives++;
tellplayer(9);
}
if ((score > 90000) && (extralives == 2)) {
extralives++;
lives++;
tellplayer(9);
}
if ((score > 120000) && (extralives == 3)) {
extralives++;
lives++;
tellplayer(9);
}
if ((score > 150000) && (extralives == 4)) {
extralives++;
lives++;
tellplayer(9);
}
score = score + 500;
if (lives < 0) {
state = "game over";
} else {
state = "paused";
}
}
}
function tellplayer(num) {
attachMovie("tell_player", "tellPlayer", 9);
with (tellPlayer) {
_x = 320;
_y = 100;
clip.gotoAndStop(num);
}
_root.playerscore.gotoAndPlay(2);
if (num == 9) {
extralife_snd.start();
}
switch (num) {
case 1 :
_root.score = _root.score + 500;
_root.sound1.start();
return;
case 2 :
_root.score = _root.score + 750;
_root.sound2.start();
return;
case 3 :
_root.score = _root.score + 1000;
_root.sound3.start();
return;
case 4 :
_root.score = _root.score + 2000;
_root.sound4.start();
return;
case 5 :
_root.score = _root.score + 3000;
_root.sound5.start();
return;
case 6 :
_root.score = _root.score + 4000;
_root.sound6.start();
return;
}
}
function pausebtnpress() {
if (_root.state == "playing") {
_root.state = "paused";
attachMovie("paused_clip", "tellPlayer", 9);
tellPlayer._x = 320;
tellPlayer._y = 240;
} else if (_root.state == "paused") {
removeMovieClip("tellPlayer");
_root.state = "playing";
}
}
function podCollected() {
sound1.start();
currentLevelCollect++;
score = score + 250;
playerscore.gotoAndPlay(2);
remainObjects = currentLevelquota - currentLevelCollect;
if (currentLevelCollect >= currentLevelquota) {
state = "level complete";
}
landScape.attachMovie("miniTellPlayer", "tp" + enemyLevel, enemyLevel);
eval ("landScape.tp" + enemyLevel).gotoAndStop(4);
enemyLevel++;
}
function miniCollected(num) {
landScape.attachMovie("miniTellPlayer", "tp" + enemyLevel, enemyLevel);
eval ("landScape.tp" + enemyLevel).gotoAndStop(num);
enemyLevel++;
pointCollectSnd.start();
switch (num) {
case 1 :
sound1.start();
score = score + 150;
playerscore.gotoAndPlay(2);
return;
case 2 :
sound1.start();
playerHealth = playerHealth + 5;
if (playerHealth > 100) {
playerHealth = 100;
}
this.lifeMeter_clip.life_bar_clip._xscale = playerHealth;
score = score + 50;
playerscore.gotoAndPlay(2);
return;
case 3 :
sound1.start();
playerFuel = playerFuel + 5;
if (playerFuel > 100) {
playerFuel = 100;
}
score = score + 75;
playerscore.gotoAndPlay(2);
}
}
function shieldChargeCollected() {
pointCollectSnd.start();
landScape.attachMovie("miniTellPlayer", "tp" + enemyLevel, enemyLevel);
eval ("landScape.tp" + enemyLevel).gotoAndStop(2);
enemyLevel++;
sound1.start();
playerHealth = playerHealth + 20;
if (playerHealth > 100) {
playerHealth = 100;
}
this.lifeMeter_clip.life_bar_clip._xscale = playerHealth;
score = score + 100;
playerscore.gotoAndPlay(2);
}
function shieldChargeClass() {
}
shieldChargeClass.prototype = new MovieClip();
shieldChargeClass.prototype.onLoad = function () {
this.x = this._x;
this.y = this._y;
this.state = "normal";
};
shieldChargeClass.prototype.onEnterFrame = function () {
if (_root.state == "paused") {
}
if (_root.state == "playing") {
if (this.state == "normal") {
if (this.hitTest(_root.player) == true) {
shieldChargeCollected();
this.state = "start collected";
}
}
if (this.state == "start collected") {
this.counter = 15;
this.state = "collected wait";
this.gotoAndPlay(2);
}
if (this.state == "collected wait") {
this.counter--;
if (this.counter < 1) {
removeMovieClip(this);
}
}
}
};
Object.registerClass("shieldCharge", shieldChargeClass);
function frameaction() {
if (state == "start again") {
setuplevel();
attachMovie("ready_announce", "tellPlayer", 9);
tellPlayer._x = 320;
tellPlayer._y = 100;
_global.playerState = 1;
this.state = "paused";
}
if (state == "paused") {
}
if (state == "begin") {
if (level > 5) {
removeMovieClip(player);
i = 0;
while (i < 100) {
i++;
}
gotoAndPlay (54);
} else {
setuplevel();
}
state = "paused";
}
if (state == "playing") {
landScape._x = -(px - 320);
landScape._y = -(py - 240);
tpx = px;
if (Key.isDown(leftKey)) {
if (playerState != "refueling") {
if (playerFuel > 0) {
if (px > -650) {
playThrustSnd();
leftThrust = leftThrust + sideThrust;
playerFuel = playerFuel - fuelThrustCost;
landScape.thrustClip.thrustLeftClip._visible = true;
} else {
landScape.thrustClip.thrustLeftClip._visible = false;
}
}
}
} else {
landScape.thrustClip.thrustLeftClip._visible = false;
}
if (Key.isDown(rightKey)) {
if (playerState != "refueling") {
if (playerFuel > 0) {
if (px < 1500) {
playThrustSnd();
rightThrust = rightThrust + sideThrust;
playerFuel = playerFuel - fuelThrustCost;
landScape.thrustClip.thrustRightClip._visible = true;
} else {
landScape.thrustClip.thrustRightClip._visible = false;
}
}
}
} else {
landScape.thrustClip.thrustRightClip._visible = false;
}
if (Key.isDown(upKey)) {
if (playerFuel > 0) {
if (playerState == "refueling") {
playerState = "normal";
}
if (py > -350) {
addThrust = addThrust + 1;
playThrustSnd();
playerFuel = playerFuel - fuelThrustCost;
landScape.thrustClip.thrustUpClip._visible = true;
} else {
landScape.thrustClip.thrustUpClip._visible = false;
}
}
} else {
landScape.thrustClip.thrustUpClip._visible = false;
}
this.fuelMeter_clip.fuel_bar_clip._xscale = playerFuel;
if (playerFuel > 30) {
lowFuelSnd_played = 0;
} else if (playerFuel < 20) {
if (lowFuelSnd_played == 0) {
lowFuelSnd.start();
lowFuelSnd_played = 1;
}
if (playerFuel < 1) {
if (lowFuelSnd_played == 1) {
outOfFuelSnd.start();
lowFuelSnd_played = 2;
}
}
}
if (Key.isDown(downKey)) {
if (playerState != "refueling") {
pty = pty + 10;
addThrust = addThrust - 0.5;
playThrustSnd();
landScape.thrustClip.thrustDownClip._visible = true;
} else {
landScape.thrustClip.thrustDownClip._visible = false;
}
}
lastPlayerY = py;
if (playerState == "normal") {
playerYspeed = playerYspeed + gravityVar;
if (thrusting == 1) {
addThrust = addThrust + 2;
playThrustSnd();
}
if (addThrust > 0) {
addThrust = addThrust * 0.985;
}
tempThrust = playerYspeed - addThrust;
if (playerYspeed > playerMaxSpeed) {
playerYspeed = playerMaxSpeed;
}
py = py + playerYspeed;
py = py - addThrust;
}
if (playerState == "refueling") {
if (thrusting == 1) {
addThrust = addThrust + 2;
playThrustSnd();
}
if (addThrust > 0) {
addThrust = addThrust * 0.985;
}
py = py - addThrust;
}
var point = {x:0, y:0};
_root.player.hitLEFT.localToGlobal(point);
globalXCoord = point.x;
globalYCoord = point.y;
_root.hitLandTest = landScape.surface.hitTest(globalXCoord, globalYCoord, true);
if (_root.hitLandTest == true) {
playerHitsLand("left");
}
var point = {x:0, y:0};
_root.player.hitRIGHT.localToGlobal(point);
globalXCoord = point.x;
globalYCoord = point.y;
_root.hitLandTest = landScape.surface.hitTest(globalXCoord, globalYCoord, true);
if (_root.hitLandTest == true) {
playerHitsLand("right");
}
var point = {x:0, y:0};
_root.player.hitBOTTOM.localToGlobal(point);
globalXCoord = point.x;
globalYCoord = point.y;
_root.hitLandTest = landScape.surface.hitTest(globalXCoord, globalYCoord, true);
if (_root.hitLandTest == true) {
playerHitsLand("bottom");
}
var point = {x:0, y:0};
_root.player.hitTOP.localToGlobal(point);
globalXCoord = point.x;
globalYCoord = point.y;
_root.hitLandTest = landScape.surface.hitTest(globalXCoord, globalYCoord, true);
if (_root.hitLandTest == true) {
playerHitsLand("top");
}
if (px < -645) {
px = -645;
leftThrust = 0;
}
if (px > 1490) {
px = 1490;
rightThrust = 0;
}
landScape.thrustClip._x = px;
landScape.thrustClip._y = py;
lastPlayerX = px;
thrustScale = Math.abs(xMovePlayer) * 10;
px = px - leftThrust;
px = px + rightThrust;
if (leftThrust > 0) {
leftThrust = leftThrust * 0.95;
if (leftThrust < 0.2) {
leftThrust = 0;
}
}
if (rightThrust > 0) {
rightThrust = rightThrust * 0.95;
if (rightThrust < 0.2) {
rightThrust = 0;
}
}
prot = ((-leftThrust) + rightThrust) * 10;
if (prot > 60) {
prot = 60;
}
if (prot < -60) {
prot = -60;
}
lastprot = prot;
player._x = 320;
player._y = 240;
player._rotation = prot / 3;
}
if (state == "level complete") {
i = 0;
while (i < 25) {
removeMovieClip(eval ("landScape.mine" + i));
removeMovieClip(eval ("landScape.fuelPad" + i));
removeMovieClip(eval ("landScape.volcano" + i));
removeMovieClip(eval ("landScape.escapePod" + i));
i++;
}
attachMovie("level_complete", "tellPlayer", 200);
tellPlayer._x = 320;
tellPlayer._y = 240;
state = "level complete wait";
count = 76;
}
if (state == "level complete wait") {
count--;
if (count < 1) {
state = "next level";
}
}
if (state == "next level") {
level++;
if (level > 5) {
removeMovieClip(player);
gotoAndPlay (54);
} else {
setuplevel();
}
}
if (state == "game over") {
removeMovieClip(player);
gotoAndPlay ("GAMEOVER");
}
}
function setup() {
leftThrust = 0;
rightThrust = 0;
sideThrust = 0.7;
xMovePlayer = 0;
upKey = 38;
downKey = 40;
leftKey = 37;
rightKey = 39;
level = 1;
fuelThrustCost = 0.1;
_quality = _root.gameQuality;
var _local4 = new Object();
_local4.onMouseDown = function () {
if (state == "playing") {
}
};
_local4.onMouseUp = function () {
if (state == "playing") {
}
};
Mouse.addListener(_local4);
extralives = 0;
thrusting = 0;
_root.lives = 2;
_root.score = 0;
_global.playerState = 1;
enemyLevelStart = 1;
_global.state = "begin";
acl = 0;
_global.prot = 0;
_root.pnum = 2;
mouseTrack = 25;
gravityVar = 0.6;
playerMaxSpeed = 10;
maxDepth = landScape._height;
addThrust = 5;
this.tSndT = 0;
this.tSndD = 6;
gameScene = "GAME";
playmusic();
}
function musicon() {
this.on_off.gotoAndStop(1);
musicstate = 1;
storage.data.musicsetting = 1;
playmusic();
}
function musicoff() {
stopmusic();
this.on_off.gotoAndStop(2);
musicstate = 0;
storage.data.musicsetting = 0;
}
function playThrustSnd() {
this.tSndT++;
if (this.tSndT > this.tSndD) {
thrustSnd.start();
this.tSndT = 0;
}
}
if (musicstate == 0) {
this.on_off.gotoAndStop(2);
}
function setuplevel() {
_root.state = "paused";
_root.levelann = "Cave " + level;
trace("LEVEL START" + level);
attachMovie("level_announce", "tellPlayer", 9);
tellPlayer._x = 320;
tellPlayer._y = 100;
background.gotoAndStop(level);
i = 0;
while (i < 100) {
removeMovieClip(eval ("landScape.mine" + i));
removeMovieClip(eval ("landScape.fuelPad" + i));
removeMovieClip(eval ("landScape.volcano" + i));
removeMovieClip(eval ("landScape.escapePod" + i));
i++;
}
landScape.attachMovie("thrustClip", "thrustClip", 100);
landScape.thrustClip.thrustRightClip._visible = false;
landScape.thrustClip.thrustLeftClip._visible = false;
landScape.thrustClip.thrustUpClip._visible = false;
landScape.thrustClip.thrustDownClip._visible = false;
playerState = "normal";
currentLevelquota = 0;
currentLevelCollect = 0;
gameArray = eval (("level" + level) + "data");
enemyLevel = _root.enemyLevelStart;
trace(enemyLevel);
i = 0;
while (i < gameArray.length) {
ran = gameArray[i];
if (ran == "player") {
trace(ran);
px = gameArray[i + 1];
py = gameArray[i + 2];
playerXspeed = 0;
playerYspeed = 0.1;
attachMovie("player", "player", 7);
player._x = 320;
player._y = 240;
}
if (ran == "exit") {
landScape.attachMovie("exitPad", "exit" + enemyLevel, enemyLevel);
with (eval ("landScape.exit" + enemyLevel)) {
_x = gameArray[i + 1];
_y = gameArray[i + 2];
}
}
if (ran == "miniCollect") {
landScape.attachMovie("miniCollect", "miniCollect" + enemyLevel, enemyLevel);
tempType = gameArray[i + 3];
if (tempType == 0) {
tempType = random(3) + 1;
}
with (eval ("landScape.miniCollect" + enemyLevel)) {
_x = gameArray[i + 1];
_y = gameArray[i + 2];
gotoAndStop(tempType);
clip.typeOf = tempType;
}
}
if (ran == "mine") {
landScape.attachMovie("mine_Clip", "mine" + enemyLevel, enemyLevel);
with (eval ("landScape.mine" + enemyLevel)) {
_x = gameArray[i + 1];
_y = gameArray[i + 2];
clip.moveType = gameArray[i + 3];
}
}
if (ran == "volcano") {
landScape.attachMovie("volcano", "volcano" + enemyLevel, enemyLevel);
with (eval ("landScape.volcano" + enemyLevel)) {
_x = gameArray[i + 1];
_y = gameArray[i + 2];
clip.moveType = gameArray[i + 3];
}
}
if (ran == "escapePod") {
landScape.attachMovie("escapePod", "escapePod" + enemyLevel, enemyLevel);
with (eval ("landScape.escapePod" + enemyLevel)) {
_x = gameArray[i + 1];
_y = gameArray[i + 2];
currentLevelquota++;
}
}
if (ran == "fuelPad") {
landScape.attachMovie("fuelPad", "fuelPad" + enemyLevel, enemyLevel);
with (eval ("landScape.fuelPad" + enemyLevel)) {
_x = gameArray[i + 1];
_y = gameArray[i + 2];
}
}
if (ran == "shieldCharge") {
landScape.attachMovie("shieldCharge", "shieldCharge" + enemyLevel, enemyLevel);
with (eval ("landScape.shieldCharge" + enemyLevel)) {
_x = gameArray[i + 1];
_y = gameArray[i + 2];
}
}
enemyLevel++;
i = i + 4;
}
currentLevelCollect = 0;
remainObjects = currentLevelquota - currentLevelCollect;
trace("remainObjects = " + remainObjects);
landScape.gotoAndStop(level + 1);
landScape._x = -(px - 320);
landScape._y = -(py - 240);
landScape._xscale = 100;
landScape._yscale = 100;
playmusic();
thrusting = 0;
leftThrust = 0;
rightThrust = 0;
addThrust = 5;
playerFuel = 100;
playerHealth = 100;
this.lifeMeter_clip.life_bar_clip._xscale = playerHealth;
this.fuelMeter_clip.fuel_bar_clip._xscale = playerFuel;
lowFuelSnd_played = 0;
}
Instance of Symbol 217 MovieClip "fuelMeter_clip" in Frame 17
/* no clip actions */
Instance of Symbol 221 MovieClip in Frame 17
onClipEvent (enterFrame) {
_root.frameaction();
}
Frame 18
setup();
Frame 26
stop();
Frame 28
if (score > yourhigh) {
yourhigh = score;
newscore.gotoAndStop(2);
storage.data.myhighscore = score;
}
storage.data.uptolevel = level;
storage.flush();
gamescene = "game over";
playmusic();
gameOverSnd.start();
Frame 35
stop();
Frame 36
function gomain() {
_root.state = "start again";
gotoAndPlay (8);
}
gameScene = "CREDITS";
playmusic();
Frame 44
stop();
Frame 45
function gomain() {
_root.state = "start again";
gotoAndPlay (8);
}
if (musicstate == 0) {
this.options.on_off.gotoAndStop(2);
}
gameScene = "HOW TO PLAY";
playmusic();
Frame 53
stop();
Frame 54
if (score > yourhigh) {
yourhigh = score;
storage.data.myhighscore = score;
}
storage.data.uptolevel = 1;
level = 1;
gameScene = "GAME FINISHED";
playmusic();
Frame 62
stop();
Symbol 10 MovieClip [escapePod] Frame 1
stop();
Symbol 10 MovieClip [escapePod] Frame 16
stop();
Symbol 28 MovieClip Frame 1
stop();
Symbol 38 MovieClip Frame 1
_root.stop();
PercentLoaded = Math.floor((_root.getBytesLoaded() / _root.getBytesTotal()) * 100);
if (PercentLoaded != 100) {
setProperty(bar, _xscale , PercentLoaded);
} else {
_root.play();
}
Symbol 38 MovieClip Frame 2
gotoAndPlay (1);
Symbol 53 MovieClip Frame 1
stop();
Symbol 54 MovieClip [tell_player] Frame 65
removeMovieClip(this);
Symbol 58 MovieClip [ready_announce] Frame 76
_root.state = "playing";
removeMovieClip(this);
Symbol 63 Button
on (release) {
_root.pausebtnpress();
}
Symbol 64 MovieClip [paused_clip] Frame 30
stop();
Symbol 67 MovieClip [lifelost] Frame 80
_root.state = "start again";
removeMovieClip(this);
Symbol 71 MovieClip [level_announce] Frame 77
_root.state = "playing";
removeMovieClip(this);
Symbol 73 MovieClip [playerExplosion] Frame 31
stop();
Symbol 83 MovieClip [level_complete] Frame 76
removeMovieClip(this);
Symbol 88 MovieClip [shieldCharge] Frame 1
stop();
Symbol 88 MovieClip [shieldCharge] Frame 16
stop();
Symbol 90 MovieClip Frame 1
stop();
Symbol 90 MovieClip Frame 15
stop();
Symbol 95 MovieClip [miniCollect] Frame 1
stop();
Symbol 101 MovieClip [miniTellPlayer] Frame 1
stop();
Symbol 115 MovieClip Frame 1
stop();
Symbol 130 Button
on (release) {
getURL ("http://www.macromedia.com/go/getflashplayer/", "_blank");
}
Symbol 133 Button
on (release) {
_root.play();
}
Symbol 142 Button
on (release) {
getURL (((("mailto:" + _root.authorContact) + "?subject=") + _root.gameTitle) + " licensing");
}
Symbol 143 MovieClip Frame 1
stop();
Symbol 149 MovieClip Frame 1
_root.stop();
Symbol 149 MovieClip Frame 75
_root.play();
Symbol 157 MovieClip Frame 23
stop();
Symbol 159 Button
on (release) {
gotoAndPlay (36);
}
Symbol 163 Button
on (release) {
gotoAndPlay (45);
}
Symbol 169 MovieClip Frame 1
stop();
Symbol 174 Button
on (release) {
_root.resetlevel();
}
Symbol 180 Button
on (press) {
_root.playgame();
}
Symbol 182 MovieClip Frame 1
stop();
Symbol 188 Button
on (press) {
_root.musicoff();
this.over.play();
}
Symbol 191 Button
on (press) {
_root.musicon();
this.over.play();
}
Symbol 192 MovieClip Frame 1
stop();
Symbol 194 MovieClip Frame 1
stop();
Symbol 209 MovieClip Frame 1
stop();
Symbol 228 MovieClip Frame 1
stop();
Symbol 232 Button
on (press) {
_root.pausebtnpress();
}
Symbol 240 MovieClip Frame 1
stop();
Symbol 243 MovieClip Frame 1
stop();
Symbol 246 Button
on (release) {
_root.state = "start again";
gotoAndPlay (8);
}
Symbol 252 Button
on (release) {
getURL ("http://www.terrypaton.com", "_blank");
}
Symbol 253 Button
on (release) {
_root.gomain();
}
Symbol 257 Button
on (release) {
gotoAndPlay (8);
}