Frame 2
stop();
if (_root.percent == undefined) {
_root.percent = 0;
loader.gotoAndStop(1);
percent_txt.text = 0;
}
onEnterFrame = function () {
if (Math.floor((this.getBytesLoaded() / this.getBytesTotal()) * 100) >= _root.percent) {
_root.percent++;
gotoAndStop (3);
delete onEnterFrame;
}
};
Frame 3
stop();
if (_root.percent >= 101) {
loader.gotoAndStop(101);
percent_txt.text = 100;
play();
} else if (_root.percent >= 1) {
loader.gotoAndStop(percent + 1);
percent_txt.text = percent;
gotoAndPlay (2);
}
Frame 5
Frame 6
Frame 8
Frame 9
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__("1467fea2", this, 10301, true);
Instance of Symbol 127 MovieClip "mc_sloop_zast" in Frame 9
onClipEvent (load) {
this.gotoAndStop(2);
}
Instance of Symbol 131 MovieClip "mc_sloop" in Frame 9
onClipEvent (load) {
var soundControl = new Sound(this);
}
Instance of Symbol 163 MovieClip "btn_sound" in Frame 15
onClipEvent (load) {
if (this._parent.stopSoundFlag) {
this.gotoAndStop(2);
}
}
Frame 24
stop();
Instance of Symbol 196 MovieClip in Frame 27
on (release) {
this._parent.gameStartWith(1);
}
onClipEvent (load) {
this._alpha = 0;
}
Instance of Symbol 196 MovieClip "btn_vehicle1" in Frame 27
on (release) {
this._parent.gameStartWith(2);
}
onClipEvent (load) {
this._alpha = 0;
}
Frame 28
this.stop();
Instance of Symbol 192 MovieClip "mc_control" in Frame 28
onClipEvent (load) {
this._parent.initLevel();
}
onClipEvent (enterFrame) {
this._parent.processGame();
}
onClipEvent (keyDown) {
this._parent.keyPressed();
}
Instance of Symbol 131 MovieClip "mc_sloop" in Frame 29
onClipEvent (load) {
var soundControl = new Sound(this);
}
Symbol 15 Button
on (release) {
getURL ("http://chillcade.com", "_blank");
}
Symbol 21 MovieClip Frame 86
_root.play();
Symbol 22 MovieClip Frame 1
function timerHandler() {
if (!loadingComplete) {
var _local2 = _root.getBytesLoaded() / _root.getBytesTotal();
bar._xscale = 100 * _local2;
if (_local2 == 1) {
loadingComplete = true;
if (AUTO_PLAY) {
startMovie();
} else {
gotoAndStop ("loaded");
}
return(undefined);
}
}
}
function startMovie() {
_root.play();
}
_root.stop();
stop();
var AUTO_PLAY = false;
var loadingComplete = false;
timerHandler();
Symbol 22 MovieClip Frame 2
stop();
Symbol 493 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 494 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 495 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 496 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 497 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 498 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 499 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 500 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 501 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 502 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 503 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 504 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_bike1(mc_container, sX, sY, engine) {
init(mc_container, sX, sY, engine, moto1Params);
}
function init_bike2(mc_container, sX, sY, engine) {
init(mc_container, sX, sY, engine, moto2Params);
}
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);
}
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_MOTO2 = 2;
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, 22.5, 0, "lib_wheel_forward1", 11, 0.4, 0, 0.03, 4.3, 24.7, 22.5, 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 moto2Params = new CBikeParams(0.6, 3.7, -0.4, "lib_bike_body2", 13, "lib_wheel2", 12, 0.4, 0, 0.03, 3.7, 26.6, 22.5, 0, "lib_wheel_forward2", 11, 0.4, 0, 0.03, 3.7, 26.6, 22.5, 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 bikeParamsArray = [moto1Params, moto2Params];
}
Symbol 505 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 506 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 = 15;
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 507 MovieClip [__Packages.CCamera] Frame 0
class CCamera
{
var targetMovie, levelMovie;
function CCamera () {
}
function init(targetMovie_, levelMovie_) {
targetMovie = targetMovie_;
levelMovie = levelMovie_;
levelMovie._y = 0;
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._y = levelMovie._y + (SCREEN_HEIGHT2 - _local2.y);
levelMovie._x = Math.round(levelMovie._x);
levelMovie._y = Math.round(levelMovie._y);
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 = 480;
static var SCREEN_WIDTH2 = SCREEN_WIDTH / 2;
static var SCREEN_HEIGHT2 = SCREEN_HEIGHT - 250;
}
Symbol 508 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 509 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 35 Button
on (release) {
getURL ("http://www.chillcade.com", "_blank");
}
Symbol 36 MovieClip Frame 1
#initclip 18
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.gotoAndStop(3);
mc_sloop_level.gotoAndStop(3);
}
stopSoundFlag = true;
}
function soundOn() {
if (zastSoundFlag) {
mc_sloop_zast.gotoAndStop(2);
} else {
mc_sloop.gotoAndStop(2);
mc_sloop_level.gotoAndStop(2);
}
stopSoundFlag = false;
}
function gameStart() {
scores = 0;
timeCounter = 0;
CGP.level = 0;
if (isFirstRun == undefined) {
trace("first Run");
loadSettings();
isFirstRun = false;
}
this.gotoAndStop("choice");
enableVehicles();
}
function chooseBikeWhenComplete() {
this.gotoAndStop("choice");
enableVehicles();
}
function chooseBike() {
this.gotoAndStop("choice");
enableVehicles();
}
function enableVehicles() {
trace((((("NUM: " + bikeLevels) + ", B2: ") + enableBike) + ", B3: ") + enableBike3);
mc_cap_unlock1._visible = !enableCoolBike;
btn_vehicle1.useHandCursor = enableCoolBike;
}
function gameStartWith(bikeNum_) {
trace(["bikeNum_: " + bikeNum_, "CCarSynchronizer.BIKE_MOTO2: " + CCarSynchronizer.BIKE_MOTO2, "enableCoolBike: " + enableCoolBike]);
if ((bikeNum_ == CCarSynchronizer.BIKE_MOTO2) && (!enableCoolBike)) {
return(undefined);
}
if (CGP.level == 0) {
zastSoundFlag = false;
updateSoundLoop();
}
bikeNum = bikeNum_;
trace("gameStartWith");
nextLevel();
}
function nextLevel() {
if ((CGP.level == 8) && (!enableCoolBike)) {
this.gotoAndStop("game");
mc_message.gotoAndStop("before_10");
} else {
zastSoundFlag = false;
updateSoundLoop();
if (!stopSoundFlag) {
mc_sloop.gotoAndStop(2);
}
if (CGP.level == CGP.MAX_LEVEL_NUM) {
newGame();
return(undefined);
}
if ((CGP.level != 9) || (enableCoolBike)) {
CGP.level++;
}
levelTimeCounter = 0;
this.gotoAndStop("reset");
this.gotoAndStop("game");
txtLevel.text = CGP.level.toString();
txtScore.text = scores.toString();
}
}
function replay() {
zastSoundFlag = false;
updateSoundLoop();
if (!stopSoundFlag) {
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();
back3 = new CBack();
} else {
engine.clear();
}
engine.stopWheels = false;
carSync.setBikeNum(bikeNum);
switch (bikeNum) {
case CCarSynchronizer.BIKE_MOTO1 :
carSync.init_bike1(mc_level.mc.mc_car, mc_level.mc.mc_start._x, mc_level.mc.mc_start._y, engine);
break;
case CCarSynchronizer.BIKE_MOTO2 :
carSync.init_bike2(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);
back3.init(mc_level.mc.mcForeQueue.mc1, mc_level.mc.mcForeQueue.mc2, 0.4);
back1.process(mc_level.mc._x);
back2.process(mc_level.mc._x);
back3.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.gotoAndStop(2);
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;
if (!stopSoundFlag) {
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);
back3.process(mc_level.mc._x);
mc_level.mc.mc_fon._x = -mc_level.mc._x;
mc_level.mc.mcForeQueue._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) {
if (CGP.level != 9) {
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();
if (!stopSoundFlag) {
mc_sloop.gotoAndStop(2);
}
mc_pause.gotoAndStop(1);
mc_message.gotoAndStop("empty");
gameState = 0;
}
function pauseGame() {
CGP.carSync.stopManAnim();
if (!stopSoundFlag) {
mc_sloop.gotoAndStop(3);
}
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;
toWinTask();
return(undefined);
}
}
function loose() {
CGP.carSync.stopManAnimFull();
mc_pause._visible = false;
zastSoundFlag = true;
updateSoundLoop();
if (!stopSoundFlag) {
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 newBike() {
enableCoolBike = true;
saveSettings();
mc_message.gotoAndStop("win");
mc_message.levelTime = getTimeString(levelTimeCounter);
mc_message.totalTime = getTimeString(timeCounter);
mc_message.scores = scores;
mc_message.txt_level.text = CGP.level;
enableVehicles();
}
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 (CGP.level < CGP.MAX_LEVEL_NUM) {
if ((CGP.level == 9) && (!enableCoolBike)) {
enableCoolBike = true;
saveSettings();
mc_message.gotoAndStop("after_10");
enableVehicles();
} else {
mc_message.gotoAndStop("win");
}
mc_message.txt_level.text = CGP.level;
zastSoundFlag = true;
updateSoundLoop();
gameState = 2;
} else {
enableCoolBike = true;
zastSoundFlag = true;
updateSoundLoop();
mc_message.gotoAndStop("complete");
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.enableCoolBike = enableCoolBike;
_local1.flush();
}
function loadSettings() {
var _local1 = SharedObject.getLocal(gameName);
if (_local1.data.enableCoolBike != undefined) {
enableCoolBike = _local1.data.enableCoolBike;
}
}
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 47 MovieClip [lib_wheel2] Frame 1
#initclip 24
Object.registerClass("lib_wheel2", CWheel);
#endinitclip
Instance of Symbol 46 MovieClip "mc_crush_test" in Symbol 47 MovieClip [lib_wheel2] Frame 1
onClipEvent (load) {
this._visible = false;
}
Symbol 54 MovieClip [lib_wheel_forward2] Frame 1
#initclip 19
Object.registerClass("lib_wheel_forward2", CWheel);
#endinitclip
Instance of Symbol 46 MovieClip "mc_crush_test" in Symbol 54 MovieClip [lib_wheel_forward2] Frame 1
onClipEvent (load) {
this._visible = false;
}
Symbol 72 MovieClip Frame 7
this._parent.endMove();
Symbol 74 MovieClip Frame 7
this._parent.endMove();
Symbol 77 MovieClip Frame 7
this._parent.endMove();
Symbol 79 MovieClip Frame 7
this._parent.endMove();
Symbol 80 MovieClip [moto2_man] Frame 1
#initclip 20
Object.registerClass("moto2_man", CMan);
#endinitclip
this.stop();
Symbol 81 MovieClip Frame 1
this.stop();
Symbol 82 MovieClip [lib_bike_body2] Frame 1
this.stop();
Symbol 88 MovieClip [lib_wheel1] Frame 1
#initclip 21
Object.registerClass("lib_wheel1", CWheel);
#endinitclip
Instance of Symbol 46 MovieClip "mc_crush_test" in Symbol 88 MovieClip [lib_wheel1] Frame 1
onClipEvent (load) {
this._visible = false;
}
Symbol 95 MovieClip [lib_wheel_forward1] Frame 1
#initclip 22
Object.registerClass("lib_wheel_forward1", CWheel);
#endinitclip
Instance of Symbol 46 MovieClip "mc_crush_test" in Symbol 95 MovieClip [lib_wheel_forward1] Frame 1
onClipEvent (load) {
this._visible = false;
}
Symbol 113 MovieClip Frame 7
this._parent.endMove();
Symbol 115 MovieClip Frame 7
this._parent.endMove();
Symbol 116 MovieClip Frame 7
this._parent.endMove();
Symbol 118 MovieClip Frame 7
this._parent.endMove();
Symbol 119 MovieClip [moto1_man] Frame 1
#initclip 23
Object.registerClass("moto1_man", CMan);
#endinitclip
this.stop();
Symbol 120 MovieClip Frame 1
this.stop();
Symbol 121 MovieClip [lib_bike_body1] Frame 1
this.stop();
Symbol 127 MovieClip Frame 1
stop();
Symbol 129 MovieClip Frame 1
stop();
Symbol 131 MovieClip Frame 1
stop();
Symbol 133 MovieClip Frame 1
stop();
Symbol 158 Button
on (press) {
this._parent.soundOff();
this.gotoAndStop(2);
}
Symbol 162 Button
on (release) {
this._parent.soundOn();
this.gotoAndStop(1);
}
Symbol 163 MovieClip Frame 1
this.stop();
Symbol 164 Button
on (release) {
getURL ("http://www.iriysoft.ru", "_blank");
}
Symbol 165 Button
on (release) {
getURL ("http://www.chillcade.com", "_blank");
}
Symbol 170 Button
on (release) {
gameStart();
}
Symbol 175 Button
on (release) {
this.gotoAndStop("rules");
}
Symbol 188 Button
on (release) {
this.gotoAndStop("main");
}
Symbol 423 Button
on (release) {
this._parent.newGame();
}
Symbol 428 Button
on (release) {
this._parent.nextLevel();
}
Symbol 437 Button
on (release) {
this._parent.chooseBike();
}
Symbol 445 Button
on (release) {
this._parent.replay();
}
Symbol 446 Button
on (release) {
CGP.level--;
this._parent.chooseBike();
}
Symbol 461 Button
on (release) {
this._parent.replay();
}
Symbol 466 Button
on (release) {
this._parent.resume();
}
Symbol 474 Button
on (release) {
_root.showScoreBoard(true, true);
}
Symbol 479 Button
on (release) {
CGP.level++;
this._parent.nextLevel();
}
Symbol 481 Button
on (release) {
this._parent.newBike();
}
Instance of Symbol 475 MovieClip in Symbol 482 MovieClip Frame 7
onClipEvent (load) {
MochiScores.showLeaderboard({boardID:"4541b9e0ee056633", score:this._parent._parent.scores, res:"640x450"});
}
Symbol 482 MovieClip Frame 8
Symbol 484 MovieClip Frame 1
stop();
Symbol 488 Button
on (press) {
this._parent.pauseGame();
}
Symbol 491 Button
on (press) {
this._parent.resume();
}
Symbol 492 MovieClip Frame 1
this.stop();