Frame 2
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);
}
MochiServices.connect("5aa44ec25f37b048");
MochiAd.showPreGameAd({id:"5aa44ec25f37b048", res:"640x450"});
__com_mochibot__("ea53d391", this, 10301, true);
Frame 4
this.stop();
Frame 5
this.stop();
Instance of Symbol 252 MovieClip "mc_sloop_zast" in Frame 5
onClipEvent (load) {
this.gotoAndStop(2);
}
Instance of Symbol 256 MovieClip "mc_sloop" in Frame 5
onClipEvent (load) {
var soundControl = new Sound(this);
}
Instance of Symbol 267 MovieClip "btn_sound" in Frame 5
onClipEvent (load) {
if (this._parent.stopSoundFlag) {
this.gotoAndStop(2);
}
}
Instance of Symbol 312 MovieClip "btn_vehicle1" in Frame 8
on (release) {
this._parent.gameStartWith(3);
}
onClipEvent (load) {
this._alpha = 0;
}
Instance of Symbol 312 MovieClip "btn_vehicle2" in Frame 8
on (release) {
this._parent.gameStartWith(4);
}
onClipEvent (load) {
this._alpha = 0;
}
Instance of Symbol 312 MovieClip in Frame 8
on (release) {
this._parent.gameStartWith(2);
}
onClipEvent (load) {
this._alpha = 0;
}
Instance of Symbol 312 MovieClip in Frame 8
on (release) {
this._parent.gameStartWith(1);
}
onClipEvent (load) {
this._alpha = 0;
}
Instance of Symbol 312 MovieClip "btn_vehicle4" in Frame 8
on (release) {
this._parent.gameStartWith(6);
}
onClipEvent (load) {
this._alpha = 0;
}
Instance of Symbol 312 MovieClip "btn_vehicle3" in Frame 8
on (release) {
this._parent.gameStartWith(5);
}
onClipEvent (load) {
this._alpha = 0;
}
Frame 9
this.stop();
Instance of Symbol 309 MovieClip "mc_control" in Frame 9
onClipEvent (load) {
this._parent.initLevel();
}
onClipEvent (enterFrame) {
this._parent.processGame();
}
onClipEvent (keyDown) {
this._parent.keyPressed();
}
Instance of Symbol 256 MovieClip "mc_sloop" in Frame 10
onClipEvent (load) {
var soundControl = new Sound(this);
}
Symbol 1 MovieClip Frame 1
#initclip 19
function updateSoundLoop() {
if (!stopSoundFlag) {
if (zastSoundFlag) {
mc_sloop_level.gotoAndStop(3);
mc_sloop_zast.gotoAndStop(2);
} else {
mc_sloop_level.gotoAndStop(2);
mc_sloop_zast.gotoAndStop(3);
}
}
}
function soundOff() {
if (zastSoundFlag) {
mc_sloop_zast.gotoAndStop(3);
} else {
mc_sloop_level.gotoAndStop(3);
}
stopSoundFlag = true;
}
function soundOn() {
if (zastSoundFlag) {
mc_sloop_zast.gotoAndStop(2);
} else {
mc_sloop_level.gotoAndStop(2);
}
stopSoundFlag = false;
}
function gameStart() {
scores = 0;
timeCounter = 0;
CGP.level = 0;
if (isFirstRun) {
loadSettings();
isFirstRun = false;
}
this.gotoAndStop("choice");
enableVehicles();
}
function chooseBikeWhenComplete() {
this.gotoAndStop("choice");
enableVehicles();
}
function chooseBike() {
CGP.level--;
this.gotoAndStop("choice");
enableVehicles();
}
function enableVehicles() {
trace((((("NUM: " + bikeLevels) + ", B2: ") + enableBike) + ", B3: ") + enableBike3);
mc_cap_unlock1._visible = !enableBike;
mc_cap_unlock3._visible = !enableBike3;
mc_cap_unlock2._visible = !enableAtv;
mc_cap_unlock4._visible = !enableAtv3;
btn_vehicle1.useHandCursor = enableBike;
btn_vehicle2.useHandCursor = enableAtv;
btn_vehicle3.useHandCursor = enableBike3;
btn_vehicle4.useHandCursor = enableAtv3;
mc_cap_unlock1.txtComplete = bikeLevels.toString();
mc_cap_unlock3.txtComplete = bikeLevels.toString();
mc_cap_unlock2.txtComplete = atvLevels.toString();
mc_cap_unlock4.txtComplete = atvLevels.toString();
}
function gameStartWith(bikeNum_) {
if ((bikeNum_ == CCarSynchronizer.BIKE_MOTO2) && (!enableBike)) {
return(undefined);
}
if ((bikeNum_ == CCarSynchronizer.BIKE_ATV2) && (!enableAtv)) {
return(undefined);
}
if ((bikeNum_ == CCarSynchronizer.BIKE_MOTO3) && (!enableBike3)) {
return(undefined);
}
if ((bikeNum_ == CCarSynchronizer.BIKE_ATV3) && (!enableAtv3)) {
return(undefined);
}
if (CGP.level == 0) {
zastSoundFlag = false;
updateSoundLoop();
}
bikeNum = bikeNum_;
nextLevel();
}
function nextLevel() {
zastSoundFlag = false;
updateSoundLoop();
mc_sloop.gotoAndStop(2);
if (CGP.level == CGP.MAX_LEVEL_NUM) {
newGame();
return(undefined);
}
CGP.level++;
levelTimeCounter = 0;
this.gotoAndStop("InterLevel");
this.gotoAndStop("reset");
this.gotoAndStop("game");
txtLevel.text = CGP.level.toString();
txtScore.text = scores.toString();
}
function replay() {
zastSoundFlag = false;
updateSoundLoop();
mc_sloop.gotoAndStop(2);
this.gotoAndStop("reset");
this.gotoAndStop("game");
txtLevel.text = CGP.level.toString();
txtScore.text = scores.toString();
}
function newGame() {
zastSoundFlag = true;
bikeLevels = 0;
atvLevels = 0;
updateSoundLoop();
this.gotoAndStop("main");
}
function initLevel() {
lastTimer = getTimer();
mc_level._x = (mc_level._y = 0);
mc_level._xscale = (mc_level._yscale = 100);
mc_level.gotoAndStop(CGP.level);
mc_level.mc.mc_hit._visible = false;
if (carSync == null) {
carSync = new CCarSynchronizer();
engine = new CParticleEngine();
objCamera = new CCamera();
back1 = new CBack();
back2 = new CBack();
} else {
engine.clear();
}
engine.stopWheels = false;
carSync.setBikeNum(bikeNum);
switch (bikeNum) {
case 1 :
carSync.init_bike1(mc_level.mc.mc_car, mc_level.mc.mc_start._x, mc_level.mc.mc_start._y, engine);
break;
case 2 :
carSync.init_atv1(mc_level.mc.mc_car, mc_level.mc.mc_start._x, mc_level.mc.mc_start._y, engine);
break;
case 3 :
carSync.init_bike2(mc_level.mc.mc_car, mc_level.mc.mc_start._x, mc_level.mc.mc_start._y, engine);
break;
case 4 :
carSync.init_atv2(mc_level.mc.mc_car, mc_level.mc.mc_start._x, mc_level.mc.mc_start._y, engine);
break;
case 5 :
carSync.init_bike3(mc_level.mc.mc_car, mc_level.mc.mc_start._x, mc_level.mc.mc_start._y, engine);
break;
case 6 :
carSync.init_atv3(mc_level.mc.mc_car, mc_level.mc.mc_start._x, mc_level.mc.mc_start._y, engine);
break;
default :
trace("error!!!");
}
carSync.setHealthIndicator(mc_panel.mc_health_ind);
back1.init(mc_level.mc.mc_fon.mc_grass.mc1, mc_level.mc.mc_fon.mc_grass.mc2, 1);
back2.init(mc_level.mc.mc_fon.mc_hill.mc1, mc_level.mc.mc_fon.mc_hill.mc2, 2);
back1.process(mc_level.mc._x);
back2.process(mc_level.mc._x);
objCamera.init(carSync.mc_car, mc_level.mc);
objCamera.process();
engine.setHitMovie(mc_level.mc.mc_hit);
engine.start();
accFlag = false;
accCounter = 50;
if (!stopSoundFlag) {
mc_sloop_level.gotoAndStop(2);
}
setStaticVariables();
CGP.setLevelTasks();
CIndicator(mc_panel.mc_progress_ind).setMaxValue(100);
CIndicator(mc_panel.mc_progress_ind).setValue(0);
mc_message.gotoAndStop("empty");
gameState = 0;
CGP.updateLevelProgress();
}
function processGame() {
newTimer = getTimer();
dTime = newTimer - lastTimer;
txtFps = 1 / (dTime / 1000);
lastTimer = newTimer;
if (gameState == 0) {
timeCounter = timeCounter + dTime;
levelTimeCounter = levelTimeCounter + dTime;
if (!carSync.isCrushed()) {
accCounter++;
if (!accFlag) {
accFlag = Key.isDown(CCarSynchronizer.BUTTON_UP) || (Key.isDown(CCarSynchronizer.BUTTON_DOWN));
if (accFlag && (accCounter > 10)) {
accCounter = 0;
mc_gas.gotoAndPlay(2);
}
} else {
accFlag = Key.isDown(CCarSynchronizer.BUTTON_UP) || (Key.isDown(CCarSynchronizer.BUTTON_DOWN));
}
if (Key.isDown(CCarSynchronizer.BUTTON_LEFT)) {
carSync.toLeft();
} else if (Key.isDown(CCarSynchronizer.BUTTON_RIGHT)) {
carSync.toRight();
}
}
engine.process();
carSync.process();
objCamera.process();
back1.process(mc_level.mc._x);
back2.process(mc_level.mc._x);
mc_level.mc.mc_fon._x = -mc_level.mc._x;
showTime();
CGP.updateLevelProgress();
checkEndLevel();
if (carSync.checkHitWithGround(mc_level.mc.mc_hit)) {
loose();
return(undefined);
}
CGP.processSounds();
}
}
function keyPressed() {
if (Key.isDown(32)) {
if (gameState == 2) {
nextLevel();
} else if (gameState == 1) {
replay();
} else if (gameState == 4) {
resume();
}
} else if (Key.isDown(80)) {
if (gameState == 0) {
pauseGame();
} else if (gameState == 4) {
resume();
}
} else if (Key.isDown(82)) {
if ((gameState == 0) || (gameState == 4)) {
replay();
}
}
}
function addLevelScores() {
var _local1;
var _local2;
var _local6 = 5;
var _local4 = 15;
var _local3 = 45;
var _local5 = 200;
_local1 = levelTimeCounter / 1000;
if (_local1 < _local6) {
_local2 = 1000;
} else if (_local1 < _local4) {
_local2 = (((_local4 - _local1) / (_local4 - _local6)) * 600) + 400;
} else if (_local1 < _local3) {
_local2 = (((_local3 - _local1) / (_local3 - _local4)) * 200) + 200;
} else if (_local1 < _local5) {
_local2 = (((_local5 - _local1) / (_local5 - _local3)) * 180) + 20;
} else {
_local2 = 20;
}
scores = scores + Math.round(_local2);
}
function showTime() {
txtTime.text = String(getTimeString(timeCounter));
}
function getTimeString(time) {
var _local1 = Math.round(time / 1000);
var _local2 = Math.floor(_local1 / 60);
var _local3;
var _local4;
_local1 = _local1 - (_local2 * 60);
if (_local1 < 10) {
_local4 = "0" + _local1;
} else {
_local4 = "" + _local1;
}
if (_local2 < 10) {
_local3 = "0" + _local2;
} else {
_local3 = "" + _local2;
}
return((_local3 + ":") + _local4);
}
function resume() {
CGP.carSync.startManAnim();
zastSoundFlag = false;
updateSoundLoop();
mc_pause.gotoAndStop(1);
mc_message.gotoAndStop("empty");
gameState = 0;
}
function pauseGame() {
CGP.carSync.stopManAnim();
if (!stopSoundFlag) {
mc_sloop_level.gotoAndStop(3);
}
zastSoundFlag = true;
updateSoundLoop();
mc_pause.gotoAndStop(2);
mc_message.gotoAndStop("pause");
gameState = 4;
}
function setStaticVariables() {
CGP.mc_levelHit = mc_level.mc.mc_hit;
CGP.mc_root = this;
CGP.mc_level = mc_level;
CGP.mc_panel = mc_panel;
CGP.carSync = CCarSynchronizer(carSync);
CGP.mc_progressInd = mc_panel.mc_progress_ind;
CGP.init();
}
function checkEndLevel() {
if (carSync.mc_car._x >= mc_level.mc.mc_finish._x) {
if (!stopSoundFlag) {
mc_sloop.gotoAndStop(3);
}
mc_pause._visible = false;
mc_sloop.gotoAndStop(3);
toWinTask();
return(undefined);
}
}
function loose() {
CGP.carSync.stopManAnimFull();
mc_pause._visible = false;
zastSoundFlag = true;
updateSoundLoop();
mc_sloop.gotoAndStop(3);
mc_message.gotoAndStop("over");
mc_message.levelTime = getTimeString(levelTimeCounter);
mc_message.totalTime = getTimeString(timeCounter);
mc_message.scores = scores;
CGP.carSync.stopManAnimFull();
gameState = 1;
}
function toWinTask() {
CGP.carSync.stopManAnimFull();
mc_pause._visible = false;
addLevelScores();
mc_message.levelTime = getTimeString(levelTimeCounter);
mc_message.totalTime = getTimeString(timeCounter);
mc_message.scores = scores;
if (((bikeNum == CCarSynchronizer.BIKE_MOTO1) || (bikeNum == CCarSynchronizer.BIKE_MOTO2)) || (bikeNum == CCarSynchronizer.BIKE_MOTO3)) {
bikeLevels++;
} else {
atvLevels++;
}
saveSettings();
if (CGP.level < CGP.MAX_LEVEL_NUM) {
if (((((bikeLevels == CGP.UNLOCK_LEVEL_BIKE) && (!enableBike)) || ((bikeLevels == CGP.UNLOCK_LEVEL_BIKE3) && (!enableBike3))) || ((atvLevels == CGP.UNLOCK_LEVEL_ATV) && (!enableAtv))) || ((atvLevels == CGP.UNLOCK_LEVEL_ATV3) && (!enableAtv3))) {
zastSoundFlag = true;
updateSoundLoop();
if (bikeLevels == CGP.UNLOCK_LEVEL_BIKE) {
enableBike = true;
} else if (bikeLevels == CGP.UNLOCK_LEVEL_BIKE3) {
enableBike3 = true;
} else if (atvLevels == CGP.UNLOCK_LEVEL_ATV) {
enableAtv = true;
} else if (atvLevels == CGP.UNLOCK_LEVEL_ATV3) {
enableAtv3 = true;
}
CGP.LVL_NEXT_FRAME = "win_unlock";
mc_message.gotoAndStop("interLevel");
} else {
zastSoundFlag = true;
updateSoundLoop();
CGP.LVL_NEXT_FRAME = "win";
mc_message.gotoAndStop("interLevel");
}
gameState = 2;
} else {
zastSoundFlag = true;
updateSoundLoop();
CGP.LVL_NEXT_FRAME = "complete";
mc_message.gotoAndStop("interLevel");
gameState = 3;
}
}
function showScoreBoard(bFlag, bSubmit) {
if (bFlag) {
mcBlockScreen = _root.attachMovie("mc_block_screen", "_mc_block_screen", _root.getNextHighestDepth(), {_x:0, _y:0});
mcBlockScreen.useHandCursor = false;
mcBlockScreen.btnBlock.enabled = false;
if (bSubmit) {
MochiScores.showLeaderboard({boardID:"4541b9e0ee056633", score:this.scores, res:"640x450", clip:this.mcBlockScreen});
} else {
MochiScores.showLeaderboard({boardID:"4541b9e0ee056633", res:"640x450", clip:this.mcBlockScreen});
}
} else {
mcBlockScreen.removeMovieClip();
}
}
function saveSettings() {
var _local1 = SharedObject.getLocal(gameName);
_local1.data.enableBike = enableBike;
_local1.data.enableAtv = enableAtv;
_local1.data.enableBike3 = enableBike3;
_local1.data.enableAtv3 = enableAtv3;
_local1.flush();
}
function loadSettings() {
var _local1 = SharedObject.getLocal(gameName);
if (_local1.data.enableBike != undefined) {
enableBike = _local1.data.enableBike;
enableAtv = _local1.data.enableAtv;
enableBike3 = _local1.data.enableBike3;
enableAtv3 = _local1.data.enableAtv3;
}
}
var newTimer;
var dTime;
var ax = 0;
var ay = 0;
var n;
var perc;
var mcBlockScreen;
var author = "www.iriysoft.ru";
var lastTimer;
var stopSoundFlag = false;
var carSync = null;
var engine = null;
var objCamera = null;
var back1 = null;
var back2 = null;
var gameState;
var zastSoundFlag = true;
var accFlag;
var accCounter;
var timeCounter;
var levelTimeCounter;
var scores;
var highQuality = true;
var enableBike = false;
var enableAtv = false;
var enableBike3 = false;
var enableAtv3 = false;
var bikeLevels = 0;
var atvLevels = 0;
var isFirtsRun = true;
var bikeNum;
#endinitclip
Symbol 558 MovieClip [__Packages.MochiScores] Frame 0
class MochiScores
{
static var boardID, onClose, onError;
function MochiScores () {
}
static function setBoardID(boardID) {
MochiScores.boardID = boardID;
MochiServices.send("scores_setBoardID", {boardID:boardID});
}
static function showLeaderboard(options) {
if (options.clip != null) {
if ((options.clip != MochiServices.__get__clip()) || (MochiServices.__get__childClip()._target == undefined)) {
MochiServices.disconnect();
MochiServices.connect(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 (typeof(options.score) == "object") {
if (options.score.text != undefined) {
options.score = options.score.text;
}
}
}
if (options.onDisplay != null) {
options.onDisplay();
} else {
MochiServices.__get__clip().stop();
}
if (options.onClose != null) {
onClose = options.onClose;
} else {
onClose = function () {
_root.showScoreBoard(false, false);
};
}
if (options.onError != null) {
onError = options.onError;
} else {
onError = onClose;
}
if (options.boardID == null) {
if (boardID != null) {
options.boardID = boardID;
}
}
MochiServices.send("scores_showLeaderboard", {options:options}, null, doClose);
}
static function closeLeaderboard() {
MochiServices.send("scores_closeLeaderboard");
}
static function getPlayerInfo(callbackObj, callbackMethod) {
MochiServices.send("scores_getPlayerInfo", null, callbackObj, callbackMethod);
}
static function submit(score, name, callbackObj, callbackMethod) {
MochiServices.send("scores_submit", {score:score, name:name}, callbackObj, callbackMethod);
}
static function requestList(callbackObj, callbackMethod) {
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 559 MovieClip [__Packages.MochiServices] Frame 0
class MochiServices
{
static var _id, _container, _clip, _sendChannelName, _rcvChannelName, __get__comChannelName, onError, _listenChannel, _rcvChannel, _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.32");
}
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";
_rcvChannelName = val;
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) {
MochiServices.onError = onError;
} else if (MochiServices.onError == undefined) {
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();
_rcvChannel.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 _local2 = "_mochiservices_com_" + id;
if (_clip != null) {
return(_clip);
}
if (!isNetworkAvailable) {
return(null);
}
allowDomains(_gatewayURL);
_clip = clip.createEmptyMovieClip(_local2, 10336, false);
_loader = new MovieClipLoader();
if (_loaderListener.waitInterval != null) {
clearInterval(_loaderListener.waitInterval);
}
_loaderListener = {};
_loaderListener.onLoadError = function (target_mc, errorCode, httpStatus) {
trace("MochiServices could not load.");
MochiServices.disconnect();
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) {
MochiServices.disconnect();
MochiServices.onError.apply(null, ["IOError"]);
}
clearInterval(this.waitInterval);
}
};
_loaderListener.waitInterval = setInterval(_loaderListener, "wait", 1000);
_loader.addListener(_loaderListener);
_loader.loadClip(_gatewayURL, _clip);
_sendChannel = new LocalConnection();
_sendChannel._queue = [];
_rcvChannel = new LocalConnection();
_rcvChannel.allowDomain = function (d) {
return(true);
};
_rcvChannel.allowInsecureDomain = _rcvChannel.allowDomain;
_rcvChannel._nextcallbackID = 0;
_rcvChannel._callbacks = {};
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) {
MochiServices.__set__comChannelName(args.newChannel);
};
_listenChannel.allowDomain = function (d) {
return(true);
};
_listenChannel.allowInsecureDomain = _listenChannel.allowDomain;
_listenChannel.connect(_listenChannelName);
trace("Waiting for MochiAds services to connect...");
}
static function initComChannels() {
if (!_connected) {
_sendChannel.onStatus = function (infoObject) {
MochiServices.onStatus(infoObject);
};
_sendChannel.send(_sendChannelName, "onReceive", {methodName:"handshakeDone"});
_sendChannel.send(_sendChannelName, "onReceive", {methodName:"registerGame", id:_id, clip:_clip, version:getVersion()});
_rcvChannel.onStatus = function (infoObject) {
MochiServices.onStatus(infoObject);
};
_rcvChannel.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];
};
_rcvChannel.onError = function () {
MochiServices.onError.apply(null, ["IOError"]);
};
_rcvChannel.connect(_rcvChannelName);
trace("connected!");
_connecting = false;
_connected = true;
_listenChannel.close();
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 = _rcvChannel._callbacks[_local1.callbackID];
}
delete _rcvChannel._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:_rcvChannel._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:_rcvChannel._nextcallbackID});
}
_rcvChannel._callbacks[_rcvChannel._nextcallbackID] = {callbackObject:callbackObject, callbackMethod:callbackMethod};
_rcvChannel._nextcallbackID++;
}
static var _gatewayURL = "http://www.mochiads.com/static/lib/services/services.swf";
static var _listenChannelName = "__mochiservices";
static var _connecting = false;
static var _connected = false;
}
Symbol 560 MovieClip [__Packages.CParticleEngine] Frame 0
class CParticleEngine
{
var hit_mc, prevTime;
function CParticleEngine () {
}
function clear() {
while (p_array.pop() != undefined) {
}
while (w_array.pop() != undefined) {
}
while (c_array.pop() != undefined) {
}
}
function clearConstraints() {
while (c_array.pop() != undefined) {
}
}
function setHitMovie(hit_mc_) {
hit_mc = hit_mc_;
}
function addParticle(p) {
p_array.push(p);
}
function addWheel(wheel, p, maxSpeed, radius) {
wheel.init(p, maxSpeed, radius);
w_array.push(wheel);
}
function addSpringConstraint(p1, p2, koeffStiff1, koeffStiff2) {
var _local2 = new CSpringConstraint(p1, p2, koeffStiff1, koeffStiff2);
c_array.push(_local2);
return(_local2);
}
function addPenetrationConstraint(p0, p1, p2) {
var _local2 = new CPenetrationConstraint(p0, p1, p2);
c_array.push(_local2);
return(_local2);
}
function addPenetrationConstraint2(p0, p1, p2) {
var _local2 = new CPenetrationConstraint2(p0, p1, p2);
c_array.push(_local2);
return(_local2);
}
function start() {
prevTime = getTimer();
}
function computeForces() {
var _local2 = 0;
while (_local2 < p_array.length) {
p_array[_local2].acc.x = 0;
p_array[_local2].acc.y = gravity * p_array[_local2].mass;
_local2++;
}
}
function clearForces() {
var _local3;
var _local2 = 0;
while (_local2 < w_array.length) {
_local3 = w_array[_local2];
_local3.addedAcc.x = (_local3.addedAcc.y = 0);
_local2++;
}
}
function applyManFrictions() {
var _local2 = 0;
while (_local2 < w_array.length) {
w_array[_local2].applyAddedAcc();
_local2++;
}
}
function verlet(dTime) {
var _local5 = 0.995;
var _local2;
var _local4 = 0;
_local2 = 0;
while (_local2 < p_array.length) {
p_array[_local2].verlet(dTime, _local5);
_local2++;
}
if (!stopWheels) {
if (Key.isDown(CCarSynchronizer.BUTTON_DOWN)) {
_local4 = -0.6;
} else if (Key.isDown(CCarSynchronizer.BUTTON_UP)) {
_local4 = 1;
}
}
_local2 = 0;
while (_local2 < w_array.length) {
w_array[_local2].process(dTime, (w_array[_local2].maxAccSpeed * _local4) / 3.2, 0.99);
_local2++;
}
}
function checkCollisions() {
var _local2 = 0;
while (_local2 < w_array.length) {
w_array[_local2].checkCollision(hit_mc);
_local2++;
}
}
function checkConstraints(dTime) {
var _local2;
var _local3 = c_array.length;
_local2 = 0;
while (_local2 < _local3) {
c_array[_local2].resolve();
_local2++;
}
}
function process() {
var _local4 = getTimer();
var _local5 = (_local4 - prevTime) / 1000;
prevTime = _local4;
var _local2;
var _local3 = Math.min(Math.round(_local5 / t), maxSteps);
_local2 = 0;
while (_local2 < _local3) {
computeForces();
applyManFrictions();
verlet(t);
checkConstraints(t);
checkCollisions();
clearForces();
_local2++;
}
}
static var gravity = 3.15;
var p_array = new Array();
var w_array = new Array();
var c_array = new Array();
var t = 0.02;
var maxSteps = 2;
var stopWheels = false;
}
Symbol 561 MovieClip [__Packages.CParticle] Frame 0
class CParticle
{
var pos, prevPos, mass, acc, mc;
function CParticle (x_, y_, mass_) {
pos = new CVector2D(x_, y_);
prevPos = pos.duplicate();
mass = mass_;
acc = new CVector2D(0, 0);
mc = null;
}
function verlet(dTime, koeffDamp) {
var _local2 = pos.duplicate();
pos.x = pos.x + (((pos.x - prevPos.x) * koeffDamp) + (acc.x * dTime));
pos.y = pos.y + (((pos.y - prevPos.y) * koeffDamp) + (acc.y * dTime));
_local2.copyTo(prevPos);
if (mc != null) {
mc._x = pos.x;
mc._y = pos.y;
}
}
function getVelocityVector() {
return(new CVector2D(pos.x - prevPos.x, pos.y - prevPos.y));
}
}
Symbol 562 MovieClip [__Packages.CVector2D] Frame 0
class CVector2D
{
var x, y;
function CVector2D (x_, y_) {
x = x_;
y = y_;
}
function reinit(x_, y_) {
x = x_;
y = y_;
}
function getUgol() {
return(Math.atan2(y, x));
}
function duplicate() {
return(new CVector2D(x, y));
}
function copyTo(v) {
v.x = x;
v.y = y;
}
function minus(v) {
x = x - v.x;
y = y - v.y;
}
function minusNew(v) {
return(new CVector2D(x - v.x, y - v.y));
}
function normalize() {
var _local2 = Math.sqrt((x * x) + (y * y));
x = x / _local2;
y = y / _local2;
}
function reverseNew() {
return(new CVector2D(-x, -y));
}
function scalar(v) {
return((x * v.x) + (y * v.y));
}
function modul() {
return(Math.sqrt((x * x) + (y * y)));
}
function reflectFromNormal(n) {
var _local2 = Math.atan2(n.y, n.x);
rotate(-_local2);
x = -x;
rotate(_local2);
}
function rotate(u) {
var _local4 = x;
var _local3 = y;
x = (_local4 * Math.cos(u)) - (_local3 * Math.sin(u));
y = (_local4 * Math.sin(u)) + (_local3 * Math.cos(u));
}
function rotateNew(u) {
return(new CVector2D((x * Math.cos(u)) - (y * Math.sin(u)), (x * Math.sin(u)) + (y * Math.cos(u))));
}
function mult(k) {
x = x * k;
y = y * k;
}
function multNew(k) {
return(new CVector2D(x * k, y * k));
}
function plus(v) {
x = x + v.x;
y = y + v.y;
}
function plusNew(v) {
return(new CVector2D(x + v.x, y + v.y));
}
function getDistanceTo(p1, p2) {
var _local3 = p1.y - p2.y;
var _local2 = p2.x - p1.x;
var _local6 = (p1.x * (p2.y - p1.y)) - (p1.y * (p2.x - p1.x));
var _local5 = Math.sqrt((_local3 * _local3) + (_local2 * _local2));
_local3 = _local3 / _local5;
_local2 = _local2 / _local5;
_local6 = _local6 / _local5;
return(((_local3 * x) + (_local2 * y)) + _local6);
}
function toString() {
return(((("( " + x) + ", ") + y) + " )");
}
}
Symbol 563 MovieClip [__Packages.CWheel] Frame 0
class CWheel extends MovieClip
{
var particle, rad, maxAccSpeed, speed, accSpeed, rot, addedAcc, intersectionFlag, lastIntersPoint, lastN, hitPointArray, normalArray, hitArray, intersArray, lastYSpeed, mc, _x, _y, localToGlobal;
function CWheel () {
super();
}
function init(particle_, maxAccSpeed_, rad_) {
particle = particle_;
rad = rad_;
maxAccSpeed = maxAccSpeed_ * 4;
speed = 0;
accSpeed = 0;
rot = new CVector2D(1, 0);
addedAcc = new CVector2D(0, 0);
intersectionFlag = false;
lastIntersPoint = new CVector2D(0, 0);
lastN = new CVector2D(0, 0);
var _local2;
var _local3 = (Math.PI*2) / hitCount;
hitPointArray = new Array(hitCount);
normalArray = new Array(hitCount);
hitArray = new Array(hitCount);
intersArray = new Array();
_local2 = 0;
while (_local2 < hitCount) {
hitPointArray[_local2] = new CVector2D(Math.sin(_local3 * _local2) * rad, (-Math.cos(_local3 * _local2)) * rad);
normalArray[_local2] = hitPointArray[_local2].multNew(-1);
normalArray[_local2].normalize();
_local2++;
}
lastYSpeed = 0;
}
function setKoeffSpring(koeffSpring_) {
koeffSpring = koeffSpring_;
}
function setKoeffSlip(koeffSlip_) {
koeffSlip = koeffSlip_;
}
function setKoeffConcatenation(koeffConcatenation_) {
koeffConcatenation = koeffConcatenation_;
}
function hasIntersection() {
return(intersectionFlag);
}
function process(dTime, acc, koeffDamp) {
accSpeed = Math.max(-maxAccSpeed, Math.min(maxAccSpeed, accSpeed + (acc * dTime)));
speed = Math.max((-maxSpeed) * dTime, Math.min((speed * koeffDamp) + accSpeed, maxSpeed * dTime));
rot.rotate(speed / rad);
mc.mc_rim._rotation = (Math.atan2(rot.y, rot.x) * 180) / Math.PI;
lastYSpeed = particle.pos.y - particle.prevPos.y;
}
function checkCollision(hit_mc) {
var _local2;
var _local8;
var _local9 = new CVector2D(0, 0);
var _local13 = false;
var _local5;
var _local7;
var _local15;
var _local16 = new CVector2D(particle.prevPos.x, particle.prevPos.y);
var _local4 = new CVector2D(0, 0);
var _local3 = new CVector2D(0, 0);
var _local14;
_x = particle.pos.x;
_y = particle.pos.y;
_local14 = 0;
_local2 = 0;
while (_local2 < hitCount) {
hitPointArray[_local2].copyTo(_local9);
localToGlobal(_local9);
if ((hitArray[_local2] = hit_mc.hitTest(_local9.x, _local9.y, true))) {
_local13 = true;
_local5 = _local2;
_local14++;
}
_local2++;
}
if (_local14 == hitCount) {
particle.pos.x = particle.prevPos.x + ((particle.pos.x - particle.prevPos.x) * 0.3);
particle.pos.y = particle.prevPos.y + ((particle.pos.y - particle.prevPos.y) * 0.3);
_x = particle.pos.x;
_y = particle.pos.y;
return(undefined);
}
_local2 = 0;
if (_local13) {
while (true) {
_local2++;
if (_local2 == hitCount) {
_local2 = 0;
}
if (!hitArray[_local2]) {
_local5 = -1;
_local8 = 0;
while (_local8 < hitCount) {
_local2++;
if (_local2 == hitCount) {
_local2 = 0;
}
if (_local5 == -1) {
if (hitArray[_local2]) {
_local5 = _local2;
_local4.plus(normalArray[_local2]);
normalArray[_local2].copyTo(_local3);
}
} else if (!hitArray[_local2]) {
_local7 = _local2 - 1;
if (_local7 < 0) {
_local7 = hitCount - 1;
}
intersArray.push({k1:_local5, k2:_local7, n:new CVector2D(_local3.x, _local3.y)});
_local5 = -1;
} else {
_local4.plus(normalArray[_local2]);
_local3.plus(normalArray[_local2]);
}
_local8++;
}
break;
}
}
var _local6 = new CVector2D(0, 0);
if (intersArray.length > 0) {
_local4.normalize();
if (intersectionFlag) {
_local4.x = _local4.x + lastN.x;
_local4.y = _local4.y + lastN.y;
_local4.x = _local4.x / 2;
_local4.y = _local4.y / 2;
}
var _local10;
var _local11;
_local15 = intersArray.length;
_local2 = 0;
while (_local2 < _local15) {
_local10 = intersArray.pop();
_local5 = _local10.k1;
_local7 = _local10.k2;
_local10.n.copyTo(_local3);
particle.pos.minusNew(particle.prevPos).copyTo(_local6);
if (_local4.scalar(_local6) < 0) {
_local11 = Math.atan2(_local4.y, _local4.x);
_local6.rotate(-_local11);
_local6.x = (-_local6.x) * koeffSpring;
_local6.rotate(_local11);
pushOut(_local5, _local7, _local3, hit_mc);
particle.prevPos.x = particle.pos.x - _local6.x;
particle.prevPos.y = particle.pos.y - _local6.y;
} else {
pushOut(_local5, _local7, _local3, hit_mc);
}
_local2++;
}
validateRotation(_local4, _local16);
intersectionFlag = true;
particle.pos.copyTo(lastIntersPoint);
_local4.copyTo(lastN);
}
} else if (intersectionFlag) {
validateRotation(lastN, _local16);
intersectionFlag = false;
}
_x = particle.pos.x;
_y = particle.pos.y;
}
function pushOut(k1, k2, n, hit_mc) {
n.normalize();
if (k1 != k2) {
var _local7 = new CVector2D(0, 0).getDistanceTo(hitPointArray[k1], hitPointArray[k2]);
_local7 = rad - Math.abs(_local7);
particle.pos.plus(n.multNew(_local7));
particle.prevPos.plus(n.multNew(_local7));
} else {
var _local6 = n.multNew(-rad);
var _local4 = new CVector2D(0, 0);
var _local5 = 0;
var _local3 = 0.03;
while (true) {
_local6.copyTo(_local4);
localToGlobal(_local4);
if (hit_mc.hitTest(_local4.x, _local4.y, true)) {
_local5++;
_x = (particle.pos.x = particle.pos.x + (n.x * _local3));
_y = (particle.pos.y = particle.pos.y + (n.y * _local3));
} else {
_local5--;
particle.pos.x = particle.pos.x - (n.x * _local3);
particle.pos.y = particle.pos.y - (n.y * _local3);
particle.prevPos.plus(n.multNew(_local3 * _local5));
break;
}
}
}
particle.pos.minus(n.multNew(koeffConcatenation));
particle.prevPos.minus(n.multNew(koeffConcatenation));
}
function validateRotation(n, oldPos) {
if ((!intersectionFlag) && (Math.abs(accSpeed) > 0.01)) {
if (Math.abs(accSpeed) < ((maxAccSpeed * 0.02) / 2)) {
accSpeed = 0;
} else if (accSpeed > 0) {
accSpeed = maxAccSpeed * 0.02;
} else {
accSpeed = (-maxAccSpeed) * 0.02;
}
}
var _local3 = new CVector2D(-n.y, n.x);
var _local6 = particle.pos.minusNew(oldPos);
var _local5 = Math.atan2(_local3.y, _local3.x);
var _local2 = _local6.rotateNew(-_local5);
speed = _local2.x + accSpeed;
_local2.y = 0;
_local2.rotate(_local5);
var _local4 = 1 - koeffSlip;
particle.pos.x = (particle.pos.x + ((_local3.x * accSpeed) * _local4)) - ((1 - koeffFriction) * _local2.x);
particle.pos.y = (particle.pos.y + ((_local3.y * accSpeed) * _local4)) - ((1 - koeffFriction) * _local2.y);
accSpeed = accSpeed * koeffSlip;
}
function applyAddedAcc() {
particle.acc.x = particle.acc.x + (addedAcc.x * particle.mass);
particle.acc.y = particle.acc.y + (addedAcc.y * particle.mass);
}
function turnTo(turnDir, force) {
particle.prevPos.x = particle.pos.x - (turnDir.x * force);
particle.prevPos.x = particle.pos.x - (turnDir.x * force);
koeffSpring = 0.9;
}
var maxSpeed = 180;
var koeffSpring = 0.03;
var koeffSlip = 0.15;
var koeffFriction = 0.97;
var koeffConcatenation = 0;
var hitCount = 16;
}
Symbol 564 MovieClip [__Packages.CSpringConstraint] Frame 0
class CSpringConstraint
{
var p1, p2, koeffStiffPress, koeffStiffStretch, relaxLen, basicParticleNum, basicParticleWeight;
function CSpringConstraint (p1_, p2_, koeffStiffPress_, koeffStiffStretch_) {
p1 = p1_;
p2 = p2_;
koeffStiffPress = koeffStiffPress_;
koeffStiffStretch = koeffStiffStretch_;
var _local2 = new CVector2D(p1.pos.x - p2.pos.x, p1.pos.y - p2.pos.y);
relaxLen = _local2.modul();
basicParticleNum = BASIC_PARTICLE_NONE;
basicParticleWeight = 1;
}
function setBasicParticleNum(basicParticleNum_) {
basicParticleNum = basicParticleNum_;
}
function setBasicParticleWeight(basicParticleWeight_) {
basicParticleWeight = basicParticleWeight_;
}
function resolve() {
var _local3 = new CVector2D(p1.pos.x - p2.pos.x, p1.pos.y - p2.pos.y);
var _local6 = _local3.modul();
var _local5 = (_local6 - relaxLen) / _local6;
var _local4;
if (_local6 > relaxLen) {
_local4 = koeffStiffStretch;
} else {
_local4 = koeffStiffPress;
}
var _local2;
if (basicParticleNum == BASIC_PARTICLE_NONE) {
_local2 = (_local5 * _local4) / (p1.mass + p2.mass);
p1.pos.x = p1.pos.x - ((_local3.x * p1.mass) * _local2);
p1.pos.y = p1.pos.y - ((_local3.y * p1.mass) * _local2);
p2.pos.x = p2.pos.x + ((_local3.x * p2.mass) * _local2);
p2.pos.y = p2.pos.y + ((_local3.y * p2.mass) * _local2);
} else if (basicParticleNum == 1) {
_local2 = (_local5 * _local4) / (p1.mass + p2.mass);
_local2 = _local5 * _local4;
p1.pos.x = p1.pos.x - ((_local3.x * _local2) * (1 - basicParticleWeight));
p1.pos.y = p1.pos.y - ((_local3.y * _local2) * (1 - basicParticleWeight));
p2.pos.x = p2.pos.x + ((_local3.x * _local2) * basicParticleWeight);
p2.pos.y = p2.pos.y + ((_local3.y * _local2) * basicParticleWeight);
} else {
_local2 = (_local5 * _local4) / (p1.mass + p2.mass);
_local2 = _local5 * _local4;
p1.pos.x = p1.pos.x + ((_local3.x * _local2) * basicParticleWeight);
p1.pos.y = p1.pos.y + ((_local3.y * _local2) * basicParticleWeight);
p2.pos.x = p2.pos.x + ((_local3.x * _local2) * (1 - basicParticleWeight));
p2.pos.y = p2.pos.y + ((_local3.y * _local2) * (1 - basicParticleWeight));
}
}
static var BASIC_PARTICLE_NONE = 0;
}
Symbol 565 MovieClip [__Packages.CPenetrationConstraint] Frame 0
class CPenetrationConstraint
{
var p0, p1, p2, sign;
function CPenetrationConstraint (p0_, p1_, p2_) {
p0 = p0_;
p1 = p1_;
p2 = p2_;
sign = p0.pos.getDistanceTo(p1.pos, p2.pos);
if (sign < 0) {
sign = -1;
} else {
sign = 1;
}
}
function resolve() {
var _local3;
var _local2;
_local3 = p0.pos.getDistanceTo(p1.pos, p2.pos);
if ((sign * _local3) <= 2) {
_local2 = new CVector2D(p2.pos.x, p2.pos.y);
_local2.minus(p1.pos);
_local2.normalize();
_local2.rotate((Math.PI/2) * sign);
_local2.mult(Math.abs(_local3) + 1);
p1.pos.minus(_local2);
}
}
}
Symbol 566 MovieClip [__Packages.CPenetrationConstraint2] Frame 0
class CPenetrationConstraint2
{
var p0, p1, p2, sign;
function CPenetrationConstraint2 (p0_, p1_, p2_) {
p0 = p0_;
p1 = p1_;
p2 = p2_;
sign = p0.pos.getDistanceTo(p1.pos, p2.pos);
if (sign < 0) {
sign = -1;
} else {
sign = 1;
}
}
function resolve() {
var _local3;
var _local2;
_local3 = p0.pos.getDistanceTo(p1.pos, p2.pos);
if ((sign * _local3) <= 2) {
_local2 = new CVector2D(p2.pos.x, p2.pos.y);
_local2.minus(p1.pos);
_local2.normalize();
_local2.rotate((Math.PI/2) * sign);
_local2.mult(Math.abs(_local3) + 1);
p0.pos.plus(_local2);
}
}
}
Symbol 567 MovieClip [__Packages.CBikeParams] Frame 0
class CBikeParams
{
var controlAccPercBase, controlAccPercMult, koeffStability, bodyLibName, bodyDepth, backWheelLibName, backWheelDepth, backWheelKoeffSlip, backWheelKoeffConcatenation, backWheelKoeffSpring, backWheelPMass, backWheelPMaxSpeed, backWheelPRadius, backWheelPAcc, forwardWheelLibName, forwardWheelDepth, forwardWheelKoeffSlip, forwardWheelKoeffConcatenation, forwardWheelKoeffSpring, forwardWheelPMass, forwardWheelPMaxSpeed, forwardWheelPRadius, forwardWheelPAcc, pLD_mass, pRD_mass, pC_mass, triangleSprings, downSpringParams, upSpringParams, diagonalSpringParams, rightSpringParams, leftSpringParams;
function CBikeParams (controlAccPercBase_, controlAccPercMult_, koeffStability_, bodyLibName_, bodyDepth_, backWheelLibName_, backWheelDepth_, backWheelKoeffSlip_, backWheelKoeffConcatenation_, backWheelKoeffSpring_, backWheelPMass_, backWheelPMaxSpeed_, backWheelPRadius_, backWheelPAcc_, forwardWheelLibName_, forwardWheelDepth_, forwardWheelKoeffSlip_, forwardWheelKoeffConcatenation_, forwardWheelKoeffSpring_, forwardWheelPMass_, forwardWheelPMaxSpeed_, forwardWheelPRadius_, forwardWheelPAcc_, pLD_mass_, pRD_mass_, pC_mass_, triangleSprings_, downSpringParams_, upSpringParams_, diagonalSpringParams_, rightSpringParams_, leftSpringParams_) {
controlAccPercBase = controlAccPercBase_;
controlAccPercMult = controlAccPercMult_;
koeffStability = koeffStability_;
bodyLibName = bodyLibName_;
bodyDepth = bodyDepth_;
backWheelLibName = backWheelLibName_;
backWheelDepth = backWheelDepth_;
backWheelKoeffSlip = backWheelKoeffSlip_;
backWheelKoeffConcatenation = backWheelKoeffConcatenation_;
backWheelKoeffSpring = backWheelKoeffSpring_;
backWheelPMass = backWheelPMass_;
backWheelPMaxSpeed = backWheelPMaxSpeed_;
backWheelPRadius = backWheelPRadius_;
backWheelPAcc = backWheelPAcc_;
forwardWheelLibName = forwardWheelLibName_;
forwardWheelDepth = forwardWheelDepth_;
forwardWheelKoeffSlip = forwardWheelKoeffSlip_;
forwardWheelKoeffConcatenation = forwardWheelKoeffConcatenation_;
forwardWheelKoeffSpring = forwardWheelKoeffSpring_;
forwardWheelPMass = forwardWheelPMass_;
forwardWheelPMaxSpeed = forwardWheelPMaxSpeed_;
forwardWheelPRadius = forwardWheelPRadius_;
forwardWheelPAcc = forwardWheelPAcc_;
pLD_mass = pLD_mass_;
pRD_mass = pRD_mass_;
pC_mass = pC_mass_;
triangleSprings = triangleSprings_;
downSpringParams = downSpringParams_;
upSpringParams = upSpringParams_;
diagonalSpringParams = diagonalSpringParams_;
rightSpringParams = rightSpringParams_;
leftSpringParams = leftSpringParams_;
}
}
Symbol 568 MovieClip [__Packages.CSpringParams] Frame 0
class CSpringParams
{
var koeffStretch, koeffPress, basicParticleNum, basicParticleWeight;
function CSpringParams (koeffStretch_, koeffPress_, basicParticleNum_, basicParticleWeight_) {
koeffStretch = koeffStretch_;
koeffPress = koeffPress_;
basicParticleNum = basicParticleNum_;
basicParticleWeight = basicParticleWeight_;
}
}
Symbol 569 MovieClip [__Packages.CCarSynchronizer] Frame 0
class CCarSynchronizer
{
var koeffSpring, healthIndicator, bikeNum, mc_back_wheel, mc_forward_wheel, mc_car, mc_back_dark, mc_forward_dark, p_wl, p_wr, p_ld, p_rd, p_c, state;
function CCarSynchronizer () {
koeffSpring = 0.5;
}
function setHealthIndicator(healthIndicator_) {
healthIndicator = healthIndicator_;
healthIndicator.setMaxValue(MAX_HEALTH);
}
function setBikeNum(bikeNum_) {
bikeNum = bikeNum_;
}
function init(mc_container, sX, sY, engine, bikeParams) {
var _local3 = {x:0, y:0};
var _local2;
var _local5;
mc_back_wheel = CWheel(mc_container.attachMovie(bikeParams.backWheelLibName, "back_w", bikeParams.backWheelDepth));
mc_forward_wheel = CWheel(mc_container.attachMovie(bikeParams.forwardWheelLibName, "forward_w", bikeParams.forwardWheelDepth));
mc_car = mc_container.attachMovie(bikeParams.bodyLibName, "body", bikeParams.bodyDepth);
if (bikeParams.triangleSprings) {
mc_back_dark = mc_container.attachMovie("lib_dark_wheel", "wdb1", 0);
mc_forward_dark = mc_container.attachMovie("lib_dark_wheel", "wdb2", 1);
}
mc_car._x = sX;
mc_car._y = sY;
_local3.x = mc_car.mc.mc_p_wl._x;
_local3.y = mc_car.mc.mc_p_wl._y;
mc_car.mc.localToGlobal(_local3);
mc_car._parent.globalToLocal(_local3);
mc_back_wheel._x = _local3.x;
mc_back_wheel._y = _local3.y;
mc_back_wheel.setKoeffSlip(bikeParams.backWheelKoeffSlip);
mc_back_wheel.setKoeffConcatenation(bikeParams.backWheelKoeffConcatenation);
mc_back_wheel.setKoeffSpring(bikeParams.backWheelKoeffSpring);
p_wl = new CParticle(_local3.x, _local3.y, bikeParams.backWheelPMass);
engine.addParticle(p_wl);
engine.addWheel(mc_back_wheel, p_wl, bikeParams.backWheelPMaxSpeed, bikeParams.backWheelPRadius);
_local3.x = mc_car.mc.mc_p_wr._x;
_local3.y = mc_car.mc.mc_p_wr._y;
mc_car.mc.localToGlobal(_local3);
mc_car._parent.globalToLocal(_local3);
mc_forward_wheel._x = _local3.x;
mc_forward_wheel._y = _local3.y;
mc_forward_wheel.setKoeffSlip(bikeParams.forwardWheelKoeffSlip);
mc_forward_wheel.setKoeffConcatenation(bikeParams.forwardWheelKoeffConcatenation);
mc_forward_wheel.setKoeffSpring(bikeParams.forwardWheelKoeffSpring);
p_wr = new CParticle(_local3.x, _local3.y, bikeParams.forwardWheelPMass);
engine.addParticle(p_wr);
engine.addWheel(mc_forward_wheel, p_wr, bikeParams.forwardWheelPMaxSpeed, bikeParams.forwardWheelPRadius);
if (!bikeParams.triangleSprings) {
_local3.x = mc_car.mc.mc_p_ld._x;
_local3.y = mc_car.mc.mc_p_ld._y;
mc_car.mc.localToGlobal(_local3);
mc_car._parent.globalToLocal(_local3);
p_ld = new CParticle(_local3.x, _local3.y, bikeParams.pLD_mass);
engine.addParticle(p_ld);
_local3.x = mc_car.mc.mc_p_rd._x;
_local3.y = mc_car.mc.mc_p_rd._y;
mc_car.mc.localToGlobal(_local3);
mc_car._parent.globalToLocal(_local3);
p_rd = new CParticle(_local3.x, _local3.y, bikeParams.pRD_mass);
engine.addParticle(p_rd);
_local2 = bikeParams.downSpringParams;
_local5 = engine.addSpringConstraint(p_wr, p_wl, _local2.koeffPress, _local2.koeffStretch);
_local5.setBasicParticleNum(_local2.basicParticleNum);
_local5.setBasicParticleWeight(_local2.basicParticleWeight);
_local2 = bikeParams.upSpringParams;
_local5 = engine.addSpringConstraint(p_ld, p_rd, _local2.koeffPress, _local2.koeffStretch);
_local5.setBasicParticleNum(_local2.basicParticleNum);
_local5.setBasicParticleWeight(_local2.basicParticleWeight);
_local2 = bikeParams.diagonalSpringParams;
_local5 = engine.addSpringConstraint(p_wr, p_ld, _local2.koeffPress, _local2.koeffStretch);
_local5.setBasicParticleNum(_local2.basicParticleNum);
_local5.setBasicParticleWeight(_local2.basicParticleWeight);
_local5 = engine.addSpringConstraint(p_wl, p_rd, _local2.koeffPress, _local2.koeffStretch);
_local5.setBasicParticleNum(_local2.basicParticleNum);
_local5.setBasicParticleWeight(_local2.basicParticleWeight);
_local2 = bikeParams.rightSpringParams;
_local5 = engine.addSpringConstraint(p_wr, p_rd, _local2.koeffPress, _local2.koeffStretch);
_local5.setBasicParticleNum(_local2.basicParticleNum);
_local5.setBasicParticleWeight(_local2.basicParticleWeight);
_local2 = bikeParams.leftSpringParams;
_local5 = engine.addSpringConstraint(p_wl, p_ld, _local2.koeffPress, _local2.koeffStretch);
_local5.setBasicParticleNum(_local2.basicParticleNum);
_local5.setBasicParticleWeight(_local2.basicParticleWeight);
engine.addPenetrationConstraint(p_wr, p_rd, p_ld);
engine.addPenetrationConstraint(p_wl, p_ld, p_rd);
} else {
_local3.x = mc_car.mc.mc_p_c._x;
_local3.y = mc_car.mc.mc_p_c._y;
mc_car.mc.localToGlobal(_local3);
mc_car._parent.globalToLocal(_local3);
p_c = new CParticle(_local3.x, _local3.y, bikeParams.pC_mass);
engine.addParticle(p_c);
_local2 = bikeParams.downSpringParams;
_local5 = engine.addSpringConstraint(p_wr, p_wl, _local2.koeffPress, _local2.koeffStretch);
_local5.setBasicParticleNum(_local2.basicParticleNum);
_local5.setBasicParticleWeight(_local2.basicParticleWeight);
_local2 = bikeParams.rightSpringParams;
_local5 = engine.addSpringConstraint(p_wr, p_c, _local2.koeffPress, _local2.koeffStretch);
_local5.setBasicParticleNum(_local2.basicParticleNum);
_local5.setBasicParticleWeight(_local2.basicParticleWeight);
_local2 = bikeParams.leftSpringParams;
_local5 = engine.addSpringConstraint(p_wl, p_c, _local2.koeffPress, _local2.koeffStretch);
_local5.setBasicParticleNum(_local2.basicParticleNum);
_local5.setBasicParticleWeight(_local2.basicParticleWeight);
engine.addPenetrationConstraint2(p_c, p_wr, p_wl);
mc_back_dark._x = mc_back_wheel._x + DARK_DX;
mc_back_dark._y = mc_back_wheel._y + DARK_DY;
mc_back_dark._rotation = mc_back_wheel.mc.mc_rim._rotation;
mc_forward_dark._x = mc_forward_wheel._x + DARK_DX;
mc_forward_dark._y = mc_forward_wheel._y + DARK_DY;
mc_forward_dark._rotation = mc_forward_wheel.mc.mc_rim._rotation;
}
state = ST_GO;
}
function init_atv1(mc_container, sX, sY, engine) {
init(mc_container, sX, sY, engine, atv1Params);
}
function init_bike1(mc_container, sX, sY, engine) {
init(mc_container, sX, sY, engine, moto1Params);
}
function init_atv2(mc_container, sX, sY, engine) {
init(mc_container, sX, sY, engine, atv2Params);
}
function init_bike2(mc_container, sX, sY, engine) {
init(mc_container, sX, sY, engine, moto2Params);
}
function init_atv3(mc_container, sX, sY, engine) {
init(mc_container, sX, sY, engine, atv3Params);
}
function init_bike3(mc_container, sX, sY, engine) {
init(mc_container, sX, sY, engine, moto3Params);
}
function process() {
if (state == ST_GO) {
if (bikeParamsArray[bikeNum - 1].triangleSprings) {
var _local5;
var _local4;
var _local3;
_local5 = new CVector2D(p_wr.pos.x - p_c.pos.x, p_wr.pos.y - p_c.pos.y);
_local5.normalize();
_local4 = new CVector2D(p_wl.pos.x - p_c.pos.x, p_wl.pos.y - p_c.pos.y);
_local4.normalize();
mc_car._rotation = ((Math.atan2(_local5.y + _local4.y, _local5.x + _local4.x) * 180) / Math.PI) - 90;
_local3 = new CVector2D(mc_car.mc.mc_p_c._x, mc_car.mc.mc_p_c._y);
mc_car.mc.localToGlobal(_local3);
mc_car._parent.globalToLocal(_local3);
mc_car._x = mc_car._x + (p_c.pos.x - _local3.x);
mc_car._y = mc_car._y + (p_c.pos.y - _local3.y);
} else {
var _local6;
var _local2;
_local6 = new CVector2D(p_rd.pos.x - p_ld.pos.x, p_rd.pos.y - p_ld.pos.y);
mc_car._rotation = (Math.atan2(_local6.y, _local6.x) * 180) / Math.PI;
var _local3 = new CVector2D(mc_car.mc.mc_p_ld._x, mc_car.mc.mc_p_ld._y);
_local2 = new CVector2D(mc_car.mc.mc_p_rd._x, mc_car.mc.mc_p_rd._y);
mc_car.mc.localToGlobal(_local3);
mc_car._parent.globalToLocal(_local3);
mc_car.mc.localToGlobal(_local2);
mc_car._parent.globalToLocal(_local2);
mc_car._x = mc_car._x + ((((p_ld.pos.x - _local3.x) + p_rd.pos.x) - _local2.x) / 2);
mc_car._y = mc_car._y + ((((p_ld.pos.y - _local3.y) + p_rd.pos.y) - _local2.y) / 2);
_local3.x = mc_back_wheel._x;
_local3.y = mc_back_wheel._y;
mc_back_wheel._parent.localToGlobal(_local3);
mc_car.mc.globalToLocal(_local3);
_local2.x = mc_forward_wheel._x;
_local2.y = mc_forward_wheel._y;
mc_forward_wheel._parent.localToGlobal(_local2);
mc_car.mc.globalToLocal(_local2);
mc_car.mc.mc_s_ld._rotation = (mc_car.mc.mc_s_lu._rotation = (Math.atan2((_local3.y + 1.2) - mc_car.mc.mc_s_lu._y, _local3.x - mc_car.mc.mc_s_lu._x) * 180) / Math.PI);
mc_car.mc.mc_s_rd._rotation = (mc_car.mc.mc_s_ru._rotation = (Math.atan2((_local2.y + 1.2) - mc_car.mc.mc_s_ru._y, _local2.x - mc_car.mc.mc_s_ru._x) * 180) / Math.PI);
}
if (((bikeNum == BIKE_ATV1) || (bikeNum == BIKE_ATV2)) || (bikeNum == BIKE_ATV3)) {
mc_forward_wheel.mc.mc_rim2._rotation = mc_forward_wheel.mc.mc_rim._rotation;
mc_back_wheel.mc.mc_rim2._rotation = mc_back_wheel.mc.mc_rim._rotation;
mc_back_dark._x = mc_back_wheel._x + DARK_DX;
mc_back_dark._y = mc_back_wheel._y + DARK_DY;
mc_back_dark._rotation = mc_back_wheel.mc.mc_rim._rotation;
mc_forward_dark._x = mc_forward_wheel._x + DARK_DX;
mc_forward_dark._y = mc_forward_wheel._y + DARK_DY;
mc_forward_dark._rotation = mc_forward_wheel.mc.mc_rim._rotation;
} else {
updateBikeSprings();
}
} else if (state == ST_CRUSH) {
}
}
function updateBikeSprings() {
var _local3;
var _local2;
var _local4;
_local2 = new CVector2D(mc_car.mc.mc_back_spring._x, mc_car.mc.mc_back_spring._y);
mc_car.mc.localToGlobal(_local2);
mc_car._parent.globalToLocal(_local2);
_local3 = new CVector2D(mc_car.mc.mc_back_spring.mc_dir._x, mc_car.mc.mc_back_spring.mc_dir._y);
mc_car.mc.mc_back_spring.localToGlobal(_local3);
mc_car._parent.globalToLocal(_local3);
_local4 = new CVector2D(mc_back_wheel._x - _local2.x, mc_back_wheel._y - _local2.y);
_local3.minus(_local2);
mc_car.mc.mc_back_spring._rotation = mc_car.mc.mc_back_spring._rotation + (((Math.atan2(_local4.y, _local4.x) - Math.atan2(_local3.y, _local3.x)) * 180) / Math.PI);
}
function toCrush(engine) {
var _local2 = new CVector2D(0, 0);
mc_car.gotoAndPlay("crush");
mc_car.mc.gotoAndStop(2);
engine.clearConstraints();
engine.stopWheels = true;
_local2.reinit(mc_forward_wheel._x - mc_car._x, mc_forward_wheel._y - mc_car._y);
_local2.normalize();
mc_forward_wheel.turnTo(_local2, 10);
_local2.reinit(mc_back_wheel._x - mc_car._x, mc_back_wheel._y - mc_car._y);
_local2.normalize();
mc_back_wheel.turnTo(_local2, 10);
state = ST_CRUSH;
}
function isCrushed() {
return(state == ST_CRUSH);
}
function isFullCrushed() {
return(false);
}
function checkHitWithGround(levelHit) {
var _local2 = {x:0, y:0};
var _local3;
_local3 = mc_car.mc.mc_man.mc.h;
_local2.x = _local3.mc_hit._x;
_local2.y = _local3.mc_hit._y;
_local3.localToGlobal(_local2);
if (levelHit.hitTest(_local2.x, _local2.y, true)) {
return(true);
}
_local3 = mc_car.mc.mc_man.mc.b;
_local2.x = _local3.mc_hit._x;
_local2.y = _local3.mc_hit._y;
_local3.localToGlobal(_local2);
if (levelHit.hitTest(_local2.x, _local2.y, true)) {
return(true);
}
_local3 = mc_car.mc.mc_man.mc.l;
_local2.x = _local3.mc_hit._x;
_local2.y = _local3.mc_hit._y;
_local3.localToGlobal(_local2);
if (levelHit.hitTest(_local2.x, _local2.y, true)) {
return(true);
}
return(false);
}
function stopManAnim() {
mc_car.mc.mc_man.stopAnim();
}
function startManAnim() {
mc_car.mc.mc_man.startAnim();
}
function stopManAnimFull() {
mc_car.mc.mc_man.stopAnim();
mc_car.mc.mc_man.stopMCAnim();
}
function toLeft() {
var _local3;
var _local2 = calcCarNVector();
var _local5;
var _local6;
var _local4;
_local4 = bikeParamsArray[bikeNum - 1];
_local5 = _local4.controlAccPercBase;
_local6 = _local4.controlAccPercMult;
_local3 = (Math.abs(_local2.y) * (1 - _local5)) + _local5;
_local3 = _local3 * _local6;
if (_local2.y > _local4.koeffStability) {
mc_forward_wheel.addedAcc.x = mc_forward_wheel.addedAcc.x - (((_local2.x * CParticleEngine.gravity) * _local3) * 0.7);
mc_forward_wheel.addedAcc.y = mc_forward_wheel.addedAcc.y - (((_local2.y * CParticleEngine.gravity) * _local3) * 0.7);
if (!mc_back_wheel.hasIntersection()) {
mc_back_wheel.addedAcc.x = mc_back_wheel.addedAcc.x + (((_local2.x * CParticleEngine.gravity) * _local3) * 1.3);
mc_back_wheel.addedAcc.y = mc_back_wheel.addedAcc.y + (((_local2.y * CParticleEngine.gravity) * _local3) * 1.3);
}
}
}
function toRight() {
var _local3;
var _local2 = calcCarNVector();
var _local5;
var _local6;
var _local4;
_local4 = bikeParamsArray[bikeNum - 1];
_local5 = _local4.controlAccPercBase;
_local6 = _local4.controlAccPercMult;
_local3 = (Math.abs(_local2.y) * (1 - _local5)) + _local5;
_local3 = _local3 * _local6;
if (_local2.y > _local4.koeffStability) {
if (!mc_forward_wheel.hasIntersection()) {
mc_forward_wheel.addedAcc.x = mc_forward_wheel.addedAcc.x + (((_local2.x * CParticleEngine.gravity) * _local3) * 1.3);
mc_forward_wheel.addedAcc.y = mc_forward_wheel.addedAcc.y + (((_local2.y * CParticleEngine.gravity) * _local3) * 1.3);
}
mc_back_wheel.addedAcc.x = mc_back_wheel.addedAcc.x - (((_local2.x * CParticleEngine.gravity) * _local3) * 0.7);
mc_back_wheel.addedAcc.y = mc_back_wheel.addedAcc.y - (((_local2.y * CParticleEngine.gravity) * _local3) * 0.7);
}
}
function calcCarNVector() {
var _local2;
_local2 = mc_forward_wheel.particle.pos.minusNew(mc_back_wheel.particle.pos);
_local2.normalize();
var _local3;
_local3 = _local2.x;
_local2.x = -_local2.y;
_local2.y = _local3;
return(_local2);
}
static var BUTTON_LEFT = 37;
static var BUTTON_RIGHT = 39;
static var BUTTON_UP = 38;
static var BUTTON_DOWN = 40;
static var DARK_DX = -3;
static var DARK_DY = -1;
static var MAX_HEALTH = 100;
static var ST_GO = 1;
static var ST_CRUSH = 2;
static var BIKE_MOTO1 = 1;
static var BIKE_ATV1 = 2;
static var BIKE_MOTO2 = 3;
static var BIKE_ATV2 = 4;
static var BIKE_MOTO3 = 5;
static var BIKE_ATV3 = 6;
static var moto1Params = new CBikeParams(0.6, 3.4, -0.4, "lib_bike_body1", 13, "lib_wheel1", 12, 0.4, 0, 0.03, 4.3, 24.7, 17, 0, "lib_wheel_forward1", 11, 0.4, 0, 0.03, 4.3, 24.7, 17, 0, 3, 3, 0, false, new CSpringParams(0.45, 0.45, CSpringConstraint.BASIC_PARTICLE_NONE, 0), new CSpringParams(1, 1, CSpringConstraint.BASIC_PARTICLE_NONE, 0), new CSpringParams(0.45, 0.45, CSpringConstraint.BASIC_PARTICLE_NONE, 0), new CSpringParams(0.2, 0.45, CSpringConstraint.BASIC_PARTICLE_NONE, 0), new CSpringParams(0.2, 0.45, CSpringConstraint.BASIC_PARTICLE_NONE, 0));
static var atv1Params = new CBikeParams(0.6, 1.9, -0.1, "lib_bike_body2", 11, "lib_wheel2", 12, 0, 0.4, 0, 4.3, 13, 16, 0, "lib_wheel2", 13, 0, 0.3, 0, 4.3, 13, 16, 0, 0, 0, 2, true, new CSpringParams(0.9, 0.9, CSpringConstraint.BASIC_PARTICLE_NONE, 0), new CSpringParams(0, 0, CSpringConstraint.BASIC_PARTICLE_NONE, 0), new CSpringParams(0, 0, CSpringConstraint.BASIC_PARTICLE_NONE, 0), new CSpringParams(0.4, 0.5, 1, 0.8), new CSpringParams(0.4, 0.5, 1, 0.8));
static var moto2Params = new CBikeParams(0.6, 3.7, -0.4, "lib_bike_body3", 13, "lib_wheel3", 12, 0.4, 0, 0.03, 3.7, 26.6, 17, 0, "lib_wheel_forward3", 11, 0.4, 0, 0.03, 3.7, 26.6, 17, 0, 3, 3, 0, false, new CSpringParams(0.49, 0.49, CSpringConstraint.BASIC_PARTICLE_NONE, 0), new CSpringParams(1, 1, CSpringConstraint.BASIC_PARTICLE_NONE, 0), new CSpringParams(0.5, 0.5, 1, 0.4), new CSpringParams(0.2, 0.49, 1, 0.6), new CSpringParams(0.25, 0.49, 1, 0.6));
static var atv2Params = new CBikeParams(0.6, 2, -0.15, "lib_bike_body4", 11, "lib_wheel4", 12, 0, 0.5, 0, 4.1, 15, 16, 0, "lib_wheel4", 13, 0, 0.4, 0, 4.1, 15, 16, 0, 0, 0, 2, true, new CSpringParams(0.9, 0.9, CSpringConstraint.BASIC_PARTICLE_NONE, 0), new CSpringParams(0, 0, CSpringConstraint.BASIC_PARTICLE_NONE, 0), new CSpringParams(0, 0, CSpringConstraint.BASIC_PARTICLE_NONE, 0), new CSpringParams(0.45, 0.52, 1, 0.81), new CSpringParams(0.45, 0.52, 1, 0.81));
static var moto3Params = new CBikeParams(0.6, 3.9, -0.4, "lib_bike_body5", 13, "lib_wheel5", 12, 0.4, 0, 0.03, 3.2, 28.5, 17, 0, "lib_wheel_forward5", 11, 0.4, 0, 0.03, 3.2, 28.5, 17, 0, 3, 3, 0, false, new CSpringParams(0.49, 0.49, CSpringConstraint.BASIC_PARTICLE_NONE, 0), new CSpringParams(1, 1, CSpringConstraint.BASIC_PARTICLE_NONE, 0), new CSpringParams(0.55, 0.55, 1, 0.8), new CSpringParams(0.25, 0.5, 1, 0.7), new CSpringParams(0.25, 0.5, 1, 0.7));
static var atv3Params = new CBikeParams(0.6, 2.2, -0.15, "lib_bike_body6", 11, "lib_wheel6", 12, 0, 0.5, 0, 3.8, 17, 16, 0, "lib_wheel6", 13, 0, 0.4, 0, 3.8, 17, 16, 0, 0, 0, 2, true, new CSpringParams(0.9, 0.9, CSpringConstraint.BASIC_PARTICLE_NONE, 0), new CSpringParams(0, 0, CSpringConstraint.BASIC_PARTICLE_NONE, 0), new CSpringParams(0, 0, CSpringConstraint.BASIC_PARTICLE_NONE, 0), new CSpringParams(0.47, 0.54, 1, 0.87), new CSpringParams(0.47, 0.54, 1, 0.87));
static var bikeParamsArray = [moto1Params, atv1Params, moto2Params, atv2Params, moto3Params, atv3Params];
}
Symbol 570 MovieClip [__Packages.CIndicator] Frame 0
class CIndicator extends MovieClip
{
var maxValue, curValue, mc_mask;
function CIndicator () {
super();
maxValue = 100;
curValue = maxValue;
}
function setMaxValue(val) {
maxValue = val;
}
function getMaxValue() {
return(maxValue);
}
function setValue(val) {
curValue = val;
validateCurValue();
updateView();
}
function addValue(val) {
curValue = curValue + val;
validateCurValue();
updateView();
}
function getValue() {
return(curValue);
}
function setPercent(perc) {
curValue = (perc * maxValue) / 100;
updateView();
}
function getPercent() {
return((100 * curValue) / maxValue);
}
function isEmpty() {
return(curValue <= 0);
}
function isFull() {
return(curValue >= maxValue);
}
function updateView() {
mc_mask._x = (-(1 - (curValue / maxValue))) * mc_mask._width;
}
static function updateViewFor(mc, val, maxVal) {
mc.mc_mask._x = (-(1 - (val / maxVal))) * mc.mc_mask._width;
}
function validateCurValue() {
if (curValue > maxValue) {
curValue = maxValue;
} else if (curValue < 0) {
curValue = 0;
}
}
}
Symbol 571 MovieClip [__Packages.CGP] Frame 0
class CGP
{
static var mc_root, uid, objectsCounter, curLevelTask, level, curLevelTaskTime, curLevelTaskValue, curLevelDistance, mc_level, crumpleCount, crushCount, greenBonusesCount, redBonusesCount, firstFinishTruck, mc_panel, mc_progressInd, carSync;
function CGP () {
}
static function createSounds() {
var _local2;
var _local1 = 0;
while (_local1 < soundsArray.length) {
_local2 = mc_root.mc_sounds.createEmptyMovieClip(soundsArray[_local1].name, _local1);
_local2.sound = new Sound(_local2);
_local2.sound.attachSound(soundsArray[_local1].name);
_local1++;
}
}
static function playSound(id, vol) {
soundsArray[id].go = true;
soundsArray[id].vol = vol;
}
static function processSounds() {
var _local1 = 0;
while (_local1 < soundsArray.length) {
if (soundsArray[_local1].go) {
if (soundsArray[_local1].vol > 10) {
realPlaySound(_local1);
break;
}
}
_local1++;
}
resetSounds();
}
static function resetSounds() {
var _local1 = 0;
while (_local1 < soundsArray.length) {
soundsArray[_local1].go = false;
_local1++;
}
}
static function realPlaySound(id) {
if (mc_root.stopSoundFlag) {
return(undefined);
}
mc_root.mc_sounds[soundsArray[id].name].sound.setVolume(soundsArray[id].vol);
mc_root.mc_sounds[soundsArray[id].name].sound.start(0, 0);
}
static function init() {
uid = 0;
objectsCounter = 0;
createSounds();
}
static function getUID() {
uid++;
return(uid);
}
static function setLevelTasks() {
curLevelTask = levelTasks[level - 1][IDX_TASK];
curLevelTaskTime = levelTasks[level - 1][IDX_TASK_TIME];
curLevelTaskValue = levelTasks[level - 1][IDX_TASK_VALUE];
curLevelDistance = mc_level.mc.mc_finish._x - mc_level.mc.mc_start._x;
crumpleCount = (crushCount = 0);
greenBonusesCount = (redBonusesCount = 0);
firstFinishTruck = FIRST_NONE;
}
static function updateLevelProgress() {
switch (curLevelTask) {
case TASK_DRIVE_LEVEL :
break;
case TASK_DRIVE_FOR_TIME :
break;
case TASK_CRUSH :
mc_panel.txtCars.text = (crushCount + "/") + curLevelTaskValue;
if (crushCount < curLevelTaskValue) {
mc_panel.txtCars.textColor = 16777215 /* 0xFFFFFF */;
} else {
mc_panel.txtCars.textColor = 65280;
}
break;
case TASK_GET_BONUSES :
mc_panel.txtBonuses.text = ((greenBonusesCount - redBonusesCount) + "/") + curLevelTaskValue;
if ((greenBonusesCount - redBonusesCount) < curLevelTaskValue) {
mc_panel.txtBonuses.textColor = 16777215 /* 0xFFFFFF */;
} else {
mc_panel.txtBonuses.textColor = 65280;
}
break;
case TASK_OVERTAKE_ENEMY :
}
mc_progressInd.setPercent((100 * (carSync.mc_car._x - mc_level.mc.mc_start._x)) / curLevelDistance);
}
static function isHitWithCar(mc) {
var _local1;
if (Math.abs(carSync.mc_car._x - mc._x) > CAR_HIT_RADIUS) {
return(false);
}
_local1 = {x:mc._x, y:mc._y};
mc._parent.localToGlobal(_local1);
return(carSync.mc_car.mc.mc_hit.hitTest(_local1.x, _local1.y, true));
}
static var CAR_HIT_RADIUS = 110;
static var TASK_DRIVE_LEVEL = 1;
static var TASK_DRIVE_FOR_TIME = 2;
static var TASK_CRUSH = 3;
static var TASK_GET_BONUSES = 4;
static var TASK_OVERTAKE_ENEMY = 5;
static var MAX_LEVEL_NUM = 10;
static var UNLOCK_LEVEL_BIKE = 3;
static var UNLOCK_LEVEL_ATV = 3;
static var UNLOCK_LEVEL_BIKE3 = 6;
static var UNLOCK_LEVEL_ATV3 = 6;
static var SHOW_INTER_LEVEL = false;
static var levelTasks = [[TASK_DRIVE_LEVEL, 0, 0], [TASK_DRIVE_FOR_TIME, 60000, 0], [TASK_CRUSH, 120000, 15], [TASK_GET_BONUSES, 120000, 15], [TASK_DRIVE_FOR_TIME, 60000, 0], [TASK_OVERTAKE_ENEMY, 0, 0]];
static var IDX_TASK = 0;
static var IDX_TASK_TIME = 1;
static var IDX_TASK_VALUE = 2;
static var FIRST_NONE = 1;
static var FIRST_PLAYER = 2;
static var FIRST_COMPUTER = 3;
static var LVL_NEXT_FRAME = "";
static var scrTime = 400;
static var soundsArray = [{name:"snd_expl", vol:100, go:false}, {name:"snd_crush", vol:100, go:false}, {name:"snd_crush_small", vol:100, go:false}, {name:"snd_expl_small", vol:100, go:false}, {name:"snd_bonus_repair", vol:100, go:false}, {name:"snd_bonus_green", vol:100, go:false}, {name:"snd_bonus_red", vol:100, go:false}];
static var snd_expl = 0;
static var snd_crush = 1;
static var snd_crush_small = 2;
static var snd_expl_small = 3;
static var snd_bonus_repair = 4;
static var snd_bonus_green = 5;
static var snd_bonus_red = 6;
}
Symbol 572 MovieClip [__Packages.CCamera] Frame 0
class CCamera
{
var targetMovie, levelMovie;
function CCamera () {
}
function init(targetMovie_, levelMovie_) {
targetMovie = targetMovie_;
levelMovie = levelMovie_;
levelMovie._y = 100;
process();
}
function process() {
var _local2 = {x:targetMovie._x + 40, y:targetMovie._y};
targetMovie._parent.localToGlobal(_local2);
levelMovie._parent.globalToLocal(_local2);
levelMovie._x = levelMovie._x + ((SCREEN_WIDTH / 3) - _local2.x);
levelMovie._x = Math.round(levelMovie._x);
if (levelMovie._x > 0) {
levelMovie._x = 0;
} else if ((levelMovie._x + levelMovie._width) < SCREEN_WIDTH) {
levelMovie._x = SCREEN_WIDTH - levelMovie._width;
}
if (levelMovie._y < 0) {
levelMovie._y = 0;
}
}
static var SCREEN_WIDTH = 640;
static var SCREEN_HEIGHT = 450;
static var SCREEN_WIDTH2 = SCREEN_WIDTH / 2;
static var SCREEN_HEIGHT2 = SCREEN_HEIGHT - 50;
}
Symbol 573 MovieClip [__Packages.CBack] Frame 0
class CBack
{
var mc1, mc2, scaleFactor;
function CBack () {
}
function init(mc1_, mc2_, scaleFactor_) {
mc1 = mc1_;
mc2 = mc2_;
scaleFactor = scaleFactor_;
}
function process(levelX) {
levelX = Math.abs(Math.round(levelX) / scaleFactor) % mc1._width;
mc1._x = -levelX;
mc2._x = (mc1._x + mc1._width) - 1;
}
}
Symbol 574 MovieClip [__Packages.MochiAd] Frame 0
class MochiAd
{
function MochiAd () {
}
static function getVersion() {
return("2.5");
}
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 () {
}, ad_finished:function () {
if (CGP.LVL_NEXT_FRAME != "") {
this.clip.mc_message.gotoAndStop(CGP.LVL_NEXT_FRAME);
CGP.LVL_NEXT_FRAME = "";
}
}, 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.clip = clip;
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 575 MovieClip [__Packages.CMan] Frame 0
class CMan extends MovieClip
{
var stopFlag, state, mc, gotoAndStop;
function CMan () {
super();
stopFlag = false;
state = 0;
}
function stopAnim() {
stopFlag = true;
}
function stopMCAnim() {
mc.stop();
}
function startAnim() {
stopFlag = false;
}
function onEnterFrame() {
if (stopFlag) {
return(undefined);
}
if (Key.isDown(LEFT_BUTTON)) {
toLeft();
} else if (Key.isDown(RIGHT_BUTTON)) {
toRight();
} else if ((state == 1) || (state == 2)) {
fromLeft();
} else if ((state == 4) || (state == 5)) {
fromRight();
}
}
function toLeft() {
if (state == 0) {
gotoAndStop("toLeft");
state = 1;
} else if (state == 3) {
gotoAndStop("toLeft");
mc.gotoAndPlay((ANIM_FRAMES - mc._currentframe) + 1);
state = 1;
} else if ((state == 4) || (state == 5)) {
fromRight();
state = 6;
}
}
function toRight() {
if (state == 0) {
gotoAndStop("toRight");
state = 4;
} else if (state == 6) {
gotoAndStop("toRight");
mc.gotoAndPlay((ANIM_FRAMES - mc._currentframe) + 1);
state = 4;
} else if ((state == 1) || (state == 2)) {
fromLeft();
state = 3;
}
}
function fromLeft() {
if (state == 1) {
gotoAndStop("fromLeft");
mc.gotoAndPlay((ANIM_FRAMES - mc._currentframe) + 1);
state = 3;
} else if (state == 2) {
gotoAndStop("fromLeft");
state = 3;
}
}
function fromRight() {
if (state == 4) {
gotoAndStop("fromRight");
mc.gotoAndPlay((ANIM_FRAMES - mc._currentframe) + 1);
state = 6;
} else if (state == 5) {
gotoAndStop("fromRight");
state = 6;
}
}
function endMove() {
if (state == 1) {
gotoAndStop("left");
state = 2;
} else if (state == 3) {
gotoAndStop("stay");
state = 0;
} else if (state == 4) {
gotoAndStop("right");
state = 5;
} else if (state == 6) {
gotoAndStop("stay");
state = 0;
}
}
static var LEFT_BUTTON = 37;
static var RIGHT_BUTTON = 39;
static var ANIM_FRAMES = 7;
}
Symbol 15 MovieClip [lib_wheel3] Frame 1
#initclip 34
Object.registerClass("lib_wheel3", CWheel);
#endinitclip
Instance of Symbol 14 MovieClip "mc_crush_test" in Symbol 15 MovieClip [lib_wheel3] Frame 1
onClipEvent (load) {
this._visible = false;
}
Symbol 22 MovieClip [lib_wheel_forward3] Frame 1
#initclip 20
Object.registerClass("lib_wheel_forward3", CWheel);
#endinitclip
Instance of Symbol 14 MovieClip "mc_crush_test" in Symbol 22 MovieClip [lib_wheel_forward3] Frame 1
onClipEvent (load) {
this._visible = false;
}
Symbol 40 MovieClip Frame 7
this._parent.endMove();
Symbol 42 MovieClip Frame 7
this._parent.endMove();
Symbol 45 MovieClip Frame 7
this._parent.endMove();
Symbol 47 MovieClip Frame 7
this._parent.endMove();
Symbol 48 MovieClip [moto3_man] Frame 1
#initclip 21
Object.registerClass("moto3_man", CMan);
#endinitclip
this.stop();
Symbol 49 MovieClip Frame 1
this.stop();
Symbol 50 MovieClip [lib_bike_body3] Frame 1
this.stop();
Symbol 56 MovieClip [lib_wheel1] Frame 1
#initclip 22
Object.registerClass("lib_wheel1", CWheel);
#endinitclip
Instance of Symbol 14 MovieClip "mc_crush_test" in Symbol 56 MovieClip [lib_wheel1] Frame 1
onClipEvent (load) {
this._visible = false;
}
Symbol 63 MovieClip [lib_wheel_forward1] Frame 1
#initclip 23
Object.registerClass("lib_wheel_forward1", CWheel);
#endinitclip
Instance of Symbol 14 MovieClip "mc_crush_test" in Symbol 63 MovieClip [lib_wheel_forward1] Frame 1
onClipEvent (load) {
this._visible = false;
}
Symbol 79 MovieClip Frame 7
this._parent.endMove();
Symbol 81 MovieClip Frame 7
this._parent.endMove();
Symbol 82 MovieClip Frame 7
this._parent.endMove();
Symbol 84 MovieClip Frame 7
this._parent.endMove();
Symbol 85 MovieClip [moto1_man] Frame 1
#initclip 24
Object.registerClass("moto1_man", CMan);
#endinitclip
this.stop();
Symbol 86 MovieClip Frame 1
this.stop();
Symbol 87 MovieClip [lib_bike_body1] Frame 1
this.stop();
Symbol 93 MovieClip [lib_wheel5] Frame 1
#initclip 25
Object.registerClass("lib_wheel5", CWheel);
#endinitclip
Instance of Symbol 92 MovieClip "mc_crush_test" in Symbol 93 MovieClip [lib_wheel5] Frame 1
onClipEvent (load) {
this._visible = false;
}
Symbol 99 MovieClip [lib_wheel_forward5] Frame 1
#initclip 26
Object.registerClass("lib_wheel_forward5", CWheel);
#endinitclip
Instance of Symbol 92 MovieClip "mc_crush_test" in Symbol 99 MovieClip [lib_wheel_forward5] Frame 1
onClipEvent (load) {
this._visible = false;
}
Symbol 118 MovieClip Frame 7
this._parent.endMove();
Symbol 120 MovieClip Frame 7
this._parent.endMove();
Symbol 121 MovieClip Frame 7
this._parent.endMove();
Symbol 123 MovieClip Frame 7
this._parent.endMove();
Symbol 124 MovieClip [moto5_man] Frame 1
#initclip 27
Object.registerClass("moto5_man", CMan);
#endinitclip
this.stop();
Symbol 125 MovieClip Frame 1
this.stop();
Symbol 126 MovieClip [lib_bike_body5] Frame 1
this.stop();
Symbol 142 MovieClip Frame 7
this._parent.endMove();
Symbol 144 MovieClip Frame 7
this._parent.endMove();
Symbol 145 MovieClip Frame 7
this._parent.endMove();
Symbol 147 MovieClip Frame 7
this._parent.endMove();
Symbol 148 MovieClip [quad2_man] Frame 1
#initclip 28
Object.registerClass("quad2_man", CMan);
#endinitclip
this.stop();
Symbol 149 MovieClip Frame 1
this.stop();
Symbol 150 MovieClip [lib_bike_body2] Frame 1
this.stop();
Symbol 160 MovieClip [lib_wheel2] Frame 1
#initclip 29
Object.registerClass("lib_wheel2", CWheel);
#endinitclip
Instance of Symbol 14 MovieClip "mc_crush_test" in Symbol 160 MovieClip [lib_wheel2] Frame 1
onClipEvent (load) {
this._visible = false;
}
Symbol 176 MovieClip Frame 7
this._parent.endMove();
Symbol 178 MovieClip Frame 7
this._parent.endMove();
Symbol 179 MovieClip Frame 7
this._parent.endMove();
Symbol 181 MovieClip Frame 7
this._parent.endMove();
Symbol 182 MovieClip [quad4_man] Frame 1
#initclip 30
Object.registerClass("quad4_man", CMan);
#endinitclip
this.stop();
Symbol 183 MovieClip Frame 1
this.stop();
Symbol 184 MovieClip [lib_bike_body4] Frame 1
this.stop();
Symbol 192 MovieClip [lib_wheel4] Frame 1
#initclip 31
Object.registerClass("lib_wheel4", CWheel);
#endinitclip
Instance of Symbol 14 MovieClip "mc_crush_test" in Symbol 192 MovieClip [lib_wheel4] Frame 1
onClipEvent (load) {
this._visible = false;
}
Symbol 209 MovieClip Frame 7
this._parent.endMove();
Symbol 211 MovieClip Frame 7
this._parent.endMove();
Symbol 212 MovieClip Frame 7
this._parent.endMove();
Symbol 214 MovieClip Frame 7
this._parent.endMove();
Symbol 215 MovieClip [quad6_man] Frame 1
#initclip 32
Object.registerClass("quad6_man", CMan);
#endinitclip
this.stop();
Symbol 216 MovieClip Frame 1
this.stop();
Symbol 217 MovieClip [lib_bike_body6] Frame 1
this.stop();
Symbol 226 MovieClip [lib_wheel6] Frame 1
#initclip 33
Object.registerClass("lib_wheel6", CWheel);
#endinitclip
Instance of Symbol 225 MovieClip "mc_crush_test" in Symbol 226 MovieClip [lib_wheel6] Frame 1
onClipEvent (load) {
this._visible = false;
}
Symbol 248 MovieClip Frame 1
Symbol 248 MovieClip Frame 140
stop();
this.timer = 0;
this.onEnterFrame = function () {
this.timer++;
if (this.timer >= 30) {
this._parent.gotoAndStop("main");
this.onEnterFrame = function () {
};
}
};
Symbol 252 MovieClip Frame 1
stop();
Symbol 254 MovieClip Frame 1
stop();
Symbol 256 MovieClip Frame 1
stop();
Symbol 258 MovieClip Frame 1
stop();
Symbol 263 Button
on (press) {
this._parent.soundOff();
this.gotoAndStop(2);
}
Symbol 266 Button
on (press) {
this._parent.soundOn();
this.gotoAndStop(1);
}
Symbol 267 MovieClip Frame 1
this.stop();
Symbol 273 Button
on (release) {
gameStart();
}
Symbol 276 Button
on (release) {
this.gotoAndStop("rules");
}
Symbol 280 Button
on (release) {
getURL ("http://www.yougame.com/", "_top");
}
Symbol 282 Button
on (release) {
getURL ("http://www.yougame.com/putonyourwebsite/", "_top");
}
Symbol 287 Button
on (release) {
getURL ("http://www.yougame.com/", "_top");
}
Symbol 291 Button
on (release) {
_root.showScoreBoard(true, false);
}
Symbol 304 Button
on (release) {
this.gotoAndStop("main");
}
Symbol 329 Button
on (release) {
this.newGame();
}
Symbol 515 Button
on (release) {
this._parent.newGame();
}
Symbol 517 Button
on (release) {
this._parent.nextLevel();
}
Symbol 520 Button
on (release) {
_root.showScoreBoard(true, true);
}
Symbol 523 Button
on (release) {
this._parent.chooseBikeWhenComplete();
}
Symbol 528 Button
on (release) {
this._parent.replay();
}
Symbol 530 Button
on (release) {
this._parent.chooseBike();
}
Symbol 543 Button
on (release) {
this._parent.replay();
}
Symbol 545 Button
on (release) {
this._parent.resume();
}
Instance of Symbol 521 MovieClip in Symbol 550 MovieClip Frame 7
onClipEvent (load) {
MochiScores.showLeaderboard({boardID:"4541b9e0ee056633", score:this._parent._parent.scores, res:"640x450"});
}
Symbol 550 MovieClip Frame 8
MochiAd.showInterLevelAd({id:"5aa44ec25f37b048", res:"640x450"});
Symbol 553 Button
on (press) {
this._parent.pauseGame();
}
Symbol 556 Button
on (press) {
this._parent.resume();
}
Symbol 557 MovieClip Frame 1
this.stop();