Combined Code
frame 1 {
function __com_mochibot__(swfid, mc, lv, trk) {
var x;
var g;
var s;
var fv;
var sb;
var u;
var res;
var mb;
var mbc;
var pv;
mb = '__mochibot__';
mbc = 'mochibot.com';
g = _global ? _global : _level0._root;
if (g[mb + swfid]) {
return g[mb + swfid];
}
s = System.security;
x = mc._root.getSWFVersion;
fv = x ? mc.getSWFVersion() : (_global ? 6 : 5);
if (!s) {
s = {};
}
sb = s.sandboxType;
if (sb == 'localWithFile') {
return null;
}
x = s.allowDomain;
if (x) {
s.allowDomain(mbc);
}
x = s.allowInsecureDomain;
if (x) {
s.allowInsecureDomain(mbc);
}
pv = (fv == 5) ? /:$version : 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);
}
return res;
}
res = mc.createEmptyMovieClip(mb + swfid, lv);
res.loadMovie(u);
return res;
}
stop();
__com_mochibot__('ee7d9c0f', this, 10301, true);
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(2);
delete onEnterFrame;
}
};
}
movieClip 5 {
}
movieClip 6 {
}
movieClip 11 {
}
movieClip 14 {
frame 1 {
_root.stop();
PercentLoaded = (_root.getBytesLoaded() / _root.getBytesTotal()) * 100;
if (PercentLoaded != 100) {
bar._xscale = PercentLoaded;
} else {
gotoAndStop('loaded');
}
}
frame 2 {
gotoAndPlay(1);
}
}
movieClip 16 {
}
movieClip 17 {
}
movieClip 22 {
}
movieClip 44 {
frame 1 {
stop();
}
frame 92 {
_root.gotoAndStop('main');
trace('play!');
}
}
instance splash of movieClip 44 {
onClipEvent (release) {
getURL('http://www.39games.com', '_blank');
}
}
// unknown tag 88 length 62
movieClip 51 {
}
movieClip 54 {
}
button 56 {
on (release) {
getURL('http://www.chillcade.com', '_blank');
}
}
movieClip 58 {
}
button 60 {
on (release) {
getURL('http://www.chillcade.com', '_blank');
}
}
movieClip 538 __Packages.MochiScores {
#initclip
if (!_global.MochiScores) {
var v1 = function () {};
_global.MochiScores = v1;
var v2 = v1.prototype;
v1.setBoardID = function (boardID) {
MochiScores.boardID = boardID;
MochiServices.send('scores_setBoardID', {'boardID': boardID});
};
v1.showLeaderboard = function (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) {
MochiScores.onClose = options.onClose;
} else {
MochiScores.onClose = function () {
_root.showScoreBoard(false, false);
};
}
if (options.onError != null) {
MochiScores.onError = options.onError;
} else {
MochiScores.onError = MochiScores.onClose;
}
if (options.boardID == null) {
if (MochiScores.boardID != null) {
options.boardID = MochiScores.boardID;
}
}
MochiServices.send('scores_showLeaderboard', {'options': options}, null, MochiScores.doClose);
};
v1.closeLeaderboard = function () {
MochiServices.send('scores_closeLeaderboard');
};
v1.getPlayerInfo = function (callbackObj, callbackMethod) {
MochiServices.send('scores_getPlayerInfo', null, callbackObj, callbackMethod);
};
v1.submit = function (score, name, callbackObj, callbackMethod) {
MochiServices.send('scores_submit', {'score': score, 'name': name}, callbackObj, callbackMethod);
};
v1.requestList = function (callbackObj, callbackMethod) {
MochiServices.send('scores_requestList', null, callbackObj, callbackMethod);
};
v1.scoresArrayToObjects = function (scores) {
var v5 = {};
var v1;
var v4;
var v2;
var v6;
for (var v8 in scores) {
if (typeof scores[v8] == 'object') {
if (scores[v8].cols != null && scores[v8].rows != null) {
v5[v8] = [];
v2 = scores[v8];
v4 = 0;
while (v4 < v2.rows.length) {
v6 = {};
v1 = 0;
while (v1 < v2.cols.length) {
v6[v2.cols[v1]] = v2.rows[v4][v1];
++v1;
}
v5[v8].push(v6);
++v4;
}
} else {
v5[v8] = {};
for (var v7 in scores[v8]) {
v5[v8][v7] = scores[v8][v7];
}
}
} else {
v5[v8] = scores[v8];
}
}
return v5;
};
v1.doClose = function (args) {
if (args.error == true) {
if (args.errorCode == undefined) {
args.errorCode = 'IOError';
}
MochiScores.onError.apply(null, [args.errorCode]);
} else {
MochiScores.onClose.apply();
}
};
ASSetPropFlags(_global.MochiScores.prototype, null, 1);
}
#endinitclip
}
movieClip 539 __Packages.MochiServices {
#initclip
if (!_global.MochiServices) {
var v1 = function () {};
_global.MochiServices = v1;
var v2 = v1.prototype;
v1.__get__id = function () {
return MochiServices._id;
};
v1.__get__clip = function () {
return MochiServices._container;
};
v1.__get__childClip = function () {
return MochiServices._clip;
};
v1.getVersion = function () {
return '1.32';
};
v1.allowDomains = function (server) {
var v1 = ((server.split('/'))[2].split(':'))[0];
if (System.security) {
if (System.security.allowDomain) {
System.security.allowDomain('*');
System.security.allowDomain(v1);
}
if (System.security.allowInsecureDomain) {
System.security.allowInsecureDomain('*');
System.security.allowInsecureDomain(v1);
}
}
return v1;
};
v1.__get__isNetworkAvailable = function () {
if (System.security) {
var v1 = System.security;
if (v1.sandboxType == 'localWithFile') {
return false;
}
}
return true;
};
v1.__set__comChannelName = function (val) {
if (val != undefined) {
if (val.length > 3) {
MochiServices._sendChannelName = val + '_fromgame';
MochiServices._rcvChannelName = val;
MochiServices.initComChannels();
}
}
return MochiServices.__get__comChannelName();
};
v1.__get__connected = function () {
return MochiServices._connected;
};
v1.connect = function (id, clip, onError) {
if (!MochiServices._connected && MochiServices._clip == undefined) {
trace('MochiServices Connecting...');
MochiServices._connecting = true;
MochiServices.init(id, clip);
}
if (onError != undefined) {
MochiServices.onError = onError;
} else {
if (MochiServices.onError == undefined) {
MochiServices.onError = function (errorCode) {
trace(errorCode);
};
}
}
};
v1.disconnect = function () {
if (MochiServices._connected || MochiServices._connecting) {
MochiServices._connected = false;
MochiServices._connecting = MochiServices._connected;
MochiServices.flush(true);
if (MochiServices._clip != undefined) {
MochiServices._clip.removeMovieClip();
delete MochiServices._clip;
}
MochiServices._listenChannel.close();
MochiServices._rcvChannel.close();
}
};
v1.init = function (id, clip) {
MochiServices._id = id;
if (clip != undefined) {
MochiServices._container = clip;
} else {
MochiServices._container = _root;
}
MochiServices.loadCommunicator(id, MochiServices._container);
};
v1.loadCommunicator = function (id, clip) {
var v2 = '_mochiservices_com_' + id;
if (MochiServices._clip != null) {
return MochiServices._clip;
}
if (!MochiServices.__get__isNetworkAvailable()) {
return null;
}
MochiServices.allowDomains(MochiServices._gatewayURL);
MochiServices._clip = clip.createEmptyMovieClip(v2, 10336, false);
MochiServices._loader = new MovieClipLoader();
if (MochiServices._loaderListener.waitInterval != null) {
clearInterval(MochiServices._loaderListener.waitInterval);
}
MochiServices._loaderListener = {};
MochiServices._loaderListener.onLoadError = function (target_mc, errorCode, httpStatus) {
trace('MochiServices could not load.');
MochiServices.disconnect();
MochiServices.onError.apply(null, [errorCode]);
};
MochiServices._loaderListener.onLoadStart = function (target_mc) {
this.isLoading = true;
};
MochiServices._loaderListener.startTime = getTimer();
MochiServices._loaderListener.wait = function () {
if (getTimer() - this.startTime > 10000) {
if (!this.isLoading) {
MochiServices.disconnect();
MochiServices.onError.apply(null, ['IOError']);
}
clearInterval(this.waitInterval);
}
};
MochiServices._loaderListener.waitInterval = setInterval(MochiServices._loaderListener, 'wait', 1000);
MochiServices._loader.addListener(MochiServices._loaderListener);
MochiServices._loader.loadClip(MochiServices._gatewayURL, MochiServices._clip);
MochiServices._sendChannel = new LocalConnection();
MochiServices._sendChannel._queue = [];
MochiServices._rcvChannel = new LocalConnection();
MochiServices._rcvChannel.allowDomain = function (d) {
return true;
};
MochiServices._rcvChannel.allowInsecureDomain = MochiServices._rcvChannel.allowDomain;
MochiServices._rcvChannel._nextcallbackID = 0;
MochiServices._rcvChannel._callbacks = {};
MochiServices.listen();
return MochiServices._clip;
};
v1.onStatus = function (infoObject) {
if (infoObject.level !== 'error') {
} else {
MochiServices._connected = false;
MochiServices._listenChannel.connect(MochiServices._listenChannelName);
}
};
v1.listen = function () {
MochiServices._listenChannel = new LocalConnection();
MochiServices._listenChannel.handshake = function (args) {
MochiServices.__set__comChannelName(args.newChannel);
};
MochiServices._listenChannel.allowDomain = function (d) {
return true;
};
MochiServices._listenChannel.allowInsecureDomain = MochiServices._listenChannel.allowDomain;
MochiServices._listenChannel.connect(MochiServices._listenChannelName);
trace('Waiting for MochiAds services to connect...');
};
v1.initComChannels = function () {
if (!MochiServices._connected) {
MochiServices._sendChannel.onStatus = function (infoObject) {
MochiServices.onStatus(infoObject);
};
MochiServices._sendChannel.send(MochiServices._sendChannelName, 'onReceive', {'methodName': 'handshakeDone'});
MochiServices._sendChannel.send(MochiServices._sendChannelName, 'onReceive', {'methodName': 'registerGame', 'id': MochiServices._id, 'clip': MochiServices._clip, 'version': /:$version});
MochiServices._rcvChannel.onStatus = function (infoObject) {
MochiServices.onStatus(infoObject);
};
MochiServices._rcvChannel.onReceive = function (pkg) {
var v5 = pkg.callbackID;
var v4 = this._callbacks[v5];
if (!v4) {
return undefined;
}
var v2 = v4.callbackMethod;
var v3 = v4.callbackObject;
if (v3 && typeof v2 == 'string') {
v2 = v3[v2];
}
if (v2 != undefined) {
v2.apply(v3, pkg.args);
}
delete this._callbacks[v5];
};
MochiServices._rcvChannel.onError = function () {
MochiServices.onError.apply(null, ['IOError']);
};
MochiServices._rcvChannel.connect(MochiServices._rcvChannelName);
trace('connected!');
MochiServices._connecting = false;
MochiServices._connected = true;
MochiServices._listenChannel.close();
while (MochiServices._sendChannel._queue.length > 0) {
MochiServices._sendChannel.send(MochiServices._sendChannelName, 'onReceive', MochiServices._sendChannel._queue.shift());
}
}
};
v1.flush = function (error) {
var v1;
var v2;
while (MochiServices._sendChannel._queue.length > 0) {
v1 = MochiServices._sendChannel._queue.shift();
false;
if (v1.callbackID != null) {
v2 = MochiServices._rcvChannel._callbacks[v1.callbackID];
}
delete MochiServices._rcvChannel._callbacks[v1.callbackID];
if (error) {
MochiServices.handleError(v1.args, v2.callbackObject, v2.callbackMethod);
}
}
};
v1.handleError = function (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);
}
}
}
};
v1.send = function (methodName, args, callbackObject, callbackMethod) {
if (MochiServices._connected) {
MochiServices._sendChannel.send(MochiServices._sendChannelName, 'onReceive', {'methodName': methodName, 'args': args, 'callbackID': MochiServices._rcvChannel._nextcallbackID});
} else {
if (MochiServices._clip == undefined || !MochiServices._connecting) {
MochiServices.onError.apply(null, ['NotConnected']);
MochiServices.handleError(args, callbackObject, callbackMethod);
MochiServices.flush(true);
return undefined;
} else {
MochiServices._sendChannel._queue.push({'methodName': methodName, 'args': args, 'callbackID': MochiServices._rcvChannel._nextcallbackID});
}
}
MochiServices._rcvChannel._callbacks[MochiServices._rcvChannel._nextcallbackID] = {'callbackObject': callbackObject, 'callbackMethod': callbackMethod};
++MochiServices._rcvChannel._nextcallbackID;
};
v1._gatewayURL = 'http://www.mochiads.com/static/lib/services/services.swf';
v1._listenChannelName = '__mochiservices';
v1._connecting = false;
v1._connected = false;
v1.addProperty('childClip', v1.__get__childClip, function () {});
v1.addProperty('clip', v1.__get__clip, function () {});
v1.addProperty('comChannelName', function () {}, v1.__set__comChannelName);
v1.addProperty('connected', v1.__get__connected, function () {});
v1.addProperty('id', v1.__get__id, function () {});
v1.addProperty('isNetworkAvailable', v1.__get__isNetworkAvailable, function () {});
ASSetPropFlags(_global.MochiServices.prototype, null, 1);
}
#endinitclip
}
movieClip 540 __Packages.CParticleEngine {
#initclip
if (!_global.CParticleEngine) {
var v1 = function () {};
_global.CParticleEngine = v1;
var v2 = v1.prototype;
v2.clear = function () {
while (this.p_array.pop() != undefined) {
}
while (this.w_array.pop() != undefined) {
}
while (this.c_array.pop() != undefined) {
}
};
v2.clearConstraints = function () {
while (this.c_array.pop() != undefined) {
}
};
v2.setHitMovie = function (hit_mc_) {
this.hit_mc = hit_mc_;
};
v2.addParticle = function (p) {
this.p_array.push(p);
};
v2.addWheel = function (wheel, p, maxSpeed, radius) {
wheel.init(p, maxSpeed, radius);
this.w_array.push(wheel);
};
v2.addSpringConstraint = function (p1, p2, koeffStiff1, koeffStiff2) {
var v2 = new CSpringConstraint(p1, p2, koeffStiff1, koeffStiff2);
this.c_array.push(v2);
return v2;
};
v2.addPenetrationConstraint = function (p0, p1, p2) {
var v2 = new CPenetrationConstraint(p0, p1, p2);
this.c_array.push(v2);
return v2;
};
v2.addPenetrationConstraint2 = function (p0, p1, p2) {
var v2 = new CPenetrationConstraint2(p0, p1, p2);
this.c_array.push(v2);
return v2;
};
v2.start = function () {
this.prevTime = getTimer();
};
v2.computeForces = function () {
var v2 = 0;
while (v2 < this.p_array.length) {
this.p_array[v2].acc.x = 0;
this.p_array[v2].acc.y = CParticleEngine.gravity * this.p_array[v2].mass;
++v2;
}
};
v2.clearForces = function () {
var v3;
var v2 = 0;
while (v2 < this.w_array.length) {
v3 = this.w_array[v2];
v3.addedAcc.y = 0;
v3.addedAcc.x = 0;
++v2;
}
};
v2.applyManFrictions = function () {
var v2 = 0;
while (v2 < this.w_array.length) {
this.w_array[v2].applyAddedAcc();
++v2;
}
};
v2.verlet = function (dTime) {
var v5 = 0.995;
var v2;
var v4 = 0;
v2 = 0;
while (v2 < this.p_array.length) {
this.p_array[v2].verlet(dTime, v5);
++v2;
}
if (!this.stopWheels) {
if (Key.isDown(CCarSynchronizer.BUTTON_DOWN)) {
v4 = -0.6;
} else {
if (Key.isDown(CCarSynchronizer.BUTTON_UP)) {
v4 = 1;
}
}
}
v2 = 0;
while (v2 < this.w_array.length) {
this.w_array[v2].process(dTime, this.w_array[v2].maxAccSpeed * v4 / 3.2, 0.99);
++v2;
}
};
v2.checkCollisions = function () {
var v2 = 0;
while (v2 < this.w_array.length) {
this.w_array[v2].checkCollision(this.hit_mc);
++v2;
}
};
v2.checkConstraints = function (dTime) {
var v2;
var v3 = this.c_array.length;
v2 = 0;
while (v2 < v3) {
this.c_array[v2].resolve();
++v2;
}
};
v2.process = function () {
var v4 = getTimer();
var v5 = (v4 - this.prevTime) / 1000;
this.prevTime = v4;
var v2;
var v3 = Math.min(Math.round(v5 / this.t), this.maxSteps);
v2 = 0;
while (v2 < v3) {
this.computeForces();
this.applyManFrictions();
this.verlet(this.t);
this.checkConstraints(this.t);
this.checkCollisions();
this.clearForces();
++v2;
}
};
v1.gravity = 3.15;
v2.p_array = new Array();
v2.w_array = new Array();
v2.c_array = new Array();
v2.t = 0.02;
v2.maxSteps = 2;
v2.stopWheels = false;
ASSetPropFlags(_global.CParticleEngine.prototype, null, 1);
}
#endinitclip
}
movieClip 541 __Packages.CParticle {
#initclip
if (!_global.CParticle) {
var v1 = function (x_, y_, mass_) {
this.pos = new CVector2D(x_, y_);
this.prevPos = this.pos.duplicate();
this.mass = mass_;
this.acc = new CVector2D(0, 0);
this.mc = null;
};
_global.CParticle = v1;
var v2 = v1.prototype;
v2.verlet = function (dTime, koeffDamp) {
var v2 = this.pos.duplicate();
this.pos.x += (this.pos.x - this.prevPos.x) * koeffDamp + this.acc.x * dTime;
this.pos.y += (this.pos.y - this.prevPos.y) * koeffDamp + this.acc.y * dTime;
v2.copyTo(this.prevPos);
if (this.mc != null) {
this.mc._x = this.pos.x;
this.mc._y = this.pos.y;
}
};
v2.getVelocityVector = function () {
return new CVector2D(this.pos.x - this.prevPos.x, this.pos.y - this.prevPos.y);
};
ASSetPropFlags(_global.CParticle.prototype, null, 1);
}
#endinitclip
}
movieClip 542 __Packages.CVector2D {
#initclip
if (!_global.CVector2D) {
var v1 = function (x_, y_) {
this.x = x_;
this.y = y_;
};
_global.CVector2D = v1;
var v2 = v1.prototype;
v2.reinit = function (x_, y_) {
this.x = x_;
this.y = y_;
};
v2.getUgol = function () {
return Math.atan2(this.y, this.x);
};
v2.duplicate = function () {
return new CVector2D(this.x, this.y);
};
v2.copyTo = function (v) {
v.x = this.x;
v.y = this.y;
};
v2.minus = function (v) {
this.x -= v.x;
this.y -= v.y;
};
v2.minusNew = function (v) {
return new CVector2D(this.x - v.x, this.y - v.y);
};
v2.normalize = function () {
var v2 = Math.sqrt(this.x * this.x + this.y * this.y);
this.x /= v2;
this.y /= v2;
};
v2.reverseNew = function () {
return new CVector2D(-this.x, -this.y);
};
v2.scalar = function (v) {
return this.x * v.x + this.y * v.y;
};
v2.modul = function () {
return Math.sqrt(this.x * this.x + this.y * this.y);
};
v2.reflectFromNormal = function (n) {
var v2 = Math.atan2(n.y, n.x);
this.rotate(-v2);
this.x = -this.x;
this.rotate(v2);
};
v2.rotate = function (u) {
var v4 = this.x;
var v3 = this.y;
this.x = v4 * Math.cos(u) - v3 * Math.sin(u);
this.y = v4 * Math.sin(u) + v3 * Math.cos(u);
};
v2.rotateNew = function (u) {
return new CVector2D(this.x * Math.cos(u) - this.y * Math.sin(u), this.x * Math.sin(u) + this.y * Math.cos(u));
};
v2.mult = function (k) {
this.x *= k;
this.y *= k;
};
v2.multNew = function (k) {
return new CVector2D(this.x * k, this.y * k);
};
v2.plus = function (v) {
this.x += v.x;
this.y += v.y;
};
v2.plusNew = function (v) {
return new CVector2D(this.x + v.x, this.y + v.y);
};
v2.getDistanceTo = function (p1, p2) {
var v3 = p1.y - p2.y;
var v2 = p2.x - p1.x;
var v6 = p1.x * (p2.y - p1.y) - p1.y * (p2.x - p1.x);
var v5 = Math.sqrt(v3 * v3 + v2 * v2);
v3 /= v5;
v2 /= v5;
v6 /= v5;
return v3 * this.x + v2 * this.y + v6;
};
v2.toString = function () {
return '( ' + this.x + ', ' + this.y + ' )';
};
ASSetPropFlags(_global.CVector2D.prototype, null, 1);
}
#endinitclip
}
movieClip 543 __Packages.CWheel {
#initclip
if (!_global.CWheel) {
var v1 = function () {
super();
};
_global.CWheel = v1;
_global.CWheel extends MovieClip;
var v2 = v1.prototype;
v2.init = function (particle_, maxAccSpeed_, rad_) {
this.particle = particle_;
this.rad = rad_;
this.maxAccSpeed = maxAccSpeed_ * 4;
this.speed = 0;
this.accSpeed = 0;
this.rot = new CVector2D(1, 0);
this.addedAcc = new CVector2D(0, 0);
this.intersectionFlag = false;
this.lastIntersPoint = new CVector2D(0, 0);
this.lastN = new CVector2D(0, 0);
var v2;
var v3 = 6.283185307179586 / this.hitCount;
this.hitPointArray = new Array(this.hitCount);
this.normalArray = new Array(this.hitCount);
this.hitArray = new Array(this.hitCount);
this.intersArray = new Array();
v2 = 0;
while (v2 < this.hitCount) {
this.hitPointArray[v2] = new CVector2D(Math.sin(v3 * v2) * this.rad, -Math.cos(v3 * v2) * this.rad);
this.normalArray[v2] = this.hitPointArray[v2].multNew(-1);
this.normalArray[v2].normalize();
++v2;
}
this.lastYSpeed = 0;
};
v2.setKoeffSpring = function (koeffSpring_) {
this.koeffSpring = koeffSpring_;
};
v2.setKoeffSlip = function (koeffSlip_) {
this.koeffSlip = koeffSlip_;
};
v2.setKoeffConcatenation = function (koeffConcatenation_) {
this.koeffConcatenation = koeffConcatenation_;
};
v2.hasIntersection = function () {
return this.intersectionFlag;
};
v2.process = function (dTime, acc, koeffDamp) {
this.accSpeed = Math.max(-this.maxAccSpeed, Math.min(this.maxAccSpeed, this.accSpeed + acc * dTime));
this.speed = Math.max(-this.maxSpeed * dTime, Math.min(this.speed * koeffDamp + this.accSpeed, this.maxSpeed * dTime));
this.rot.rotate(this.speed / this.rad);
this.mc.mc_rim._rotation = Math.atan2(this.rot.y, this.rot.x) * 180 / Math.PI;
this.lastYSpeed = this.particle.pos.y - this.particle.prevPos.y;
};
v2.checkCollision = function (hit_mc) {
var v2;
var v8;
var v9 = new CVector2D(0, 0);
var v13 = false;
var v5;
var v7;
var v15;
var v16 = new CVector2D(this.particle.prevPos.x, this.particle.prevPos.y);
var v4 = new CVector2D(0, 0);
var v3 = new CVector2D(0, 0);
var v14;
this._x = this.particle.pos.x;
this._y = this.particle.pos.y;
v14 = 0;
v2 = 0;
while (v2 < this.hitCount) {
this.hitPointArray[v2].copyTo(v9);
this.localToGlobal(v9);
this.hitArray[v2] = hit_mc.hitTest(v9.x, v9.y, true);
if (this.hitArray[v2]) {
v13 = true;
v5 = v2;
++v14;
}
++v2;
}
if (v14 == this.hitCount) {
this.particle.pos.x = this.particle.prevPos.x + (this.particle.pos.x - this.particle.prevPos.x) * 0.3;
this.particle.pos.y = this.particle.prevPos.y + (this.particle.pos.y - this.particle.prevPos.y) * 0.3;
this._x = this.particle.pos.x;
this._y = this.particle.pos.y;
return undefined;
}
v2 = 0;
if (v13) {
while (!false) {
++v2;
if (v2 == this.hitCount) {
v2 = 0;
}
if (!this.hitArray[v2]) {
v5 = -1;
v8 = 0;
while (v8 < this.hitCount) {
++v2;
if (v2 == this.hitCount) {
v2 = 0;
}
if (v5 == -1) {
if (this.hitArray[v2]) {
v5 = v2;
v4.plus(this.normalArray[v2]);
this.normalArray[v2].copyTo(v3);
}
} else {
if (!this.hitArray[v2]) {
v7 = v2 - 1;
if (v7 < 0) {
v7 = this.hitCount - 1;
}
this.intersArray.push({'k1': v5, 'k2': v7, 'n': new CVector2D(v3.x, v3.y)});
v5 = -1;
} else {
v4.plus(this.normalArray[v2]);
v3.plus(this.normalArray[v2]);
}
}
++v8;
}
break;
}
}
var v6 = new CVector2D(0, 0);
if (this.intersArray.length > 0) {
v4.normalize();
if (this.intersectionFlag) {
v4.x += this.lastN.x;
v4.y += this.lastN.y;
v4.x /= 2;
v4.y /= 2;
}
var v10;
var v11;
v15 = this.intersArray.length;
v2 = 0;
while (v2 < v15) {
v10 = this.intersArray.pop();
v5 = v10.k1;
v7 = v10.k2;
v10.n.copyTo(v3);
(this.particle.pos.minusNew(this.particle.prevPos)).copyTo(v6);
if (v4.scalar(v6) < 0) {
v11 = Math.atan2(v4.y, v4.x);
v6.rotate(-v11);
v6.x = -v6.x * this.koeffSpring;
v6.rotate(v11);
this.pushOut(v5, v7, v3, hit_mc);
this.particle.prevPos.x = this.particle.pos.x - v6.x;
this.particle.prevPos.y = this.particle.pos.y - v6.y;
} else {
this.pushOut(v5, v7, v3, hit_mc);
}
++v2;
}
this.validateRotation(v4, v16);
this.intersectionFlag = true;
this.particle.pos.copyTo(this.lastIntersPoint);
v4.copyTo(this.lastN);
}
} else {
if (this.intersectionFlag) {
this.validateRotation(this.lastN, v16);
this.intersectionFlag = false;
}
}
this._x = this.particle.pos.x;
this._y = this.particle.pos.y;
};
v2.pushOut = function (k1, k2, n, hit_mc) {
n.normalize();
if (k1 != k2) {
var v7 = (new CVector2D(0, 0)).getDistanceTo(this.hitPointArray[k1], this.hitPointArray[k2]);
v7 = this.rad - Math.abs(v7);
this.particle.pos.plus(n.multNew(v7));
this.particle.prevPos.plus(n.multNew(v7));
} else {
var v6 = n.multNew(-this.rad);
var v4 = new CVector2D(0, 0);
var v5 = 0;
var v3 = 0.03;
while (!false) {
v6.copyTo(v4);
this.localToGlobal(v4);
if (hit_mc.hitTest(v4.x, v4.y, true)) {
++v5;
this.particle.pos.x += n.x * v3;
this._x = this.particle.pos.x;
this.particle.pos.y += n.y * v3;
this._y = this.particle.pos.y;
} else {
--v5;
this.particle.pos.x -= n.x * v3;
this.particle.pos.y -= n.y * v3;
this.particle.prevPos.plus(n.multNew(v3 * v5));
break;
}
}
}
this.particle.pos.minus(n.multNew(this.koeffConcatenation));
this.particle.prevPos.minus(n.multNew(this.koeffConcatenation));
};
v2.validateRotation = function (n, oldPos) {
if (!this.intersectionFlag && Math.abs(this.accSpeed) > 0.01) {
if (Math.abs(this.accSpeed) < this.maxAccSpeed * 0.02 / 2) {
this.accSpeed = 0;
} else {
if (this.accSpeed > 0) {
this.accSpeed = this.maxAccSpeed * 0.02;
} else {
this.accSpeed = -this.maxAccSpeed * 0.02;
}
}
}
var v3 = new CVector2D(-n.y, n.x);
var v6 = this.particle.pos.minusNew(oldPos);
var v5 = Math.atan2(v3.y, v3.x);
var v2 = v6.rotateNew(-v5);
this.speed = v2.x + this.accSpeed;
v2.y = 0;
v2.rotate(v5);
var v4 = 1 - this.koeffSlip;
this.particle.pos.x = this.particle.pos.x + v3.x * this.accSpeed * v4 - (1 - this.koeffFriction) * v2.x;
this.particle.pos.y = this.particle.pos.y + v3.y * this.accSpeed * v4 - (1 - this.koeffFriction) * v2.y;
this.accSpeed *= this.koeffSlip;
};
v2.applyAddedAcc = function () {
this.particle.acc.x += this.addedAcc.x * this.particle.mass;
this.particle.acc.y += this.addedAcc.y * this.particle.mass;
};
v2.turnTo = function (turnDir, force) {
this.particle.prevPos.x = this.particle.pos.x - turnDir.x * force;
this.particle.prevPos.x = this.particle.pos.x - turnDir.x * force;
this.koeffSpring = 0.9;
};
v2.maxSpeed = 180;
v2.koeffSpring = 0.03;
v2.koeffSlip = 0.15;
v2.koeffFriction = 0.97;
v2.koeffConcatenation = 0;
v2.hitCount = 16;
ASSetPropFlags(_global.CWheel.prototype, null, 1);
}
#endinitclip
}
movieClip 544 __Packages.CSpringConstraint {
#initclip
if (!_global.CSpringConstraint) {
var v1 = function (p1_, p2_, koeffStiffPress_, koeffStiffStretch_) {
this.p1 = p1_;
this.p2 = p2_;
this.koeffStiffPress = koeffStiffPress_;
this.koeffStiffStretch = koeffStiffStretch_;
var v2 = new CVector2D(this.p1.pos.x - this.p2.pos.x, this.p1.pos.y - this.p2.pos.y);
this.relaxLen = v2.modul();
this.basicParticleNum = CSpringConstraint.BASIC_PARTICLE_NONE;
this.basicParticleWeight = 1;
};
_global.CSpringConstraint = v1;
var v2 = v1.prototype;
v2.setBasicParticleNum = function (basicParticleNum_) {
this.basicParticleNum = basicParticleNum_;
};
v2.setBasicParticleWeight = function (basicParticleWeight_) {
this.basicParticleWeight = basicParticleWeight_;
};
v2.resolve = function () {
var v3 = new CVector2D(this.p1.pos.x - this.p2.pos.x, this.p1.pos.y - this.p2.pos.y);
var v6 = v3.modul();
var v5 = (v6 - this.relaxLen) / v6;
var v4;
if (v6 > this.relaxLen) {
v4 = this.koeffStiffStretch;
} else {
v4 = this.koeffStiffPress;
}
var v2;
if (this.basicParticleNum == CSpringConstraint.BASIC_PARTICLE_NONE) {
v2 = v5 * v4 / (this.p1.mass + this.p2.mass);
this.p1.pos.x -= v3.x * this.p1.mass * v2;
this.p1.pos.y -= v3.y * this.p1.mass * v2;
this.p2.pos.x += v3.x * this.p2.mass * v2;
this.p2.pos.y += v3.y * this.p2.mass * v2;
} else {
if (this.basicParticleNum == 1) {
v2 = v5 * v4 / (this.p1.mass + this.p2.mass);
v2 = v5 * v4;
this.p1.pos.x -= v3.x * v2 * (1 - this.basicParticleWeight);
this.p1.pos.y -= v3.y * v2 * (1 - this.basicParticleWeight);
this.p2.pos.x += v3.x * v2 * this.basicParticleWeight;
this.p2.pos.y += v3.y * v2 * this.basicParticleWeight;
} else {
v2 = v5 * v4 / (this.p1.mass + this.p2.mass);
v2 = v5 * v4;
this.p1.pos.x += v3.x * v2 * this.basicParticleWeight;
this.p1.pos.y += v3.y * v2 * this.basicParticleWeight;
this.p2.pos.x += v3.x * v2 * (1 - this.basicParticleWeight);
this.p2.pos.y += v3.y * v2 * (1 - this.basicParticleWeight);
}
}
};
v1.BASIC_PARTICLE_NONE = 0;
ASSetPropFlags(_global.CSpringConstraint.prototype, null, 1);
}
#endinitclip
}
movieClip 545 __Packages.CPenetrationConstraint {
#initclip
if (!_global.CPenetrationConstraint) {
var v1 = function (p0_, p1_, p2_) {
this.p0 = p0_;
this.p1 = p1_;
this.p2 = p2_;
this.sign = this.p0.pos.getDistanceTo(this.p1.pos, this.p2.pos);
if (this.sign < 0) {
this.sign = -1;
} else {
this.sign = 1;
}
};
_global.CPenetrationConstraint = v1;
var v2 = v1.prototype;
v2.resolve = function () {
var v3;
var v2;
v3 = this.p0.pos.getDistanceTo(this.p1.pos, this.p2.pos);
if (this.sign * v3 <= 2) {
v2 = new CVector2D(this.p2.pos.x, this.p2.pos.y);
v2.minus(this.p1.pos);
v2.normalize();
v2.rotate(1.570796326794897 * this.sign);
v2.mult(Math.abs(v3) + 1);
this.p1.pos.minus(v2);
}
};
ASSetPropFlags(_global.CPenetrationConstraint.prototype, null, 1);
}
#endinitclip
}
movieClip 546 __Packages.CPenetrationConstraint2 {
#initclip
if (!_global.CPenetrationConstraint2) {
var v1 = function (p0_, p1_, p2_) {
this.p0 = p0_;
this.p1 = p1_;
this.p2 = p2_;
this.sign = this.p0.pos.getDistanceTo(this.p1.pos, this.p2.pos);
if (this.sign < 0) {
this.sign = -1;
} else {
this.sign = 1;
}
};
_global.CPenetrationConstraint2 = v1;
var v2 = v1.prototype;
v2.resolve = function () {
var v3;
var v2;
v3 = this.p0.pos.getDistanceTo(this.p1.pos, this.p2.pos);
if (this.sign * v3 <= 2) {
v2 = new CVector2D(this.p2.pos.x, this.p2.pos.y);
v2.minus(this.p1.pos);
v2.normalize();
v2.rotate(1.570796326794897 * this.sign);
v2.mult(Math.abs(v3) + 1);
this.p0.pos.plus(v2);
}
};
ASSetPropFlags(_global.CPenetrationConstraint2.prototype, null, 1);
}
#endinitclip
}
movieClip 547 __Packages.CBikeParams {
#initclip
if (!_global.CBikeParams) {
var v1 = function (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_) {
this.controlAccPercBase = controlAccPercBase_;
this.controlAccPercMult = controlAccPercMult_;
this.koeffStability = koeffStability_;
this.bodyLibName = bodyLibName_;
this.bodyDepth = bodyDepth_;
this.backWheelLibName = backWheelLibName_;
this.backWheelDepth = backWheelDepth_;
this.backWheelKoeffSlip = backWheelKoeffSlip_;
this.backWheelKoeffConcatenation = backWheelKoeffConcatenation_;
this.backWheelKoeffSpring = backWheelKoeffSpring_;
this.backWheelPMass = backWheelPMass_;
this.backWheelPMaxSpeed = backWheelPMaxSpeed_;
this.backWheelPRadius = backWheelPRadius_;
this.backWheelPAcc = backWheelPAcc_;
this.forwardWheelLibName = forwardWheelLibName_;
this.forwardWheelDepth = forwardWheelDepth_;
this.forwardWheelKoeffSlip = forwardWheelKoeffSlip_;
this.forwardWheelKoeffConcatenation = forwardWheelKoeffConcatenation_;
this.forwardWheelKoeffSpring = forwardWheelKoeffSpring_;
this.forwardWheelPMass = forwardWheelPMass_;
this.forwardWheelPMaxSpeed = forwardWheelPMaxSpeed_;
this.forwardWheelPRadius = forwardWheelPRadius_;
this.forwardWheelPAcc = forwardWheelPAcc_;
this.pLD_mass = pLD_mass_;
this.pRD_mass = pRD_mass_;
this.pC_mass = pC_mass_;
this.triangleSprings = triangleSprings_;
this.downSpringParams = downSpringParams_;
this.upSpringParams = upSpringParams_;
this.diagonalSpringParams = diagonalSpringParams_;
this.rightSpringParams = rightSpringParams_;
this.leftSpringParams = leftSpringParams_;
};
_global.CBikeParams = v1;
var v2 = v1.prototype;
ASSetPropFlags(_global.CBikeParams.prototype, null, 1);
}
#endinitclip
}
movieClip 548 __Packages.CSpringParams {
#initclip
if (!_global.CSpringParams) {
var v1 = function (koeffStretch_, koeffPress_, basicParticleNum_, basicParticleWeight_) {
this.koeffStretch = koeffStretch_;
this.koeffPress = koeffPress_;
this.basicParticleNum = basicParticleNum_;
this.basicParticleWeight = basicParticleWeight_;
};
_global.CSpringParams = v1;
var v2 = v1.prototype;
ASSetPropFlags(_global.CSpringParams.prototype, null, 1);
}
#endinitclip
}
movieClip 549 __Packages.CCarSynchronizer {
#initclip
if (!_global.CCarSynchronizer) {
var v1 = function () {
this.koeffSpring = 0.5;
};
_global.CCarSynchronizer = v1;
var v2 = v1.prototype;
v2.setHealthIndicator = function (healthIndicator_) {
this.healthIndicator = healthIndicator_;
this.healthIndicator.setMaxValue(CCarSynchronizer.MAX_HEALTH);
};
v2.setBikeNum = function (bikeNum_) {
this.bikeNum = bikeNum_;
};
v2.init = function (mc_container, sX, sY, engine, bikeParams) {
var v3 = {'x': 0, 'y': 0};
var v2;
var v5;
this.mc_back_wheel = CWheel(mc_container.attachMovie(bikeParams.backWheelLibName, 'back_w', bikeParams.backWheelDepth));
this.mc_forward_wheel = CWheel(mc_container.attachMovie(bikeParams.forwardWheelLibName, 'forward_w', bikeParams.forwardWheelDepth));
this.mc_car = mc_container.attachMovie(bikeParams.bodyLibName, 'body', bikeParams.bodyDepth);
if (bikeParams.triangleSprings) {
this.mc_back_dark = mc_container.attachMovie('lib_dark_wheel', 'wdb1', 0);
this.mc_forward_dark = mc_container.attachMovie('lib_dark_wheel', 'wdb2', 1);
}
this.mc_car._x = sX;
this.mc_car._y = sY;
v3.x = this.mc_car.mc.mc_p_wl._x;
v3.y = this.mc_car.mc.mc_p_wl._y;
this.mc_car.mc.localToGlobal(v3);
this.mc_car._parent.globalToLocal(v3);
this.mc_back_wheel._x = v3.x;
this.mc_back_wheel._y = v3.y;
this.mc_back_wheel.setKoeffSlip(bikeParams.backWheelKoeffSlip);
this.mc_back_wheel.setKoeffConcatenation(bikeParams.backWheelKoeffConcatenation);
this.mc_back_wheel.setKoeffSpring(bikeParams.backWheelKoeffSpring);
this.p_wl = new CParticle(v3.x, v3.y, bikeParams.backWheelPMass);
engine.addParticle(this.p_wl);
engine.addWheel(this.mc_back_wheel, this.p_wl, bikeParams.backWheelPMaxSpeed, bikeParams.backWheelPRadius);
v3.x = this.mc_car.mc.mc_p_wr._x;
v3.y = this.mc_car.mc.mc_p_wr._y;
this.mc_car.mc.localToGlobal(v3);
this.mc_car._parent.globalToLocal(v3);
this.mc_forward_wheel._x = v3.x;
this.mc_forward_wheel._y = v3.y;
this.mc_forward_wheel.setKoeffSlip(bikeParams.forwardWheelKoeffSlip);
this.mc_forward_wheel.setKoeffConcatenation(bikeParams.forwardWheelKoeffConcatenation);
this.mc_forward_wheel.setKoeffSpring(bikeParams.forwardWheelKoeffSpring);
this.p_wr = new CParticle(v3.x, v3.y, bikeParams.forwardWheelPMass);
engine.addParticle(this.p_wr);
engine.addWheel(this.mc_forward_wheel, this.p_wr, bikeParams.forwardWheelPMaxSpeed, bikeParams.forwardWheelPRadius);
if (!bikeParams.triangleSprings) {
v3.x = this.mc_car.mc.mc_p_ld._x;
v3.y = this.mc_car.mc.mc_p_ld._y;
this.mc_car.mc.localToGlobal(v3);
this.mc_car._parent.globalToLocal(v3);
this.p_ld = new CParticle(v3.x, v3.y, bikeParams.pLD_mass);
engine.addParticle(this.p_ld);
v3.x = this.mc_car.mc.mc_p_rd._x;
v3.y = this.mc_car.mc.mc_p_rd._y;
this.mc_car.mc.localToGlobal(v3);
this.mc_car._parent.globalToLocal(v3);
this.p_rd = new CParticle(v3.x, v3.y, bikeParams.pRD_mass);
engine.addParticle(this.p_rd);
v2 = bikeParams.downSpringParams;
v5 = engine.addSpringConstraint(this.p_wr, this.p_wl, v2.koeffPress, v2.koeffStretch);
v5.setBasicParticleNum(v2.basicParticleNum);
v5.setBasicParticleWeight(v2.basicParticleWeight);
v2 = bikeParams.upSpringParams;
v5 = engine.addSpringConstraint(this.p_ld, this.p_rd, v2.koeffPress, v2.koeffStretch);
v5.setBasicParticleNum(v2.basicParticleNum);
v5.setBasicParticleWeight(v2.basicParticleWeight);
v2 = bikeParams.diagonalSpringParams;
v5 = engine.addSpringConstraint(this.p_wr, this.p_ld, v2.koeffPress, v2.koeffStretch);
v5.setBasicParticleNum(v2.basicParticleNum);
v5.setBasicParticleWeight(v2.basicParticleWeight);
v5 = engine.addSpringConstraint(this.p_wl, this.p_rd, v2.koeffPress, v2.koeffStretch);
v5.setBasicParticleNum(v2.basicParticleNum);
v5.setBasicParticleWeight(v2.basicParticleWeight);
v2 = bikeParams.rightSpringParams;
v5 = engine.addSpringConstraint(this.p_wr, this.p_rd, v2.koeffPress, v2.koeffStretch);
v5.setBasicParticleNum(v2.basicParticleNum);
v5.setBasicParticleWeight(v2.basicParticleWeight);
v2 = bikeParams.leftSpringParams;
v5 = engine.addSpringConstraint(this.p_wl, this.p_ld, v2.koeffPress, v2.koeffStretch);
v5.setBasicParticleNum(v2.basicParticleNum);
v5.setBasicParticleWeight(v2.basicParticleWeight);
engine.addPenetrationConstraint(this.p_wr, this.p_rd, this.p_ld);
engine.addPenetrationConstraint(this.p_wl, this.p_ld, this.p_rd);
} else {
v3.x = this.mc_car.mc.mc_p_c._x;
v3.y = this.mc_car.mc.mc_p_c._y;
this.mc_car.mc.localToGlobal(v3);
this.mc_car._parent.globalToLocal(v3);
this.p_c = new CParticle(v3.x, v3.y, bikeParams.pC_mass);
engine.addParticle(this.p_c);
v2 = bikeParams.downSpringParams;
v5 = engine.addSpringConstraint(this.p_wr, this.p_wl, v2.koeffPress, v2.koeffStretch);
v5.setBasicParticleNum(v2.basicParticleNum);
v5.setBasicParticleWeight(v2.basicParticleWeight);
v2 = bikeParams.rightSpringParams;
v5 = engine.addSpringConstraint(this.p_wr, this.p_c, v2.koeffPress, v2.koeffStretch);
v5.setBasicParticleNum(v2.basicParticleNum);
v5.setBasicParticleWeight(v2.basicParticleWeight);
v2 = bikeParams.leftSpringParams;
v5 = engine.addSpringConstraint(this.p_wl, this.p_c, v2.koeffPress, v2.koeffStretch);
v5.setBasicParticleNum(v2.basicParticleNum);
v5.setBasicParticleWeight(v2.basicParticleWeight);
engine.addPenetrationConstraint2(this.p_c, this.p_wr, this.p_wl);
this.mc_back_dark._x = this.mc_back_wheel._x + CCarSynchronizer.DARK_DX;
this.mc_back_dark._y = this.mc_back_wheel._y + CCarSynchronizer.DARK_DY;
this.mc_back_dark._rotation = this.mc_back_wheel.mc.mc_rim._rotation;
this.mc_forward_dark._x = this.mc_forward_wheel._x + CCarSynchronizer.DARK_DX;
this.mc_forward_dark._y = this.mc_forward_wheel._y + CCarSynchronizer.DARK_DY;
this.mc_forward_dark._rotation = this.mc_forward_wheel.mc.mc_rim._rotation;
}
this.state = CCarSynchronizer.ST_GO;
};
v2.init_bike1 = function (mc_container, sX, sY, engine) {
this.init(mc_container, sX, sY, engine, CCarSynchronizer.moto1Params);
};
v2.init_bike2 = function (mc_container, sX, sY, engine) {
this.init(mc_container, sX, sY, engine, CCarSynchronizer.moto2Params);
};
v2.process = function () {
if (this.state == CCarSynchronizer.ST_GO) {
if (CCarSynchronizer.bikeParamsArray[this.bikeNum - 1].triangleSprings) {
var v5;
var v4;
var v3;
v5 = new CVector2D(this.p_wr.pos.x - this.p_c.pos.x, this.p_wr.pos.y - this.p_c.pos.y);
v5.normalize();
v4 = new CVector2D(this.p_wl.pos.x - this.p_c.pos.x, this.p_wl.pos.y - this.p_c.pos.y);
v4.normalize();
this.mc_car._rotation = Math.atan2(v5.y + v4.y, v5.x + v4.x) * 180 / Math.PI - 90;
v3 = new CVector2D(this.mc_car.mc.mc_p_c._x, this.mc_car.mc.mc_p_c._y);
this.mc_car.mc.localToGlobal(v3);
this.mc_car._parent.globalToLocal(v3);
this.mc_car._x += this.p_c.pos.x - v3.x;
this.mc_car._y += this.p_c.pos.y - v3.y;
} else {
var v6;
var v2;
v6 = new CVector2D(this.p_rd.pos.x - this.p_ld.pos.x, this.p_rd.pos.y - this.p_ld.pos.y);
this.mc_car._rotation = Math.atan2(v6.y, v6.x) * 180 / Math.PI;
var v3 = new CVector2D(this.mc_car.mc.mc_p_ld._x, this.mc_car.mc.mc_p_ld._y);
v2 = new CVector2D(this.mc_car.mc.mc_p_rd._x, this.mc_car.mc.mc_p_rd._y);
this.mc_car.mc.localToGlobal(v3);
this.mc_car._parent.globalToLocal(v3);
this.mc_car.mc.localToGlobal(v2);
this.mc_car._parent.globalToLocal(v2);
this.mc_car._x += (this.p_ld.pos.x - v3.x + this.p_rd.pos.x - v2.x) / 2;
this.mc_car._y += (this.p_ld.pos.y - v3.y + this.p_rd.pos.y - v2.y) / 2;
v3.x = this.mc_back_wheel._x;
v3.y = this.mc_back_wheel._y;
this.mc_back_wheel._parent.localToGlobal(v3);
this.mc_car.mc.globalToLocal(v3);
v2.x = this.mc_forward_wheel._x;
v2.y = this.mc_forward_wheel._y;
this.mc_forward_wheel._parent.localToGlobal(v2);
this.mc_car.mc.globalToLocal(v2);
this.mc_car.mc.mc_s_lu._rotation = Math.atan2(v3.y + 1.2 - this.mc_car.mc.mc_s_lu._y, v3.x - this.mc_car.mc.mc_s_lu._x) * 180 / Math.PI;
this.mc_car.mc.mc_s_ld._rotation = this.mc_car.mc.mc_s_lu._rotation;
this.mc_car.mc.mc_s_ru._rotation = Math.atan2(v2.y + 1.2 - this.mc_car.mc.mc_s_ru._y, v2.x - this.mc_car.mc.mc_s_ru._x) * 180 / Math.PI;
this.mc_car.mc.mc_s_rd._rotation = this.mc_car.mc.mc_s_ru._rotation;
}
this.updateBikeSprings();
} else {
if (this.state == CCarSynchronizer.ST_CRUSH) {
}
}
};
v2.updateBikeSprings = function () {
var v3;
var v2;
var v4;
v2 = new CVector2D(this.mc_car.mc.mc_back_spring._x, this.mc_car.mc.mc_back_spring._y);
this.mc_car.mc.localToGlobal(v2);
this.mc_car._parent.globalToLocal(v2);
v3 = new CVector2D(this.mc_car.mc.mc_back_spring.mc_dir._x, this.mc_car.mc.mc_back_spring.mc_dir._y);
this.mc_car.mc.mc_back_spring.localToGlobal(v3);
this.mc_car._parent.globalToLocal(v3);
v4 = new CVector2D(this.mc_back_wheel._x - v2.x, this.mc_back_wheel._y - v2.y);
v3.minus(v2);
this.mc_car.mc.mc_back_spring._rotation += (Math.atan2(v4.y, v4.x) - Math.atan2(v3.y, v3.x)) * 180 / Math.PI;
};
v2.toCrush = function (engine) {
var v2 = new CVector2D(0, 0);
this.mc_car.gotoAndPlay('crush');
this.mc_car.mc.gotoAndStop(2);
engine.clearConstraints();
engine.stopWheels = true;
v2.reinit(this.mc_forward_wheel._x - this.mc_car._x, this.mc_forward_wheel._y - this.mc_car._y);
v2.normalize();
this.mc_forward_wheel.turnTo(v2, 10);
v2.reinit(this.mc_back_wheel._x - this.mc_car._x, this.mc_back_wheel._y - this.mc_car._y);
v2.normalize();
this.mc_back_wheel.turnTo(v2, 10);
this.state = CCarSynchronizer.ST_CRUSH;
};
v2.isCrushed = function () {
return this.state == CCarSynchronizer.ST_CRUSH;
};
v2.isFullCrushed = function () {
return false;
};
v2.checkHitWithGround = function (levelHit) {
var v2 = {'x': 0, 'y': 0};
var v3;
v3 = this.mc_car.mc.mc_man.mc.h;
v2.x = v3.mc_hit._x;
v2.y = v3.mc_hit._y;
v3.localToGlobal(v2);
if (levelHit.hitTest(v2.x, v2.y, true)) {
return true;
}
v3 = this.mc_car.mc.mc_man.mc.b;
v2.x = v3.mc_hit._x;
v2.y = v3.mc_hit._y;
v3.localToGlobal(v2);
if (levelHit.hitTest(v2.x, v2.y, true)) {
return true;
}
v3 = this.mc_car.mc.mc_man.mc.l;
v2.x = v3.mc_hit._x;
v2.y = v3.mc_hit._y;
v3.localToGlobal(v2);
if (levelHit.hitTest(v2.x, v2.y, true)) {
return true;
}
return false;
};
v2.stopManAnim = function () {
this.mc_car.mc.mc_man.stopAnim();
};
v2.startManAnim = function () {
this.mc_car.mc.mc_man.startAnim();
};
v2.stopManAnimFull = function () {
this.mc_car.mc.mc_man.stopAnim();
this.mc_car.mc.mc_man.stopMCAnim();
};
v2.toLeft = function () {
var v3;
var v2 = this.calcCarNVector();
var v5;
var v6;
var v4;
v4 = CCarSynchronizer.bikeParamsArray[this.bikeNum - 1];
v5 = v4.controlAccPercBase;
v6 = v4.controlAccPercMult;
v3 = Math.abs(v2.y) * (1 - v5) + v5;
v3 *= v6;
if (v2.y > v4.koeffStability) {
this.mc_forward_wheel.addedAcc.x -= v2.x * CParticleEngine.gravity * v3 * 0.7;
this.mc_forward_wheel.addedAcc.y -= v2.y * CParticleEngine.gravity * v3 * 0.7;
if (!this.mc_back_wheel.hasIntersection()) {
this.mc_back_wheel.addedAcc.x += v2.x * CParticleEngine.gravity * v3 * 1.3;
this.mc_back_wheel.addedAcc.y += v2.y * CParticleEngine.gravity * v3 * 1.3;
}
}
};
v2.toRight = function () {
var v3;
var v2 = this.calcCarNVector();
var v5;
var v6;
var v4;
v4 = CCarSynchronizer.bikeParamsArray[this.bikeNum - 1];
v5 = v4.controlAccPercBase;
v6 = v4.controlAccPercMult;
v3 = Math.abs(v2.y) * (1 - v5) + v5;
v3 *= v6;
if (v2.y > v4.koeffStability) {
if (!this.mc_forward_wheel.hasIntersection()) {
this.mc_forward_wheel.addedAcc.x += v2.x * CParticleEngine.gravity * v3 * 1.3;
this.mc_forward_wheel.addedAcc.y += v2.y * CParticleEngine.gravity * v3 * 1.3;
}
this.mc_back_wheel.addedAcc.x -= v2.x * CParticleEngine.gravity * v3 * 0.7;
this.mc_back_wheel.addedAcc.y -= v2.y * CParticleEngine.gravity * v3 * 0.7;
}
};
v2.calcCarNVector = function () {
var v2;
v2 = this.mc_forward_wheel.particle.pos.minusNew(this.mc_back_wheel.particle.pos);
v2.normalize();
var v3;
v3 = v2.x;
v2.x = -v2.y;
v2.y = v3;
return v2;
};
v1.BUTTON_LEFT = 37;
v1.BUTTON_RIGHT = 39;
v1.BUTTON_UP = 38;
v1.BUTTON_DOWN = 40;
v1.DARK_DX = -3;
v1.DARK_DY = -1;
v1.MAX_HEALTH = 100;
v1.ST_GO = 1;
v1.ST_CRUSH = 2;
v1.BIKE_MOTO1 = 1;
v1.BIKE_MOTO2 = 2;
v1.moto1Params = new CBikeParams(0.6, 3.4, -0.4, 'lib_bike_body2', 13, 'lib_wheel2', 12, 0.4, 0, 0.03, 4.3, 24.7, 22.5, 0, 'lib_wheel_forward2', 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));
v1.moto2Params = new CBikeParams(0.6, 3.7, -0.4, 'lib_bike_body1', 13, 'lib_wheel1', 12, 0.4, 0, 0.03, 3.7, 26.6, 22.5, 0, 'lib_wheel_forward1', 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));
v1.bikeParamsArray = [CCarSynchronizer.moto1Params, CCarSynchronizer.moto2Params];
ASSetPropFlags(_global.CCarSynchronizer.prototype, null, 1);
}
#endinitclip
}
movieClip 550 __Packages.CIndicator {
#initclip
if (!_global.CIndicator) {
var v1 = function () {
super();
this.maxValue = 100;
this.curValue = this.maxValue;
};
_global.CIndicator = v1;
_global.CIndicator extends MovieClip;
var v2 = v1.prototype;
v2.setMaxValue = function (val) {
this.maxValue = val;
};
v2.getMaxValue = function () {
return this.maxValue;
};
v2.setValue = function (val) {
this.curValue = val;
this.validateCurValue();
this.updateView();
};
v2.addValue = function (val) {
this.curValue += val;
this.validateCurValue();
this.updateView();
};
v2.getValue = function () {
return this.curValue;
};
v2.setPercent = function (perc) {
this.curValue = perc * this.maxValue / 100;
this.updateView();
};
v2.getPercent = function () {
return 100 * this.curValue / this.maxValue;
};
v2.isEmpty = function () {
return this.curValue <= 0;
};
v2.isFull = function () {
return this.curValue >= this.maxValue;
};
v2.updateView = function () {
this.mc_mask._x = -(1 - this.curValue / this.maxValue) * this.mc_mask._width;
};
v1.updateViewFor = function (mc, val, maxVal) {
mc.mc_mask._x = -(1 - val / maxVal) * mc.mc_mask._width;
};
v2.validateCurValue = function () {
if (this.curValue > this.maxValue) {
this.curValue = this.maxValue;
} else {
if (this.curValue < 0) {
this.curValue = 0;
}
}
};
ASSetPropFlags(_global.CIndicator.prototype, null, 1);
}
#endinitclip
}
movieClip 551 __Packages.CGP {
#initclip
if (!_global.CGP) {
var v1 = function () {};
_global.CGP = v1;
var v2 = v1.prototype;
v1.createSounds = function () {
var v2;
var v1 = 0;
while (v1 < CGP.soundsArray.length) {
v2 = CGP.mc_root.mc_sounds.createEmptyMovieClip(CGP.soundsArray[v1].name, v1);
v2.sound = new Sound(v2);
v2.sound.attachSound(CGP.soundsArray[v1].name);
++v1;
}
};
v1.playSound = function (id, vol) {
CGP.soundsArray[id].go = true;
CGP.soundsArray[id].vol = vol;
};
v1.processSounds = function () {
var v1 = 0;
while (v1 < CGP.soundsArray.length) {
if (CGP.soundsArray[v1].go) {
if (CGP.soundsArray[v1].vol > 10) {
CGP.realPlaySound(v1);
break;
}
}
++v1;
}
CGP.resetSounds();
};
v1.resetSounds = function () {
var v1 = 0;
while (v1 < CGP.soundsArray.length) {
CGP.soundsArray[v1].go = false;
++v1;
}
};
v1.realPlaySound = function (id) {
if (CGP.mc_root.stopSoundFlag) {
return undefined;
}
CGP.mc_root.mc_sounds[CGP.soundsArray[id].name].sound.setVolume(CGP.soundsArray[id].vol);
CGP.mc_root.mc_sounds[CGP.soundsArray[id].name].sound.start(0, 0);
};
v1.init = function () {
CGP.uid = 0;
CGP.objectsCounter = 0;
CGP.createSounds();
};
v1.getUID = function () {
++CGP.uid;
return CGP.uid;
};
v1.setLevelTasks = function () {
CGP.curLevelTask = CGP.levelTasks[CGP.level - 1][CGP.IDX_TASK];
CGP.curLevelTaskTime = CGP.levelTasks[CGP.level - 1][CGP.IDX_TASK_TIME];
CGP.curLevelTaskValue = CGP.levelTasks[CGP.level - 1][CGP.IDX_TASK_VALUE];
CGP.curLevelDistance = CGP.mc_level.mc.mc_finish._x - CGP.mc_level.mc.mc_start._x;
CGP.crushCount = 0;
CGP.crumpleCount = 0;
CGP.redBonusesCount = 0;
CGP.greenBonusesCount = 0;
CGP.firstFinishTruck = CGP.FIRST_NONE;
};
v1.updateLevelProgress = function () {
switch (CGP.curLevelTask) {
break;
case CGP.TASK_DRIVE_LEVEL:
case CGP.TASK_DRIVE_FOR_TIME:
break;
case CGP.TASK_CRUSH:
CGP.mc_panel.txtCars.text = CGP.crushCount + '/' + CGP.curLevelTaskValue;
if (CGP.crushCount < CGP.curLevelTaskValue) {
CGP.mc_panel.txtCars.textColor = 16777215;
} else {
CGP.mc_panel.txtCars.textColor = 65280;
}
break;
case CGP.TASK_GET_BONUSES:
CGP.mc_panel.txtBonuses.text = CGP.greenBonusesCount - CGP.redBonusesCount + '/' + CGP.curLevelTaskValue;
if (CGP.greenBonusesCount - CGP.redBonusesCount < CGP.curLevelTaskValue) {
CGP.mc_panel.txtBonuses.textColor = 16777215;
} else {
CGP.mc_panel.txtBonuses.textColor = 65280;
}
break;
case CGP.TASK_OVERTAKE_ENEMY:
}
CGP.mc_progressInd.setPercent(100 * (CGP.carSync.mc_car._x - CGP.mc_level.mc.mc_start._x) / CGP.curLevelDistance);
};
v1.isHitWithCar = function (mc) {
var v1;
if (Math.abs(CGP.carSync.mc_car._x - mc._x) > CGP.CAR_HIT_RADIUS) {
return false;
}
v1 = {'x': mc._x, 'y': mc._y};
mc._parent.localToGlobal(v1);
return CGP.carSync.mc_car.mc.mc_hit.hitTest(v1.x, v1.y, true);
};
v1.CAR_HIT_RADIUS = 110;
v1.TASK_DRIVE_LEVEL = 1;
v1.TASK_DRIVE_FOR_TIME = 2;
v1.TASK_CRUSH = 3;
v1.TASK_GET_BONUSES = 4;
v1.TASK_OVERTAKE_ENEMY = 5;
v1.MAX_LEVEL_NUM = 15;
v1.SHOW_INTER_LEVEL = false;
v1.levelTasks = [[CGP.TASK_DRIVE_LEVEL, 0, 0], [CGP.TASK_DRIVE_FOR_TIME, 60000, 0], [CGP.TASK_CRUSH, 120000, 15], [CGP.TASK_GET_BONUSES, 120000, 15], [CGP.TASK_DRIVE_FOR_TIME, 60000, 0], [CGP.TASK_OVERTAKE_ENEMY, 0, 0]];
v1.IDX_TASK = 0;
v1.IDX_TASK_TIME = 1;
v1.IDX_TASK_VALUE = 2;
v1.FIRST_NONE = 1;
v1.FIRST_PLAYER = 2;
v1.FIRST_COMPUTER = 3;
v1.LVL_NEXT_FRAME = '';
v1.scrTime = 400;
v1.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}];
v1.snd_expl = 0;
v1.snd_crush = 1;
v1.snd_crush_small = 2;
v1.snd_expl_small = 3;
v1.snd_bonus_repair = 4;
v1.snd_bonus_green = 5;
v1.snd_bonus_red = 6;
ASSetPropFlags(_global.CGP.prototype, null, 1);
}
#endinitclip
}
movieClip 552 __Packages.CCamera {
#initclip
if (!_global.CCamera) {
var v1 = function () {};
_global.CCamera = v1;
var v2 = v1.prototype;
v2.init = function (targetMovie_, levelMovie_) {
this.targetMovie = targetMovie_;
this.levelMovie = levelMovie_;
this.levelMovie._y = 0;
this.process();
};
v2.process = function () {
var v2 = {'x': this.targetMovie._x + 40, 'y': this.targetMovie._y};
this.targetMovie._parent.localToGlobal(v2);
this.levelMovie._parent.globalToLocal(v2);
this.levelMovie._x += CCamera.SCREEN_WIDTH / 3 - v2.x;
this.levelMovie._y += CCamera.SCREEN_HEIGHT2 - v2.y;
this.levelMovie._x = Math.round(this.levelMovie._x);
this.levelMovie._y = Math.round(this.levelMovie._y);
if (this.levelMovie._x > 0) {
this.levelMovie._x = 0;
} else {
if (this.levelMovie._x + this.levelMovie._width < CCamera.SCREEN_WIDTH) {
this.levelMovie._x = CCamera.SCREEN_WIDTH - this.levelMovie._width;
}
}
if (this.levelMovie._y < 0) {
this.levelMovie._y = 0;
}
};
v1.SCREEN_WIDTH = 640;
v1.SCREEN_HEIGHT = 480;
v1.SCREEN_WIDTH2 = CCamera.SCREEN_WIDTH / 2;
v1.SCREEN_HEIGHT2 = CCamera.SCREEN_HEIGHT - 250;
ASSetPropFlags(_global.CCamera.prototype, null, 1);
}
#endinitclip
}
movieClip 553 __Packages.CBack {
#initclip
if (!_global.CBack) {
var v1 = function () {};
_global.CBack = v1;
var v2 = v1.prototype;
v2.init = function (mc1_, mc2_, scaleFactor_) {
this.mc1 = mc1_;
this.mc2 = mc2_;
this.scaleFactor = scaleFactor_;
};
v2.process = function (levelX) {
levelX = Math.abs(Math.round(levelX) / this.scaleFactor) % this.mc1._width;
this.mc1._x = -levelX;
this.mc2._x = this.mc1._x + this.mc1._width - 1;
};
ASSetPropFlags(_global.CBack.prototype, null, 1);
}
#endinitclip
}
movieClip 554 __Packages.CMan {
#initclip
if (!_global.CMan) {
var v1 = function () {
super();
this.stopFlag = false;
this.state = 0;
};
_global.CMan = v1;
_global.CMan extends MovieClip;
var v2 = v1.prototype;
v2.stopAnim = function () {
this.stopFlag = true;
};
v2.stopMCAnim = function () {
this.mc.stop();
};
v2.startAnim = function () {
this.stopFlag = false;
};
v2.onEnterFrame = function () {
if (this.stopFlag) {
return undefined;
}
if (Key.isDown(CMan.LEFT_BUTTON)) {
this.toLeft();
} else {
if (Key.isDown(CMan.RIGHT_BUTTON)) {
this.toRight();
} else {
if (this.state == 1 || this.state == 2) {
this.fromLeft();
} else {
if (this.state == 4 || this.state == 5) {
this.fromRight();
}
}
}
}
};
v2.toLeft = function () {
if (this.state == 0) {
this.gotoAndStop('toLeft');
this.state = 1;
} else {
if (this.state == 3) {
this.gotoAndStop('toLeft');
this.mc.gotoAndPlay(CMan.ANIM_FRAMES - this.mc._currentframe + 1);
this.state = 1;
} else {
if (this.state == 4 || this.state == 5) {
this.fromRight();
this.state = 6;
}
}
}
};
v2.toRight = function () {
if (this.state == 0) {
this.gotoAndStop('toRight');
this.state = 4;
} else {
if (this.state == 6) {
this.gotoAndStop('toRight');
this.mc.gotoAndPlay(CMan.ANIM_FRAMES - this.mc._currentframe + 1);
this.state = 4;
} else {
if (this.state == 1 || this.state == 2) {
this.fromLeft();
this.state = 3;
}
}
}
};
v2.fromLeft = function () {
if (this.state == 1) {
this.gotoAndStop('fromLeft');
this.mc.gotoAndPlay(CMan.ANIM_FRAMES - this.mc._currentframe + 1);
this.state = 3;
} else {
if (this.state == 2) {
this.gotoAndStop('fromLeft');
this.state = 3;
}
}
};
v2.fromRight = function () {
if (this.state == 4) {
this.gotoAndStop('fromRight');
this.mc.gotoAndPlay(CMan.ANIM_FRAMES - this.mc._currentframe + 1);
this.state = 6;
} else {
if (this.state == 5) {
this.gotoAndStop('fromRight');
this.state = 6;
}
}
};
v2.endMove = function () {
if (this.state == 1) {
this.gotoAndStop('left');
this.state = 2;
} else {
if (this.state == 3) {
this.gotoAndStop('stay');
this.state = 0;
} else {
if (this.state == 4) {
this.gotoAndStop('right');
this.state = 5;
} else {
if (this.state == 6) {
this.gotoAndStop('stay');
this.state = 0;
}
}
}
}
};
v1.LEFT_BUTTON = 37;
v1.RIGHT_BUTTON = 39;
v1.ANIM_FRAMES = 7;
ASSetPropFlags(_global.CMan.prototype, null, 1);
}
#endinitclip
}
frame 2 {
stop();
if (_root.percent >= 101) {
loader.gotoAndStop(101);
trace('gotoAndStop3');
percent_txt.text = 100;
gotoAndStop('main');
} else {
if (_root.percent >= 1) {
trace('the othe rone');
loader.gotoAndStop(percent + 1);
percent_txt.text = percent;
gotoAndPlay(1);
}
}
}
frame 4 {
}
movieClip 61 {
#initclip
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._y = 0;
mc_level._x = 0;
mc_level._yscale = 100;
mc_level._xscale = 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 += dTime;
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 v1;
var v2;
var v6 = 5;
var v4 = 15;
var v3 = 45;
var v5 = 200;
v1 = levelTimeCounter / 1000;
if (v1 < v6) {
v2 = 1000;
v2 = v2;
} else {
if (v1 < v4) {
v2 = ((v4 - v1) / (v4 - v6)) * 600 + 400;
} else {
if (v1 < v3) {
v2 = ((v3 - v1) / (v3 - v4)) * 200 + 200;
} else {
if (v1 < v5) {
v2 = ((v5 - v1) / (v5 - v3)) * 180 + 20;
} else {
v2 = 20;
}
}
}
}
scores += Math.round(v2);
}
function showTime() {
txtTime.text = String(getTimeString(timeCounter));
}
function getTimeString(time) {
var v1 = Math.round(time / 1000);
var v2 = Math.floor(v1 / 60);
var v3;
var v4;
v1 -= v2 * 60;
if (v1 < 10) {
v4 = '0' + v1;
} else {
v4 = '' + v1;
}
if (v2 < 10) {
v3 = '0' + v2;
return v3 + ':' + v4;
}
v3 = '' + v2;
return v3 + ':' + v4;
}
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;
} else {
if (carSync.mc_car._y >= mc_level.mc.mc_dead._y) {
trace('Fell');
if (!stopSoundFlag) {
mc_sloop.gotoAndStop(3);
}
mc_pause._visible = false;
loose();
}
}
}
function loose() {
trace('Game over');
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 v1 = SharedObject.getLocal(gameName);
v1.data.enableCoolBike = enableCoolBike;
v1.flush();
}
function loadSettings() {
var v1 = SharedObject.getLocal(gameName);
if (v1.data.enableCoolBike != undefined) {
enableCoolBike = v1.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
frame 1 {
}
}
frame 5 {
}
movieClip 67 {
}
movieClip 68 {
}
movieClip 70 {
}
movieClip 71 lib_wheel2 {
#initclip
Object.registerClass('lib_wheel2', CWheel);
#endinitclip
instance mc_crush_test of movieClip 70 {
onClipEvent (load) {
this._visible = false;
}
}
}
movieClip 72 lib_wheel_forward2 {
#initclip
Object.registerClass('lib_wheel_forward2', CWheel);
#endinitclip
instance mc_crush_test of movieClip 70 {
onClipEvent (load) {
this._visible = false;
}
}
}
movieClip 73 {
}
movieClip 74 {
}
movieClip 77 {
}
movieClip 80 {
}
movieClip 83 {
}
movieClip 86 {
}
movieClip 89 {
}
movieClip 92 {
}
movieClip 94 {
}
movieClip 96 {
}
movieClip 99 {
}
movieClip 102 {
}
movieClip 104 {
}
movieClip 106 {
}
movieClip 108 {
}
movieClip 110 {
}
movieClip 112 {
}
movieClip 114 {
}
movieClip 117 {
}
movieClip 119 {
}
movieClip 121 {
}
movieClip 123 {
}
movieClip 126 {
}
movieClip 128 {
}
movieClip 130 {
}
movieClip 132 {
}
movieClip 134 {
}
movieClip 136 {
}
movieClip 137 {
}
movieClip 138 {
frame 7 {
this._parent.endMove();
}
}
movieClip 139 {
}
movieClip 140 {
frame 7 {
this._parent.endMove();
}
}
movieClip 141 {
frame 7 {
this._parent.endMove();
}
}
movieClip 142 {
}
movieClip 143 {
frame 7 {
this._parent.endMove();
}
}
movieClip 144 moto2_man {
#initclip
Object.registerClass('moto2_man', CMan);
#endinitclip
frame 1 {
this.stop();
}
}
movieClip 145 {
frame 1 {
this.stop();
}
}
movieClip 146 lib_bike_body2 {
frame 1 {
this.stop();
}
}
movieClip 147 lib_wheel1 {
#initclip
Object.registerClass('lib_wheel1', CWheel);
#endinitclip
instance mc_crush_test of movieClip 70 {
onClipEvent (load) {
this._visible = false;
}
}
}
movieClip 148 lib_wheel_forward1 {
#initclip
Object.registerClass('lib_wheel_forward1', CWheel);
#endinitclip
instance mc_crush_test of movieClip 70 {
onClipEvent (load) {
this._visible = false;
}
}
}
movieClip 151 {
}
movieClip 153 {
}
movieClip 155 {
}
movieClip 157 {
}
movieClip 160 {
}
movieClip 162 {
}
movieClip 165 {
}
movieClip 167 {
}
movieClip 169 {
}
movieClip 171 {
}
movieClip 173 {
}
movieClip 175 {
}
movieClip 176 {
}
movieClip 177 {
frame 7 {
this._parent.endMove();
}
}
movieClip 178 {
}
movieClip 179 {
frame 7 {
this._parent.endMove();
}
}
movieClip 180 {
frame 7 {
this._parent.endMove();
}
}
movieClip 181 {
}
movieClip 182 {
frame 7 {
this._parent.endMove();
}
}
movieClip 183 moto1_man {
#initclip
Object.registerClass('moto1_man', CMan);
#endinitclip
frame 1 {
this.stop();
}
}
movieClip 184 {
frame 1 {
this.stop();
}
}
movieClip 185 lib_bike_body1 {
frame 1 {
this.stop();
}
}
frame 7 {
}
frame 8 {
}
frame 8 {
gotoAndStop('main');
}
movieClip 191 {
frame 1 {
stop();
}
}
instance mc_sloop_zast of movieClip 191 {
onClipEvent (load) {
this.gotoAndStop(2);
}
}
movieClip 193 {
frame 1 {
stop();
}
}
movieClip 195 {
frame 1 {
stop();
}
}
instance mc_sloop of movieClip 195 {
onClipEvent (load) {
var soundControl = new Sound(this);
}
}
movieClip 197 {
frame 1 {
stop();
}
}
// unknown tag 88 length 68
// unknown tag 88 length 57
movieClip 209 {
}
movieClip 214 {
}
movieClip 217 {
}
movieClip 219 {
}
button 222 {
on (press) {
this._parent.soundOff();
this.gotoAndStop(2);
}
}
movieClip 224 {
}
button 226 {
on (release) {
this._parent.soundOn();
this.gotoAndStop(1);
}
}
movieClip 227 {
frame 1 {
this.stop();
}
}
instance btn_sound of movieClip 227 {
onClipEvent (load) {
if (this._parent.stopSoundFlag) {
this.gotoAndStop(2);
}
}
}
button 228 {
on (release) {
getURL('http://www.iriysoft.ru', '_blank');
}
}
button 229 {
on (release) {
getURL('http://www.chillcade.com', '_blank');
}
}
frame 23 {
stop();
}
movieClip 232 {
}
button 240 {
on (release) {
this.gotoAndStop('credits');
}
}
button 244 {
on (release) {
gameStart();
}
}
button 248 {
on (release) {
this.gotoAndStop('rules');
}
}
button 252 {
on (release) {
getURL('http://www.chillcade.com', '_blank');
}
}
movieClip 255 {
}
button 257 {
on (release) {
this.gotoAndStop('rules');
}
}
// unknown tag 88 length 127
movieClip 268 {
}
button 270 {
on (release) {
this.gotoAndStop('main');
}
}
button 277 {
on (release) {
this.gotoAndStop('main');
}
}
// unknown tag 88 length 127
movieClip 284 {
}
movieClip 287 {
}
movieClip 291 {
}
instance of movieClip 291 {
onClipEvent (release) {
this._parent.gameStartWith(1);
}
onClipEvent (load) {
this._alpha = 0;
}
}
instance btn_vehicle1 of movieClip 291 {
onClipEvent (release) {
this._parent.gameStartWith(2);
}
onClipEvent (load) {
this._alpha = 0;
}
}
movieClip 294 {
}
frame 27 {
this.stop();
}
movieClip 300 {
}
movieClip 301 {
}
movieClip 302 {
}
movieClip 304 {
}
movieClip 310 {
}
movieClip 312 {
}
movieClip 313 {
}
movieClip 316 {
}
movieClip 319 {
}
movieClip 320 {
}
movieClip 321 {
}
movieClip 323 {
}
movieClip 328 {
}
movieClip 332 {
}
movieClip 333 {
}
movieClip 335 {
}
movieClip 338 {
}
movieClip 343 {
}
movieClip 344 {
}
movieClip 345 {
}
movieClip 347 {
}
movieClip 350 {
}
movieClip 352 {
}
movieClip 355 {
}
movieClip 357 {
}
movieClip 360 {
}
movieClip 364 {
}
movieClip 367 {
}
movieClip 369 {
}
movieClip 372 {
}
movieClip 374 {
}
movieClip 377 {
}
movieClip 381 {
}
movieClip 386 {
}
movieClip 391 {
}
movieClip 392 {
}
movieClip 397 {
}
movieClip 398 {
}
movieClip 402 {
}
movieClip 406 {
}
movieClip 411 {
}
movieClip 412 {
}
movieClip 413 {
}
movieClip 427 {
}
button 428 {
on (release) {
this._parent.newGame();
}
}
movieClip 432 {
}
button 433 {
on (release) {
this._parent.nextLevel();
}
}
button 442 {
on (release) {
this._parent.chooseBike();
}
}
button 443 {
on (release) {
this._parent.newGame();
}
}
button 449 {
on (release) {
this._parent.nextLevel();
}
}
movieClip 453 {
}
button 455 {
on (release) {
this._parent.chooseBike();
}
}
movieClip 461 {
}
button 462 {
on (release) {
this._parent.replay();
}
}
button 463 {
on (release) {
--CGP.level;
this._parent.chooseBike();
}
}
button 466 {
on (release) {
--CGP.level;
this._parent.chooseBike();
}
}
button 470 {
on (release) {
this._parent.replay();
}
}
movieClip 484 {
}
movieClip 489 {
}
button 490 {
on (release) {
this._parent.replay();
}
}
movieClip 494 {
}
button 495 {
on (release) {
this._parent.resume();
}
}
button 501 {
on (release) {
this._parent.replay();
}
}
button 505 {
on (release) {
this._parent.resume();
}
}
movieClip 512 {
}
button 513 {
on (release) {
_root.showScoreBoard(true, true);
}
}
movieClip 514 {
}
// unknown tag 88 length 63
button 518 {
on (release) {
++CGP.level;
this._parent.nextLevel();
}
}
button 521 {
on (release) {
++CGP.level;
this._parent.nextLevel();
}
}
button 523 {
on (release) {
this._parent.newBike();
}
}
button 526 {
on (release) {
this._parent.newBike();
}
}
movieClip 527 {
instance of movieClip 514 {
onClipEvent (load) {
MochiScores.showLeaderboard({'boardID': '4541b9e0ee056633', 'score': this._parent._parent.scores, 'res': '640x450'});
}
}
frame 8 {
}
}
instance mc_control of movieClip 284 {
onClipEvent (load) {
this._parent.initLevel();
}
onClipEvent (enterFrame) {
this._parent.processGame();
}
onClipEvent (keyDown) {
this._parent.keyPressed();
}
}
movieClip 529 {
frame 1 {
stop();
}
}
movieClip 531 {
}
button 533 {
on (press) {
this._parent.pauseGame();
}
}
movieClip 535 {
}
button 536 {
on (press) {
this._parent.resume();
}
}
movieClip 537 {
frame 1 {
this.stop();
}
}
instance mc_sloop of movieClip 195 {
onClipEvent (load) {
var soundControl = new Sound(this);
}
}