Frame 1
function gameMenu(menu, obj) {
getURL (_root.authorsSite, "_blank");
}
highscore = 0;
_root.externalMusic = 0;
_root.gameName = "balance";
_root.gameDesc = "Dangers in a microscopic world!";
_root.vNum = "1.2";
_root.flashVersionsNeeded = 8;
_root.authorName = "Terry Paton";
_root.authorContact = "terry@terrypaton.com";
_root.authorsSite = "http://www.terrypaton.com";
_root.legalDomain = "http://www.terrypaton.com";
_root.gameLocation = _root._url.substr(0, legalDomain.length);
_root.gameQuality = "AUTO";
var menu_cm = new ContextMenu();
menu_cm.customItems.push(new ContextMenuItem(gameTitle, gameMenu));
menu_cm.hideBuiltInItems();
_root.menu = menu_cm;
fscommand ("fullscreen", true);
Frame 4
function displayplayer() {
this.playerShadow.gotoAndStop(displayframe);
this.player._x = px;
this.player._y = py;
this.player._rotation = pr;
if (pr > 0) {
displayframe = 17 + Math.floor(Math.abs(pr) / 2);
if (displayframe > 30) {
displayframe = 30;
}
}
if (pr < 0) {
displayframe = 17 - Math.floor(Math.abs(pr) / 2);
}
if (displayframe < 1) {
displayframe = 1;
}
this.player.gotoAndStop(displayframe);
temp = Math.abs(pr);
if (temp > 80) {
this.player.gotoAndStop(31);
}
this.shadow._x = 275 + (pr * 1.3);
if ((pr > 24) && (pr < 40)) {
this.player.playerhead.gotoAndStop(4);
}
if (pr > 40) {
this.player.playerhead.gotoAndStop(4);
}
if ((pr > 10) && (pr < 25)) {
this.player.playerhead.gotoAndStop(3);
}
if (pr < 11) {
this.player.playerhead.gotoAndStop(1);
}
}
this.background.gotoAndStop(random(2) + 1);
function setup() {
_global.px = 275;
_global.py = 345;
_global.pr = 0;
leftkey = 37;
rightkey = 39;
spacekey = 32;
trace(random(2) + 1);
time = 0;
if (highscore == undefined) {
highscore = 0;
trace(highscore);
}
this.pressspace.gotoAndStop(1);
if (firsttime == 0) {
firsttime = 1;
this.getready.gotoAndStop(1);
} else if (firsttime == 0) {
}
}
function frameaction() {
if (action == "wait") {
waitcount++;
if (waitcount > 2) {
waitcount = 0;
if (random(2) == 1) {
pr = Math.random(2);
}
if (random(2) == 1) {
pr = -Math.random(2);
}
if (pr > 0) {
displayframe = 17 + Math.floor(Math.abs(pr) / 2);
if (displayframe > 30) {
displayframe = 30;
}
}
if (pr < 0) {
displayframe = 17 - Math.floor(Math.abs(pr) / 2);
}
if (displayframe < 1) {
displayframe = 1;
}
this.player.gotoAndStop(displayframe);
this.playerShadow.gotoAndStop(displayframe);
this.playerShadow._rotation = pr;
this.player._rotation = pr;
}
}
if (action == "setup") {
setup();
start_time = getTimer();
action = "playing";
}
if (action == "playing") {
if ((pr > 0) || (pr < 0)) {
pr = pr * 1.1;
}
if (Math.abs(pr) < 4) {
if (random(2) == 1) {
pr = pr + Math.random(diff);
}
if (random(2) == 1) {
pr = pr - Math.random(diff);
}
}
if (Math.abs(pr) > 45) {
pr = pr * 1.2;
}
if (pr > 89) {
pr = 90;
action = "fell";
}
if (pr < -89) {
pr = -90;
action = "fell";
}
leftpress = Key.isDown(leftkey);
rightpress = Key.isDown(rightkey);
if (Math.abs(pr) < 70) {
if (leftpress == true) {
pr = pr - 5;
a = random(200) + 100;
attachMovie("indicator", "a" + a, a);
eval ("a" + a)._x = 150;
eval ("a" + a)._y = a;
}
if (rightpress == true) {
pr = pr + 5;
a = random(200) + 100;
attachMovie("indicator", "a" + a, a);
eval ("a" + a)._x = 400;
eval ("a" + a)._y = a;
eval ("a" + a)._xscale = -100;
}
}
displayplayer();
now_time = getTimer();
ntime = now_time - start_time;
utime = Math.floor(ntime / 1000);
displaytime = (utime + ".") + Math.floor((ntime - (utime * 1000)) / 100);
diff = (utime / 100) * 10;
if (diff < 3) {
diff = 3;
}
}
if (action == "fell") {
trace("game over");
this.left.gotoAndStop(1);
this.right.gotoAndStop(1);
score = utime + (Math.floor((ntime - (utime * 1000)) / 100) / 10);
trace(highscore);
if (score > highscore) {
trace("new record");
highscore = score;
action = "highscore wait";
_root.newrecord.gotoAndPlay(2);
} else {
action = "menu wait";
acount = 40;
}
}
if (action == "menu wait") {
if (acount > 0) {
acount--;
}
if (acount == 1) {
this.pressspace.gotoAndPlay(2);
_root.newrecord.gotoAndStop(1);
trace(1);
}
spacepress = Key.isDown(spacekey);
if (spacepress == true) {
_root.action = "setup";
this.getready.gotoAndPlay(2);
_root.newrecord.gotoAndStop(1);
action = "wait";
this.pressspace.gotoAndStop(1);
}
}
}
function startagain() {
_root.action = "setup";
this.getready.gotoAndPlay(2);
_root.newrecord.gotoAndStop(1);
action = "wait";
this.pressspace.gotoAndStop(1);
}
waitcount = 0;
diff = 3;
Instance of Symbol 51 MovieClip in Frame 4
onClipEvent (enterFrame) {
_root.frameaction();
}
Frame 8
setup();
action = "menu wait";
acount = 40;
firsttime = 0;
stop();
Symbol 7 MovieClip Frame 1
_root.stop();
PercentLoaded = Math.floor((_root.getBytesLoaded() / _root.getBytesTotal()) * 100);
if (PercentLoaded != 100) {
setProperty(bar, _xscale , PercentLoaded);
} else {
_root.play();
}
Symbol 7 MovieClip Frame 2
gotoAndPlay (1);
Symbol 10 MovieClip [indicator] Frame 12
removeMovieClip(this);
Symbol 19 MovieClip Frame 1
_root.stop();
Symbol 19 MovieClip Frame 75
_root.play();
Symbol 25 MovieClip Frame 1
stop();
Symbol 47 MovieClip Frame 1
stop();
Symbol 48 MovieClip Frame 1
stop();
Symbol 61 MovieClip Frame 1
stop();
Symbol 61 MovieClip Frame 50
_root.action = "setup";
Symbol 61 MovieClip Frame 75
stop();
Symbol 70 Button
on (release) {
_root.startagain();
}
Symbol 84 MovieClip [highscore_entry] Frame 1
typeYourName = "type your name";
this.nameEntry.restrict = "a-z A-Z 0-9";
nameEntry.onSetFocus = function () {
if ((this._parent.typeYourName == "type your name") || (this._parent.typeYourName == "")) {
this.text = "";
}
};
nameEntry.onKillFocus = function () {
if (this.text == "") {
this.text = "type your name";
}
};
_root.yourPos = undefined;
submitted = false;
enterBtn.enabled = true;
this._alpha = 100;
var submitURL = "HTTP://www.terrypaton.com/highscores/score.php";
enterBtn.onRelease = function () {
if (!this._parent.submitted) {
this.enabled = false;
this._parent._alpha = 30;
if ((this._parent.typeYourName != "type your name") && (this._parent.typeYourName != "")) {
var _local3 = new LoadVars();
_local3.name = this._parent.nameEntry.text;
_local3.score = _root.score;
_local3.game = _root.gameName;
_local3.act = 1;
_local3.submit = true;
_local3.sendAndLoad(submitURL, _local3, "POST");
nameEntry.selectable = false;
_local3.onLoad = function (success) {
if (success == 1) {
this._parent.nameEntry.text = ":)";
this._parent.submitted = true;
this._parent._visible = false;
gotoAndStop (5);
} else {
gotoAndStop (4);
}
};
}
}
};
stop();
Symbol 84 MovieClip [highscore_entry] Frame 2
stop();
Symbol 84 MovieClip [highscore_entry] Frame 5
stop();
Symbol 86 MovieClip Frame 1
stop();
Symbol 86 MovieClip Frame 30
stop();
Symbol 86 MovieClip Frame 41
stop();
Symbol 96 Button
on (release) {
_root.startagain();
}
Symbol 97 MovieClip Frame 1
stop();
Symbol 97 MovieClip Frame 18
stop();