Section 1
//wav (addNitro.wav)
package addNitro {
import flash.media.*;
public dynamic class wav extends Sound {
}
}//package addNitro
Section 2
//DemageWindow_6 (Allcar_fla.DemageWindow_6)
package Allcar_fla {
import flash.display.*;
public dynamic class DemageWindow_6 extends MovieClip {
public function DemageWindow_6(){
addFrameScript(0, this.frame1);
}
function frame1(){
stop();
}
}
}//package Allcar_fla
Section 3
//DemageWindow_f_32 (Allcar_fla.DemageWindow_f_32)
package Allcar_fla {
import flash.display.*;
public dynamic class DemageWindow_f_32 extends MovieClip {
public function DemageWindow_f_32(){
addFrameScript(0, this.frame1);
}
function frame1(){
stop();
}
}
}//package Allcar_fla
Section 4
//DemageWindow_ford_28 (Allcar_fla.DemageWindow_ford_28)
package Allcar_fla {
import flash.display.*;
public dynamic class DemageWindow_ford_28 extends MovieClip {
public function DemageWindow_ford_28(){
addFrameScript(0, this.frame1);
}
function frame1(){
stop();
}
}
}//package Allcar_fla
Section 5
//IData (base.IData)
package base {
public interface IData {
function init():void;
function cleanup():void;
}
}//package base
Section 6
//IObject (base.IObject)
package base {
public interface IObject extends IData {
function update(:Number):void;
function enablePause(:Boolean=true):void;
}
}//package base
Section 7
//IView (base.IView)
package base {
import flash.display.*;
public interface IView {
function set view(D:\kobyz\work\swc\PEngine\src;base;IView.as:DisplayObjectContainer):void;
function get view():DisplayObjectContainer;
}
}//package base
Section 8
//KeyManager (base.KeyManager)
package base {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
public class KeyManager implements IObject {
protected var _keyStorage:Dictionary;
protected var _pKeyReceiver:DisplayObject;
public function KeyManager(){
super();
}
public function enablePause(enable_:Boolean=true):void{
}
public function cleanup():void{
_keyStorage = null;
if (_pKeyReceiver != null){
if (_pKeyReceiver.hasEventListener(KeyboardEvent.KEY_DOWN)){
_pKeyReceiver.removeEventListener(KeyboardEvent.KEY_DOWN, onKeyDown);
};
if (_pKeyReceiver.hasEventListener(KeyboardEvent.KEY_UP)){
_pKeyReceiver.removeEventListener(KeyboardEvent.KEY_UP, onKeyUp);
};
_pKeyReceiver = null;
};
}
public function keyIsReleased(keyCode:int):Boolean{
return ((_keyStorage[keyCode] == -2));
}
public function getKeyState(keyCode:int):int{
return (_keyStorage[keyCode]);
}
public function keyIsFirstPressed(keyCode:int):Boolean{
return ((_keyStorage[keyCode] == 1));
}
public function keysContaintFirstPressed(keysCode:Array):Boolean{
var val:int;
for each (val in keysCode) {
if (keyIsFirstPressed(val)){
return (true);
};
};
return (false);
}
public function keysContaintPressed(keysCode:Array):Boolean{
var val:int;
for each (val in keysCode) {
if (keyIsPressed(val)){
return (true);
};
};
return (false);
}
protected function onKeyDown(evnt:KeyboardEvent):void{
if ((((_keyStorage[evnt.keyCode] == null)) || ((_keyStorage[evnt.keyCode] < 0)))){
_keyStorage[evnt.keyCode] = 0;
};
}
public function init():void{
_keyStorage = new Dictionary();
}
public function keysContaintReleased(keysCode:Array):Boolean{
var val:int;
for each (val in keysCode) {
if (keyIsReleased(val)){
return (true);
};
};
return (false);
}
protected function onKeyUp(evnt:KeyboardEvent):void{
_keyStorage[evnt.keyCode] = -1;
}
public function update(deltaTime_:Number):void{
var charCode:*;
for (charCode in _keyStorage) {
if (_keyStorage[charCode] >= 0){
var _local5 = _keyStorage;
var _local6 = charCode;
var _local7 = (_local5[_local6] + 1);
_local5[_local6] = _local7;
} else {
if (_keyStorage[charCode] < 0){
_local5 = _keyStorage;
_local6 = charCode;
_local7 = (_local5[_local6] - 1);
_local5[_local6] = _local7;
};
};
};
}
public function keyIsPressed(keyCode:int):Boolean{
return ((_keyStorage[keyCode] > 0));
}
public function initKeyManager(keyReceiver_:DisplayObject):KeyManager{
_pKeyReceiver = keyReceiver_;
_pKeyReceiver.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDown);
_pKeyReceiver.addEventListener(KeyboardEvent.KEY_UP, onKeyUp);
return (this);
}
public static function create():KeyManager{
var mbr:KeyManager = new (KeyManager);
mbr.init();
return (mbr);
}
}
}//package base
Section 9
//wav (bonus.wav)
package bonus {
import flash.media.*;
public dynamic class wav extends Sound {
}
}//package bonus
Section 10
//wav (but.wav)
package but {
import flash.media.*;
public dynamic class wav extends Sound {
}
}//package but
Section 11
//wav (expl.wav)
package expl {
import flash.media.*;
public dynamic class wav extends Sound {
}
}//package expl
Section 12
//wav (hotShot.wav)
package hotShot {
import flash.media.*;
public dynamic class wav extends Sound {
}
}//package hotShot
Section 13
//wav (inGame.wav)
package inGame {
import flash.media.*;
public dynamic class wav extends Sound {
}
}//package inGame
Section 14
//flashIner_118 (Interf_fla.flashIner_118)
package Interf_fla {
import flash.display.*;
public dynamic class flashIner_118 extends MovieClip {
public function flashIner_118(){
addFrameScript(15, this.frame16);
}
function frame16(){
stop();
}
}
}//package Interf_fla
Section 15
//flashMoney_116 (Interf_fla.flashMoney_116)
package Interf_fla {
import flash.display.*;
public dynamic class flashMoney_116 extends MovieClip {
public function flashMoney_116(){
addFrameScript(10, this.frame11);
}
function frame11(){
stop();
}
}
}//package Interf_fla
Section 16
//flashNitro_117 (Interf_fla.flashNitro_117)
package Interf_fla {
import flash.display.*;
public dynamic class flashNitro_117 extends MovieClip {
public function flashNitro_117(){
addFrameScript(10, this.frame11);
}
function frame11(){
stop();
}
}
}//package Interf_fla
Section 17
//Gate_89 (Interf_fla.Gate_89)
package Interf_fla {
import flash.display.*;
public dynamic class Gate_89 extends MovieClip {
public var mcDG:MovieClip;
public function Gate_89(){
addFrameScript(19, this.frame20);
}
function frame20(){
stop();
}
}
}//package Interf_fla
Section 18
//GraphicsTriger_49 (Interf_fla.GraphicsTriger_49)
package Interf_fla {
import flash.display.*;
public dynamic class GraphicsTriger_49 extends MovieClip {
public var btLow:SimpleButton;
public var btHigh:SimpleButton;
public var btMed:SimpleButton;
public function GraphicsTriger_49(){
addFrameScript(0, this.frame1);
}
function frame1(){
stop();
}
}
}//package Interf_fla
Section 19
//iconRaceBonus_115 (Interf_fla.iconRaceBonus_115)
package Interf_fla {
import flash.display.*;
public dynamic class iconRaceBonus_115 extends MovieClip {
public var mcMoney:MovieClip;
public var mcNO2:MovieClip;
public var msShowFlash:MovieClip;
public function iconRaceBonus_115(){
addFrameScript(0, this.frame1);
}
function frame1(){
stop();
}
}
}//package Interf_fla
Section 20
//mapMark_67 (Interf_fla.mapMark_67)
package Interf_fla {
import flash.display.*;
public dynamic class mapMark_67 extends MovieClip {
public var mcC:MovieClip;
public var mcS:MovieClip;
public var mcHit:SimpleButton;
public function mapMark_67(){
addFrameScript(0, this.frame1);
}
function frame1(){
stop();
}
}
}//package Interf_fla
Section 21
//mcOnOff_50 (Interf_fla.mcOnOff_50)
package Interf_fla {
import flash.display.*;
public dynamic class mcOnOff_50 extends MovieClip {
public function mcOnOff_50(){
addFrameScript(0, this.frame1);
}
function frame1(){
stop();
}
}
}//package Interf_fla
Section 22
//mcWindMov_12 (Interf_fla.mcWindMov_12)
package Interf_fla {
import flash.display.*;
public dynamic class mcWindMov_12 extends MovieClip {
public var mcWind:MovieClip;
public function mcWindMov_12(){
addFrameScript(0, this.frame1, 17, this.frame18);
}
function frame18(){
stop();
}
function frame1(){
stop();
}
}
}//package Interf_fla
Section 23
//preload_129 (Interf_fla.preload_129)
package Interf_fla {
import flash.display.*;
public dynamic class preload_129 extends MovieClip {
public var hit:SimpleButton;
public var mcBar:MovieClip;
public function preload_129(){
addFrameScript(120, this.frame121);
}
function frame121(){
stop();
}
}
}//package Interf_fla
Section 24
//rezZaezd_96 (Interf_fla.rezZaezd_96)
package Interf_fla {
import flash.display.*;
public dynamic class rezZaezd_96 extends MovieClip {
public function rezZaezd_96(){
addFrameScript(0, this.frame1);
}
function frame1(){
stop();
}
}
}//package Interf_fla
Section 25
//SideSmoke_104 (Interf_fla.SideSmoke_104)
package Interf_fla {
import flash.display.*;
public dynamic class SideSmoke_104 extends MovieClip {
public function SideSmoke_104(){
addFrameScript(15, this.frame16);
}
function frame16(){
stop();
}
}
}//package Interf_fla
Section 26
//wav (intro.wav)
package intro {
import flash.media.*;
public dynamic class wav extends Sound {
}
}//package intro
Section 27
//wav (mine.wav)
package mine {
import flash.media.*;
public dynamic class wav extends Sound {
}
}//package mine
Section 28
//wav (Missle.wav)
package Missle {
import flash.media.*;
public dynamic class wav extends Sound {
}
}//package Missle
Section 29
//wav (MonetSound.wav)
package MonetSound {
import flash.media.*;
public dynamic class wav extends Sound {
}
}//package MonetSound
Section 30
//AllLevel (myEng.AllLevel)
package myEng {
import flash.display.*;
import flash.geom.*;
import base.*;
import flash.system.*;
public class AllLevel implements IData {
public var VehZone:MovieClip;
public var BonusZone:MovieClip;
public var startPoint:MovieClip;
public var VivZone:MovieClip;
public var SmokeZone:MovieClip;
public var numLev:int;
public var PicZone:MovieClip;
public var HitZone:MovieClip;
public static var AllLevelNum:Array = [[1, 6, 7, 8, 8, 6, 8, 12, 6, 7, 6, 6, 3, 2, 7, 6, 7, 8, 12, 6, 7, 6, 6, 2, 6, 8, 5, 5], [1, 7, 6, 10, 7, 6, 11, 9, 14, 6, 7, 3, 6, 2, 7, 7, 9, 11, 7, 8, 8, 7, 8, 10, 9, 8, 8, 8, 5, 5], [20, 22, 23, 22, 22, 26, 26, 26, 22, 23, 23, 26, 22, 23, 23, 22, 26, 26, 26, 22, 23, 23, 22, 23, 23, 22, 24, 25, 25, 24, 22, 21, 21, 21], [30, 32, 33, 32, 34, 35, 32, 32, 36, 37, 38, 32, 33, 33, 37, 36, 33, 32, 32, 33, 32, 36, 37, 32, 33, 33, 37, 38, 33, 32, 34, 35, 34, 33, 32, 35, 33, 31, 31, 31], [20, 22, 24, 23, 22, 23, 24, 27, 24, 23, 22, 25, 22, 26, 26, 26, 22, 23, 23, 26, 22, 23, 23, 22, 26, 26, 26, 22, 23, 23, 22, 23, 23, 22, 23, 27, 24, 25, 24, 24, 25, 22, 23, 21, 21, 21], [30, 32, 33, 32, 33, 34, 35, 32, 33, 33, 32, 38, 33, 36, 37, 32, 33, 33, 38, 33, 32, 37, 32, 33, 32, 36, 37, 38, 32, 33, 33, 34, 35, 33, 32, 32, 33, 32, 33, 33, 34, 35, 34, 34, 33, 33, 31, 31, 31], [40, 42, 42, 43, 48, 42, 43, 43, 44, 42, 43, 48, 44, 43, 45, 42, 42, 43, 48, 42, 43, 44, 43, 48, 42, 43, 43, 44, 42, 48, 44, 43, 44, 45, 42, 43, 43, 42, 43, 44, 45, 42, 43, 42, 43, 44, 42, 43, 43, 41, 41, 41], [40, 42, 42, 46, 42, 43, 43, 48, 42, 48, 42, 43, 44, 43, 46, 47, 42, 43, 48, 42, 43, 48, 43, 46, 46, 42, 43, 44, 45, 42, 46, 42, 43, 48, 43, 42, 43, 48, 42, 43, 43, 44, 42, 48, 43, 44, 43, 45, 42, 43, 43, 41, 41, 41], [1, 7, 6, 8, 6, 12, 13, 8, 13, 6, 7, 3, 6, 10, 11, 9, 8, 7, 14, 6, 7, 3, 6, 2, 7, 7, 9, 11, 7, 8, 8, 8, 7, 8, 14, 6, 7, 6, 7, 10, 9, 12, 12, 13, 6, 8, 6, 9, 7, 3, 2, 10, 10, 8, 5, 5, 5], [40, 42, 42, 43, 42, 45, 42, 46, 46, 42, 43, 48, 44, 43, 45, 42, 42, 43, 48, 42, 43, 44, 43, 47, 43, 44, 42, 46, 46, 46, 42, 43, 43, 47, 42, 44, 45, 45, 44, 42, 43, 43, 42, 43, 43, 43, 43, 43, 42, 43, 43, 41, 41, 41]];
public static var AllLevelBG:Array = [1, 1, 2, 3, 2, 3, 4, 4, 1, 3];
public static var AllLevelMd:Array = [1, 1, 2, 3, 2, 3, 2, 2, 1, 2];
public function AllLevel(){
super();
init();
}
public function onHitHitZona(_mc:MovieClip):Boolean{
var p:Point = _mc.localToGlobal(new Point(0, 0));
return (HitZone.hitTestPoint(p.x, p.y, true));
}
public function update():void{
}
public function redrawLevel():void{
myBonus.clearAll();
clearMC(HitZone);
clearMC(PicZone);
clearMC(BonusZone);
VivZone.removeChild(HitZone);
VivZone.removeChild(PicZone);
VivZone.removeChild(BonusZone);
VivZone.removeChild(startPoint);
HitZone = new MovieClip();
VivZone.addChild(HitZone);
HitZone.visible = false;
PicZone = new MovieClip();
VivZone.addChild(PicZone);
VivZone.setChildIndex(VehZone, (VivZone.numChildren - 1));
BonusZone = new MovieClip();
VivZone.addChild(BonusZone);
SmokeZone = new MovieClip();
VivZone.addChild(SmokeZone);
cSmoke.init(SmokeZone);
buildLevel();
PicZone.cacheAsBitmap = true;
}
public function addSegment(px:int, py:int, num:int, iii:int):Point{
var spr:MovieClip = new (getLibraryClass(("pic_" + String(num))));
if (spr.totalFrames > 1){
spr.gotoAndStop(((iii % spr.totalFrames) + 1));
};
var clipContentsBound:Rectangle = spr.getBounds(spr);
var bitmapData:BitmapData = new BitmapData(clipContentsBound.width, clipContentsBound.height, true, 0);
var mat:Matrix = new Matrix();
mat.translate(-(clipContentsBound.x), -(clipContentsBound.y));
bitmapData.draw(spr, mat);
spr.graphics.clear();
var bitmap:Bitmap = new Bitmap(bitmapData);
bitmap.x = clipContentsBound.x;
bitmap.y = clipContentsBound.y;
spr = new MovieClip();
spr.addChild(bitmap);
PicZone.addChild(spr);
spr.x = px;
spr.y = py;
spr.cacheAsBitmap = true;
spr.stop();
spr = new (getLibraryClass(("hit_" + String(num))));
HitZone.addChild(spr);
spr.x = px;
spr.y = py;
spr.stop();
spr.cacheAsBitmap = true;
var t:MovieClip = (spr.getChildByName("endPoint") as MovieClip);
t.visible = false;
var p:Point = new Point(t.x, t.y);
p = spr.localToGlobal(p);
p = HitZone.globalToLocal(p);
spr = new (getLibraryClass(("bonus_" + String(num))));
BonusZone.addChild(spr);
spr.x = px;
spr.y = py;
spr.stop();
initBonus(spr);
return (p);
}
public function initLevel(viv:MovieClip, num:int):void{
VivZone = new MovieClip();
viv.addChild(VivZone);
VivZone.tabEnabled = false;
VivZone.tabChildren = false;
numLev = num;
PicZone = new MovieClip();
VivZone.addChild(PicZone);
HitZone = new MovieClip();
VivZone.addChild(HitZone);
HitZone.visible = false;
VehZone = new MovieClip();
VivZone.addChild(VehZone);
BonusZone = new MovieClip();
VivZone.addChild(BonusZone);
SmokeZone = new MovieClip();
VivZone.addChild(SmokeZone);
myBonus.clearAll();
cSmoke.init(SmokeZone);
}
public function init():void{
}
public function buildLevel():void{
var p:Point = new Point(0, 0);
var i:int;
while (i < (AllLevelNum[numLev] as Array).length) {
p = addSegment(p.x, p.y, AllLevelNum[numLev][i], i);
i++;
};
startPoint = new MovieClip();
VivZone.addChild(startPoint);
startPoint.x = 400;
startPoint.y = 300;
}
public function clearMC(mcE:MovieClip):void{
if (mcE != null){
while (mcE.numChildren > 0) {
mcE.removeChildAt(0);
};
mcE.graphics.clear();
};
}
public function cleanup():void{
VivZone.removeChild(PicZone);
PicZone = null;
myBonus.clearAll();
VivZone.removeChild(BonusZone);
BonusZone = null;
cSmoke.destroy();
VivZone.removeChild(SmokeZone);
SmokeZone = null;
VivZone.removeChild(HitZone);
HitZone = null;
VivZone.parent.removeChild(VivZone);
VivZone = null;
}
public function initBonus(BZona:MovieClip):void{
var d:Object;
var ar:Array = [];
var i:int;
while (i < BZona.numChildren) {
d = BZona.getChildAt(i);
if ((d as myBonus) != null){
ar.push(d);
};
i++;
};
i = 0;
while (i < ar.length) {
ar[i].init();
i++;
};
ar = [];
}
public static function getLibraryClass(linkageName_:String):Class{
return ((ApplicationDomain.currentDomain.getDefinition(linkageName_) as Class));
}
public static function mc2pic(spr:MovieClip):void{
var clipContentsBound:Rectangle = spr.getBounds(spr);
var bitmapData:BitmapData = new BitmapData(clipContentsBound.width, clipContentsBound.height, true, 0);
var mat:Matrix = new Matrix();
mat.translate(-(clipContentsBound.x), -(clipContentsBound.y));
bitmapData.draw(spr, mat);
while (spr.numChildren > 0) {
spr.removeChildAt(0);
};
spr.graphics.clear();
var bitmap:Bitmap = new Bitmap(bitmapData);
bitmap.x = clipContentsBound.x;
bitmap.y = clipContentsBound.y;
spr.addChild(bitmap);
}
}
}//package myEng
Section 31
//cBar (myEng.cBar)
package myEng {
import flash.display.*;
public class cBar {
protected var _val:Number;
public var max:int;
public var mc:MovieClip;
public var autoUpdate:Boolean;
public function cBar(){
super();
}
public function set value(val:Number):void{
_val = Math.min(max, Math.max(0, val));
if (autoUpdate){
mc.gotoAndStop((int(((100 / max) * _val)) + 1));
};
}
public function get value():Number{
return (_val);
}
public function init(_mc:MovieClip):void{
mc = _mc;
max = 100;
value = 0;
autoUpdate = true;
}
public function update():void{
var r:int = (mc.currentFrame + int(((int(((100 / max) * _val)) - mc.currentFrame) / 2)));
mc.gotoAndStop((r + 1));
}
public function cleanup():void{
mc = null;
}
}
}//package myEng
Section 32
//CCamera (myEng.CCamera)
package myEng {
import flash.display.*;
import flash.geom.*;
public class CCamera {
protected var m_window:Rectangle;
public var updateView:Function;
public var checkPosition:Function;
private var _data:Object;
protected var t_curPos:Point;
protected var t_deltaMin:Point;
protected var t_deltaPos:Point;
public var getTargetX:Function;
public var getTargetY:Function;
protected var t_deltaMax:Point;
protected var m_rangeBorder:Rectangle;
public function CCamera(){
super();
t_curPos = new Point();
t_deltaPos = new Point();
t_deltaMin = new Point();
t_deltaMax = new Point();
}
public function update():void{
t_curPos.x = getTargetX();
t_curPos.y = getTargetY();
t_deltaMin.x = (m_rangeBorder.x - m_window.x);
t_deltaMin.y = (m_rangeBorder.y - m_window.y);
t_deltaMax.x = (m_rangeBorder.bottomRight.x - m_window.x);
t_deltaMax.y = (m_rangeBorder.bottomRight.y - m_window.y);
convertToWindowPos(t_curPos);
t_deltaPos = checkPosition(t_curPos);
t_deltaPos.x = Math.min(t_deltaPos.x, t_deltaMax.x);
t_deltaPos.y = Math.min(t_deltaPos.y, t_deltaMax.y);
t_deltaPos.x = Math.max(t_deltaPos.x, t_deltaMin.x);
t_deltaPos.y = Math.max(t_deltaPos.y, t_deltaMin.y);
m_window.offsetPoint(t_deltaPos);
updateView();
}
public function get rangeBorder():Rectangle{
return (m_rangeBorder);
}
public function set rangeBorder(newBorder:Rectangle):void{
m_rangeBorder = newBorder;
}
public function createDefaultUpdateView(movieForScroll:Sprite):void{
var movieForScroll = movieForScroll;
_data["m_movieForScroll"] = movieForScroll;
updateView = function ():void{
_data.m_movieForScroll.x = (_data.m_movieForScroll.x - ((_data.m_movieForScroll.x + window.x) / 2));
_data.m_movieForScroll.y = (_data.m_movieForScroll.y - ((_data.m_movieForScroll.y + window.y) / 2));
};
}
public function convertToWindowPos(pos:Point):void{
pos.x = (pos.x - m_window.x);
pos.y = (pos.y - m_window.y);
}
public function set window(newWindow:Rectangle):void{
m_window = newWindow;
}
public function createDefaultScroll(target:Sprite, targetBorderOnScreen:Rectangle):void{
var target = target;
var targetBorderOnScreen = targetBorderOnScreen;
_data = new Object();
_data["t_moveCamera"] = new Point();
_data["m_target"] = target;
_data["m_targetBorderOnScreen"] = targetBorderOnScreen;
getTargetX = function ():Number{
return (_data.m_target.x);
};
getTargetY = function ():Number{
return (_data.m_target.y);
};
checkPosition = function (posAtWindow:Point):Point{
_data.t_moveCamera.x = 0;
_data.t_moveCamera.y = 0;
if (posAtWindow.x < _data.m_targetBorderOnScreen.left){
_data.t_moveCamera.x = (posAtWindow.x - _data.m_targetBorderOnScreen.left);
} else {
if (posAtWindow.x > _data.m_targetBorderOnScreen.right){
_data.t_moveCamera.x = (posAtWindow.x - _data.m_targetBorderOnScreen.right);
};
};
if (posAtWindow.y < _data.m_targetBorderOnScreen.top){
_data.t_moveCamera.y = (posAtWindow.y - _data.m_targetBorderOnScreen.top);
} else {
if (posAtWindow.y > _data.m_targetBorderOnScreen.bottom){
_data.t_moveCamera.y = (posAtWindow.y - _data.m_targetBorderOnScreen.bottom);
};
};
return (_data.t_moveCamera);
};
}
public function cleanup():void{
t_curPos = null;
t_deltaPos = null;
t_deltaMin = null;
t_deltaMax = null;
_data = null;
}
public function get window():Rectangle{
return (m_window);
}
}
}//package myEng
Section 33
//cCar (myEng.cCar)
package myEng {
import flash.display.*;
import pengine.*;
import flash.geom.*;
import base.*;
public class cCar extends MovieClip {
public var _param:CarData;
protected var _shildTimer:int;
private var __tmpPoint:Point;
protected var _curBonus:int;
protected var _vehicleNormal:Vector2D;
protected var _smokeTimer:int;
protected var _nitroCount:int;
protected var _money:int;
protected var _vehicleMovie:DisplayObject;
protected var _wheelForward:Wheel;
protected var _inFireTimer:int;
protected var _carBody:carBody;
protected var _numDemEng:int;
protected var _wheelBack:Wheel;
protected var _vehicleAngle:Number;
protected var _vehicleDir:Vector2D;
public var firstInRace:Boolean;
protected var _nitroTimer:int;
protected var _demagBody:int;
public static const DIR_LEFT:int = 1;
public static const DIR_RIGHT:int = 0;
public static const VAL_180_DIV_PI:Number = 57.2957795130823;
public function cCar(){
__tmpPoint = new Point();
super();
}
public function set money(value:int):void{
_money = value;
cRacePanel.Score = (cRacePanel.Score + 200);
cSmoke.addTextPart("Money +500", (wheelForward.view as MovieClip));
cRacePanel.inst.mcIconMoney.gotoAndPlay(1);
cRacePanel.inst.mcIconMoney.visible = true;
SoundConst._playSound(SoundConst.MONEY);
}
public function get wheelBack():Wheel{
return (_wheelBack);
}
public function processKey(keyManager:KeyManager):void{
if (keyManager.keyIsPressed(KeyConst.KEY_UP)){
accelerate(1);
} else {
if (keyManager.keyIsPressed(KeyConst.KEY_DOWN)){
brake();
} else {
stopAccelerate();
};
};
if (keyManager.keyIsPressed(KeyConst.KEY_RIGHT)){
turnRight();
} else {
if (keyManager.keyIsPressed(KeyConst.KEY_LEFT)){
turnLeft();
};
};
if (keyManager.keyIsPressed(KeyConst.KEY_NITRO)){
startNitro();
};
if (keyManager.keyIsPressed(KeyConst.KEY_JUMP)){
startBonus();
};
}
public function checkDemag(_hitZone:DisplayObject):void{
var p:Point = new Point(_param.mcC.x, _param.mcC.y);
p = _param.mcC.parent.localToGlobal(p);
if (_hitZone.hitTestPoint(p.x, p.y, true)){
setDemag(6);
};
}
public function init():void{
_vehicleDir = new Vector2D(0, 0);
_vehicleNormal = new Vector2D(0, 0);
__tmpPoint = new Point();
firstInRace = false;
_shildTimer = 0;
_smokeTimer = 0;
_inFireTimer = 0;
_numDemEng = 1;
}
public function getSpeed():Number{
return ((_wheelForward.pos.minusNew(_wheelForward.prevPos) as Vector2D).modul());
}
public function updateVehicleViewTriangle(_skeleton:TriangleSkeleton):void{
__tmpPoint.x = _param.mcC.x;
__tmpPoint.y = _param.mcC.y;
__tmpPoint = _param.mcC.parent.localToGlobal(__tmpPoint);
__tmpPoint = _vehicleMovie.parent.globalToLocal(__tmpPoint);
_vehicleMovie.x = (_vehicleMovie.x + (_skeleton.C.pos.x - __tmpPoint.x));
_vehicleMovie.y = (_vehicleMovie.y + (_skeleton.C.pos.y - __tmpPoint.y));
}
public function turnRight():void{
turnTo(DIR_RIGHT, _param.turnPower);
}
protected function updatePosition():void{
_vehicleDir.init((_wheelForward.pos.x - _wheelBack.pos.x), (_wheelForward.pos.y - _wheelBack.pos.y));
_vehicleNormal.init(_vehicleDir.x, _vehicleDir.y);
_vehicleNormal.normalize();
var t_buffNumber:Number = _vehicleNormal.x;
_vehicleNormal.x = -(_vehicleNormal.y);
_vehicleNormal.y = t_buffNumber;
_vehicleAngle = (Math.atan2(_vehicleDir.y, _vehicleDir.x) * VAL_180_DIV_PI);
_vehicleMovie.rotation = _vehicleAngle;
}
public function get body():DisplayObject{
return (_vehicleMovie);
}
public function cleanup():void{
_vehicleDir = null;
_vehicleNormal = null;
_wheelBack.cleanup();
_wheelBack = null;
_wheelForward.cleanup();
_wheelForward = null;
_vehicleMovie = null;
if (_param != null){
_param.cleanup();
_param = null;
};
}
public function rotateMovieToMovieLocal(movie:DisplayObject, moviePos:DisplayObject):void{
movie.rotation = (Math.atan2((moviePos.y - movie.y), (moviePos.x - movie.x)) * VAL_180_DIV_PI);
}
protected function get _skeleton():TriangleSkeleton{
return (_param.skeleton);
}
protected function changeSkeletonGeometry():void{
_skeleton.changeTriangleGeometry(getVehiclePoint(_param.mcA), getVehiclePoint(_param.mcB), getVehiclePoint(_param.mcC));
}
protected function getVehiclePoint(mc:DisplayObject):Point{
var p:Point = new Point(mc.x, mc.y);
p = mc.parent.localToGlobal(p);
p = _vehicleMovie.parent.globalToLocal(p);
return (p);
}
public function startNitroCPU():void{
}
public function showDemag():void{
cRacePanel.inst.barDemag.value = _demagBody;
}
public function get money():int{
return (_money);
}
public function get NitroCount():int{
return (_nitroCount);
}
public function inSmoke():void{
_inFireTimer = 15;
}
public function brake():void{
_wheelBack.setAccelerate(_param.wheelBackBrake);
_wheelForward.setAccelerate(_param.wheelForwardBrake);
}
public function update(deltaTime_:Number):void{
baseUpdate();
if (_demagBody <= 0){
_shildTimer--;
if ((_shildTimer % 4) > 1){
body.alpha = 0.1;
} else {
body.alpha = 1;
};
_inFireTimer = 100;
accelerate(0);
if (_shildTimer > -30){
return;
};
body.alpha = 1;
_demagBody = _param.maxLiveBody;
_numDemEng = 0;
_money = 0;
_inFireTimer = 0;
setBonus(0);
SoundConst._playSound(SoundConst.REPAIR);
resetAt(body.x, (body.y - 100));
setDemag(0);
_shildTimer = 20;
} else {
if (_demagBody < _param.maxLiveBody){
cSmoke.addEngineDemageSmoke(_param.SmokePoint);
if (_numDemEng > 2){
cSmoke.addEngineDemageSmoke(_param.SmokePoint);
};
if (_numDemEng > 3){
cSmoke.addEngineDemageSmoke(_param.SmokePoint);
};
if (Math.random() > (1 - (_numDemEng / 5))){
_demagBody = (_demagBody + (3 + _numDemEng));
setDemag(0);
};
};
};
if (_nitroTimer > 0){
_nitroTimer--;
cSmoke.addPuff((_wheelBack.view as MovieClip));
if (_nitroTimer <= 0){
cRacePanel.inst.mcNitroInd["flmc"].visible = false;
};
};
if (_shildTimer > 0){
_shildTimer--;
if ((_shildTimer % 4) > 1){
body.alpha = 0.5;
} else {
body.alpha = 1;
};
};
if (_smokeTimer > 0){
_smokeTimer--;
cSmoke.addSmoke((_wheelBack.view as MovieClip));
onSmoke();
};
}
public function turnLeft():void{
turnTo(DIR_LEFT, _param.turnPower);
}
public function startNitro():void{
if (_nitroTimer > 10){
return;
};
if (NitroCount > 0){
NitroCount--;
_nitroTimer = (_nitroTimer + int(_param.NitroPower));
};
}
public function constructVehicle(pEngine_:ParticleEngine, vehicleZone_:DisplayObjectContainer):void{
_param.makeVehicleView(vehicleZone_);
_skeleton.addToEngine(pEngine_);
}
public function turnTo(dir:Number, turnPower:Number):void{
var Coeff:Number = (((Math.abs(_vehicleNormal.y) * (1 - _param.turnAccCoeff)) + _param.turnAccCoeff) * turnPower);
var dxDown:Number = (_vehicleNormal.x * Coeff);
var dyDown:Number = (_vehicleNormal.y * Coeff);
var dxUp:Number = (-(dxDown) * _param.turnCoeffUp);
var dyUp:Number = (-(dyDown) * _param.turnCoeffUp);
dxDown = (dxDown * _param.turnCoeffDown);
dyDown = (dyDown * _param.turnCoeffDown);
if (_vehicleNormal.y > _param.turnYLimit){
if (dir == DIR_RIGHT){
if (!_wheelForward.hasIntersection()){
_wheelForward.accelerate.plusXY(dxDown, dyDown);
};
_wheelBack.accelerate.plusXY(dxUp, dyUp);
} else {
_wheelForward.accelerate.plusXY(dxUp, dyUp);
if (!_wheelBack.hasIntersection()){
_wheelBack.accelerate.plusXY(dxDown, dyDown);
};
};
};
}
public function accelerate(multParam_:Number=1):void{
if (_nitroTimer > 0){
_wheelForward.accelerate.plusXY(_param.NitroPower, 0);
multParam_ = (2 * multParam_);
} else {
_wheelForward.accelerate.plusXY(((_param.NitroPower / 5) * multParam_), 0);
multParam_ = (multParam_ * 1.5);
};
if (_inFireTimer > 0){
_inFireTimer--;
stopAccelerate();
return;
};
multParam_ = Math.max(0, (multParam_ * ((_demagBody / _param.maxLiveBody) + 0.2)));
_wheelBack.setAccelerate((multParam_ * _param.wheelBackAccelerate));
_wheelForward.setAccelerate((multParam_ * _param.wheelForwardAccelerate));
}
public function onGround():Boolean{
return (((_wheelBack.hasIntersection()) || (_wheelForward.hasIntersection())));
}
public function onSmoke():void{
if (Math.abs(((body.x - 500) - allScr.myCurState._CPUvehicle.body.x)) < 300){
allScr.myCurState._CPUvehicle.inSmoke();
};
}
public function moveMovieToMovieGlobal(movie:DisplayObject, moviePos:DisplayObject):void{
var p:Point = new Point();
p.x = 0;
p.y = 0;
p = movie.localToGlobal(p);
p = moviePos.parent.globalToLocal(p);
moviePos.x = p.x;
moviePos.y = p.y;
}
public function resetAt(x_:Number, y_:Number):void{
_vehicleMovie.x = x_;
_vehicleMovie.y = y_;
_vehicleMovie.rotation = 0;
_vehicleAngle = 0;
changeSkeletonGeometry();
}
public function setBonus(n:int):void{
cRacePanel.inst.showBonus(n);
_curBonus = n;
}
public function getBonus():void{
setBonus(0);
SoundConst._playSound(SoundConst.BONUSsound);
var ar:Array = [];
if (_demagBody < _param.maxLiveBody){
ar.push(4);
if (!firstInRace){
ar.push(4, 4, 4, 4, 4);
};
};
if (_demagBody < (_param.maxLiveBody / 2)){
ar.push(4, 4, 4, 4, 4, 4);
};
if (firstInRace){
ar.push(1, 1, 0, 0, 7, 7, 7);
} else {
ar.push(3, 5, 5, 2, 2, 5);
if (_nitroCount < _param.maxNitro){
ar.push(6, 6, 6, 6, 6);
};
};
if (_nitroCount < _param.maxNitro){
if (_nitroCount < 2){
ar.push(6);
};
ar.push(6);
};
var r:int = ar[int((Math.random() * ar.length))];
if (r == 0){
setBonus(1);
};
if (r == 1){
setBonus(2);
};
if (r == 2){
setBonus(3);
};
if (r == 3){
setBonus(4);
};
if (r == 4){
_demagBody = _param.maxLiveBody;
setDemag(0);
SoundConst._playSound(SoundConst.REPAIR);
};
if (r == 5){
setBonus(5);
};
if (r == 6){
NitroCount++;
};
if (r == 7){
money = (money + 500);
};
}
public function checkDeadPoint(_hitZone:DisplayObject, contDeadPoint_:DisplayObjectContainer):Boolean{
var i:String;
var d2:DisplayObject;
var p:Point;
var rez:Boolean;
for (i in contDeadPoint_) {
d2 = contDeadPoint_.getChildByName(i);
p = new Point(d2.x, d2.y);
p = d2.parent.localToGlobal(p);
rez = ((rez) || (_hitZone.hitTestPoint(p.x, p.y, true)));
};
return (rez);
}
public function startBonus():void{
if (_curBonus == 0){
return;
};
cRacePanel.Score = (cRacePanel.Score + (_curBonus * 53));
if (_curBonus == 1){
_smokeTimer = (15 + int((_param.effectWeapon / 2)));
};
if (_curBonus == 2){
myMine.start(this, allScr.myCurState._CPUvehicle);
};
if (_curBonus == 3){
SoundConst._playSound(SoundConst.SHILD);
_shildTimer = (25 + int((_param.effectWeapon / 2)));
};
if (_curBonus == 4){
myMolotov.start(this, allScr.myCurState._CPUvehicle);
};
if (_curBonus == 5){
myMissel.start(this, allScr.myCurState._CPUvehicle);
};
setBonus(0);
}
public function set NitroCount(value:int):void{
if (value > _nitroCount){
SoundConst._playSound(SoundConst.ADDNITRO);
cRacePanel.inst.mcIconNitro.visible = true;
cRacePanel.inst.mcIconNitro.gotoAndPlay(1);
} else {
SoundConst._playSound(SoundConst.NITRO);
cRacePanel.inst.mcNitroInd["flmc"].visible = true;
};
_nitroCount = Math.min(value, _param.maxNitro);
cRacePanel.inst.mcNitroInd.gotoAndStop((_nitroCount + 1));
}
public function setDemag(v:int):void{
if (_shildTimer > 0){
return;
};
_demagBody = (_demagBody - v);
if (v > 0){
_inFireTimer = int((35 * (1.5 - (_demagBody / _param.maxLiveBody))));
};
var b = 1;
if (_demagBody < 90){
b = 2;
};
if (_demagBody < 50){
b = 3;
};
if (_demagBody < 10){
b = 4;
};
_param.demWindMC.gotoAndStop(b);
_numDemEng = (b - 1);
showDemag();
}
public function get wheelForward():Wheel{
return (_wheelForward);
}
public function baseUpdate():void{
updatePosition();
updateVehicleViewTriangle(_skeleton);
}
public function initVehicle(StringParam_:String, pEngine_:ParticleEngine, vehicleZone_:DisplayObjectContainer):cCar{
init();
_param = new CarData();
_param.initInString(StringParam_);
_param.init4Game();
_param.vehicleView.scaleX = 0.3;
_param.vehicleView.scaleY = 0.3;
_param.wheelBackView.scaleX = 0.3;
_param.wheelBackView.scaleY = 0.3;
_param.wheelFrontView.scaleX = 0.3;
_param.wheelFrontView.scaleY = 0.3;
_param.makeVehicleView(vehicleZone_);
_vehicleMovie = _param.vehicleView;
_param.createTriangl();
_wheelBack = Wheel(_skeleton.B);
_wheelBack.view = _param.wheelBackView;
_wheelBack.setRotationMovie(_param.wheelBackSpoke);
_wheelForward = Wheel(_skeleton.A);
_wheelForward.view = _param.wheelFrontView;
_wheelForward.setRotationMovie(_param.wheelFrontSpoke);
_skeleton.addToEngine(pEngine_);
Wheel._maxSpeed = 80000;
_demagBody = _param.maxLiveBody;
_nitroCount = _param.maxNitro;
setBonus(0);
return (this);
}
public function stopAccelerate():void{
_wheelBack.setAccelerate(0);
_wheelForward.setAccelerate(0);
}
}
}//package myEng
Section 34
//cCarCPU (myEng.cCarCPU)
package myEng {
public class cCarCPU extends cCar {
public var diff:int;
protected var _CPUNitroFlag:Boolean;
public function cCarCPU(){
super();
diff = scrMap.Diff;
_CPUNitroFlag = false;
}
override public function set money(value:int):void{
_money = value;
}
override public function startBonus():void{
if ((Math.random() * 13) > diff){
return;
};
var tx:Number = allScr.myCurState._vehicle.body.x;
if (_curBonus == 1){
if (Math.abs(((body.x - 500) - tx)) < 300){
_smokeTimer = 35;
setBonus(0);
};
};
if (_curBonus == 2){
if (body.x > tx){
myMine.start(this, allScr.myCurState._vehicle);
setBonus(0);
};
};
if (_curBonus == 3){
if (Math.abs((body.x - tx)) < 2300){
_shildTimer = 55;
setBonus(0);
};
};
if (_curBonus == 4){
if (Math.abs(((body.x + 500) - tx)) < 150){
myMolotov.start(this, allScr.myCurState._vehicle);
setBonus(0);
};
};
if (_curBonus == 5){
myMissel.start(this, allScr.myCurState._vehicle);
setBonus(0);
};
}
override public function get NitroCount():int{
return (super.NitroCount);
}
override public function update(deltaTime_:Number):void{
if ((Math.random() + (diff / 10)) > 0.6){
if ((allScr.myCurState._vehicle.body.x + 1500) > body.x){
accelerate(1);
};
if (Math.random() > 0.9){
accelerate(1);
};
};
if (allScr.myCurState._vehicle.body.x > (body.x + 500)){
accelerate(1);
if ((((_nitroTimer < 3)) && ((NitroCount > 0)))){
startNitroCPU();
};
};
if (_vehicleAngle < -0.03){
turnRight();
};
if (_vehicleAngle > 0.03){
turnLeft();
};
if (_curBonus > 0){
startBonus();
};
if (((_CPUNitroFlag) && (onGround()))){
_CPUNitroFlag = false;
startNitro();
};
super.update(deltaTime_);
}
override public function onSmoke():void{
if (Math.abs(((body.x - 500) - allScr.myCurState._vehicle.body.x)) < 300){
cRacePanel.Score = (cRacePanel.Score + 10);
allScr.myCurState._vehicle.inSmoke();
};
}
override public function set NitroCount(value:int):void{
_nitroCount = Math.min(value, _param.maxNitro);
}
override public function startNitroCPU():void{
if ((Math.random() * 11) > diff){
return;
};
_CPUNitroFlag = true;
}
override public function showDemag():void{
cRacePanel.inst.barCPUDemag.value = _demagBody;
}
override public function setBonus(n:int):void{
cRacePanel.inst.showBonusCPU(n);
_curBonus = n;
}
}
}//package myEng
Section 35
//cFinishBonus (myEng.cFinishBonus)
package myEng {
public class cFinishBonus extends myBonus {
public function cFinishBonus(){
super();
}
override public function init():void{
super.init();
visible = false;
cRacePanel.setFinishPos(myX);
}
override public function myHitTest(mc:cCar, n:int):void{
if (mc.body.x > myX){
allScr.myCurState.setFinishProcess();
};
}
}
}//package myEng
Section 36
//cRacePanel (myEng.cRacePanel)
package myEng {
import flash.events.*;
import flash.display.*;
import base.*;
import flash.text.*;
public class cRacePanel extends MovieClip implements IData {
protected var _pausa:Boolean;
protected var markGam:MovieClip;
public var barTah:cBar;
public var mcTimer:TextField;
public var mcIconMoney:MovieClip;
protected var iconTimer:int;
protected var markCPU:MovieClip;
public var barCPUDemag:cBar;
public var mcNitroInd:MovieClip;
public var mcIconCPUBonus:MovieClip;
public var mcIconNitro:MovieClip;
public var barDemag:cBar;
public var PausaMC:MovieClip;
public var mcIconBonus:MovieClip;
public var barSpeed:cBar;
protected var iconTimerCPU:int;
public static var Score:Number;
public static var maxSpeed:Number;
public static var inst:cRacePanel;
public static var myTimer:Number;
protected static var koof:Number;
public function cRacePanel(){
super();
inst = this;
}
public function btClicPausa(e:Event):void{
SoundConst._buttonClick();
if (_pausa){
PausaMC.gotoAndStop(2);
allScr.myCurState.setPausaUpdate(true);
_pausa = false;
} else {
PausaMC.gotoAndStop(1);
allScr.myCurState.setPausaUpdate(false);
_pausa = true;
};
}
public function update():void{
if (iconTimer > 0){
iconTimer--;
if (iconTimer <= 0){
mcIconBonus["msShowFlash"].visible = false;
mcIconBonus.gotoAndStop(1);
};
};
if (iconTimerCPU > 0){
iconTimerCPU--;
if (iconTimerCPU <= 0){
mcIconCPUBonus["msShowFlash"].visible = false;
mcIconCPUBonus.gotoAndStop(1);
};
};
barSpeed.update();
barDemag.update();
barCPUDemag.update();
myTimer = (myTimer + 0.04);
if (maxSpeed < barSpeed.value){
maxSpeed = barSpeed.value;
};
mcTimer.text = convertTimer(myTimer);
}
public function setPos(xC:Number, xP:Number):void{
markGam.x = (300 + (koof * xP));
markCPU.x = (300 + (koof * xC));
}
public function init():void{
iconTimer = 0;
barSpeed = new cBar();
barSpeed.init((this["mcSpeed"] as MovieClip));
barSpeed.autoUpdate = false;
barTah = new cBar();
barTah.init((this["mcTah"] as MovieClip));
barTah.autoUpdate = false;
barTah.mc.visible = false;
mcNitroInd = (this["mcNitro"] as MovieClip);
mcNitroInd.stop();
barDemag = new cBar();
barDemag.init((this["mcDemBar"] as MovieClip));
barDemag.autoUpdate = false;
barCPUDemag = new cBar();
barCPUDemag.init((this["mcCPUdemBar"] as MovieClip));
barCPUDemag.autoUpdate = false;
mcIconBonus = (this["mcIcon"] as MovieClip);
mcIconBonus.stop();
mcIconCPUBonus = (this["mcIconEnemy"] as MovieClip);
mcIconCPUBonus.stop();
mcIconNitro = (mcIconBonus["mcNO2"] as MovieClip);
mcIconMoney = (mcIconBonus["mcMoney"] as MovieClip);
(mcIconCPUBonus["mcNO2"] as MovieClip).visible = false;
(mcIconCPUBonus["mcMoney"] as MovieClip).visible = false;
mcIconNitro.visible = false;
mcIconMoney.visible = false;
markCPU = (this["mcCarCPU"] as MovieClip);
markGam = (this["mcCar"] as MovieClip);
var t:TextField = (this["mcLev"] as TextField);
t.text = ("LEVEL " + String((Main.curLev + 1)));
mcTimer = (this["mcTim"] as TextField);
maxSpeed = 0;
Score = 0;
myTimer = -0.04;
var s:SimpleButton = (this["btExit"] as SimpleButton);
s.addEventListener(MouseEvent.CLICK, exBt);
PausaMC = (this["btPausa"] as MovieClip);
PausaMC.stop();
s = (PausaMC["btHit"] as SimpleButton);
s.addEventListener(MouseEvent.CLICK, btClicPausa);
mcNitroInd["flmc"].visible = false;
var m:MovieClip = (this["mcIconCPUPers"] as MovieClip);
m.gotoAndStop((Main.curLev + 1));
_pausa = true;
}
public function exBt(e:Event):void{
SoundConst._buttonClick();
allScr.myCurState.setFinishProcess();
scrRez.Win = false;
scrRez.FindMoney = 0;
Score = 0;
}
public function showBonus(n:int):void{
if (n == 0){
iconTimer = 5;
if (mcIconBonus["msShowFlash"] == null){
return;
};
mcIconBonus["msShowFlash"].gotoAndPlay(1);
} else {
iconTimer = -1;
mcIconBonus.gotoAndStop((n + 1));
};
}
public function setPer(n:int):void{
var ss:TextField = (barTah.mc["mcNum"] as TextField);
ss.text = String(n);
}
public function cleanup():void{
var s:SimpleButton = (this["btExit"] as SimpleButton);
s.removeEventListener(MouseEvent.CLICK, exBt);
barDemag.cleanup();
barCPUDemag.cleanup();
barSpeed.cleanup();
barSpeed = null;
barCPUDemag = null;
barDemag = null;
mcNitroInd = null;
barTah = null;
mcTimer = null;
mcIconBonus = null;
mcIconCPUBonus = null;
markCPU = null;
markGam = null;
}
public function showBonusCPU(n:int):void{
if (n == 0){
iconTimerCPU = 10;
if (mcIconBonus["msShowFlash"] == null){
return;
};
mcIconCPUBonus["msShowFlash"].gotoAndPlay(1);
} else {
iconTimerCPU = -1;
mcIconCPUBonus.gotoAndStop((n + 1));
};
}
public function showDemag(_b:int, _t:int):void{
}
public static function convertTimer(newTime:Number):String{
if (newTime < 0){
return ("--:--:--");
};
var min:Number = Math.floor((newTime / 60));
var sec:Number = Math.floor((newTime % 60));
var msec:Number = Math.floor(((newTime - Math.floor(newTime)) * 100));
return (((((numberToStringWith0(min) + ":") + numberToStringWith0(sec)) + ":") + numberToStringWith0(msec)));
}
protected static function numberToStringWith0(val:Number):String{
if (val < 10){
return (String(("0" + val.toString())));
};
return (val.toString());
}
public static function setFinishPos(xp:Number):void{
koof = (337 / xp);
}
}
}//package myEng
Section 37
//cSmoke (myEng.cSmoke)
package myEng {
import flash.display.*;
import flash.geom.*;
public class cSmoke {
protected var myMC:MovieClip;
protected var speedScale:Number;
protected var lifeTime:int;
protected var MaxLifeTime:int;
protected var speedRot:Number;
protected var speedX:Number;
protected var speedVert:Number;
protected var speedY:Number;
protected var dWave:int;
public static var cont:MovieClip;
protected static var arraySmoke:Array = [];
public function cSmoke(){
super();
lifeTime = 0;
dWave = 0;
MaxLifeTime = 12;
speedRot = 0;
speedVert = 0;
speedScale = 0;
speedX = 0;
speedY = 0;
}
public function indiv():void{
}
public static function addTextPart(t:String, SObj_:MovieClip):void{
var p0:Point = SObj_.localToGlobal(new Point());
p0 = cont.globalToLocal(p0);
var f:cSmoke = new (cSmoke);
f.myMC = new partNum();
f.myMC["txt"].text = t;
cont.addChildAt(f.myMC, 0);
f.MaxLifeTime = 18;
f.myMC.x = p0.x;
f.myMC.y = p0.y;
f.speedRot = 0;
f.speedVert = -1;
f.speedScale = 0;
f.speedX = 10;
f.speedY = -2;
f.myMC.scaleX = 1;
f.myMC.scaleY = 1;
f.dWave = (15 + int((Math.random() * 15)));
arraySmoke.push(f);
}
public static function addPuff(SObj_:MovieClip):void{
var p0:Point = SObj_.localToGlobal(new Point());
p0 = cont.globalToLocal(p0);
arraySmoke.push(newPart(p0, 0.8, smokeMC));
p0.x = (p0.x + 5);
arraySmoke.push(newPart(p0, 0.6, smokeMC));
p0.x = (p0.x - 8);
arraySmoke.push(newPart(p0, 0.4, smokeMC));
}
public static function update():void{
var f:cSmoke;
var i:int;
while (i < arraySmoke.length) {
f = (arraySmoke[i] as cSmoke);
if (f.dWave > 0){
f.dWave++;
f.speedX = (((f.dWave % 15) - 7) * 3);
};
f.lifeTime++;
f.speedY = (f.speedY + f.speedVert);
f.myMC.x = (f.myMC.x + f.speedX);
f.myMC.y = (f.myMC.y + f.speedY);
f.myMC.scaleX = (f.myMC.scaleX + f.speedScale);
f.myMC.scaleY = (f.myMC.scaleY + f.speedScale);
f.myMC.rotation = (f.myMC.rotation + f.speedRot);
f.indiv();
if (f.lifeTime > f.MaxLifeTime){
cont.removeChild(f.myMC);
f.myMC = null;
f = null;
arraySmoke.splice(i, 1);
};
i++;
};
}
public static function addSmoke(SObj_:MovieClip):void{
var p0:Point = SObj_.localToGlobal(new Point());
p0 = cont.globalToLocal(p0);
var f:cSmoke = new (cSmoke);
f.myMC = new smokeMC();
cont.addChildAt(f.myMC, 0);
f.MaxLifeTime = 30;
f.myMC.x = p0.x;
f.myMC.y = p0.y;
f.speedRot = (8 + (Math.random() * 10));
f.speedVert = (-0.3 + Math.random());
f.speedScale = 0.2;
f.speedX = 2;
f.speedY = (-2 + (Math.random() * 4));
f.myMC.scaleX = 1;
f.myMC.scaleY = 1;
arraySmoke.push(f);
}
public static function init(cont_:Object):void{
cont = (cont_ as MovieClip);
var i:int;
while (i < arraySmoke.length) {
(arraySmoke[i] as cSmoke).myMC = null;
arraySmoke[i] = null;
i++;
};
arraySmoke = [];
}
public static function newPart(p0:Point, s:Number, cl:Class):cSmoke{
var f:cSmoke = new (cSmoke);
f.myMC = new (cl);
cont.addChildAt(f.myMC, 0);
f.MaxLifeTime = (10 + int((Math.random() * 4)));
f.myMC.alpha = 0.7;
f.myMC.x = (p0.x - (Math.random() * 15));
f.myMC.y = (p0.y + (Math.random() * 5));
f.myMC.scaleX = (((Math.random() * 0.29) + 0.2) * s);
f.myMC.scaleY = (((Math.random() * 0.29) + 0.2) * s);
f.myMC.rotation = (Math.random() * 180);
f.speedRot = ((Math.random() * 6) - 3);
f.speedVert = (-1 - (Math.random() / 2));
f.speedScale = (((Math.random() * 0.1) + 0.02) * s);
f.speedX = ((Math.random() * 4) - 2);
f.speedY = ((Math.random() * 5) + 2);
return (f);
}
public static function addExpl(SObj_:MovieClip):void{
var p0:Point = SObj_.localToGlobal(new Point());
p0 = cont.globalToLocal(p0);
var f:cSmoke = new (cSmoke);
f.myMC = new mcExpBig();
f.myMC.x = p0.x;
f.myMC.y = p0.y;
cont.addChildAt(f.myMC, 0);
f.MaxLifeTime = 13;
f.lifeTime = 0;
if (Math.random() > 0.5){
(f.myMC["ex2"] as MovieClip).visible = false;
};
if (Math.random() > 0.5){
(f.myMC["ex1"] as MovieClip).visible = false;
};
if (Math.random() > 0.5){
(f.myMC["ex3"] as MovieClip).visible = false;
};
f.speedX = 0;
f.speedY = -0.5;
arraySmoke.push(f);
}
public static function addEngineDemageSmoke(SObj_:MovieClip):void{
var p0:Point = SObj_.localToGlobal(new Point());
p0 = cont.globalToLocal(p0);
p0.x = (p0.x + ((Math.random() * 20) - 10));
arraySmoke.push(newPart(p0, 1, smokeMC));
}
public static function destroy():void{
var i:int;
while (i < arraySmoke.length) {
cont.removeChild((arraySmoke[i] as cSmoke).myMC);
arraySmoke[i] = null;
i++;
};
arraySmoke = [];
}
public static function addLevelFinish(SObj_:MovieClip):void{
var p0:Point = SObj_.localToGlobal(new Point());
p0 = cont.globalToLocal(p0);
var f:cSmoke = new (cSmoke);
f.myMC = new partNum();
f.myMC["txt"].text = "You Win! ";
cont.addChildAt(f.myMC, 0);
f.MaxLifeTime = 22;
f.myMC.x = p0.x;
f.myMC.y = p0.y;
f.speedRot = 0;
f.speedVert = -0.6;
f.speedScale = 0.1;
f.speedX = 0;
f.speedY = -2;
f.myMC.scaleX = 1;
f.myMC.scaleY = 1;
arraySmoke.push(f);
}
public static function addLevelText(SObj_:MovieClip):void{
var p0:Point = SObj_.localToGlobal(new Point());
p0 = cont.globalToLocal(p0);
var f:cSmoke = new (cSmoke);
f.myMC = new partNum();
f.myMC["txt"].text = ("Level " + String((Main.curLev + 1)));
cont.addChildAt(f.myMC, 0);
f.MaxLifeTime = 22;
f.myMC.x = p0.x;
f.myMC.y = p0.y;
f.speedRot = 0;
f.speedVert = -0.6;
f.speedScale = 0.1;
f.speedX = 0;
f.speedY = -2;
f.myMC.scaleX = 1;
f.myMC.scaleY = 1;
arraySmoke.push(f);
}
}
}//package myEng
Section 38
//myBonus (myEng.myBonus)
package myEng {
import flash.display.*;
public class myBonus extends MovieClip {
protected var active:Boolean;
protected var myNum:int;
protected var myX:Number;
public static var bonusList:Array = [];
public function myBonus(){
super();
}
public function init():void{
bonusList.push(this);
active = true;
myX = (this.x + this.parent.x);
myNum = (bonusList.length - 1);
}
public function destroy():void{
active = false;
bonusList[myNum] = null;
parent.removeChild(this);
}
public function myHitTest(mc:cCar, n:int):void{
if (!active){
};
}
public function setNormalState():void{
}
public static function AllNormalState():void{
var i:int;
while (i < bonusList.length) {
if (bonusList[i] != null){
(bonusList[i] as myBonus).setNormalState();
};
i++;
};
}
public static function clearAll():void{
var i:int;
while (i < bonusList.length) {
if (bonusList[i] != null){
(bonusList[i] as myBonus).destroy();
};
bonusList[i] = null;
i++;
};
bonusList = [];
}
public static function checkBonus(mc:cCar, mc1:cCar):void{
var i:int;
while (i < bonusList.length) {
if (Math.abs((bonusList[i].myX - mc.body.x)) < 2500){
(bonusList[i] as myBonus).myHitTest(mc, i);
};
if (Math.abs((bonusList[i].myX - mc1.body.x)) < 2500){
(bonusList[i] as myBonus).myHitTest(mc1, i);
};
i++;
};
}
}
}//package myEng
Section 39
//myMine (myEng.myMine)
package myEng {
import flash.geom.*;
public class myMine extends cSmoke {
protected var dem:int;
protected var tar:cCar;
public function myMine(){
super();
dWave = 0;
lifeTime = 0;
speedScale = 0;
MaxLifeTime = 210;
speedVert = 2.3;
speedRot = (15 + (Math.random() * 8));
}
override public function indiv():void{
var i:int;
if (((tar.body.hitTestObject(myMC)) || (tar.wheelForward.view.hitTestObject(myMC)))){
SoundConst._playSound(SoundConst.EXPL);
tar.setDemag(dem);
lifeTime = (lifeTime + MaxLifeTime);
myMC.visible = false;
cSmoke.addExpl(myMC);
};
if (allScr.myCurState._level.onHitHitZona(myMC)){
SoundConst._playSound(SoundConst.MINE);
speedX = 0;
speedY = 0;
speedVert = 0;
speedRot = 0;
myMC.y = (myMC.y - 4);
i = 0;
while (i < 10) {
if (allScr.myCurState._level.onHitHitZona(myMC)){
myMC.y = (myMC.y - 4);
};
i++;
};
};
}
public static function start(_st:cCar, _tar:cCar):void{
SoundConst._playSound(SoundConst.HOT);
var p0:Point = _st.body.localToGlobal(new Point());
p0 = cont.globalToLocal(p0);
var f:myMine = new (myMine);
f.myMC = new mcMine();
f.myMC.x = (p0.x - 150);
f.myMC.y = p0.y;
cont.addChildAt(f.myMC, 0);
f.speedX = ((_st.getSpeed() * 3) - 10);
f.speedY = -12;
f.tar = _tar;
f.dem = (((_st._param.effectWeapon * (0.5 + Math.random())) / 2) + 10);
arraySmoke.push(f);
f = new (myMine);
f.myMC = new mcMine();
f.myMC.x = (p0.x - 150);
f.myMC.y = p0.y;
cont.addChildAt(f.myMC, 0);
f.speedX = ((_st.getSpeed() * 3) - 14);
f.speedY = -8;
f.tar = _tar;
f.dem = (((_st._param.effectWeapon * (0.5 + Math.random())) / 2) + 10);
arraySmoke.push(f);
f = new (myMine);
f.myMC = new mcMine();
f.myMC.x = (p0.x - 150);
f.myMC.y = p0.y;
cont.addChildAt(f.myMC, 0);
f.speedX = ((_st.getSpeed() * 3) - 19);
f.speedY = -10;
f.tar = _tar;
f.dem = (((_st._param.effectWeapon * (0.5 + Math.random())) / 2) + 10);
arraySmoke.push(f);
}
}
}//package myEng
Section 40
//myMissel (myEng.myMissel)
package myEng {
import flash.display.*;
import flash.geom.*;
public class myMissel extends cSmoke {
protected var hit:MovieClip;
protected var mSmok:MovieClip;
public var tar:cCar;
protected var dem:int;
public function myMissel(){
super();
}
override public function indiv():void{
cSmoke.addPuff(mSmok);
if (lifeTime > 7){
speedX = (speedX + Math.max(Math.min(10, ((tar.body.x - myMC.x) / 8)), -10));
speedY = (speedY + Math.max(Math.min(5, ((tar.body.y - myMC.y) / 8)), -5));
};
if (Math.abs((tar.body.x - myMC.x)) > 500){
speedX = Math.max(Math.min(speedX, 190), -190);
} else {
speedX = Math.max(Math.min(speedX, 90), -90);
};
speedY = Math.max(Math.min(speedY, 35), -45);
myMC.rotation = (((Math.atan2(speedY, speedX) * 180) / 3.14) + 90);
if (tar.body.hitTestObject(hit)){
SoundConst._playSound(SoundConst.EXPL);
tar.setDemag(dem);
myMC.visible = false;
lifeTime = (lifeTime + MaxLifeTime);
cSmoke.addExpl(myMC);
};
}
public static function start(_st:cCar, _tar:cCar):void{
var p0:Point = _st.body.localToGlobal(new Point());
p0 = cont.globalToLocal(p0);
var f:myMissel = new (myMissel);
f.myMC = new mcMissel();
f.myMC.x = p0.x;
f.myMC.y = p0.y;
cont.addChildAt(f.myMC, 0);
f.dem = (_st._param.effectWeapon * (0.5 + Math.random()));
f.hit = (f.myMC["mcHit"] as MovieClip);
f.mSmok = (f.myMC["mcSmoke"] as MovieClip);
f.hit.visible = false;
f.mSmok.visible = false;
f.MaxLifeTime = 170;
f.speedX = 30;
f.speedY = -40;
f.speedRot = 0;
f.tar = _tar;
f.dWave = 0;
f.lifeTime = 0;
f.speedScale = 0;
f.speedVert = 0;
arraySmoke.push(f);
cSmoke.addPuff(f.mSmok);
cSmoke.addPuff(f.hit);
SoundConst._playSound(SoundConst.MISSEL);
}
}
}//package myEng
Section 41
//myMolotov (myEng.myMolotov)
package myEng {
import flash.display.*;
import flash.geom.*;
public class myMolotov extends cSmoke {
protected var hit:MovieClip;
protected var tar:cCar;
protected var dem:int;
public function myMolotov(){
super();
}
override public function indiv():void{
var i:int;
if (tar.body.hitTestObject(hit)){
SoundConst._playSound(SoundConst.EXPL);
tar.setDemag(dem);
lifeTime = (lifeTime + MaxLifeTime);
myMC.visible = false;
cSmoke.addExpl(myMC);
};
if (allScr.myCurState._level.onHitHitZona(myMC)){
i = 0;
while (i < 10) {
if (allScr.myCurState._level.onHitHitZona(myMC)){
myMC.y = (myMC.y - 4);
};
i++;
};
cSmoke.addExpl(myMC);
myMC.visible = false;
lifeTime = (lifeTime + MaxLifeTime);
};
}
public static function start(_st:cCar, _tar:cCar):void{
SoundConst._playSound(SoundConst.HOT);
var p0:Point = _st.body.localToGlobal(new Point());
p0 = cont.globalToLocal(p0);
var f:myMolotov = new (myMolotov);
f.myMC = new mcButle();
f.myMC.x = (p0.x + 50);
f.myMC.y = (p0.y - 50);
cont.addChildAt(f.myMC, 0);
f.hit = (f.myMC["mcHit"] as MovieClip);
f.dem = ((_st._param.effectWeapon * (0.5 + Math.random())) * 2);
f.MaxLifeTime = 110;
f.speedX = ((_st.getSpeed() * 3) + 60);
f.speedY = -5;
f.speedRot = (15 + (Math.random() * 8));
f.tar = _tar;
f.dWave = 0;
f.lifeTime = 0;
f.speedScale = 0;
f.speedVert = 1.3;
arraySmoke.push(f);
}
}
}//package myEng
Section 42
//myNitroCPU (myEng.myNitroCPU)
package myEng {
public class myNitroCPU extends myBonus {
public function myNitroCPU(){
super();
}
override public function init():void{
super.init();
this.visible = false;
}
override public function myHitTest(mc:cCar, n:int):void{
if (active){
if (mc.body.hitTestObject(this)){
active = false;
this.play();
mc.startNitroCPU();
};
};
}
}
}//package myEng
Section 43
//myRndBonus (myEng.myRndBonus)
package myEng {
public class myRndBonus extends myBonus {
protected var timerDown:int;
public function myRndBonus(){
super();
}
override public function init():void{
super.init();
}
override public function myHitTest(mc:cCar, n:int):void{
if (active){
if (mc.body.hitTestObject(this)){
active = false;
this.play();
mc.getBonus();
timerDown = 70;
};
} else {
timerDown--;
if (timerDown < 0){
active = true;
this.gotoAndStop(1);
};
};
}
}
}//package myEng
Section 44
//Race (myEng.Race)
package myEng {
import flash.events.*;
import flash.display.*;
import pengine.*;
import flash.geom.*;
public class Race extends MovieClip {
public var _CPUvehicle:cCarCPU;
public var _camera:CCamera;
public var _level:AllLevel;
public var update:Function;
protected var mcStartTim:MovieClip;
public var result:Function;
public var _pEngine:ParticleEngine;
public var mcRPanel:cRacePanel;
public var updateEF:Function;
public var _vehicle:cCar;
protected var bacUpUpdate:Function;
protected var myFinishTimer:int;
public var midlMC:MovieClip;
protected var kParlax:Number;
public function Race(){
super();
allScr.myCurState = this;
init();
addEventListener(Event.ENTER_FRAME, updateEF);
}
public function updateParlax():void{
midlMC.x = (_level.VivZone.x / 6);
midlMC.y = ((Main.SCREEN_HEIGHT / 5) + (_level.VivZone.y * kParlax));
}
public function init():void{
var bg:MovieClip = (getChildByName("mcBackground") as MovieClip);
bg.gotoAndStop(AllLevel.AllLevelBG[Main.curLev]);
update = updateStart;
myFinishTimer = 90;
updateEF = function (e:Event):void{
update();
};
this.focusRect = new MovieClip();
this.tabEnabled = false;
mcStartTim = new startTim();
midlMC = new MovieClip();
this.addChild(midlMC);
mcRPanel = new panMC();
_level = new AllLevel();
_level.initLevel(this, Main.curLev);
_level.buildLevel();
createParlax();
addChild(mcRPanel);
mcRPanel.init();
_pEngine = ParticleEngine.create().initParticleEngine(_level.HitZone, 14, 0.999, 5);
_CPUvehicle = new cCarCPU();
_CPUvehicle.initVehicle(scrMap.curEnemyCar, _pEngine, _level.VehZone);
_CPUvehicle.resetAt(_level.startPoint.x, _level.startPoint.y);
_vehicle = new cCar();
_vehicle.initVehicle(CarData.allCar[Main.curCar].getString(), _pEngine, _level.VehZone);
_vehicle.resetAt(_level.startPoint.x, _level.startPoint.y);
mcRPanel.barSpeed.max = 40;
_vehicle.NitroCount = _vehicle._param.maxNitro;
cRacePanel.inst.mcIconNitro.visible = false;
mcRPanel.barDemag.autoUpdate = true;
mcRPanel.barCPUDemag.autoUpdate = true;
mcRPanel.barDemag.max = _vehicle._param.maxLiveBody;
mcRPanel.barDemag.value = _vehicle._param.maxLiveBody;
mcRPanel.barCPUDemag.max = _CPUvehicle._param.maxLiveBody;
mcRPanel.barCPUDemag.value = _CPUvehicle._param.maxLiveBody;
mcRPanel.barDemag.autoUpdate = false;
mcRPanel.barCPUDemag.autoUpdate = false;
_camera = new CCamera();
_camera.window = new Rectangle(0, 0, Main.SCREEN_WIDTH, Main.SCREEN_HEIGHT);
_camera.rangeBorder = new Rectangle(100, -10000, 1000000, 20000);
_camera.createDefaultScroll((_vehicle.body as Sprite), new Rectangle(150, 300, 80, 80));
_camera.createDefaultUpdateView((_level.VivZone as Sprite));
_pEngine.update(0);
_vehicle.update(0);
addChild(mcStartTim);
mcStartTim.x = 400;
mcStartTim.y = 250;
_CPUvehicle.baseUpdate();
mcRPanel.update();
SoundConst._playInGameMusic();
cRacePanel.inst.mcNitroInd["flmc"].visible = false;
}
public function updateStart():void{
if (myFinishTimer == 85){
SoundConst._playSound(SoundConst.LEVEL_START);
};
_camera.update();
updateParlax();
_pEngine.update(0.04);
_vehicle.baseUpdate();
_CPUvehicle.baseUpdate();
mcRPanel.barSpeed.value = _vehicle.getSpeed();
myFinishTimer--;
if (myFinishTimer <= 0){
mcStartTim.stop();
mcStartTim.visible = false;
removeChild(mcStartTim);
update = GameUpdate;
if (_CPUvehicle.diff > 3){
_CPUvehicle.startNitroCPU();
if (_CPUvehicle.diff > 5){
_CPUvehicle.startNitroCPU();
};
if (_CPUvehicle.diff > 7){
_CPUvehicle.startNitroCPU();
};
};
};
}
public function FinishUpdate():void{
myFinishTimer--;
_pEngine.update(0);
_vehicle.update(0);
_CPUvehicle.update(0);
cSmoke.update();
if (myFinishTimer <= 0){
result();
};
}
public function setPausaUpdate(b:Boolean):void{
var b = b;
if (b){
bacUpUpdate = update;
update = function ():void{
};
} else {
update = bacUpUpdate;
};
}
public function cleanup():void{
cSmoke.destroy();
mcStartTim = null;
update = new Function();
removeEventListener(Event.ENTER_FRAME, updateEF);
updateEF = null;
update = null;
result = null;
mcRPanel.cleanup();
mcRPanel = null;
_camera.cleanup();
_camera = null;
_vehicle.cleanup();
_vehicle = null;
_CPUvehicle.cleanup();
_CPUvehicle = null;
_level.cleanup();
_level = null;
_pEngine.cleanup();
_pEngine = null;
}
public function setFinishProcess():void{
myFinishTimer = 20;
update = FinishUpdate;
scrRez.Win = _vehicle.firstInRace;
if (_vehicle.firstInRace){
SoundConst._playSound(SoundConst.LEVEL_WIN);
} else {
SoundConst._playSound(SoundConst.LEVEL_LOSE);
};
scrRez.FindMoney = _vehicle.money;
if (((((_vehicle.firstInRace) && (scrMap.InCarGame))) && ((Main.curLev == 9)))){
result = function ():void{
allScr.setState(allScr.STATE_Win);
};
} else {
result = function ():void{
allScr.setState(allScr.STATE_Rez);
};
};
}
public function GameUpdate():void{
this.stage.focus = this;
KeyConst.keyManager.update(0.04);
_vehicle.processKey(KeyConst.keyManager);
_pEngine.update(0.04);
_vehicle.update(0.04);
_CPUvehicle.update(0.04);
_vehicle.firstInRace = false;
_CPUvehicle.firstInRace = false;
if (_vehicle.body.x > _CPUvehicle.body.x){
cRacePanel.Score = (cRacePanel.Score + scrMap.Diff);
if (!_vehicle.firstInRace){
cRacePanel.Score = (cRacePanel.Score + 200);
};
_vehicle.firstInRace = true;
} else {
_CPUvehicle.firstInRace = true;
};
if (_vehicle.onGround()){
mcRPanel.barSpeed.value = _vehicle.getSpeed();
};
mcRPanel.update();
mcRPanel.setPos(_CPUvehicle.body.x, _vehicle.body.x);
_camera.update();
updateParlax();
myBonus.checkBonus((_vehicle as cCar), (_CPUvehicle as cCar));
_vehicle.checkDemag(_level.HitZone);
_CPUvehicle.checkDemag(_level.HitZone);
cSmoke.update();
}
protected function createParlax():void{
var c:Class;
var xm:Number = 0;
var da:Array = [midl1, midl1, midl2, midl3];
c = da[AllLevel.AllLevelMd[Main.curLev]];
var m:MovieClip = new (c);
var i:int;
while (i < int((((_level.VivZone.width / 5) / m.width) + 1))) {
m = new (c);
midlMC.addChild(m);
m.x = xm;
xm = ((m.x + m.width) - 4);
i++;
};
midlMC.y = 300;
kParlax = ((Main.SCREEN_HEIGHT / _level.HitZone.height) / 2);
}
}
}//package myEng
Section 45
//wav (nitro.wav)
package nitro {
import flash.media.*;
public dynamic class wav extends Sound {
}
}//package nitro
Section 46
//IConstraint (pengine.IConstraint)
package pengine {
public interface IConstraint {
function resolve():void;
}
}//package pengine
Section 47
//ISkeleton (pengine.ISkeleton)
package pengine {
public interface ISkeleton {
function get A():Particle;
function get B():Particle;
function getParticleByName(:String):Particle;
function changeGeometry(... _args):void;
function addToEngine(particleName_:ParticleEngine):void;
}
}//package pengine
Section 48
//Particle (pengine.Particle)
package pengine {
import flash.display.*;
import base.*;
public class Particle implements IObject, IView {
protected var _view:DisplayObjectContainer;
protected var _mass:Number;
protected var _curPosition:Vector2D;
protected var _prevPosition:Vector2D;
protected var _synchronizeMovie:Function;
protected var _buckup:Vector2D;
protected var _accelerate:Vector2D;
static var KOEFF_DUMP:Number = 0.995;
public function Particle():void{
super();
}
public function set accelerate(acc:Vector2D):void{
_accelerate = acc;
}
public function set view(view_:DisplayObjectContainer):void{
var view_ = view_;
if (view_ == null){
_synchronizeMovie = function ():void{
};
} else {
_view = view_;
_synchronizeMovie = moveMovieToCurentPosition;
};
}
protected function moveMovieToCurentPosition():void{
_view.x = _curPosition.x;
_view.y = _curPosition.y;
}
public function init():void{
_curPosition = new Vector2D();
_prevPosition = new Vector2D();
_accelerate = new Vector2D();
_buckup = new Vector2D();
}
public function update(deltaTime_:Number):void{
_buckup.copyFrom(_curPosition);
_curPosition.x = (_curPosition.x + (((_curPosition.x - _prevPosition.x) * KOEFF_DUMP) + (_accelerate.x * deltaTime_)));
_curPosition.y = (_curPosition.y + (((_curPosition.y - _prevPosition.y) * KOEFF_DUMP) + (_accelerate.y * deltaTime_)));
_buckup.copyTo(_prevPosition);
_synchronizeMovie();
}
public function set prevPos(pos:Vector2D):void{
_prevPosition = pos;
}
public function get accelerate():Vector2D{
return (_accelerate);
}
public function get prevPos():Vector2D{
return (_prevPosition);
}
public function checkCollision(hitMovie:DisplayObject):void{
}
public function get pos():Vector2D{
return (_curPosition);
}
public function get view():DisplayObjectContainer{
return (_view);
}
public function set mass(nMass:Number):void{
_mass = nMass;
}
public function cleanup():void{
_curPosition = null;
_prevPosition = null;
_accelerate = null;
_buckup = null;
_view = null;
_synchronizeMovie = null;
}
public function set pos(pos:Vector2D):void{
_curPosition = pos;
}
public function enablePause(enable_:Boolean=true):void{
}
public function get mass():Number{
return (_mass);
}
public function initParticle(x:Number=0, y:Number=0, mass:Number=1, mc:DisplayObjectContainer=null):Particle{
_mass = mass;
_accelerate.x = 0;
_accelerate.y = 0;
view = mc;
moveTo(x, y);
return (this);
}
public function moveTo(nx:Number, ny:Number):void{
_curPosition.x = (_prevPosition.x = nx);
_curPosition.y = (_prevPosition.y = ny);
_synchronizeMovie();
}
public static function create():Particle{
var mbr:Particle = new (Particle);
mbr.init();
return (mbr);
}
}
}//package pengine
Section 49
//ParticleEngine (pengine.ParticleEngine)
package pengine {
import flash.display.*;
import base.*;
public class ParticleEngine implements IObject {
protected var _gravity:Number;
protected var _particles:Array;
protected var _constraints:Array;
protected var _hitMovie:DisplayObject;
protected static var _repeatCount:int;
public function ParticleEngine(){
super();
}
public function enablePause(enable_:Boolean=true):void{
}
public function addParticle(p:Particle):void{
_particles.push(p);
}
public function get gravity():Number{
return (_gravity);
}
public function update(deltaTime_:Number):void{
var i:int;
i = 0;
while (i < _particles.length) {
_particles[i].accelerate.plusXY(0, (_gravity * _particles[i].mass));
_particles[i].accelerate.mult((1 / _repeatCount));
i++;
};
var k:int;
while (k < _repeatCount) {
i = 0;
while (i < _particles.length) {
_particles[i].update((deltaTime_ / _repeatCount));
i++;
};
i = 0;
while (i < _constraints.length) {
_constraints[i].resolve();
i++;
};
i = 0;
while (i < _particles.length) {
_particles[i].checkCollision(_hitMovie);
i++;
};
k++;
};
i = 0;
while (i < _particles.length) {
_particles[i].accelerate.init(0, 0);
i++;
};
}
public function getHitMovie():DisplayObject{
return (_hitMovie);
}
public function clearAll():void{
if (_particles != null){
do {
} while (_particles.pop() != null);
};
clearConstraints();
}
public function init():void{
_gravity = 7;
_repeatCount = 3;
_hitMovie = null;
_particles = new Array();
_constraints = new Array();
}
public function initParticleEngine(hitMovie:DisplayObject=null, nGravity:Number=7, koeffDamp:Number=0.995, repeatCount_:int=3):ParticleEngine{
setHitMovie(hitMovie);
gravity = nGravity;
_repeatCount = repeatCount_;
Particle.KOEFF_DUMP = koeffDamp;
return (this);
}
public function addConstraint(c:IConstraint):void{
_constraints.push(c);
}
public function setHitMovie(hitMovie:DisplayObject=null):void{
_hitMovie = hitMovie;
}
public function set gravity(nGravity:Number):void{
_gravity = nGravity;
}
public function cleanup():void{
clearAll();
_hitMovie = null;
_particles = null;
_constraints = null;
}
public function clearConstraints():void{
if (_constraints != null){
do {
} while (_constraints.pop() != null);
};
}
public static function create():ParticleEngine{
var pe:ParticleEngine = new (ParticleEngine);
pe.init();
return (pe);
}
}
}//package pengine
Section 50
//PenetrationConstraint (pengine.PenetrationConstraint)
package pengine {
import base.*;
public class PenetrationConstraint implements IData, IConstraint {
protected const PI2:Number = 1.5707963267949;
protected var _p1:Particle;
protected var _p2:Particle;
protected var _p0:Particle;
protected var _n:Vector2D;
protected var _sign:Number;
public function PenetrationConstraint():void{
super();
}
public function cleanup():void{
_p0 = null;
_p1 = null;
_p2 = null;
_n = null;
}
public function fixDistance():void{
_sign = _p0.pos.getDistanceTo(_p1.pos, _p2.pos);
if (_sign < 0){
_sign = -1;
} else {
_sign = 1;
};
_n = new Vector2D();
}
public function resolve():void{
var new_sign:Number = _p0.pos.getDistanceTo(_p1.pos, _p2.pos);
if ((_sign * new_sign) <= 2){
_n.init(_p2.pos.x, _p2.pos.y);
_n.minus(_p1.pos);
_n.normalize();
_n.rotate((PI2 * _sign));
_n.mult((Math.abs(new_sign) + 1));
_p1.pos.minus(_n);
};
}
public function init():void{
_p0 = null;
_p1 = null;
_p2 = null;
_n = null;
}
public function initPenetrationConstraint(_p0_:Particle, _p1_:Particle, _p2_:Particle):PenetrationConstraint{
_p0 = _p0_;
_p1 = _p1_;
_p2 = _p2_;
fixDistance();
return (this);
}
public static function create():PenetrationConstraint{
var mbr:PenetrationConstraint = new (PenetrationConstraint);
mbr.init();
return (mbr);
}
}
}//package pengine
Section 51
//SpringConstraint (pengine.SpringConstraint)
package pengine {
import base.*;
public class SpringConstraint implements IData, IConstraint {
protected var _p2:Particle;
protected var _p1:Particle;
protected var nKoeffStiffPress:Number;
protected var nRelaxLen:Number;
protected var nKoeffStiffStretch:Number;
public function SpringConstraint(){
super();
}
public function cleanup():void{
_p1 = null;
_p2 = null;
}
public function get p1():Particle{
return (_p1);
}
public function initSpringConstraint(koeffStiffPress:Number, koeffStiffStretch:Number, p1_:Particle=null, p2_:Particle=null):SpringConstraint{
if (p1_ == null){
p1_ = Particle.create();
};
if (p2_ == null){
p2_ = Particle.create();
};
_p1 = p1_;
_p2 = p2_;
nKoeffStiffPress = koeffStiffPress;
nKoeffStiffStretch = koeffStiffStretch;
fixDistance();
return (this);
}
public function fixDistance():void{
nRelaxLen = Vector2D.getDistanceBetween(_p1.pos, _p2.pos);
}
public function resolve():void{
var dy:Number;
var koeffStiff:Number;
var mass2:Number;
var k:Number;
var dx:Number = (_p1.pos.x - _p2.pos.x);
dy = (_p1.pos.y - _p2.pos.y);
var m:Number = Math.sqrt(((dx * dx) + (dy * dy)));
var dr:Number = ((m - nRelaxLen) / m);
if (m > nRelaxLen){
koeffStiff = nKoeffStiffStretch;
} else {
koeffStiff = nKoeffStiffPress;
};
var mass1:Number = _p1.mass;
mass2 = _p2.mass;
k = ((dr * koeffStiff) / (mass1 + mass2));
_p1.pos.x = (_p1.pos.x - ((dx * mass1) * k));
_p1.pos.y = (_p1.pos.y - ((dy * mass1) * k));
_p2.pos.x = (_p2.pos.x + ((dx * mass2) * k));
_p2.pos.y = (_p2.pos.y + ((dy * mass2) * k));
}
public function init():void{
_p1 = null;
_p2 = null;
}
public function set p1(nP1:Particle):void{
_p1 = nP1;
}
public function get p2():Particle{
return (_p2);
}
public function set p2(nP2:Particle):void{
_p2 = nP2;
}
public static function create():SpringConstraint{
var mbr:SpringConstraint = new (SpringConstraint);
mbr.init();
return (mbr);
}
}
}//package pengine
Section 52
//TriangleSkeleton (pengine.TriangleSkeleton)
package pengine {
import flash.geom.*;
import base.*;
public class TriangleSkeleton implements IData, ISkeleton {
protected var _pAB:SpringConstraint;
protected var _pAC:SpringConstraint;
protected var _pA:Particle;
protected var _pB:Particle;
protected var _pBC:SpringConstraint;
protected var _pABC:PenetrationConstraint;
protected var _pC:Particle;
public function TriangleSkeleton(){
super();
}
public function changeGeometry(... _args):void{
changeTriangleGeometry(_args[0], _args[1], _args[2]);
}
public function get C():Particle{
return (_pC);
}
public function get AC():SpringConstraint{
return (_pAC);
}
public function cleanup():void{
_pA = null;
_pB = null;
_pC = null;
_pAB = null;
_pAC = null;
_pBC = null;
_pABC = null;
}
public function get A():Particle{
return (_pA);
}
public function init():void{
_pA = null;
_pB = null;
_pC = null;
_pAB = null;
_pAC = null;
_pBC = null;
_pABC = null;
}
public function get B():Particle{
return (_pB);
}
public function get BC():SpringConstraint{
return (_pBC);
}
public function getParticleByName(particleName_:String):Particle{
return (this[particleName_]);
}
public function get AB():SpringConstraint{
return (_pAB);
}
public function initTriangleSkeleton(pA_:Particle, pB_:Particle, pC_:Particle, pAB_:SpringConstraint, pAC_:SpringConstraint, pBC_:SpringConstraint):TriangleSkeleton{
_pA = pA_;
_pB = pB_;
_pC = pC_;
_pAB = pAB_;
_pAB.p1 = pA_;
_pAB.p2 = _pB;
_pAC = pAC_;
_pAC.p1 = pA_;
_pAC.p2 = _pC;
_pBC = pBC_;
_pBC.p1 = _pB;
_pBC.p2 = _pC;
_pABC = PenetrationConstraint.create().initPenetrationConstraint(_pA, _pC, _pB);
return (this);
}
public function changeTriangleGeometry(pA:Point, pB:Point, pC:Point):void{
_pA.moveTo(pA.x, pA.y);
_pB.moveTo(pB.x, pB.y);
_pC.moveTo(pC.x, pC.y);
_pAB.fixDistance();
_pAC.fixDistance();
_pBC.fixDistance();
_pABC.fixDistance();
}
public function addToEngine(engine:ParticleEngine):void{
engine.addParticle(_pA);
engine.addParticle(_pB);
engine.addParticle(_pC);
engine.addConstraint(_pAB);
engine.addConstraint(_pAC);
engine.addConstraint(_pBC);
engine.addConstraint(_pABC);
}
public static function create():TriangleSkeleton{
var mbr:TriangleSkeleton = new (TriangleSkeleton);
mbr.init();
return (mbr);
}
}
}//package pengine
Section 53
//Vector2D (pengine.Vector2D)
package pengine {
public class Vector2D {
public var x:Number;
public var y:Number;
public function Vector2D(nx:Number=0, ny:Number=0):void{
super();
init(nx, ny);
}
public function modul():Number{
return (Math.sqrt(((x * x) + (y * y))));
}
public function rotate(u:Number):void{
var oX:Number = x;
var oY:Number = y;
x = ((oX * Math.cos(u)) - (oY * Math.sin(u)));
y = ((oX * Math.sin(u)) + (oY * Math.cos(u)));
}
public function rotateNew(u:Number):Vector2D{
return (new Vector2D(((x * Math.cos(u)) - (y * Math.sin(u))), ((x * Math.sin(u)) + (y * Math.cos(u)))));
}
public function copyFrom(v:Vector2D):void{
x = v.x;
y = v.y;
}
public function mult(k:Number):void{
x = (x * k);
y = (y * k);
}
public function getDistanceTo(p1:Vector2D, p2:Vector2D):Number{
var A:Number = (p1.y - p2.y);
var B:Number = (p2.x - p1.x);
var C:Number = ((p1.x * (p2.y - p1.y)) - (p1.y * (p2.x - p1.x)));
var d:Number = Math.sqrt(((A * A) + (B * B)));
A = (A / d);
B = (B / d);
C = (C / d);
return ((((A * x) + (B * y)) + C));
}
public function duplicate():Vector2D{
return (new Vector2D(x, y));
}
public function scalar(v:Vector2D):Number{
return (((x * v.x) + (y * v.y)));
}
public function normalize():void{
var r:Number = Math.sqrt(((x * x) + (y * y)));
x = (x / r);
y = (y / r);
}
public function init(nx:Number, ny:Number):void{
x = nx;
y = ny;
}
public function plusNew(v:Vector2D):Vector2D{
return (new Vector2D((x + v.x), (y + v.y)));
}
public function multNew(k:Number):Vector2D{
return (new Vector2D((x * k), (y * k)));
}
public function minusNew(v:Vector2D):Vector2D{
return (new Vector2D((x - v.x), (y - v.y)));
}
public function plus(v:Vector2D):void{
x = (x + v.x);
y = (y + v.y);
}
public function plusXY(nx:Number, ny:Number):void{
x = (x + nx);
y = (y + ny);
}
public function copyTo(v:Vector2D):void{
v.x = x;
v.y = y;
}
public function reverseNew():Vector2D{
return (new Vector2D(-(x), -(y)));
}
public function minus(v:Vector2D):void{
x = (x - v.x);
y = (y - v.y);
}
public static function getDistanceBetween(p1:Vector2D, p2:Vector2D):Number{
var dx:Number = (p1.x - p2.x);
var dy:Number = (p1.y - p2.y);
return (Math.sqrt(((dx * dx) + (dy * dy))));
}
}
}//package pengine
Section 54
//Wheel (pengine.Wheel)
package pengine {
import flash.display.*;
import flash.geom.*;
public class Wheel extends Particle {
protected var intersArray:Array;
protected var hitArray:Array;
public var _maxAccSpeed:Number;
protected var intersectionFlag:Boolean;
protected var hitPointArray:Array;
protected var n_part:Vector2D;
protected var _accSpeed:Number;
protected var oldPos:Vector2D;
protected var _koeffSpring:Number;
protected var rotateMovie:Function;
protected var _radius:Number;
protected var normalArray:Array;
protected var lastIntersPoint:Vector2D;
protected var _speed:Number;
protected var p3:Vector2D;
protected var _rim:DisplayObject;
protected var _acceleration:Number;
protected var rot:Vector2D;
protected var _koeffSlip:Number;
protected var _n:Vector2D;
protected var _p:Point;
protected var obj:Object;
protected var lastN:Vector2D;
protected static var ANGLE_180_DIV_PI:Number = 57.2957795130823;
public static var _maxSpeed:Number = 180;
protected static var _koeffFriction:Number = 0.03;
protected static var _hitCount:Number = 16;
public function Wheel():void{
super();
}
protected function _innerInit():void{
n_part = new Vector2D(0, 0);
oldPos = new Vector2D(0, 0);
_p = new Point();
_n = new Vector2D(0, 0);
p3 = new Vector2D(0, 0);
}
override public function checkCollision(hit_view:DisplayObject):void{
var i:Number;
var j:Number;
var k1:Number;
var k2:Number;
var k:Number;
var counter:Number;
var u:Number;
_p.x = (_p.y = 0);
var hitFlag:Boolean;
oldPos.init(_prevPosition.x, _prevPosition.y);
_n.init(0, 0);
n_part.init(0, 0);
_synchronizeMovie();
counter = 0;
i = 0;
while (i < _hitCount) {
_p.x = hitPointArray[i].x;
_p.y = hitPointArray[i].y;
_p = _view.localToGlobal(_p);
if ((hitArray[i] = hit_view.hitTestPoint(_p.x, _p.y, true))){
hitFlag = true;
k1 = i;
counter++;
};
i++;
};
if (counter == _hitCount){
_curPosition.x = (_prevPosition.x + ((_curPosition.x - _prevPosition.x) * 0.3));
_curPosition.y = (_prevPosition.y + ((_curPosition.y - _prevPosition.y) * 0.3));
_synchronizeMovie();
return;
};
i = 0;
if (hitFlag){
while (true) {
i++;
if (i == _hitCount){
i = 0;
};
if (!hitArray[i]){
k1 = -1;
j = 0;
while (j < _hitCount) {
i++;
if (i == _hitCount){
i = 0;
};
if (k1 == -1){
if (hitArray[i]){
k1 = i;
_n.plus(normalArray[i]);
normalArray[i].copyTo(n_part);
};
} else {
if (!hitArray[i]){
k2 = (i - 1);
if (k2 < 0){
k2 = (_hitCount - 1);
};
intersArray.push({k1:k1, k2:k2, n:new Vector2D(n_part.x, n_part.y)});
k1 = -1;
} else {
_n.plus(normalArray[i]);
n_part.plus(normalArray[i]);
};
};
j++;
};
break;
};
};
p3.init(0, 0);
if (intersArray.length > 0){
_n.normalize();
if (intersectionFlag){
_n.x = (_n.x + lastN.x);
_n.y = (_n.y + lastN.y);
_n.x = (_n.x / 2);
_n.y = (_n.y / 2);
};
k = intersArray.length;
i = 0;
while (i < k) {
obj = intersArray.pop();
k1 = obj.k1;
k2 = obj.k2;
obj.n.copyTo(n_part);
_curPosition.minusNew(_prevPosition).copyTo(p3);
if (_n.scalar(p3) < 0){
u = Math.atan2(_n.y, _n.x);
p3.rotate(-(u));
p3.x = (-(p3.x) * _koeffSpring);
p3.rotate(u);
pushOut(k1, k2, n_part, hit_view);
_prevPosition.x = (_curPosition.x - p3.x);
_prevPosition.y = (_curPosition.y - p3.y);
} else {
pushOut(k1, k2, n_part, hit_view);
};
i++;
};
validateRotation(_n, oldPos);
intersectionFlag = true;
_curPosition.copyTo(lastIntersPoint);
_n.copyTo(lastN);
};
} else {
if (intersectionFlag){
validateRotation(lastN, oldPos);
intersectionFlag = false;
};
};
_synchronizeMovie();
}
override public function init():void{
super.init();
}
public function getRotationMovie():DisplayObject{
return (_rim);
}
public function setRotationMovie(rotationMovie:DisplayObject):void{
var rotationMovie = rotationMovie;
if ((((rotationMovie == null)) || ((rotationMovie == null)))){
rotateMovie = function ():void{
};
_rim = null;
} else {
rotateMovie = function ():void{
rot.rotate((_speed / _radius));
_rim.rotation = (Math.atan2(rot.y, rot.x) * ANGLE_180_DIV_PI);
};
_rim = rotationMovie;
};
}
override public function cleanup():void{
_rim = null;
rot = null;
hitPointArray = null;
normalArray = null;
hitArray = null;
intersArray = null;
lastIntersPoint = null;
lastN = null;
rotateMovie = null;
super.cleanup();
}
public function initWheel(x:Number, y:Number, mass:Number, rad:Number, maxAccSpeed:Number, mc:DisplayObjectContainer, rotationMovie:DisplayObject=null, koeffSpring:Number=0.1, koeffSlip:Number=0.1):Wheel{
var i:Number;
_innerInit();
initParticle(x, y, mass, mc);
_koeffSpring = koeffSpring;
_koeffSlip = koeffSlip;
setRotationMovie(rotationMovie);
_radius = rad;
_maxAccSpeed = maxAccSpeed;
_speed = 0;
_accSpeed = 0;
rot = new Vector2D(1, 0);
intersectionFlag = false;
lastIntersPoint = new Vector2D(0, 0);
lastN = new Vector2D(0, 0);
var du:Number = ((Math.PI * 2) / _hitCount);
hitPointArray = new Array(_hitCount);
normalArray = new Array(_hitCount);
hitArray = new Array(_hitCount);
intersArray = new Array();
i = 0;
while (i < _hitCount) {
hitPointArray[i] = new Vector2D((Math.sin((du * i)) * _radius), (-(Math.cos((du * i))) * _radius));
normalArray[i] = hitPointArray[i].multNew(-1);
normalArray[i].normalize();
i++;
};
_acceleration = 0;
return (this);
}
protected function validateRotation(n:Vector2D, oldPos:Vector2D):void{
if (((!(intersectionFlag)) && ((Math.abs(_accSpeed) > 0.01)))){
if (Math.abs(_accSpeed) < ((_maxAccSpeed * 0.02) / 2)){
_accSpeed = 0;
} else {
if (_accSpeed > 0){
_accSpeed = (_maxAccSpeed * 0.02);
} else {
_accSpeed = (-(_maxAccSpeed) * 0.02);
};
};
};
var accDir:Vector2D = new Vector2D(-(n.y), n.x);
var wheelSpeed:Vector2D = _curPosition.minusNew(oldPos);
var ugol:Number = Math.atan2(accDir.y, accDir.x);
var projectVector:Vector2D = wheelSpeed.rotateNew(-(ugol));
_speed = (projectVector.x + _accSpeed);
projectVector.y = 0;
projectVector.rotate(ugol);
var traction:Number = (1 - _koeffSlip);
_curPosition.x = ((_curPosition.x + ((accDir.x * _accSpeed) * traction)) - (_koeffFriction * projectVector.x));
_curPosition.y = ((_curPosition.y + ((accDir.y * _accSpeed) * traction)) - (_koeffFriction * projectVector.y));
_accSpeed = (_accSpeed * _koeffSlip);
}
public function disableRotation():void{
rotateMovie = function ():void{
};
}
override public function update(deltaTime_:Number):void{
super.update(deltaTime_);
_accSpeed = Math.max(-(_maxAccSpeed), Math.min(_maxAccSpeed, (_accSpeed + (_acceleration * deltaTime_))));
_speed = Math.max((-(_maxSpeed) * deltaTime_), Math.min(((_speed * KOEFF_DUMP) + _accSpeed), (_maxSpeed * deltaTime_)));
rotateMovie();
}
public function getAccelerate():Number{
return (_acceleration);
}
protected function pushOut(k1:Number, k2:Number, n:Vector2D, hit_view:DisplayObject):void{
var d:Number;
var p3:Vector2D;
var p_p:Point;
var m:Number;
var step:Number;
n.normalize();
if (k1 != k2){
d = new Vector2D(0, 0).getDistanceTo(hitPointArray[k1], hitPointArray[k2]);
d = (_radius - Math.abs(d));
_curPosition.plus(n.multNew(d));
_prevPosition.plus(n.multNew(d));
} else {
p3 = n.multNew(-(_radius));
p_p = new Point(0, 0);
m = 0;
step = 0.03;
while (true) {
p_p.x = p3.x;
p_p.y = p3.y;
p_p = _view.localToGlobal(p_p);
if (hit_view.hitTestPoint(p_p.x, p_p.y, true)){
m++;
_curPosition.x = (_curPosition.x + (n.x * step));
_curPosition.y = (_curPosition.y + (n.y * step));
_synchronizeMovie();
} else {
m--;
_curPosition.x = (_curPosition.x - (n.x * step));
_curPosition.y = (_curPosition.y - (n.y * step));
_prevPosition.plus(n.multNew((step * m)));
break;
};
};
};
}
public function hasIntersection():Boolean{
return (intersectionFlag);
}
public function setAccelerate(nAccelerate:Number):void{
_acceleration = nAccelerate;
}
public function stopRotate():void{
_accSpeed = 0;
}
public static function create():Wheel{
var mbr:Wheel = new (Wheel);
mbr.init();
return (mbr);
}
}
}//package pengine
Section 55
//wav (recolor.wav)
package recolor {
import flash.media.*;
public dynamic class wav extends Sound {
}
}//package recolor
Section 56
//wav (repear.wav)
package repear {
import flash.media.*;
public dynamic class wav extends Sound {
}
}//package repear
Section 57
//wav (shild.wav)
package shild {
import flash.media.*;
public dynamic class wav extends Sound {
}
}//package shild
Section 58
//SoundManager (sound.SoundManager)
package sound {
import flash.events.*;
import flash.media.*;
import flash.utils.*;
import flash.system.*;
public class SoundManager {
protected var m_sBackSoundID:String;
protected var m_soundOn:Boolean;
protected var m_schBackSound:SoundChannel;
protected var m_dictSounds:Dictionary;
protected var m_dictChannels:Dictionary;
public function SoundManager(){
super();
this.m_dictSounds = new Dictionary();
this.m_dictChannels = new Dictionary();
this.soundOn = true;
this.m_sBackSoundID = null;
}
protected function onSoundComplete(event:Event):void{
delete this.m_dictChannels[(event.target as SoundChannel)];
}
public function stopBackSound():void{
if (this.m_schBackSound != null){
this.m_schBackSound.stop();
this.m_schBackSound = null;
};
}
public function setTransform(sID:String, soundTransform:SoundTransform):void{
(this.m_dictSounds[sID] as SoundObject).m_transform = soundTransform;
}
public function stopSound(sID:SoundChannel):void{
this.m_dictChannels[sID].stop();
}
public function get soundOn():Boolean{
return (this.m_soundOn);
}
public function removeSound(sID:String):void{
delete this.m_dictSounds[sID];
}
public function setVolume(sID:String, nVolume:Number):void{
(this.m_dictSounds[sID] as SoundObject).m_transform.volume = nVolume;
}
public function addSound(sClassName:String, sID:String=null):void{
if (sID == null){
sID = sClassName;
};
var classSound:Class = (ApplicationDomain.currentDomain.getDefinition(sClassName) as Class);
var sndObj:SoundObject = new SoundObject(new (classSound));
this.m_dictSounds[sID] = sndObj;
}
public function playBackSound(sID:String):SoundChannel{
var t:Boolean = this.m_soundOn;
this.m_soundOn = true;
if (((!((this.m_schBackSound == null))) && (!((this.m_sBackSoundID == sID))))){
this.m_schBackSound.stop();
this.m_schBackSound = null;
};
if (this.m_schBackSound == null){
this.m_schBackSound = this.playSound(sID, 0, (int.MAX_VALUE - 100));
};
this.m_sBackSoundID = sID;
this.m_soundOn = t;
return (this.m_schBackSound);
}
public function playSound(sID:String, nStartTime:Number=0, iLoops:int=0):SoundChannel{
var sou:SoundObject;
var sndChannel:SoundChannel;
var sID = sID;
var nStartTime = nStartTime;
var iLoops = iLoops;
if (this.soundOn){
sou = (this.m_dictSounds[sID] as SoundObject);
sndChannel = sou.play(nStartTime, iLoops);
this.m_dictChannels[sndChannel] = sndChannel;
sndChannel.addEventListener(Event.SOUND_COMPLETE, this.onSoundComplete, false, 0, true);
return (sndChannel);
//unresolved jump
var _slot1 = e;
trace("SoundManager::playSound exception", _slot1.getStackTrace());
return (null);
};
return (null);
}
public function set soundOn(bValue:Boolean):void{
var channel:SoundChannel;
this.m_soundOn = bValue;
if (!this.m_soundOn){
for each (channel in this.m_dictChannels) {
channel.stop();
};
} else {
this.m_dictChannels = new Dictionary();
};
}
}
}//package sound
Section 59
//SoundObject (sound.SoundObject)
package sound {
import flash.media.*;
class SoundObject {
public var m_transform:SoundTransform;
public var m_sound:Sound;
function SoundObject(sound:Sound){
super();
this.m_sound = sound;
this.m_transform = new SoundTransform();
}
public function play(nStartTime:Number=0, iLoops:int=0):SoundChannel{
return (this.m_sound.play(nStartTime, iLoops, this.m_transform));
}
}
}//package sound
Section 60
//wav (startRace.wav)
package startRace {
import flash.media.*;
public dynamic class wav extends Sound {
}
}//package startRace
Section 61
//wav (win.wav)
package win {
import flash.media.*;
public dynamic class wav extends Sound {
}
}//package win
Section 62
//Acura_TL (Acura_TL)
package {
import flash.display.*;
public dynamic class Acura_TL extends MovieClip {
public var mcA:MovieClip;
public var mcB:MovieClip;
public var mcC:MovieClip;
public var risMC:MovieClip;
public var mcSmokePoint:MovieClip;
public var mcDem1:MovieClip;
public var bodyMC:MovieClip;
}
}//package
Section 63
//AllCar (AllCar)
package {
import flash.display.*;
public dynamic class AllCar extends MovieClip {
}
}//package
Section 64
//allDinamic (allDinamic)
package {
import flash.display.*;
public dynamic class allDinamic extends MovieClip {
}
}//package
Section 65
//allScr (allScr)
package {
import flash.events.*;
import flash.display.*;
import base.*;
import flash.net.*;
public class allScr extends MovieClip {
protected static var _money:int;
public static var myCurState:Object;
public static var interf:MovieClip;
public static var STATE_Garag:int = 1;
public static var STATE_Tune:int = 3;
public static var STATE_Map:int = 5;
public static var STATE_Options:int = 2;
public static var STATE_Start:int = 0;
public static var stateNum:int;
public static var STATE_HTP:int = 4;
public static var STATE_Rez:int = 7;
public static var STATE_Win:int = 8;
public static var STATE_Race:int = 6;
public function allScr(){
super();
init();
}
public function init():void{
interf = (this["mcOpt"] as MovieClip);
interf.visible = false;
money = 0;
KeyConst.keyManager = KeyManager.create().initKeyManager(this);
var s:SimpleButton = (interf["btOptions"] as SimpleButton);
s.addEventListener(MouseEvent.CLICK, btClOptions);
stop();
}
public function btClGarag(e:Event):void{
setState(STATE_Garag);
}
public function btClRace(e:Event):void{
if (stateNum == STATE_Map){
if (Main.mapRez[Main.curLev] < 3){
scrMap.InCarGame = false;
myCurState.startGate();
} else {
scrMap.InCarGame = true;
scrMap.curPriz = 0;
myCurState.startGate();
};
} else {
setState(STATE_Map);
};
}
public function btClOptions(e:Event):void{
var mc:MovieClip = new scrScrOptions();
interf.addChild(mc);
mc.init();
}
public function btClCustom(e:Event):void{
setState(STATE_Tune);
}
public static function set money(value:int):void{
_money = value;
interf["mcCash"].text = ("CASH $" + String(_money));
}
public static function get money():int{
return (_money);
}
public static function setState(_newState:int):void{
trace("State", _newState);
if (_newState == stateNum){
return;
};
if (myCurState != null){
myCurState.cleanup();
};
if ((((((_newState == STATE_Race)) || ((_newState == STATE_Start)))) || ((_newState == STATE_HTP)))){
interf.visible = false;
} else {
interf.visible = true;
};
var labelArr:Array = ["lbStart", "lbGarag", "lbOptions", "lbTune", "lbHTP", "lbMap", "lbRace", "lbRez", "lbWin"];
Main.myRoot.gotoAndStop(labelArr[_newState]);
stateNum = _newState;
updateLevel();
}
public static function updateLevel():void{
interf["mcLev"].visible = false;
if (stateNum == STATE_Map){
interf["mcLev"].text = ("LEVEL " + String((Main.curLev + 1)));
interf["mcLev"].visible = true;
};
}
public static function btClic(e:Event):void{
SoundConst._buttonClick();
var req:URLRequest = new URLRequest("http://www.nextplay.com/category/racing-games/1/top-rated.html?utm_medium=brandedgames_external&utm_campaign=race-or-die&utm_source=ingame&utm_content=ingame");
navigateToURL(req, "_blank");
}
}
}//package
Section 66
//allSounds (allSounds)
package {
import flash.display.*;
public dynamic class allSounds extends MovieClip {
public function allSounds(){
addFrameScript(0, this.frame1);
}
function frame1(){
stop();
}
}
}//package
Section 67
//AstonMartinDB9 (AstonMartinDB9)
package {
import flash.display.*;
public dynamic class AstonMartinDB9 extends MovieClip {
public var mcA:MovieClip;
public var mcB:MovieClip;
public var mcC:MovieClip;
public var risMC:MovieClip;
public var mcSmokePoint:MovieClip;
public var mcDem1:MovieClip;
public var bodyMC:MovieClip;
}
}//package
Section 68
//Audi_R8 (Audi_R8)
package {
import flash.display.*;
public dynamic class Audi_R8 extends MovieClip {
public var mcA:MovieClip;
public var mcB:MovieClip;
public var mcC:MovieClip;
public var risMC:MovieClip;
public var mcSmokePoint:MovieClip;
public var mcDem1:MovieClip;
public var windMC:MovieClip;
public var bodyMC:MovieClip;
}
}//package
Section 69
//BMW_M3 (BMW_M3)
package {
import flash.display.*;
public dynamic class BMW_M3 extends MovieClip {
public var mcA:MovieClip;
public var mcB:MovieClip;
public var mcC:MovieClip;
public var risMC:MovieClip;
public var mcSmokePoint:MovieClip;
public var mcDem1:MovieClip;
public var bodyMC:MovieClip;
}
}//package
Section 70
//BONUS (BONUS)
package {
import myEng.*;
public dynamic class BONUS extends myRndBonus {
public function BONUS(){
addFrameScript(0, this.frame1, 5, this.frame6);
}
function frame6(){
stop();
}
function frame1(){
stop();
}
}
}//package
Section 71
//bonus_1 (bonus_1)
package {
import flash.display.*;
public dynamic class bonus_1 extends MovieClip {
}
}//package
Section 72
//bonus_10 (bonus_10)
package {
import flash.display.*;
public dynamic class bonus_10 extends MovieClip {
}
}//package
Section 73
//bonus_11 (bonus_11)
package {
import flash.display.*;
public dynamic class bonus_11 extends MovieClip {
}
}//package
Section 74
//bonus_12 (bonus_12)
package {
import flash.display.*;
public dynamic class bonus_12 extends MovieClip {
}
}//package
Section 75
//bonus_13 (bonus_13)
package {
import flash.display.*;
public dynamic class bonus_13 extends MovieClip {
}
}//package
Section 76
//bonus_14 (bonus_14)
package {
import flash.display.*;
public dynamic class bonus_14 extends MovieClip {
}
}//package
Section 77
//bonus_15 (bonus_15)
package {
import flash.display.*;
public dynamic class bonus_15 extends MovieClip {
}
}//package
Section 78
//bonus_16 (bonus_16)
package {
import flash.display.*;
public dynamic class bonus_16 extends MovieClip {
}
}//package
Section 79
//bonus_17 (bonus_17)
package {
import flash.display.*;
public dynamic class bonus_17 extends MovieClip {
}
}//package
Section 80
//bonus_18 (bonus_18)
package {
import flash.display.*;
public dynamic class bonus_18 extends MovieClip {
}
}//package
Section 81
//bonus_19 (bonus_19)
package {
import flash.display.*;
public dynamic class bonus_19 extends MovieClip {
}
}//package
Section 82
//bonus_2 (bonus_2)
package {
import flash.display.*;
public dynamic class bonus_2 extends MovieClip {
}
}//package
Section 83
//bonus_20 (bonus_20)
package {
import flash.display.*;
public dynamic class bonus_20 extends MovieClip {
}
}//package
Section 84
//bonus_21 (bonus_21)
package {
import flash.display.*;
public dynamic class bonus_21 extends MovieClip {
}
}//package
Section 85
//bonus_22 (bonus_22)
package {
import flash.display.*;
public dynamic class bonus_22 extends MovieClip {
}
}//package
Section 86
//bonus_23 (bonus_23)
package {
import flash.display.*;
public dynamic class bonus_23 extends MovieClip {
}
}//package
Section 87
//bonus_24 (bonus_24)
package {
import flash.display.*;
public dynamic class bonus_24 extends MovieClip {
}
}//package
Section 88
//bonus_25 (bonus_25)
package {
import flash.display.*;
public dynamic class bonus_25 extends MovieClip {
}
}//package
Section 89
//bonus_26 (bonus_26)
package {
import flash.display.*;
public dynamic class bonus_26 extends MovieClip {
}
}//package
Section 90
//bonus_27 (bonus_27)
package {
import flash.display.*;
public dynamic class bonus_27 extends MovieClip {
}
}//package
Section 91
//bonus_28 (bonus_28)
package {
import flash.display.*;
public dynamic class bonus_28 extends MovieClip {
}
}//package
Section 92
//bonus_29 (bonus_29)
package {
import flash.display.*;
public dynamic class bonus_29 extends MovieClip {
}
}//package
Section 93
//bonus_3 (bonus_3)
package {
import flash.display.*;
public dynamic class bonus_3 extends MovieClip {
}
}//package
Section 94
//bonus_30 (bonus_30)
package {
import flash.display.*;
public dynamic class bonus_30 extends MovieClip {
}
}//package
Section 95
//bonus_31 (bonus_31)
package {
import flash.display.*;
public dynamic class bonus_31 extends MovieClip {
}
}//package
Section 96
//bonus_32 (bonus_32)
package {
import flash.display.*;
public dynamic class bonus_32 extends MovieClip {
}
}//package
Section 97
//bonus_33 (bonus_33)
package {
import flash.display.*;
public dynamic class bonus_33 extends MovieClip {
}
}//package
Section 98
//bonus_34 (bonus_34)
package {
import flash.display.*;
public dynamic class bonus_34 extends MovieClip {
}
}//package
Section 99
//bonus_35 (bonus_35)
package {
import flash.display.*;
public dynamic class bonus_35 extends MovieClip {
}
}//package
Section 100
//bonus_36 (bonus_36)
package {
import flash.display.*;
public dynamic class bonus_36 extends MovieClip {
}
}//package
Section 101
//bonus_37 (bonus_37)
package {
import flash.display.*;
public dynamic class bonus_37 extends MovieClip {
}
}//package
Section 102
//bonus_38 (bonus_38)
package {
import flash.display.*;
public dynamic class bonus_38 extends MovieClip {
}
}//package
Section 103
//bonus_39 (bonus_39)
package {
import flash.display.*;
public dynamic class bonus_39 extends MovieClip {
}
}//package
Section 104
//bonus_4 (bonus_4)
package {
import flash.display.*;
public dynamic class bonus_4 extends MovieClip {
}
}//package
Section 105
//bonus_40 (bonus_40)
package {
import flash.display.*;
public dynamic class bonus_40 extends MovieClip {
}
}//package
Section 106
//bonus_41 (bonus_41)
package {
import flash.display.*;
public dynamic class bonus_41 extends MovieClip {
}
}//package
Section 107
//bonus_42 (bonus_42)
package {
import flash.display.*;
public dynamic class bonus_42 extends MovieClip {
}
}//package
Section 108
//bonus_43 (bonus_43)
package {
import flash.display.*;
public dynamic class bonus_43 extends MovieClip {
}
}//package
Section 109
//bonus_44 (bonus_44)
package {
import flash.display.*;
public dynamic class bonus_44 extends MovieClip {
}
}//package
Section 110
//bonus_45 (bonus_45)
package {
import flash.display.*;
public dynamic class bonus_45 extends MovieClip {
}
}//package
Section 111
//bonus_46 (bonus_46)
package {
import flash.display.*;
public dynamic class bonus_46 extends MovieClip {
}
}//package
Section 112
//bonus_47 (bonus_47)
package {
import flash.display.*;
public dynamic class bonus_47 extends MovieClip {
}
}//package
Section 113
//bonus_48 (bonus_48)
package {
import flash.display.*;
public dynamic class bonus_48 extends MovieClip {
}
}//package
Section 114
//bonus_49 (bonus_49)
package {
import flash.display.*;
public dynamic class bonus_49 extends MovieClip {
}
}//package
Section 115
//bonus_5 (bonus_5)
package {
import flash.display.*;
public dynamic class bonus_5 extends MovieClip {
}
}//package
Section 116
//bonus_50 (bonus_50)
package {
import flash.display.*;
public dynamic class bonus_50 extends MovieClip {
}
}//package
Section 117
//bonus_6 (bonus_6)
package {
import flash.display.*;
public dynamic class bonus_6 extends MovieClip {
}
}//package
Section 118
//bonus_7 (bonus_7)
package {
import flash.display.*;
public dynamic class bonus_7 extends MovieClip {
}
}//package
Section 119
//bonus_8 (bonus_8)
package {
import flash.display.*;
public dynamic class bonus_8 extends MovieClip {
}
}//package
Section 120
//bonus_9 (bonus_9)
package {
import flash.display.*;
public dynamic class bonus_9 extends MovieClip {
}
}//package
Section 121
//Camaro_2009 (Camaro_2009)
package {
import flash.display.*;
public dynamic class Camaro_2009 extends MovieClip {
public var mcA:MovieClip;
public var mcB:MovieClip;
public var mcC:MovieClip;
public var risMC:MovieClip;
public var mcSmokePoint:MovieClip;
public var mcDem1:MovieClip;
public var bodyMC:MovieClip;
}
}//package
Section 122
//carBody (carBody)
package {
import flash.display.*;
import flash.geom.*;
public class carBody {
public var body:MovieClip;
public var carData:CarData;
public var wb:MovieClip;
public var wf:MovieClip;
public var cont:MovieClip;
public function carBody(){
super();
carData = new CarData();
}
public function recolor1(n:int):void{
carData.recolor1(n);
}
public function initInString(s:String):void{
carData = new CarData();
carData.initInString(s);
init();
}
public function recolor2(n:int):void{
carData.recolor2(n);
}
public function clear():void{
if (body != null){
cont.removeChild(body);
body = null;
cont.removeChild(wb);
wb = null;
cont.removeChild(wf);
wf = null;
};
carData.cleanup();
body = null;
carData = new CarData();
}
public function whellSet(n:int):void{
var p:Point = new Point(carData.mcA.x, carData.mcA.y);
p = body.localToGlobal(p);
p = cont.globalToLocal(p);
wf.x = p.x;
wf.y = p.y;
p = new Point(carData.mcB.x, carData.mcB.y);
p = body.localToGlobal(p);
p = cont.globalToLocal(p);
wb.x = p.x;
wb.y = p.y;
setTypeWheel(n);
}
public function init():void{
carData.init4Game();
body = carData.vehicleView;
cont.addChild(body);
wb = carData.wheelBackView;
cont.addChild(wb);
wf = carData.wheelFrontView;
cont.addChild(wf);
recolor1(carData.color1);
recolor2(carData.color2);
whellSet(carData.WhellType);
}
public function initInNum(n:int):void{
carData = (CarData.allCar[n] as CarData);
init();
}
public function initInParam(n:CarData):void{
carData = n;
init();
}
public function cleanup():void{
clear();
body = null;
carData.cleanup();
}
public function setTypeWheel(n:int):void{
carData.wheelFrontSpoke.gotoAndStop(n);
carData.wheelFrontSpoke.cacheAsBitmap = true;
carData.wheelBackSpoke.gotoAndStop(n);
carData.wheelBackSpoke.cacheAsBitmap = true;
}
public static function create(m:MovieClip):carBody{
var r:carBody = new (carBody);
r.cont = m;
return (r);
}
}
}//package
Section 123
//CarData (CarData)
package {
import flash.display.*;
import pengine.*;
import myEng.*;
public class CarData {
public var SmokePoint:MovieClip;
public var turnPower:Number;
public var effectWeapon:int;
public var maxNitro:int;
public var turnAccCoeff:Number;
public var nameWheel:String;
public var wheelFrontSpoke:MovieClip;
public var turnYLimit:Number;
public var upVyhlop:int;
public var color1:int;
public var NitroPower:int;
public var maxLiveBody:int;
public var color2:int;
public var turnCoeffUp:Number;
public var upWeap:int;
public var upNitro:int;
public var turnCoeffDown:Number;
public var wheelBackView:MovieClip;
public var type:int;
public var upEng:int;
public var nameCar:String;
public var wheelBackSpoke:MovieClip;
public var upTrans:int;
public var nameView:String;
public var demWindMC:MovieClip;
public var wheelFrontView:MovieClip;
public var skeleton:TriangleSkeleton;
public var idealRPM:int;
public var upBody:int;
public var wheelBackAccelerate:Number;
public var wheelForwardBrake:Number;
public var koofPer:Array;
public var wheelForwardAccelerate:Number;
public var wheelBackBrake:Number;
public var viewObjectOrder:Array;
public var maxRPM:int;
public var mcB:DisplayObject;
public var mcC:DisplayObject;
public var WhellType:int;
public var vehicleView:MovieClip;
public var mcA:DisplayObject;
public var _koofPer:Array;
public var maxSpeedCur:Number;
public static var nameArr:Array = ["Audi R8", "BMW M3", "Mercedes SLR", "Camaro 2009", "Corvette Stingray", "Acura TL", "AstonMartin DB9", "Ford GT", "Chrysler 300", "Ferrari Enzo", "Jaguar XJ220", "Mustang Fastback", "Porsche 911 Turbo Coupe", "McLaren F1"];
public static var costCar:Array = [146000, 35750, 495000, 36580, 73000, 35105, 186450, 141245, 37885, 787300, 422120, 213000, 130050, 950000];
public static var allCar:Array = [];
protected static var m3arr:Array = [5, 5, 6, 6, 5, 6, 5, 4, 7, 4, 5, 5, 4, 4];
protected static var m2arr:Array = [6, 8, 5, 9, 9, 9, 8, 7, 10, 7, 7, 8, 5, 5];
protected static var m1arr:Array = [6, 7, 4, 8, 8, 8, 7, 7, 10, 6, 6, 7, 5, 4];
public function CarData(){
super();
type = 1;
color1 = 0;
color2 = 1;
maxNitro = 4;
upBody = 1;
upTrans = 1;
upEng = 1;
upVyhlop = 1;
upNitro = 1;
upWeap = 1;
}
public function cleanup():void{
skeleton = null;
wheelBackView = null;
wheelFrontView = null;
vehicleView = null;
wheelBackSpoke = null;
wheelFrontSpoke = null;
viewObjectOrder = null;
mcA = null;
mcB = null;
mcC = null;
SmokePoint = null;
demWindMC = null;
}
public function getString():String{
var ss:String = ((((((((((((((((((String(type) + "_") + String(color1)) + "_") + String(color2)) + "_") + String(WhellType)) + "_") + String(upBody)) + "_") + String(upTrans)) + "_") + String(upEng)) + "_") + String(upVyhlop)) + "_") + String(upNitro)) + "_") + String(upWeap));
return (ss);
}
public function makeVehicleView(vehicleZone_:DisplayObjectContainer):void{
var dObj:DisplayObject;
for each (dObj in viewObjectOrder) {
vehicleZone_.addChild(dObj);
};
}
public function allUp():Array{
var c:Array = [upBody, upTrans, upEng, upVyhlop, upNitro, upWeap];
return (c);
}
public function recolor2(n:int):void{
var m:MovieClip = (vehicleView["risMC"] as MovieClip);
m.gotoAndStop(n);
m.cacheAsBitmap = true;
}
public function recolor1(n:int):void{
var m:MovieClip = (vehicleView["bodyMC"] as MovieClip);
m.gotoAndStop(n);
m.cacheAsBitmap = true;
}
protected function recalcParam():void{
var hp:Array = [528, 230, 617, 400, 330, 286, 470, 711, 360, 651, 500, 320, 450, 550];
var maxSpeed:Array = [190, 0xFF, 330, 218, 264, 248, 300, 280, 240, 190, 270, 315, 185, 225];
var aRPMIdeal:Array = [78, 63, 65, 50, 62, 62, 50, 63, 48, 80, 50, 70, 40, 70];
maxSpeedCur = (((maxSpeed[type] / 140) + (upVyhlop / 4)) + (upEng / 5));
wheelForwardAccelerate = ((((hp[type] / 10) + (upEng * 5)) + (upVyhlop * 4)) + 10);
wheelBackAccelerate = ((((hp[type] / 10) + 1) + (upEng * 5)) + (upVyhlop * 4));
wheelForwardBrake = ((-(hp[type]) / 20) + (upEng * 2));
wheelBackBrake = ((-(hp[type]) / 20) + (upEng * 2));
turnPower = ((6 * 5) + (upTrans * 1.1));
turnCoeffDown = 1.3;
turnCoeffUp = 0.7;
turnYLimit = -0.9;
turnAccCoeff = 0.6;
NitroPower = ((40 + (wheelForwardAccelerate / 2)) * ((1 + (upNitro / 6)) + (upVyhlop / 7)));
maxNitro = upNitro;
maxRPM = 100;
idealRPM = aRPMIdeal[type];
effectWeapon = int(((20 + (hp[type] / 20)) * (0.8 + (upWeap / 5))));
koofPer = [0, 0.1, 0.2, 0.4, 0.5, 0.7, 1];
_koofPer = [0, 6, 5, 4, 3, 2.5, 2];
maxLiveBody = ((m3arr[type] * 20) * (1 + (upBody / 10)));
}
public function createTriangl():void{
skeleton = new TriangleSkeleton();
var ABSprS:Array = [0.9, 0.9, 1, 1, 1, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.8, 0.9, 0.9];
var BCSprS:Array = [0.9, 0.9, 0.9, 0.9, 0.8, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.8, 0.9, 0.9];
var ACSprS:Array = [0.9, 0.9, 0.9, 0.9, 0.8, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.8, 0.9, 0.9];
var ABSprU:Array = [0.9, 0.9, 0.9, 0.9, 1, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.8, 0.9, 0.9];
var BCSprU:Array = [0.9, 0.9, 0.9, 0.9, 0.8, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.8, 0.9, 0.9];
var ACSprU:Array = [0.9, 0.9, 0.9, 0.9, 0.8, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.8, 0.9, 0.9];
skeleton = new TriangleSkeleton().initTriangleSkeleton(Wheel.create().initWheel(0, 0, m1arr[type], 45, maxSpeedCur, null, null, 0.01, 0.1), Wheel.create().initWheel(0, 0, m2arr[type], 45, maxSpeedCur, null, null, 0.01, 0.1), Particle.create().initParticle(0, 0, m3arr[type], null), SpringConstraint.create().initSpringConstraint(ABSprS[type], ABSprU[type]), SpringConstraint.create().initSpringConstraint(BCSprS[type], BCSprU[type]), SpringConstraint.create().initSpringConstraint(ACSprS[type], ACSprU[type]));
}
public function init4Game():void{
recalcParam();
vehicleView = new (AllLevel.getLibraryClass(nameView));
recolor1(color1);
recolor2(color2);
wheelBackView = new (AllLevel.getLibraryClass(nameWheel));
wheelBackSpoke = (wheelBackView["rim"] as MovieClip);
wheelBackSpoke.gotoAndStop(WhellType);
wheelFrontView = new (AllLevel.getLibraryClass(nameWheel));
wheelFrontSpoke = (wheelFrontView["rim"] as MovieClip);
wheelFrontSpoke.gotoAndStop(WhellType);
demWindMC = (vehicleView["mcDem1"] as MovieClip);
mcA = (vehicleView["mcA"] as MovieClip);
mcA.visible = false;
mcB = (vehicleView["mcB"] as MovieClip);
mcB.visible = false;
mcC = (vehicleView["mcC"] as MovieClip);
mcC.visible = false;
setTypeWheel(WhellType);
SmokePoint = (vehicleView["mcSmokePoint"] as MovieClip);
SmokePoint.visible = false;
viewObjectOrder = [vehicleView, wheelBackView, wheelFrontView];
}
public function getCostUp(n:int):int{
var a:Array = [5, 10, 20, 8, 9, 7];
var b:Array = [1, 1, 1.5, 3, 3.5];
return ((int(((((a[n] * b[allUp()[n]]) * costCar[type]) / 250) / 100)) * 100));
}
public function initInString(s:String):void{
var t:Array = s.split("_");
type = int(t[0]);
color1 = int(t[1]);
color2 = int(t[2]);
WhellType = int(t[3]);
upBody = int(t[4]);
upTrans = int(t[5]);
upEng = int(t[6]);
upVyhlop = int(t[7]);
upNitro = int(t[8]);
upWeap = int(t[9]);
nameWheel = "WheelAll";
var a:Array = ["Audi_R8", "BMW_M3", "MercedesSLR", "Camaro_2009", "Corvette_Stingray", "Acura_TL", "AstonMartinDB9", "Ford_GT", "Chrysler_300", "Ferrari_Enzo", "Jaguar_XJ220", "Mustang_Fastback", "Porsche_911", "McLaren_F1"];
nameView = a[type];
nameCar = nameArr[type];
}
public function removeVehicleView():void{
var dObj:DisplayObject;
for each (dObj in viewObjectOrder) {
dObj.parent.removeChild(dObj);
};
}
public function upElement(n:int):void{
switch (n){
case 0:
upBody++;
break;
case 1:
upTrans++;
break;
case 2:
upEng++;
break;
case 3:
upVyhlop++;
break;
case 4:
upNitro++;
break;
case 5:
upWeap++;
break;
};
recalcParam();
}
public function enableUp(n:int):Boolean{
return ((allUp[n] < 4));
}
public function setTypeWheel(n:int):void{
wheelFrontSpoke.gotoAndStop(n);
wheelFrontSpoke.cacheAsBitmap = true;
wheelBackSpoke.gotoAndStop(n);
wheelBackSpoke.cacheAsBitmap = true;
}
public static function add2Array(s:String):void{
var n:CarData = new (CarData);
n.initInString(s);
allCar.push(n);
}
}
}//package
Section 124
//Chrysler_300 (Chrysler_300)
package {
import flash.display.*;
public dynamic class Chrysler_300 extends MovieClip {
public var mcA:MovieClip;
public var mcB:MovieClip;
public var mcC:MovieClip;
public var risMC:MovieClip;
public var mcSmokePoint:MovieClip;
public var mcDem1:MovieClip;
public var bodyMC:MovieClip;
}
}//package
Section 125
//Corvette_Stingray (Corvette_Stingray)
package {
import flash.display.*;
public dynamic class Corvette_Stingray extends MovieClip {
public var mcA:MovieClip;
public var mcB:MovieClip;
public var mcC:MovieClip;
public var risMC:MovieClip;
public var mcSmokePoint:MovieClip;
public var mcDem1:MovieClip;
public var bodyMC:MovieClip;
}
}//package
Section 126
//Ferrari_Enzo (Ferrari_Enzo)
package {
import flash.display.*;
public dynamic class Ferrari_Enzo extends MovieClip {
public var mcA:MovieClip;
public var mcB:MovieClip;
public var mcC:MovieClip;
public var risMC:MovieClip;
public var mcSmokePoint:MovieClip;
public var mcDem1:MovieClip;
public var bodyMC:MovieClip;
}
}//package
Section 127
//finishLine (finishLine)
package {
import myEng.*;
public dynamic class finishLine extends cFinishBonus {
}
}//package
Section 128
//Ford_GT (Ford_GT)
package {
import flash.display.*;
public dynamic class Ford_GT extends MovieClip {
public var mcA:MovieClip;
public var mcB:MovieClip;
public var mcC:MovieClip;
public var risMC:MovieClip;
public var mcSmokePoint:MovieClip;
public var mcDem1:MovieClip;
public var bodyMC:MovieClip;
}
}//package
Section 129
//gameMc (gameMc)
package {
public dynamic class gameMc extends allScr {
public function gameMc(){
addFrameScript(1, this.frame2);
}
function frame2(){
stop();
}
}
}//package
Section 130
//hit_1 (hit_1)
package {
import flash.display.*;
public dynamic class hit_1 extends MovieClip {
public var endPoint:MovieClip;
}
}//package
Section 131
//hit_10 (hit_10)
package {
import flash.display.*;
public dynamic class hit_10 extends MovieClip {
public var endPoint:MovieClip;
}
}//package
Section 132
//hit_11 (hit_11)
package {
import flash.display.*;
public dynamic class hit_11 extends MovieClip {
public var endPoint:MovieClip;
}
}//package
Section 133
//hit_12 (hit_12)
package {
import flash.display.*;
public dynamic class hit_12 extends MovieClip {
public var endPoint:MovieClip;
}
}//package
Section 134
//hit_13 (hit_13)
package {
import flash.display.*;
public dynamic class hit_13 extends MovieClip {
public var endPoint:MovieClip;
}
}//package
Section 135
//hit_14 (hit_14)
package {
import flash.display.*;
public dynamic class hit_14 extends MovieClip {
public var endPoint:MovieClip;
}
}//package
Section 136
//hit_15 (hit_15)
package {
import flash.display.*;
public dynamic class hit_15 extends MovieClip {
public var endPoint:MovieClip;
}
}//package
Section 137
//hit_16 (hit_16)
package {
import flash.display.*;
public dynamic class hit_16 extends MovieClip {
public var endPoint:MovieClip;
}
}//package
Section 138
//hit_17 (hit_17)
package {
import flash.display.*;
public dynamic class hit_17 extends MovieClip {
public var endPoint:MovieClip;
}
}//package
Section 139
//hit_18 (hit_18)
package {
import flash.display.*;
public dynamic class hit_18 extends MovieClip {
public var endPoint:MovieClip;
}
}//package
Section 140
//hit_19 (hit_19)
package {
import flash.display.*;
public dynamic class hit_19 extends MovieClip {
public var endPoint:MovieClip;
}
}//package
Section 141
//hit_2 (hit_2)
package {
import flash.display.*;
public dynamic class hit_2 extends MovieClip {
public var endPoint:MovieClip;
}
}//package
Section 142
//hit_20 (hit_20)
package {
import flash.display.*;
public dynamic class hit_20 extends MovieClip {
public var endPoint:MovieClip;
}
}//package
Section 143
//hit_21 (hit_21)
package {
import flash.display.*;
public dynamic class hit_21 extends MovieClip {
public var endPoint:MovieClip;
}
}//package
Section 144
//hit_22 (hit_22)
package {
import flash.display.*;
public dynamic class hit_22 extends MovieClip {
public var endPoint:MovieClip;
}
}//package
Section 145
//hit_23 (hit_23)
package {
import flash.display.*;
public dynamic class hit_23 extends MovieClip {
public var endPoint:MovieClip;
}
}//package
Section 146
//hit_24 (hit_24)
package {
import flash.display.*;
public dynamic class hit_24 extends MovieClip {
public var endPoint:MovieClip;
}
}//package
Section 147
//hit_25 (hit_25)
package {
import flash.display.*;
public dynamic class hit_25 extends MovieClip {
public var endPoint:MovieClip;
}
}//package
Section 148
//hit_26 (hit_26)
package {
import flash.display.*;
public dynamic class hit_26 extends MovieClip {
public var endPoint:MovieClip;
}
}//package
Section 149
//hit_27 (hit_27)
package {
import flash.display.*;
public dynamic class hit_27 extends MovieClip {
public var endPoint:MovieClip;
}
}//package
Section 150
//hit_28 (hit_28)
package {
import flash.display.*;
public dynamic class hit_28 extends MovieClip {
public var endPoint:MovieClip;
}
}//package
Section 151
//hit_29 (hit_29)
package {
import flash.display.*;
public dynamic class hit_29 extends MovieClip {
public var endPoint:MovieClip;
}
}//package
Section 152
//hit_3 (hit_3)
package {
import flash.display.*;
public dynamic class hit_3 extends MovieClip {
public var endPoint:MovieClip;
}
}//package
Section 153
//hit_30 (hit_30)
package {
import flash.display.*;
public dynamic class hit_30 extends MovieClip {
public var endPoint:MovieClip;
}
}//package
Section 154
//hit_31 (hit_31)
package {
import flash.display.*;
public dynamic class hit_31 extends MovieClip {
public var endPoint:MovieClip;
}
}//package
Section 155
//hit_32 (hit_32)
package {
import flash.display.*;
public dynamic class hit_32 extends MovieClip {
public var endPoint:MovieClip;
}
}//package
Section 156
//hit_33 (hit_33)
package {
import flash.display.*;
public dynamic class hit_33 extends MovieClip {
public var endPoint:MovieClip;
}
}//package
Section 157
//hit_34 (hit_34)
package {
import flash.display.*;
public dynamic class hit_34 extends MovieClip {
public var endPoint:MovieClip;
}
}//package
Section 158
//hit_35 (hit_35)
package {
import flash.display.*;
public dynamic class hit_35 extends MovieClip {
public var endPoint:MovieClip;
}
}//package
Section 159
//hit_36 (hit_36)
package {
import flash.display.*;
public dynamic class hit_36 extends MovieClip {
public var endPoint:MovieClip;
}
}//package
Section 160
//hit_37 (hit_37)
package {
import flash.display.*;
public dynamic class hit_37 extends MovieClip {
public var endPoint:MovieClip;
}
}//package
Section 161
//hit_38 (hit_38)
package {
import flash.display.*;
public dynamic class hit_38 extends MovieClip {
public var endPoint:MovieClip;
}
}//package
Section 162
//hit_39 (hit_39)
package {
import flash.display.*;
public dynamic class hit_39 extends MovieClip {
public var endPoint:MovieClip;
}
}//package
Section 163
//hit_4 (hit_4)
package {
import flash.display.*;
public dynamic class hit_4 extends MovieClip {
public var endPoint:MovieClip;
}
}//package
Section 164
//hit_40 (hit_40)
package {
import flash.display.*;
public dynamic class hit_40 extends MovieClip {
public var endPoint:MovieClip;
}
}//package
Section 165
//hit_41 (hit_41)
package {
import flash.display.*;
public dynamic class hit_41 extends MovieClip {
public var endPoint:MovieClip;
}
}//package
Section 166
//hit_42 (hit_42)
package {
import flash.display.*;
public dynamic class hit_42 extends MovieClip {
public var endPoint:MovieClip;
}
}//package
Section 167
//hit_43 (hit_43)
package {
import flash.display.*;
public dynamic class hit_43 extends MovieClip {
public var endPoint:MovieClip;
}
}//package
Section 168
//hit_44 (hit_44)
package {
import flash.display.*;
public dynamic class hit_44 extends MovieClip {
public var endPoint:MovieClip;
}
}//package
Section 169
//hit_45 (hit_45)
package {
import flash.display.*;
public dynamic class hit_45 extends MovieClip {
public var endPoint:MovieClip;
}
}//package
Section 170
//hit_46 (hit_46)
package {
import flash.display.*;
public dynamic class hit_46 extends MovieClip {
public var endPoint:MovieClip;
}
}//package
Section 171
//hit_47 (hit_47)
package {
import flash.display.*;
public dynamic class hit_47 extends MovieClip {
public var endPoint:MovieClip;
}
}//package
Section 172
//hit_48 (hit_48)
package {
import flash.display.*;
public dynamic class hit_48 extends MovieClip {
public var endPoint:MovieClip;
}
}//package
Section 173
//hit_49 (hit_49)
package {
import flash.display.*;
public dynamic class hit_49 extends MovieClip {
public var endPoint:MovieClip;
}
}//package
Section 174
//hit_5 (hit_5)
package {
import flash.display.*;
public dynamic class hit_5 extends MovieClip {
public var endPoint:MovieClip;
}
}//package
Section 175
//hit_50 (hit_50)
package {
import flash.display.*;
public dynamic class hit_50 extends MovieClip {
public var endPoint:MovieClip;
}
}//package
Section 176
//hit_6 (hit_6)
package {
import flash.display.*;
public dynamic class hit_6 extends MovieClip {
public var endPoint:MovieClip;
}
}//package
Section 177
//hit_7 (hit_7)
package {
import flash.display.*;
public dynamic class hit_7 extends MovieClip {
public var endPoint:MovieClip;
}
}//package
Section 178
//hit_8 (hit_8)
package {
import flash.display.*;
public dynamic class hit_8 extends MovieClip {
public var endPoint:MovieClip;
}
}//package
Section 179
//hit_9 (hit_9)
package {
import flash.display.*;
public dynamic class hit_9 extends MovieClip {
public var endPoint:MovieClip;
}
}//package
Section 180
//Jaguar_XJ220 (Jaguar_XJ220)
package {
import flash.display.*;
public dynamic class Jaguar_XJ220 extends MovieClip {
public var mcA:MovieClip;
public var mcB:MovieClip;
public var mcC:MovieClip;
public var risMC:MovieClip;
public var mcSmokePoint:MovieClip;
public var mcDem1:MovieClip;
public var bodyMC:MovieClip;
}
}//package
Section 181
//KeyConst (KeyConst)
package {
import base.*;
public class KeyConst {
public static var KEY_NITRO:int = 90;
public static var KEY_LEFT:int = 37;
public static var keyManager:KeyManager;
public static var KEY_UP:int = 38;
public static var KEY_DOWN:int = 40;
public static var KEY_JUMP:int = 32;
public static var KEY_Trik1:int = 49;
public static var KEY_Trik2:int = 50;
public static var KEY_Trik3:int = 51;
public static var KEY_Trik4:int = 52;
public static var KEY_Trik5:int = 53;
public static var KEY_Trik6:int = 54;
public static var KEY_Trik7:int = 55;
public static var KEY_RIGHT:int = 39;
public function KeyConst(){
super();
}
}
}//package
Section 182
//Main (Main)
package {
import flash.events.*;
import flash.display.*;
import flash.net.*;
public class Main extends Sprite {
public static var maxSpeed:Number;
public static var levTime:Array = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
public static var SCREEN_WIDTH:int = 800;
public static var maxLev:int = 0;
public static var SCREEN_HEIGHT:int = 550;
protected static var nameGame:String = "Dragster_01";
public static var mapRez:Array = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
public static var myRoot:allScr;
public static var levScore:Array = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
public static var curCar:int = 0;
public static var curLev:int = 0;
public function Main():void{
super();
if (stage){
init();
} else {
addEventListener(Event.ADDED_TO_STAGE, init);
};
}
private function init(e:Event=null):void{
removeEventListener(Event.ADDED_TO_STAGE, init);
this.focusRect = new MovieClip();
this.tabEnabled = false;
this.tabChildren = false;
myRoot = new gameMc();
stage.addChild(myRoot);
myRoot.gotoAndPlay(2);
myRoot.focusRect = new MovieClip();
myRoot.tabEnabled = false;
myRoot.tabChildren = false;
this.stage.focus = this;
var _allDinamicMC:MovieClip = new allDinamic();
var _allCar:MovieClip = new AllCar();
MochiBot.track(myRoot, "0376489b");
}
public static function saveData():void{
var d:SharedObject = SharedObject.getLocal(nameGame);
d.data["maxLev"] = Main.maxLev;
d.data["carCount"] = CarData.allCar.length;
var i:int;
while (i < CarData.allCar.length) {
d.data[("car" + String(i))] = (CarData.allCar[i] as CarData).getString();
i++;
};
var j:int;
while (j < mapRez.length) {
d.data[("mapRez" + String(j))] = mapRez[j];
d.data[("levTime" + String(j))] = levTime[j];
d.data[("levScore" + String(j))] = levScore[j];
j++;
};
d.data["curCar"] = curCar;
d.data["money"] = allScr.money;
d.data["maxSpeed"] = Main.maxSpeed;
d.flush();
}
public static function checkOldData():Boolean{
var d:SharedObject = SharedObject.getLocal(nameGame);
if (d.data["carCount"] != null){
return (true);
};
return (false);
}
public static function resetData():void{
mapRez = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
levTime = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
levScore = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
maxSpeed = 0;
CarData.allCar = [];
curCar = 0;
curLev = 0;
maxLev = 0;
allScr.money = 100;
}
public static function loadData():void{
var d:SharedObject = SharedObject.getLocal(nameGame);
var ll:int = int(d.data["carCount"]);
CarData.allCar = [];
var i:int;
while (i < ll) {
CarData.add2Array(d.data[("car" + String(i))]);
i++;
};
var j:int;
while (j < mapRez.length) {
mapRez[j] = int(d.data[("mapRez" + String(j))]);
levTime[j] = d.data[("levTime" + String(j))];
levScore[j] = d.data[("levScore" + String(j))];
j++;
};
curCar = int(d.data["curCar"]);
allScr.money = int(d.data["money"]);
Main.maxLev = int(d.data["maxLev"]);
Main.maxSpeed = d.data["maxSpeed"];
}
}
}//package
Section 183
//mcButle (mcButle)
package {
import flash.display.*;
public dynamic class mcButle extends MovieClip {
public var mcHit:MovieClip;
}
}//package
Section 184
//mcExpBig (mcExpBig)
package {
import flash.display.*;
public dynamic class mcExpBig extends MovieClip {
public var ex3:MovieClip;
public var ex1:MovieClip;
public var ex2:MovieClip;
}
}//package
Section 185
//mcInterface (mcInterface)
package {
import flash.display.*;
import flash.text.*;
public dynamic class mcInterface extends MovieClip {
public var mcLev:TextField;
public var mcCash:TextField;
public var btOptions:SimpleButton;
}
}//package
Section 186
//McLaren_F1 (McLaren_F1)
package {
import flash.display.*;
public dynamic class McLaren_F1 extends MovieClip {
public var mcA:MovieClip;
public var mcB:MovieClip;
public var mcC:MovieClip;
public var risMC:MovieClip;
public var mcSmokePoint:MovieClip;
public var mcDem1:MovieClip;
public var bodyMC:MovieClip;
}
}//package
Section 187
//mcMine (mcMine)
package {
import flash.display.*;
public dynamic class mcMine extends MovieClip {
}
}//package
Section 188
//mcMissel (mcMissel)
package {
import flash.display.*;
public dynamic class mcMissel extends MovieClip {
public var mcSmoke:MovieClip;
public var mcHit:MovieClip;
}
}//package
Section 189
//mcRace (mcRace)
package {
import myEng.*;
public dynamic class mcRace extends Race {
}
}//package
Section 190
//mcScrGarag (mcScrGarag)
package {
public dynamic class mcScrGarag extends scrGarag {
}
}//package
Section 191
//mcScrMap (mcScrMap)
package {
public dynamic class mcScrMap extends scrMap {
}
}//package
Section 192
//mcScrRez (mcScrRez)
package {
public dynamic class mcScrRez extends scrRez {
}
}//package
Section 193
//mcScrStart (mcScrStart)
package {
public dynamic class mcScrStart extends scrStart {
public function mcScrStart(){
addFrameScript(19, this.frame20);
}
function frame20(){
stop();
}
}
}//package
Section 194
//MercedesSLR (MercedesSLR)
package {
import flash.display.*;
public dynamic class MercedesSLR extends MovieClip {
public var mcA:MovieClip;
public var mcB:MovieClip;
public var mcC:MovieClip;
public var risMC:MovieClip;
public var mcSmokePoint:MovieClip;
public var mcDem1:MovieClip;
public var bodyMC:MovieClip;
}
}//package
Section 195
//midl1 (midl1)
package {
import flash.display.*;
public dynamic class midl1 extends MovieClip {
}
}//package
Section 196
//midl2 (midl2)
package {
import flash.display.*;
public dynamic class midl2 extends MovieClip {
}
}//package
Section 197
//midl3 (midl3)
package {
import flash.display.*;
public dynamic class midl3 extends MovieClip {
}
}//package
Section 198
//MochiBot (MochiBot)
package {
import flash.display.*;
import flash.net.*;
import flash.system.*;
public dynamic class MochiBot extends Sprite {
public function MochiBot(){
super();
}
public static function track(parent:Sprite, tag:String):MochiBot{
if (Security.sandboxType == "localWithFile"){
return (null);
};
var self:MochiBot = new (MochiBot);
parent.addChild(self);
Security.allowDomain("*");
Security.allowInsecureDomain("*");
var server:String = "http://core.mochibot.com/my/core.swf";
var lv:URLVariables = new URLVariables();
lv["sb"] = Security.sandboxType;
lv["v"] = Capabilities.version;
lv["swfid"] = tag;
lv["mv"] = "8";
lv["fv"] = "9";
var url:String = self.root.loaderInfo.loaderURL;
if (url.indexOf("http") == 0){
lv["url"] = url;
} else {
lv["url"] = "local";
};
var req:URLRequest = new URLRequest(server);
req.contentType = "application/x-www-form-urlencoded";
req.method = URLRequestMethod.POST;
req.data = lv;
var loader:Loader = new Loader();
self.addChild(loader);
loader.load(req);
return (self);
}
}
}//package
Section 199
//Mustang_Fastback (Mustang_Fastback)
package {
import flash.display.*;
public dynamic class Mustang_Fastback extends MovieClip {
public var mcA:MovieClip;
public var mcB:MovieClip;
public var mcC:MovieClip;
public var risMC:MovieClip;
public var mcSmokePoint:MovieClip;
public var mcDem1:MovieClip;
public var bodyMC:MovieClip;
}
}//package
Section 200
//NitroCPU (NitroCPU)
package {
import myEng.*;
public dynamic class NitroCPU extends myNitroCPU {
}
}//package
Section 201
//panMC (panMC)
package {
import myEng.*;
public dynamic class panMC extends cRacePanel {
}
}//package
Section 202
//partNum (partNum)
package {
import flash.display.*;
import flash.text.*;
public dynamic class partNum extends MovieClip {
public var txt:TextField;
}
}//package
Section 203
//pic_1 (pic_1)
package {
import flash.display.*;
public dynamic class pic_1 extends MovieClip {
}
}//package
Section 204
//pic_10 (pic_10)
package {
import flash.display.*;
public dynamic class pic_10 extends MovieClip {
}
}//package
Section 205
//pic_11 (pic_11)
package {
import flash.display.*;
public dynamic class pic_11 extends MovieClip {
}
}//package
Section 206
//pic_12 (pic_12)
package {
import flash.display.*;
public dynamic class pic_12 extends MovieClip {
}
}//package
Section 207
//pic_13 (pic_13)
package {
import flash.display.*;
public dynamic class pic_13 extends MovieClip {
}
}//package
Section 208
//pic_14 (pic_14)
package {
import flash.display.*;
public dynamic class pic_14 extends MovieClip {
}
}//package
Section 209
//pic_15 (pic_15)
package {
import flash.display.*;
public dynamic class pic_15 extends MovieClip {
}
}//package
Section 210
//pic_16 (pic_16)
package {
import flash.display.*;
public dynamic class pic_16 extends MovieClip {
}
}//package
Section 211
//pic_17 (pic_17)
package {
import flash.display.*;
public dynamic class pic_17 extends MovieClip {
}
}//package
Section 212
//pic_18 (pic_18)
package {
import flash.display.*;
public dynamic class pic_18 extends MovieClip {
}
}//package
Section 213
//pic_19 (pic_19)
package {
import flash.display.*;
public dynamic class pic_19 extends MovieClip {
}
}//package
Section 214
//pic_2 (pic_2)
package {
import flash.display.*;
public dynamic class pic_2 extends MovieClip {
}
}//package
Section 215
//pic_20 (pic_20)
package {
import flash.display.*;
public dynamic class pic_20 extends MovieClip {
}
}//package
Section 216
//pic_21 (pic_21)
package {
import flash.display.*;
public dynamic class pic_21 extends MovieClip {
}
}//package
Section 217
//pic_22 (pic_22)
package {
import flash.display.*;
public dynamic class pic_22 extends MovieClip {
}
}//package
Section 218
//pic_23 (pic_23)
package {
import flash.display.*;
public dynamic class pic_23 extends MovieClip {
}
}//package
Section 219
//pic_24 (pic_24)
package {
import flash.display.*;
public dynamic class pic_24 extends MovieClip {
}
}//package
Section 220
//pic_25 (pic_25)
package {
import flash.display.*;
public dynamic class pic_25 extends MovieClip {
}
}//package
Section 221
//pic_26 (pic_26)
package {
import flash.display.*;
public dynamic class pic_26 extends MovieClip {
}
}//package
Section 222
//pic_27 (pic_27)
package {
import flash.display.*;
public dynamic class pic_27 extends MovieClip {
}
}//package
Section 223
//pic_28 (pic_28)
package {
import flash.display.*;
public dynamic class pic_28 extends MovieClip {
}
}//package
Section 224
//pic_29 (pic_29)
package {
import flash.display.*;
public dynamic class pic_29 extends MovieClip {
}
}//package
Section 225
//pic_3 (pic_3)
package {
import flash.display.*;
public dynamic class pic_3 extends MovieClip {
}
}//package
Section 226
//pic_30 (pic_30)
package {
import flash.display.*;
public dynamic class pic_30 extends MovieClip {
}
}//package
Section 227
//pic_31 (pic_31)
package {
import flash.display.*;
public dynamic class pic_31 extends MovieClip {
}
}//package
Section 228
//pic_32 (pic_32)
package {
import flash.display.*;
public dynamic class pic_32 extends MovieClip {
}
}//package
Section 229
//pic_33 (pic_33)
package {
import flash.display.*;
public dynamic class pic_33 extends MovieClip {
}
}//package
Section 230
//pic_34 (pic_34)
package {
import flash.display.*;
public dynamic class pic_34 extends MovieClip {
}
}//package
Section 231
//pic_35 (pic_35)
package {
import flash.display.*;
public dynamic class pic_35 extends MovieClip {
}
}//package
Section 232
//pic_36 (pic_36)
package {
import flash.display.*;
public dynamic class pic_36 extends MovieClip {
}
}//package
Section 233
//pic_37 (pic_37)
package {
import flash.display.*;
public dynamic class pic_37 extends MovieClip {
}
}//package
Section 234
//pic_38 (pic_38)
package {
import flash.display.*;
public dynamic class pic_38 extends MovieClip {
}
}//package
Section 235
//pic_39 (pic_39)
package {
import flash.display.*;
public dynamic class pic_39 extends MovieClip {
}
}//package
Section 236
//pic_4 (pic_4)
package {
import flash.display.*;
public dynamic class pic_4 extends MovieClip {
}
}//package
Section 237
//pic_40 (pic_40)
package {
import flash.display.*;
public dynamic class pic_40 extends MovieClip {
}
}//package
Section 238
//pic_41 (pic_41)
package {
import flash.display.*;
public dynamic class pic_41 extends MovieClip {
}
}//package
Section 239
//pic_42 (pic_42)
package {
import flash.display.*;
public dynamic class pic_42 extends MovieClip {
}
}//package
Section 240
//pic_43 (pic_43)
package {
import flash.display.*;
public dynamic class pic_43 extends MovieClip {
}
}//package
Section 241
//pic_44 (pic_44)
package {
import flash.display.*;
public dynamic class pic_44 extends MovieClip {
}
}//package
Section 242
//pic_45 (pic_45)
package {
import flash.display.*;
public dynamic class pic_45 extends MovieClip {
}
}//package
Section 243
//pic_46 (pic_46)
package {
import flash.display.*;
public dynamic class pic_46 extends MovieClip {
}
}//package
Section 244
//pic_47 (pic_47)
package {
import flash.display.*;
public dynamic class pic_47 extends MovieClip {
}
}//package
Section 245
//pic_48 (pic_48)
package {
import flash.display.*;
public dynamic class pic_48 extends MovieClip {
}
}//package
Section 246
//pic_49 (pic_49)
package {
import flash.display.*;
public dynamic class pic_49 extends MovieClip {
}
}//package
Section 247
//pic_5 (pic_5)
package {
import flash.display.*;
public dynamic class pic_5 extends MovieClip {
}
}//package
Section 248
//pic_50 (pic_50)
package {
import flash.display.*;
public dynamic class pic_50 extends MovieClip {
}
}//package
Section 249
//pic_6 (pic_6)
package {
import flash.display.*;
public dynamic class pic_6 extends MovieClip {
}
}//package
Section 250
//pic_7 (pic_7)
package {
import flash.display.*;
public dynamic class pic_7 extends MovieClip {
}
}//package
Section 251
//pic_8 (pic_8)
package {
import flash.display.*;
public dynamic class pic_8 extends MovieClip {
}
}//package
Section 252
//pic_9 (pic_9)
package {
import flash.display.*;
public dynamic class pic_9 extends MovieClip {
}
}//package
Section 253
//Porsche_911 (Porsche_911)
package {
import flash.display.*;
public dynamic class Porsche_911 extends MovieClip {
public var mcA:MovieClip;
public var mcB:MovieClip;
public var mcC:MovieClip;
public var risMC:MovieClip;
public var mcSmokePoint:MovieClip;
public var mcDem1:MovieClip;
public var bodyMC:MovieClip;
}
}//package
Section 254
//Preloader (Preloader)
package {
import flash.events.*;
import flash.display.*;
import flash.net.*;
import flash.utils.*;
public class Preloader extends MovieClip {
protected var bt2:SimpleButton;
protected var prMCLine:MovieClip;
protected var bt:SimpleButton;
protected var prMC:MovieClip;
protected var tim:int;
public function Preloader(){
super();
prMC = new preloadMC();
addChild(prMC);
prMCLine = (prMC["mcPre"]["mcBar"] as MovieClip);
bt2 = (prMC["mcPre"]["hit"] as SimpleButton);
prMCLine.gotoAndStop(1);
tim = 0;
bt = (prMCLine["bt"] as SimpleButton);
bt.visible = false;
bt.addEventListener(MouseEvent.CLICK, okKey);
addEventListener(Event.ENTER_FRAME, checkFrame);
loaderInfo.addEventListener(ProgressEvent.PROGRESS, progress);
bt2.addEventListener(MouseEvent.CLICK, hitHTP);
}
protected function okKey(e:Event):void{
bt.removeEventListener(MouseEvent.CLICK, okKey);
bt = null;
prMC["mcPre"].gotoAndPlay("ok");
addEventListener(Event.ENTER_FRAME, endOk);
bt2.removeEventListener(MouseEvent.CLICK, hitHTP);
}
protected function checkFrame(e:Event):void{
tim++;
tim++;
var t:int = int(((loaderInfo.bytesLoaded / loaderInfo.bytesTotal) * 200));
t = Math.min(t, tim);
prMCLine.gotoAndStop(t);
if (t >= 200){
bt.visible = true;
removeEventListener(Event.ENTER_FRAME, checkFrame);
prMCLine = null;
};
}
protected function progress(e:ProgressEvent):void{
}
protected function hitHTP(e:Event):void{
var req:URLRequest = new URLRequest("http://www.nextplay.com/category/racing-games/1/top-rated.html?utm_medium=brandedgames_external&utm_campaign=race-or-die&utm_source=ingame&utm_content=ingame");
navigateToURL(req, "_blank");
}
protected function startup():void{
stop();
loaderInfo.removeEventListener(ProgressEvent.PROGRESS, progress);
var mainClass:Class = (getDefinitionByName("Main") as Class);
addChild((new (mainClass) as DisplayObject));
removeChild(prMC);
prMC = null;
}
protected function endOk(e:Event):void{
if (prMC["mcPre"].currentFrame == prMC["mcPre"].totalFrames){
removeEventListener(Event.ENTER_FRAME, endOk);
startup();
};
}
}
}//package
Section 255
//preloadMC (preloadMC)
package {
import flash.display.*;
public dynamic class preloadMC extends MovieClip {
public var mcPre:MovieClip;
}
}//package
Section 256
//scrGarag (scrGarag)
package {
import flash.events.*;
import flash.display.*;
import base.*;
import myEng.*;
import flash.text.*;
public class scrGarag extends MovieClip implements IData {
protected var mcBarEng:cBar;
protected var nCar:TextField;
protected var cName:TextField;
protected var mcBarSpeed:cBar;
protected var _MCcurColor:MovieClip;
protected var mcBarWeap:cBar;
protected var _car2:carBody;
protected var _car3:carBody;
protected var _car1:carBody;
protected var mcMenu2:MovieClip;
protected var _MCcurUzor:MovieClip;
protected var endFrame:int;
protected var _Menu:MovieClip;
protected var _curColor:int;
protected var _curUzor:int;
public var carMC:MovieClip;
protected var mcBarCase:cBar;
protected var curCar:int;
protected var mcBarNitro:cBar;
public function scrGarag(){
super();
allScr.myCurState = this;
init();
}
public function HideMenu(e:Event):void{
SoundConst._buttonClick();
_Menu.visible = !(_Menu.visible);
mcMenu2.visible = !(mcMenu2.visible);
}
public function btClMap(e:Event):void{
SoundConst._buttonClick();
allScr.setState(allScr.STATE_Map);
}
public function redrawNum():void{
var t:TextField;
var s:SimpleButton;
var i = 1;
while (i < 7) {
t = (mcMenu2[("mcCount" + String(i))] as TextField);
t.text = String(_car1.carData.allUp()[(i - 1)]);
s = (mcMenu2[("p" + String(i))] as SimpleButton);
s.visible = true;
t = (mcMenu2[("mcCost" + String(i))] as TextField);
t.visible = false;
if (_car1.carData.allUp()[(i - 1)] > 2){
s.visible = false;
} else {
if (_car1.carData.getCostUp((i - 1)) > allScr.money){
s.visible = false;
};
t.visible = true;
t.text = ("$ " + String(_car1.carData.getCostUp((i - 1))));
};
i++;
};
mcBarCase.value = _car1.carData.maxLiveBody;
mcBarSpeed.value = _car1.carData.maxSpeedCur;
mcBarEng.value = _car1.carData.wheelForwardAccelerate;
mcBarNitro.value = _car1.carData.NitroPower;
mcBarWeap.value = _car1.carData.effectWeapon;
nCar.text = ((("Car " + String((Main.curCar + 1))) + "/") + String(CarData.allCar.length));
}
public function init():void{
var s:SimpleButton;
curCar = Main.curCar;
carMC = (this["car"] as MovieClip);
carMC.stop();
_car1 = carBody.create((carMC.getChildByName("car0") as MovieClip));
_car2 = carBody.create((carMC.getChildByName("car1") as MovieClip));
_car3 = carBody.create((carMC.getChildByName("car2") as MovieClip));
mcMenu2 = (this["mcMenuUp"] as MovieClip);
mcBarSpeed = new cBar();
mcBarSpeed.init((mcMenu2["barSpeed"] as MovieClip));
mcBarSpeed.max = 5;
mcBarEng = new cBar();
mcBarEng.init((mcMenu2["barEng"] as MovieClip));
mcBarEng.max = 100;
mcBarCase = new cBar();
mcBarCase.init((mcMenu2["barCase"] as MovieClip));
mcBarCase.max = 230;
mcBarNitro = new cBar();
mcBarNitro.init((mcMenu2["barNitro"] as MovieClip));
mcBarNitro.max = 150;
mcBarWeap = new cBar();
mcBarWeap.init((mcMenu2["barWeap"] as MovieClip));
mcBarWeap.max = 90;
_Menu = (this["menuMC"] as MovieClip);
_MCcurColor = (_Menu["mcColorCar"] as MovieClip);
_MCcurUzor = (_Menu["mcColorDopEl"] as MovieClip);
s = (carMC["btNext"] as SimpleButton);
s.addEventListener(MouseEvent.CLICK, toRight);
if (CarData.allCar.length < 2){
s.visible = false;
};
s = (carMC["btPrev"] as SimpleButton);
s.addEventListener(MouseEvent.CLICK, toLeft);
if (CarData.allCar.length < 2){
s.visible = false;
};
s = (_Menu["btLColorCar"] as SimpleButton);
s.addEventListener(MouseEvent.CLICK, btLCC);
s = (_Menu["btRColorCar"] as SimpleButton);
s.addEventListener(MouseEvent.CLICK, btRCC);
s = (_Menu["btLDE"] as SimpleButton);
s.addEventListener(MouseEvent.CLICK, btLCU);
s = (_Menu["btRDE"] as SimpleButton);
s.addEventListener(MouseEvent.CLICK, btRCU);
s = (this["btHide"] as SimpleButton);
s.addEventListener(MouseEvent.CLICK, HideMenu);
s = (this["btBack"] as SimpleButton);
s.addEventListener(MouseEvent.CLICK, btClStart);
s = (this["btRace"] as SimpleButton);
s.addEventListener(MouseEvent.CLICK, btClMap);
s = (this["btPMG"] as SimpleButton);
s.addEventListener(MouseEvent.CLICK, allScr.btClic);
s = (this["logoNext"] as SimpleButton);
s.addEventListener(MouseEvent.CLICK, allScr.btClic);
var i = 1;
while (i <= 6) {
s = (mcMenu2[("p" + String(i))] as SimpleButton);
s.addEventListener(MouseEvent.CLICK, plus);
i++;
};
cName = (this["carName"] as TextField);
nCar = (this["carNum"] as TextField);
_car1.initInNum(curCar);
cName.text = _car1.carData.nameCar;
_curColor = _car1.carData.color1;
_curUzor = _car1.carData.color2;
_MCcurUzor.gotoAndStop(_curUzor);
_MCcurColor.gotoAndStop(_curColor);
redrawNum();
}
public function setCar(e:Event):void{
Main.curCar = curCar;
Main.saveData();
}
public function plus(e:Event):void{
SoundConst._playSound(SoundConst.MONEY);
var s:String = e.target.name;
allScr.money = (allScr.money - _car1.carData.getCostUp((int(s.charAt(1)) - 1)));
_car1.carData.upElement((int(s.charAt(1)) - 1));
CarData.allCar[Main.curCar] = _car1.carData;
Main.saveData();
redrawNum();
}
public function btRCC(e:Event):void{
_curColor++;
SoundConst._playSound(SoundConst.RECOLOR);
if (_curColor > 6){
_curColor = 1;
};
_MCcurColor.gotoAndStop(_curColor);
_car1.recolor1(_curColor);
_car1.carData.color1 = _curColor;
}
public function btLCC(e:Event):void{
_curColor--;
SoundConst._playSound(SoundConst.RECOLOR);
if (_curColor < 1){
_curColor = 6;
};
_MCcurColor.gotoAndStop(_curColor);
_car1.recolor1(_curColor);
_car1.carData.color1 = _curColor;
}
public function toLeft(e:Event):void{
SoundConst._buttonClick();
if (curCar == 0){
curCar = (CarData.allCar.length - 1);
} else {
curCar--;
};
cName.text = "";
_car2.clear();
_car3.clear();
_car2.initInNum(curCar);
_car3.initInNum(curCar);
carMC.gotoAndPlay("lbToLeft");
endFrame = 20;
carMC.addEventListener(Event.ENTER_FRAME, ef);
_Menu.visible = false;
mcMenu2.visible = false;
}
public function ef(e:Event):void{
if (carMC.currentFrame == endFrame){
_car1.cleanup();
_car1.initInNum(curCar);
cName.text = _car1.carData.nameCar;
trace(_car1.carData.getString());
carMC.gotoAndStop(1);
carMC.removeEventListener(Event.ENTER_FRAME, ef);
Main.curCar = curCar;
redrawNum();
_Menu.visible = true;
mcMenu2.visible = true;
_curColor = _car1.carData.color1;
_curUzor = _car1.carData.color2;
trace("uzor", _curUzor);
_MCcurUzor.gotoAndStop(_curUzor);
_MCcurColor.gotoAndStop(_curColor);
};
}
public function cleanup():void{
Main.saveData();
carMC = (this["car"] as MovieClip);
var s:SimpleButton = (_Menu["btLColorCar"] as SimpleButton);
s.removeEventListener(MouseEvent.CLICK, btLCC);
s = (_Menu["btRColorCar"] as SimpleButton);
s.removeEventListener(MouseEvent.CLICK, btRCC);
s = (_Menu["btLDE"] as SimpleButton);
s.removeEventListener(MouseEvent.CLICK, btLCU);
s = (_Menu["btRDE"] as SimpleButton);
s.removeEventListener(MouseEvent.CLICK, btRCU);
s = (this["btHide"] as SimpleButton);
s.removeEventListener(MouseEvent.CLICK, HideMenu);
s = (carMC["btNext"] as SimpleButton);
s.removeEventListener(MouseEvent.CLICK, toRight);
s = (carMC["btPrev"] as SimpleButton);
s.removeEventListener(MouseEvent.CLICK, toLeft);
s = (this["btBack"] as SimpleButton);
s.removeEventListener(MouseEvent.CLICK, btClStart);
s = (this["btRace"] as SimpleButton);
s.removeEventListener(MouseEvent.CLICK, btClMap);
mcBarCase.cleanup();
mcBarCase = null;
mcBarEng.cleanup();
mcBarEng = null;
mcBarNitro.cleanup();
mcBarNitro = null;
mcBarSpeed.cleanup();
mcBarSpeed = null;
mcBarWeap.cleanup();
mcBarWeap = null;
_MCcurUzor = null;
_MCcurColor = null;
_Menu = null;
var i = 1;
while (i <= 6) {
s = (mcMenu2[("p" + String(i))] as SimpleButton);
s.removeEventListener(MouseEvent.CLICK, plus);
i++;
};
s = (this["btPMG"] as SimpleButton);
s.removeEventListener(MouseEvent.CLICK, allScr.btClic);
s = (this["logoNext"] as SimpleButton);
s.removeEventListener(MouseEvent.CLICK, allScr.btClic);
mcMenu2 = null;
_car1.cleanup();
_car2.cleanup();
_car3.cleanup();
carMC = null;
_car1 = null;
_car2 = null;
_car3 = null;
}
public function btLCU(e:Event):void{
_curUzor--;
SoundConst._playSound(SoundConst.RECOLOR);
if (_curUzor < 1){
_curUzor = 6;
};
_MCcurUzor.gotoAndStop(_curUzor);
_car1.recolor2(_curUzor);
_car1.carData.color2 = _curUzor;
}
public function btRCU(e:Event):void{
_curUzor++;
SoundConst._playSound(SoundConst.RECOLOR);
if (_curUzor > 6){
_curUzor = 1;
};
_MCcurUzor.gotoAndStop(_curUzor);
_car1.recolor2(_curUzor);
_car1.carData.color2 = _curUzor;
}
public function btClStart(e:Event):void{
SoundConst._buttonClick();
allScr.setState(allScr.STATE_Start);
}
public function toRight(e:Event):void{
SoundConst._buttonClick();
if (curCar == (CarData.allCar.length - 1)){
curCar = 0;
} else {
curCar++;
};
cName.text = "";
_car2.clear();
_car3.clear();
_car2.initInNum(curCar);
_car3.initInNum(curCar);
carMC.gotoAndPlay("lbToRight");
endFrame = 40;
carMC.addEventListener(Event.ENTER_FRAME, ef);
_Menu.visible = false;
mcMenu2.visible = false;
}
}
}//package
Section 257
//scrHTP (scrHTP)
package {
import flash.events.*;
import flash.display.*;
public class scrHTP extends MovieClip {
public static var NG:Boolean;
public function scrHTP(){
super();
allScr.myCurState = this;
init();
}
public function init():void{
Main.myRoot.parent.addEventListener(KeyboardEvent.KEY_DOWN, btB);
var s:SimpleButton = (this["btBack"] as SimpleButton);
s.addEventListener(MouseEvent.CLICK, btB);
s = (this["btNext"] as SimpleButton);
s.addEventListener(MouseEvent.CLICK, btB);
s.visible = NG;
s = (this["logoNext"] as SimpleButton);
s.addEventListener(MouseEvent.CLICK, allScr.btClic);
}
public function cleanup():void{
Main.myRoot.parent.removeEventListener(KeyboardEvent.KEY_DOWN, btB);
var s:SimpleButton = (this["btBack"] as SimpleButton);
s.removeEventListener(MouseEvent.CLICK, btB);
s = (this["btNext"] as SimpleButton);
s.removeEventListener(MouseEvent.CLICK, btB);
s = (this["logoNext"] as SimpleButton);
s.removeEventListener(MouseEvent.CLICK, allScr.btClic);
}
public function kb(e:KeyboardEvent):void{
trace("bbb");
SoundConst._buttonClick();
allScr.setState(allScr.STATE_Start);
}
public function btB(e:Event):void{
SoundConst._buttonClick();
if (NG){
allScr.setState(allScr.STATE_Garag);
} else {
allScr.setState(allScr.STATE_Start);
};
}
}
}//package
Section 258
//scrHTPmc (scrHTPmc)
package {
public dynamic class scrHTPmc extends scrHTP {
}
}//package
Section 259
//scrMap (scrMap)
package {
import flash.events.*;
import flash.display.*;
import base.*;
import flash.text.*;
public class scrMap extends MovieClip implements IData {
public var btPlayMoney:SimpleButton;
public var car4Level:Array;
protected var selMoney:MovieClip;
public var btPlayCar:SimpleButton;
public var btPlayRace:SimpleButton;
protected var _tim:int;
protected var selCar:MovieClip;
protected var mcGateMap:MovieClip;
protected var selected:Boolean;
public var priz4Level:Array;
public var mcPrize:TextField;
public var mcMiss:MovieClip;
protected var carN:TextField;
public static var InCarGame:Boolean;
public static var curPriz:int;
public static var Diff:int;
public static var curEnemyCar:String;
public function scrMap(){
car4Level = ["11_1_4_5_1_1_1_1_1_1", "8_2_1_4_2_1_1_1_1_1", "12_4_5_5_1_2_2_1_1_1", "6_3_3_2_1_1_1_1_2_1_1", "10_1_3_7_2_1_1_1_2_1_1", "0_2_3_9_2_1_2_1_2_1_1", "2_6_3_10_2_1_2_2_2_1_1", "13_5_6_7_2_1_2_2_2_1_2", "9_3_6_5_2_1_2_2_2_1_2", "7_2_2_2_2_2_2_2_2_2_2"];
priz4Level = [1500, 2500, 5000, 10000, 20000, 50000, 75000, 90000, 100000, 150000];
super();
allScr.myCurState = this;
init();
}
public function efStart(e:Event):void{
_tim++;
if (_tim > 40){
removeEventListener(Event.ENTER_FRAME, efStart);
allScr.setState(allScr.STATE_Race);
};
}
public function update():void{
var m:MovieClip;
var s:SimpleButton;
var mS:MovieClip;
var mC:MovieClip;
var t:int;
if (Main.mapRez[Main.curLev] > 3){
Main.curLev = Main.maxLev;
};
var i:int;
while (i < 10) {
m = (this[("m_" + String((i + 1)))] as MovieClip);
s = (m["mcHit"] as SimpleButton);
mS = (m["mcS"] as MovieClip);
mC = (m["mcC"] as MovieClip);
mC.visible = false;
mS.visible = false;
t = 2;
s.visible = false;
if (Main.mapRez[i] > 0){
mC.visible = true;
mS.visible = true;
s.visible = true;
t = 3;
if (Main.mapRez[i] == 3){
mS.visible = false;
};
};
if (Main.mapRez[i] > 3){
mS.visible = false;
mC.visible = false;
s.visible = false;
t = 5;
};
if (i > Main.maxLev){
t = 1;
};
if (i == Main.maxLev){
mS.visible = true;
mC.visible = false;
s.visible = true;
t = 4;
};
if (i == Main.curLev){
t = 2;
};
m.gotoAndStop(t);
i++;
};
mcMiss.gotoAndStop((Main.curLev + 1));
curPriz = int((priz4Level[Main.curLev] * (1 + (Main.mapRez[Main.curLev] / 5))));
mcPrize.text = String(curPriz);
trace(Main.mapRez[Main.curLev]);
btPlayCar.enabled = true;
btPlayMoney.enabled = true;
btPlayRace.enabled = false;
btPlayRace.alpha = 0.7;
selected = false;
selCar.visible = false;
selMoney.visible = false;
if (Main.mapRez[Main.curLev] > 0){
btPlayCar.visible = true;
} else {
btPlayCar.visible = false;
btStartClick(null);
};
if (Main.mapRez[Main.curLev] > 2){
mcPrize.text = "";
btPlayMoney.visible = false;
btStartCarClick(null);
} else {
btPlayMoney.visible = true;
};
curEnemyCar = car4Level[Main.curLev];
var a:Array = curEnemyCar.split("_");
Diff = int((Main.curLev * 0.7));
var ss:CarData = CarData.allCar[Main.curCar];
if (a[1] == ss.color1){
a[1] = ((ss.color1 + 1) % 5);
};
if (Main.mapRez[Main.curLev] == 1){
var _local9 = a;
var _local10 = 4;
var _local11 = (_local9[_local10] + 1);
_local9[_local10] = _local11;
_local9 = a;
_local10 = 6;
_local11 = (_local9[_local10] + 1);
_local9[_local10] = _local11;
_local9 = a;
_local10 = 8;
_local11 = (_local9[_local10] + 1);
_local9[_local10] = _local11;
Diff++;
};
if (Main.mapRez[Main.curLev] == 2){
a[4] = 3;
_local9 = a;
_local10 = 6;
_local11 = (_local9[_local10] + 1);
_local9[_local10] = _local11;
_local9 = a;
_local10 = 7;
_local11 = (_local9[_local10] + 1);
_local9[_local10] = _local11;
a[8] = 3;
_local9 = a;
_local10 = 9;
_local11 = (_local9[_local10] + 1);
_local9[_local10] = _local11;
Diff = (Diff + 2);
};
if (Main.mapRez[Main.curLev] == 3){
a[4] = 3;
a[5] = 3;
a[6] = 3;
a[7] = 3;
a[8] = 3;
a[9] = 3;
Diff = (Diff + 3);
};
curEnemyCar = a.join("_");
carN.text = CarData.nameArr[int(a[0])];
allScr.updateLevel();
}
public function init():void{
var m:MovieClip;
btPlayRace = (this["btStart"] as SimpleButton);
btPlayRace.addEventListener(MouseEvent.CLICK, btClRace);
var s:SimpleButton = (this["btGarag"] as SimpleButton);
s.addEventListener(MouseEvent.CLICK, btClGarag);
s = (this["btPMG"] as SimpleButton);
s.addEventListener(MouseEvent.CLICK, allScr.btClic);
s = (this["logoNext"] as SimpleButton);
s.addEventListener(MouseEvent.CLICK, allScr.btClic);
mcGateMap = (this["mcGate"] as MovieClip);
mcGateMap.stop();
btPlayMoney = (this["btStartMoney"] as SimpleButton);
btPlayMoney.addEventListener(MouseEvent.CLICK, btStartClick);
btPlayCar = (this["btStartCar"] as SimpleButton);
btPlayCar.addEventListener(MouseEvent.CLICK, btStartCarClick);
selMoney = (this["sman"] as MovieClip);
selCar = (this["scar"] as MovieClip);
mcMiss = (this["mcMis"] as MovieClip);
mcPrize = (this["cost"] as TextField);
mcPrize.mouseEnabled = false;
var max:int;
var i = 1;
while (i < 11) {
m = (this[("m_" + String(i))] as MovieClip);
s = (m["mcHit"] as SimpleButton);
s.addEventListener(MouseEvent.CLICK, clickMark);
if (Main.mapRez[(i - 1)] < 3){
max = (i - 1);
};
i++;
};
Main.curLev = Math.min(Main.maxLev, max);
carN = (this["carName"] as TextField);
update();
}
public function cleanup():void{
var m:MovieClip;
btPlayMoney = (this["btStart"] as SimpleButton);
btPlayMoney.removeEventListener(MouseEvent.CLICK, btStartClick);
btPlayCar.removeEventListener(MouseEvent.CLICK, btStartCarClick);
btPlayCar = null;
mcMiss = null;
var s:SimpleButton = (this["btStart"] as SimpleButton);
s.removeEventListener(MouseEvent.CLICK, btClRace);
s = (this["btGarag"] as SimpleButton);
s.removeEventListener(MouseEvent.CLICK, btClGarag);
s = (this["btPMG"] as SimpleButton);
s.removeEventListener(MouseEvent.CLICK, allScr.btClic);
s = (this["logoNext"] as SimpleButton);
s.removeEventListener(MouseEvent.CLICK, allScr.btClic);
var i = 1;
while (i < 11) {
m = (this[("m_" + String(i))] as MovieClip);
s = (m["mcHit"] as SimpleButton);
s.removeEventListener(MouseEvent.CLICK, clickMark);
i++;
};
}
public function btClRace(e:Event):void{
if (!selected){
return;
};
startGate();
}
public function startGate():void{
_tim = 0;
SoundConst._buttonClick();
mcGateMap.gotoAndPlay(2);
mcGateMap["mcDG"]["mcMis"].gotoAndStop((Main.curLev + 1));
addEventListener(Event.ENTER_FRAME, efStart);
allScr.interf.visible = false;
}
public function btClGarag(e:Event):void{
SoundConst._buttonClick();
allScr.setState(allScr.STATE_Garag);
}
public function clickMark(e:Event):void{
var s:String = e.target.parent.name;
var a:Array = s.split("_");
SoundConst._buttonClick();
Main.curLev = Math.min(int((a[1] - 1)), Main.maxLev);
update();
}
public function btStartCarClick(e:Event):void{
selCar.visible = true;
selMoney.visible = false;
selected = true;
btPlayCar.enabled = false;
btPlayMoney.enabled = true;
btPlayRace.alpha = 1;
btPlayRace.enabled = true;
InCarGame = true;
curPriz = 0;
}
public function btStartClick(e:Event):void{
selCar.visible = false;
selMoney.visible = true;
selected = true;
btPlayCar.enabled = true;
btPlayMoney.enabled = false;
btPlayRace.alpha = 1;
btPlayRace.enabled = true;
InCarGame = false;
curPriz = int((priz4Level[Main.curLev] * (1 + (Main.mapRez[Main.curLev] / 5))));
}
}
}//package
Section 260
//scrOption (scrOption)
package {
import flash.events.*;
import flash.display.*;
import base.*;
public class scrOption extends MovieClip implements IData {
protected var graph:MovieClip;
public var drag:Boolean;
protected var vol:SimpleButton;
public function scrOption(){
super();
}
public function onClicON(e:Event):void{
drag = true;
}
public function onDrag(e:Event):void{
var xx:int;
if (drag){
xx = (int((Math.min(500, Math.max(358, (mouseX + 15))) / 10)) * 10);
if (int((SoundConst.SOUND_VOLUME * 10)) != int(((10 * (xx - 358)) / 142))){
trace(((xx - 358) / 142));
SoundConst.SOUND_VOLUME = ((xx - 358) / 142);
setVolPos();
};
};
}
public function setVolPos():void{
SoundConst.MUSIC_VOLUME = (0.4 * SoundConst.SOUND_VOLUME);
var x:Number = (358 + (SoundConst.SOUND_VOLUME * 142));
vol.x = x;
SoundConst.setVolume();
SoundConst._buttonClick();
}
public function setHigh(e:Event):void{
SoundConst._buttonClick();
stage.quality = "HIGH";
graph.gotoAndStop(1);
}
public function onClicOFF(e:Event):void{
drag = false;
}
public function setMed(e:Event):void{
SoundConst._buttonClick();
stage.quality = "MEDIUM";
graph.gotoAndStop(2);
}
public function SFXOnOff(e:Event):void{
SoundConst.sfxOn = !(SoundConst.sfxOn);
if (SoundConst.sfxOn){
SoundConst._buttonClick();
this["mcSWF"].gotoAndStop(1);
SoundConst._soundOn();
} else {
this["mcSWF"].gotoAndStop(2);
SoundConst._soundOff();
if (SoundConst.musicOn){
SoundConst._buttonClick();
SoundConst._playBGMusic();
};
};
}
public function volPlus(e:Event):void{
SoundConst.SOUND_VOLUME = Math.min(1, (SoundConst.SOUND_VOLUME + 0.1));
setVolPos();
}
public function init():void{
graph = (this["trGraph"] as MovieClip);
graph.stop();
var s:SimpleButton = (this["btSFX1"] as SimpleButton);
s.addEventListener(MouseEvent.CLICK, SFXOnOff);
s = (this["btSFX2"] as SimpleButton);
s.addEventListener(MouseEvent.CLICK, SFXOnOff);
s = (this["btM2"] as SimpleButton);
s.addEventListener(MouseEvent.CLICK, musicOnOff);
s = (this["btM1"] as SimpleButton);
s.addEventListener(MouseEvent.CLICK, musicOnOff);
s = (this["ntExit"] as SimpleButton);
s.addEventListener(MouseEvent.CLICK, exitBt);
if (SoundConst.sfxOn){
this["mcSWF"].gotoAndStop(1);
} else {
this["mcSWF"].gotoAndStop(2);
};
if (SoundConst.musicOn){
this["mcM"].gotoAndStop(1);
} else {
this["mcM"].gotoAndStop(2);
};
s = (graph["btLow"] as SimpleButton);
s.addEventListener(MouseEvent.CLICK, setLow);
s = (graph["btMed"] as SimpleButton);
s.addEventListener(MouseEvent.CLICK, setMed);
s = (graph["btHigh"] as SimpleButton);
s.addEventListener(MouseEvent.CLICK, setHigh);
s = (this["btvolmax"] as SimpleButton);
s.addEventListener(MouseEvent.CLICK, volPlus);
s = (this["btVolmin"] as SimpleButton);
s.addEventListener(MouseEvent.CLICK, volMinus);
vol = (this["dv"] as SimpleButton);
vol.addEventListener(MouseEvent.MOUSE_DOWN, onClicON);
vol.addEventListener(MouseEvent.MOUSE_UP, onClicOFF);
this.addEventListener(MouseEvent.MOUSE_UP, onClicOFF);
vol.addEventListener(Event.ENTER_FRAME, onDrag);
drag = false;
setVolPos();
trace(stage.quality);
if (stage.quality == "LOW"){
graph.gotoAndStop(3);
};
if (stage.quality == "MEDIUM"){
graph.gotoAndStop(2);
};
}
public function cleanup():void{
var s:SimpleButton = (this["btSFX1"] as SimpleButton);
s.removeEventListener(MouseEvent.CLICK, SFXOnOff);
s = (this["btSFX2"] as SimpleButton);
s.removeEventListener(MouseEvent.CLICK, SFXOnOff);
s = (this["btM2"] as SimpleButton);
s.removeEventListener(MouseEvent.CLICK, musicOnOff);
s = (this["btM1"] as SimpleButton);
s.removeEventListener(MouseEvent.CLICK, musicOnOff);
s = (graph["btLow"] as SimpleButton);
s.removeEventListener(MouseEvent.CLICK, setLow);
s = (graph["btMed"] as SimpleButton);
s.removeEventListener(MouseEvent.CLICK, setMed);
s = (graph["btHigh"] as SimpleButton);
s.removeEventListener(MouseEvent.CLICK, setHigh);
s = (this["btvolmax"] as SimpleButton);
s.removeEventListener(MouseEvent.CLICK, volPlus);
s = (this["btVolmin"] as SimpleButton);
s.removeEventListener(MouseEvent.CLICK, volMinus);
vol = null;
graph = null;
}
public function musicOnOff(e:Event):void{
SoundConst.musicOn = !(SoundConst.musicOn);
if (SoundConst.musicOn){
SoundConst._buttonClick();
this["mcM"].gotoAndStop(1);
SoundConst._playBGMusic();
} else {
this["mcM"].gotoAndStop(2);
SoundConst._stopBGSound();
};
}
public function setLow(e:Event):void{
stage.quality = "LOW";
SoundConst._buttonClick();
graph.gotoAndStop(3);
}
public function volMinus(e:Event):void{
SoundConst.SOUND_VOLUME = Math.max(0, (SoundConst.SOUND_VOLUME - 0.1));
setVolPos();
}
public function exitBt(e:Event):void{
SoundConst._buttonClick();
cleanup();
this.parent.removeChild(this);
}
}
}//package
Section 261
//scrRez (scrRez)
package {
import flash.events.*;
import flash.display.*;
import base.*;
import myEng.*;
import flash.text.*;
public class scrRez extends MovieClip implements IData {
public static var Win:Boolean;
public static var FindMoney:int;
public function scrRez(){
super();
allScr.myCurState = this;
init();
}
public function init():void{
var t:TextField;
var dt:Number;
var _car1:carBody;
Main.myRoot.parent.addEventListener(KeyboardEvent.KEY_DOWN, btClRace);
SoundConst._playIntroMusic();
var CarMC:MovieClip = (this["mcCar"] as MovieClip);
CarMC.visible = false;
var s:SimpleButton = (this["btRace"] as SimpleButton);
s.addEventListener(MouseEvent.CLICK, btClRace);
s = (this["btPMG"] as SimpleButton);
s.addEventListener(MouseEvent.CLICK, allScr.btClic);
s = (this["logoNext"] as SimpleButton);
s.addEventListener(MouseEvent.CLICK, allScr.btClic);
var scorePlusMC:TextField = (this["mcPlusScore"] as TextField);
scorePlusMC.visible = false;
var timeMC:TextField = (this["mcTime"] as TextField);
timeMC.text = cRacePanel.convertTimer(cRacePanel.myTimer);
var timePlusMC:TextField = (this["mcPlusTime"] as TextField);
timePlusMC.visible = false;
var prizPlusMC:TextField = (this["mcPlusPrizMoney"] as TextField);
prizPlusMC.visible = false;
prizPlusMC.text = ("+$ " + String(scrMap.curPriz));
var findPlusMC:TextField = (this["mcPlusFindMoney"] as TextField);
findPlusMC.text = ("+$ " + String(FindMoney));
var PlusMoneyMC:TextField = (this["mcPlusMoney"] as TextField);
PlusMoneyMC.visible = false;
PlusMoneyMC.text = ("=$ " + String((FindMoney + scrMap.curPriz)));
var tMaxSpeed:TextField = (this["mcMaxSpeed"] as TextField);
var mxs:Number = (int((cRacePanel.maxSpeed * 105)) / 10);
tMaxSpeed.text = String(mxs);
var tPMaxSpeed:TextField = (this["mcPlusMaxSpeed"] as TextField);
if (Main.maxSpeed < mxs){
tPMaxSpeed.text = ("+" + String((int(((mxs - Main.maxSpeed) * 10)) / 10)));
Main.maxSpeed = mxs;
tPMaxSpeed.visible = true;
cRacePanel.Score = (cRacePanel.Score * 1.1);
} else {
tPMaxSpeed.text = "";
tPMaxSpeed.visible = false;
};
var mm:MovieClip = (this["mcRez"] as MovieClip);
if (Win){
if (Main.levTime[Main.curLev] > cRacePanel.myTimer){
dt = (Main.levTime[Main.curLev] - cRacePanel.myTimer);
timePlusMC.text = cRacePanel.convertTimer(dt);
timePlusMC.visible = true;
trace("tp///////////////////////", timePlusMC);
Main.levTime[Main.curLev] = cRacePanel.myTimer;
cRacePanel.Score = (cRacePanel.Score * 1.1);
};
if (Main.levTime[Main.curLev] == 0){
Main.levTime[Main.curLev] = cRacePanel.myTimer;
};
if (Main.levScore[Main.curLev] < int(cRacePanel.Score)){
scorePlusMC.text = ("+" + String((int(cRacePanel.Score) - Main.levScore[Main.curLev])));
scorePlusMC.visible = true;
Main.levScore[Main.curLev] = int(cRacePanel.Score);
};
mm.gotoAndStop(1);
if (Main.curLev == Main.maxLev){
Main.maxLev++;
};
var _local16 = Main.mapRez;
var _local17 = Main.curLev;
var _local18 = (_local16[_local17] + 1);
_local16[_local17] = _local18;
if (scrMap.InCarGame){
_car1 = carBody.create(CarMC);
CarMC.visible = true;
_car1.initInString(scrMap.curEnemyCar);
prizPlusMC.visible = false;
prizPlusMC.text = "";
CarData.add2Array(scrMap.curEnemyCar);
Main.mapRez[Main.curLev] = 10;
Main.curLev = Main.maxLev;
} else {
prizPlusMC.visible = true;
};
findPlusMC.visible = true;
PlusMoneyMC.visible = true;
allScr.money = (allScr.money + (FindMoney + scrMap.curPriz));
t = (this["mcScore"] as TextField);
t.text = String(int(cRacePanel.Score));
Main.saveData();
} else {
PlusMoneyMC.visible = false;
prizPlusMC.visible = false;
allScr.money = (allScr.money + FindMoney);
mm.gotoAndStop(2);
};
}
public function btClRace(e:Event):void{
allScr.setState(allScr.STATE_Garag);
}
public function cleanup():void{
Main.myRoot.parent.removeEventListener(KeyboardEvent.KEY_DOWN, btClRace);
var s:SimpleButton = (this["btRace"] as SimpleButton);
s.removeEventListener(MouseEvent.CLICK, btClRace);
s = (this["btPMG"] as SimpleButton);
s.removeEventListener(MouseEvent.CLICK, allScr.btClic);
s = (this["logoNext"] as SimpleButton);
s.removeEventListener(MouseEvent.CLICK, allScr.btClic);
}
}
}//package
Section 262
//scrScrOptions (scrScrOptions)
package {
public dynamic class scrScrOptions extends scrOption {
}
}//package
Section 263
//scrStart (scrStart)
package {
import flash.events.*;
import flash.display.*;
import base.*;
public class scrStart extends MovieClip implements IData {
public var mcWind:MovieClip;
public function scrStart(){
super();
allScr.myCurState = this;
init();
}
public function init():void{
var s:SimpleButton = (this["btNew"] as SimpleButton);
s.addEventListener(MouseEvent.CLICK, btClNew);
s = (this["btCont"] as SimpleButton);
s.addEventListener(MouseEvent.CLICK, btClCont);
s.visible = Main.checkOldData();
s = (this["btHTP"] as SimpleButton);
s.addEventListener(MouseEvent.CLICK, btClHTP);
s = (this["logoNext"] as SimpleButton);
s.addEventListener(MouseEvent.CLICK, allScr.btClic);
mcWind = (this["mcMovWind"] as MovieClip);
s = (mcWind["mcWind"]["btYes"] as SimpleButton);
s.addEventListener(MouseEvent.CLICK, btClYes);
s = (mcWind["mcWind"]["btNo"] as SimpleButton);
s.addEventListener(MouseEvent.CLICK, btClNo);
s = (this["btPMG"] as SimpleButton);
s.addEventListener(MouseEvent.CLICK, allScr.btClic);
SoundConst._playIntroMusic();
}
public function btClNo(e:Event):void{
SoundConst._buttonClick();
mcWind.gotoAndStop(1);
}
public function btClNew(e:Event):void{
SoundConst._buttonClick();
if (Main.checkOldData()){
mcWind.gotoAndPlay(2);
} else {
btClYes(e);
};
}
public function cleanup():void{
var s:SimpleButton = (this["btNew"] as SimpleButton);
s.removeEventListener(MouseEvent.CLICK, btClNew);
s = (this["btCont"] as SimpleButton);
s.removeEventListener(MouseEvent.CLICK, btClCont);
s = (this["btHTP"] as SimpleButton);
s.removeEventListener(MouseEvent.CLICK, btClHTP);
s = (mcWind["mcWind"]["btYes"] as SimpleButton);
s.removeEventListener(MouseEvent.CLICK, btClYes);
s = (mcWind["mcWind"]["btNo"] as SimpleButton);
s.removeEventListener(MouseEvent.CLICK, btClNo);
s = (this["logoNext"] as SimpleButton);
s.removeEventListener(MouseEvent.CLICK, allScr.btClic);
mcWind = null;
}
public function btClHTP(e:Event):void{
scrHTP.NG = false;
SoundConst._buttonClick();
allScr.setState(allScr.STATE_HTP);
}
public function btClYes(e:Event):void{
SoundConst._buttonClick();
Main.resetData();
CarData.add2Array("1_3_2_2_1_1_1_1_1_1");
CarData.add2Array("4_2_1_2_1_1_1_1_1_1");
CarData.add2Array("5_4_3_2_1_1_1_1_1_1");
allScr.money = 1500;
Main.saveData();
scrHTP.NG = true;
allScr.setState(allScr.STATE_HTP);
}
public function btClCont(e:Event):void{
SoundConst._buttonClick();
Main.resetData();
Main.loadData();
allScr.setState(allScr.STATE_Garag);
}
}
}//package
Section 264
//scrWin (scrWin)
package {
import flash.events.*;
import flash.display.*;
import myEng.*;
import flash.text.*;
public class scrWin extends MovieClip {
public function scrWin(){
super();
allScr.myCurState = this;
init();
}
public function init():void{
Main.myRoot.parent.addEventListener(KeyboardEvent.KEY_UP, btB);
var s:SimpleButton = (this["btBack"] as SimpleButton);
s.addEventListener(MouseEvent.CLICK, btB);
s = (this["btPMG"] as SimpleButton);
s.addEventListener(MouseEvent.CLICK, allScr.btClic);
s = (this["logoNext"] as SimpleButton);
s.addEventListener(MouseEvent.CLICK, allScr.btClic);
var CarMC:MovieClip = (this["mcCar"] as MovieClip);
var _car1:carBody = carBody.create(CarMC);
CarMC.visible = true;
_car1.initInString(scrMap.curEnemyCar);
CarData.add2Array(scrMap.curEnemyCar);
Main.mapRez[Main.curLev] = 10;
Main.curLev = (Main.maxLev + 1);
var mxs:Number = (int((cRacePanel.maxSpeed * 105)) / 10);
if (Main.maxSpeed < mxs){
Main.maxSpeed = mxs;
cRacePanel.Score = (cRacePanel.Score * 1.1);
};
if (Main.levTime[Main.curLev] > cRacePanel.myTimer){
Main.levTime[Main.curLev] = cRacePanel.myTimer;
cRacePanel.Score = (cRacePanel.Score * 1.1);
};
if (Main.levScore[Main.curLev] < int(cRacePanel.Score)){
Main.levScore[Main.curLev] = int(cRacePanel.Score);
};
var scor:int;
var i:int;
while (i < Main.levScore.length) {
scor = (scor + int(Main.levScore[i]));
i++;
};
var scoreMC:TextField = (this["mcScore"] as TextField);
scoreMC.text = String(scor);
var ms:TextField = (this["mcMaxSpeed"] as TextField);
ms.text = String(Main.maxSpeed);
}
public function cleanup():void{
Main.myRoot.parent.removeEventListener(KeyboardEvent.KEY_UP, btB);
var s:SimpleButton = (this["btBack"] as SimpleButton);
s.removeEventListener(MouseEvent.CLICK, btB);
s = (this["btPMG"] as SimpleButton);
s.removeEventListener(MouseEvent.CLICK, allScr.btClic);
s = (this["logoNext"] as SimpleButton);
s.removeEventListener(MouseEvent.CLICK, allScr.btClic);
}
public function btB(e:Event):void{
SoundConst._buttonClick();
allScr.setState(allScr.STATE_Start);
}
}
}//package
Section 265
//scrWinMc (scrWinMc)
package {
public dynamic class scrWinMc extends scrWin {
}
}//package
Section 266
//smokeMC (smokeMC)
package {
import flash.display.*;
public dynamic class smokeMC extends MovieClip {
}
}//package
Section 267
//SoundConst (SoundConst)
package {
import flash.display.*;
import flash.media.*;
import sound.*;
public class SoundConst {
public var m_engineLoop:SoundChannel;
public static const SHILD:String = "shild.wav";
public static const REPAIR:String = "repear.wav";
public static const LEVEL_LOSE:String = "bonus.wav";
public static const ADDNITRO:String = "addNitro.wav";
public static const BUTTON_CLICK:String = "but.wav";
public static const MONEY:String = "MonetSound.wav";
public static const HOT:String = "hotShot.wav";
public static const LEVEL_START:String = "startRace.wav";
public static const MISSEL:String = "Missle.wav";
public static const MINE:String = "mine.wav";
public static const LEVEL_WIN:String = "win.wav";
public static const EXPL:String = "expl.wav";
public static const RECOLOR:String = "recolor.wav";
public static const NITRO:String = "nitro.wav";
public static const MUSIC_2:String = "inGame.wav";
public static const MUSIC_1:String = "intro.wav";
public static const BONUSsound:String = "bonus.wav";
protected static var curBGSound:String = "intro.wav";
public static var soundManager:SoundManager;
public static var MUSIC_VOLUME:Number = 0.3;
public static var sfxOn:Boolean = true;
public static var musicOn:Boolean = true;
public static var SOUND_VOLUME:Number = 1;
public static var bgch:SoundChannel;
public static var _instance:SoundConst;
public function SoundConst(){
super();
_instance = this;
init();
}
public function get volume():Number{
return (SOUND_VOLUME);
}
public function set volume(value:Number):void{
SOUND_VOLUME = value;
MUSIC_VOLUME = (value * 0.6);
setVolume();
}
public static function _soundOn():void{
sfxOn = true;
soundManager.soundOn = true;
if (musicOn){
soundManager.playBackSound(curBGSound);
};
}
public static function _playIntroMusic():void{
if (soundManager == null){
init();
};
if (musicOn){
bgch = soundManager.playBackSound(MUSIC_1);
};
curBGSound = MUSIC_1;
}
public static function init():void{
var m:MovieClip = new allSounds();
soundManager = new SoundManager();
soundManager.addSound(MUSIC_1);
soundManager.addSound(MUSIC_2);
soundManager.addSound(BUTTON_CLICK);
soundManager.addSound(LEVEL_WIN);
soundManager.addSound(LEVEL_LOSE);
soundManager.addSound(LEVEL_START);
soundManager.addSound(ADDNITRO);
soundManager.addSound(BONUSsound);
soundManager.addSound(EXPL);
soundManager.addSound(NITRO);
soundManager.addSound(SHILD);
soundManager.addSound(MISSEL);
soundManager.addSound(MONEY);
soundManager.addSound(RECOLOR);
soundManager.addSound(REPAIR);
soundManager.addSound(HOT);
soundManager.addSound(MINE);
setVolume();
}
public static function setVolume():void{
var transform:SoundTransform;
soundManager.setVolume(MUSIC_1, MUSIC_VOLUME);
soundManager.setVolume(MUSIC_2, MUSIC_VOLUME);
soundManager.setVolume(BUTTON_CLICK, SOUND_VOLUME);
soundManager.setVolume(LEVEL_WIN, SOUND_VOLUME);
soundManager.setVolume(LEVEL_LOSE, SOUND_VOLUME);
soundManager.setVolume(LEVEL_START, SOUND_VOLUME);
soundManager.setVolume(ADDNITRO, SOUND_VOLUME);
soundManager.setVolume(BONUSsound, SOUND_VOLUME);
soundManager.setVolume(EXPL, SOUND_VOLUME);
soundManager.setVolume(NITRO, SOUND_VOLUME);
soundManager.setVolume(SHILD, SOUND_VOLUME);
soundManager.setVolume(MISSEL, SOUND_VOLUME);
soundManager.setVolume(MONEY, SOUND_VOLUME);
soundManager.setVolume(RECOLOR, SOUND_VOLUME);
soundManager.setVolume(REPAIR, SOUND_VOLUME);
soundManager.setVolume(MINE, SOUND_VOLUME);
soundManager.setVolume(HOT, SOUND_VOLUME);
if (bgch != null){
trace(bgch.soundTransform.volume);
transform = bgch.soundTransform;
transform.volume = MUSIC_VOLUME;
bgch.soundTransform = transform;
};
}
public static function _playInGameMusic():void{
if (musicOn){
bgch = soundManager.playBackSound(MUSIC_2);
};
curBGSound = MUSIC_2;
}
public static function _buttonClick():void{
if (sfxOn){
soundManager.playSound(BUTTON_CLICK);
};
}
public static function _soundOff():void{
sfxOn = false;
soundManager.soundOn = false;
}
public static function _playSound(s:String):void{
if (soundManager == null){
init();
};
if (sfxOn){
soundManager.playSound(s);
};
}
public static function _isSoundOn():Boolean{
return (soundManager.soundOn);
}
public static function _stopBGSound():void{
soundManager.stopBackSound();
}
public static function _playBGMusic():void{
if (musicOn){
bgch = soundManager.playBackSound(curBGSound);
};
}
}
}//package
Section 268
//startTim (startTim)
package {
import flash.display.*;
public dynamic class startTim extends MovieClip {
}
}//package
Section 269
//WheelAll (WheelAll)
package {
import flash.display.*;
public dynamic class WheelAll extends MovieClip {
public var rim:MovieClip;
public function WheelAll(){
addFrameScript(0, this.frame1);
}
function frame1(){
stop();
}
}
}//package