Frame 1
function __com_mochibot__(swfid, mc, lv, trk) {
var x;
var g;
var s;
var fv;
var sb;
var u;
var res;
var mb;
var mbc;
mb = "__mochibot__";
mbc = "mochibot.com";
g = (_global ? (_global) : (_level0._root));
if (g[mb + swfid]) {
return(g[mb + swfid]);
}
s = System.security;
x = mc._root.getSWFVersion;
fv = (x ? (mc.getSWFVersion()) : ((_global ? 6 : 5)));
if (!s) {
s = {};
}
sb = s.sandboxType;
if (sb == "localWithFile") {
return(null);
}
x = s.allowDomain;
if (x) {
s.allowDomain(mbc);
}
x = s.allowInsecureDomain;
if (x) {
s.allowInsecureDomain(mbc);
}
u = (((((((((((("http://" + mbc) + "/my/core.swf?mv=7&fv=") + fv) + "&v=") + escape(getVersion())) + "&swfid=") + escape(swfid)) + "&l=") + lv) + "&f=") + mc) + (sb ? ("&sb=" + sb) : "")) + (trk ? "&t=1" : "");
lv = ((fv > 6) ? (mc.getNextHighestDepth()) : ((g[mb + "level"] ? (g[mb + "level"] + 1) : (lv))));
g[mb + "level"] = lv;
if (fv == 5) {
res = "_level" + lv;
if (!eval (res)) {
loadMovieNum (u, lv);
}
} else {
res = mc.createEmptyMovieClip(mb + swfid, lv);
res.loadMovie(u);
}
return(res);
}
__com_mochibot__("2128f783", this, 10301, true);
stop();
Frame 2
function secInc() {
if (!gamePause) {
s++;
}
}
gameStarted = false;
practice = 0;
if (!gameRunning) {
gamePause = true;
gameRunning = true;
}
duplicateMovieClip (_root.targetDummy, "target0", 1);
_root.target0._x = random(370) + 15;
_root.target0._y = random(290) + 15;
_root.avoidDummy.base = true;
_root.targetDummy.base = true;
_root.stripeDummy.base = true;
_root.moveDummy.base = true;
_root.ballTrail.base = true;
_root.startMenu.practice.ballTrail.base = true;
j = 5;
time = random(500);
time2 = random(500);
time3 = random(250) + 100;
scoreNum = 0;
topScore = 0;
top = 1;
bottom = 1;
left = 1;
right = 1;
stripe = 0;
ms = 0;
s = 0;
m = 0;
h = 0;
clearInterval(id);
id = setInterval(secInc, 1000);
_root.ball.onEnterFrame = function () {
_root.topBar.gotoAndStop(top);
_root.bottomBar.gotoAndStop(bottom);
_root.leftBar.gotoAndStop(left);
_root.rightBar.gotoAndStop(right);
if (_root.scoreNum > _root.topScore) {
_root.topScore = _root.scoreNum;
_root.topscore = "Topscore: " + _root.topScore;
}
if (scoreNum < 0) {
_root.pauseText = "Game over.";
_root.gamePause = true;
_root.score = "Score: 0";
}
msDisp = ms;
sDisp = s;
mDisp = m;
hDisp = h;
if (ms < 10) {
msDisp = "0" + ms;
}
if (s < 10) {
sDisp = "0" + s;
}
if (m < 10) {
mDisp = "0" + m;
}
if (h < 10) {
hDisp = "0" + h;
}
_root.timer = (((hDisp + ":") + mDisp) + ":") + sDisp;
if (ms >= 99) {
s++;
ms = 0;
}
if (s == 60) {
m++;
s = 0;
}
if (m == 60) {
h++;
m = 0;
}
if (gamePause) {
if (scoreNum >= 0) {
_root.pauseText = "Game paused.";
}
}
if (!gamePause) {
if (((scoreNum > 1260) && (time3 <= 0)) && (_root.stripe == 0)) {
j++;
duplicateMovieClip (_root.stripeDummy, "stripe" + j, j);
_root["stripe" + j]._x = random(370) + 15;
_root["stripe" + j]._y = random(290) + 15;
time3 = random(250) + 100;
_root.stripe = 1;
}
_root.score = "Score: " + scoreNum;
if (time < 0) {
j++;
if (scoreNum < 900) {
time = random(1000 - scoreNum);
} else {
time = random(300);
}
duplicateMovieClip (_root.avoidDummy, "avoid" + j, j);
_root["avoid" + j]._x = random(370) + 15;
_root["avoid" + j]._y = random(290) + 15;
}
if (time2 < 0) {
j++;
time2 = random(500);
duplicateMovieClip (_root.targetDummy, "target" + j, j);
_root["target" + j]._x = random(370) + 15;
_root["target" + j]._y = random(290) + 15;
}
time--;
time2--;
if (_root.stripe == 0) {
time3--;
}
}
};
Instance of Symbol 25 MovieClip "ball" in Frame 2
onClipEvent (load) {
speedX = 0;
speedY = 0;
gravityX = 0;
gravityY = 0;
oldBallX = 200;
oldBallY = 160;
friction = 0.9;
j = 1;
}
onClipEvent (enterFrame) {
this.swapDepths(j + 10);
if (!_root.gamePause) {
j++;
duplicateMovieClip (_root.ballTrail, ["ballTrail" + j], j);
_root["ballTrail" + j].disposable = true;
_root["ballTrail" + j]._x = ballX;
_root["ballTrail" + j]._y = ballY;
speedX = speedX + gravityX;
speedY = speedY + gravityY;
ballX = oldBallX + speedX;
ballY = oldBallY + speedY;
if (ballX < 15) {
ballX = 15;
speedX = (speedX * -1) * friction;
speedY = speedY * friction;
}
if (ballX > 385) {
ballX = 385;
speedX = (speedX * -1) * friction;
speedY = speedY * friction;
}
if (ballY < 15) {
ballY = 15;
speedY = (speedY * -1) * friction;
speedX = speedX * friction;
}
if (ballY > 305) {
ballY = 305;
speedY = (speedY * -1) * friction;
speedX = speedX * friction;
}
if (Math.abs(speedX) < 0.001) {
speedX = 0;
}
if (Math.abs(speedY) < 0.001) {
speedY = 0;
}
oldBallX = ballX;
oldBallY = ballY;
this._x = ballX;
this._y = ballY;
}
}
Instance of Symbol 33 MovieClip "ballTrail" in Frame 2
onClipEvent (load) {
if (base) {
_alpha = 0;
} else {
_alpha = 100;
}
this.gotoAndStop(random(5));
}
onClipEvent (enterFrame) {
if (!_root.gamePause) {
if (!base) {
this._alpha = this._alpha - 5;
this._width = this._width - 0.5;
this._height = this._height - 0.5;
if (this._alpha < 0) {
removeMovieClip(this);
}
}
}
}
Instance of Symbol 37 MovieClip "targetDummy" in Frame 2
onClipEvent (load) {
if (base) {
this._alpha = 0;
}
this._alpha = 0;
justNew = true;
score = 75;
time = random(300) + 200;
this._rotation = random(360);
this.gotoAndStop(random(6));
rotationSpeed = random(30) - 15;
if ((rotationSpeed < 10) && (rotationSpeed > 0)) {
rotationSpeed = rotationSpeed + 5;
}
if ((rotationSpeed > -10) && (rotationSpeed <= 0)) {
rotationSpeed = rotationSpeed - 5;
}
}
onClipEvent (enterFrame) {
if (!_root.gamePause) {
this._rotation = this._rotation + (rotationSpeed * 2);
if (!base) {
time--;
}
if (time < 0) {
dead = true;
}
if (score > 10) {
score = score - 0.3;
}
if (justNew) {
this._alpha = this._alpha + 5;
if (this._alpha > 80) {
justNew = false;
}
}
if (this.hitTest(_root.ball)) {
if (!hit) {
score = Math.round(score);
_root.pauseText = "+" + score;
justNew = false;
_root.scoreNum = _root.scoreNum + score;
_root.j++;
duplicateMovieClip (this, "target" + _root.j, _root.j);
_root["target" + _root.j]._x = random(370) + 15;
_root["target" + _root.j]._y = random(290) + 15;
hit = true;
}
}
if (hit || (dead)) {
this._alpha = this._alpha - 10;
this._width = this._width - 0.5;
this._height = this._height - 0.5;
if (this._alpha < -100) {
removeMovieClip(this);
_root.pauseText = "";
}
}
}
}
Instance of Symbol 46 MovieClip "avoidDummy" in Frame 2
onClipEvent (load) {
this._alpha = 0;
justNew = true;
score = -100;
lifeTime = (random(150) + _root.scoreNum) + 100;
}
onClipEvent (enterFrame) {
if (!_root.gamePause) {
if (!base) {
lifeTime--;
if (lifeTime < 0) {
if (!hit) {
dead = true;
}
}
}
if (justNew) {
this._alpha = this._alpha + 5;
if (this._alpha > 80) {
justNew = false;
}
}
if (this.hitTest(_root.ball)) {
if (!hit) {
_root.pauseText = score;
hit = true;
_root.scoreNum = _root.scoreNum + score;
}
}
if (hit || (dead)) {
this._alpha = this._alpha - 10;
this._width = this._width - 0.5;
this._height = this._height - 0.5;
if (this._alpha < -100) {
_root.pauseText = "";
removeMovieClip(this);
_root.k--;
}
}
}
if (_root.scoreNum < 0) {
removeMovieClip(this);
}
}
Instance of Symbol 81 MovieClip "startMenu" in Frame 2
onClipEvent (load) {
this.swapDepths(9999);
}
Symbol 4 Button
on (release) {
gotoAndStop (2);
}
Symbol 6 Button
on (release) {
getURL ("http://www.koalafun.com", _blank);
}
Symbol 27 Button
on (keyPress "<Left>") {
if (!_root.gameStarted) {
_root.startMenu.practice.ball.gravityX = -0.3;
_root.startMenu.practice.ball.gravityY = 0;
}
if (_root.gameStarted) {
if (!_root.gamePause) {
_root.ball.gravityX = -0.3;
_root.ball.gravityY = 0;
gravity = "Gravity is left.";
}
}
}
on (keyPress "<Right>") {
if (!_root.gameStarted) {
_root.startMenu.practice.ball.gravityX = 0.3;
_root.startMenu.practice.ball.gravityY = 0;
}
if (_root.gameStarted) {
if (!_root.gamePause) {
_root.ball.gravityX = 0.3;
_root.ball.gravityY = 0;
gravity = "Gravity is right.";
}
}
}
on (keyPress "<Up>") {
if (!_root.gameStarted) {
_root.startMenu.practice.ball.gravityY = -0.3;
_root.startMenu.practice.ball.gravityX = 0;
}
if (_root.gameStarted) {
if (!_root.gamePause) {
_root.ball.gravityY = -0.3;
_root.ball.gravityX = 0;
gravity = "Gravity is up.";
}
}
}
on (keyPress "<Down>") {
if (!_root.gameStarted) {
_root.startMenu.practice.ball.gravityY = 0.3;
_root.startMenu.practice.ball.gravityX = 0;
}
if (_root.gameStarted) {
if (!_root.gamePause) {
_root.ball.gravityY = 0.3;
_root.ball.gravityX = 0;
gravity = "Gravity is down.";
}
}
}
on (keyPress "<Space>") {
if (!_root.gameStarted) {
if (_root.practice < 1) {
_root.startMenu.practice.gotoAndStop(2);
_root.practice = 1;
}
}
if (_root.gameStarted) {
if (_root.gamePause) {
_root.gamePause = false;
_root.pauseText = "";
} else {
_root.gamePause = true;
}
}
}
Symbol 33 MovieClip Frame 1
stop();
Symbol 37 MovieClip Frame 1
stop();
Instance of Symbol 36 MovieClip "effect" in Symbol 37 MovieClip Frame 1
onClipEvent (enterFrame) {
if (this._parent.hit) {
this._width = this._width * 1.9;
this._height = this._height * 1.9;
}
}
Instance of Symbol 45 MovieClip "round" in Symbol 46 MovieClip Frame 1
onClipEvent (enterFrame) {
if (this._parent.hit) {
_alpha = 100;
this._width = this._width * 2.3;
this._height = this._height * 2.3;
}
}
Symbol 74 MovieClip Frame 1
stop();
Instance of Symbol 33 MovieClip "ballTrail" in Symbol 74 MovieClip Frame 1
onClipEvent (load) {
if (base) {
_alpha = 0;
} else {
_alpha = 100;
}
this.gotoAndStop(random(5));
}
onClipEvent (enterFrame) {
if (!base) {
this._alpha = this._alpha - 5;
this._width = this._width - 0.5;
this._height = this._height - 0.5;
if (this._alpha < 0) {
removeMovieClip(this);
}
}
}
Instance of Symbol 25 MovieClip "ball" in Symbol 74 MovieClip Frame 1
onClipEvent (load) {
speedX = 0;
speedY = 0;
gravityX = 0;
gravityY = 0;
oldBallX = 144.5;
oldBallY = 62;
friction = 0.9;
j = 1;
timer = 0;
}
onClipEvent (enterFrame) {
if (_root.gameStarted) {
_root.startMenu._alpha = _root.startMenu._alpha - 5;
if (_root.startMenu._alpha < 0) {
removeMovieClip(_root.startMenu);
}
}
if (_root.practice >= 1) {
this.swapDepths(j + 10);
if ((_root.practice == 6) || (_root.practice == 7)) {
timer++;
if (timer > 150) {
timer = 0;
_root.practice++;
this._parent.nextFrame();
}
}
j++;
duplicateMovieClip (_root.startMenu.practice.ballTrail, ["ballTrail" + j], j);
_root.startMenu.practice["ballTrail" + j].disposable = true;
_root.startMenu.practice["ballTrail" + j]._x = ballX;
_root.startMenu.practice["ballTrail" + j]._y = ballY;
speedX = speedX + gravityX;
speedY = speedY + gravityY;
ballX = oldBallX + speedX;
ballY = oldBallY + speedY;
if (ballX < 5) {
if (_root.practice == 3) {
_root.practice++;
this._parent.gotoAndStop(5);
}
ballX = 5;
speedX = (speedX * -1) * friction;
speedY = speedY * friction;
}
if (ballX > 284) {
if (_root.practice == 4) {
_root.practice++;
this._parent.gotoAndStop(6);
}
ballX = 284;
speedX = (speedX * -1) * friction;
speedY = speedY * friction;
}
if (ballY < 5) {
if (_root.practice == 1) {
_root.practice++;
this._parent.gotoAndStop(3);
}
ballY = 5;
speedY = (speedY * -1) * friction;
speedX = speedX * friction;
}
if (ballY > 131) {
if (_root.practice == 2) {
_root.practice++;
this._parent.gotoAndStop(4);
}
ballY = 131;
speedY = (speedY * -1) * friction;
speedX = speedX * friction;
}
if (Math.abs(speedX) < 0.001) {
speedX = 0;
}
if (Math.abs(speedY) < 0.001) {
speedY = 0;
}
oldBallX = ballX;
oldBallY = ballY;
this._x = ballX;
this._y = ballY;
}
}
Instance of Symbol 37 MovieClip "targetDummy" in Symbol 74 MovieClip Frame 6
onClipEvent (load) {
justNew = true;
score = 75;
time = random(300) + 200;
this._rotation = random(360);
this.gotoAndStop(random(6));
rotationSpeed = random(30) - 15;
if ((rotationSpeed < 10) && (rotationSpeed > 0)) {
rotationSpeed = rotationSpeed + 5;
}
if ((rotationSpeed > -10) && (rotationSpeed <= 0)) {
rotationSpeed = rotationSpeed - 5;
}
}
onClipEvent (enterFrame) {
this._rotation = this._rotation + (rotationSpeed * 2);
if (justNew) {
this._alpha = this._alpha + 5;
if (this._alpha > 80) {
justNew = false;
}
}
if (this.hitTest(_root.startMenu.practice.ball)) {
if (!hit) {
justNew = false;
hit = true;
}
}
if (hit || (dead)) {
this._alpha = this._alpha - 10;
this._width = this._width - 0.5;
this._height = this._height - 0.5;
if (this._alpha < -100) {
removeMovieClip(this);
_root.practice++;
this._parent.nextFrame();
}
}
}
Instance of Symbol 46 MovieClip "avoidDummy" in Symbol 74 MovieClip Frame 8
onClipEvent (load) {
justNew = true;
score = -100;
lifeTime = (random(150) + _root.scoreNum) + 100;
}
onClipEvent (enterFrame) {
if (_root.gamePause) {
if (justNew) {
this._alpha = this._alpha + 5;
if (this._alpha > 80) {
justNew = false;
}
}
if (this.hitTest(_root.startMenu.practice.ball)) {
if (!hit) {
hit = true;
}
}
if (hit || (dead)) {
this._alpha = this._alpha - 10;
this._width = this._width - 0.5;
this._height = this._height - 0.5;
if (this._alpha < -100) {
_root.practice++;
this._parent.nextFrame();
removeMovieClip(this);
_root.k--;
}
}
}
}
Symbol 79 Button
on (release) {
getURL ("http://fakeyou.deviantart.com/art/Gravity-game-78483913", _blank);
}
Symbol 80 Button
on (release) {
_root.gameStarted = true;
}
Symbol 82 Button
on (release) {
getURL ("http://omgitsaninja.com/?sponsor=gravity", _blank);
}