Frame 1
function gameMenu(menu, obj) {
getURL (_root.authorsSite, "_blank");
}
_root.vNum = "1.1";
_root.flashVersionsNeeded = 8;
_root.legalDomain = "http://uploads.ungrounded.net";
_root.gameLocation = _root._url.substr(0, legalDomain.length);
var menu_cm = new ContextMenu();
menu_cm.customItems.push(new ContextMenuItem(gameTitle, gameMenu));
menu_cm.hideBuiltInItems();
_root.menu = menu_cm;
fscommand ("fullscreen", true);
Frame 2
if (false) {
}
Instance of Symbol 81 MovieClip in Frame 3
onClipEvent (load) {
var flashVersion = System.capabilities.version;
_root.flashVersionsinstalled = flashVersion.substr(4, 1);
trace(_root.flashVersionsinstalled);
if (_root.flashVersionsNeeded > _root.flashVersionsinstalled) {
_root.stop();
this.gotoAndStop(2);
} else if (_root.gameLocation != _root.legalDomain) {
getURL ("http://www.terrypaton.com", "_blank");
_root.stop();
}
}
Frame 3
if (false) {
}
Frame 5
bounce = new Sound();
bounce.attachSound("bounceSound");
hurt = new Sound();
hurt.attachSound("hurtSound");
die = new Sound();
die.attachSound("dieSound");
collect = new Sound();
collect.attachSound("collectSound");
musicTrack = new Sound();
musicTrack.attachSound("musicTrackSnd");
_root.gameQuality = "low";
Frame 6
storage = SharedObject.getLocal("store");
yourhigh = storage.data.myhighscore;
if (yourhigh == undefined) {
storage.data.myhighscore = 0;
yourhigh = 0;
}
powerSnd = new Sound();
powerSnd.attachSound("powerUpSound");
levelSnd = new Sound();
levelSnd.attachSound("levelSound");
deathSnd = new Sound();
deathSnd.attachSound("deathSound");
Frame 7
function playgame() {
musicTrack.stop();
gotoAndPlay (11);
}
function goIntro() {
gotoAndPlay (7);
}
function resetlevel() {
this.resetclip.resetclip.gotoAndPlay(2);
storage.data.myhighscore = 0;
yourhigh = 0;
storage.flush();
}
musicTrack.start(0, 100);
level = 1;
score = 0;
_quality = "HIGH";
removeMovieClip(player);
Instance of Symbol 60 MovieClip [powerUp] in Frame 7
onClipEvent (load) {
this.gotoAndStop(1);
}
Instance of Symbol 60 MovieClip [powerUp] in Frame 7
onClipEvent (load) {
this.gotoAndStop(2);
}
Instance of Symbol 60 MovieClip [powerUp] in Frame 7
onClipEvent (load) {
this.gotoAndStop(3);
}
Instance of Symbol 60 MovieClip [powerUp] in Frame 7
onClipEvent (load) {
this.gotoAndStop(4);
}
Instance of Symbol 60 MovieClip [powerUp] in Frame 7
onClipEvent (load) {
this.gotoAndStop(5);
}
Frame 10
stop();
Frame 11
gameState = "setup";
function frameaction() {
if (gameState == "start gameover") {
deathSnd.start();
gwait = 60;
attachMovie("game_over_clip", "tellPlayer", 200);
tellPlayer._x = 320;
tellPlayer._y = 240;
gameState = "gameover wait";
}
if (gameState == "gameover wait") {
gwait--;
if (gwait < 1) {
removeMovieClip(tellPlayer);
gameState = "game over";
}
}
if (gameState == "begin") {
setupLevel();
player._x = Math.floor(playerX);
player._y = Math.floor(playerY);
playerMarkerHolder.playerMarker._x = (landPos / (maxLevelDistance - 10)) * 178.4;
landScape.land._x = -landPos;
backGround1.distance._x = (-landPos) / 3;
backGround2.distance2._x = (-landPos) / 6;
beginW = 60;
trace("yo");
attachMovie("nextlevel_complete_clip", "tellPlayer", 200);
tellPlayer._x = 320;
tellPlayer._y = 240;
gameState = "begin wait";
}
if (gameState == "begin wait") {
beginW--;
if (beginW < 1) {
removeMovieClip(tellPlayer);
gameState = "playing";
}
}
if (gameState == "level complete") {
levelSnd.start();
trace("l;evel complete");
i = 0;
while (i < 1000) {
removeMovieClip(eval ("landScape.land.c" + i));
removeMovieClip(eval ("landScape.land.b" + i));
removeMovieClip(eval ("landScape.land.p" + i));
i++;
}
attachMovie("level_complete_clip", "tellPlayer", 200);
tellPlayer._x = 320;
tellPlayer._y = 240;
gameState = "level complete wait";
count = 60;
}
if (gameState == "level complete wait") {
count--;
if (count < 1) {
gameState = "next level";
}
}
if (gameState == "next level") {
removeMovieClip(tellPlayer);
level++;
if (level > 4) {
removeMovieClip(player);
gotoAndPlay (25);
} else {
gameState = "begin";
}
}
if (gameState == "game over") {
removeMovieClip(player);
if (score > yourhigh) {
yourhigh = score;
newscore.gotoAndStop(2);
storage.data.myhighscore = score;
}
storage.data.uptolevel = level;
storage.flush();
gotoAndPlay (7);
}
if (gameState == "game complete") {
gotoAndPlay (25);
}
if (gameState == "setup") {
gameState = "begin";
}
if (gameState == "playing") {
if (playerStateDelay > 0) {
powerTimer._x = 320;
powerTimer._y = playerY + 30;
powerTimeC = Math.round(playerStateDelay / 30);
playerStateDelay--;
if (playerStateDelay < 1) {
playerState = 0;
playerScale = 100;
player._xscale = playerScale;
maxPlayerXspeed = originalMaxPlayerXspeed;
powerTimer._y = -100;
}
}
if (playerState == 1) {
}
if (playerState == 2) {
}
this.playerYspeed = this.playerYspeed + 0.5;
if (this.playerYspeed > 0) {
this.playerYspeed = this.playerYspeed * 1.01;
}
if (this.playerYspeed < 0) {
this.playerYspeed = this.playerYspeed * 0.99;
}
playerY = playerY + this.playerYspeed;
if (this.playerYspeed > pXmax) {
this.playerYspeed = pXmax;
}
if (this.playerYspeed < (-pXmax)) {
this.playerYspeed = -pXmax;
}
if (this.y < -15) {
this.y = -15;
}
this.ty = Math.abs(Math.round((landPos + 320) / landScapeStepping));
if (playerYspeed > 0) {
if ((playerState != 3) && (playerState != 4)) {
playerScale = playerScale + 1;
}
if (playerY > landScapeArray[ty]) {
this.playerYspeed = -this.playerYspeed;
this.playerYspeed = -18;
playerY = landScapeArray[ty];
playerScale = 60;
bounce.start();
}
}
if ((playerState != 3) && (playerState != 4)) {
if (playerScale < 100) {
playerScale = playerScale * 1.05;
if (playerScale > 100) {
playerScale = 100;
}
}
}
player._yscale = playerScale;
player._x = Math.floor(playerX);
player._y = Math.floor(playerY);
if (Math.abs(playerXspeed) > 0.5) {
if (playerState != 5) {
playerXspeed = playerXspeed * 0.9;
}
}
if (playerKeyDelay < 2) {
if (Key.isDown(leftKey)) {
playerXspeed = playerXspeed - 1.5;
}
if (Key.isDown(rightKey)) {
playerXspeed = playerXspeed + 1.5;
}
} else {
playerKeyDelay--;
}
if (playerXspeed < (-maxPlayerXspeed)) {
playerXspeed = -maxPlayerXspeed;
}
if (playerXspeed > maxPlayerXspeed) {
playerXspeed = maxPlayerXspeed;
}
landPos = landPos + playerXspeed;
if (landPos < 0) {
landPos = 0;
}
if (landPos > maxLevelDistance) {
landPos = maxLevelDistance;
}
playerMarkerHolder.playerMarker._x = (landPos / (maxLevelDistance - 10)) * 178.4;
landScape.land._x = -landPos;
backGround1.distance._x = (-landPos) / 3;
backGround2.distance2._x = (-landPos) / 6;
ty = Math.abs(Math.round((landPos + 320) / landScapeStepping));
playerBaseY = landScapeArray[ty];
playerBounceY = playerBounceY + 1;
trailC++;
if (trailC > trailD) {
trailC = 0;
landScape.land.attachMovie("trail", "t" + trailNum, trailNum);
eval ("landScape.land.t" + trailNum)._y = player._y - 25;
eval ("landScape.land.t" + trailNum)._x = landPos + 320;
eval ("landScape.land.t" + trailNum).gotoAndStop(tailType);
trailNum++;
if (trailNum > 1050) {
trailNum = 1000;
}
}
tested = 0;
j = 0;
while (j < levelObjects) {
tx2 = eval ("this.landScape.land.c" + j)._x;
tXdiff = Math.abs((landPos + 320) - tx2);
if (tXdiff < 100) {
tested++;
if (player.hitTest(eval ("this.landScape.land.c" + j))) {
lev = landScape.land.getNextHighestDepth();
landScape.land.attachMovie("CollectAnim", "col" + colNum, 200 + lev);
eval ("landScape.land.col" + colNum)._x = eval ("this.landScape.land.c" + j)._x;
eval ("landScape.land.col" + colNum)._y = eval ("this.landScape.land.c" + j)._y;
colNum++;
removeMovieClip(eval ("this.landScape.land.c" + j));
collected++;
percentCollected = Math.floor(100 - (((levelObjects - collected) / levelObjects) * 100));
collectedReport = percentCollected + "%";
collect.start();
_root.score = _root.score + 10;
}
if (percentCollected > levelTargetCollect) {
gameState = "level complete";
}
}
j++;
}
if (playerState != 2) {
j = 0;
while (j < badlevelObjects) {
tx2 = eval ("this.landScape.land.b" + j)._x;
tXdiff = Math.abs((landPos + 320) - tx2);
if (tXdiff < 100) {
if (player.hitBox.hitTest(eval (("this.landScape.land.b" + j) + ".clip"))) {
damagePlayer();
player.gotoAndPlay(2);
playerXspeed = (-playerXspeed) * 0.7;
var tx = Math.floor(eval ("this.landScape.land.b" + j)._x);
tv = Math.floor(landPos) + 320;
if (tv < tx) {
landPos = landPos - 35;
} else if (tv > tx) {
landPos = landPos + 35;
}
playerKeyDelay = 10;
}
}
j++;
}
}
}
}
function changeTrail() {
currentTail = tailType;
tailType = random(5) + 1;
while (tailType == currentTail) {
tailType = random(5) + 1;
}
_root.score = _root.score + 500;
}
function shrinkPlayer() {
playerState = 3;
playerStateDelay = 150;
playerScale = 40;
player._xscale = playerScale;
player._yscale = playerScale;
}
function growPlayer() {
playerState = 4;
playerStateDelay = 150;
playerScale = 200;
player._xscale = playerScale;
player._yscale = playerScale;
}
function invinciblePowerUp() {
playerScale = 100;
player._xscale = playerScale;
playerState = 2;
playerStateDelay = 150;
}
function speedPlayer() {
playerScale = 100;
player._xscale = playerScale;
playerState = 5;
maxPlayerXspeed = maxPlayerXspeed + 7;
playerStateDelay = 150;
}
function shieldPlayer() {
playerScale = 100;
player._xscale = playerScale;
playerState = 6;
playerStateDelay = 150;
}
function badAClass() {
}
badAClass.prototype = new MovieClip();
badAClass.prototype.onLoad = function () {
this.x = this._x;
this.y = this._y;
this.startx = this.x;
this.starty = this.y;
this.bstate = "normal";
this.mNum = Math.random();
this.speed = 0.2 + Math.random();
if (level < 3) {
this.bugType = random(2);
}
if (level == 2) {
this.bugType = random(4);
}
if (level == 3) {
this.bugType = random(6);
}
if (level == 4) {
this.bugType = random(7);
}
};
badAClass.prototype.onEnterFrame = function () {
if (this.bstate == "kill") {
trace("kill");
this.killCount = 10;
this.state = "dying";
}
if (this.bstate == "dying") {
this._alpha = this._alpha - 10;
this.killCount--;
if (this.killCount < 1) {
removeMovieClip(this);
}
}
if (_root.gameState == "paused") {
}
if (_root.gameState == "playing") {
if (Math.abs((landPos + 320) - this.x) < 320) {
if (this.bstate == "normal") {
switch (this.bugType) {
case 0 :
break;
case 1 :
this.mNum = this.mNum + 0.05;
this.y = this.y + ((4 * Math.sin(this.mNum)) * this.speed);
this.x = this.x + ((4 * Math.cos(this.mNum)) * this.speed);
break;
case 2 :
this.mNum = this.mNum + 0.06;
this.x = this.x + ((4 * Math.cos(this.mNum)) * this.speed);
break;
case 3 :
this.mNum = this.mNum + 0.06;
this.y = this.y + ((4 * Math.sin(this.mNum)) * this.speed);
break;
case 4 :
this.mNum = this.mNum + 0.05;
this.y = this.y + ((3 * Math.cos(this.mNum)) * this.speed);
this.x = this.x + ((6 * Math.sin(this.mNum)) * this.speed);
break;
case 5 :
this.mNum = this.mNum + 0.06;
this.y = this.y + ((3 * Math.cos(this.mNum)) * this.speed);
break;
case 6 :
this.mNum = this.mNum + 0.06;
this.x = this.x + ((6 * Math.sin(this.mNum)) * this.speed);
break;
}
this._x = int(this.x);
this._y = int(this.y);
}
}
}
};
Object.registerClass("badA", badAClass);
function damagePlayer() {
if (playerState != 6) {
playerEnergy = playerEnergy - 7;
if (playerEnergy < 1) {
die.start();
playerEnergy = 0;
gameState = "start gameover";
}
energyBar.energyBar_Bar._xscale = playerEnergy;
energyBar.energyLoss.gotoAndPlay(2);
player.gotoAndPlay(2);
hurt.start();
}
}
function powerUpClass() {
}
powerUpClass.prototype = new MovieClip();
powerUpClass.prototype.onLoad = function () {
this.x = this._x;
this.y = this._y;
this.pointsawarded = 250;
this.gotoAndStop(this.typeOfpowerUp);
};
powerUpClass.prototype.onEnterFrame = function () {
if (_root.gameState == "paused") {
}
if (_root.gameState == "playing") {
if (this.hitTest(_root.player) == true) {
trace("power up has hit player");
trace("picked up = " + this.typeOf);
switch (this.typeOf) {
case 1 :
powerSnd.start();
changeTrail();
break;
case 2 :
powerSnd.start();
invinciblePowerUp();
break;
case 3 :
powerSnd.start();
shrinkPlayer();
break;
case 4 :
sound4.start();
shieldPlayer();
break;
case 5 :
powerSnd.start();
speedPlayer();
break;
case 6 :
powerSnd.start();
growPlayer();
break;
}
_root.score = _root.score + this.pointsawarded;
removeMovieClip(this);
}
}
};
Object.registerClass("powerUp", powerUpClass);
function setupLevel() {
powerTimer._y = -100;
collected = 0;
percentCollected = 0;
landPos = 100;
switch (level) {
case 1 :
levelDistance = 100;
levelObjects = 30;
badlevelObjects = 20;
powerUpsObjects = 5;
levelTargetCollect = 70;
break;
case 2 :
levelDistance = 200;
levelObjects = 50;
badlevelObjects = 40;
powerUpsObjects = 8;
levelTargetCollect = 80;
break;
case 3 :
levelObjects = 60;
levelDistance = 300;
badlevelObjects = 80;
powerUpsObjects = 10;
levelTargetCollect = 80;
break;
case 4 :
levelObjects = 60;
levelDistance = 400;
badlevelObjects = 90;
powerUpsObjects = 12;
levelTargetCollect = 90;
break;
}
playerStateDelay = 0;
playerState = 1;
tailType = 1;
sky.gotoAndStop(level);
_quality = _root.gameQuality;
speedModifier = 1;
playerEnergy = 100;
trace("setup");
maxPlayerXspeed = 14;
originalMaxPlayerXspeed = maxPlayerXspeed;
trailNum = 1000;
trailC = 0;
trailD = 0;
playerXspeed = 10;
playerScale = 100;
playerKeyDelay = 0;
playerX = 320;
playerY = 100;
pXmax = 30;
this.playerYspeed = 1;
this.playerXspeed = 0;
attachMovie("player", "player", 100);
basey = 350;
landScape.rectangle = new flash.geom.Rectangle(0, 0, 640, 480);
landScape.scrollRect = landScape.rectangle;
backGround1.rectangle = new flash.geom.Rectangle(0, 0, 640, 480);
backGround1.scrollRect = backGround1.rectangle;
backGround2.rectangle = new flash.geom.Rectangle(0, 0, 640, 480);
backGround2.scrollRect = backGround2.rectangle;
landScapeArray = new Array();
landScape.createEmptyMovieClip("land", 5);
landScape.land.beginFill(21794, 100);
landScapeStepping = 40;
this.moveDistance = 0.1;
landScape.land.lineTo(300, 0);
landScape.land.lineTo(300, basey);
i = 8;
while (i < ((levelDistance + 30) - 1)) {
ty = (basey + ((random(30) + 40) * Math.sin(i / 2))) + (5 * Math.cos(i / (random(5) + 1)));
landScapeArray[i] = ty;
landScape.land.lineTo(i * landScapeStepping, ty);
this.moveDistance = this.moveDistance + 0.1;
i++;
}
landScape.land.lineTo((i - 1) * landScapeStepping, 0);
backGround1.distance.lineTo((i - 1) * landScapeStepping, basey);
backGround1.distance.lineTo(i * landScapeStepping, basey);
landScape.land.lineTo(i * landScapeStepping, 0);
landScape.land.lineTo((i + 8) * landScapeStepping, 0);
landScape.land.lineTo((i + 8) * landScapeStepping, 480);
landScape.land.lineTo(0, 480);
landScape.land.endFill();
trace(i * landScapeStepping);
maxLevelDistance = (i * landScapeStepping) - 380;
backGround1.createEmptyMovieClip("distance", 4);
backGround1.distance.beginFill(896604, 100);
backGround1.distance.lineStyle(4, 896604, 50);
backGround1.distance.lineTo(0, basey);
backGround1.distance.lineTo(0, 480);
landScapeStepping2 = 20;
this.moveDistance = 0.1;
i = 0;
while (i < 300) {
ty = ((basey - 30) + ((random(20) + 30) * Math.sin(i / 4))) + (2 * Math.cos(i / (random(3) + 1)));
backGround1.distance.lineTo(i * landScapeStepping2, ty);
this.moveDistance = this.moveDistance + 0.1;
i++;
}
backGround1.distance.lineTo(i * landScapeStepping2, 480);
backGround1.distance.lineTo(0, 480);
backGround1.distance.endFill();
backGround2.createEmptyMovieClip("distance2", 3);
backGround2.distance2.beginFill(8706299, 100);
backGround2.distance2.lineStyle(6, 8706299, 50);
backGround2.distance2.moveTo(0, basey);
landScapeStepping3 = 20;
this.moveDistance = 0.1;
i = 0;
while (i < levelDistance) {
ty = (basey - 20) + ((random(10) + 20) * Math.sin(i / 5));
backGround2.distance2.lineTo(i * landScapeStepping2, ty);
this.moveDistance = this.moveDistance + 0.1;
i++;
}
landscape._visible = false;
backGround2.distance2.lineTo(i * landScapeStepping2, 480);
backGround2.distance2.lineTo(0, 480);
backGround2.distance2.endFill();
playerBounceY = 0.1;
maxBounceHigh = 30;
leftKey = 37;
rightKey = 39;
i = 0;
while (i < levelObjects) {
tempx = 620 + Math.round(Math.random() * (maxLevelDistance - 420));
lev = landScape.land.getNextHighestDepth();
tempy1 = Math.abs(Math.round(tempx / landScapeStepping));
tempy2 = Math.round((landScapeArray[tempy1] - 100) - random(200));
landScape.land.attachMovie("collectA", "c" + i, lev);
eval ("landScape.land.c" + i)._x = tempx;
eval ("landScape.land.c" + i)._y = tempy2;
i++;
}
i = 0;
while (i < badlevelObjects) {
tempx = 600 + Math.round(Math.random() * (maxLevelDistance - 600));
lev = landScape.land.getNextHighestDepth();
landScape.land.attachMovie("badA", "b" + i, lev);
eval ("landScape.land.b" + i)._x = tempx;
tempy1 = Math.abs(Math.round(tempx / landScapeStepping));
tempy2 = Math.round((landScapeArray[tempy1] - 100) - random(200));
eval ("landScape.land.b" + i)._y = tempy2;
i++;
}
i = 0;
while (i < powerUpsObjects) {
tempx = 600 + Math.round(Math.random() * (maxLevelDistance - 600));
lev = landScape.land.getNextHighestDepth();
landScape.land.attachMovie("powerUp", "p" + i, lev);
eval ("landScape.land.p" + i)._x = tempx;
tempy1 = Math.abs(Math.round(tempx / landScapeStepping));
tempy2 = Math.round((landScapeArray[tempy1] - 100) - random(200));
eval ("landScape.land.p" + i)._y = tempy2;
tt = random(5) + 1;
eval ("landScape.land.p" + i).typeOf = tt;
eval ("landScape.land.p" + i).gotoAndStop(tt);
i++;
}
trace("levelObjects = " + levelObjects);
collected = 0;
colNum = 0;
collectedReport = "0%";
targetCollect = levelTargetCollect + "%";
}
function trailClass() {
}
trailClass.prototype = new MovieClip();
trailClass.prototype.onLoad = function () {
this.life = 15;
this._alpha = 80;
this._xscale = playerScale * 0.8;
this._yscale = playerScale * 0.8;
};
trailClass.prototype.onEnterFrame = function () {
if (gameState == "playing") {
this.life--;
this._alpha = this._alpha * 0.8;
if (this.life < 1) {
removeMovieClip(this);
}
}
};
Object.registerClass("trail", trailClass);
Instance of Symbol 132 MovieClip in Frame 11
onClipEvent (enterFrame) {
_root.frameaction();
}
Frame 23
stop();
Frame 24
goIntro();
Frame 31
stop();
Symbol 10 MovieClip [game_over_clip] Frame 17
stop();
Symbol 13 MovieClip [CollectAnim] Frame 13
removeMovieClip(this);
Symbol 34 MovieClip [player] 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 43 MovieClip [level_complete_clip] Frame 19
stop();
Symbol 46 MovieClip [nextlevel_complete_clip] Frame 60
stop();
Symbol 72 MovieClip Frame 1
stop();
Symbol 80 Button
on (release) {
getURL ("http://www.macromedia.com/go/getflashplayer/", "_blank");
}
Symbol 81 MovieClip Frame 1
stop();
Symbol 90 MovieClip Frame 1
_root.stop();
Symbol 90 MovieClip Frame 75
_root.play();
Symbol 95 MovieClip Frame 1
stop();
Symbol 100 Button
on (press) {
_root.playgame();
}
Symbol 102 MovieClip Frame 1
stop();
Symbol 118 MovieClip Frame 1
stop();
Symbol 122 Button
on (release) {
_root.resetlevel();
}
Symbol 138 MovieClip Frame 1
stop();
Symbol 155 Button
on (press) {
_root.goIntro();
}