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;
var pv;
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);
}
pv = ((fv == 5) ? (getVersion()) : (System.capabilities.version));
u = (((((((((((("http://" + mbc) + "/my/core.swf?mv=8&fv=") + fv) + "&v=") + escape(pv)) + "&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__("cbe78bf2", this, 10301, true);
Symbol 26 MovieClip [cart_groupie2] Frame 1
stop();
Symbol 37 MovieClip [cart_groupie3] Frame 1
stop();
Symbol 48 MovieClip [cart_groupie1] Frame 1
stop();
Symbol 84 MovieClip [guy] Frame 1
stop();
Symbol 84 MovieClip [guy] Frame 2
stop();
Symbol 84 MovieClip [guy] Frame 19
stop();
Symbol 88 MovieClip [floatingScore] Frame 1
this.dx = 1 * (Math.random() - 0.5);
this.dy = (-2 + Math.random()) - 0.5;
this.scoreText.textColor = this.col;
this.onEnterFrame = function () {
this._x = this._x + this.dx;
this._y = this._y + this.dy;
this._xscale = this._xscale + dS;
this._yscale = this._yscale + dS;
this._alpha = this._alpha - 5;
};
Symbol 88 MovieClip [floatingScore] Frame 20
this.removeMovieClip();
Symbol 104 MovieClip [headblood] Frame 1
this._xscale = 0;
this._yscale = 0;
this.onEnterFrame = function () {
if (this.targetScale <= 0) {
this.targetScale = 1;
}
var _local2 = 1 - (this._currentframe / 100);
this._xscale = this._xscale + ((_local2 * 3) * this.targetScale);
this._yscale = this._yscale + ((_local2 * 3) * this.targetScale);
this._x = this._x + ((_local2 * 0.3) * this.targetScale);
this._y = this._y + ((_local2 * 0.3) * this.targetScale);
};
Symbol 104 MovieClip [headblood] Frame 100
delete this.onEnterFrame;
stop();
Symbol 145 Button
on (release) {
_parent.play();
}
Symbol 158 Button
on (release) {
if (!gDisableMochi) {
var playerscore = _root.MAIN.gPowerUps.mBestScore;
if (playerscore > _root.MAIN.gPowerUps.mSubmittedBestScore) {
_root.MAIN.gPowerUps.mSubmittedBestScore = playerscore;
_root.MAIN.game.storemc.MAIN_STORE.scoreboardPanel.butSubmit.enabled = false;
mochi.MochiScores.showLeaderboard({score:playerscore, onClose:function () {
}});
}
}
}
Symbol 168 Button
on (release) {
gPU_HasRockets = true;
}
Symbol 194 MovieClip [store] Frame 1
Symbol 195 MovieClip [MAIN_STORE] Frame 1
gSndStoreDrop = new Sound();
gSndStoreDrop.attachSound("s_storeDrop.wav");
gSndStoreDrop.start();
Symbol 195 MovieClip [MAIN_STORE] Frame 25
stop();
Symbol 195 MovieClip [MAIN_STORE] Frame 26
gSndStoreDrop.start();
Symbol 195 MovieClip [MAIN_STORE] Frame 50
stop();
Symbol 195 MovieClip [MAIN_STORE] Frame 51
gSndStoreDrop.start();
Symbol 195 MovieClip [MAIN_STORE] Frame 65
stop();
gStore.mDone = true;
Symbol 218 MovieClip [floatingTrickScore] Frame 1
this.dx = 0;
this.dy = -1.5;
this.scoreText.textColor = this.col;
this.onEnterFrame = function () {
this._x = this._x + this.dx;
this._y = this._y + this.dy;
this._alpha = this._alpha - 2;
};
Symbol 218 MovieClip [floatingTrickScore] Frame 40
this.removeMovieClip();
Symbol 224 Button
on (release) {
Key.removeListener(keyListener);
delete keyListener;
gotoAndStop ("game");
}
Symbol 226 Button
on (release) {
if (!gDisableMochi) {
mochi.MochiScores.showLeaderboard({onClose:function () {
}});
}
}
Symbol 236 MovieClip Frame 1
gDisableMochi = false;
if (!gDisableMochi) {
MochiAd.showPreGameAd({id:"6344101dfaf57a3d", res:"550x400", clip:_root.MAIN});
mochi.MochiServices.connect("6344101dfaf57a3d", _root.MAIN);
mochi.MochiScores.setBoardID("da7e919ca2e1f004");
}
gPowerUps = new PowerUps();
Symbol 236 MovieClip Frame 7
stop();
keyListener = new Object();
keyListener.onKeyDown = function () {
var _local1 = Key.getCode();
if (_local1 == 32) {
Key.removeListener(keyListener);
delete keyListener;
gotoAndStop ("game");
}
};
Key.addListener(keyListener);
stop();
Symbol 236 MovieClip Frame 25
function StartGame() {
fpsText = "";
game.createEmptyMovieClip("gamemc", 3);
gWorld = new World(game.gamemc, onGameDone, gPowerUps);
}
function onGameDone() {
gWorld.Destructor();
delete gWorld;
StartStore();
}
function StartStore() {
game.createEmptyMovieClip("storemc", 4);
gStore = new Store(game.storemc, onStoreDone, gPowerUps);
}
function onStoreDone() {
gStore.Destructor();
delete gStore;
game.storemc.removeMovieClip();
game.gamemc.removeMovieClip();
StartGame();
}
stop();
StartGame();
Symbol 237 MovieClip [__Packages.mochi.MochiScores] Frame 0
class mochi.MochiScores
{
static var boardID, onClose, onError;
function MochiScores () {
}
static function setBoardID(boardID) {
mochi.MochiScores.boardID = boardID;
mochi.MochiServices.send("scores_setBoardID", {boardID:boardID});
}
static function showLeaderboard(options) {
if ((options.clip == null) || (options.clip == undefined)) {
options.clip = mochi.MochiServices.clip;
}
if ((options.clip != mochi.MochiServices.__get__clip()) || (mochi.MochiServices.__get__childClip()._target == undefined)) {
mochi.MochiServices.disconnect();
mochi.MochiServices.connect(mochi.MochiServices.__get__id(), options.clip);
}
delete options.clip;
if (options.name != null) {
if (typeof(options.name) == "object") {
if (options.name.text != undefined) {
options.name = options.name.text;
}
}
}
if (options.score != null) {
if (options.score instanceof TextField) {
if (options.score.text != undefined) {
options.score = options.score.text;
}
} else if (options.score instanceof mochi.MochiDigits) {
options.score = options.score.value;
}
var _local1 = Number(options.score);
if (isNaN(_local1)) {
trace(("ERROR: Submitted score '" + options.score) + "' will be rejected, score is 'Not a Number'");
} else if ((_local1 == Number.NEGATIVE_INFINITY) || (_local1 == Number.POSITIVE_INFINITY)) {
trace(("ERROR: Submitted score '" + options.score) + "' will be rejected, score is an infinite");
} else {
if (Math.floor(_local1) != _local1) {
trace(("WARNING: Submitted score '" + options.score) + "' will be truncated");
}
options.score = _local1;
}
}
if (options.onDisplay != null) {
options.onDisplay();
} else {
mochi.MochiServices.__get__clip().stop();
}
if (options.onClose != null) {
onClose = options.onClose;
} else {
onClose = function () {
mochi.MochiServices.__get__clip().play();
};
}
if (options.onError != null) {
onError = options.onError;
} else {
onError = onClose;
}
if (options.boardID == null) {
if (boardID != null) {
options.boardID = boardID;
}
}
mochi.MochiServices.send("scores_showLeaderboard", {options:options}, null, doClose);
}
static function closeLeaderboard() {
mochi.MochiServices.send("scores_closeLeaderboard");
}
static function getPlayerInfo(callbackObj, callbackMethod) {
mochi.MochiServices.send("scores_getPlayerInfo", null, callbackObj, callbackMethod);
}
static function submit(score, name, callbackObj, callbackMethod) {
score = Number(score);
if (isNaN(score)) {
trace(("ERROR: Submitted score '" + String(score)) + "' will be rejected, score is 'Not a Number'");
} else if ((score == Number.NEGATIVE_INFINITY) || (score == Number.POSITIVE_INFINITY)) {
trace(("ERROR: Submitted score '" + String(score)) + "' will be rejected, score is an infinite");
} else {
if (Math.floor(score) != score) {
trace(("WARNING: Submitted score '" + String(score)) + "' will be truncated");
}
score = Number(score);
}
mochi.MochiServices.send("scores_submit", {score:score, name:name}, callbackObj, callbackMethod);
}
static function requestList(callbackObj, callbackMethod) {
mochi.MochiServices.send("scores_requestList", null, callbackObj, callbackMethod);
}
static function scoresArrayToObjects(scores) {
var _local5 = {};
var _local1;
var _local4;
var _local2;
var _local6;
for (var _local8 in scores) {
if (typeof(scores[_local8]) == "object") {
if ((scores[_local8].cols != null) && (scores[_local8].rows != null)) {
_local5[_local8] = [];
_local2 = scores[_local8];
_local4 = 0;
while (_local4 < _local2.rows.length) {
_local6 = {};
_local1 = 0;
while (_local1 < _local2.cols.length) {
_local6[_local2.cols[_local1]] = _local2.rows[_local4][_local1];
_local1++;
}
_local5[_local8].push(_local6);
_local4++;
}
} else {
_local5[_local8] = {};
for (var _local7 in scores[_local8]) {
_local5[_local8][_local7] = scores[_local8][_local7];
}
}
} else {
_local5[_local8] = scores[_local8];
}
}
return(_local5);
}
static function doClose(args) {
if (args.error == true) {
if (args.errorCode == undefined) {
args.errorCode = "IOError";
}
onError.apply(null, [args.errorCode]);
} else {
onClose.apply();
}
}
}
Symbol 238 MovieClip [__Packages.mochi.MochiServices] Frame 0
class mochi.MochiServices
{
static var _id, _container, _clip, _sendChannelName, __get__comChannelName, onError, _listenChannel, _loader, _loaderListener, _sendChannel;
function MochiServices () {
}
static function get id() {
return(_id);
}
static function get clip() {
return(_container);
}
static function get childClip() {
return(_clip);
}
static function getVersion() {
return("1.43");
}
static function allowDomains(server) {
var _local1 = server.split("/")[2].split(":")[0];
if (System.security) {
if (System.security.allowDomain) {
System.security.allowDomain("*");
System.security.allowDomain(_local1);
}
if (System.security.allowInsecureDomain) {
System.security.allowInsecureDomain("*");
System.security.allowInsecureDomain(_local1);
}
}
return(_local1);
}
static function get isNetworkAvailable() {
if (System.security) {
var _local1 = System.security;
if (_local1.sandboxType == "localWithFile") {
return(false);
}
}
return(true);
}
static function set comChannelName(val) {
if (val != undefined) {
if (val.length > 3) {
_sendChannelName = val + "_fromgame";
initComChannels();
}
}
//return(__get__comChannelName());
}
static function get connected() {
return(_connected);
}
static function connect(id, clip, onError) {
if ((!_connected) && (_clip == undefined)) {
trace("MochiServices Connecting...");
_connecting = true;
init(id, clip);
}
if (onError != undefined) {
mochi.MochiServices.onError = onError;
} else if (mochi.MochiServices.onError == undefined) {
mochi.MochiServices.onError = function (errorCode) {
trace(errorCode);
};
}
}
static function disconnect() {
if (_connected || (_connecting)) {
_connecting = (_connected = false);
flush(true);
if (_clip != undefined) {
_clip.removeMovieClip();
delete _clip;
}
_listenChannel.close();
}
}
static function init(id, clip) {
_id = id;
if (clip != undefined) {
_container = clip;
} else {
_container = _root;
}
loadCommunicator(id, _container);
}
static function loadCommunicator(id, clip) {
var _local3 = "_mochiservices_com_" + id;
if (_clip != null) {
return(_clip);
}
if (!isNetworkAvailable) {
return(null);
}
if (urlOptions().servicesURL != undefined) {
_servicesURL = urlOptions().servicesURL;
}
allowDomains(_servicesURL);
_clip = clip.createEmptyMovieClip(_local3, 10336, false);
_listenChannelName = _listenChannelName + ((Math.floor(new Date().getTime()) + "_") + Math.floor(Math.random() * 99999));
_loader = new MovieClipLoader();
if (_loaderListener.waitInterval != null) {
clearInterval(_loaderListener.waitInterval);
}
_loaderListener = {};
_loaderListener.onLoadError = function (target_mc, errorCode, httpStatus) {
trace("MochiServices could not load.");
mochi.MochiServices.disconnect();
mochi.MochiServices.onError.apply(null, [errorCode]);
};
_loaderListener.onLoadStart = function (target_mc) {
this.isLoading = true;
};
_loaderListener.startTime = getTimer();
_loaderListener.wait = function () {
if ((getTimer() - this.startTime) > 10000) {
if (!this.isLoading) {
mochi.MochiServices.disconnect();
mochi.MochiServices.onError.apply(null, ["IOError"]);
}
clearInterval(this.waitInterval);
}
};
_loaderListener.waitInterval = setInterval(_loaderListener, "wait", 1000);
_loader.addListener(_loaderListener);
_loader.loadClip((((_servicesURL + "?listenLC=") + _listenChannelName) + "&mochiad_options=") + escape(_root.mochiad_options), _clip);
_sendChannel = new LocalConnection();
_sendChannel._queue = [];
listen();
return(_clip);
}
static function onStatus(infoObject) {
if (!(infoObject.level === "error")) {
} else {
_connected = false;
_listenChannel.connect(_listenChannelName);
}
}
static function listen() {
_listenChannel = new LocalConnection();
_listenChannel.handshake = function (args) {
mochi.MochiServices.__set__comChannelName(args.newChannel);
};
_listenChannel.allowDomain = function (d) {
return(true);
};
_listenChannel.allowInsecureDomain = _listenChannel.allowDomain;
_listenChannel._nextcallbackID = 0;
_listenChannel._callbacks = {};
_listenChannel.connect(_listenChannelName);
trace("Waiting for MochiAds services to connect...");
}
static function initComChannels() {
if (!_connected) {
_sendChannel.onStatus = function (infoObject) {
mochi.MochiServices.onStatus(infoObject);
};
_sendChannel.send(_sendChannelName, "onReceive", {methodName:"handshakeDone"});
_sendChannel.send(_sendChannelName, "onReceive", {methodName:"registerGame", id:_id, clip:_clip, version:getVersion()});
_listenChannel.onStatus = function (infoObject) {
mochi.MochiServices.onStatus(infoObject);
};
_listenChannel.onReceive = function (pkg) {
var _local5 = pkg.callbackID;
var _local4 = this._callbacks[_local5];
if (!_local4) {
return(undefined);
}
var _local2 = _local4.callbackMethod;
var _local3 = _local4.callbackObject;
if (_local3 && (typeof(_local2) == "string")) {
_local2 = _local3[_local2];
}
if (_local2 != undefined) {
_local2.apply(_local3, pkg.args);
}
delete this._callbacks[_local5];
};
_listenChannel.onError = function () {
mochi.MochiServices.onError.apply(null, ["IOError"]);
};
trace("connected!");
_connecting = false;
_connected = true;
while (_sendChannel._queue.length > 0) {
_sendChannel.send(_sendChannelName, "onReceive", _sendChannel._queue.shift());
}
}
}
static function flush(error) {
var _local1;
var _local2;
while (_sendChannel._queue.length > 0) {
_local1 = _sendChannel._queue.shift();
if (_local1.callbackID != null) {
_local2 = _listenChannel._callbacks[_local1.callbackID];
}
delete _listenChannel._callbacks[_local1.callbackID];
if (error) {
handleError(_local1.args, _local2.callbackObject, _local2.callbackMethod);
}
}
}
static function handleError(args, callbackObject, callbackMethod) {
if (args != null) {
if (args.onError != null) {
args.onError.apply(null, ["NotConnected"]);
}
if ((args.options != null) && (args.options.onError != null)) {
args.options.onError.apply(null, ["NotConnected"]);
}
}
if (callbackMethod != null) {
args = {};
args.error = true;
args.errorCode = "NotConnected";
if ((callbackObject != null) && (typeof(callbackMethod) == "string")) {
callbackObject[callbackMethod](args);
} else if (callbackMethod != null) {
callbackMethod.apply(args);
}
}
}
static function send(methodName, args, callbackObject, callbackMethod) {
if (_connected) {
_sendChannel.send(_sendChannelName, "onReceive", {methodName:methodName, args:args, callbackID:_listenChannel._nextcallbackID});
} else {
if ((_clip == undefined) || (!_connecting)) {
onError.apply(null, ["NotConnected"]);
handleError(args, callbackObject, callbackMethod);
flush(true);
return(undefined);
}
_sendChannel._queue.push({methodName:methodName, args:args, callbackID:_listenChannel._nextcallbackID});
}
_listenChannel._callbacks[_listenChannel._nextcallbackID] = {callbackObject:callbackObject, callbackMethod:callbackMethod};
_listenChannel._nextcallbackID++;
}
static function urlOptions() {
var _local5 = {};
if (_root.mochiad_options) {
var _local4 = _root.mochiad_options.split("&");
var _local2 = 0;
while (_local2 < _local4.length) {
var _local3 = _local4[_local2].split("=");
_local5[unescape(_local3[0])] = unescape(_local3[1]);
_local2++;
}
}
return(_local5);
}
static function addLinkEvent(url, burl, btn, onClick) {
var timeout = 1500;
var t0 = getTimer();
var _local2 = new Object();
_local2.mav = getVersion();
_local2.swfv = btn.getSWFVersion() || 6;
_local2.swfurl = btn._url;
_local2.fv = System.capabilities.version;
_local2.os = System.capabilities.os;
_local2.lang = System.capabilities.language;
_local2.scres = (System.capabilities.screenResolutionX + "x") + System.capabilities.screenResolutionY;
var s = "?";
var _local3 = 0;
for (var _local6 in _local2) {
if (_local3 != 0) {
s = s + "&";
}
_local3++;
s = ((s + _local6) + "=") + escape(_local2[_local6]);
}
if (!(netupAttempted || (_connected))) {
var ping = btn.createEmptyMovieClip("ping", 777);
var _local7 = btn.createEmptyMovieClip("nettest", 778);
netupAttempted = true;
ping.loadMovie("http://x.mochiads.com/linkping.swf?t=" + getTimer());
_local7.onEnterFrame = function () {
if ((ping._totalframes > 0) && (ping._totalframes == ping._framesloaded)) {
delete this.onEnterFrame;
} else if ((getTimer() - t0) > timeout) {
delete this.onEnterFrame;
mochi.MochiServices.netup = false;
}
};
}
var _local4 = btn.createEmptyMovieClip("clk", 1001);
_local4._alpha = 0;
_local4.beginFill(1044735);
_local4.moveTo(0, 0);
_local4.lineTo(0, btn._height);
_local4.lineTo(btn._width, btn._height);
_local4.lineTo(btn._width, 0);
_local4.lineTo(0, 0);
_local4.endFill();
_local4.onRelease = function () {
if (mochi.MochiServices.netup) {
getURL (url + s, "_blank");
} else {
getURL (burl, "_blank");
}
if (onClick != undefined) {
onClick();
}
};
}
static var _servicesURL = "http://www.mochiads.com/static/lib/services/services.swf";
static var _listenChannelName = "__ms_";
static var _connecting = false;
static var _connected = false;
static var netup = true;
static var netupAttempted = false;
}
Symbol 239 MovieClip [__Packages.mochi.MochiDigits] Frame 0
class mochi.MochiDigits
{
var Encoder, Fragment, Sibling;
function MochiDigits (digit, index) {
Encoder = 0;
setValue(digit, index);
}
function get value() {
return(Number(toString()));
}
function set value(v) {
setValue(v);
//return(value);
}
function addValue(v) {
value = value + v;
}
function setValue(digit, index) {
var _local3 = digit.toString();
if ((index == undefined) || (isNaN(index))) {
index = 0;
}
Fragment = _local3.charCodeAt(index++) ^ Encoder;
if (index < _local3.length) {
Sibling = new mochi.MochiDigits(digit, index);
} else {
Sibling = null;
}
reencode();
}
function reencode() {
var _local2 = int(2147483647 * Math.random());
Fragment = Fragment ^ (_local2 ^ Encoder);
Encoder = _local2;
}
function toString() {
var _local2 = String.fromCharCode(Fragment ^ Encoder);
return(((Sibling != null) ? (_local2.concat(Sibling.toString())) : (_local2)));
}
}
Symbol 240 MovieClip [__Packages.PowerUps] Frame 0
class PowerUps
{
function PowerUps (aParent) {
}
var mLastDist = 0;
var mLastHeight = 0;
var mLastStyle = 1;
var mLastTrick = 0;
var mLastScore = 0;
var mSubmittedBestScore = 0;
var mBestScore = 0;
var mTotalMoney = 0;
var mHasRockets0 = true;
var mHasRockets1 = false;
var mHasRockets2 = false;
var mHasRockets3 = false;
var mWheel0 = true;
var mWheel1 = false;
var mWheel2 = false;
var mWheel3 = false;
var mGroupie0 = true;
var mGroupie1 = false;
var mGroupie2 = false;
var mGroupie3 = false;
var mTrickHandstand = false;
var mTrickSuperman = false;
}
Symbol 241 MovieClip [__Packages.MochiAd] Frame 0
class MochiAd
{
function MochiAd () {
}
static function getVersion() {
return("2.7");
}
static function showPreGameAd(options) {
var _local26 = {clip:_root, ad_timeout:3000, fadeout_time:250, regpt:"o", method:"showPreloaderAd", color:16747008, background:16777161, outline:13994812, no_progress_bar:false, ad_started:function () {
this.clip.stop();
}, ad_finished:function () {
this.clip.play();
}, ad_failed:function () {
trace("[MochiAd] Couldn't load an ad, make sure that your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, ad_loaded:function (width, height) {
}, ad_skipped:function () {
}, ad_progress:function (percent) {
}};
options = _parseOptions(options, _local26);
if ("c862232051e0a94e1c3609b3916ddb17".substr(0) == "dfeada81ac97cde83665f81c12da7def") {
options.ad_started();
options.ad_finished();
return(undefined);
}
var clip = options.clip;
var _local22 = 11000;
var _local25 = options.ad_timeout;
delete options.ad_timeout;
var fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!load(options)) {
options.ad_failed();
options.ad_finished();
return(undefined);
}
options.ad_started();
var mc = clip._mochiad;
mc.onUnload = function () {
options.ad_finished();
};
var _local14 = _getRes(options);
var _local4 = _local14[0];
var _local13 = _local14[1];
mc._x = _local4 * 0.5;
mc._y = _local13 * 0.5;
var chk = mc.createEmptyMovieClip("_mochiad_wait", 3);
chk._x = _local4 * -0.5;
chk._y = _local13 * -0.5;
var _local6 = chk.createEmptyMovieClip("_mochiad_bar", 4);
if (options.no_progress_bar) {
_local6._visible = false;
delete options.no_progress_bar;
} else {
_local6._x = 10;
_local6._y = _local13 - 20;
}
var _local21 = options.color;
delete options.color;
var _local19 = options.background;
delete options.background;
var _local23 = options.outline;
delete options.outline;
var _local5 = _local6.createEmptyMovieClip("_outline", 1);
_local5.beginFill(_local19);
_local5.moveTo(0, 0);
_local5.lineTo(_local4 - 20, 0);
_local5.lineTo(_local4 - 20, 10);
_local5.lineTo(0, 10);
_local5.lineTo(0, 0);
_local5.endFill();
var _local3 = _local6.createEmptyMovieClip("_inside", 2);
_local3.beginFill(_local21);
_local3.moveTo(0, 0);
_local3.lineTo(_local4 - 20, 0);
_local3.lineTo(_local4 - 20, 10);
_local3.lineTo(0, 10);
_local3.lineTo(0, 0);
_local3.endFill();
_local3._xscale = 0;
var _local7 = _local6.createEmptyMovieClip("_outline", 3);
_local7.lineStyle(0, _local23, 100);
_local7.moveTo(0, 0);
_local7.lineTo(_local4 - 20, 0);
_local7.lineTo(_local4 - 20, 10);
_local7.lineTo(0, 10);
_local7.lineTo(0, 0);
chk.ad_msec = _local22;
chk.ad_timeout = _local25;
chk.started = getTimer();
chk.showing = false;
chk.last_pcnt = 0;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function () {
var _local2 = 100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time));
if (_local2 > 0) {
this._parent._alpha = _local2;
} else {
var _local3 = this._parent._parent;
MochiAd.unload(_local3);
delete this.onEnterFrame;
}
};
mc.lc.regContLC = function (lc_name) {
mc._containerLCName = lc_name;
};
var sendHostProgress = false;
mc.lc.sendHostLoadProgress = function (lc_name) {
sendHostProgress = true;
};
mc.lc.adLoaded = options.ad_loaded;
mc.lc.adSkipped = options.ad_skipped;
mc.lc.adjustProgress = function (msec) {
var _local2 = this.mc._mochiad_wait;
_local2.server_control = true;
_local2.started = getTimer();
_local2.ad_msec = msec;
};
mc.lc.rpc = function (callbackID, arg) {
MochiAd.rpc(clip, callbackID, arg);
};
mc.rpcTestFn = function (s) {
trace("[MOCHIAD rpcTestFn] " + s);
return(s);
};
chk.onEnterFrame = function () {
var _local6 = this._parent._parent;
var _local11 = this._parent._mochiad_ctr;
var _local5 = getTimer() - this.started;
var _local3 = false;
var _local4 = _local6.getBytesTotal();
var _local8 = _local6.getBytesLoaded();
var _local2 = (100 * _local8) / _local4;
var _local10 = (100 * _local5) / chk.ad_msec;
var _local9 = this._mochiad_bar._inside;
var _local13 = Math.min(100, Math.min(_local2 || 0, _local10));
_local13 = Math.max(this.last_pcnt, _local13);
this.last_pcnt = _local13;
_local9._xscale = _local13;
options.ad_progress(_local13);
if (sendHostProgress) {
clip._mochiad.lc.send(clip._mochiad._containerLCName, "notify", {id:"hostLoadPcnt", pcnt:_local2});
if (_local2 == 100) {
sendHostProgress = false;
}
}
if (!chk.showing) {
var _local7 = _local11.getBytesTotal();
if ((_local7 > 0) || (typeof(_local7) == "undefined")) {
chk.showing = true;
chk.started = getTimer();
} else if ((_local5 > chk.ad_timeout) && (_local2 == 100)) {
options.ad_failed();
_local3 = true;
}
}
if (_local5 > chk.ad_msec) {
_local3 = true;
}
if (((_local4 > 0) && (_local8 >= _local4)) && (_local3)) {
if (this.server_control) {
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = chk.fadeFunction;
}
}
};
}
static function showClickAwayAd(options) {
var _local9 = {clip:_root, ad_timeout:2000, fadeout_time:250, regpt:"o", method:"showClickAwayAd", res:"300x250", no_bg:true, ad_started:function () {
}, ad_finished:function () {
}, ad_loaded:function (width, height) {
}, ad_failed:function () {
trace("[MochiAd] Couldn't load an ad, make sure that your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, ad_skipped:function () {
}};
options = _parseOptions(options, _local9);
var clip = options.clip;
var _local8 = options.ad_timeout;
delete options.ad_timeout;
if (!load(options)) {
options.ad_failed();
options.ad_finished();
return(undefined);
}
options.ad_started();
var mc = clip._mochiad;
mc.onUnload = function () {
options.ad_finished();
};
var _local4 = _getRes(options);
var _local10 = _local4[0];
var _local7 = _local4[1];
mc._x = _local10 * 0.5;
mc._y = _local7 * 0.5;
var chk = mc.createEmptyMovieClip("_mochiad_wait", 3);
chk.ad_timeout = _local8;
chk.started = getTimer();
chk.showing = false;
mc.lc.adLoaded = options.ad_loaded;
mc.lc.adSkipped = options.ad_skipped;
mc.lc.rpc = function (callbackID, arg) {
MochiAd.rpc(clip, callbackID, arg);
};
mc.rpcTestFn = function (s) {
trace("[MOCHIAD rpcTestFn] " + s);
return(s);
};
var _local20 = false;
mc.lc.regContLC = function (lc_name) {
mc._containerLCName = lc_name;
};
chk.onEnterFrame = function () {
var _local5 = this._parent._mochiad_ctr;
var _local4 = getTimer() - this.started;
var _local2 = false;
if (!chk.showing) {
var _local3 = _local5.getBytesTotal();
if ((_local3 > 0) || (typeof(_local3) == "undefined")) {
_local2 = true;
chk.showing = true;
chk.started = getTimer();
} else if (_local4 > chk.ad_timeout) {
options.ad_failed();
_local2 = true;
}
}
if (_local2) {
delete this.onEnterFrame;
}
};
}
static function showInterLevelAd(options) {
var _local13 = {clip:_root, ad_timeout:2000, fadeout_time:250, regpt:"o", method:"showTimedAd", ad_started:function () {
this.clip.stop();
}, ad_finished:function () {
this.clip.play();
}, ad_failed:function () {
trace("[MochiAd] Couldn't load an ad, make sure that your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, ad_loaded:function (width, height) {
}, ad_skipped:function () {
}};
options = _parseOptions(options, _local13);
var clip = options.clip;
var _local10 = 11000;
var _local12 = options.ad_timeout;
delete options.ad_timeout;
var fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!load(options)) {
options.ad_failed();
options.ad_finished();
return(undefined);
}
options.ad_started();
var mc = clip._mochiad;
mc.onUnload = function () {
options.ad_finished();
};
var _local5 = _getRes(options);
var _local14 = _local5[0];
var _local11 = _local5[1];
mc._x = _local14 * 0.5;
mc._y = _local11 * 0.5;
var chk = mc.createEmptyMovieClip("_mochiad_wait", 3);
chk.ad_msec = _local10;
chk.ad_timeout = _local12;
chk.started = getTimer();
chk.showing = false;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function () {
var _local2 = 100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time));
if (_local2 > 0) {
this._parent._alpha = _local2;
} else {
var _local3 = this._parent._parent;
MochiAd.unload(_local3);
delete this.onEnterFrame;
}
};
mc.lc.adLoaded = options.ad_loaded;
mc.lc.adSkipped = options.ad_skipped;
mc.lc.adjustProgress = function (msec) {
var _local2 = this.mc._mochiad_wait;
_local2.server_control = true;
_local2.started = getTimer();
_local2.ad_msec = msec - 250;
};
mc.lc.rpc = function (callbackID, arg) {
MochiAd.rpc(clip, callbackID, arg);
};
mc.rpcTestFn = function (s) {
trace("[MOCHIAD rpcTestFn] " + s);
return(s);
};
chk.onEnterFrame = function () {
var _local5 = this._parent._mochiad_ctr;
var _local4 = getTimer() - this.started;
var _local2 = false;
if (!chk.showing) {
var _local3 = _local5.getBytesTotal();
if ((_local3 > 0) || (typeof(_local3) == "undefined")) {
chk.showing = true;
chk.started = getTimer();
} else if (_local4 > chk.ad_timeout) {
options.ad_failed();
_local2 = true;
}
}
if (_local4 > chk.ad_msec) {
_local2 = true;
}
if (_local2) {
if (this.server_control) {
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = this.fadeFunction;
}
}
};
}
static function showPreloaderAd(options) {
trace("[MochiAd] DEPRECATED: showPreloaderAd was renamed to showPreGameAd in 2.0");
showPreGameAd(options);
}
static function showTimedAd(options) {
trace("[MochiAd] DEPRECATED: showTimedAd was renamed to showInterLevelAd in 2.0");
showInterLevelAd(options);
}
static function _allowDomains(server) {
var _local1 = server.split("/")[2].split(":")[0];
if (System.security) {
if (System.security.allowDomain) {
System.security.allowDomain("*");
System.security.allowDomain(_local1);
}
if (System.security.allowInsecureDomain) {
System.security.allowInsecureDomain("*");
System.security.allowInsecureDomain(_local1);
}
}
return(_local1);
}
static function load(options) {
var _local13 = {clip:_root, server:"http://x.mochiads.com/srv/1/", method:"load", depth:10333, id:"_UNKNOWN_"};
options = _parseOptions(options, _local13);
options.swfv = options.clip.getSWFVersion() || 6;
options.mav = getVersion();
var _local9 = options.clip;
if (!_isNetworkAvailable()) {
return(null);
}
if (_local9._mochiad_loaded) {
return(null);
}
var _local12 = options.depth;
delete options.depth;
var _local6 = _local9.createEmptyMovieClip("_mochiad", _local12);
var _local11 = _getRes(options);
options.res = (_local11[0] + "x") + _local11[1];
options.server = options.server + options.id;
delete options.id;
_local9._mochiad_loaded = true;
var _local4 = _local6.createEmptyMovieClip("_mochiad_ctr", 1);
for (var _local7 in options) {
_local4[_local7] = options[_local7];
}
var _local10 = _local4.server;
delete _local4.server;
var _local14 = _allowDomains(_local10);
_local6.onEnterFrame = function () {
if (this._mochiad_ctr._url != this._url) {
this.onEnterFrame = function () {
if (!this._mochiad_ctr) {
delete this.onEnterFrame;
MochiAd.unload(this._parent);
}
};
}
};
var _local5 = new LocalConnection();
var _local8 = ["", Math.floor(new Date().getTime()), random(999999)].join("_");
_local5.mc = _local6;
_local5.name = _local8;
_local5.hostname = _local14;
_local5.allowDomain = function (d) {
return(true);
};
_local5.allowInsecureDomain = _local5.allowDomain;
_local5.connect(_local8);
_local6.lc = _local5;
_local4.lc = _local8;
_local4.st = getTimer();
_local4.loadMovie(_local10 + ".swf", "POST");
return(_local6);
}
static function unload(clip) {
if (typeof(clip) == "undefined") {
clip = _root;
}
if (clip.clip && (clip.clip._mochiad)) {
clip = clip.clip;
}
if (!clip._mochiad) {
return(false);
}
if (clip._mochiad._containerLCName != undefined) {
clip._mochiad.lc.send(clip._mochiad._containerLCName, "notify", {id:"unload"});
}
clip._mochiad.removeMovieClip();
delete clip._mochiad_loaded;
delete clip._mochiad;
return(true);
}
static function _isNetworkAvailable() {
if (System.security) {
var _local1 = System.security;
if (_local1.sandboxType == "localWithFile") {
return(false);
}
}
return(true);
}
static function _getRes(options) {
var _local3 = options.clip.getBounds();
var _local2 = 0;
var _local1 = 0;
if (typeof(options.res) != "undefined") {
var _local4 = options.res.split("x");
_local2 = parseFloat(_local4[0]);
_local1 = parseFloat(_local4[1]);
} else {
_local2 = _local3.xMax - _local3.xMin;
_local1 = _local3.yMax - _local3.yMin;
}
if ((_local2 == 0) || (_local1 == 0)) {
_local2 = Stage.width;
_local1 = Stage.height;
}
return([_local2, _local1]);
}
static function _parseOptions(options, defaults) {
var _local4 = {};
for (var _local8 in defaults) {
_local4[_local8] = defaults[_local8];
}
if (options) {
for (var _local8 in options) {
_local4[_local8] = options[_local8];
}
}
if (_root.mochiad_options) {
var _local5 = _root.mochiad_options.split("&");
var _local2 = 0;
while (_local2 < _local5.length) {
var _local3 = _local5[_local2].split("=");
_local4[unescape(_local3[0])] = unescape(_local3[1]);
_local2++;
}
}
if (_local4.id == "test") {
trace("[MochiAd] WARNING: Using the MochiAds test identifier, make sure to use the code from your dashboard, not this example!");
}
return(_local4);
}
static function rpc(clip, callbackID, arg) {
switch (arg.id) {
case "setValue" :
setValue(clip, arg.objectName, arg.value);
break;
case "getValue" :
var _local4 = getValue(clip, arg.objectName);
clip._mochiad.lc.send(clip._mochiad._containerLCName, "rpcResult", callbackID, _local4);
break;
case "runMethod" :
var _local3 = runMethod(clip, arg.method, arg.args);
clip._mochiad.lc.send(clip._mochiad._containerLCName, "rpcResult", callbackID, _local3);
break;
default :
trace("[mochiads rpc] unknown rpc id: " + arg.id);
}
}
static function setValue(base, objectName, value) {
var _local2 = objectName.split(".");
var _local1;
_local1 = 0;
while (_local1 < (_local2.length - 1)) {
if ((base[_local2[_local1]] == undefined) || (base[_local2[_local1]] == null)) {
return(undefined);
}
base = base[_local2[_local1]];
_local1++;
}
base[_local2[_local1]] = value;
}
static function getValue(base, objectName) {
var _local2 = objectName.split(".");
var _local1;
_local1 = 0;
while (_local1 < (_local2.length - 1)) {
if ((base[_local2[_local1]] == undefined) || (base[_local2[_local1]] == null)) {
return(undefined);
}
base = base[_local2[_local1]];
_local1++;
}
return(base[_local2[_local1]]);
}
static function runMethod(base, methodName, argsArray) {
var _local2 = methodName.split(".");
var _local1;
_local1 = 0;
while (_local1 < (_local2.length - 1)) {
if ((base[_local2[_local1]] == undefined) || (base[_local2[_local1]] == null)) {
return(undefined);
}
base = base[_local2[_local1]];
_local1++;
}
if (typeof(base[_local2[_local1]]) == "function") {
return(base[_local2[_local1]].apply(base, argsArray));
}
return(undefined);
}
}
Symbol 242 MovieClip [__Packages.UpdatableGameLoop] Frame 0
class UpdatableGameLoop
{
var mParent, mOnUpdateFunction, mOnDoneFunction, mLastTimer, mFPSCnt, mFPSTime, mNextDT;
function UpdatableGameLoop (aParent, aOnUpdateFunction, aOnDoneFunction) {
mParent = aParent;
mOnUpdateFunction = aOnUpdateFunction;
mOnDoneFunction = aOnDoneFunction;
mLastTimer = 0;
mParent.onEnterFrame = mx.utils.Delegate.create(this, _Update);
Mouse.addListener(this);
Key.addListener(this);
mFPSCnt = 0;
mFPSTime = 0;
mNextDT = 0.0166666666666667;
}
function Destructor() {
delete mParent.onEnterFrame;
Key.removeListener(this);
Mouse.removeListener(this);
delete mOnUpdateFunction;
delete mOnDoneFunction;
}
function _Update() {
var _local3 = Math.max(0.01666, Math.min(0.0333, mNextDT));
mLastTimer = timer;
if ((++mFPSCnt) > 10) {
var timer = getTimer();
var _local2 = (mFPSCnt * 1000) / (timer - mFPSTime);
mNextDT = 1 / _local2;
mFPSTime = timer;
mFPSCnt = 0;
}
if (mOnUpdateFunction(_local3) == false) {
if (mOnDoneFunction != undefined) {
mOnDoneFunction();
}
delete mParent.onEnterFrame;
}
}
}
Symbol 243 MovieClip [__Packages.mx.utils.Delegate] Frame 0
class mx.utils.Delegate extends Object
{
var func;
function Delegate (f) {
super();
func = f;
}
static function create(obj, func) {
var _local2 = function () {
var _local2 = arguments.callee.target;
var _local3 = arguments.callee.func;
return(_local3.apply(_local2, arguments));
};
_local2.target = obj;
_local2.func = func;
return(_local2);
}
function createDelegate(obj) {
return(create(obj, func));
}
}
Symbol 244 MovieClip [__Packages.World] Frame 0
class World extends UpdatableGameLoop
{
var mParent, mHelpTips, mKbd, mKbdPressed, mGameOver, mPowerUps, mKeyCodeBuf, mKeyTimeBuf, mMaxDist, mMaxHeight, mFirstDist, mTrickPts, mWaitForStartKey, mDone, mDoneTimer, mCart, mGroundPhase, mJunk, mTipMode;
function World (aParent, aOnDone, aPowerUps) {
super(aParent, Update, aOnDone);
aParent.attachMovie("skygradient", "sky", aParent.getNextHighestDepth(), {_x:-1});
mParent = aParent.attachMovie("campfire", "game", aParent.getNextHighestDepth());
mHelpTips = aParent.createEmptyMovieClip("helptips", aParent.getNextHighestDepth());
mKbd = new Array();
mKbdPressed = new Array();
mGameOver = false;
mPowerUps = aPowerUps;
mKeyCodeBuf = new Array();
mKeyTimeBuf = new Array();
InitWorld();
}
function toString() {
return("World");
}
function Destructor() {
super.Destructor();
}
function InitWorld() {
mMaxDist = 0;
mMaxHeight = 0;
mFirstDist = 0;
mTrickPts = 0;
mWaitForStartKey = true;
mDone = false;
mDoneTimer = 0;
mCart = new Cart(this, mParent, mParent.getNextHighestDepth());
mParent._x = 200 - mCart.mPos.x;
mParent._y = 200 - mCart.mPos.y;
mGroundPhase = Math.random() * 1000;
mParent.beginFill(7820595);
mParent.moveTo(-500, 300);
mParent.lineTo(-500, GetGroundHeight(-1000) - 30);
var _local2 = 0;
while (_local2 < 3000) {
mParent.lineTo(_local2, GetGroundHeight(_local2) - 20);
_local2 = _local2 + 5;
}
while (_local2 < 100000) {
mParent.lineTo(_local2, GetGroundHeight(_local2) - 20);
_local2 = _local2 + 25;
}
mParent.lineTo(100000, GetGroundHeight(50000) - 30);
mParent.lineTo(100000, 300);
mParent.endFill();
_local2 = 50;
while (_local2 < 2600) {
mParent.attachMovie("flag" + ((_local2 < 800) ? "blue" : (((_local2 < 1100) ? "yellow" : "green"))), "tree" + _local2, mParent.getNextHighestDepth(), {_x:_local2, _y:GetGroundHeight(_local2) + 10});
_local2 = _local2 + 200;
}
mParent.attachMovie("flaggetin", "jumpingate", mParent.getNextHighestDepth(), {_x:900, _y:GetGroundHeight(900)});
mParent.attachMovie("flaggetin", "jumpupgate", mParent.getNextHighestDepth(), {_x:2650, _y:GetGroundHeight(2650)});
mJunk = new Array();
mJunk.push(mParent.attachMovie("tree", "tree1", mParent.getNextHighestDepth(), {_x:4000, _y:50, ymin:50, ymax:100, xskip:1000}));
mJunk.push(mParent.attachMovie("tree", "tree2", mParent.getNextHighestDepth(), {_x:4500, _y:50, ymin:50, ymax:100, xskip:1000}));
mJunk.push(mParent.attachMovie("cloud", "cloud1", mParent.getNextHighestDepth(), {_x:3000, _y:-300 - (Math.random() * 500), ymin:-300, ymax:-1000, xskip:1000}));
mJunk.push(mParent.attachMovie("cloud", "cloud2", mParent.getNextHighestDepth(), {_x:3500, _y:-300 - (Math.random() * 500), ymin:-300, ymax:-1000, xskip:1000}));
mJunk.push(mParent.attachMovie("star", "star1", mParent.getNextHighestDepth(), {_x:3000, _y:-1500 - (Math.random() * 1000), ymin:-2000, ymax:-4000, xskip:1000}));
mJunk.push(mParent.attachMovie("star", "star2", mParent.getNextHighestDepth(), {_x:3500, _y:-1500 - (Math.random() * 1000), ymin:-2000, ymax:-4000, xskip:1000}));
mJunk.push(mParent.attachMovie("star", "star3", mParent.getNextHighestDepth(), {_x:3000, _y:-1500 - (Math.random() * 1000), ymin:-2000, ymax:-4000, xskip:1000}));
mJunk.push(mParent.attachMovie("star", "star4", mParent.getNextHighestDepth(), {_x:3500, _y:-1500 - (Math.random() * 1000), ymin:-2000, ymax:-4000, xskip:1000}));
mJunk.push(mParent.attachMovie("star", "star5", mParent.getNextHighestDepth(), {_x:3000, _y:-1500 - (Math.random() * 1000), ymin:-2000, ymax:-4000, xskip:1000}));
mJunk.push(mParent.attachMovie("star", "star6", mParent.getNextHighestDepth(), {_x:3500, _y:-1500 - (Math.random() * 1000), ymin:-2000, ymax:-4000, xskip:1000}));
mTipMode = 0;
}
function UpdateHelpTips() {
var _local2 = 0;
if (mTipMode == 0) {
mHelpTips.attachMovie("helptip1", "arrowfwd", mHelpTips.getNextHighestDepth(), {_x:100, _y:300});
mTipMode++;
}
_local2++;
if (mTipMode == _local2) {
if (mCart.mPos.x > 150) {
mHelpTips.arrowfwd.onEnterFrame = function () {
if (((this._alpha = this._alpha - 5)) < 0) {
this.removeMovieClip();
}
};
mTipMode++;
}
}
_local2++;
if (mTipMode == _local2) {
if (mCart.mPos.x > 600) {
mHelpTips.attachMovie("helptip3", "arrowup", mHelpTips.getNextHighestDepth(), {_x:100, _y:300});
mTipMode++;
}
}
_local2++;
if (mTipMode == _local2) {
if (mCart.mRunning == false) {
mHelpTips.arrowup.onEnterFrame = function () {
if (((this._alpha = this._alpha - 5)) < 0) {
this.removeMovieClip();
}
};
mTipMode++;
}
}
_local2++;
if (mTipMode == _local2) {
if (mCart.mPos.x > 2200) {
mHelpTips.attachMovie("helptip4", "arrowup", mHelpTips.getNextHighestDepth(), {_x:100, _y:300});
mTipMode++;
}
}
_local2++;
if (mTipMode == _local2) {
if (mMaxDist > 0) {
mHelpTips.arrowup.onEnterFrame = function () {
if (((this._alpha = this._alpha - 5)) < 0) {
this.removeMovieClip();
}
};
mTipMode++;
}
}
_local2++;
if (mTipMode == _local2) {
if (mMaxDist > 10) {
mHelpTips.attachMovie("helptip2", "tip", mParent.getNextHighestDepth(), {_x:100, _y:300});
mHelpTips.takeoff.onEnterFrame = function () {
if (((this._alpha = this._alpha - 5)) < 0) {
this.removeMovieClip();
}
};
mHelpTips.jumpin.onEnterFrame = function () {
if (((this._alpha = this._alpha - 5)) < 0) {
this.removeMovieClip();
}
};
mTipMode++;
}
}
_local2++;
if (mTipMode == _local2) {
if (mFirstDist > 0) {
mHelpTips.tip.removeMovieClip();
mTipMode++;
}
}
}
function UpdateJunk() {
for (var _local2 in mJunk) {
if ((mJunk[_local2]._x + mJunk[_local2]._width) < (-mParent._x)) {
mJunk[_local2]._x = ((-mParent._x) + mJunk[_local2].xskip) + (Math.random() * 200);
mJunk[_local2]._y = mJunk[_local2].ymin + (Math.random() * (mJunk[_local2].ymax - mJunk[_local2].ymin));
mJunk[_local2]._xscale = mJunk[_local2]._xscale * -1;
}
}
}
function SinCurve(x, x1, x2, y1, y2) {
var _local2 = (x2 + x1) / 2;
var _local1 = x2 - x1;
return(y1 + (((y2 - y1) / 2) * (1 + Math.sin((3.14159256 * (x - _local2)) / _local1))));
}
function SinJump(x, x1, x2, y1, y2) {
var _local5 = (x2 + x1) / 2;
var _local2 = x2 - x1;
return(y1 + ((y2 - y1) * (1 - Math.sin((3.14159256 * (x2 - x)) / (_local2 * 2)))));
}
function Linear(x, x1, x2, y1, y2) {
return(y1 + (((y2 - y1) * (x - x1)) / (x2 - x1)));
}
function GetGroundHeight(x) {
if (x < 0) {
return(-800);
}
if (x < 2500) {
return(SinCurve(x, 0, 2500, -800, 0));
}
if (x < 2700) {
return(SinJump(x, 2500, 2700, 0, -100));
}
if (x < 2730) {
return(-100);
}
var _local3 = x + mGroundPhase;
return(((25 * Math.sin(_local3 / 97)) * Math.cos(_local3 / 307)) * Math.sin(_local3 / 233));
}
function GetGroundNormal(x) {
var _local5 = GetGroundHeight(x);
var _local4 = GetGroundHeight(x + 1);
var _local2 = new vec2(_local4 - _local5, -1);
var _local3 = Math.sqrt((_local2.x * _local2.x) + 1);
_local2.x = _local2.x / _local3;
_local2.y = _local2.y / _local3;
return(_local2);
}
function onMouseDown() {
}
function onMouseUp() {
}
function onKeyDown() {
var _local2 = Key.getCode();
if (!mKbd[_local2]) {
mKbdPressed[_local2] = true;
}
mKbd[_local2] = true;
mKeyCodeBuf.push(_local2);
mKeyTimeBuf.push(getTimer() / 1000);
mKeyCodeBuf.splice(0, Math.max(0, mKeyCodeBuf.length - 3));
mKeyTimeBuf.splice(0, Math.max(0, mKeyTimeBuf.length - 3));
CheckForTricks();
}
function onKeyUp() {
mKbd[Key.getCode()] = false;
}
function CheckForTricks() {
var _local2 = mKeyCodeBuf.length - 3;
if (_local2 < 0) {
return(undefined);
}
if ((mKeyTimeBuf[_local2 + 1] < (mKeyTimeBuf[_local2 + 0] + 0.4)) && (mKeyTimeBuf[_local2 + 2] < (mKeyTimeBuf[_local2 + 1] + 0.4))) {
if ((((mPowerUps.mTrickHandstand == true) && (mKeyCodeBuf[_local2 + 0] == 38)) && (mKeyCodeBuf[_local2 + 1] == 38)) && (mKeyCodeBuf[_local2 + 2] == 40)) {
mCart.StartTrick("Handstand", 40);
}
if ((((mPowerUps.mTrickSuperman == true) && (mKeyCodeBuf[_local2 + 0] == 38)) && (mKeyCodeBuf[_local2 + 1] == 37)) && (mKeyCodeBuf[_local2 + 2] == 40)) {
mCart.StartTrick("Superman", 40);
}
}
}
function Update(aDt) {
if (mWaitForStartKey) {
aDt = 0;
if (mKbdPressed[39]) {
mWaitForStartKey = false;
}
}
UpdateHelpTips();
UpdateJunk();
mCart.Update(this, aDt);
if (!mCart.mCrashing) {
mMaxDist = Math.max(mMaxDist, (mCart.mPos.x - 2700) / 40);
if (mMaxDist > 0) {
mMaxHeight = Math.max(mMaxHeight, (-mCart.mPos.y) / 4);
}
mParent._parent._parent._parent.scoreArrows._visible = true;
mParent._parent._parent._parent.scoreText = util.toFixed(mMaxDist, 1);
mParent._parent._parent._parent.scoreTextH = util.toFixed(mMaxHeight, 1);
mParent._parent._parent._parent.scoreTextT = util.toFixed(mTrickPts, 1);
}
mParent._parent._parent._parent.trickScore = mCart.mTrickScoreText;
var _local3 = (mCart.mCrashing ? (mCart.mGuyMovie._x) : (mCart.mPos.x + (mCart.mVel.x * 0.15)));
var _local4 = (mCart.mCrashing ? (mCart.mGuyMovie._y) : (mCart.mPos.y + (mCart.mVel.y * 0.15)));
mParent._x = mParent._x + ((((200 - _local3) - mParent._x) * aDt) * 5);
mParent._y = mParent._y + ((((200 - _local4) - mParent._y) * aDt) * 4);
mParent._parent.sky._y = -2450 + mParent._y;
if (mKbdPressed.length > 0) {
mKbdPressed = new Array();
}
if ((mCart.mGrounded && (mMaxDist > 0)) && ((mCart.mVel.x < 15) || (mCart.mCrashing))) {
mDone = true;
}
if (mDone) {
if ((mCart.mVel.x > 0) && (!mCart.mCrashing)) {
mCart.mVel.x = 0;
}
mDoneTimer = mDoneTimer + aDt;
}
if (mDoneTimer > 4) {
mGameOver = true;
mPowerUps.mLastDist = mMaxDist;
mPowerUps.mLastHeight = mMaxHeight;
mPowerUps.mLastStyle = (mCart.mCrashing ? 0.1 : ((mPowerUps.mGroupie3 ? 2 : ((mPowerUps.mGroupie2 ? 1.6 : ((mPowerUps.mGroupie1 ? 1.3 : 1)))))));
mPowerUps.mLastTrick = mTrickPts;
mPowerUps.mLastScore = ((mPowerUps.mLastDist + mPowerUps.mLastHeight) + mTrickPts) * mPowerUps.mLastStyle;
mPowerUps.mBestScore = Math.max(mPowerUps.mBestScore, mPowerUps.mLastScore);
mPowerUps.mTotalMoney = mPowerUps.mTotalMoney + mPowerUps.mLastScore;
mParent._parent._parent._parent.scoreText = "";
mParent._parent._parent._parent.scoreTextH = "";
mParent._parent._parent._parent.scoreTextT = "";
mParent._parent._parent._parent.scoreArrows._visible = false;
mParent._parent._parent._parent.trickScore = "";
}
return(!mGameOver);
}
}
Symbol 245 MovieClip [__Packages.Cart] Frame 0
class Cart
{
var mParent, mVel, mPos, mCartMovie, mCrashDepth, mSndCartLand, mNextCartSndPos, mSndCrash, mSndRocket, mSndRocketEnd, mSndStep, mNextStepPos, mGroupie3Movie, mGroupie2Movie, mGroupie1Movie, mGuyMovie, mGuyAnimState, mGuyCycleTime, mRunning, mCrashing, mAngVel, mAccelGetInBoost, mTakeOffBoost, mDragModifier, mGravModifier, mTrickName, mTrickExit, mHoldKey, mGrounded, mTrickHoldTime, mTrickSpeed, mTrickBasePts, mTrickHoldPts;
function Cart (aWorld, aParent, aDepth) {
mParent = aParent;
mVel = new vec2(30, 0);
mPos = new vec2(-70, -800);
mCartMovie = mParent.createEmptyMovieClip("cart", aDepth);
mCrashDepth = mParent.getNextHighestDepth();
mSndCartLand = new Array();
var _local7 = new Sound();
_local7.attachSound("s_bounce2.mp3");
mSndCartLand.push(_local7);
var _local6 = new Sound();
_local6.attachSound("s_bounce3.mp3");
mSndCartLand.push(_local6);
var _local5 = new Sound();
_local5.attachSound("s_bounce4.mp3");
mSndCartLand.push(_local5);
var _local4 = new Sound();
_local4.attachSound("s_bounce5.mp3");
mSndCartLand.push(_local4);
var _local3 = new Sound();
_local3.attachSound("s_bounce6.mp3");
mSndCartLand.push(_local3);
mNextCartSndPos = -1000;
mSndCrash = new Sound();
mSndCrash.attachSound("s_crash.mp3");
mSndRocket = new Sound();
mSndRocket.attachSound("s_rocketStart.mp3");
mSndRocketEnd = new Sound();
mSndRocketEnd.attachSound("s_rocketEnd.mp3");
mSndStep = new Array();
var _local8 = new Sound();
_local8.attachSound("s_step1.mp3");
mSndStep.push(_local8);
_local7 = new Sound();
_local7.attachSound("s_step2.mp3");
mSndStep.push(_local7);
_local6 = new Sound();
_local6.attachSound("s_step3.mp3");
mSndStep.push(_local6);
_local3 = new Sound();
_local3.attachSound("s_step6.mp3");
mSndStep.push(_local3);
mNextStepPos = -69;
if (aWorld.mPowerUps.mGroupie3) {
mGroupie3Movie = mCartMovie.attachMovie("cart_groupie3", "cart_groupie3", mCartMovie.getNextHighestDepth(), {_x:-42, _y:-4});
}
if (aWorld.mPowerUps.mGroupie2) {
mGroupie2Movie = mCartMovie.attachMovie("cart_groupie2", "cart_groupie2", mCartMovie.getNextHighestDepth(), {_x:-42, _y:-4});
}
if (aWorld.mPowerUps.mGroupie1) {
mGroupie1Movie = mCartMovie.attachMovie("cart_groupie1", "cart_groupie1", mCartMovie.getNextHighestDepth(), {_x:-42, _y:-4});
}
mGuyMovie = mCartMovie.attachMovie("guy", "guy", mCartMovie.getNextHighestDepth(), {_x:-42, _y:-4});
mCartMovie.attachMovie("cart", "cart", mCartMovie.getNextHighestDepth());
if (aWorld.mPowerUps.mHasRockets3) {
mCartMovie.attachMovie("cart_rocket3", "cart_rocket2", mCartMovie.getNextHighestDepth());
} else if (aWorld.mPowerUps.mHasRockets2) {
mCartMovie.attachMovie("cart_rocket2", "cart_rocket2", mCartMovie.getNextHighestDepth());
} else if (aWorld.mPowerUps.mHasRockets1) {
mCartMovie.attachMovie("cart_rocket1", "cart_rocket1", mCartMovie.getNextHighestDepth());
}
mGuyAnimState = "stopped";
mGuyMovie.gotoAndPlay(mGuyAnimState);
mGuyCycleTime = 0;
mRunning = true;
mCrashing = false;
mAngVel = (Math.random() * 100) - 50;
mAccelGetInBoost = 0;
mTakeOffBoost = false;
mDragModifier = 1;
mGravModifier = 1;
mTrickName = undefined;
mTrickExit = undefined;
mHoldKey = 0;
}
function Destructor() {
mCartMovie.removeMovieClip();
mGuyMovie.removeMovieClip();
}
function StartTrick(aTrickName, aHoldKey) {
if (mGrounded || (mTrickName != undefined)) {
return(undefined);
}
mTrickName = aTrickName;
mTrickExit = undefined;
mHoldKey = aHoldKey;
mGuyCycleTime = 0;
mTrickHoldTime = 0;
if (mTrickName == "Superman") {
mTrickSpeed = 25;
mTrickBasePts = 100;
mTrickHoldPts = 50;
} else {
mTrickSpeed = 20;
mTrickBasePts = 200;
mTrickHoldPts = 100;
}
}
function Update(aWorld, aDt) {
var _local18 = 50;
var _local20 = 20;
var _local16 = 300;
if (mGrounded) {
if (aWorld.mMaxDist <= 0) {
if (mRunning) {
if (aWorld.mKbd[39]) {
mVel.x = mVel.x + (_local18 * aDt);
}
}
mVel.x = mVel.x + ((_local20 + mAccelGetInBoost) * aDt);
} else {
mVel.x = mVel.x * (1 - (aDt * mDragModifier));
}
}
if (mRunning) {
if ((mPos.x > 1300) || ((mPos.x > 400) && (aWorld.mKbdPressed[32] || (aWorld.mKbdPressed[38])))) {
mRunning = false;
mGuyCycleTime = 0;
var _local6 = Math.min(1, Math.max(0, 1 - (Math.abs(900 - mPos.x) / 400)));
mDragModifier = 1 - ((((0.3 * _local6) * _local6) * _local6) * _local6);
mAccelGetInBoost = (((100 * _local6) * _local6) * _local6) * _local6;
mVel.x = mVel.x + (mAccelGetInBoost * 2);
var _local9 = mParent._parent.helptips;
_local9.attachMovie("helptip_power", "jumpin", _local9.getNextHighestDepth(), {_x:38, _y:375});
_local9.jumpin.helptip_power_meter._xscale = 100 * _local6;
}
if (mPos.x > mNextStepPos) {
mSndStep[int(Math.random() * mSndStep.length)].start();
mNextStepPos = mPos.x + 35;
}
}
if (!mTakeOffBoost) {
if ((mPos.x > 3100) || ((mPos.x > 2200) && (aWorld.mKbdPressed[32] || (aWorld.mKbdPressed[38])))) {
mTakeOffBoost = true;
var _local6 = Math.min(1, Math.max(0, 1 - (Math.abs(2700 - mPos.x) / 400)));
mGravModifier = 1 - ((((0.3 * _local6) * _local6) * _local6) * _local6);
mAccelGetInBoost = (((100 * _local6) * _local6) * _local6) * _local6;
mVel.x = mVel.x + mAccelGetInBoost;
var _local9 = mParent._parent.helptips;
_local9.attachMovie("helptip_power", "takeoff", _local9.getNextHighestDepth(), {_x:213, _y:375});
_local9.takeoff.helptip_power_meter._xscale = 100 * _local6;
}
}
if ((((mPos.x > 1400) && (mCartMovie.cart_rocket_flames == undefined)) && (mRocketTime > 0)) && ((aWorld.mPowerUps.mHasRockets1 || (aWorld.mPowerUps.mHasRockets2)) || (aWorld.mPowerUps.mHasRockets3))) {
var _local21 = (aWorld.mPowerUps.mHasRockets3 ? "3" : ((aWorld.mPowerUps.mHasRockets2 ? "2" : "")));
mCartMovie.attachMovie("cart_rocket_flames" + _local21, "cart_rocket_flames", mCartMovie.getNextHighestDepth());
if (aWorld.mPowerUps.mHasRockets3) {
mRocketTime = 6;
} else if (aWorld.mPowerUps.mHasRockets2) {
mRocketTime = 2;
}
mSndRocket.start();
}
if (mCartMovie.cart_rocket_flames != undefined) {
mRocketTime = mRocketTime - aDt;
mVel.x = mVel.x + ((Math.cos((mCartMovie._rotation * 3.14159256) / 180) * _local16) * aDt);
mVel.y = mVel.y + ((Math.sin((mCartMovie._rotation * 3.14159256) / 180) * _local16) * aDt);
if (mRocketTime < 0) {
mCartMovie.cart_rocket_flames.removeMovieClip();
mCartMovie.cart_rocket_flames = undefined;
mSndRocket.stop();
mSndRocketEnd.start();
}
}
mVel.y = mVel.y + ((aDt * 600) * mGravModifier);
mPos.x = mPos.x + (mVel.x * aDt);
mPos.y = mPos.y + (mVel.y * aDt);
if ((aWorld.mMaxDist > 0) && (mPos.x < 2700)) {
mPos.x = 2700;
}
var _local13 = ((aWorld.mPowerUps.mWheel3 == true) ? 100000 : (((aWorld.mPowerUps.mWheel2 == true) ? 1500 : 1000)));
var _local14 = 0;
if (mGrounded && (mVel.x > _local13)) {
mVel.x = _local13;
_local14 = (Math.random() * 2) - 1;
}
var _local8 = aWorld.GetGroundHeight(mPos.x);
var _local12;
var _local24 = false;
mGrounded = false;
if (mPos.y > _local8) {
var _local10 = Math.abs((((mCartMovie._rotation + 180) + 3600) % 360) - 180);
mPos.y = _local8;
var _local11 = aWorld.GetGroundNormal(mPos.x);
if (vec2.Dot(_local11, mVel) < 0) {
var _local15 = vec2.Sub(mVel, vec2.Mul(_local11, 2 * vec2.Dot(_local11, mVel)));
_local12 = _local15;
mVel = vec2.Sub(_local12, vec2.Mul(_local11, vec2.Dot(_local15, _local11) * 0.8));
}
mGrounded = true;
if ((aWorld.mMaxDist > 0) && (aWorld.mFirstDist <= 0)) {
aWorld.mFirstDist = aWorld.mMaxDist;
}
if ((aWorld.mMaxDist > 1) && (!mCrashing)) {
if ((_local10 > 60) || (mTrickName != undefined)) {
mAngVel = 600;
mCrashing = true;
mGuyCycleTime = 0;
mGuyMovie.removeMovieClip();
mParent.attachMovie("headblood", "blood", mCrashDepth, {_x:mPos.x + 130, _y:mPos.y + 40});
mGuyMovie = mParent.attachMovie("guy", "guy", mCrashDepth + 1, {_x:mPos.x, _y:mPos.y});
if (mGroupie1Movie) {
mGroupie1Movie.removeMovieClip();
mParent.attachMovie("headblood", "bloodg1", mCrashDepth + 2, {_x:mPos.x + 210, _y:mPos.y + 10, targetScale:0.7});
mGroupie1Movie = mParent.attachMovie("cart_groupie1", "cart_groupie1", mCrashDepth + 3, {_x:mPos.x + 50, _y:mPos.y - 20});
}
if (mGroupie2Movie) {
mGroupie2Movie.removeMovieClip();
mParent.attachMovie("headblood", "bloodg2", mCrashDepth + 4, {_x:mPos.x - 45, _y:mPos.y + 0, targetScale:0.7});
mGroupie2Movie = mParent.attachMovie("cart_groupie2", "cart_groupie2", mCrashDepth + 5, {_x:mPos.x - 100, _y:mPos.y - 20});
}
if (mGroupie3Movie) {
mGroupie3Movie.removeMovieClip();
mParent.attachMovie("headblood", "bloodg3", mCrashDepth + 6, {_x:mPos.x - 5, _y:mPos.y + 60, targetScale:0.7});
mGroupie3Movie = mParent.attachMovie("cart_groupie3", "cart_groupie3", mCrashDepth + 7, {_x:mPos.x - 100, _y:mPos.y - 20});
}
if (mTrickName != undefined) {
mParent._parent.attachMovie("floatingTrickScore", "floatingTrickScore", mParent._parent.getNextHighestDepth(), {_x:275, _y:375, col:13369344, textStr:mTrickScoreText});
mTrickScoreText = "";
}
mSndCrash.start();
aWorld.mPowerUps.mGroupie1 = false;
aWorld.mPowerUps.mGroupie2 = false;
aWorld.mPowerUps.mGroupie3 = false;
} else if (mPos.x > mNextCartSndPos) {
var _local19 = int(Math.random() * mSndCartLand.length);
mSndCartLand[_local19].start();
mNextCartSndPos = mPos.x + 100;
if ((aWorld.mMaxDist > 0) && (Math.abs(mVel.y) > 10)) {
var _local4 = 1 - (_local10 / 1000);
_local4 = ((_local4 * _local4) * _local4) * _local4;
_local4 = ((_local4 * _local4) * _local4) * _local4;
mVel.x = mVel.x * _local4;
}
}
}
}
mCartMovie._x = mPos.x;
mCartMovie._y = mPos.y;
if (mGrounded) {
if ((mPos.x < 2690) || (mPos.x > 2710)) {
var _local11 = aWorld.GetGroundNormal(mPos.x);
mCartMovie._rotation = (Math.atan2(_local11.x, -_local11.y) / 3.141592) * 180;
}
mCartMovie._rotation = mCartMovie._rotation + _local14;
} else if (aWorld.mMaxDist > 0) {
var _local7 = 100;
if (mCartMovie.cart_rocket_flames != undefined) {
_local7 = 30;
}
if (mPos.y < (_local8 - 50)) {
if (aWorld.mKbd[39] && (mAngVel < 100)) {
mAngVel = mAngVel + (_local7 * aDt);
}
if (aWorld.mKbd[37] && (mAngVel > -100)) {
mAngVel = mAngVel - (_local7 * aDt);
}
}
mCartMovie._rotation = mCartMovie._rotation + (mAngVel * aDt);
}
var _local5;
if (mRunning) {
mGuyAnimState = "run";
_local5 = 3;
mGuyCycleTime = mGuyCycleTime + ((aDt * 0.1) * Math.abs(mVel.x));
if (mGuyCycleTime >= _local5) {
mGuyCycleTime = mGuyCycleTime % _local5;
}
} else if (mCrashing) {
mGuyAnimState = "fall";
_local5 = 9;
mGuyCycleTime = mGuyCycleTime + (aDt * 40);
mGuyCycleTime = Math.min(_local5 - 1, mGuyCycleTime);
} else if (mTrickExit != undefined) {
mGuyAnimState = mTrickName;
mGuyCycleTime = mGuyCycleTime - (aDt * mTrickSpeed);
mGuyCycleTime = Math.max(0, mGuyCycleTime);
if (mGuyCycleTime <= 0) {
mGuyCycleTime = 10000;
mTrickName = undefined;
mTrickExit = undefined;
aWorld.mTrickPts = aWorld.mTrickPts + (mTrickBasePts + (mTrickHoldPts * mTrickHoldTime));
mParent._parent.attachMovie("floatingTrickScore", "floatingTrickScore", mParent._parent.getNextHighestDepth(), {_x:275, _y:375, col:3407667, textStr:mTrickScoreText});
mTrickScoreText = "";
}
} else if (mTrickName != undefined) {
mGuyAnimState = mTrickName;
_local5 = 9;
mGuyCycleTime = mGuyCycleTime + (aDt * mTrickSpeed);
if (mGuyCycleTime > (_local5 - 1)) {
mTrickHoldTime = mTrickHoldTime + aDt;
}
mGuyCycleTime = Math.min(_local5 - 1, mGuyCycleTime);
if ((mGuyCycleTime >= (_local5 - 1)) && (aWorld.mKbd[mHoldKey] == false)) {
mTrickExit = mTrickName;
}
mTrickScoreText = (((mTrickName + ": ") + util.toFixed(mTrickBasePts, 0)) + " + ") + util.toFixed(mTrickHoldPts * mTrickHoldTime, 1);
} else {
mGuyAnimState = "jumpin";
_local5 = 9;
mGuyCycleTime = mGuyCycleTime + (aDt * 15);
mGuyCycleTime = Math.min(_local5 - 1, mGuyCycleTime);
}
if (aDt > 0) {
mGuyMovie.gotoAndStop((mGuyAnimState + "-") + Math.floor(mGuyCycleTime));
}
if (mCrashing) {
mGuyMovie._rotation = mGuyMovie._rotation + ((-mGuyMovie._rotation) * 0.3);
} else if (((!mRunning) && (mGrounded)) && (mVel.x > 40)) {
mGuyMovie._rotation = -1 + (((2 * Math.sin(getTimer() / 200)) * Math.sin(getTimer() / 111)) * Math.cos(getTimer() / 432));
} else {
mGuyMovie._rotation = 0;
}
if (mGroupie3Movie) {
if (mCrashing) {
var _local17 = Math.floor(Math.min(mGuyCycleTime * 1.3, 6));
mGroupie3Movie.gotoAndStop("fall-" + _local17);
} else {
mGroupie3Movie.arm._rotation = -3 + ((6 * Math.sin(getTimer() / 200)) * Math.sin(getTimer() / 111));
mGroupie3Movie.head._rotation = -2 + (10 * Math.sin(getTimer() / 125));
}
}
if (mGroupie2Movie) {
if (mCrashing) {
var _local17 = Math.floor(Math.min(mGuyCycleTime * 0.8, 6));
mGroupie2Movie.gotoAndStop("fall-" + _local17);
} else {
mGroupie2Movie.arm._rotation = -10 + ((20 * Math.sin(getTimer() / 330)) * Math.sin(getTimer() / 480));
mGroupie2Movie.head._rotation = -2 + (10 * Math.sin(getTimer() / 105));
}
}
if (mGroupie1Movie) {
if (mCrashing) {
var _local17 = Math.floor(Math.min(mGuyCycleTime * 1.1, 6));
mGroupie1Movie.gotoAndStop("fall-" + _local17);
} else {
mGroupie1Movie.arm._rotation = -10 + ((20 * Math.sin(getTimer() / 250)) * Math.sin(getTimer() / 590));
mGroupie1Movie.head._rotation = -2 + (10 * Math.sin(getTimer() / 115));
}
}
mCartMovie.cart.wheel1._rotation = mCartMovie.cart.wheel1._rotation + ((10 * aDt) * mVel.x);
mCartMovie.cart.wheel2._rotation = mCartMovie.cart.wheel2._rotation + ((10 * aDt) * mVel.x);
if ((aWorld.mMaxDist > 0) && (!mCrashing)) {
if (mCartMovie._rotation > 360) {
trace("forward flip!");
mCartMovie._rotation = mCartMovie._rotation - 360;
}
if (mCartMovie._rotation < -360) {
trace("back flip!");
mCartMovie._rotation = mCartMovie._rotation + 360;
}
}
return(true);
}
var mTrickScoreText = "";
var mRocketTime = 1;
}
Symbol 246 MovieClip [__Packages.vec2] Frame 0
class vec2
{
var x, y;
function vec2 (aX, aY) {
x = aX;
y = aY;
}
static function Add(v1, v2) {
return(new vec2(v1.x + v2.x, v1.y + v2.y));
}
static function Sub(v1, v2) {
return(new vec2(v1.x - v2.x, v1.y - v2.y));
}
static function Mul(v1, f) {
return(new vec2(v1.x * f, v1.y * f));
}
static function SquaredLengthSub(v1, v2) {
var _local1 = Sub(v1, v2);
return((_local1.x * _local1.x) + (_local1.y * _local1.y));
}
static function SquaredLength(v) {
return((v.x * v.x) + (v.y * v.y));
}
static function Length(v) {
return(Math.sqrt((v.x * v.x) + (v.y * v.y)));
}
static function Normalize(v) {
var _local1 = Length(v);
return(new vec2(v.x / _local1, v.y / _local1));
}
static function Dot(v1, v2) {
return((v1.x * v2.x) + (v1.y * v2.y));
}
}
Symbol 247 MovieClip [__Packages.util] Frame 0
class util
{
function util () {
}
static function toFixed(x, n) {
var _local4 = x.toString();
var _local3 = _local4.split(".", 2);
if (n == 0) {
return(_local3[0]);
}
var _local1 = _local3[1].substr(0, n);
if (_local1 == undefined) {
_local1 = "0";
}
while (_local1.length < n) {
_local1 = _local1 + "0";
}
return((_local3[0] + ".") + _local1);
}
}
Symbol 248 MovieClip [__Packages.Store] Frame 0
class Store extends UpdatableGameLoop
{
var mPowerUps, mDone, mSndPop, mParent, mToolTip;
function Store (aParent, aOnDone, aPowerUps) {
super(aParent, Update, aOnDone);
mPowerUps = aPowerUps;
mDone = false;
mSndPop = new Array();
var _local3 = new Sound();
_local3.attachSound("s_pop2.mp3");
mSndPop.push(_local3);
InitWorld();
}
function toString() {
return("Store");
}
function Destructor() {
super.Destructor();
}
function InitWorld() {
mParent.attachMovie("MAIN_STORE", "MAIN_STORE", mParent.getNextHighestDepth());
mParent.MAIN_STORE.scoreboardPanel.textDist.text = util.toFixed(mPowerUps.mLastDist, 1);
mParent.MAIN_STORE.scoreboardPanel.textHeight.text = "+ " + util.toFixed(mPowerUps.mLastHeight, 1);
mParent.MAIN_STORE.scoreboardPanel.textTricks.text = "+ " + util.toFixed(mPowerUps.mLastTrick, 1);
mParent.MAIN_STORE.scoreboardPanel.textStyle.text = "x " + util.toFixed(mPowerUps.mLastStyle, 2);
if (mPowerUps.mLastStyle < 1) {
mParent.MAIN_STORE.scoreboardPanel.textStyle.textColor = 8912896 /* 0x880000 */;
}
mParent.MAIN_STORE.scoreboardPanel.textTotal.text = util.toFixed(mPowerUps.mLastScore, 1);
mParent.MAIN_STORE.scoreboardPanel.textBest.text = "Highscore: " + util.toFixed(mPowerUps.mBestScore, 1);
mParent.MAIN_STORE.scoreboardPanel.butSubmit.enabled = mPowerUps.mBestScore > mPowerUps.mSubmittedBestScore;
mParent.MAIN_STORE.storepanel.textMoney.text = "$" + util.toFixed(mPowerUps.mTotalMoney, 0);
InitButtons();
}
function InitButtons() {
mToolTip.removeTip();
mToolTip = new Tooltip(16777215, 0);
InitButton("mWheel0", 0, "", "Junk Wheels");
InitButton("mWheel1", 100, "mWheel0", "Round Wheels");
InitButton("mWheel2", 250, "mWheel1", "Metal Wheels");
InitButton("mWheel3", 1000, "mWheel2", "Racing Wheels");
InitButton("mHasRockets0", 0, "", "");
InitButton("mHasRockets1", 500, "mHasRockets0", "Rocket Jet");
InitButton("mHasRockets2", 1000, "mHasRockets1", "Double Rockets");
InitButton("mHasRockets3", 5000, "mHasRockets2", "This isn't safe.");
InitButton("mGroupie0", 0, "", "No Friends");
InitButton("mGroupie1", 800, "mGroupie0", "Groupie");
InitButton("mGroupie2", 2500, "mGroupie1", "Two Groupies");
InitButton("mGroupie3", 6000, "mGroupie2", "Full Harem");
InitButton("mTrickSuperman", 1000, "", "Superman (Up Left Down + Hold)");
InitButton("mTrickHandstand", 2000, "", "Handstand (Up Up Down + Hold)");
}
function InitButton(puName, aPrice, aDependency, aToolTip) {
if (mPowerUps[puName]) {
mParent.MAIN_STORE.storepanel["but_" + puName]._alpha = 100;
mParent.MAIN_STORE.storepanel["but_" + puName].textPrice.text = "";
mParent.MAIN_STORE.storepanel[("but_" + puName) + "_cost"].removeMovieClip();
mParent.MAIN_STORE.storepanel[("but_" + puName) + "_check"].removeMovieClip();
mParent.MAIN_STORE.storepanel.attachMovie("but_check", ("but_" + puName) + "_check", mParent.MAIN_STORE.storepanel.getNextHighestDepth(), {_x:mParent.MAIN_STORE.storepanel["but_" + puName]._x, _y:mParent.MAIN_STORE.storepanel["but_" + puName]._y});
} else {
mParent.MAIN_STORE.storepanel["but_" + puName]._alpha = 80;
mParent.MAIN_STORE.storepanel["but_" + puName].onRelease = mx.utils.Delegate.create(this, function () {
this.ClickButton(puName);
});
mParent.MAIN_STORE.storepanel[("but_" + puName) + "_cost"].removeMovieClip();
mParent.MAIN_STORE.storepanel.attachMovie("but_price", ("but_" + puName) + "_cost", mParent.MAIN_STORE.storepanel.getNextHighestDepth(), {_x:mParent.MAIN_STORE.storepanel["but_" + puName]._x, _y:mParent.MAIN_STORE.storepanel["but_" + puName]._y});
mParent.MAIN_STORE.storepanel["but_" + puName].mCost = aPrice;
mParent.MAIN_STORE.storepanel[("but_" + puName) + "_cost"].textPrice.text = "$" + aPrice;
mParent.MAIN_STORE.storepanel[("but_" + puName) + "_cost"].textPrice.textColor = ((mPowerUps.mTotalMoney >= aPrice) ? 0 : 16711680);
if ((aDependency.length > 0) && (mPowerUps[aDependency] == false)) {
mParent.MAIN_STORE.storepanel["but_" + puName]._alpha = 40;
mParent.MAIN_STORE.storepanel[("but_" + puName) + "_cost"]._alpha = 40;
}
}
if (aToolTip.length > 0) {
mParent.MAIN_STORE.storepanel["but_" + puName].onRollOver = mx.utils.Delegate.create(this, function () {
this.mToolTip.showTip(aToolTip);
});
mParent.MAIN_STORE.storepanel["but_" + puName].onRollOut = mx.utils.Delegate.create(this, function () {
this.mToolTip.removeTip();
});
}
}
function ClickButton(puName) {
if (mPowerUps.mTotalMoney > mParent.MAIN_STORE.storepanel["but_" + puName].mCost) {
mSndPop[int(Math.random() * mSndPop.length)].start();
mPowerUps.mTotalMoney = mPowerUps.mTotalMoney - mParent.MAIN_STORE.storepanel["but_" + puName].mCost;
mPowerUps[puName] = true;
InitButtons();
mParent.MAIN_STORE.storepanel.textMoney.text = "$" + util.toFixed(mPowerUps.mTotalMoney, 0);
}
}
function onKeyDown() {
if (((Key.getCode() == 32) || (Key.getCode() == 13)) || (Key.getCode() == 38)) {
if (mParent.MAIN_STORE._currentframe == 25) {
mParent.MAIN_STORE.play();
}
if (mParent.MAIN_STORE._currentframe == 50) {
mParent.MAIN_STORE.play();
}
}
}
function Update(aDt) {
if (mParent.MAIN_STORE._currentframe >= 65) {
mDone = true;
}
return(!mDone);
}
}
Symbol 249 MovieClip [__Packages.Tooltip] Frame 0
class Tooltip
{
var theTip, tFormat, mHex, mHex2;
function Tooltip (hex, hex2) {
theTip = _root.createEmptyMovieClip("tooltip", _root.getNextHighestDepth());
theTip.createTextField("theText", theTip.getNextHighestDepth(), 3, 1, 10, 20);
theTip._visible = false;
theTip.theText.selectable = false;
tFormat = new TextFormat();
tFormat.font = "Arial";
tFormat.size = 11;
tFormat.align = "center";
theTip.theText.setNewTextFormat(tFormat);
mHex = hex;
mHex2 = hex2;
}
function showTip(theText) {
theTip.theText.text = theText;
theTip.theText.autoSize = "center";
var _local3 = theTip.theText.textWidth;
var _local4 = 15;
theTip.clear();
theTip.beginFill(mHex);
theTip.lineStyle(1, mHex2, 100);
theTip.moveTo((-_local3) / 2, 0);
theTip.lineTo((_local3 / 2) + _local4, 0);
theTip.lineTo((_local3 / 2) + _local4, 20);
theTip.lineTo(5, 20);
theTip.lineTo(0, 30);
theTip.lineTo(-5, 20);
theTip.lineTo((-_local3) / 2, 20);
theTip.lineTo((-_local3) / 2, 0);
theTip.endFill();
theTip._x = _root._xmouse;
theTip._y = _root._ymouse - 35;
theTip._visible = true;
theTip.onMouseMove = function () {
this._x = _root._xmouse;
this._y = _root._ymouse - 35;
updateAfterEvent();
};
}
function removeTip() {
theTip._visible = false;
delete theTip.onEnterFrame;
}
}