Frame 1
_global.ipbSend = function (ipb_score) {
_root._visible = false;
_root.enabled = false;
stopAllSounds();
xx = new LoadVars();
xx.gname = "bikemania";
xx.gscore = _root.scores;
xx.flashgametime = int(getTimer() / 1000);
xx.gamesessid = _level0.gamesessid;
xx.gameid = _level0.gid;
xx.send("index.php?act=Arcade&do=newscore", "_self", "POST");
stop();
};
fscommand ("showmenu", false);
fscommand ("trapallkeys", true);
stop();
Frame 4
prevFrame();
Frame 5
if (false) {
}
Frame 6
this.stop();
Instance of Symbol 38 MovieClip in Frame 6
onClipEvent (load) {
var nPercentage = 0;
}
onClipEvent (enterFrame) {
if ((_parent.getBytesLoaded() > 1) && (_parent.getBytesTotal() > 1)) {
this.nPercentage = Math.floor((100 * _parent.getBytesLoaded()) / _parent.getBytesTotal());
this.mcStripe._xscale = nPercentage;
this.tP.text = String(nPercentage) + "%";
this.tP2.text = String(nPercentage) + "%";
if (nPercentage >= 100) {
this._parent.gotoAndStop("main");
}
}
}
Instance of Symbol 111 MovieClip in Frame 8
onClipEvent (load) {
if (!this._parent.highQuality) {
this.gotoAndStop(2);
}
}
Instance of Symbol 113 MovieClip "mc_sloop" in Frame 8
onClipEvent (load) {
var soundControl = new Sound(this);
}
Instance of Symbol 115 MovieClip "mc_sloop_zast" in Frame 8
onClipEvent (load) {
this.gotoAndStop(2);
}
Instance of Symbol 126 MovieClip "btn_sound" in Frame 8
onClipEvent (load) {
if (this._parent.stopSoundFlag) {
this.gotoAndStop(2);
}
}
Frame 8
if (false) {
}
Frame 9
if (false) {
}
Frame 10
this.stop();
Instance of Symbol 58 MovieClip "mc_control" in Frame 10
onClipEvent (load) {
this._parent.initLevel();
}
onClipEvent (enterFrame) {
this._parent.processGame();
}
onClipEvent (keyDown) {
this._parent.keyPressed();
updateAfterEvent();
}
Symbol 2 Button
on (press) {
}
Symbol 7 MovieClip Frame 9
stop();
Symbol 10 MovieClip Frame 1
Symbol 10 MovieClip Frame 233
if (_url.indexOf("swf") == -1) {
gotoAndPlay (2);
} else {
_root.gotoAndStop("loading");
}
Symbol 16 Button
on (release) {
}
Symbol 285 MovieClip [__Packages.CParticleEngine] Frame 0
class CParticleEngine
{
var hit_mc, prevTime;
function CParticleEngine () {
}
function clear() {
var _local1 = this;
while (_local1.p_array.pop() != undefined) {
}
while (_local1.w_array.pop() != undefined) {
}
while (_local1.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 _local1 = new CSpringConstraint(p1, p2, koeffStiff1, koeffStiff2);
c_array.push(_local1);
}
function start() {
prevTime = getTimer();
}
function computeForces() {
var _local2 = this;
var _local1;
var _local3 = _local2.p_array.length;
_local1 = 0;
while (_local1 < _local3) {
_local2.p_array[_local1].acc.x = 0;
_local2.p_array[_local1].acc.y = _local2.gravity * _local2.p_array[_local1].mass;
_local1++;
}
}
function clearForces() {
var _local3 = w_array.length;
var _local1;
var _local2;
_local1 = 0;
while (_local1 < _local3) {
_local2 = w_array[_local1];
_local2.addedAcc.x = (_local2.addedAcc.y = 0);
_local1++;
}
}
function applyManFrictions() {
var _local3 = this;
var _local2 = _local3.w_array.length;
var _local1;
_local1 = 0;
while (_local1 < _local2) {
_local3.w_array[_local1].applyAddedAcc();
_local1++;
}
}
function verlet(dTime) {
var _local2 = this;
var koeffDamp = 0.995;
var _local1;
var _local3 = _local2.p_array.length;
_local1 = 0;
while (_local1 < _local3) {
_local2.p_array[_local1].verlet(dTime, koeffDamp);
_local1++;
}
_local3 = _local2.w_array.length;
var acc = 0;
if (Key.isDown(40)) {
acc = -0.6;
} else if (Key.isDown(38)) {
acc = 1;
}
_local1 = 0;
while (_local1 < _local3) {
_local2.w_array[_local1].process(dTime, (_local2.w_array[_local1].maxAccSpeed * acc) / 3.2, 0.99);
_local1++;
}
}
function checkCollisions() {
var _local2 = this;
var _local1;
var _local3 = _local2.w_array.length;
_local1 = 0;
while (_local1 < _local3) {
_local2.w_array[_local1].checkCollision(_local2.hit_mc);
_local1++;
}
}
function checkConstraints(dTime) {
var _local3 = this;
var _local1;
var _local2 = _local3.c_array.length;
_local1 = 0;
while (_local1 < _local2) {
_local3.c_array[_local1].resolve(dTime);
_local1++;
}
}
function process() {
var _local1 = this;
var curTime = getTimer();
var dTime = ((curTime - _local1.prevTime) / 1000);
_local1.prevTime = curTime;
var _local2;
var _local3 = Math.min(Math.round(dTime / _local1.t), _local1.maxSteps);
_local2 = 0;
while (_local2 < _local3) {
_local1.computeForces();
_local1.applyManFrictions();
_local1.verlet(_local1.t);
_local1.checkConstraints(_local1.t);
_local1.checkCollisions();
_local2++;
}
_local1.clearForces();
}
var p_array = new Array();
var w_array = new Array();
var c_array = new Array();
var t = 0.02;
var maxSteps = 2;
var gravity = 3.15;
}
Symbol 286 MovieClip [__Packages.CParticle] Frame 0
class CParticle
{
function CParticle (x_, y_, mass_) {
var _local1 = this;
_local1.pos = new CVector2D(x_, y_);
_local1.prevPos = _local1.pos.duplicate();
_local1.mass = mass_;
_local1.acc = new CVector2D(0, 0);
_local1.mc = null;
}
function verlet(dTime, koeffDamp) {
var _local1 = this;
var _local2 = _local1.pos.duplicate();
_local1.pos.x = _local1.pos.x + (((_local1.pos.x - _local1.prevPos.x) * koeffDamp) + (_local1.acc.x * dTime));
_local1.pos.y = _local1.pos.y + (((_local1.pos.y - _local1.prevPos.y) * koeffDamp) + (_local1.acc.y * dTime));
_local2.copyTo(_local1.prevPos);
if (_local1.mc != null) {
_local1.mc._x = _local1.pos.x;
_local1.mc._y = _local1.pos.y;
}
}
}
Symbol 287 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 _local1 = this;
var _local2 = Math.sqrt((_local1.x * _local1.x) + (_local1.y * _local1.y));
_local1.x = _local1.x / _local2;
_local1.y = _local1.y / _local2;
}
function reverseNew() {
return(new CVector2D(-x, -y));
}
function scalar(v) {
return((x * v.x) + (y * v.y));
}
function modul() {
var _local1 = this;
return(Math.sqrt((_local1.x * _local1.x) + (_local1.y * _local1.y)));
}
function reflectFromNormal(n) {
var _local2 = this;
var _local1 = Math.atan2(n.y, n.x);
_local2.rotate(-_local1);
_local2.x = -_local2.x;
_local2.rotate(_local1);
}
function rotate(u) {
var _local1 = u;
var _local2 = this;
var oX = _local2.x;
var _local3 = _local2.y;
_local2.x = (oX * Math.cos(_local1)) - (_local3 * Math.sin(_local1));
_local2.y = (oX * Math.sin(_local1)) + (_local3 * Math.cos(_local1));
}
function rotateNew(u) {
var _local1 = u;
var _local2 = this;
return(new CVector2D((_local2.x * Math.cos(_local1)) - (_local2.y * Math.sin(_local1)), (_local2.x * Math.sin(_local1)) + (_local2.y * Math.cos(_local1))));
}
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;
var _local2 = _local3.y - p2.y;
var _local1 = p2.x - _local3.x;
var C = ((_local3.x * (p2.y - _local3.y)) - (_local3.y * (p2.x - _local3.x)));
var d = Math.sqrt((_local2 * _local2) + (_local1 * _local1));
_local2 = _local2 / d;
_local1 = _local1 / d;
C = C / d;
return(((_local2 * x) + (_local1 * y)) + C);
}
}
Symbol 288 MovieClip [__Packages.CWheel] Frame 0
class CWheel extends MovieClip
{
function CWheel () {
super();
}
function init(particle_, maxAccSpeed_, rad_) {
var _local1 = this;
_local1.particle = particle_;
_local1.rad = rad_;
_local1.maxAccSpeed = maxAccSpeed_ * 4;
_local1.speed = 0;
_local1.accSpeed = 0;
_local1.rot = new CVector2D(1, 0);
_local1.addedAcc = new CVector2D(0, 0);
_local1.intersectionFlag = false;
_local1.lastIntersPoint = new CVector2D(0, 0);
_local1.lastN = new CVector2D(0, 0);
var _local2;
var mc;
var _local3 = (Math.PI*2) / _local1.hitCount;
_local1.hitPointArray = new Array(_local1.hitCount);
_local1.normalArray = new Array(_local1.hitCount);
_local1.hitArray = new Array(_local1.hitCount);
_local1.intersArray = new Array();
_local2 = 0;
while (_local2 < _local1.hitCount) {
_local1.hitPointArray[_local2] = new CVector2D(Math.sin(_local3 * _local2) * _local1.rad, (-Math.cos(_local3 * _local2)) * _local1.rad);
_local1.normalArray[_local2] = _local1.hitPointArray[_local2].multNew(-1);
_local1.normalArray[_local2].normalize();
_local2++;
}
}
function process(dTime, acc, koeffDamp) {
var _local1 = this;
var _local2 = dTime;
_local1.accSpeed = Math.max(-_local1.maxAccSpeed, Math.min(_local1.maxAccSpeed, _local1.accSpeed + (acc * _local2)));
_local1.speed = Math.max((-_local1.maxSpeed) * _local2, Math.min((_local1.speed * koeffDamp) + _local1.accSpeed, _local1.maxSpeed * _local2));
_local1.rot.rotate(_local1.speed / _local1.rad);
_local1.mc.mc_rim._rotation = (Math.atan2(_local1.rot.y, _local1.rot.x) * 180) / Math.PI;
}
function checkCollision(hit_mc) {
var _local1 = this;
var _local2;
var j;
var p = new CVector2D(0, 0);
var hitFlag = false;
var _local3;
var k2;
var k;
var oldPos = new CVector2D(_local1.particle.prevPos.x, _local1.particle.prevPos.y);
var n = new CVector2D(0, 0);
var counter;
_local1._x = _local1.particle.pos.x;
_local1._y = _local1.particle.pos.y;
counter = 0;
_local2 = 0;
while (_local2 < _local1.hitCount) {
_local1.hitPointArray[_local2].copyTo(p);
_local1.localToGlobal(p);
if ((_local1.hitArray[_local2] = hit_mc.hitTest(p.x, p.y, true))) {
hitFlag = true;
_local3 = _local2;
counter++;
}
_local2++;
}
if (counter == _local1.hitCount) {
_local1.particle.pos.x = _local1.particle.prevPos.x + ((_local1.particle.pos.x - _local1.particle.prevPos.x) * 0.3);
_local1.particle.pos.y = _local1.particle.prevPos.y + ((_local1.particle.pos.y - _local1.particle.prevPos.y) * 0.3);
_local1._x = _local1.particle.pos.x;
_local1._y = _local1.particle.pos.y;
} else {
_local2 = 0;
if (hitFlag) {
while (true) {
_local2++;
if (_local2 == _local1.hitCount) {
_local2 = 0;
}
if (!_local1.hitArray[_local2]) {
_local3 = -1;
j = 0;
while (j < _local1.hitCount) {
_local2++;
if (_local2 == _local1.hitCount) {
_local2 = 0;
}
if (_local3 == -1) {
if (_local1.hitArray[_local2]) {
_local3 = _local2;
n.plus(_local1.normalArray[_local2]);
}
} else if (!_local1.hitArray[_local2]) {
k2 = _local2 - 1;
if (k2 < 0) {
k2 = _local1.hitCount - 1;
}
_local1.intersArray.push({k1:_local3, k2:k2});
_local3 = -1;
} else {
n.plus(_local1.normalArray[_local2]);
}
j++;
}
break;
}
}
var p3 = new CVector2D(0, 0);
if (_local1.intersArray.length > 0) {
n.normalize();
if (_local1.intersectionFlag) {
n.x = n.x + _local1.lastN.x;
n.y = n.y + _local1.lastN.y;
n.x = n.x / 2;
n.y = n.y / 2;
}
var obj;
var u;
k = _local1.intersArray.length;
_local2 = 0;
while (_local2 < k) {
obj = _local1.intersArray.pop();
_local3 = obj.k1;
k2 = obj.k2;
_local1.particle.pos.minusNew(_local1.particle.prevPos).copyTo(p3);
if (n.scalar(p3) < 0) {
u = Math.atan2(n.y, n.x);
p3.rotate(-u);
p3.x = (-p3.x) * _local1.koeffSpring;
p3.rotate(u);
_local1.pushOut(_local3, k2, hit_mc);
_local1.particle.prevPos.x = _local1.particle.pos.x - p3.x;
_local1.particle.prevPos.y = _local1.particle.pos.y - p3.y;
} else {
_local1.pushOut(_local3, k2, hit_mc);
}
_local2++;
}
_local1.validateRotation(n, oldPos);
_local1.intersectionFlag = true;
_local1.particle.pos.copyTo(_local1.lastIntersPoint);
n.copyTo(_local1.lastN);
}
} else if (_local1.intersectionFlag) {
_local1.validateRotation(_local1.lastN, oldPos);
_local1.intersectionFlag = false;
}
_local1._x = _local1.particle.pos.x;
_local1._y = _local1.particle.pos.y;
}
}
function pushOut(k1, k2, hit_mc) {
var _local1 = this;
var _local2;
if (k1 != k2) {
_local2 = _local1.normalArray[k1].plusNew(_local1.normalArray[k2]);
_local2.normalize();
var d = new CVector2D(0, 0).getDistanceTo(_local1.hitPointArray[k1], _local1.hitPointArray[k2]);
d = _local1.rad - Math.abs(d);
_local1.particle.pos.plus(_local2.multNew(d));
_local1.particle.prevPos.plus(_local2.multNew(d));
} else {
_local2 = _local1.normalArray[k1];
var p3 = _local2.multNew(-_local1.rad);
var p = new CVector2D(0, 0);
var m = 0;
var _local3 = 0.03;
while (true) {
p3.copyTo(p);
_local1.localToGlobal(p);
if (hit_mc.hitTest(p.x, p.y, true)) {
m++;
_local1._x = (_local1.particle.pos.x = _local1.particle.pos.x + (_local2.x * _local3));
_local1._y = (_local1.particle.pos.y = _local1.particle.pos.y + (_local2.y * _local3));
} else {
m--;
_local1.particle.pos.x = _local1.particle.pos.x - (_local2.x * _local3);
_local1.particle.pos.y = _local1.particle.pos.y - (_local2.y * _local3);
_local1.particle.prevPos.plus(_local2.multNew(_local3 * m));
return;
}
}
}
}
function validateRotation(n, oldPos) {
var _local1 = this;
if ((!_local1.intersectionFlag) && (Math.abs(_local1.accSpeed) > 0.01)) {
if (Math.abs(_local1.accSpeed) < ((_local1.maxAccSpeed * 0.02) / 2)) {
_local1.accSpeed = 0;
} else if (_local1.accSpeed > 0) {
_local1.accSpeed = _local1.maxAccSpeed * 0.02;
} else {
_local1.accSpeed = (-_local1.maxAccSpeed) * 0.02;
}
}
var _local3 = new CVector2D(-n.y, n.x);
var wheelSpeed = _local1.particle.pos.minusNew(oldPos);
var ugol = Math.atan2(_local3.y, _local3.x);
var _local2 = wheelSpeed.rotateNew(-ugol);
_local1.speed = _local2.x + _local1.accSpeed;
_local2.y = 0;
_local2.rotate(ugol);
var traction = (1 - _local1.koeffSlip);
_local1.particle.pos.x = (_local1.particle.pos.x + ((_local3.x * _local1.accSpeed) * traction)) - ((1 - _local1.koeffFriction) * _local2.x);
_local1.particle.pos.y = (_local1.particle.pos.y + ((_local3.y * _local1.accSpeed) * traction)) - ((1 - _local1.koeffFriction) * _local2.y);
_local1.accSpeed = _local1.accSpeed * _local1.koeffSlip;
}
function applyAddedAcc() {
var _local1 = this;
_local1.particle.acc.x = _local1.particle.acc.x + (_local1.addedAcc.x * _local1.particle.mass);
_local1.particle.acc.y = _local1.particle.acc.y + (_local1.addedAcc.y * _local1.particle.mass);
}
var maxSpeed = 180;
var koeffSpring = 0.05;
var koeffSlip = 0.15;
var koeffFriction = 0.97;
var hitCount = 32;
}
Symbol 289 MovieClip [__Packages.CSpringConstraint] Frame 0
class CSpringConstraint
{
function CSpringConstraint (p1_, p2_, koeffStiffPress_, koeffStiffStretch_) {
var _local1 = this;
_local1.p1 = p1_;
_local1.p2 = p2_;
_local1.koeffStiffPress = koeffStiffPress_;
_local1.koeffStiffStretch = koeffStiffStretch_;
var _local2 = new CVector2D(_local1.p1.pos.x - _local1.p2.pos.x, _local1.p1.pos.y - _local1.p2.pos.y);
_local1.relaxLen = _local2.modul();
}
function resolve(dTime) {
var _local1 = this;
var _local2 = new CVector2D(_local1.p1.pos.x - _local1.p2.pos.x, _local1.p1.pos.y - _local1.p2.pos.y);
var m = _local2.modul();
var dr = ((_local1.relaxLen - m) / m);
_local2.mult(dr);
var _local3;
if (m > _local1.relaxLen) {
_local3 = _local1.koeffStiffStretch;
} else {
_local3 = _local1.koeffStiffPress;
}
_local1.p2.pos.x = _local1.p2.pos.x - (((_local2.x * ((_local1.p1.mass / (_local1.p1.mass + _local1.p2.mass)) + 1)) / 2) * _local3);
_local1.p2.pos.y = _local1.p2.pos.y - (((_local2.y * ((_local1.p1.mass / (_local1.p1.mass + _local1.p2.mass)) + 1)) / 2) * _local3);
_local1.p1.pos.x = _local1.p1.pos.x + (((_local2.x * ((_local1.p2.mass / (_local1.p1.mass + _local1.p2.mass)) + 1)) / 2) * _local3);
_local1.p1.pos.y = _local1.p1.pos.y + (((_local2.y * ((_local1.p2.mass / (_local1.p1.mass + _local1.p2.mass)) + 1)) / 2) * _local3);
}
}
Symbol 290 MovieClip [__Packages.CCamera] Frame 0
class CCamera
{
function CCamera () {
}
function init(targetMovie_, levelMovie_) {
var _local1 = this;
_local1.targetMovie = targetMovie_;
_local1.levelMovie = levelMovie_;
_local1.process();
}
function process() {
var _local1 = this;
var _local2 = {x:_local1.targetMovie._x, y:_local1.targetMovie._y};
_local1.targetMovie._parent.localToGlobal(_local2);
_local1.levelMovie._parent.globalToLocal(_local2);
_local1.levelMovie._x = _local1.levelMovie._x + (SCREEN_WIDTH2 - _local2.x);
_local1.levelMovie._y = _local1.levelMovie._y + (SCREEN_HEIGHT2 - _local2.y);
_local1.levelMovie._x = Math.round(_local1.levelMovie._x);
_local1.levelMovie._y = Math.round(_local1.levelMovie._y);
if (_local1.levelMovie._x > 0) {
_local1.levelMovie._x = 0;
} else if ((_local1.levelMovie._x + _local1.levelMovie._width) < SCREEN_WIDTH) {
_local1.levelMovie._x = SCREEN_WIDTH - _local1.levelMovie._width;
}
if (_local1.levelMovie._y < 0) {
_local1.levelMovie._y = 0;
}
}
static var SCREEN_WIDTH = 500;
static var SCREEN_HEIGHT = 400;
static var SCREEN_WIDTH2 = SCREEN_WIDTH / 2;
static var SCREEN_HEIGHT2 = SCREEN_HEIGHT / 2;
}
Symbol 291 MovieClip [__Packages.CBack] Frame 0
class CBack
{
function CBack () {
}
function init(mc1_, mc2_, scaleFactor_) {
var _local1 = this;
_local1.mc1 = mc1_;
_local1.mc2 = mc2_;
_local1.scaleFactor = scaleFactor_;
}
function process(levelX) {
var _local1 = this;
var _local2 = levelX;
_local2 = Math.abs(Math.round(_local2) / _local1.scaleFactor) % _local1.mc1._width;
_local1.mc1._x = -_local2;
_local1.mc2._x = (_local1.mc1._x + _local1.mc1._width) - 1;
}
static var SCREEN_WIDTH = 500;
}
Symbol 292 MovieClip [__Packages.CMan] Frame 0
class CMan extends MovieClip
{
var stopFlag, state, mc;
function CMan () {
super();
stopFlag = false;
state = 0;
}
function stopAnim() {
stopFlag = true;
}
function stopMCAnim() {
mc.stop();
}
function startAnim() {
stopFlag = false;
}
function onEnterFrame() {
var _local1 = this;
if (_local1.stopFlag) {
} else if (Key.isDown(LEFT_BUTTON)) {
_local1.toLeft();
} else if (Key.isDown(RIGHT_BUTTON)) {
_local1.toRight();
} else if ((_local1.state == 1) || (_local1.state == 2)) {
_local1.fromLeft();
} else if ((_local1.state == 4) || (_local1.state == 5)) {
_local1.fromRight();
}
}
function toLeft() {
var _local1 = this;
var _local2;
if (_local1.state == 0) {
_local1.state = 1;
_local1.gotoAndStop("toLeft");
_local1.state = 1;
} else if (_local1.state == 3) {
_local2 = _local1.mc._currentframe;
_local1.gotoAndStop("toLeft");
_local1.mc.gotoAndPlay((ANIM_FRAMES - _local2) + 1);
_local1.state = 1;
} else if ((_local1.state == 4) || (_local1.state == 5)) {
_local1.fromRight();
_local1.state = 6;
}
}
function toRight() {
var _local1 = this;
var _local2;
if (_local1.state == 0) {
_local1.state = 1;
_local1.gotoAndStop("toRight");
_local1.state = 4;
} else if (_local1.state == 6) {
_local2 = _local1.mc._currentframe;
_local1.gotoAndStop("toRight");
_local1.mc.gotoAndPlay((ANIM_FRAMES - _local2) + 1);
_local1.state = 4;
} else if ((_local1.state == 1) || (_local1.state == 2)) {
_local1.fromLeft();
_local1.state = 3;
}
}
function fromLeft() {
var _local1 = this;
var _local2;
if (_local1.state == 1) {
_local2 = _local1.mc._currentframe;
_local1.gotoAndStop("fromLeft");
_local1.mc.gotoAndPlay((ANIM_FRAMES - _local2) + 1);
_local1.state = 3;
} else if (_local1.state == 2) {
_local1.gotoAndStop("fromLeft");
_local1.state = 3;
}
}
function fromRight() {
var _local1 = this;
var _local2;
if (_local1.state == 4) {
_local2 = _local1.mc._currentframe;
_local1.gotoAndStop("fromRight");
_local1.mc.gotoAndPlay((ANIM_FRAMES - _local2) + 1);
_local1.state = 6;
} else if (_local1.state == 5) {
_local1.gotoAndStop("fromRight");
_local1.state = 6;
}
}
function endMove() {
var _local1 = this;
if (_local1.state == 1) {
_local1.gotoAndStop("left");
_local1.state = 2;
} else if (_local1.state == 3) {
_local1.state = 0;
_local1.gotoAndStop("stay");
} else if (_local1.state == 4) {
_local1.state = 5;
_local1.gotoAndStop("right");
} else if (_local1.state == 6) {
_local1.state = 0;
_local1.gotoAndStop("stay");
}
}
static var LEFT_BUTTON = 37;
static var RIGHT_BUTTON = 39;
static var ANIM_FRAMES = 7;
}
Symbol 293 MovieClip [__Packages.CBikeSynchronizer] Frame 0
class CBikeSynchronizer
{
function CBikeSynchronizer () {
var _local1 = this;
_local1.fdir = new CVector2D(0, 0);
_local1.fpos = new CVector2D(0, 0);
_local1.bdir = new CVector2D(0, 0);
_local1.bpos = new CVector2D(0, 0);
}
function init(mc_container, sX, sY) {
var _local1 = this;
var _local3 = mc_container;
var _local2 = {x:0, y:0};
_local1.mc_back_wheel = _local3.attachMovie("lib_back_wheel", "back_w", 0);
_local1.mc_forward_wheel = _local3.attachMovie("lib_forward_wheel", "forward_w", 1);
_local1.mc_bike = _local3.attachMovie("lib_bike_body", "body", 2);
_local1.mc_bike._x = sX;
_local1.mc_bike._y = sY;
_local2.x = _local1.mc_bike.mc.mc_s_wheel_back._x;
_local2.y = _local1.mc_bike.mc.mc_s_wheel_back._y;
_local1.mc_bike.mc.localToGlobal(_local2);
_local1.mc_bike._parent.globalToLocal(_local2);
_local1.mc_back_wheel._x = _local2.x;
_local1.mc_back_wheel._y = _local2.y;
_local2.x = _local1.mc_bike.mc.mc_s_wheel_forward._x;
_local2.y = _local1.mc_bike.mc.mc_s_wheel_forward._y;
_local1.mc_bike.mc.localToGlobal(_local2);
_local1.mc_bike._parent.globalToLocal(_local2);
_local1.mc_forward_wheel._x = _local2.x;
_local1.mc_forward_wheel._y = _local2.y;
}
function setParticles(pBody_, pBWheel_, pFWheel_) {
var _local1 = this;
_local1.pBody = pBody_;
_local1.pBWheel = pBWheel_;
_local1.pFWheel = pFWheel_;
_local1.fdir.reinit(_local1.mc_bike.mc.mc_f_point._x - _local1.mc_bike.mc.mc_s_wheel_forward._x, _local1.mc_bike.mc.mc_f_point._y - _local1.mc_bike.mc.mc_s_wheel_forward._y);
_local1.fdir.normalize();
_local1.fpos.x = _local1.mc_bike.mc.mc_f_spring._x + ((_local1.fdir.x * (-_local1.mc_bike.mc.mc_f_spring._y)) / _local1.fdir.y);
_local1.fpos.x = _local1.fpos.x - _local1.mc_bike.mc.mc_body_man._x;
_local1.bpos.reinit(_local1.mc_bike.mc.mc_b_spring.mc_top._x, _local1.mc_bike.mc.mc_b_spring.mc_top._y);
_local1.mc_bike.mc.mc_b_spring.localToGlobal(_local1.bpos);
_local1.bdir.reinit(_local1.bpos.x, _local1.bpos.y);
_local1.mc_bike.mc.mc_body_man.globalToLocal(_local1.bpos);
_local1.mc_bike.mc.globalToLocal(_local1.bdir);
_local1.bdir.x = _local1.bdir.x - _local1.mc_bike.mc.mc_b_spring._x;
_local1.bdir.y = _local1.bdir.y - _local1.mc_bike.mc.mc_b_spring._y;
}
function process() {
var _local1 = this;
var _local2 = {x:0, y:0};
var _local3;
_local1.mc_bike._x = _local1.pBody.pos.x;
_local1.mc_bike._y = _local1.pBody.pos.y;
_local3 = _local1.pFWheel.pos.minusNew(_local1.pBWheel.pos);
_local1.mc_bike._rotation = (Math.atan2(_local3.y, _local3.x) * 180) / Math.PI;
_local2.x = _local1.pFWheel.pos.x;
_local2.y = _local1.pFWheel.pos.y;
_local1.mc_bike._parent.localToGlobal(_local2);
_local1.mc_bike.mc.globalToLocal(_local2);
_local1.mc_bike.mc.mc_f_spring._x = _local2.x;
_local1.mc_bike.mc.mc_f_spring._y = _local2.y;
var dx = (((_local2.x + ((_local1.fdir.x * (-_local2.y)) / _local1.fdir.y)) - _local1.mc_bike.mc.mc_body_man._x) - _local1.fpos.x);
_local1.mc_bike.mc.mc_body_man._x = _local1.mc_bike.mc.mc_body_man._x + dx;
_local1.mc_bike.mc.mc_f_spring.mc_spring._xscale = _local1.mc_bike.mc.mc_f_spring._y * 10;
_local2.x = _local1.mc_bike.mc.mc_f_spring.mc_spring._x;
_local2.y = _local1.mc_bike.mc.mc_f_spring.mc_spring._y;
_local1.mc_bike.mc.mc_f_spring.localToGlobal(_local2);
_local1.mc_bike.mc.globalToLocal(_local2);
_local1.mc_bike.mc.mc_f_spring.mc_spring._xscale = _local2.y * 10;
_local2.x = _local1.pBWheel.pos.x;
_local2.y = _local1.pBWheel.pos.y;
_local1.mc_bike._parent.localToGlobal(_local2);
_local1.mc_bike.mc.globalToLocal(_local2);
_local1.mc_bike.mc.mc_b_spring._x = _local2.x;
_local1.mc_bike.mc.mc_b_spring._y = _local2.y;
_local3.reinit(_local1.bpos.x, _local1.bpos.y);
_local1.mc_bike.mc.mc_body_man.localToGlobal(_local3);
_local1.mc_bike.mc.globalToLocal(_local3);
_local3.x = _local3.x - _local1.mc_bike.mc.mc_b_spring._x;
_local3.y = _local3.y - _local1.mc_bike.mc.mc_b_spring._y;
_local1.mc_bike.mc.mc_b_spring._rotation = ((_local3.getUgol() - _local1.bdir.getUgol()) * 180) / Math.PI;
}
}
Symbol 26 MovieClip Frame 1
#initclip 10
function updateSoundLoop() {
if (!stopSoundFlag) {
if (zastSoundFlag) {
mc_sloop.gotoAndStop(3);
mc_sloop_zast.gotoAndStop(2);
} else {
mc_sloop.gotoAndStop(2);
mc_sloop_zast.gotoAndStop(3);
}
}
}
function soundOff() {
if (zastSoundFlag) {
mc_sloop_zast.gotoAndStop(3);
} else {
mc_sloop.gotoAndStop(3);
}
stopSoundFlag = true;
}
function soundOn() {
if (zastSoundFlag) {
mc_sloop_zast.gotoAndStop(2);
} else {
mc_sloop.gotoAndStop(2);
}
stopSoundFlag = false;
}
function gameStart() {
scores = 0;
timeCounter = 0;
zastSoundFlag = false;
updateSoundLoop();
level = 0;
nextLevel();
}
function nextLevel() {
levelTimeCounter = 0;
if (level == 20) {
newGame();
return(undefined);
}
level++;
this.gotoAndStop("reset");
this.gotoAndStop("game");
}
function replay() {
this.gotoAndStop("reset");
this.gotoAndStop("game");
}
function newGame() {
zastSoundFlag = true;
updateSoundLoop();
this.gotoAndStop("main");
}
function playSnd(lib_snd) {
s = new Sound(this);
s.attachSound(lib_snd);
s.start();
}
function initLevel() {
lastTimer = getTimer();
mc_level.gotoAndStop(level);
mc_level.mc.mc_hit._visible = false;
if (bikeSync == null) {
bikeSync = new CBikeSynchronizer();
engine = new CParticleEngine();
objCamera = new CCamera();
back1 = new CBack();
back2 = new CBack();
} else {
engine.clear();
}
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);
bikeSync.init(mc_level.mc.mc_bike, 1, 1);
var _local1 = new CParticle(bikeSync.mc_back_wheel._x, bikeSync.mc_back_wheel._y, 5);
engine.addParticle(_local1);
engine.addWheel(bikeSync.mc_back_wheel, _local1, 28.5, 17.5);
var _local3 = new CParticle(bikeSync.mc_forward_wheel._x, bikeSync.mc_forward_wheel._y, 3);
engine.addParticle(_local3);
engine.addWheel(bikeSync.mc_forward_wheel, _local3, 220.5, 17.5);
var _local2 = new CParticle(bikeSync.mc_bike._x, bikeSync.mc_bike._y, 3);
_local2.mc = mc_level.mc.mc_bike.mc_test;
engine.addParticle(_local2);
engine.addSpringConstraint(_local1, _local3, 0.45, 0.5);
engine.addSpringConstraint(_local1, _local2, 0.45, 0.55);
engine.addSpringConstraint(_local2, _local3, 0.45, 0.7);
bikeSync.setParticles(_local2, _local1, _local3);
objCamera.init(bikeSync.mc_bike, mc_level.mc);
engine.setHitMovie(mc_level.mc.mc_hit);
engine.start();
accFlag = false;
accCounter = 150;
if (!stopSoundFlag) {
mc_sloop.gotoAndStop(2);
}
mc_message.gotoAndStop("empty");
gameState = 0;
}
function processGame() {
var newTimer;
var dTime;
newTimer = getTimer();
dTime = newTimer - lastTimer;
txtFps = 1 / (dTime / 1000);
lastTimer = newTimer;
if (gameState == 0) {
timeCounter = timeCounter + dTime;
levelTimeCounter = levelTimeCounter + dTime;
showTime();
var ax = 0;
var ay = 0;
var _local2;
var perc;
accCounter++;
if (!accFlag) {
accFlag = Key.isDown(38);
if (accFlag && (accCounter > 10)) {
accCounter = 2;
if (!stopSoundFlag) {
mc_gas.gotoAndPlay(2);
}
}
} else {
accFlag = Key.isDown(38);
}
if (Key.isDown(CMan.LEFT_BUTTON)) {
_local2 = calcBikeNVector();
if (_local2.y > 0) {
perc = (Math.abs(_local2.y) * 0.2) + 0.8;
bikeSync.mc_forward_wheel.addedAcc.x = bikeSync.mc_forward_wheel.addedAcc.x - (((_local2.x * engine.gravity) / 1.1) * perc);
bikeSync.mc_forward_wheel.addedAcc.y = bikeSync.mc_forward_wheel.addedAcc.y - (((_local2.y * engine.gravity) * 1.3) * perc);
bikeSync.mc_back_wheel.addedAcc.x = bikeSync.mc_back_wheel.addedAcc.x + (((_local2.x * engine.gravity) / 1.5) * perc);
bikeSync.mc_back_wheel.addedAcc.y = bikeSync.mc_back_wheel.addedAcc.y + ((_local2.y * engine.gravity) * perc);
}
} else if (Key.isDown(CMan.RIGHT_BUTTON)) {
_local2 = calcBikeNVector();
if (_local2.y > 0) {
perc = (Math.abs(_local2.y) * 0.2) + 0.8;
bikeSync.mc_forward_wheel.addedAcc.x = bikeSync.mc_forward_wheel.addedAcc.x + (((_local2.x * engine.gravity) / 2.5) * perc);
bikeSync.mc_forward_wheel.addedAcc.y = bikeSync.mc_forward_wheel.addedAcc.y + ((_local2.y * engine.gravity) * perc);
bikeSync.mc_back_wheel.addedAcc.x = bikeSync.mc_back_wheel.addedAcc.x - (((_local2.x * engine.gravity) / 2.1) * perc);
bikeSync.mc_back_wheel.addedAcc.y = bikeSync.mc_back_wheel.addedAcc.y - (((_local2.y * engine.gravity) * 2.3) * perc);
}
}
engine.process();
bikeSync.process();
objCamera.process();
back1.process(mc_level.mc._x);
back2.process(mc_level.mc._x);
mc_level.mc.mc_fon._x = -mc_level.mc._x;
if ((bikeSync.mc_bike._x + mc_level.mc.mc_bike._x) >= mc_level.mc.mc_finish._x) {
if (!stopSoundFlag) {
mc_sloop.gotoAndStop(3);
}
if (level < 20) {
mc_message.gotoAndStop("win");
gameState = 2;
} else {
mc_message.gotoAndStop("complete");
gameState = 3;
}
addLevelScores();
mc_message.levelTime = getTimeString(levelTimeCounter);
mc_message.commonTime = getTimeString(timeCounter);
mc_message.scores = scores;
bikeSync.mc_bike.mc.mc_body_man.mc.stopAnim();
bikeSync.mc_bike.mc.mc_body_man.mc.stopMCAnim();
} else {
var _local1 = {x:0, y:0};
var _local3 = bikeSync.mc_bike.mc.mc_body_man.mc.mc.h;
_local1.x = _local3.p._x;
_local1.y = _local3.p._y;
_local3.localToGlobal(_local1);
if (mc_level.mc.mc_hit.hitTest(_local1.x, _local1.y, true)) {
loose();
} else {
_local3 = bikeSync.mc_bike.mc.mc_body_man.mc.mc.b;
_local1.x = _local3.p._x;
_local1.y = _local3.p._y;
_local3.localToGlobal(_local1);
if (mc_level.mc.mc_hit.hitTest(_local1.x, _local1.y, true)) {
loose();
} else {
_local3 = bikeSync.mc_bike.mc.mc_body_man.mc.mc.l;
_local1.x = _local3.p._x;
_local1.y = _local3.p._y;
_local3.localToGlobal(_local1);
if (mc_level.mc.mc_hit.hitTest(_local1.x, _local1.y, true)) {
loose();
}
}
}
}
}
}
function keyPressed() {
if (Key.isDown(32)) {
if (gameState == 2) {
nextLevel();
} else if (gameState == 1) {
replay();
}
} else if (Key.isDown(80)) {
if (gameState == 0) {
pauseGame();
} else if (gameState == 4) {
resume();
}
}
}
function addLevelScores() {
if (levelTimeCounter <= 15000) {
scores = scores + 500;
} else if (levelTimeCounter <= 80000) {
scores = scores + (100 + (300 * (1 - (levelTimeCounter / 70000))));
} else if (levelTimeCounter < 180000) {
scores = scores + 50;
}
scores = Math.round(scores);
}
function showTime() {
txtTime = getTimeString(timeCounter);
}
function getTimeString(time) {
var _local1 = Math.round(time / 1000);
var _local2 = Math.floor(_local1 / 60);
_local1 = _local1 - (_local2 * 60);
var _local3;
var secStr;
if (_local1 < 10) {
secStr = "0" + _local1;
} else {
secStr = "" + _local1;
}
if (_local2 < 10) {
_local3 = "0" + _local2;
} else {
_local3 = "" + _local2;
}
return((_local3 + ":") + secStr);
}
function resume() {
if (!stopSoundFlag) {
mc_sloop.gotoAndStop(2);
}
mc_message.gotoAndStop("empty");
bikeSync.mc_bike.mc.mc_body_man.mc.startAnim();
gameState = 0;
}
function pauseGame() {
if (!stopSoundFlag) {
mc_sloop.gotoAndStop(3);
}
mc_message.gotoAndStop("pause");
bikeSync.mc_bike.mc.mc_body_man.mc.stopAnim();
gameState = 4;
}
function loose() {
if (!stopSoundFlag) {
mc_sloop.gotoAndStop(3);
}
if (!stopSoundFlag) {
playSnd("lib_snd_fail");
}
mc_message.gotoAndStop("over");
mc_message.levelTime = getTimeString(levelTimeCounter);
mc_message.commonTime = getTimeString(timeCounter);
mc_message.scores = scores;
bikeSync.mc_bike.mc.mc_body_man.mc.stopAnim();
bikeSync.mc_bike.mc.mc_body_man.mc.stopMCAnim();
gameState = 1;
}
function calcBikeNVector() {
var _local1;
_local1 = bikeSync.mc_forward_wheel.particle.pos.minusNew(bikeSync.mc_back_wheel.particle.pos);
_local1.normalize();
var _local2;
_local2 = _local1.x;
_local1.x = -_local1.y;
_local1.y = _local2;
return(_local1);
}
var author = "www.iriysoft.ru";
var lastTimer;
var level;
var stopSoundFlag = false;
var bikeSync = 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;
#endinitclip
Symbol 46 MovieClip [lib_back_wheel] Frame 1
#initclip 13
Object.registerClass("lib_back_wheel", CWheel);
#endinitclip
Symbol 53 MovieClip [lib_forward_wheel] Frame 1
#initclip 11
Object.registerClass("lib_forward_wheel", CWheel);
#endinitclip
Instance of Symbol 64 MovieClip in Symbol 66 MovieClip Frame 1
onClipEvent (load) {
gotoAndPlay (10);
}
Symbol 82 MovieClip Frame 7
this._parent.endMove();
Symbol 83 MovieClip Frame 7
this._parent.endMove();
Symbol 84 MovieClip Frame 7
this._parent.endMove();
Symbol 85 MovieClip Frame 7
this._parent.endMove();
Symbol 88 MovieClip [lib_man] Frame 1
#initclip 12
Object.registerClass("lib_man", CMan);
#endinitclip
this.stop();
Symbol 101 Button
on (release) {
gameStart();
}
Symbol 102 Button
on (release) {
this.gotoAndStop("rules");
}
Symbol 108 Button
on (release) {
this.gotoAndStop(2);
this._parent.highQuality = false;
_quality = "MEDIUM";
}
Symbol 110 Button
on (release) {
this.gotoAndStop(1);
this._parent.highQuality = true;
_quality = "HIGH";
}
Symbol 111 MovieClip Frame 1
this.stop();
Symbol 113 MovieClip Frame 1
stop();
Symbol 115 MovieClip Frame 1
stop();
Symbol 117 MovieClip Frame 1
stop();
Symbol 123 Button
on (press) {
this._parent.soundOff();
this.gotoAndStop(2);
}
Symbol 125 Button
on (press) {
this._parent.soundOn();
this.gotoAndStop(1);
}
Symbol 126 MovieClip Frame 1
this.stop();
Symbol 132 Button
on (release) {
this.gotoAndStop("main");
}
Symbol 249 Button
on (release) {
this._parent.newGame();
}
Symbol 252 Button
on (release) {
this._parent.nextLevel();
}
Symbol 261 Button
on (release) {
this._parent.replay();
}
Symbol 273 Button
on (release) {
_global.ipbSend();
}
Symbol 281 Button
on (release) {
this._parent.resume();
}