Frame 1
stop();
_root.i = 0;
_root.p_width = _root.load_percent._width;
_root.onEnterFrame = function () {
TotalBytes = getBytesTotal();
BytesLoaded = getBytesLoaded();
PercentLoaded = Math.round((BytesLoaded / TotalBytes) * 100);
i++;
if ((i % 5) == 0) {
_root.preloader.text = PercentLoaded + "%";
_root.preloader2.text = PercentLoaded + "%";
}
_root.load_percent._width = (PercentLoaded / 100) * p_width;
if (BytesLoaded >= TotalBytes) {
delete this.onEnterFrame;
gotoAndStop (2);
}
};
Frame 2
stop();
Frame 3
stop();
Instance of Symbol 54 MovieClip "indicator_demo" in Frame 3
onClipEvent (load) {
i = 0;
interval = 50;
this._alpha = 0;
dir = 1;
}
onClipEvent (enterFrame) {
if (this._alpha <= -50) {
this._alpha = this._alpha + 5;
dir = 1;
} else if (this._alpha >= 120) {
this._alpha = this._alpha - 5;
dir = 0;
} else if (dir == 1) {
this._alpha = this._alpha + 5;
} else {
this._alpha = this._alpha - 5;
}
i++;
}
Instance of Symbol 60 MovieClip "demo_ball" in Frame 3
onClipEvent (enterFrame) {
this.roll._rotation = this.roll._rotation - 10;
}
Instance of Symbol 66 MovieClip "jump_demo" in Frame 3
onClipEvent (load) {
i = 0;
interval = 60;
}
onClipEvent (enterFrame) {
if ((i % interval) == 10) {
this.play();
}
i++;
}
Frame 4
stop();
Instance of Symbol 72 MovieClip "UNI_ROOT" in Frame 4
onClipEvent (load) {
function makeball() {
if (_root.ball_indicator._alpha >= 120) {
if (bs_min > 6) {
bs_min = bs_min - 1;
}
if (bs_max < 17) {
bs_max = bs_max + 1;
}
ball_speed = Math.floor(Math.random() * (bs_max - bs_min)) + bs_min;
ball_rot_per_frame = 360 * (ball_speed / ball_circ);
next_timeout = Math.floor(Math.random() * (max_timeout - min_timeout)) + min_timeout;
_root.ball._x = ball_start_x;
} else {
_root.ball_indicator._alpha = _root.ball_indicator._alpha + indicator_fade_in;
}
}
function reset_ball() {
_root.ball._x = -70;
next_timeout = -2500;
}
STARTx = this._x;
STARTy = _root.wheel._y;
STARTy_dude = _root.dude._y;
ball_start_x = _root.ball._x;
jumping = 0;
jump_vel = 0;
charge_time = 16;
max_charge = -22;
jump_charge = max_charge / charge_time;
gravity = 1.8;
rot_limit = 90;
max_difficulty = 7.5;
difficulty_init = 0;
difficulty = difficulty_init;
tightness_init = 100;
tightness = tightness_init;
tightness_max = 30;
difficulty_buffer = 120;
tightness_add = (tightness_max - tightness) / difficulty_buffer;
diff_add = (max_difficulty - difficulty) / difficulty_buffer;
accn = 0;
arms_factor = -0.75;
ball_speed = 8;
bs_max = 14;
bs_min = 11;
ball_circ = _root.ball._width * Math.PI;
ball_rot_per_frame = 360 * (ball_speed / ball_circ);
min_timeout = -700;
max_timeout = -1500;
circ = _root.wheel._height * 3.14159;
wheel_r = _root.wheel._width / 2;
ball_r = _root.ball._width / 2;
elasticity = -0.075;
this._y = -50;
fadein_speed = 6;
fadeout_speed = 10;
time_init = new Date();
_root.restart._visible = false;
_root.restart._alpha = 0;
best_ms = 0;
best_sub = 0;
indicator_fade = 10;
indicator_fade_in = 5;
_root.ball_indicator._alpha = 0;
reset_ball();
cheat = false;
}
onClipEvent (enterFrame) {
if (_root._currentframe == 5) {
_root.btime_submit.text = btime_txt;
} else {
nowx = _root._xmouse;
if (_root.wheel._y == STARTy) {
accn = this._x - nowx;
}
distance = this._x - STARTx;
time_now = new Date();
diff_ms = time_now.getTime() - time_init.getTime();
if (diff_ms > best_ms) {
best_ms = diff_ms;
}
mins = Math.floor(diff_ms / 60000);
secs = Math.floor(diff_ms / 1000) % 60;
msecs = Math.floor(diff_ms / 100) % 10;
bmins = Math.floor(best_ms / 60000);
bsecs = Math.floor(best_ms / 1000) % 60;
bmsecs = Math.floor(best_ms / 100) % 10;
if (mins < 10) {
mp = "0";
} else {
mp = "";
}
if (secs < 10) {
sp = "0";
} else {
sp = "";
}
if (bmins < 10) {
bmp = "0";
} else {
bmp = "";
}
if (bsecs < 10) {
bsp = "0";
} else {
bsp = "";
}
time_txt = mp.concat(mins.toString(), ":", sp, secs.toString(), ":", msecs.toString());
btime_txt = bmp.concat(bmins.toString(), ":", bsp, bsecs.toString(), ":", bmsecs.toString());
wheel_rot = 360 * (distance / circ);
wheel_rot_rad = ((wheel_rot / 360) * 2) * Math.PI;
if (difficulty < max_difficulty) {
difficulty = difficulty + diff_add;
tightness = tightness + tightness_add;
}
guy_rot = _root.dude._rotation;
guy_rot_rad = ((guy_rot / 360) * 2) * Math.PI;
rotation_fall_add = difficulty * Math.sin(guy_rot_rad);
guy_rot = guy_rot + (accn / tightness);
guy_rot = guy_rot + rotation_fall_add;
if (_root.ball._x >= next_timeout) {
if (_root.ball_indicator._alpha > 0) {
_root.ball_indicator._alpha = _root.ball_indicator._alpha - indicator_fade;
}
_root.ball._x = _root.ball._x - ball_speed;
_root.ball.roll._rotation = _root.ball.roll._rotation - ball_rot_per_frame;
} else {
makeball();
}
colx = _root.ball._x - _root.wheel._x;
coly = _root.ball._y - _root.wheel._y;
cold = Math.sqrt((colx * colx) + (coly * coly));
minimum_distance = wheel_r + ball_r;
if (cold < minimum_distance) {
hit = 1;
} else {
hit = 0;
}
if (((guy_rot > rot_limit) || (guy_rot < (-rot_limit))) || (hit == 1)) {
guy_rot = rot_limit;
this._y = -60;
time_init = new Date();
reset_ball();
}
if (this._y == -50) {
if (Key.isDown(32) && (!jumping)) {
if (jump_vel > max_charge) {
jump_vel = jump_vel + jump_charge;
_root.jump_charge.play();
}
} else if ((jump_vel != 0) && (!jumping)) {
jumping = 1;
_root.wheel._y = _root.wheel._y + jump_vel;
_root.dude._y = _root.dude._y + jump_vel;
jump_vel = jump_vel + gravity;
_root.jump_charge.gotoAndStop(1);
}
if (_root.wheel._y < Math.floor(STARTy)) {
if ((STARTy - _root.wheel._y) <= jump_vel) {
_root.wheel._y = STARTy;
_root.dude._y = STARTy_dude;
_root.SHADOW._alpha = 100;
jump_vel = 0;
jumping = 0;
} else {
_root.SHADOW._alpha = 100 - ((STARTy - _root.wheel._y) / 2.2);
_root.wheel._y = _root.wheel._y + jump_vel;
_root.dude._y = _root.dude._y + jump_vel;
jump_vel = jump_vel + gravity;
}
} else {
_root.dude._rotation = guy_rot;
_root.dude.right_arm._rotation = (guy_rot * arms_factor) * 0.7;
_root.dude.left_arm._rotation = guy_rot * arms_factor;
}
this._x = this._x + (accn * elasticity);
_root.wheel._x = this._x;
_root.SHADOW._x = this._x;
_root.dude._x = this._x;
_root.wheel._rotation = wheel_rot;
if (_root.restart._alpha > 0) {
_root.restart._alpha = _root.restart._alpha - fadeout_speed;
} else {
_root.restart._visible = false;
}
_root.timer.text = time_txt;
_root.btimer.text = btime_txt;
_root.restart.btimer2.text = btime_txt;
} else if (_root.restart._alpha < 120) {
_root.restart._visible = true;
_root.restart._alpha = _root.restart._alpha + fadein_speed;
difficulty = difficulty_init;
tightness = tightness_init;
jump_vel = 0;
} else {
time_init = new Date();
}
}
}
Instance of Symbol 96 MovieClip "restart" in Frame 4
onClipEvent (enterFrame) {
if (this._alpha >= 100) {
this.btimer2.text = _root.UNI_ROOT.btime_txt;
trace(_root.UNI_ROOT.btime_txt);
}
}
Frame 5
stop();
Instance of Symbol 109 MovieClip "submitting_note" in Frame 5
onClipEvent (load) {
this._visible = false;
}
Frame 6
scores_xml = new XML();
scores_xml.ignoreWhite = true;
names = new Array();
times = new Array();
timestr = "";
namestr = "";
i = 1;
scores_xml.onLoad = function (success) {
if (success) {
var _local2 = 0;
while (_local2 < scores_xml.firstChild.childNodes.length) {
rank = scores_xml.firstChild.childNodes[_local2].attributes.rank;
hname = scores_xml.firstChild.childNodes[_local2].attributes.name;
min = scores_xml.firstChild.childNodes[_local2].attributes.min;
sec = scores_xml.firstChild.childNodes[_local2].attributes.sec;
ms = scores_xml.firstChild.childNodes[_local2].attributes.ms;
names[rank] = hname;
times[rank] = (((min + ":") + sec) + ":") + ms;
_local2++;
}
rank = 1;
while (rank <= 10) {
timestr = (timestr + times[rank]) + newline;
namestr = (namestr + names[rank]) + newline;
rank++;
}
_root.score_times.text = timestr;
} else {
namestr = "Error:\nCouldn't load\nhigh score data";
}
_root.score_names.text = namestr;
};
scores_xml.load("http://www.gfxmonk.com/misc/unigame/highscores.xml");
stop();
Symbol 13 Button
on (release) {
getURL ("http://www.gfxmonk.com", "_new");
}
Symbol 20 Button
on (press) {
gotoAndStop (3);
}
Symbol 46 Button
on (press) {
gotoAndStop (4);
}
Symbol 66 MovieClip Frame 1
stop();
Symbol 66 MovieClip Frame 20
stop();
Symbol 82 Button
on (release) {
_root.gotoAndStop(6);
}
Symbol 87 Button
on (release) {
_root.gotoAndStop(5);
}
Symbol 92 Button
on (release) {
_root.UNI_ROOT._y = -50;
x = _root._xmouse;
_root.UNI_ROOT._x = x;
_root.wheel._x = x;
_root.SHADOW._x = x;
_root.dude._x = x - 5;
_root.dude._rotation = -0.5;
_root.jump_charge.gotoAndStop(1);
}
Symbol 99 Button
on (release) {
getURL ("http://www.tim3d.tk", "_new");
}
Symbol 106 Button
on (release) {
if (_root.UNI_ROOT.best_sub != _root.UNI_ROOT.best_ms) {
if (_root.name.text != "") {
_root.submit_submit._visible = false;
_root.submitting_note._visible = true;
submit_data = new LoadVars();
verification = new LoadVars();
submit_data.hfdhjihehgsd = _root.name.text;
submit_data.gfuyalamodhiq = _root.UNI_ROOT.best_ms;
submit_data.sendAndLoad("http://www.gfxmonk.com/misc/unigame/score.php", verification, "GET");
verification.onLoad = function (success) {
trace((("loaded: " + success) + ", ") + verification.msg);
if ((success == true) && (verification.msg == "ok")) {
_root.UNI_ROOT.best_sub = _root.UNI_ROOT.best_ms;
gotoAndStop (6);
}
if (verification.msg == "ERROR") {
_root.error_display.text = "Server Error:\n" + verification.error;
_root.submit_submit._visible = true;
_root.submitting_note._visible = false;
}
};
} else {
_root.error_display.text = "Submission Error:\nYou need to enter a name!";
}
} else {
_root.error_display.text = "Submission Error:\nYou have already submitted this score!";
}
}
Symbol 114 Button
on (release) {
_root.gotoAndStop(4);
_root.ball._x = -70;
_root.UNI_ROOT.next_timeout = -2500;
_root.UNI_ROOT.time_init = new Date();
}
Symbol 123 Button
on (release) {
gotoAndStop (5);
}
Symbol 125 Button
on (release) {
_root.gotoAndStop(4);
}