STORY   LOOP   FURRY   PORN   GAMES
• C •   SERVICES [?] [R] RND   POPULAR
Archived flashes:
229595
/disc/ · /res/     /show/ · /fap/ · /gg/ · /swf/P0001 · P2595 · P5190

<div style="position:absolute;top:-99px;left:-99px;"><img src="http://swfchan.com:57475/59604988?noj=FRM59604988-22DC" width="1" height="1"></div>

coal-express-4.swf

This is the info page for
Flash #118147

(Click the ID number above for more basic data on this flash file.)


ActionScript [AS3]
Section 1
//BaseStage (BaseClass.BaseStage) package BaseClass { import Element.*; import flash.display.*; import flash.events.*; import caurina.transitions.*; import UserdefinedClass.*; import flash.geom.*; import Box2D.Common.Math.*; import Box2D.Collision.*; import flash.utils.*; public class BaseStage extends MovieClip { public var backarr:Array; public var upperpoint:Point; public var runplay:Boolean;// = false public var Roadfriction:Number;// = 5 public var totallen:Number;// = 0 public var yan:Sprite; public var yancount:int;// = 0 public var score:int;// = 0 public var SRC_W:Number;// = 700 public var standby:Sprite; public var mincargo:int; public var money:int;// = 0 public var frontroad:Sprite; public var FPS:int;// = 30 public var end:MovieClip; public var back:Sprite; public var wucount:int;// = 0 public var road:Sprite; public var smokecount:int;// = 0 public var camera:Camera; public var speedup:Boolean;// = false public var Roadrestitution:Number;// = 0 public var lowerpoint:Point; public var stopmc:MovieClip; public var burst:Sprite; public var backgroundmc:MovieClip; public var isup:Boolean;// = false public var roadarr:Array; public var runcount:int;// = 0 public var cameraPoint:Point; public var endLink:MovieClip; public var startLink:MovieClip; public var lv:int; public var currentlylen:Number;// = 0 public var world:Box2dFactory; public var hit:Sprite; public var endpoint:MovieClip; public var speedvar:int;// = 0 public var Roaddensity:Number;// = 0 public var main:Main; public var cargo:Sprite; public var trainMc:BaseTrain; public var stagenum:int; public var car:Sprite; public var gametime:MyTime; public var pausebool:Boolean;// = false public var countup:int;// = 0 public var game:Sprite; public function BaseStage(mainobj:Object){ lowerpoint = new Point(-2000, -2000); upperpoint = new Point(2000, 2000); SRC_W = 700; pausebool = false; score = 0; cameraPoint = new Point(200, 300); Roadfriction = 5; Roaddensity = 0; Roadrestitution = 0; money = 0; totallen = 0; currentlylen = 0; isup = false; countup = 0; speedvar = 0; FPS = 30; yancount = 0; smokecount = 0; wucount = 0; runcount = 0; runplay = false; speedup = false; super(); main = (mainobj as Main); initgame(); } public function mathhightscore(T:int, C:int):int{ var tempS:int; var price:int; var MS:int; var tempT:int; var TS:int; tempS = 0; price = MyData.getInstance().cargo[(lv - 1)]; MS = (price * C); tempT = MyData.getInstance().gamedataground[(lv - 1)].JYTtime[1]; TS = 0; if (T < tempT){ TS = ((tempT - T) * 100); } else { TS = 0; }; tempS = (MS + TS); return (tempS); } public function inititem():void{ world.world.SetContactFilter(new MyContactFilter()); world.world.SetContactListener(new MyContactListener()); bulidroad(0, 406, road, roadarr); trainMc = new BaseTrain(this, 360, 330, (main.seltrain - 1)); backgroundupdate(); camera.lookAt(trainMc.train, cameraPoint, Camera.LOCKWAY_NORMAL); } public function delayrun(time:int, fun:Function){ Tweener.addTween(this, {delay:time, onComplete:fun}); } public function showyan(){ if (main.seltrain != 1){ return; }; yancount++; if (yancount == 10){ yancount = 0; onnewyan(); }; } public function suc31(){ if (gametime.count <= 15){ if (!MyData.getInstance().succeed[31]){ MyData.getInstance().succeed[31] = true; main.addmoney(2000); main.savemoney(); }; }; } public function workaddspeedbar(){ if (!isup){ countup++; if (countup == FPS){ countup = 0; addspeedupbar(trainMc.addspeed); }; } else { countup = 0; }; } public function setTime(){ main.setTime(gametime.count); } public function suc36(){ if (!speedup){ if (!MyData.getInstance().succeed[36]){ MyData.getInstance().succeed[36] = true; main.addmoney(2000); main.savemoney(); }; }; } public function suc30(){ main.dietime++; main.savedietime(); if (main.dietime >= 50){ if (!MyData.getInstance().succeed[30]){ MyData.getInstance().succeed[30] = true; main.addmoney(2000); main.savemoney(); }; }; } public function bulidroad(x:Number, y:Number, container:Sprite, roads:Array):Number{ var lastWidth:Number; var lastLu:MovieClip; var g:Point; var lu:MovieClip; var map:MovieClip; var tempNum:Number; var i:int; var luclass:*; var t:Sprite; lastWidth = 0; map = new MovieClip(); tempNum = 0; i = 0; while (i < roads.length) { luclass = getDefinitionByName(roads[i].toString()); lu = (new (luclass) as MovieClip); if (lastLu){ t = (lastLu.getChildByName("tail") as MovieClip); lu.x = (lastLu.x + t.x); lu.y = (lastLu.y + t.y); } else { lu.x = x; lu.y = y; }; map.addChild(lu); addbagarr(lu); lastWidth = (lastWidth + lu.width); lastLu = lu; Box2dFactory.getInstance().addToWorld((lu.x / 30), (lu.y / 30), lu.rotation, Roadfriction, Roaddensity, Roadrestitution, lu, false, "road"); if (i == 0){ startLink = (lu.getChildByName("link") as MovieClip); }; if (i == (roads.length - 1)){ endLink = (lu.getChildByName("link") as MovieClip); endpoint = (lu.getChildByName("end") as MovieClip); g = MyMath.LtoG(container, endpoint); endpoint.x = g.x; endpoint.y = g.y; container.addChild(endpoint); end = (lu.getChildByName("endpoint") as MovieClip); g = MyMath.LtoG(frontroad, end); end.x = g.x; end.y = g.y; frontroad.addChild(end); trace("endx", g.x); }; i++; }; totallen = g.x; trace(totallen); container.addChild(map); return (lastWidth); } public function restartgame(){ addEventListener(Event.ENTER_FRAME, updata); addEventListener(Event.ENTER_FRAME, onkeyfun); gametime.restart(); } public function playsuc(sucarr:Array){ } public function initworld(){ var aabb:b2AABB; world = Box2dFactory.getInstance(); aabb = new b2AABB(); aabb.lowerBound.Set(lowerpoint.x, lowerpoint.y); aabb.upperBound.Set(upperpoint.x, upperpoint.y); world.createWorld(new b2Vec2(0, 30), aabb); } public function showsmoke(){ smokecount++; if (smokecount == 3){ smokecount = 0; newsmoke(); }; } public function completegame(){ } public function resucceed(N:int, T:int):int{ var renum:int; renum = 0; if (!MyData.getInstance().succeed[(lv - 1)]){ if (T <= MyData.getInstance().gamedataground[(lv - 1)].JYTtime[0]){ MyData.getInstance().succeed[(lv - 1)] = true; main.savesucceed(); renum++; }; }; if (!MyData.getInstance().succeed[((lv - 1) + 15)]){ if (N >= MyData.getInstance().gamedataground[(lv - 1)].JYTcargo[1]){ MyData.getInstance().succeed[((lv - 1) + 15)] = true; main.savesucceed(); renum++; }; }; return (renum); } public function isspeedup(){ isup = true; if (speedvar > 0){ speedup = true; trainMc.accelerate(); main.setpowerbar(speedvar); speedvar--; showsmoke(); }; } public function mathmoney(Num:int, T:int):int{ var price:int; var M:int; var tempM:int; price = MyData.getInstance().cargo[(lv - 1)]; M = (price * Num); tempM = resucceed(Num, T); M = (M + (tempM * 2000)); return (M); } public function run(){ Main.run.playsound(1000000, 0.2); } public function updata(e:Event){ Box2dFactory.getInstance().updata(); backgroundupdate(); camera.lookAt(trainMc.train, cameraPoint, Camera.LOCKWAY_NORMAL); if (trainMc.train.hitTestObject(endpoint)){ trace("game.x", game.x); trace("end"); removeEventListener(Event.ENTER_FRAME, updata); removeEventListener(Event.ENTER_FRAME, onkeyfun); main.setpoint(100); win(); return; }; if (!judgecargo()){ gameover(); return; }; showyan(); workaddspeedbar(); main.setcargo(recargonum()); workcrisp(); workbikedie(); main.setpoint(curpoint()); } public function workbikedie(){ var die:Function; die = function (){ var tempmc:MovieClip; stopgame(); main.gamestage = "over"; Main.bao.playsound(1); trainMc.stopship(); trainMc.breakDown(); stopgame(); main.gamestage = "over"; tempmc = new Shipdie(); burst.addChild(tempmc); tempmc.x = (trainMc.train.x + (trainMc.train.width * 0.5)); tempmc.y = (trainMc.train.y + (trainMc.train.height * 0.5)); delayrun(1, gameover); }; if (MyData.die){ trace("死"); die(); suc30(); MyData.die = false; }; } public function wu(){ if (main.seltrain == 1){ Main.wu.playsound(1, 0.2); }; } public function pausegame(){ if (pausebool){ restartgame(); } else { stopgame(); }; if (pausebool){ pausebool = false; } else { pausebool = true; }; } public function judgecargo():Boolean{ return (((recargonum() < MyData.getInstance().gamedataground[(lv - 1)].JYTcargo[0])) ? false : true); } public function initgame(){ SoundControl.stopallsound(); game = new Sprite(); road = new Sprite(); car = new Sprite(); back = new Sprite(); cargo = new Sprite(); frontroad = new Sprite(); standby = new Sprite(); yan = new Sprite(); burst = new Sprite(); addChild(back); addChild(game); game.addChild(road); game.addChild(cargo); game.addChild(car); game.addChild(frontroad); game.addChild(burst); game.addChild(yan); addChild(standby); initworld(); initSound(); rewritedata(); loaddata(); initui(); camera = Camera.getInstance(game); camera.easing = true; camera.lockWay = Camera.LOCKWAY_X; cameraPoint.x = 230; inititem(); main.stage.focus = this; loadbg(); playbgm(); } public function addspeedupbar(Num:int):void{ if ((speedvar + Num) <= 101){ speedvar = (speedvar + Num); } else { speedvar = 101; }; main.setpowerbar(speedvar); } public function playbgm(){ var tempnum:int; tempnum = ((lv - 1) / 3); switch (tempnum){ case 0: Main.bgm1.playsound(10000000); break; case 1: Main.bgm2.playsound(10000000); break; case 2: Main.bgm3.playsound(10000000); break; case 3: Main.bgm4.playsound(10000000); break; case 4: Main.bgm5.playsound(10000000); break; }; } public function destory(){ stopgame(); camera.clear(); gametime.removetime(); Clr.removeAllChildren(back); Clr.removeAllChildren(yan); Clr.removeAllChildren(burst); Clr.removeAllChildren(road); Clr.removeAllChildren(cargo); Clr.removeAllChildren(car); Clr.removeAllChildren(frontroad); Clr.removeAllChildren(game); Clr.removeAllChildren(standby); Clr.removeAllChildren(main.Cue); Clr.removeAllChildren(this); Tweener.removeAllTweens(); SoundControl.stopallsound(); } public function stopgame(){ removeEventListener(Event.ENTER_FRAME, updata); removeEventListener(Event.ENTER_FRAME, onkeyfun); gametime.pausetime(); } public function startlistener(){ addEventListener(Event.ENTER_FRAME, updata); addEventListener(Event.ENTER_FRAME, onkeyfun); gametime.starttime(); } public function rewritedata(){ } public function addbagarr(mc:MovieClip){ } public function wokeSandM(){ } public function stoprun(){ runplay = false; Main.run.stopSound(); } public function workcrisp():void{ } public function curpoint():Number{ return (int(((-(game.x) / totallen) * 100))); } public function onkeyfun(e:Event):void{ Input.keydownrunfun(Input.LEFT, trainMc.moveR); Input.keydownrunfun(Input.RIGHT, trainMc.moveL); Input.keydownrunfun(Input.DOWN, motolrun); Input.keydownrunfun(Input.UP, motorrun); Input.keydownrunfun(Input.SPACE, isspeedup); if (((!(Input.key[Input.DOWN])) && (!(Input.key[Input.UP])))){ trainMc.release(); }; if (!Input.key[Input.UP]){ stoprun(); }; if (!Input.key[Input.SPACE]){ isup = false; }; } public function onnewyan(){ var yan1:MovieClip; var p:Point; var tempyan:MovieClip; yan1 = trainMc.yanarr[0]; p = MyMath.LtoG(yan, yan1); tempyan = new Blackyan(); tempyan.x = p.x; tempyan.y = p.y; yan.addChild(tempyan); } public function backgroundupdate():void{ back.x = ((game.x / 20) - 100); back.y = ((game.y / 40) - 100); } public function recargonum():int{ var tempcargo:Array; var len:int; var tempcount:int; var str:String; var i:int; tempcargo = trainMc.cargocontainer; len = tempcargo.length; tempcount = 0; str = new String(); i = 0; while (i < len) { if (tempcargo[i].live == true){ tempcount++; } else { if (tempcargo[i].alpha >= 1){ Tweener.addTween(tempcargo[i], {alpha:0, time:2, transition:"linear"}); Box2dFactory.getInstance().world.DestroyBody(tempcargo[i].bd); }; if (tempcargo[i].currentFrame == 3){ if ((((((((lv == 9)) || ((lv == 12)))) || ((lv == 14)))) || ((lv == 15)))){ tempcargo[i].gotoAndStop(1); Box2dFactory.getInstance().world.DestroyBody(tempcargo[i].bd); }; }; }; i++; }; return (tempcount); } public function loaddata():void{ lv = main.initgamenum; roadarr = new Array(); backarr = new Array(); roadarr = MyData.getInstance().gamedataground[(lv - 1)].gameroad; gametime = new MyTime(setTime); } public function initui(){ var tempmax:int; tempmax = MyData.getInstance().gamedataground[(lv - 1)].JYTcargo[0]; mincargo = tempmax; main.setTcargo(mincargo); main.setLv(lv); main.setTime(gametime.count); } public function loadbg(){ var bgclass:*; if (MyData.getInstance().BGB[int(((lv - 1) / 3))] == ""){ return; }; bgclass = getDefinitionByName(MyData.getInstance().BGB[int(((lv - 1) / 3))]); backgroundmc = (new (bgclass) as MovieClip); back.addChild(backgroundmc); } public function motolrun(){ trainMc.lunMoveL(); } public function judgesuc():Boolean{ var bool:Boolean; bool = false; return (bool); } public function gameover(){ stopgame(); main.showGameover(); } public function newsmoke(){ var yan2:MovieClip; var yan3:MovieClip; var p:Point; var tempyan1:MovieClip; var tempyan2:MovieClip; yan2 = trainMc.yanarr[1]; yan3 = trainMc.yanarr[2]; p = MyMath.LtoG(yan, yan2); tempyan1 = new Whiteyan(); tempyan2 = new Whiteyan(); tempyan1.x = p.x; tempyan1.y = p.y; p = MyMath.LtoG(yan, yan3); tempyan2.x = p.x; tempyan2.y = p.y; yan.addChild(tempyan1); yan.addChild(tempyan2); } public function win():void{ var tempcargonum:int; var tempmoneynum:int; var HS:int; tempcargonum = recargonum(); tempmoneynum = mathmoney(tempcargonum, gametime.count); HS = mathhightscore(gametime.count, tempcargonum); if (HS > MyData.getInstance().highscore[(lv - 1)]){ MyData.getInstance().highscore[(lv - 1)] = HS; main.saveHS(); }; stopgame(); suc36(); main.showWin(gametime.count, tempcargonum, HS, tempmoneynum); } public function initSound(){ SoundControl.destorySdground(); } public function endsucplaywin(){ Clr.removeAllChildren(standby); wokeSandM(); completegame(); } public function motorrun(){ trainMc.lunMoveR(); if (wucount == 0){ wu(); }; wucount++; if (wucount == (FPS * 12)){ wucount = 0; }; if (!runplay){ runplay = true; run(); }; } } }//package BaseClass
Section 2
//b2CircleDef (Box2D.Collision.Shapes.b2CircleDef) package Box2D.Collision.Shapes { import Box2D.Common.Math.*; public class b2CircleDef extends b2ShapeDef { public var localPosition:b2Vec2; public var radius:Number; public function b2CircleDef(){ localPosition = new b2Vec2(0, 0); super(); type = b2Shape.e_circleShape; radius = 1; } } }//package Box2D.Collision.Shapes
Section 3
//b2CircleShape (Box2D.Collision.Shapes.b2CircleShape) package Box2D.Collision.Shapes { import Box2D.Common.Math.*; import Box2D.Collision.*; import Box2D.Common.*; public class b2CircleShape extends b2Shape { public var m_radius:Number; public var m_localPosition:b2Vec2; public function b2CircleShape(def:b2ShapeDef){ var circleDef:b2CircleDef; m_localPosition = new b2Vec2(); super(def); circleDef = (def as b2CircleDef); m_type = e_circleShape; m_localPosition.SetV(circleDef.localPosition); m_radius = circleDef.radius; } override public function TestPoint(transform:b2XForm, p:b2Vec2):Boolean{ var tMat:b2Mat22; var dX:Number; var dY:Number; tMat = transform.R; dX = (transform.position.x + ((tMat.col1.x * m_localPosition.x) + (tMat.col2.x * m_localPosition.y))); dY = (transform.position.y + ((tMat.col1.y * m_localPosition.x) + (tMat.col2.y * m_localPosition.y))); dX = (p.x - dX); dY = (p.y - dY); return ((((dX * dX) + (dY * dY)) <= (m_radius * m_radius))); } public function GetLocalPosition():b2Vec2{ return (m_localPosition); } override public function TestSegment(transform:b2XForm, lambda:Array, normal:b2Vec2, segment:b2Segment, maxLambda:Number):Boolean{ var tMat:b2Mat22; var positionX:Number; var positionY:Number; var sX:Number; var sY:Number; var b:Number; var rX:Number; var rY:Number; var c:Number; var rr:Number; var sigma:Number; var a:Number; tMat = transform.R; positionX = (transform.position.x + ((tMat.col1.x * m_localPosition.x) + (tMat.col2.x * m_localPosition.y))); positionY = (transform.position.y + ((tMat.col1.y * m_localPosition.x) + (tMat.col2.y * m_localPosition.y))); sX = (segment.p1.x - positionX); sY = (segment.p1.y - positionY); b = (((sX * sX) + (sY * sY)) - (m_radius * m_radius)); if (b < 0){ return (false); }; rX = (segment.p2.x - segment.p1.x); rY = (segment.p2.y - segment.p1.y); c = ((sX * rX) + (sY * rY)); rr = ((rX * rX) + (rY * rY)); sigma = ((c * c) - (rr * b)); if ((((sigma < 0)) || ((rr < Number.MIN_VALUE)))){ return (false); }; a = -((c + Math.sqrt(sigma))); if ((((0 <= a)) && ((a <= (maxLambda * rr))))){ a = (a / rr); lambda[0] = a; normal.x = (sX + (a * rX)); normal.y = (sY + (a * rY)); normal.Normalize(); return (true); }; return (false); } override public function ComputeMass(massData:b2MassData):void{ massData.mass = (((m_density * b2Settings.b2_pi) * m_radius) * m_radius); massData.center.SetV(m_localPosition); massData.I = (massData.mass * (((0.5 * m_radius) * m_radius) + ((m_localPosition.x * m_localPosition.x) + (m_localPosition.y * m_localPosition.y)))); } override public function ComputeSweptAABB(aabb:b2AABB, transform1:b2XForm, transform2:b2XForm):void{ var tMat:b2Mat22; var p1X:Number; var p1Y:Number; var p2X:Number; var p2Y:Number; tMat = transform1.R; p1X = (transform1.position.x + ((tMat.col1.x * m_localPosition.x) + (tMat.col2.x * m_localPosition.y))); p1Y = (transform1.position.y + ((tMat.col1.y * m_localPosition.x) + (tMat.col2.y * m_localPosition.y))); tMat = transform2.R; p2X = (transform2.position.x + ((tMat.col1.x * m_localPosition.x) + (tMat.col2.x * m_localPosition.y))); p2Y = (transform2.position.y + ((tMat.col1.y * m_localPosition.x) + (tMat.col2.y * m_localPosition.y))); aabb.lowerBound.Set((((p1X < p2X)) ? p1X : p2X - m_radius), (((p1Y < p2Y)) ? p1Y : p2Y - m_radius)); aabb.upperBound.Set((((p1X > p2X)) ? p1X : p2X + m_radius), (((p1Y > p2Y)) ? p1Y : p2Y + m_radius)); } public function GetRadius():Number{ return (m_radius); } override public function UpdateSweepRadius(center:b2Vec2):void{ var dX:Number; var dY:Number; dX = (m_localPosition.x - center.x); dY = (m_localPosition.y - center.y); dX = Math.sqrt(((dX * dX) + (dY * dY))); m_sweepRadius = ((dX + m_radius) - b2Settings.b2_toiSlop); } override public function ComputeAABB(aabb:b2AABB, transform:b2XForm):void{ var tMat:b2Mat22; var pX:Number; var pY:Number; tMat = transform.R; pX = (transform.position.x + ((tMat.col1.x * m_localPosition.x) + (tMat.col2.x * m_localPosition.y))); pY = (transform.position.y + ((tMat.col1.y * m_localPosition.x) + (tMat.col2.y * m_localPosition.y))); aabb.lowerBound.Set((pX - m_radius), (pY - m_radius)); aabb.upperBound.Set((pX + m_radius), (pY + m_radius)); } } }//package Box2D.Collision.Shapes
Section 4
//b2FilterData (Box2D.Collision.Shapes.b2FilterData) package Box2D.Collision.Shapes { public class b2FilterData { public var maskBits:uint;// = 0xFFFF public var groupIndex:int;// = 0 public var categoryBits:uint;// = 1 public function b2FilterData(){ categoryBits = 1; maskBits = 0xFFFF; groupIndex = 0; super(); } public function Copy():b2FilterData{ var copy:b2FilterData; copy = new b2FilterData(); copy.categoryBits = categoryBits; copy.maskBits = maskBits; copy.groupIndex = groupIndex; return (copy); } } }//package Box2D.Collision.Shapes
Section 5
//b2MassData (Box2D.Collision.Shapes.b2MassData) package Box2D.Collision.Shapes { import Box2D.Common.Math.*; public class b2MassData { public var mass:Number;// = 0 public var center:b2Vec2; public var I:Number;// = 0 public function b2MassData(){ mass = 0; center = new b2Vec2(0, 0); I = 0; super(); } } }//package Box2D.Collision.Shapes
Section 6
//b2PolygonDef (Box2D.Collision.Shapes.b2PolygonDef) package Box2D.Collision.Shapes { import Box2D.Common.Math.*; import Box2D.Common.*; public class b2PolygonDef extends b2ShapeDef { public var vertexCount:int; public var vertices:Array; private static var s_mat:b2Mat22 = new b2Mat22(); public function b2PolygonDef(){ var i:int; vertices = new Array(b2Settings.b2_maxPolygonVertices); super(); type = b2Shape.e_polygonShape; vertexCount = 0; i = 0; while (i < b2Settings.b2_maxPolygonVertices) { vertices[i] = new b2Vec2(); i++; }; } public function SetAsOrientedBox(hx:Number, hy:Number, center:b2Vec2=null, angle:Number=0):void{ var xfPosition:b2Vec2; var xfR:b2Mat22; var i:int; vertexCount = 4; vertices[0].Set(-(hx), -(hy)); vertices[1].Set(hx, -(hy)); vertices[2].Set(hx, hy); vertices[3].Set(-(hx), hy); if (center){ xfPosition = center; xfR = s_mat; xfR.Set(angle); i = 0; while (i < vertexCount) { center = vertices[i]; hx = (xfPosition.x + ((xfR.col1.x * center.x) + (xfR.col2.x * center.y))); center.y = (xfPosition.y + ((xfR.col1.y * center.x) + (xfR.col2.y * center.y))); center.x = hx; i++; }; }; } public function SetAsBox(hx:Number, hy:Number):void{ vertexCount = 4; vertices[0].Set(-(hx), -(hy)); vertices[1].Set(hx, -(hy)); vertices[2].Set(hx, hy); vertices[3].Set(-(hx), hy); } } }//package Box2D.Collision.Shapes
Section 7
//b2PolygonShape (Box2D.Collision.Shapes.b2PolygonShape) package Box2D.Collision.Shapes { import Box2D.Dynamics.*; import Box2D.Common.Math.*; import Box2D.Collision.*; import Box2D.Common.*; public class b2PolygonShape extends b2Shape { public var m_vertices:Array; public var m_normals:Array; private var s_supportVec:b2Vec2; public var m_obb:b2OBB; public var m_coreVertices:Array; public var m_centroid:b2Vec2; public var m_vertexCount:int; private static var s_computeMat:b2Mat22 = new b2Mat22(); private static var s_sweptAABB1:b2AABB = new b2AABB(); private static var s_sweptAABB2:b2AABB = new b2AABB(); public function b2PolygonShape(def:b2ShapeDef){ var poly:b2PolygonDef; var i:int; var i1:int; var i2:int; var edgeX:Number; var edgeY:Number; var len:Number; var n1X:Number; var n1Y:Number; var n2X:Number; var n2Y:Number; var vX:Number; var vY:Number; var dX:Number; var dY:Number; var det:Number; s_supportVec = new b2Vec2(); m_obb = new b2OBB(); m_vertices = new Array(b2Settings.b2_maxPolygonVertices); m_normals = new Array(b2Settings.b2_maxPolygonVertices); m_coreVertices = new Array(b2Settings.b2_maxPolygonVertices); super(def); m_type = e_polygonShape; poly = (def as b2PolygonDef); m_vertexCount = poly.vertexCount; i1 = i; i2 = i; i = 0; while (i < m_vertexCount) { m_vertices[i] = poly.vertices[i].Copy(); i++; }; i = 0; while (i < m_vertexCount) { i1 = i; i2 = (((i + 1) < m_vertexCount)) ? (i + 1) : 0; edgeX = (m_vertices[i2].x - m_vertices[i1].x); edgeY = (m_vertices[i2].y - m_vertices[i1].y); len = Math.sqrt(((edgeX * edgeX) + (edgeY * edgeY))); m_normals[i] = new b2Vec2((edgeY / len), (-(edgeX) / len)); i++; }; m_centroid = ComputeCentroid(poly.vertices, poly.vertexCount); ComputeOBB(m_obb, m_vertices, m_vertexCount); i = 0; while (i < m_vertexCount) { i1 = (((i - 1) >= 0)) ? (i - 1) : (m_vertexCount - 1); i2 = i; n1X = m_normals[i1].x; n1Y = m_normals[i1].y; n2X = m_normals[i2].x; n2Y = m_normals[i2].y; vX = (m_vertices[i].x - m_centroid.x); vY = (m_vertices[i].y - m_centroid.y); dX = (((n1X * vX) + (n1Y * vY)) - b2Settings.b2_toiSlop); dY = (((n2X * vX) + (n2Y * vY)) - b2Settings.b2_toiSlop); det = (1 / ((n1X * n2Y) - (n1Y * n2X))); m_coreVertices[i] = new b2Vec2(((det * ((n2Y * dX) - (n1Y * dY))) + m_centroid.x), ((det * ((n1X * dY) - (n2X * dX))) + m_centroid.y)); i++; }; } override public function TestPoint(xf:b2XForm, p:b2Vec2):Boolean{ var tVec:b2Vec2; var tMat:b2Mat22; var tX:Number; var tY:Number; var pLocalX:Number; var pLocalY:Number; var i:int; var dot:Number; tMat = xf.R; tX = (p.x - xf.position.x); tY = (p.y - xf.position.y); pLocalX = ((tX * tMat.col1.x) + (tY * tMat.col1.y)); pLocalY = ((tX * tMat.col2.x) + (tY * tMat.col2.y)); i = 0; while (i < m_vertexCount) { tVec = m_vertices[i]; tX = (pLocalX - tVec.x); tY = (pLocalY - tVec.y); tVec = m_normals[i]; dot = ((tVec.x * tX) + (tVec.y * tY)); if (dot > 0){ return (false); }; i++; }; return (true); } public function GetCoreVertices():Array{ return (m_coreVertices); } override public function TestSegment(xf:b2XForm, lambda:Array, normal:b2Vec2, segment:b2Segment, maxLambda:Number):Boolean{ var lower:Number; var upper:Number; var tX:Number; var tY:Number; var tMat:b2Mat22; var tVec:b2Vec2; var p1X:Number; var p1Y:Number; var p2X:Number; var p2Y:Number; var dX:Number; var dY:Number; var index:int; var i:int; var numerator:Number; var denominator:Number; lower = 0; upper = maxLambda; tX = (segment.p1.x - xf.position.x); tY = (segment.p1.y - xf.position.y); tMat = xf.R; p1X = ((tX * tMat.col1.x) + (tY * tMat.col1.y)); p1Y = ((tX * tMat.col2.x) + (tY * tMat.col2.y)); tX = (segment.p2.x - xf.position.x); tY = (segment.p2.y - xf.position.y); tMat = xf.R; p2X = ((tX * tMat.col1.x) + (tY * tMat.col1.y)); p2Y = ((tX * tMat.col2.x) + (tY * tMat.col2.y)); dX = (p2X - p1X); dY = (p2Y - p1Y); index = -1; i = 0; while (i < m_vertexCount) { tVec = m_vertices[i]; tX = (tVec.x - p1X); tY = (tVec.y - p1Y); tVec = m_normals[i]; numerator = ((tVec.x * tX) + (tVec.y * tY)); denominator = ((tVec.x * dX) + (tVec.y * dY)); if ((((denominator < 0)) && ((numerator < (lower * denominator))))){ lower = (numerator / denominator); index = i; } else { if ((((denominator > 0)) && ((numerator < (upper * denominator))))){ upper = (numerator / denominator); }; }; if (upper < lower){ return (false); }; i++; }; if (index >= 0){ lambda[0] = lower; tMat = xf.R; tVec = m_normals[index]; normal.x = ((tMat.col1.x * tVec.x) + (tMat.col2.x * tVec.y)); normal.y = ((tMat.col1.y * tVec.x) + (tMat.col2.y * tVec.y)); return (true); }; return (false); } public function GetCentroid():b2Vec2{ return (m_centroid); } override public function ComputeMass(massData:b2MassData):void{ var centerX:Number; var centerY:Number; var area:Number; var I:Number; var p1X:Number; var p1Y:Number; var k_inv3:Number; var i:int; var p2:b2Vec2; var p3:b2Vec2; var e1X:Number; var e1Y:Number; var e2X:Number; var e2Y:Number; var D:Number; var triangleArea:Number; var px:Number; var py:Number; var ex1:Number; var ey1:Number; var ex2:Number; var ey2:Number; var intx2:Number; var inty2:Number; centerX = 0; centerY = 0; area = 0; I = 0; p1X = 0; p1Y = 0; k_inv3 = (1 / 3); i = 0; while (i < m_vertexCount) { p2 = m_vertices[i]; p3 = (((i + 1) < m_vertexCount)) ? m_vertices[int((i + 1))] : m_vertices[0]; e1X = (p2.x - p1X); e1Y = (p2.y - p1Y); e2X = (p3.x - p1X); e2Y = (p3.y - p1Y); D = ((e1X * e2Y) - (e1Y * e2X)); triangleArea = (0.5 * D); area = (area + triangleArea); centerX = (centerX + ((triangleArea * k_inv3) * ((p1X + p2.x) + p3.x))); centerY = (centerY + ((triangleArea * k_inv3) * ((p1Y + p2.y) + p3.y))); px = p1X; py = p1Y; ex1 = e1X; ey1 = e1Y; ex2 = e2X; ey2 = e2Y; intx2 = ((k_inv3 * ((0.25 * (((ex1 * ex1) + (ex2 * ex1)) + (ex2 * ex2))) + ((px * ex1) + (px * ex2)))) + ((0.5 * px) * px)); inty2 = ((k_inv3 * ((0.25 * (((ey1 * ey1) + (ey2 * ey1)) + (ey2 * ey2))) + ((py * ey1) + (py * ey2)))) + ((0.5 * py) * py)); I = (I + (D * (intx2 + inty2))); i++; }; massData.mass = (m_density * area); centerX = (centerX * (1 / area)); centerY = (centerY * (1 / area)); massData.center.Set(centerX, centerY); massData.I = (m_density * I); } public function Support(xf:b2XForm, dX:Number, dY:Number):b2Vec2{ var tVec:b2Vec2; var tMat:b2Mat22; var dLocalX:Number; var dLocalY:Number; var bestIndex:int; var bestValue:Number; var i:int; var value:Number; tMat = xf.R; dLocalX = ((dX * tMat.col1.x) + (dY * tMat.col1.y)); dLocalY = ((dX * tMat.col2.x) + (dY * tMat.col2.y)); bestIndex = 0; tVec = m_coreVertices[0]; bestValue = ((tVec.x * dLocalX) + (tVec.y * dLocalY)); i = 1; while (i < m_vertexCount) { tVec = m_coreVertices[i]; value = ((tVec.x * dLocalX) + (tVec.y * dLocalY)); if (value > bestValue){ bestIndex = i; bestValue = value; }; i++; }; tMat = xf.R; tVec = m_coreVertices[bestIndex]; s_supportVec.x = (xf.position.x + ((tMat.col1.x * tVec.x) + (tMat.col2.x * tVec.y))); s_supportVec.y = (xf.position.y + ((tMat.col1.y * tVec.x) + (tMat.col2.y * tVec.y))); return (s_supportVec); } public function GetVertexCount():int{ return (m_vertexCount); } override public function ComputeSweptAABB(aabb:b2AABB, transform1:b2XForm, transform2:b2XForm):void{ var aabb1:b2AABB; var aabb2:b2AABB; aabb1 = s_sweptAABB1; aabb2 = s_sweptAABB2; ComputeAABB(aabb1, transform1); ComputeAABB(aabb2, transform2); aabb.lowerBound.Set(((aabb1.lowerBound.x < aabb2.lowerBound.x)) ? aabb1.lowerBound.x : aabb2.lowerBound.x, ((aabb1.lowerBound.y < aabb2.lowerBound.y)) ? aabb1.lowerBound.y : aabb2.lowerBound.y); aabb.upperBound.Set(((aabb1.upperBound.x > aabb2.upperBound.x)) ? aabb1.upperBound.x : aabb2.upperBound.x, ((aabb1.upperBound.y > aabb2.upperBound.y)) ? aabb1.upperBound.y : aabb2.upperBound.y); } public function GetVertices():Array{ return (m_vertices); } public function GetNormals():Array{ return (m_normals); } public function GetOBB():b2OBB{ return (m_obb); } public function GetFirstVertex(xf:b2XForm):b2Vec2{ return (b2Math.b2MulX(xf, m_coreVertices[0])); } public function Centroid(xf:b2XForm):b2Vec2{ return (b2Math.b2MulX(xf, m_centroid)); } override public function UpdateSweepRadius(center:b2Vec2):void{ var tVec:b2Vec2; var i:int; var dX:Number; var dY:Number; m_sweepRadius = 0; i = 0; while (i < m_vertexCount) { tVec = m_coreVertices[i]; dX = (tVec.x - center.x); dY = (tVec.y - center.y); dX = Math.sqrt(((dX * dX) + (dY * dY))); if (dX > m_sweepRadius){ m_sweepRadius = dX; }; i++; }; } override public function ComputeAABB(aabb:b2AABB, xf:b2XForm):void{ var tMat:b2Mat22; var tVec:b2Vec2; var R:b2Mat22; var absR:b2Mat22; var hX:Number; var hY:Number; var positionX:Number; var positionY:Number; R = s_computeMat; tMat = xf.R; tVec = m_obb.R.col1; R.col1.x = ((tMat.col1.x * tVec.x) + (tMat.col2.x * tVec.y)); R.col1.y = ((tMat.col1.y * tVec.x) + (tMat.col2.y * tVec.y)); tVec = m_obb.R.col2; R.col2.x = ((tMat.col1.x * tVec.x) + (tMat.col2.x * tVec.y)); R.col2.y = ((tMat.col1.y * tVec.x) + (tMat.col2.y * tVec.y)); R.Abs(); absR = R; tVec = m_obb.extents; hX = ((absR.col1.x * tVec.x) + (absR.col2.x * tVec.y)); hY = ((absR.col1.y * tVec.x) + (absR.col2.y * tVec.y)); tMat = xf.R; tVec = m_obb.center; positionX = (xf.position.x + ((tMat.col1.x * tVec.x) + (tMat.col2.x * tVec.y))); positionY = (xf.position.y + ((tMat.col1.y * tVec.x) + (tMat.col2.y * tVec.y))); aabb.lowerBound.Set((positionX - hX), (positionY - hY)); aabb.upperBound.Set((positionX + hX), (positionY + hY)); } public static function ComputeCentroid(vs:Array, count:int):b2Vec2{ var c:b2Vec2; var area:Number; var p1X:Number; var p1Y:Number; var inv3:Number; var i:int; var p2:b2Vec2; var p3:b2Vec2; var e1X:Number; var e1Y:Number; var e2X:Number; var e2Y:Number; var D:Number; var triangleArea:Number; c = new b2Vec2(); area = 0; p1X = 0; p1Y = 0; inv3 = (1 / 3); i = 0; while (i < count) { p2 = vs[i]; p3 = (((i + 1) < count)) ? vs[int((i + 1))] : vs[0]; e1X = (p2.x - p1X); e1Y = (p2.y - p1Y); e2X = (p3.x - p1X); e2Y = (p3.y - p1Y); D = ((e1X * e2Y) - (e1Y * e2X)); triangleArea = (0.5 * D); area = (area + triangleArea); c.x = (c.x + ((triangleArea * inv3) * ((p1X + p2.x) + p3.x))); c.y = (c.y + ((triangleArea * inv3) * ((p1Y + p2.y) + p3.y))); i++; }; c.x = (c.x * (1 / area)); c.y = (c.y * (1 / area)); return (c); } public static function ComputeOBB(obb:b2OBB, vs:Array, count:int):void{ var i:int; var p:Array; var minArea:Number; var root:b2Vec2; var uxX:Number; var uxY:Number; var length:Number; var uyX:Number; var uyY:Number; var lowerX:Number; var lowerY:Number; var upperX:Number; var upperY:Number; var j:int; var area:Number; var dX:Number; var dY:Number; var rX:Number; var rY:Number; var centerX:Number; var centerY:Number; var tMat:b2Mat22; p = new Array((b2Settings.b2_maxPolygonVertices + 1)); i = 0; while (i < count) { p[i] = vs[i]; i++; }; p[count] = p[0]; minArea = Number.MAX_VALUE; i = 1; while (i <= count) { root = p[int((i - 1))]; uxX = (p[i].x - root.x); uxY = (p[i].y - root.y); length = Math.sqrt(((uxX * uxX) + (uxY * uxY))); uxX = (uxX / length); uxY = (uxY / length); uyX = -(uxY); uyY = uxX; lowerX = Number.MAX_VALUE; lowerY = Number.MAX_VALUE; upperX = -(Number.MAX_VALUE); upperY = -(Number.MAX_VALUE); j = 0; while (j < count) { dX = (p[j].x - root.x); dY = (p[j].y - root.y); rX = ((uxX * dX) + (uxY * dY)); rY = ((uyX * dX) + (uyY * dY)); if (rX < lowerX){ lowerX = rX; }; if (rY < lowerY){ lowerY = rY; }; if (rX > upperX){ upperX = rX; }; if (rY > upperY){ upperY = rY; }; j++; }; area = ((upperX - lowerX) * (upperY - lowerY)); if (area < (0.95 * minArea)){ minArea = area; obb.R.col1.x = uxX; obb.R.col1.y = uxY; obb.R.col2.x = uyX; obb.R.col2.y = uyY; centerX = (0.5 * (lowerX + upperX)); centerY = (0.5 * (lowerY + upperY)); tMat = obb.R; obb.center.x = (root.x + ((tMat.col1.x * centerX) + (tMat.col2.x * centerY))); obb.center.y = (root.y + ((tMat.col1.y * centerX) + (tMat.col2.y * centerY))); obb.extents.x = (0.5 * (upperX - lowerX)); obb.extents.y = (0.5 * (upperY - lowerY)); }; i++; }; } } }//package Box2D.Collision.Shapes
Section 8
//b2Shape (Box2D.Collision.Shapes.b2Shape) package Box2D.Collision.Shapes { import Box2D.Dynamics.*; import Box2D.Common.Math.*; import Box2D.Collision.*; public class b2Shape { public var m_type:int; public var m_sweepRadius:Number; public var m_density:Number; public var m_filter:b2FilterData; public var m_friction:Number; public var m_next:b2Shape; public var m_restitution:Number; public var m_userData; public var m_isSensor:Boolean; public var m_proxyId:uint; public var m_body:b2Body; public static const e_polygonShape:int = 1; public static const e_unknownShape:int = -1; public static const e_circleShape:int = 0; public static const e_shapeTypeCount:int = 2; private static var s_resetAABB:b2AABB = new b2AABB(); private static var s_syncAABB:b2AABB = new b2AABB(); private static var s_proxyAABB:b2AABB = new b2AABB(); public function b2Shape(def:b2ShapeDef){ super(); m_userData = def.userData; m_friction = def.friction; m_restitution = def.restitution; m_density = def.density; m_body = null; m_sweepRadius = 0; m_next = null; m_proxyId = b2Pair.b2_nullProxy; m_filter = def.filter.Copy(); m_isSensor = def.isSensor; } public function TestPoint(xf:b2XForm, p:b2Vec2):Boolean{ return (false); } public function GetSweepRadius():Number{ return (m_sweepRadius); } public function GetNext():b2Shape{ return (m_next); } public function ComputeSweptAABB(aabb:b2AABB, xf1:b2XForm, xf2:b2XForm):void{ } public function GetType():int{ return (m_type); } public function GetRestitution():Number{ return (m_restitution); } public function GetFriction():Number{ return (m_friction); } public function GetFilterData():b2FilterData{ return (m_filter.Copy()); } public function TestSegment(xf:b2XForm, lambda:Array, normal:b2Vec2, segment:b2Segment, maxLambda:Number):Boolean{ return (false); } public function RefilterProxy(broadPhase:b2BroadPhase, transform:b2XForm):void{ var aabb:b2AABB; var inRange:Boolean; if (m_proxyId == b2Pair.b2_nullProxy){ return; }; broadPhase.DestroyProxy(m_proxyId); aabb = s_resetAABB; ComputeAABB(aabb, transform); inRange = broadPhase.InRange(aabb); if (inRange){ m_proxyId = broadPhase.CreateProxy(aabb, this); } else { m_proxyId = b2Pair.b2_nullProxy; }; } public function SetFilterData(filter:b2FilterData):void{ m_filter = filter.Copy(); } public function GetUserData(){ return (m_userData); } public function Synchronize(broadPhase:b2BroadPhase, transform1:b2XForm, transform2:b2XForm):Boolean{ var aabb:b2AABB; if (m_proxyId == b2Pair.b2_nullProxy){ return (false); }; aabb = s_syncAABB; ComputeSweptAABB(aabb, transform1, transform2); if (broadPhase.InRange(aabb)){ broadPhase.MoveProxy(m_proxyId, aabb); return (true); }; return (false); } public function ComputeMass(massData:b2MassData):void{ } public function IsSensor():Boolean{ return (m_isSensor); } public function DestroyProxy(broadPhase:b2BroadPhase):void{ if (m_proxyId != b2Pair.b2_nullProxy){ broadPhase.DestroyProxy(m_proxyId); m_proxyId = b2Pair.b2_nullProxy; }; } public function UpdateSweepRadius(center:b2Vec2):void{ } public function ComputeAABB(aabb:b2AABB, xf:b2XForm):void{ } public function GetBody():b2Body{ return (m_body); } public function CreateProxy(broadPhase:b2BroadPhase, transform:b2XForm):void{ var aabb:b2AABB; var inRange:Boolean; aabb = s_proxyAABB; ComputeAABB(aabb, transform); inRange = broadPhase.InRange(aabb); if (inRange){ m_proxyId = broadPhase.CreateProxy(aabb, this); } else { m_proxyId = b2Pair.b2_nullProxy; }; } public function SetUserData(data):void{ m_userData = data; } public static function Destroy(shape:b2Shape, allocator):void{ } public static function Create(def:b2ShapeDef, allocator):b2Shape{ switch (def.type){ case e_circleShape: return (new b2CircleShape(def)); case e_polygonShape: return (new b2PolygonShape(def)); default: return (null); }; } } }//package Box2D.Collision.Shapes
Section 9
//b2ShapeDef (Box2D.Collision.Shapes.b2ShapeDef) package Box2D.Collision.Shapes { public class b2ShapeDef { public var isSensor:Boolean;// = false public var density:Number;// = 0 public var type:int;// = -1 public var restitution:Number;// = 0 public var userData;// = null public var filter:b2FilterData; public var friction:Number;// = 0.2 public function b2ShapeDef(){ type = b2Shape.e_unknownShape; userData = null; friction = 0.2; restitution = 0; density = 0; isSensor = false; filter = new b2FilterData(); super(); } } }//package Box2D.Collision.Shapes
Section 10
//b2AABB (Box2D.Collision.b2AABB) package Box2D.Collision { import Box2D.Common.Math.*; public class b2AABB { public var upperBound:b2Vec2; public var lowerBound:b2Vec2; public function b2AABB(){ lowerBound = new b2Vec2(); upperBound = new b2Vec2(); super(); } public function IsValid():Boolean{ var dX:Number; var dY:Number; var valid:Boolean; dX = (upperBound.x - lowerBound.x); dY = (upperBound.y - lowerBound.y); valid = (((dX >= 0)) && ((dY >= 0))); valid = ((((valid) && (lowerBound.IsValid()))) && (upperBound.IsValid())); return (valid); } } }//package Box2D.Collision
Section 11
//b2Bound (Box2D.Collision.b2Bound) package Box2D.Collision { public class b2Bound { public var proxyId:uint; public var stabbingCount:uint; public var value:uint; public function b2Bound(){ super(); } public function Swap(b:b2Bound):void{ var tempValue:uint; var tempProxyId:uint; var tempStabbingCount:uint; tempValue = value; tempProxyId = proxyId; tempStabbingCount = stabbingCount; value = b.value; proxyId = b.proxyId; stabbingCount = b.stabbingCount; b.value = tempValue; b.proxyId = tempProxyId; b.stabbingCount = tempStabbingCount; } public function IsLower():Boolean{ return (((value & 1) == 0)); } public function IsUpper():Boolean{ return (((value & 1) == 1)); } } }//package Box2D.Collision
Section 12
//b2BoundValues (Box2D.Collision.b2BoundValues) package Box2D.Collision { public class b2BoundValues { public var lowerValues:Array; public var upperValues:Array; public function b2BoundValues(){ lowerValues = [0, 0]; upperValues = [0, 0]; super(); } } }//package Box2D.Collision
Section 13
//b2BroadPhase (Box2D.Collision.b2BroadPhase) package Box2D.Collision { import Box2D.Common.Math.*; import Box2D.Common.*; public class b2BroadPhase { public var m_quantizationFactor:b2Vec2; public var m_worldAABB:b2AABB; public var m_bounds:Array; public var m_freeProxy:uint; public var m_proxyCount:int; public var m_proxyPool:Array; public var m_queryResultCount:int; public var m_pairManager:b2PairManager; public var m_timeStamp:uint; public var m_queryResults:Array; public static const b2_nullEdge:uint = b2Settings.USHRT_MAX; public static const b2_invalid:uint = b2Settings.USHRT_MAX; public static var s_validate:Boolean = false; public function b2BroadPhase(worldAABB:b2AABB, callback:b2PairCallback){ var i:int; var dX:Number; var dY:Number; var tProxy:b2Proxy; var j:int; m_pairManager = new b2PairManager(); m_proxyPool = new Array(b2Settings.b2_maxPairs); m_bounds = new Array((2 * b2Settings.b2_maxProxies)); m_queryResults = new Array(b2Settings.b2_maxProxies); m_quantizationFactor = new b2Vec2(); super(); m_pairManager.Initialize(this, callback); m_worldAABB = worldAABB; m_proxyCount = 0; i = 0; while (i < b2Settings.b2_maxProxies) { m_queryResults[i] = 0; i++; }; m_bounds = new Array(2); i = 0; while (i < 2) { m_bounds[i] = new Array((2 * b2Settings.b2_maxProxies)); j = 0; while (j < (2 * b2Settings.b2_maxProxies)) { m_bounds[i][j] = new b2Bound(); j++; }; i++; }; dX = (worldAABB.upperBound.x - worldAABB.lowerBound.x); dY = (worldAABB.upperBound.y - worldAABB.lowerBound.y); m_quantizationFactor.x = (b2Settings.USHRT_MAX / dX); m_quantizationFactor.y = (b2Settings.USHRT_MAX / dY); i = 0; while (i < (b2Settings.b2_maxProxies - 1)) { tProxy = new b2Proxy(); m_proxyPool[i] = tProxy; tProxy.SetNext((i + 1)); tProxy.timeStamp = 0; tProxy.overlapCount = b2_invalid; tProxy.userData = null; i++; }; tProxy = new b2Proxy(); m_proxyPool[int((b2Settings.b2_maxProxies - 1))] = tProxy; tProxy.SetNext(b2Pair.b2_nullProxy); tProxy.timeStamp = 0; tProxy.overlapCount = b2_invalid; tProxy.userData = null; m_freeProxy = 0; m_timeStamp = 1; m_queryResultCount = 0; } public function QueryAABB(aabb:b2AABB, userData, maxCount:int):int{ var lowerValues:Array; var upperValues:Array; var lowerIndex:uint; var upperIndex:uint; var lowerIndexOut:Array; var upperIndexOut:Array; var count:int; var i:int; var proxy:b2Proxy; lowerValues = new Array(); upperValues = new Array(); ComputeBounds(lowerValues, upperValues, aabb); lowerIndexOut = [lowerIndex]; upperIndexOut = [upperIndex]; Query(lowerIndexOut, upperIndexOut, lowerValues[0], upperValues[0], m_bounds[0], (2 * m_proxyCount), 0); Query(lowerIndexOut, upperIndexOut, lowerValues[1], upperValues[1], m_bounds[1], (2 * m_proxyCount), 1); count = 0; i = 0; while ((((i < m_queryResultCount)) && ((count < maxCount)))) { proxy = m_proxyPool[m_queryResults[i]]; userData[i] = proxy.userData; i++; count++; }; m_queryResultCount = 0; IncrementTimeStamp(); return (count); } public function Commit():void{ m_pairManager.Commit(); } public function GetProxy(proxyId:int):b2Proxy{ var proxy:b2Proxy; proxy = m_proxyPool[proxyId]; if ((((proxyId == b2Pair.b2_nullProxy)) || ((proxy.IsValid() == false)))){ return (null); }; return (proxy); } private function IncrementTimeStamp():void{ var i:uint; if (m_timeStamp == b2Settings.USHRT_MAX){ i = 0; while (i < b2Settings.b2_maxProxies) { (m_proxyPool[i] as b2Proxy).timeStamp = 0; i++; }; m_timeStamp = 1; } else { m_timeStamp++; }; } private function Query(lowerQueryOut:Array, upperQueryOut:Array, lowerValue:uint, upperValue:uint, bounds:Array, boundCount:uint, axis:int):void{ var lowerQuery:uint; var upperQuery:uint; var bound:b2Bound; var j:uint; var i:int; var s:int; var proxy:b2Proxy; lowerQuery = BinarySearch(bounds, boundCount, lowerValue); upperQuery = BinarySearch(bounds, boundCount, upperValue); j = lowerQuery; while (j < upperQuery) { bound = bounds[j]; if (bound.IsLower()){ IncrementOverlapCount(bound.proxyId); }; j++; }; if (lowerQuery > 0){ i = (lowerQuery - 1); bound = bounds[i]; s = bound.stabbingCount; while (s) { bound = bounds[i]; if (bound.IsLower()){ proxy = m_proxyPool[bound.proxyId]; if (lowerQuery <= proxy.upperBounds[axis]){ IncrementOverlapCount(bound.proxyId); s--; }; }; i--; }; }; lowerQueryOut[0] = lowerQuery; upperQueryOut[0] = upperQuery; } private function TestOverlapValidate(p1:b2Proxy, p2:b2Proxy):Boolean{ var axis:int; var bounds:Array; var bound1:b2Bound; var bound2:b2Bound; axis = 0; while (axis < 2) { bounds = m_bounds[axis]; bound1 = bounds[p1.lowerBounds[axis]]; bound2 = bounds[p2.upperBounds[axis]]; if (bound1.value > bound2.value){ return (false); }; bound1 = bounds[p1.upperBounds[axis]]; bound2 = bounds[p2.lowerBounds[axis]]; if (bound1.value < bound2.value){ return (false); }; axis++; }; return (true); } private function ComputeBounds(lowerValues:Array, upperValues:Array, aabb:b2AABB):void{ var minVertexX:Number; var minVertexY:Number; var maxVertexX:Number; var maxVertexY:Number; minVertexX = aabb.lowerBound.x; minVertexY = aabb.lowerBound.y; minVertexX = b2Math.b2Min(minVertexX, m_worldAABB.upperBound.x); minVertexY = b2Math.b2Min(minVertexY, m_worldAABB.upperBound.y); minVertexX = b2Math.b2Max(minVertexX, m_worldAABB.lowerBound.x); minVertexY = b2Math.b2Max(minVertexY, m_worldAABB.lowerBound.y); maxVertexX = aabb.upperBound.x; maxVertexY = aabb.upperBound.y; maxVertexX = b2Math.b2Min(maxVertexX, m_worldAABB.upperBound.x); maxVertexY = b2Math.b2Min(maxVertexY, m_worldAABB.upperBound.y); maxVertexX = b2Math.b2Max(maxVertexX, m_worldAABB.lowerBound.x); maxVertexY = b2Math.b2Max(maxVertexY, m_worldAABB.lowerBound.y); lowerValues[0] = (uint((m_quantizationFactor.x * (minVertexX - m_worldAABB.lowerBound.x))) & (b2Settings.USHRT_MAX - 1)); upperValues[0] = ((uint((m_quantizationFactor.x * (maxVertexX - m_worldAABB.lowerBound.x))) & 0xFFFF) | 1); lowerValues[1] = (uint((m_quantizationFactor.y * (minVertexY - m_worldAABB.lowerBound.y))) & (b2Settings.USHRT_MAX - 1)); upperValues[1] = ((uint((m_quantizationFactor.y * (maxVertexY - m_worldAABB.lowerBound.y))) & 0xFFFF) | 1); } public function CreateProxy(aabb:b2AABB, userData):uint{ var index:uint; var proxy:b2Proxy; var proxyId:uint; var boundCount:uint; var lowerValues:Array; var upperValues:Array; var axis:int; var i:int; var bounds:Array; var lowerIndex:uint; var upperIndex:uint; var lowerIndexOut:Array; var upperIndexOut:Array; var tArr:Array; var j:int; var tEnd:int; var tBound1:b2Bound; var tBound2:b2Bound; var tBoundAS3:b2Bound; var tIndex:int; var proxy2:b2Proxy; proxyId = m_freeProxy; proxy = m_proxyPool[proxyId]; m_freeProxy = proxy.GetNext(); proxy.overlapCount = 0; proxy.userData = userData; boundCount = (2 * m_proxyCount); lowerValues = new Array(); upperValues = new Array(); ComputeBounds(lowerValues, upperValues, aabb); axis = 0; while (axis < 2) { bounds = m_bounds[axis]; lowerIndexOut = [lowerIndex]; upperIndexOut = [upperIndex]; Query(lowerIndexOut, upperIndexOut, lowerValues[axis], upperValues[axis], bounds, boundCount, axis); lowerIndex = lowerIndexOut[0]; upperIndex = upperIndexOut[0]; tArr = new Array(); tEnd = (boundCount - upperIndex); j = 0; while (j < tEnd) { tArr[j] = new b2Bound(); tBound1 = tArr[j]; tBound2 = bounds[int((upperIndex + j))]; tBound1.value = tBound2.value; tBound1.proxyId = tBound2.proxyId; tBound1.stabbingCount = tBound2.stabbingCount; j++; }; tEnd = tArr.length; tIndex = (upperIndex + 2); j = 0; while (j < tEnd) { tBound2 = tArr[j]; tBound1 = bounds[int((tIndex + j))]; tBound1.value = tBound2.value; tBound1.proxyId = tBound2.proxyId; tBound1.stabbingCount = tBound2.stabbingCount; j++; }; tArr = new Array(); tEnd = (upperIndex - lowerIndex); j = 0; while (j < tEnd) { tArr[j] = new b2Bound(); tBound1 = tArr[j]; tBound2 = bounds[int((lowerIndex + j))]; tBound1.value = tBound2.value; tBound1.proxyId = tBound2.proxyId; tBound1.stabbingCount = tBound2.stabbingCount; j++; }; tEnd = tArr.length; tIndex = (lowerIndex + 1); j = 0; while (j < tEnd) { tBound2 = tArr[j]; tBound1 = bounds[int((tIndex + j))]; tBound1.value = tBound2.value; tBound1.proxyId = tBound2.proxyId; tBound1.stabbingCount = tBound2.stabbingCount; j++; }; upperIndex++; tBound1 = bounds[lowerIndex]; tBound2 = bounds[upperIndex]; tBound1.value = lowerValues[axis]; tBound1.proxyId = proxyId; tBound2.value = upperValues[axis]; tBound2.proxyId = proxyId; tBoundAS3 = bounds[int((lowerIndex - 1))]; tBound1.stabbingCount = ((lowerIndex == 0)) ? 0 : tBoundAS3.stabbingCount; tBoundAS3 = bounds[int((upperIndex - 1))]; tBound2.stabbingCount = tBoundAS3.stabbingCount; index = lowerIndex; while (index < upperIndex) { tBoundAS3 = bounds[index]; tBoundAS3.stabbingCount++; index++; }; index = lowerIndex; while (index < (boundCount + 2)) { tBound1 = bounds[index]; proxy2 = m_proxyPool[tBound1.proxyId]; if (tBound1.IsLower()){ proxy2.lowerBounds[axis] = index; } else { proxy2.upperBounds[axis] = index; }; index++; }; axis++; }; m_proxyCount++; i = 0; while (i < m_queryResultCount) { m_pairManager.AddBufferedPair(proxyId, m_queryResults[i]); i++; }; m_pairManager.Commit(); m_queryResultCount = 0; IncrementTimeStamp(); return (proxyId); } public function DestroyProxy(proxyId:uint):void{ var tBound1:b2Bound; var tBound2:b2Bound; var proxy:b2Proxy; var boundCount:int; var axis:int; var i:int; var bounds:Array; var lowerIndex:uint; var upperIndex:uint; var lowerValue:uint; var upperValue:uint; var tArr:Array; var j:int; var tEnd:int; var tIndex:int; var index:uint; var index2:int; var proxy2:b2Proxy; proxy = m_proxyPool[proxyId]; boundCount = (2 * m_proxyCount); axis = 0; while (axis < 2) { bounds = m_bounds[axis]; lowerIndex = proxy.lowerBounds[axis]; upperIndex = proxy.upperBounds[axis]; tBound1 = bounds[lowerIndex]; lowerValue = tBound1.value; tBound2 = bounds[upperIndex]; upperValue = tBound2.value; tArr = new Array(); tEnd = ((upperIndex - lowerIndex) - 1); j = 0; while (j < tEnd) { tArr[j] = new b2Bound(); tBound1 = tArr[j]; tBound2 = bounds[int(((lowerIndex + 1) + j))]; tBound1.value = tBound2.value; tBound1.proxyId = tBound2.proxyId; tBound1.stabbingCount = tBound2.stabbingCount; j++; }; tEnd = tArr.length; tIndex = lowerIndex; j = 0; while (j < tEnd) { tBound2 = tArr[j]; tBound1 = bounds[int((tIndex + j))]; tBound1.value = tBound2.value; tBound1.proxyId = tBound2.proxyId; tBound1.stabbingCount = tBound2.stabbingCount; j++; }; tArr = new Array(); tEnd = ((boundCount - upperIndex) - 1); j = 0; while (j < tEnd) { tArr[j] = new b2Bound(); tBound1 = tArr[j]; tBound2 = bounds[int(((upperIndex + 1) + j))]; tBound1.value = tBound2.value; tBound1.proxyId = tBound2.proxyId; tBound1.stabbingCount = tBound2.stabbingCount; j++; }; tEnd = tArr.length; tIndex = (upperIndex - 1); j = 0; while (j < tEnd) { tBound2 = tArr[j]; tBound1 = bounds[int((tIndex + j))]; tBound1.value = tBound2.value; tBound1.proxyId = tBound2.proxyId; tBound1.stabbingCount = tBound2.stabbingCount; j++; }; tEnd = (boundCount - 2); index = lowerIndex; while (index < tEnd) { tBound1 = bounds[index]; proxy2 = m_proxyPool[tBound1.proxyId]; if (tBound1.IsLower()){ proxy2.lowerBounds[axis] = index; } else { proxy2.upperBounds[axis] = index; }; index++; }; tEnd = (upperIndex - 1); index2 = lowerIndex; while (index2 < tEnd) { tBound1 = bounds[index2]; tBound1.stabbingCount--; index2++; }; Query([0], [0], lowerValue, upperValue, bounds, (boundCount - 2), axis); axis++; }; i = 0; while (i < m_queryResultCount) { m_pairManager.RemoveBufferedPair(proxyId, m_queryResults[i]); i++; }; m_pairManager.Commit(); m_queryResultCount = 0; IncrementTimeStamp(); proxy.userData = null; proxy.overlapCount = b2_invalid; proxy.lowerBounds[0] = b2_invalid; proxy.lowerBounds[1] = b2_invalid; proxy.upperBounds[0] = b2_invalid; proxy.upperBounds[1] = b2_invalid; proxy.SetNext(m_freeProxy); m_freeProxy = proxyId; m_proxyCount--; } public function TestOverlap(b:b2BoundValues, p:b2Proxy):Boolean{ var axis:int; var bounds:Array; var bound:b2Bound; axis = 0; while (axis < 2) { bounds = m_bounds[axis]; bound = bounds[p.upperBounds[axis]]; if (b.lowerValues[axis] > bound.value){ return (false); }; bound = bounds[p.lowerBounds[axis]]; if (b.upperValues[axis] < bound.value){ return (false); }; axis++; }; return (true); } public function Validate():void{ var pair:b2Pair; var proxy1:b2Proxy; var proxy2:b2Proxy; var overlap:Boolean; var axis:int; var bounds:b2Bound; var boundCount:uint; var stabbingCount:uint; var i:uint; var bound:b2Bound; axis = 0; while (axis < 2) { bounds = m_bounds[axis]; boundCount = (2 * m_proxyCount); stabbingCount = 0; i = 0; while (i < boundCount) { bound = bounds[i]; if (bound.IsLower() == true){ stabbingCount++; } else { stabbingCount--; }; i++; }; axis++; }; } private function IncrementOverlapCount(proxyId:uint):void{ var proxy:b2Proxy; proxy = m_proxyPool[proxyId]; if (proxy.timeStamp < m_timeStamp){ proxy.timeStamp = m_timeStamp; proxy.overlapCount = 1; } else { proxy.overlapCount = 2; m_queryResults[m_queryResultCount] = proxyId; m_queryResultCount++; }; } public function InRange(aabb:b2AABB):Boolean{ var dX:Number; var dY:Number; var d2X:Number; var d2Y:Number; dX = aabb.lowerBound.x; dY = aabb.lowerBound.y; dX = (dX - m_worldAABB.upperBound.x); dY = (dY - m_worldAABB.upperBound.y); d2X = m_worldAABB.lowerBound.x; d2Y = m_worldAABB.lowerBound.y; d2X = (d2X - aabb.upperBound.x); d2Y = (d2Y - aabb.upperBound.y); dX = b2Math.b2Max(dX, d2X); dY = b2Math.b2Max(dY, d2Y); return ((b2Math.b2Max(dX, dY) < 0)); } public function MoveProxy(proxyId:uint, aabb:b2AABB):void{ var as3arr:Array; var as3int:int; var axis:uint; var index:uint; var bound:b2Bound; var prevBound:b2Bound; var nextBound:b2Bound; var nextProxyId:uint; var nextProxy:b2Proxy; var boundCount:uint; var proxy:b2Proxy; var newValues:b2BoundValues; var oldValues:b2BoundValues; var bounds:Array; var lowerIndex:uint; var upperIndex:uint; var lowerValue:uint; var upperValue:uint; var deltaLower:int; var deltaUpper:int; var prevProxyId:uint; var prevProxy:b2Proxy; if ((((proxyId == b2Pair.b2_nullProxy)) || ((b2Settings.b2_maxProxies <= proxyId)))){ return; }; if (aabb.IsValid() == false){ return; }; boundCount = (2 * m_proxyCount); proxy = m_proxyPool[proxyId]; newValues = new b2BoundValues(); ComputeBounds(newValues.lowerValues, newValues.upperValues, aabb); oldValues = new b2BoundValues(); axis = 0; while (axis < 2) { bound = m_bounds[axis][proxy.lowerBounds[axis]]; oldValues.lowerValues[axis] = bound.value; bound = m_bounds[axis][proxy.upperBounds[axis]]; oldValues.upperValues[axis] = bound.value; axis++; }; axis = 0; while (axis < 2) { bounds = m_bounds[axis]; lowerIndex = proxy.lowerBounds[axis]; upperIndex = proxy.upperBounds[axis]; lowerValue = newValues.lowerValues[axis]; upperValue = newValues.upperValues[axis]; bound = bounds[lowerIndex]; deltaLower = (lowerValue - bound.value); bound.value = lowerValue; bound = bounds[upperIndex]; deltaUpper = (upperValue - bound.value); bound.value = upperValue; if (deltaLower < 0){ index = lowerIndex; while ((((index > 0)) && ((lowerValue < (bounds[int((index - 1))] as b2Bound).value)))) { bound = bounds[index]; prevBound = bounds[int((index - 1))]; prevProxyId = prevBound.proxyId; prevProxy = m_proxyPool[prevBound.proxyId]; prevBound.stabbingCount++; if (prevBound.IsUpper() == true){ if (TestOverlap(newValues, prevProxy)){ m_pairManager.AddBufferedPair(proxyId, prevProxyId); }; as3arr = prevProxy.upperBounds; as3int = as3arr[axis]; as3int++; as3arr[axis] = as3int; bound.stabbingCount++; } else { as3arr = prevProxy.lowerBounds; as3int = as3arr[axis]; as3int++; as3arr[axis] = as3int; bound.stabbingCount--; }; as3arr = proxy.lowerBounds; as3int = as3arr[axis]; as3int--; as3arr[axis] = as3int; bound.Swap(prevBound); index--; }; }; if (deltaUpper > 0){ index = upperIndex; while ((((index < (boundCount - 1))) && (((bounds[int((index + 1))] as b2Bound).value <= upperValue)))) { bound = bounds[index]; nextBound = bounds[int((index + 1))]; nextProxyId = nextBound.proxyId; nextProxy = m_proxyPool[nextProxyId]; nextBound.stabbingCount++; if (nextBound.IsLower() == true){ if (TestOverlap(newValues, nextProxy)){ m_pairManager.AddBufferedPair(proxyId, nextProxyId); }; as3arr = nextProxy.lowerBounds; as3int = as3arr[axis]; as3int--; as3arr[axis] = as3int; bound.stabbingCount++; } else { as3arr = nextProxy.upperBounds; as3int = as3arr[axis]; as3int--; as3arr[axis] = as3int; bound.stabbingCount--; }; as3arr = proxy.upperBounds; as3int = as3arr[axis]; as3int++; as3arr[axis] = as3int; bound.Swap(nextBound); index++; }; }; if (deltaLower > 0){ index = lowerIndex; while ((((index < (boundCount - 1))) && (((bounds[int((index + 1))] as b2Bound).value <= lowerValue)))) { bound = bounds[index]; nextBound = bounds[int((index + 1))]; nextProxyId = nextBound.proxyId; nextProxy = m_proxyPool[nextProxyId]; nextBound.stabbingCount--; if (nextBound.IsUpper()){ if (TestOverlap(oldValues, nextProxy)){ m_pairManager.RemoveBufferedPair(proxyId, nextProxyId); }; as3arr = nextProxy.upperBounds; as3int = as3arr[axis]; as3int--; as3arr[axis] = as3int; bound.stabbingCount--; } else { as3arr = nextProxy.lowerBounds; as3int = as3arr[axis]; as3int--; as3arr[axis] = as3int; bound.stabbingCount++; }; as3arr = proxy.lowerBounds; as3int = as3arr[axis]; as3int++; as3arr[axis] = as3int; bound.Swap(nextBound); index++; }; }; if (deltaUpper < 0){ index = upperIndex; while ((((index > 0)) && ((upperValue < (bounds[int((index - 1))] as b2Bound).value)))) { bound = bounds[index]; prevBound = bounds[int((index - 1))]; prevProxyId = prevBound.proxyId; prevProxy = m_proxyPool[prevProxyId]; prevBound.stabbingCount--; if (prevBound.IsLower() == true){ if (TestOverlap(oldValues, prevProxy)){ m_pairManager.RemoveBufferedPair(proxyId, prevProxyId); }; as3arr = prevProxy.lowerBounds; as3int = as3arr[axis]; as3int++; as3arr[axis] = as3int; bound.stabbingCount--; } else { as3arr = prevProxy.upperBounds; as3int = as3arr[axis]; as3int++; as3arr[axis] = as3int; bound.stabbingCount++; }; as3arr = proxy.upperBounds; as3int = as3arr[axis]; as3int--; as3arr[axis] = as3int; bound.Swap(prevBound); index--; }; }; axis++; }; } public static function BinarySearch(bounds:Array, count:int, value:uint):uint{ var low:int; var high:int; var mid:int; var bound:b2Bound; low = 0; high = (count - 1); while (low <= high) { mid = ((low + high) / 2); bound = bounds[mid]; if (bound.value > value){ high = (mid - 1); } else { if (bound.value < value){ low = (mid + 1); } else { return (uint(mid)); }; }; }; return (uint(low)); } } }//package Box2D.Collision
Section 14
//b2BufferedPair (Box2D.Collision.b2BufferedPair) package Box2D.Collision { public class b2BufferedPair { public var proxyId1:uint; public var proxyId2:uint; public function b2BufferedPair(){ super(); } } }//package Box2D.Collision
Section 15
//b2Collision (Box2D.Collision.b2Collision) package Box2D.Collision { import Box2D.Common.Math.*; import Box2D.Collision.Shapes.*; import Box2D.Common.*; public class b2Collision { public static const b2_nullFeature:uint = 0xFF; private static var b2CollidePolyTempVec:b2Vec2 = new b2Vec2(); public function b2Collision(){ super(); } public static function EdgeSeparation(poly1:b2PolygonShape, xf1:b2XForm, edge1:int, poly2:b2PolygonShape, xf2:b2XForm):Number{ var count1:int; var vertices1:Array; var normals1:Array; var count2:int; var vertices2:Array; var tMat:b2Mat22; var tVec:b2Vec2; var normal1WorldX:Number; var normal1WorldY:Number; var normal1X:Number; var normal1Y:Number; var index:int; var minDot:Number; var i:int; var v1X:Number; var v1Y:Number; var v2X:Number; var v2Y:Number; var separation:Number; var dot:Number; count1 = poly1.m_vertexCount; vertices1 = poly1.m_vertices; normals1 = poly1.m_normals; count2 = poly2.m_vertexCount; vertices2 = poly2.m_vertices; tMat = xf1.R; tVec = normals1[edge1]; normal1WorldX = ((tMat.col1.x * tVec.x) + (tMat.col2.x * tVec.y)); normal1WorldY = ((tMat.col1.y * tVec.x) + (tMat.col2.y * tVec.y)); tMat = xf2.R; normal1X = ((tMat.col1.x * normal1WorldX) + (tMat.col1.y * normal1WorldY)); normal1Y = ((tMat.col2.x * normal1WorldX) + (tMat.col2.y * normal1WorldY)); index = 0; minDot = Number.MAX_VALUE; i = 0; while (i < count2) { tVec = vertices2[i]; dot = ((tVec.x * normal1X) + (tVec.y * normal1Y)); if (dot < minDot){ minDot = dot; index = i; }; i++; }; tVec = vertices1[edge1]; tMat = xf1.R; v1X = (xf1.position.x + ((tMat.col1.x * tVec.x) + (tMat.col2.x * tVec.y))); v1Y = (xf1.position.y + ((tMat.col1.y * tVec.x) + (tMat.col2.y * tVec.y))); tVec = vertices2[index]; tMat = xf2.R; v2X = (xf2.position.x + ((tMat.col1.x * tVec.x) + (tMat.col2.x * tVec.y))); v2Y = (xf2.position.y + ((tMat.col1.y * tVec.x) + (tMat.col2.y * tVec.y))); v2X = (v2X - v1X); v2Y = (v2Y - v1Y); separation = ((v2X * normal1WorldX) + (v2Y * normal1WorldY)); return (separation); } public static function b2TestOverlap(a:b2AABB, b:b2AABB):Boolean{ var t1:b2Vec2; var t2:b2Vec2; var d1X:Number; var d1Y:Number; var d2X:Number; var d2Y:Number; t1 = b.lowerBound; t2 = a.upperBound; d1X = (t1.x - t2.x); d1Y = (t1.y - t2.y); t1 = a.lowerBound; t2 = b.upperBound; d2X = (t1.x - t2.x); d2Y = (t1.y - t2.y); if ((((d1X > 0)) || ((d1Y > 0)))){ return (false); }; if ((((d2X > 0)) || ((d2Y > 0)))){ return (false); }; return (true); } public static function FindIncidentEdge(c:Array, poly1:b2PolygonShape, xf1:b2XForm, edge1:int, poly2:b2PolygonShape, xf2:b2XForm):void{ var count1:int; var normals1:Array; var count2:int; var vertices2:Array; var normals2:Array; var tMat:b2Mat22; var tVec:b2Vec2; var normal1X:Number; var normal1Y:Number; var tX:Number; var index:int; var minDot:Number; var i:int; var tClip:ClipVertex; var i1:int; var i2:int; var dot:Number; count1 = poly1.m_vertexCount; normals1 = poly1.m_normals; count2 = poly2.m_vertexCount; vertices2 = poly2.m_vertices; normals2 = poly2.m_normals; tMat = xf1.R; tVec = normals1[edge1]; normal1X = ((tMat.col1.x * tVec.x) + (tMat.col2.x * tVec.y)); normal1Y = ((tMat.col1.y * tVec.x) + (tMat.col2.y * tVec.y)); tMat = xf2.R; tX = ((tMat.col1.x * normal1X) + (tMat.col1.y * normal1Y)); normal1Y = ((tMat.col2.x * normal1X) + (tMat.col2.y * normal1Y)); normal1X = tX; index = 0; minDot = Number.MAX_VALUE; i = 0; while (i < count2) { tVec = normals2[i]; dot = ((normal1X * tVec.x) + (normal1Y * tVec.y)); if (dot < minDot){ minDot = dot; index = i; }; i++; }; i1 = index; i2 = (((i1 + 1) < count2)) ? (i1 + 1) : 0; tClip = c[0]; tVec = vertices2[i1]; tMat = xf2.R; tClip.v.x = (xf2.position.x + ((tMat.col1.x * tVec.x) + (tMat.col2.x * tVec.y))); tClip.v.y = (xf2.position.y + ((tMat.col1.y * tVec.x) + (tMat.col2.y * tVec.y))); tClip.id.features.referenceEdge = edge1; tClip.id.features.incidentEdge = i1; tClip.id.features.incidentVertex = 0; tClip = c[1]; tVec = vertices2[i2]; tMat = xf2.R; tClip.v.x = (xf2.position.x + ((tMat.col1.x * tVec.x) + (tMat.col2.x * tVec.y))); tClip.v.y = (xf2.position.y + ((tMat.col1.y * tVec.x) + (tMat.col2.y * tVec.y))); tClip.id.features.referenceEdge = edge1; tClip.id.features.incidentEdge = i2; tClip.id.features.incidentVertex = 1; } public static function b2CollidePolygons(manifold:b2Manifold, polyA:b2PolygonShape, xfA:b2XForm, polyB:b2PolygonShape, xfB:b2XForm):void{ var cv:ClipVertex; var edgeA:int; var edgeAO:Array; var separationA:Number; var edgeB:int; var edgeBO:Array; var separationB:Number; var poly1:b2PolygonShape; var poly2:b2PolygonShape; var xf1:b2XForm; var xf2:b2XForm; var edge1:int; var flip:uint; var k_relativeTol:Number; var k_absoluteTol:Number; var incidentEdge:Array; var count1:int; var vertices1:Array; var tVec:b2Vec2; var v11:b2Vec2; var dv:b2Vec2; var sideNormal:b2Vec2; var frontNormal:b2Vec2; var frontOffset:Number; var sideOffset1:Number; var sideOffset2:Number; var clipPoints1:Array; var clipPoints2:Array; var np:int; var pointCount:int; var i:int; var v12:b2Vec2; var separation:Number; var cp:b2ManifoldPoint; manifold.pointCount = 0; edgeA = 0; edgeAO = [edgeA]; separationA = FindMaxSeparation(edgeAO, polyA, xfA, polyB, xfB); edgeA = edgeAO[0]; if (separationA > 0){ return; }; edgeB = 0; edgeBO = [edgeB]; separationB = FindMaxSeparation(edgeBO, polyB, xfB, polyA, xfA); edgeB = edgeBO[0]; if (separationB > 0){ return; }; xf1 = new b2XForm(); xf2 = new b2XForm(); k_relativeTol = 0.98; k_absoluteTol = 0.001; if (separationB > ((k_relativeTol * separationA) + k_absoluteTol)){ poly1 = polyB; poly2 = polyA; xf1.Set(xfB); xf2.Set(xfA); edge1 = edgeB; flip = 1; } else { poly1 = polyA; poly2 = polyB; xf1.Set(xfA); xf2.Set(xfB); edge1 = edgeA; flip = 0; }; incidentEdge = [new ClipVertex(), new ClipVertex()]; FindIncidentEdge(incidentEdge, poly1, xf1, edge1, poly2, xf2); count1 = poly1.m_vertexCount; vertices1 = poly1.m_vertices; tVec = vertices1[edge1]; v11 = tVec.Copy(); if ((edge1 + 1) < count1){ tVec = vertices1[int((edge1 + 1))]; v12 = tVec.Copy(); } else { tVec = vertices1[0]; v12 = tVec.Copy(); }; dv = b2Math.SubtractVV(v12, v11); sideNormal = b2Math.b2MulMV(xf1.R, b2Math.SubtractVV(v12, v11)); sideNormal.Normalize(); frontNormal = b2Math.b2CrossVF(sideNormal, 1); v11 = b2Math.b2MulX(xf1, v11); v12 = b2Math.b2MulX(xf1, v12); frontOffset = b2Math.b2Dot(frontNormal, v11); sideOffset1 = -(b2Math.b2Dot(sideNormal, v11)); sideOffset2 = b2Math.b2Dot(sideNormal, v12); clipPoints1 = [new ClipVertex(), new ClipVertex()]; clipPoints2 = [new ClipVertex(), new ClipVertex()]; np = ClipSegmentToLine(clipPoints1, incidentEdge, sideNormal.Negative(), sideOffset1); if (np < 2){ return; }; np = ClipSegmentToLine(clipPoints2, clipPoints1, sideNormal, sideOffset2); if (np < 2){ return; }; manifold.normal = (flip) ? frontNormal.Negative() : frontNormal.Copy(); pointCount = 0; i = 0; while (i < b2Settings.b2_maxManifoldPoints) { cv = clipPoints2[i]; separation = (b2Math.b2Dot(frontNormal, cv.v) - frontOffset); if (separation <= 0){ cp = manifold.points[pointCount]; cp.separation = separation; cp.localPoint1 = b2Math.b2MulXT(xfA, cv.v); cp.localPoint2 = b2Math.b2MulXT(xfB, cv.v); cp.id.key = cv.id._key; cp.id.features.flip = flip; pointCount++; }; i++; }; manifold.pointCount = pointCount; } public static function FindMaxSeparation(edgeIndex:Array, poly1:b2PolygonShape, xf1:b2XForm, poly2:b2PolygonShape, xf2:b2XForm):Number{ var count1:int; var normals1:Array; var tVec:b2Vec2; var tMat:b2Mat22; var dX:Number; var dY:Number; var dLocal1X:Number; var dLocal1Y:Number; var edge:int; var maxDot:Number; var i:int; var s:Number; var prevEdge:int; var sPrev:Number; var nextEdge:int; var sNext:Number; var bestEdge:int; var bestSeparation:Number; var increment:int; var dot:Number; count1 = poly1.m_vertexCount; normals1 = poly1.m_normals; tMat = xf2.R; tVec = poly2.m_centroid; dX = (xf2.position.x + ((tMat.col1.x * tVec.x) + (tMat.col2.x * tVec.y))); dY = (xf2.position.y + ((tMat.col1.y * tVec.x) + (tMat.col2.y * tVec.y))); tMat = xf1.R; tVec = poly1.m_centroid; dX = (dX - (xf1.position.x + ((tMat.col1.x * tVec.x) + (tMat.col2.x * tVec.y)))); dY = (dY - (xf1.position.y + ((tMat.col1.y * tVec.x) + (tMat.col2.y * tVec.y)))); dLocal1X = ((dX * xf1.R.col1.x) + (dY * xf1.R.col1.y)); dLocal1Y = ((dX * xf1.R.col2.x) + (dY * xf1.R.col2.y)); edge = 0; maxDot = -(Number.MAX_VALUE); i = 0; while (i < count1) { tVec = normals1[i]; dot = ((tVec.x * dLocal1X) + (tVec.y * dLocal1Y)); if (dot > maxDot){ maxDot = dot; edge = i; }; i++; }; s = EdgeSeparation(poly1, xf1, edge, poly2, xf2); if (s > 0){ return (s); }; prevEdge = (((edge - 1) >= 0)) ? (edge - 1) : (count1 - 1); sPrev = EdgeSeparation(poly1, xf1, prevEdge, poly2, xf2); if (sPrev > 0){ return (sPrev); }; nextEdge = (((edge + 1) < count1)) ? (edge + 1) : 0; sNext = EdgeSeparation(poly1, xf1, nextEdge, poly2, xf2); if (sNext > 0){ return (sNext); }; if ((((sPrev > s)) && ((sPrev > sNext)))){ increment = -1; bestEdge = prevEdge; bestSeparation = sPrev; } else { if (sNext > s){ increment = 1; bestEdge = nextEdge; bestSeparation = sNext; } else { edgeIndex[0] = edge; return (s); }; }; while (true) { if (increment == -1){ edge = (((bestEdge - 1) >= 0)) ? (bestEdge - 1) : (count1 - 1); } else { edge = (((bestEdge + 1) < count1)) ? (bestEdge + 1) : 0; }; s = EdgeSeparation(poly1, xf1, edge, poly2, xf2); if (s > 0){ return (s); }; if (s > bestSeparation){ bestEdge = edge; bestSeparation = s; } else { break; }; }; edgeIndex[0] = bestEdge; return (bestSeparation); } public static function ClipSegmentToLine(vOut:Array, vIn:Array, normal:b2Vec2, offset:Number):int{ var cv:ClipVertex; var numOut:int; var vIn0:b2Vec2; var vIn1:b2Vec2; var distance0:Number; var distance1:Number; var interp:Number; var tVec:b2Vec2; var cv2:ClipVertex; numOut = 0; cv = vIn[0]; vIn0 = cv.v; cv = vIn[1]; vIn1 = cv.v; distance0 = (b2Math.b2Dot(normal, vIn0) - offset); distance1 = (b2Math.b2Dot(normal, vIn1) - offset); if (distance0 <= 0){ var _temp1 = numOut; numOut = (numOut + 1); var _local14 = _temp1; vOut[_local14] = vIn[0]; }; if (distance1 <= 0){ var _temp2 = numOut; numOut = (numOut + 1); _local14 = _temp2; vOut[_local14] = vIn[1]; }; if ((distance0 * distance1) < 0){ interp = (distance0 / (distance0 - distance1)); cv = vOut[numOut]; tVec = cv.v; tVec.x = (vIn0.x + (interp * (vIn1.x - vIn0.x))); tVec.y = (vIn0.y + (interp * (vIn1.y - vIn0.y))); cv = vOut[numOut]; if (distance0 > 0){ cv2 = vIn[0]; cv.id = cv2.id; } else { cv2 = vIn[1]; cv.id = cv2.id; }; numOut++; }; return (numOut); } public static function b2CollideCircles(manifold:b2Manifold, circle1:b2CircleShape, xf1:b2XForm, circle2:b2CircleShape, xf2:b2XForm):void{ var tMat:b2Mat22; var tVec:b2Vec2; var p1X:Number; var p1Y:Number; var p2X:Number; var p2Y:Number; var dX:Number; var dY:Number; var distSqr:Number; var r1:Number; var r2:Number; var radiusSum:Number; var separation:Number; var tPoint:b2ManifoldPoint; var pX:Number; var pY:Number; var tX:Number; var tY:Number; var dist:Number; var a:Number; manifold.pointCount = 0; tMat = xf1.R; tVec = circle1.m_localPosition; p1X = (xf1.position.x + ((tMat.col1.x * tVec.x) + (tMat.col2.x * tVec.y))); p1Y = (xf1.position.y + ((tMat.col1.y * tVec.x) + (tMat.col2.y * tVec.y))); tMat = xf2.R; tVec = circle2.m_localPosition; p2X = (xf2.position.x + ((tMat.col1.x * tVec.x) + (tMat.col2.x * tVec.y))); p2Y = (xf2.position.y + ((tMat.col1.y * tVec.x) + (tMat.col2.y * tVec.y))); dX = (p2X - p1X); dY = (p2Y - p1Y); distSqr = ((dX * dX) + (dY * dY)); r1 = circle1.m_radius; r2 = circle2.m_radius; radiusSum = (r1 + r2); if (distSqr > (radiusSum * radiusSum)){ return; }; if (distSqr < Number.MIN_VALUE){ separation = -(radiusSum); manifold.normal.Set(0, 1); } else { dist = Math.sqrt(distSqr); separation = (dist - radiusSum); a = (1 / dist); manifold.normal.x = (a * dX); manifold.normal.y = (a * dY); }; manifold.pointCount = 1; tPoint = manifold.points[0]; tPoint.id.key = 0; tPoint.separation = separation; p1X = (p1X + (r1 * manifold.normal.x)); p1Y = (p1Y + (r1 * manifold.normal.y)); p2X = (p2X - (r2 * manifold.normal.x)); p2Y = (p2Y - (r2 * manifold.normal.y)); pX = (0.5 * (p1X + p2X)); pY = (0.5 * (p1Y + p2Y)); tX = (pX - xf1.position.x); tY = (pY - xf1.position.y); tPoint.localPoint1.x = ((tX * xf1.R.col1.x) + (tY * xf1.R.col1.y)); tPoint.localPoint1.y = ((tX * xf1.R.col2.x) + (tY * xf1.R.col2.y)); tX = (pX - xf2.position.x); tY = (pY - xf2.position.y); tPoint.localPoint2.x = ((tX * xf2.R.col1.x) + (tY * xf2.R.col1.y)); tPoint.localPoint2.y = ((tX * xf2.R.col2.x) + (tY * xf2.R.col2.y)); } public static function b2CollidePolygonAndCircle(manifold:b2Manifold, polygon:b2PolygonShape, xf1:b2XForm, circle:b2CircleShape, xf2:b2XForm):void{ var tPoint:b2ManifoldPoint; var dX:Number; var dY:Number; var positionX:Number; var positionY:Number; var tVec:b2Vec2; var tMat:b2Mat22; var cX:Number; var cY:Number; var cLocalX:Number; var cLocalY:Number; var dist:Number; var normalIndex:int; var separation:Number; var radius:Number; var vertexCount:int; var vertices:Array; var normals:Array; var i:int; var vertIndex1:int; var vertIndex2:int; var tVec2:b2Vec2; var eX:Number; var eY:Number; var length:Number; var u:Number; var pX:Number; var pY:Number; var s:Number; manifold.pointCount = 0; tMat = xf2.R; tVec = circle.m_localPosition; cX = (xf2.position.x + ((tMat.col1.x * tVec.x) + (tMat.col2.x * tVec.y))); cY = (xf2.position.y + ((tMat.col1.y * tVec.x) + (tMat.col2.y * tVec.y))); dX = (cX - xf1.position.x); dY = (cY - xf1.position.y); tMat = xf1.R; cLocalX = ((dX * tMat.col1.x) + (dY * tMat.col1.y)); cLocalY = ((dX * tMat.col2.x) + (dY * tMat.col2.y)); normalIndex = 0; separation = -(Number.MAX_VALUE); radius = circle.m_radius; vertexCount = polygon.m_vertexCount; vertices = polygon.m_vertices; normals = polygon.m_normals; i = 0; while (i < vertexCount) { tVec = vertices[i]; dX = (cLocalX - tVec.x); dY = (cLocalY - tVec.y); tVec = normals[i]; s = ((tVec.x * dX) + (tVec.y * dY)); if (s > radius){ return; }; if (s > separation){ separation = s; normalIndex = i; }; i++; }; if (separation < Number.MIN_VALUE){ manifold.pointCount = 1; tVec = normals[normalIndex]; tMat = xf1.R; manifold.normal.x = ((tMat.col1.x * tVec.x) + (tMat.col2.x * tVec.y)); manifold.normal.y = ((tMat.col1.y * tVec.x) + (tMat.col2.y * tVec.y)); tPoint = manifold.points[0]; tPoint.id.features.incidentEdge = normalIndex; tPoint.id.features.incidentVertex = b2_nullFeature; tPoint.id.features.referenceEdge = 0; tPoint.id.features.flip = 0; positionX = (cX - (radius * manifold.normal.x)); positionY = (cY - (radius * manifold.normal.y)); dX = (positionX - xf1.position.x); dY = (positionY - xf1.position.y); tMat = xf1.R; tPoint.localPoint1.x = ((dX * tMat.col1.x) + (dY * tMat.col1.y)); tPoint.localPoint1.y = ((dX * tMat.col2.x) + (dY * tMat.col2.y)); dX = (positionX - xf2.position.x); dY = (positionY - xf2.position.y); tMat = xf2.R; tPoint.localPoint2.x = ((dX * tMat.col1.x) + (dY * tMat.col1.y)); tPoint.localPoint2.y = ((dX * tMat.col2.x) + (dY * tMat.col2.y)); tPoint.separation = (separation - radius); return; }; vertIndex1 = normalIndex; vertIndex2 = (((vertIndex1 + 1) < vertexCount)) ? (vertIndex1 + 1) : 0; tVec = vertices[vertIndex1]; tVec2 = vertices[vertIndex2]; eX = (tVec2.x - tVec.x); eY = (tVec2.y - tVec.y); length = Math.sqrt(((eX * eX) + (eY * eY))); eX = (eX / length); eY = (eY / length); dX = (cLocalX - tVec.x); dY = (cLocalY - tVec.y); u = ((dX * eX) + (dY * eY)); tPoint = manifold.points[0]; if (u <= 0){ pX = tVec.x; pY = tVec.y; tPoint.id.features.incidentEdge = b2_nullFeature; tPoint.id.features.incidentVertex = vertIndex1; } else { if (u >= length){ pX = tVec2.x; pY = tVec2.y; tPoint.id.features.incidentEdge = b2_nullFeature; tPoint.id.features.incidentVertex = vertIndex2; } else { pX = ((eX * u) + tVec.x); pY = ((eY * u) + tVec.y); tPoint.id.features.incidentEdge = normalIndex; tPoint.id.features.incidentVertex = b2_nullFeature; }; }; dX = (cLocalX - pX); dY = (cLocalY - pY); dist = Math.sqrt(((dX * dX) + (dY * dY))); dX = (dX / dist); dY = (dY / dist); if (dist > radius){ return; }; manifold.pointCount = 1; tMat = xf1.R; manifold.normal.x = ((tMat.col1.x * dX) + (tMat.col2.x * dY)); manifold.normal.y = ((tMat.col1.y * dX) + (tMat.col2.y * dY)); positionX = (cX - (radius * manifold.normal.x)); positionY = (cY - (radius * manifold.normal.y)); dX = (positionX - xf1.position.x); dY = (positionY - xf1.position.y); tMat = xf1.R; tPoint.localPoint1.x = ((dX * tMat.col1.x) + (dY * tMat.col1.y)); tPoint.localPoint1.y = ((dX * tMat.col2.x) + (dY * tMat.col2.y)); dX = (positionX - xf2.position.x); dY = (positionY - xf2.position.y); tMat = xf2.R; tPoint.localPoint2.x = ((dX * tMat.col1.x) + (dY * tMat.col1.y)); tPoint.localPoint2.y = ((dX * tMat.col2.x) + (dY * tMat.col2.y)); tPoint.separation = (dist - radius); tPoint.id.features.referenceEdge = 0; tPoint.id.features.flip = 0; } } }//package Box2D.Collision
Section 16
//b2ContactID (Box2D.Collision.b2ContactID) package Box2D.Collision { public class b2ContactID { public var _key:uint; public var features:Features; public function b2ContactID(){ features = new Features(); super(); features._m_id = this; } public function Set(id:b2ContactID):void{ key = id._key; } public function Copy():b2ContactID{ var id:b2ContactID; id = new b2ContactID(); id.key = key; return (id); } public function get key():uint{ return (_key); } public function set key(value:uint):void{ _key = value; features._referenceEdge = (_key & 0xFF); features._incidentEdge = (((_key & 0xFF00) >> 8) & 0xFF); features._incidentVertex = (((_key & 0xFF0000) >> 16) & 0xFF); features._flip = (((_key & 4278190080) >> 24) & 0xFF); } } }//package Box2D.Collision
Section 17
//b2ContactPoint (Box2D.Collision.b2ContactPoint) package Box2D.Collision { import Box2D.Common.Math.*; import Box2D.Collision.Shapes.*; public class b2ContactPoint { public var separation:Number; public var normal:b2Vec2; public var position:b2Vec2; public var restitution:Number; public var shape1:b2Shape; public var shape2:b2Shape; public var id:b2ContactID; public var friction:Number; public var velocity:b2Vec2; public function b2ContactPoint(){ position = new b2Vec2(); velocity = new b2Vec2(); normal = new b2Vec2(); id = new b2ContactID(); super(); } } }//package Box2D.Collision
Section 18
//b2Distance (Box2D.Collision.b2Distance) package Box2D.Collision { import Box2D.Common.Math.*; import Box2D.Collision.Shapes.*; import Box2D.Common.*; public class b2Distance { private static var s_p2s:Array = [new b2Vec2(), new b2Vec2(), new b2Vec2()]; private static var s_p1s:Array = [new b2Vec2(), new b2Vec2(), new b2Vec2()]; private static var s_points:Array = [new b2Vec2(), new b2Vec2(), new b2Vec2()]; private static var gPoint:b2Point = new b2Point(); public static var g_GJK_Iterations:int = 0; public function b2Distance(){ super(); } public static function InPoints(w:b2Vec2, points:Array, pointCount:int):Boolean{ var k_tolerance:Number; var i:int; var points_i:b2Vec2; var dX:Number; var dY:Number; var mX:Number; var mY:Number; k_tolerance = (100 * Number.MIN_VALUE); i = 0; while (i < pointCount) { points_i = points[i]; dX = Math.abs((w.x - points_i.x)); dY = Math.abs((w.y - points_i.y)); mX = Math.max(Math.abs(w.x), Math.abs(points_i.x)); mY = Math.max(Math.abs(w.y), Math.abs(points_i.y)); if ((((dX < (k_tolerance * (mX + 1)))) && ((dY < (k_tolerance * (mY + 1)))))){ return (true); }; i++; }; return (false); } public static function DistanceGeneric(x1:b2Vec2, x2:b2Vec2, shape1, xf1:b2XForm, shape2, xf2:b2XForm):Number{ var tVec:b2Vec2; var p1s:Array; var p2s:Array; var points:Array; var pointCount:int; var vSqr:Number; var maxIterations:int; var iter:int; var vX:Number; var vY:Number; var w1:b2Vec2; var w2:b2Vec2; var wX:Number; var wY:Number; var vw:Number; var maxSqr:Number; var i:int; p1s = s_p1s; p2s = s_p2s; points = s_points; pointCount = 0; x1.SetV(shape1.GetFirstVertex(xf1)); x2.SetV(shape2.GetFirstVertex(xf2)); vSqr = 0; maxIterations = 20; iter = 0; while (iter < maxIterations) { vX = (x2.x - x1.x); vY = (x2.y - x1.y); w1 = shape1.Support(xf1, vX, vY); w2 = shape2.Support(xf2, -(vX), -(vY)); vSqr = ((vX * vX) + (vY * vY)); wX = (w2.x - w1.x); wY = (w2.y - w1.y); vw = ((vX * wX) + (vY * wY)); if ((vSqr - vw) <= (0.01 * vSqr)){ if (pointCount == 0){ x1.SetV(w1); x2.SetV(w2); }; g_GJK_Iterations = iter; return (Math.sqrt(vSqr)); }; switch (pointCount){ case 0: tVec = p1s[0]; tVec.SetV(w1); tVec = p2s[0]; tVec.SetV(w2); tVec = points[0]; tVec.x = wX; tVec.y = wY; x1.SetV(p1s[0]); x2.SetV(p2s[0]); pointCount++; break; case 1: tVec = p1s[1]; tVec.SetV(w1); tVec = p2s[1]; tVec.SetV(w2); tVec = points[1]; tVec.x = wX; tVec.y = wY; pointCount = ProcessTwo(x1, x2, p1s, p2s, points); break; case 2: tVec = p1s[2]; tVec.SetV(w1); tVec = p2s[2]; tVec.SetV(w2); tVec = points[2]; tVec.x = wX; tVec.y = wY; pointCount = ProcessThree(x1, x2, p1s, p2s, points); break; }; if (pointCount == 3){ g_GJK_Iterations = iter; return (0); }; maxSqr = -(Number.MAX_VALUE); i = 0; while (i < pointCount) { tVec = points[i]; maxSqr = b2Math.b2Max(maxSqr, ((tVec.x * tVec.x) + (tVec.y * tVec.y))); i++; }; if ((((pointCount == 3)) || ((vSqr <= ((100 * Number.MIN_VALUE) * maxSqr))))){ g_GJK_Iterations = iter; vX = (x2.x - x1.x); vY = (x2.y - x1.y); vSqr = ((vX * vX) + (vY * vY)); return (Math.sqrt(vSqr)); }; iter++; }; g_GJK_Iterations = maxIterations; return (Math.sqrt(vSqr)); } public static function DistanceCC(x1:b2Vec2, x2:b2Vec2, circle1:b2CircleShape, xf1:b2XForm, circle2:b2CircleShape, xf2:b2XForm):Number{ var tMat:b2Mat22; var tVec:b2Vec2; var p1X:Number; var p1Y:Number; var p2X:Number; var p2Y:Number; var dX:Number; var dY:Number; var dSqr:Number; var r1:Number; var r2:Number; var r:Number; var dLen:Number; var distance:Number; tMat = xf1.R; tVec = circle1.m_localPosition; p1X = (xf1.position.x + ((tMat.col1.x * tVec.x) + (tMat.col2.x * tVec.y))); p1Y = (xf1.position.y + ((tMat.col1.y * tVec.x) + (tMat.col2.y * tVec.y))); tMat = xf2.R; tVec = circle2.m_localPosition; p2X = (xf2.position.x + ((tMat.col1.x * tVec.x) + (tMat.col2.x * tVec.y))); p2Y = (xf2.position.y + ((tMat.col1.y * tVec.x) + (tMat.col2.y * tVec.y))); dX = (p2X - p1X); dY = (p2Y - p1Y); dSqr = ((dX * dX) + (dY * dY)); r1 = (circle1.m_radius - b2Settings.b2_toiSlop); r2 = (circle2.m_radius - b2Settings.b2_toiSlop); r = (r1 + r2); if (dSqr > (r * r)){ dLen = Math.sqrt(dSqr); dX = (dX / dLen); dY = (dY / dLen); distance = (dLen - r); x1.x = (p1X + (r1 * dX)); x1.y = (p1Y + (r1 * dY)); x2.x = (p2X - (r2 * dX)); x2.y = (p2Y - (r2 * dY)); return (distance); }; if (dSqr > (Number.MIN_VALUE * Number.MIN_VALUE)){ dLen = Math.sqrt(dSqr); dX = (dX / dLen); dY = (dY / dLen); x1.x = (p1X + (r1 * dX)); x1.y = (p1Y + (r1 * dY)); x2.x = x1.x; x2.y = x1.y; return (0); }; x1.x = p1X; x1.y = p1Y; x2.x = x1.x; x2.y = x1.y; return (0); } public static function ProcessThree(x1:b2Vec2, x2:b2Vec2, p1s:Array, p2s:Array, points:Array):int{ var points_0:b2Vec2; var points_1:b2Vec2; var points_2:b2Vec2; var p1s_0:b2Vec2; var p1s_1:b2Vec2; var p1s_2:b2Vec2; var p2s_0:b2Vec2; var p2s_1:b2Vec2; var p2s_2:b2Vec2; var aX:Number; var aY:Number; var bX:Number; var bY:Number; var cX:Number; var cY:Number; var abX:Number; var abY:Number; var acX:Number; var acY:Number; var bcX:Number; var bcY:Number; var sn:Number; var sd:Number; var tn:Number; var td:Number; var un:Number; var ud:Number; var n:Number; var vc:Number; var lambda:Number; var va:Number; var vb:Number; var denom:Number; var u:Number; var v:Number; var w:Number; points_0 = points[0]; points_1 = points[1]; points_2 = points[2]; p1s_0 = p1s[0]; p1s_1 = p1s[1]; p1s_2 = p1s[2]; p2s_0 = p2s[0]; p2s_1 = p2s[1]; p2s_2 = p2s[2]; aX = points_0.x; aY = points_0.y; bX = points_1.x; bY = points_1.y; cX = points_2.x; cY = points_2.y; abX = (bX - aX); abY = (bY - aY); acX = (cX - aX); acY = (cY - aY); bcX = (cX - bX); bcY = (cY - bY); sn = -(((aX * abX) + (aY * abY))); sd = ((bX * abX) + (bY * abY)); tn = -(((aX * acX) + (aY * acY))); td = ((cX * acX) + (cY * acY)); un = -(((bX * bcX) + (bY * bcY))); ud = ((cX * bcX) + (cY * bcY)); if ((((td <= 0)) && ((ud <= 0)))){ x1.SetV(p1s_2); x2.SetV(p2s_2); p1s_0.SetV(p1s_2); p2s_0.SetV(p2s_2); points_0.SetV(points_2); return (1); }; n = ((abX * acY) - (abY * acX)); vc = (n * ((aX * bY) - (aY * bX))); va = (n * ((bX * cY) - (bY * cX))); if ((((((((va <= 0)) && ((un >= 0)))) && ((ud >= 0)))) && (((un + ud) > 0)))){ lambda = (un / (un + ud)); x1.x = (p1s_1.x + (lambda * (p1s_2.x - p1s_1.x))); x1.y = (p1s_1.y + (lambda * (p1s_2.y - p1s_1.y))); x2.x = (p2s_1.x + (lambda * (p2s_2.x - p2s_1.x))); x2.y = (p2s_1.y + (lambda * (p2s_2.y - p2s_1.y))); p1s_0.SetV(p1s_2); p2s_0.SetV(p2s_2); points_0.SetV(points_2); return (2); }; vb = (n * ((cX * aY) - (cY * aX))); if ((((((((vb <= 0)) && ((tn >= 0)))) && ((td >= 0)))) && (((tn + td) > 0)))){ lambda = (tn / (tn + td)); x1.x = (p1s_0.x + (lambda * (p1s_2.x - p1s_0.x))); x1.y = (p1s_0.y + (lambda * (p1s_2.y - p1s_0.y))); x2.x = (p2s_0.x + (lambda * (p2s_2.x - p2s_0.x))); x2.y = (p2s_0.y + (lambda * (p2s_2.y - p2s_0.y))); p1s_1.SetV(p1s_2); p2s_1.SetV(p2s_2); points_1.SetV(points_2); return (2); }; denom = ((va + vb) + vc); denom = (1 / denom); u = (va * denom); v = (vb * denom); w = ((1 - u) - v); x1.x = (((u * p1s_0.x) + (v * p1s_1.x)) + (w * p1s_2.x)); x1.y = (((u * p1s_0.y) + (v * p1s_1.y)) + (w * p1s_2.y)); x2.x = (((u * p2s_0.x) + (v * p2s_1.x)) + (w * p2s_2.x)); x2.y = (((u * p2s_0.y) + (v * p2s_1.y)) + (w * p2s_2.y)); return (3); } public static function DistancePC(x1:b2Vec2, x2:b2Vec2, polygon:b2PolygonShape, xf1:b2XForm, circle:b2CircleShape, xf2:b2XForm):Number{ var tMat:b2Mat22; var tVec:b2Vec2; var point:b2Point; var distance:Number; var r:Number; var dX:Number; var dY:Number; var dLen:Number; point = gPoint; tVec = circle.m_localPosition; tMat = xf2.R; point.p.x = (xf2.position.x + ((tMat.col1.x * tVec.x) + (tMat.col2.x * tVec.y))); point.p.y = (xf2.position.y + ((tMat.col1.y * tVec.x) + (tMat.col2.y * tVec.y))); distance = DistanceGeneric(x1, x2, polygon, xf1, point, b2Math.b2XForm_identity); r = (circle.m_radius - b2Settings.b2_toiSlop); if (distance > r){ distance = (distance - r); dX = (x2.x - x1.x); dY = (x2.y - x1.y); dLen = Math.sqrt(((dX * dX) + (dY * dY))); dX = (dX / dLen); dY = (dY / dLen); x2.x = (x2.x - (r * dX)); x2.y = (x2.y - (r * dY)); } else { distance = 0; x2.x = x1.x; x2.y = x1.y; }; return (distance); } public static function Distance(x1:b2Vec2, x2:b2Vec2, shape1:b2Shape, xf1:b2XForm, shape2:b2Shape, xf2:b2XForm):Number{ var type1:int; var type2:int; type1 = shape1.m_type; type2 = shape2.m_type; if ((((type1 == b2Shape.e_circleShape)) && ((type2 == b2Shape.e_circleShape)))){ return (DistanceCC(x1, x2, (shape1 as b2CircleShape), xf1, (shape2 as b2CircleShape), xf2)); }; if ((((type1 == b2Shape.e_polygonShape)) && ((type2 == b2Shape.e_circleShape)))){ return (DistancePC(x1, x2, (shape1 as b2PolygonShape), xf1, (shape2 as b2CircleShape), xf2)); }; if ((((type1 == b2Shape.e_circleShape)) && ((type2 == b2Shape.e_polygonShape)))){ return (DistancePC(x2, x1, (shape2 as b2PolygonShape), xf2, (shape1 as b2CircleShape), xf1)); }; if ((((type1 == b2Shape.e_polygonShape)) && ((type2 == b2Shape.e_polygonShape)))){ return (DistanceGeneric(x1, x2, (shape1 as b2PolygonShape), xf1, (shape2 as b2PolygonShape), xf2)); }; return (0); } public static function ProcessTwo(x1:b2Vec2, x2:b2Vec2, p1s:Array, p2s:Array, points:Array):int{ var points_0:b2Vec2; var points_1:b2Vec2; var p1s_0:b2Vec2; var p1s_1:b2Vec2; var p2s_0:b2Vec2; var p2s_1:b2Vec2; var rX:Number; var rY:Number; var dX:Number; var dY:Number; var length:Number; var lambda:Number; points_0 = points[0]; points_1 = points[1]; p1s_0 = p1s[0]; p1s_1 = p1s[1]; p2s_0 = p2s[0]; p2s_1 = p2s[1]; rX = -(points_1.x); rY = -(points_1.y); dX = (points_0.x - points_1.x); dY = (points_0.y - points_1.y); length = Math.sqrt(((dX * dX) + (dY * dY))); dX = (dX / length); dY = (dY / length); lambda = ((rX * dX) + (rY * dY)); if ((((lambda <= 0)) || ((length < Number.MIN_VALUE)))){ x1.SetV(p1s_1); x2.SetV(p2s_1); p1s_0.SetV(p1s_1); p2s_0.SetV(p2s_1); points_0.SetV(points_1); return (1); }; lambda = (lambda / length); x1.x = (p1s_1.x + (lambda * (p1s_0.x - p1s_1.x))); x1.y = (p1s_1.y + (lambda * (p1s_0.y - p1s_1.y))); x2.x = (p2s_1.x + (lambda * (p2s_0.x - p2s_1.x))); x2.y = (p2s_1.y + (lambda * (p2s_0.y - p2s_1.y))); return (2); } } }//package Box2D.Collision
Section 19
//b2Manifold (Box2D.Collision.b2Manifold) package Box2D.Collision { import Box2D.Common.Math.*; import Box2D.Common.*; public class b2Manifold { public var points:Array; public var pointCount:int;// = 0 public var normal:b2Vec2; public function b2Manifold(){ var i:int; pointCount = 0; super(); points = new Array(b2Settings.b2_maxManifoldPoints); i = 0; while (i < b2Settings.b2_maxManifoldPoints) { points[i] = new b2ManifoldPoint(); i++; }; normal = new b2Vec2(); } public function Set(m:b2Manifold):void{ var i:int; pointCount = m.pointCount; i = 0; while (i < b2Settings.b2_maxManifoldPoints) { (points[i] as b2ManifoldPoint).Set(m.points[i]); i++; }; normal.SetV(m.normal); } public function Reset():void{ var i:int; i = 0; while (i < b2Settings.b2_maxManifoldPoints) { (points[i] as b2ManifoldPoint).Reset(); i++; }; normal.SetZero(); pointCount = 0; } } }//package Box2D.Collision
Section 20
//b2ManifoldPoint (Box2D.Collision.b2ManifoldPoint) package Box2D.Collision { import Box2D.Common.Math.*; public class b2ManifoldPoint { public var separation:Number; public var localPoint2:b2Vec2; public var normalImpulse:Number; public var tangentImpulse:Number; public var localPoint1:b2Vec2; public var id:b2ContactID; public function b2ManifoldPoint(){ localPoint1 = new b2Vec2(); localPoint2 = new b2Vec2(); id = new b2ContactID(); super(); } public function Set(m:b2ManifoldPoint):void{ localPoint1.SetV(m.localPoint1); localPoint2.SetV(m.localPoint2); separation = m.separation; normalImpulse = m.normalImpulse; tangentImpulse = m.tangentImpulse; id.key = m.id.key; } public function Reset():void{ localPoint1.SetZero(); localPoint2.SetZero(); separation = 0; normalImpulse = 0; tangentImpulse = 0; id.key = 0; } } }//package Box2D.Collision
Section 21
//b2OBB (Box2D.Collision.b2OBB) package Box2D.Collision { import Box2D.Common.Math.*; public class b2OBB { public var R:b2Mat22; public var center:b2Vec2; public var extents:b2Vec2; public function b2OBB(){ R = new b2Mat22(); center = new b2Vec2(); extents = new b2Vec2(); super(); } } }//package Box2D.Collision
Section 22
//b2Pair (Box2D.Collision.b2Pair) package Box2D.Collision { import Box2D.Common.*; public class b2Pair { public var userData;// = null public var proxyId1:uint; public var proxyId2:uint; public var status:uint; public var next:uint; public static var e_pairFinal:uint = 4; public static var b2_tableMask:int = (b2_tableCapacity - 1); public static var e_pairRemoved:uint = 2; public static var b2_nullPair:uint = b2Settings.USHRT_MAX; public static var e_pairBuffered:uint = 1; public static var b2_nullProxy:uint = b2Settings.USHRT_MAX; public static var b2_tableCapacity:int = b2Settings.b2_maxPairs; public function b2Pair(){ userData = null; super(); } public function SetBuffered():void{ status = (status | e_pairBuffered); } public function IsBuffered():Boolean{ return (((status & e_pairBuffered) == e_pairBuffered)); } public function IsFinal():Boolean{ return (((status & e_pairFinal) == e_pairFinal)); } public function ClearRemoved():void{ status = (status & ~(e_pairRemoved)); } public function SetFinal():void{ status = (status | e_pairFinal); } public function IsRemoved():Boolean{ return (((status & e_pairRemoved) == e_pairRemoved)); } public function ClearBuffered():void{ status = (status & ~(e_pairBuffered)); } public function SetRemoved():void{ status = (status | e_pairRemoved); } } }//package Box2D.Collision
Section 23
//b2PairCallback (Box2D.Collision.b2PairCallback) package Box2D.Collision { public class b2PairCallback { public function b2PairCallback(){ super(); } public function PairRemoved(proxyUserData1, proxyUserData2, pairUserData):void{ } public function PairAdded(proxyUserData1, proxyUserData2){ return (null); } } }//package Box2D.Collision
Section 24
//b2PairManager (Box2D.Collision.b2PairManager) package Box2D.Collision { import Box2D.Common.Math.*; import Box2D.Common.*; public class b2PairManager { public var m_pairCount:int; public var m_pairBuffer:Array; public var m_callback:b2PairCallback; public var m_pairs:Array; public var m_pairBufferCount:int; public var m_hashTable:Array; public var m_broadPhase:b2BroadPhase; public var m_freePair:uint; public function b2PairManager(){ var i:uint; super(); m_hashTable = new Array(b2Pair.b2_tableCapacity); i = 0; while (i < b2Pair.b2_tableCapacity) { m_hashTable[i] = b2Pair.b2_nullPair; i++; }; m_pairs = new Array(b2Settings.b2_maxPairs); i = 0; while (i < b2Settings.b2_maxPairs) { m_pairs[i] = new b2Pair(); i++; }; m_pairBuffer = new Array(b2Settings.b2_maxPairs); i = 0; while (i < b2Settings.b2_maxPairs) { m_pairBuffer[i] = new b2BufferedPair(); i++; }; i = 0; while (i < b2Settings.b2_maxPairs) { m_pairs[i].proxyId1 = b2Pair.b2_nullProxy; m_pairs[i].proxyId2 = b2Pair.b2_nullProxy; m_pairs[i].userData = null; m_pairs[i].status = 0; m_pairs[i].next = (i + 1); i++; }; m_pairs[int((b2Settings.b2_maxPairs - 1))].next = b2Pair.b2_nullPair; m_pairCount = 0; m_pairBufferCount = 0; } private function FindHash(proxyId1:uint, proxyId2:uint, hash:uint):b2Pair{ var pair:b2Pair; var index:uint; index = m_hashTable[hash]; pair = m_pairs[index]; while (((!((index == b2Pair.b2_nullPair))) && ((Equals(pair, proxyId1, proxyId2) == false)))) { index = pair.next; pair = m_pairs[index]; }; if (index == b2Pair.b2_nullPair){ return (null); }; return (pair); } private function Find(proxyId1:uint, proxyId2:uint):b2Pair{ var hash:uint; var temp:uint; if (proxyId1 > proxyId2){ temp = proxyId1; proxyId1 = proxyId2; proxyId2 = temp; }; hash = (Hash(proxyId1, proxyId2) & b2Pair.b2_tableMask); return (FindHash(proxyId1, proxyId2, hash)); } private function ValidateBuffer():void{ } public function Commit():void{ var bufferedPair:b2BufferedPair; var i:int; var removeCount:int; var proxies:Array; var pair:b2Pair; var proxy1:b2Proxy; var proxy2:b2Proxy; removeCount = 0; proxies = m_broadPhase.m_proxyPool; i = 0; while (i < m_pairBufferCount) { bufferedPair = m_pairBuffer[i]; pair = Find(bufferedPair.proxyId1, bufferedPair.proxyId2); pair.ClearBuffered(); proxy1 = proxies[pair.proxyId1]; proxy2 = proxies[pair.proxyId2]; if (pair.IsRemoved()){ if (pair.IsFinal() == true){ m_callback.PairRemoved(proxy1.userData, proxy2.userData, pair.userData); }; bufferedPair = m_pairBuffer[removeCount]; bufferedPair.proxyId1 = pair.proxyId1; bufferedPair.proxyId2 = pair.proxyId2; removeCount++; } else { if (pair.IsFinal() == false){ pair.userData = m_callback.PairAdded(proxy1.userData, proxy2.userData); pair.SetFinal(); }; }; i++; }; i = 0; while (i < removeCount) { bufferedPair = m_pairBuffer[i]; RemovePair(bufferedPair.proxyId1, bufferedPair.proxyId2); i++; }; m_pairBufferCount = 0; if (b2BroadPhase.s_validate){ ValidateTable(); }; } public function RemoveBufferedPair(proxyId1:int, proxyId2:int):void{ var bufferedPair:b2BufferedPair; var pair:b2Pair; pair = Find(proxyId1, proxyId2); if (pair == null){ return; }; if (pair.IsBuffered() == false){ pair.SetBuffered(); bufferedPair = m_pairBuffer[m_pairBufferCount]; bufferedPair.proxyId1 = pair.proxyId1; bufferedPair.proxyId2 = pair.proxyId2; m_pairBufferCount++; }; pair.SetRemoved(); if (b2BroadPhase.s_validate){ ValidateBuffer(); }; } private function RemovePair(proxyId1:uint, proxyId2:uint){ var pair:b2Pair; var hash:uint; var node:uint; var pNode:b2Pair; var temp:uint; var index:uint; var userData:*; if (proxyId1 > proxyId2){ temp = proxyId1; proxyId1 = proxyId2; proxyId2 = temp; }; hash = (Hash(proxyId1, proxyId2) & b2Pair.b2_tableMask); node = m_hashTable[hash]; pNode = null; while (node != b2Pair.b2_nullPair) { if (Equals(m_pairs[node], proxyId1, proxyId2)){ index = node; pair = m_pairs[node]; if (pNode){ pNode.next = pair.next; } else { m_hashTable[hash] = pair.next; }; pair = m_pairs[index]; userData = pair.userData; pair.next = m_freePair; pair.proxyId1 = b2Pair.b2_nullProxy; pair.proxyId2 = b2Pair.b2_nullProxy; pair.userData = null; pair.status = 0; m_freePair = index; m_pairCount--; return (userData); } else { pNode = m_pairs[node]; node = pNode.next; }; }; return (null); } public function Initialize(broadPhase:b2BroadPhase, callback:b2PairCallback):void{ m_broadPhase = broadPhase; m_callback = callback; } public function AddBufferedPair(proxyId1:int, proxyId2:int):void{ var bufferedPair:b2BufferedPair; var pair:b2Pair; pair = AddPair(proxyId1, proxyId2); if (pair.IsBuffered() == false){ pair.SetBuffered(); bufferedPair = m_pairBuffer[m_pairBufferCount]; bufferedPair.proxyId1 = pair.proxyId1; bufferedPair.proxyId2 = pair.proxyId2; m_pairBufferCount++; }; pair.ClearRemoved(); if (b2BroadPhase.s_validate){ ValidateBuffer(); }; } private function AddPair(proxyId1:uint, proxyId2:uint):b2Pair{ var hash:uint; var pair:b2Pair; var pIndex:uint; var temp:uint; if (proxyId1 > proxyId2){ temp = proxyId1; proxyId1 = proxyId2; proxyId2 = temp; }; hash = (Hash(proxyId1, proxyId2) & b2Pair.b2_tableMask); pair = FindHash(proxyId1, proxyId2, hash); if (pair != null){ return (pair); }; pIndex = m_freePair; pair = m_pairs[pIndex]; m_freePair = pair.next; pair.proxyId1 = proxyId1; pair.proxyId2 = proxyId2; pair.status = 0; pair.userData = null; pair.next = m_hashTable[hash]; m_hashTable[hash] = pIndex; m_pairCount++; return (pair); } private function ValidateTable():void{ } public static function EqualsPair(pair1:b2BufferedPair, pair2:b2BufferedPair):Boolean{ return ((((pair1.proxyId1 == pair2.proxyId1)) && ((pair1.proxyId2 == pair2.proxyId2)))); } public static function Hash(proxyId1:uint, proxyId2:uint):uint{ var key:uint; key = (((proxyId2 << 16) & 4294901760) | proxyId1); key = (~(key) + ((key << 15) & 4294934528)); key = (key ^ ((key >> 12) & 1048575)); key = (key + ((key << 2) & 4294967292)); key = (key ^ ((key >> 4) & 268435455)); key = (key * 2057); key = (key ^ ((key >> 16) & 0xFFFF)); return (key); } public static function Equals(pair:b2Pair, proxyId1:uint, proxyId2:uint):Boolean{ return ((((pair.proxyId1 == proxyId1)) && ((pair.proxyId2 == proxyId2)))); } } }//package Box2D.Collision
Section 25
//b2Point (Box2D.Collision.b2Point) package Box2D.Collision { import Box2D.Common.Math.*; public class b2Point { public var p:b2Vec2; public function b2Point(){ p = new b2Vec2(); super(); } public function GetFirstVertex(xf:b2XForm):b2Vec2{ return (p); } public function Support(xf:b2XForm, vX:Number, vY:Number):b2Vec2{ return (p); } } }//package Box2D.Collision
Section 26
//b2Proxy (Box2D.Collision.b2Proxy) package Box2D.Collision { public class b2Proxy { public var overlapCount:uint; public var lowerBounds:Array; public var upperBounds:Array; public var userData;// = null public var timeStamp:uint; public function b2Proxy(){ lowerBounds = [uint(0), uint(0)]; upperBounds = [uint(0), uint(0)]; userData = null; super(); } public function GetNext():uint{ return (lowerBounds[0]); } public function IsValid():Boolean{ return (!((overlapCount == b2BroadPhase.b2_invalid))); } public function SetNext(next:uint):void{ lowerBounds[0] = (next & 0xFFFF); } } }//package Box2D.Collision
Section 27
//b2Segment (Box2D.Collision.b2Segment) package Box2D.Collision { import Box2D.Common.Math.*; public class b2Segment { public var p1:b2Vec2; public var p2:b2Vec2; public function b2Segment(){ p1 = new b2Vec2(); p2 = new b2Vec2(); super(); } public function TestSegment(lambda:Array, normal:b2Vec2, segment:b2Segment, maxLambda:Number):Boolean{ var s:b2Vec2; var rX:Number; var rY:Number; var dX:Number; var dY:Number; var nX:Number; var nY:Number; var k_slop:Number; var denom:Number; var bX:Number; var bY:Number; var a:Number; var mu2:Number; var nLen:Number; s = segment.p1; rX = (segment.p2.x - s.x); rY = (segment.p2.y - s.y); dX = (p2.x - p1.x); dY = (p2.y - p1.y); nX = dY; nY = -(dX); k_slop = (100 * Number.MIN_VALUE); denom = -(((rX * nX) + (rY * nY))); if (denom > k_slop){ bX = (s.x - p1.x); bY = (s.y - p1.y); a = ((bX * nX) + (bY * nY)); if ((((0 <= a)) && ((a <= (maxLambda * denom))))){ mu2 = ((-(rX) * bY) + (rY * bX)); if (((((-(k_slop) * denom) <= mu2)) && ((mu2 <= (denom * (1 + k_slop)))))){ a = (a / denom); nLen = Math.sqrt(((nX * nX) + (nY * nY))); nX = (nX / nLen); nY = (nY / nLen); lambda[0] = a; normal.Set(nX, nY); return (true); }; }; }; return (false); } } }//package Box2D.Collision
Section 28
//b2TimeOfImpact (Box2D.Collision.b2TimeOfImpact) package Box2D.Collision { import Box2D.Common.Math.*; import Box2D.Collision.Shapes.*; import Box2D.Common.*; public class b2TimeOfImpact { public static var s_xf1:b2XForm = new b2XForm(); public static var s_xf2:b2XForm = new b2XForm(); public static var s_p1:b2Vec2 = new b2Vec2(); public static var s_p2:b2Vec2 = new b2Vec2(); public function b2TimeOfImpact(){ super(); } public static function TimeOfImpact(shape1:b2Shape, sweep1:b2Sweep, shape2:b2Shape, sweep2:b2Sweep):Number{ var math1:Number; var math2:Number; var r1:Number; var r2:Number; var t0:Number; var v1X:Number; var v1Y:Number; var v2X:Number; var v2Y:Number; var omega1:Number; var omega2:Number; var alpha:Number; var p1:b2Vec2; var p2:b2Vec2; var k_maxIterations:int; var iter:int; var normalX:Number; var normalY:Number; var distance:Number; var targetDistance:Number; var t:Number; var xf1:b2XForm; var xf2:b2XForm; var nLen:Number; var approachVelocityBound:Number; var dAlpha:Number; var newAlpha:Number; r1 = shape1.m_sweepRadius; r2 = shape2.m_sweepRadius; t0 = sweep1.t0; v1X = (sweep1.c.x - sweep1.c0.x); v1Y = (sweep1.c.y - sweep1.c0.y); v2X = (sweep2.c.x - sweep2.c0.x); v2Y = (sweep2.c.y - sweep2.c0.y); omega1 = (sweep1.a - sweep1.a0); omega2 = (sweep2.a - sweep2.a0); alpha = 0; p1 = s_p1; p2 = s_p2; k_maxIterations = 20; iter = 0; normalX = 0; normalY = 0; distance = 0; targetDistance = 0; while (true) { t = (((1 - alpha) * t0) + alpha); xf1 = s_xf1; xf2 = s_xf2; sweep1.GetXForm(xf1, t); sweep2.GetXForm(xf2, t); distance = b2Distance.Distance(p1, p2, shape1, xf1, shape2, xf2); if (iter == 0){ if (distance > (2 * b2Settings.b2_toiSlop)){ targetDistance = (1.5 * b2Settings.b2_toiSlop); } else { math1 = (0.05 * b2Settings.b2_toiSlop); math2 = (distance - (0.5 * b2Settings.b2_toiSlop)); targetDistance = ((math1 > math2)) ? math1 : math2; }; }; if (((((distance - targetDistance) < (0.05 * b2Settings.b2_toiSlop))) || ((iter == k_maxIterations)))){ break; }; normalX = (p2.x - p1.x); normalY = (p2.y - p1.y); nLen = Math.sqrt(((normalX * normalX) + (normalY * normalY))); normalX = (normalX / nLen); normalY = (normalY / nLen); approachVelocityBound = ((((normalX * (v1X - v2X)) + (normalY * (v1Y - v2Y))) + (((omega1 < 0)) ? -(omega1) : omega1 * r1)) + (((omega2 < 0)) ? -(omega2) : omega2 * r2)); if (approachVelocityBound == 0){ alpha = 1; break; }; dAlpha = ((distance - targetDistance) / approachVelocityBound); newAlpha = (alpha + dAlpha); if ((((newAlpha < 0)) || ((1 < newAlpha)))){ alpha = 1; break; }; if (newAlpha < ((1 + (100 * Number.MIN_VALUE)) * alpha)){ break; }; alpha = newAlpha; iter++; }; return (alpha); } } }//package Box2D.Collision
Section 29
//ClipVertex (Box2D.Collision.ClipVertex) package Box2D.Collision { import Box2D.Common.Math.*; public class ClipVertex { public var v:b2Vec2; public var id:b2ContactID; public function ClipVertex(){ v = new b2Vec2(); id = new b2ContactID(); super(); } } }//package Box2D.Collision
Section 30
//Features (Box2D.Collision.Features) package Box2D.Collision { public class Features { public var _referenceEdge:int; public var _incidentEdge:int; public var _flip:int; public var _incidentVertex:int; public var _m_id:b2ContactID; public function Features(){ super(); } public function get referenceEdge():int{ return (_referenceEdge); } public function set incidentVertex(value:int):void{ _incidentVertex = value; _m_id._key = ((_m_id._key & 4278255615) | ((_incidentVertex << 16) & 0xFF0000)); } public function get flip():int{ return (_flip); } public function get incidentEdge():int{ return (_incidentEdge); } public function set referenceEdge(value:int):void{ _referenceEdge = value; _m_id._key = ((_m_id._key & 4294967040) | (_referenceEdge & 0xFF)); } public function set flip(value:int):void{ _flip = value; _m_id._key = ((_m_id._key & 0xFFFFFF) | ((_flip << 24) & 4278190080)); } public function get incidentVertex():int{ return (_incidentVertex); } public function set incidentEdge(value:int):void{ _incidentEdge = value; _m_id._key = ((_m_id._key & 4294902015) | ((_incidentEdge << 8) & 0xFF00)); } } }//package Box2D.Collision
Section 31
//b2Mat22 (Box2D.Common.Math.b2Mat22) package Box2D.Common.Math { public class b2Mat22 { public var col1:b2Vec2; public var col2:b2Vec2; public function b2Mat22(angle:Number=0, c1:b2Vec2=null, c2:b2Vec2=null){ var c:Number; var s:Number; col1 = new b2Vec2(); col2 = new b2Vec2(); super(); if (((!((c1 == null))) && (!((c2 == null))))){ col1.SetV(c1); col2.SetV(c2); } else { c = Math.cos(angle); s = Math.sin(angle); col1.x = c; col2.x = -(s); col1.y = s; col2.y = c; }; } public function SetIdentity():void{ col1.x = 1; col2.x = 0; col1.y = 0; col2.y = 1; } public function Set(angle:Number):void{ var c:Number; var s:Number; c = Math.cos(angle); s = Math.sin(angle); col1.x = c; col2.x = -(s); col1.y = s; col2.y = c; } public function SetVV(c1:b2Vec2, c2:b2Vec2):void{ col1.SetV(c1); col2.SetV(c2); } public function SetZero():void{ col1.x = 0; col2.x = 0; col1.y = 0; col2.y = 0; } public function SetM(m:b2Mat22):void{ col1.SetV(m.col1); col2.SetV(m.col2); } public function AddM(m:b2Mat22):void{ col1.x = (col1.x + m.col1.x); col1.y = (col1.y + m.col1.y); col2.x = (col2.x + m.col2.x); col2.y = (col2.y + m.col2.y); } public function Abs():void{ col1.Abs(); col2.Abs(); } public function Copy():b2Mat22{ return (new b2Mat22(0, col1, col2)); } public function Invert(out:b2Mat22):b2Mat22{ var a:Number; var b:Number; var c:Number; var d:Number; var det:Number; a = col1.x; b = col2.x; c = col1.y; d = col2.y; det = ((a * d) - (b * c)); det = (1 / det); out.col1.x = (det * d); out.col2.x = (-(det) * b); out.col1.y = (-(det) * c); out.col2.y = (det * a); return (out); } public function GetAngle():Number{ return (Math.atan2(col1.y, col1.x)); } public function Solve(out:b2Vec2, bX:Number, bY:Number):b2Vec2{ var a11:Number; var a12:Number; var a21:Number; var a22:Number; var det:Number; a11 = col1.x; a12 = col2.x; a21 = col1.y; a22 = col2.y; det = ((a11 * a22) - (a12 * a21)); det = (1 / det); out.x = (det * ((a22 * bX) - (a12 * bY))); out.y = (det * ((a11 * bY) - (a21 * bX))); return (out); } } }//package Box2D.Common.Math
Section 32
//b2Math (Box2D.Common.Math.b2Math) package Box2D.Common.Math { public class b2Math { public static const b2Mat22_identity:b2Mat22 = new b2Mat22(0, new b2Vec2(1, 0), new b2Vec2(0, 1)); public static const b2XForm_identity:b2XForm = new b2XForm(b2Vec2_zero, b2Mat22_identity); public static const b2Vec2_zero:b2Vec2 = new b2Vec2(0, 0); public function b2Math(){ super(); } public static function b2CrossVF(a:b2Vec2, s:Number):b2Vec2{ var v:b2Vec2; v = new b2Vec2((s * a.y), (-(s) * a.x)); return (v); } public static function AddVV(a:b2Vec2, b:b2Vec2):b2Vec2{ var v:b2Vec2; v = new b2Vec2((a.x + b.x), (a.y + b.y)); return (v); } public static function b2IsValid(x:Number):Boolean{ return (isFinite(x)); } public static function b2MinV(a:b2Vec2, b:b2Vec2):b2Vec2{ var c:b2Vec2; c = new b2Vec2(b2Min(a.x, b.x), b2Min(a.y, b.y)); return (c); } public static function b2MulX(T:b2XForm, v:b2Vec2):b2Vec2{ var a:b2Vec2; a = b2MulMV(T.R, v); a.x = (a.x + T.position.x); a.y = (a.y + T.position.y); return (a); } public static function b2DistanceSquared(a:b2Vec2, b:b2Vec2):Number{ var cX:Number; var cY:Number; cX = (a.x - b.x); cY = (a.y - b.y); return (((cX * cX) + (cY * cY))); } public static function b2Swap(a:Array, b:Array):void{ var tmp:*; tmp = a[0]; a[0] = b[0]; b[0] = tmp; } public static function b2AbsM(A:b2Mat22):b2Mat22{ var B:b2Mat22; B = new b2Mat22(0, b2AbsV(A.col1), b2AbsV(A.col2)); return (B); } public static function SubtractVV(a:b2Vec2, b:b2Vec2):b2Vec2{ var v:b2Vec2; v = new b2Vec2((a.x - b.x), (a.y - b.y)); return (v); } public static function b2MulXT(T:b2XForm, v:b2Vec2):b2Vec2{ var a:b2Vec2; var tX:Number; a = SubtractVV(v, T.position); tX = ((a.x * T.R.col1.x) + (a.y * T.R.col1.y)); a.y = ((a.x * T.R.col2.x) + (a.y * T.R.col2.y)); a.x = tX; return (a); } public static function b2Abs(a:Number):Number{ return (((a > 0)) ? a : -(a)); } public static function b2Clamp(a:Number, low:Number, high:Number):Number{ return (b2Max(low, b2Min(a, high))); } public static function b2AbsV(a:b2Vec2):b2Vec2{ var b:b2Vec2; b = new b2Vec2(b2Abs(a.x), b2Abs(a.y)); return (b); } public static function MulFV(s:Number, a:b2Vec2):b2Vec2{ var v:b2Vec2; v = new b2Vec2((s * a.x), (s * a.y)); return (v); } public static function b2CrossVV(a:b2Vec2, b:b2Vec2):Number{ return (((a.x * b.y) - (a.y * b.x))); } public static function b2Dot(a:b2Vec2, b:b2Vec2):Number{ return (((a.x * b.x) + (a.y * b.y))); } public static function b2CrossFV(s:Number, a:b2Vec2):b2Vec2{ var v:b2Vec2; v = new b2Vec2((-(s) * a.y), (s * a.x)); return (v); } public static function AddMM(A:b2Mat22, B:b2Mat22):b2Mat22{ var C:b2Mat22; C = new b2Mat22(0, AddVV(A.col1, B.col1), AddVV(A.col2, B.col2)); return (C); } public static function b2Distance(a:b2Vec2, b:b2Vec2):Number{ var cX:Number; var cY:Number; cX = (a.x - b.x); cY = (a.y - b.y); return (Math.sqrt(((cX * cX) + (cY * cY)))); } public static function b2MulTMM(A:b2Mat22, B:b2Mat22):b2Mat22{ var c1:b2Vec2; var c2:b2Vec2; var C:b2Mat22; c1 = new b2Vec2(b2Dot(A.col1, B.col1), b2Dot(A.col2, B.col1)); c2 = new b2Vec2(b2Dot(A.col1, B.col2), b2Dot(A.col2, B.col2)); C = new b2Mat22(0, c1, c2); return (C); } public static function b2MaxV(a:b2Vec2, b:b2Vec2):b2Vec2{ var c:b2Vec2; c = new b2Vec2(b2Max(a.x, b.x), b2Max(a.y, b.y)); return (c); } public static function b2IsPowerOfTwo(x:uint):Boolean{ var result:Boolean; result = (((x > 0)) && (((x & (x - 1)) == 0))); return (result); } public static function b2ClampV(a:b2Vec2, low:b2Vec2, high:b2Vec2):b2Vec2{ return (b2MaxV(low, b2MinV(a, high))); } public static function b2RandomRange(lo:Number, hi:Number):Number{ var r:Number; r = Math.random(); r = (((hi - lo) * r) + lo); return (r); } public static function b2MulTMV(A:b2Mat22, v:b2Vec2):b2Vec2{ var u:b2Vec2; u = new b2Vec2(b2Dot(v, A.col1), b2Dot(v, A.col2)); return (u); } public static function b2Min(a:Number, b:Number):Number{ return (((a < b)) ? a : b); } public static function b2Random():Number{ return (((Math.random() * 2) - 1)); } public static function b2MulMM(A:b2Mat22, B:b2Mat22):b2Mat22{ var C:b2Mat22; C = new b2Mat22(0, b2MulMV(A, B.col1), b2MulMV(A, B.col2)); return (C); } public static function b2NextPowerOfTwo(x:uint):uint{ x = (x | ((x >> 1) & 2147483647)); x = (x | ((x >> 2) & 1073741823)); x = (x | ((x >> 4) & 268435455)); x = (x | ((x >> 8) & 0xFFFFFF)); x = (x | ((x >> 16) & 0xFFFF)); return ((x + 1)); } public static function b2Max(a:Number, b:Number):Number{ return (((a > b)) ? a : b); } public static function b2MulMV(A:b2Mat22, v:b2Vec2):b2Vec2{ var u:b2Vec2; u = new b2Vec2(((A.col1.x * v.x) + (A.col2.x * v.y)), ((A.col1.y * v.x) + (A.col2.y * v.y))); return (u); } } }//package Box2D.Common.Math
Section 33
//b2Sweep (Box2D.Common.Math.b2Sweep) package Box2D.Common.Math { public class b2Sweep { public var localCenter:b2Vec2; public var c:b2Vec2; public var a:Number; public var c0:b2Vec2; public var a0:Number; public var t0:Number; public function b2Sweep(){ localCenter = new b2Vec2(); c0 = new b2Vec2(); c = new b2Vec2(); super(); } public function Advance(t:Number):void{ var alpha:Number; if ((((t0 < t)) && (((1 - t0) > Number.MIN_VALUE)))){ alpha = ((t - t0) / (1 - t0)); c0.x = (((1 - alpha) * c0.x) + (alpha * c.x)); c0.y = (((1 - alpha) * c0.y) + (alpha * c.y)); a0 = (((1 - alpha) * a0) + (alpha * a)); t0 = t; }; } public function GetXForm(xf:b2XForm, t:Number):void{ var tMat:b2Mat22; var alpha:Number; var angle:Number; if ((1 - t0) > Number.MIN_VALUE){ alpha = ((t - t0) / (1 - t0)); xf.position.x = (((1 - alpha) * c0.x) + (alpha * c.x)); xf.position.y = (((1 - alpha) * c0.y) + (alpha * c.y)); angle = (((1 - alpha) * a0) + (alpha * a)); xf.R.Set(angle); } else { xf.position.SetV(c); xf.R.Set(a); }; tMat = xf.R; xf.position.x = (xf.position.x - ((tMat.col1.x * localCenter.x) + (tMat.col2.x * localCenter.y))); xf.position.y = (xf.position.y - ((tMat.col1.y * localCenter.x) + (tMat.col2.y * localCenter.y))); } } }//package Box2D.Common.Math
Section 34
//b2Vec2 (Box2D.Common.Math.b2Vec2) package Box2D.Common.Math { public class b2Vec2 { public var x:Number; public var y:Number; public function b2Vec2(x_:Number=0, y_:Number=0):void{ super(); x = x_; y = y_; } public function Set(x_:Number=0, y_:Number=0):void{ x = x_; y = y_; } public function Multiply(a:Number):void{ x = (x * a); y = (y * a); } public function Length():Number{ return (Math.sqrt(((x * x) + (y * y)))); } public function LengthSquared():Number{ return (((x * x) + (y * y))); } public function SetZero():void{ x = 0; y = 0; } public function Add(v:b2Vec2):void{ x = (x + v.x); y = (y + v.y); } public function MaxV(b:b2Vec2):void{ x = ((x > b.x)) ? x : b.x; y = ((y > b.y)) ? y : b.y; } public function SetV(v:b2Vec2):void{ x = v.x; y = v.y; } public function Negative():b2Vec2{ return (new b2Vec2(-(x), -(y))); } public function CrossVF(s:Number):void{ var tX:Number; tX = x; x = (s * y); y = (-(s) * tX); } public function Abs():void{ if (x < 0){ x = -(x); }; if (y < 0){ y = -(y); }; } public function Copy():b2Vec2{ return (new b2Vec2(x, y)); } public function MulTM(A:b2Mat22):void{ var tX:Number; tX = b2Math.b2Dot(this, A.col1); y = b2Math.b2Dot(this, A.col2); x = tX; } public function IsValid():Boolean{ return (((b2Math.b2IsValid(x)) && (b2Math.b2IsValid(y)))); } public function MinV(b:b2Vec2):void{ x = ((x < b.x)) ? x : b.x; y = ((y < b.y)) ? y : b.y; } public function MulM(A:b2Mat22):void{ var tX:Number; tX = x; x = ((A.col1.x * tX) + (A.col2.x * y)); y = ((A.col1.y * tX) + (A.col2.y * y)); } public function Normalize():Number{ var length:Number; var invLength:Number; length = Math.sqrt(((x * x) + (y * y))); if (length < Number.MIN_VALUE){ return (0); }; invLength = (1 / length); x = (x * invLength); y = (y * invLength); return (length); } public function Subtract(v:b2Vec2):void{ x = (x - v.x); y = (y - v.y); } public function CrossFV(s:Number):void{ var tX:Number; tX = x; x = (-(s) * y); y = (s * tX); } public static function Make(x_:Number, y_:Number):b2Vec2{ return (new b2Vec2(x_, y_)); } } }//package Box2D.Common.Math
Section 35
//b2XForm (Box2D.Common.Math.b2XForm) package Box2D.Common.Math { public class b2XForm { public var R:b2Mat22; public var position:b2Vec2; public function b2XForm(pos:b2Vec2=null, r:b2Mat22=null):void{ position = new b2Vec2(); R = new b2Mat22(); super(); if (pos){ position.SetV(pos); R.SetM(r); }; } public function Initialize(pos:b2Vec2, r:b2Mat22):void{ position.SetV(pos); R.SetM(r); } public function Set(x:b2XForm):void{ position.SetV(x.position); R.SetM(x.R); } public function SetIdentity():void{ position.SetZero(); R.SetIdentity(); } } }//package Box2D.Common.Math
Section 36
//b2Color (Box2D.Common.b2Color) package Box2D.Common { import Box2D.Common.Math.*; public class b2Color { private var _g:uint;// = 0 private var _b:uint;// = 0 private var _r:uint;// = 0 public function b2Color(rr:Number, gg:Number, bb:Number){ _r = 0; _g = 0; _b = 0; super(); _r = uint((0xFF * b2Math.b2Clamp(rr, 0, 1))); _g = uint((0xFF * b2Math.b2Clamp(gg, 0, 1))); _b = uint((0xFF * b2Math.b2Clamp(bb, 0, 1))); } public function Set(rr:Number, gg:Number, bb:Number):void{ _r = uint((0xFF * b2Math.b2Clamp(rr, 0, 1))); _g = uint((0xFF * b2Math.b2Clamp(gg, 0, 1))); _b = uint((0xFF * b2Math.b2Clamp(bb, 0, 1))); } public function get color():uint{ return (((_r | (_g << 8)) | (_b << 16))); } public function set r(rr:Number):void{ _r = uint((0xFF * b2Math.b2Clamp(rr, 0, 1))); } public function set b(bb:Number):void{ _b = uint((0xFF * b2Math.b2Clamp(bb, 0, 1))); } public function set g(gg:Number):void{ _g = uint((0xFF * b2Math.b2Clamp(gg, 0, 1))); } } }//package Box2D.Common
Section 37
//b2Settings (Box2D.Common.b2Settings) package Box2D.Common { import Box2D.Common.Math.*; public class b2Settings { public static const b2_angularSleepTolerance:Number = 0.0111111111111111; public static const b2_linearSleepTolerance:Number = 0.01; public static const b2_angularSlop:Number = 0.0349065850398866; public static const b2_linearSlop:Number = 0.005; public static const b2_pi:Number = 3.14159265358979; public static const b2_maxProxies:int = 0x0200; public static const b2_maxAngularVelocitySquared:Number = 62500; public static const b2_maxPolygonVertices:int = 8; public static const b2_velocityThreshold:Number = 1; public static const b2_contactBaumgarte:Number = 0.2; public static const b2_maxPairs:int = 4096; public static const b2_maxTOIContactsPerIsland:int = 32; public static const b2_timeToSleep:Number = 0.5; public static const b2_maxManifoldPoints:int = 2; public static const b2_maxAngularVelocity:Number = 250; public static const b2_maxAngularCorrection:Number = 0.139626340159546; public static const USHRT_MAX:int = 0xFFFF; public static const b2_maxLinearVelocity:Number = 200; public static const b2_maxLinearCorrection:Number = 0.2; public static const b2_toiSlop:Number = 0.04; public static const b2_maxLinearVelocitySquared:Number = 40000; public function b2Settings(){ super(); } public static function b2Assert(a:Boolean):void{ var nullVec:b2Vec2; if (!a){ nullVec.x++; }; } } }//package Box2D.Common
Section 38
//b2CircleContact (Box2D.Dynamics.Contacts.b2CircleContact) package Box2D.Dynamics.Contacts { import Box2D.Dynamics.*; import Box2D.Common.Math.*; import Box2D.Collision.*; import Box2D.Collision.Shapes.*; public class b2CircleContact extends b2Contact { private var m_manifolds:Array; private var m0:b2Manifold; public var m_manifold:b2Manifold; private static const s_evalCP:b2ContactPoint = new b2ContactPoint(); public function b2CircleContact(shape1:b2Shape, shape2:b2Shape){ var point:b2ManifoldPoint; m_manifolds = [new b2Manifold()]; m0 = new b2Manifold(); super(shape1, shape2); m_manifold = m_manifolds[0]; m_manifold.pointCount = 0; point = m_manifold.points[0]; point.normalImpulse = 0; point.tangentImpulse = 0; } override public function GetManifolds():Array{ return (m_manifolds); } override public function Evaluate(listener:b2ContactListener):void{ var v1:b2Vec2; var v2:b2Vec2; var mp0:b2ManifoldPoint; var b1:b2Body; var b2:b2Body; var cp:b2ContactPoint; var mp:b2ManifoldPoint; b1 = m_shape1.m_body; b2 = m_shape2.m_body; m0.Set(m_manifold); b2Collision.b2CollideCircles(m_manifold, (m_shape1 as b2CircleShape), b1.m_xf, (m_shape2 as b2CircleShape), b2.m_xf); cp = s_evalCP; cp.shape1 = m_shape1; cp.shape2 = m_shape2; cp.friction = m_friction; cp.restitution = m_restitution; if (m_manifold.pointCount > 0){ m_manifoldCount = 1; mp = m_manifold.points[0]; if (m0.pointCount == 0){ mp.normalImpulse = 0; mp.tangentImpulse = 0; if (listener){ cp.position = b1.GetWorldPoint(mp.localPoint1); v1 = b1.GetLinearVelocityFromLocalPoint(mp.localPoint1); v2 = b2.GetLinearVelocityFromLocalPoint(mp.localPoint2); cp.velocity.Set((v2.x - v1.x), (v2.y - v1.y)); cp.normal.SetV(m_manifold.normal); cp.separation = mp.separation; cp.id.key = mp.id._key; listener.Add(cp); }; } else { mp0 = m0.points[0]; mp.normalImpulse = mp0.normalImpulse; mp.tangentImpulse = mp0.tangentImpulse; if (listener){ cp.position = b1.GetWorldPoint(mp.localPoint1); v1 = b1.GetLinearVelocityFromLocalPoint(mp.localPoint1); v2 = b2.GetLinearVelocityFromLocalPoint(mp.localPoint2); cp.velocity.Set((v2.x - v1.x), (v2.y - v1.y)); cp.normal.SetV(m_manifold.normal); cp.separation = mp.separation; cp.id.key = mp.id._key; listener.Persist(cp); }; }; } else { m_manifoldCount = 0; if ((((m0.pointCount > 0)) && (listener))){ mp0 = m0.points[0]; cp.position = b1.GetWorldPoint(mp0.localPoint1); v1 = b1.GetLinearVelocityFromLocalPoint(mp0.localPoint1); v2 = b2.GetLinearVelocityFromLocalPoint(mp0.localPoint2); cp.velocity.Set((v2.x - v1.x), (v2.y - v1.y)); cp.normal.SetV(m0.normal); cp.separation = mp0.separation; cp.id.key = mp0.id._key; listener.Remove(cp); }; }; } public static function Destroy(contact:b2Contact, allocator):void{ } public static function Create(shape1:b2Shape, shape2:b2Shape, allocator):b2Contact{ return (new b2CircleContact(shape1, shape2)); } } }//package Box2D.Dynamics.Contacts
Section 39
//b2Contact (Box2D.Dynamics.Contacts.b2Contact) package Box2D.Dynamics.Contacts { import Box2D.Dynamics.*; import Box2D.Common.Math.*; import Box2D.Collision.*; import Box2D.Collision.Shapes.*; import Box2D.Common.*; public class b2Contact { public var m_shape1:b2Shape; public var m_shape2:b2Shape; public var m_prev:b2Contact; public var m_toi:Number; public var m_next:b2Contact; public var m_friction:Number; public var m_manifoldCount:int; public var m_node1:b2ContactEdge; public var m_node2:b2ContactEdge; public var m_restitution:Number; public var m_flags:uint; public static var e_toiFlag:uint = 8; public static var e_nonSolidFlag:uint = 1; public static var e_slowFlag:uint = 2; public static var e_islandFlag:uint = 4; public static var s_registers:Array; public static var s_initialized:Boolean = false; public function b2Contact(s1:b2Shape=null, s2:b2Shape=null){ m_node1 = new b2ContactEdge(); m_node2 = new b2ContactEdge(); super(); m_flags = 0; if (((!(s1)) || (!(s2)))){ m_shape1 = null; m_shape2 = null; return; }; if (((s1.IsSensor()) || (s2.IsSensor()))){ m_flags = (m_flags | e_nonSolidFlag); }; m_shape1 = s1; m_shape2 = s2; m_manifoldCount = 0; m_friction = Math.sqrt((m_shape1.m_friction * m_shape2.m_friction)); m_restitution = b2Math.b2Max(m_shape1.m_restitution, m_shape2.m_restitution); m_prev = null; m_next = null; m_node1.contact = null; m_node1.prev = null; m_node1.next = null; m_node1.other = null; m_node2.contact = null; m_node2.prev = null; m_node2.next = null; m_node2.other = null; } public function GetShape1():b2Shape{ return (m_shape1); } public function IsSolid():Boolean{ return (((m_flags & e_nonSolidFlag) == 0)); } public function GetNext():b2Contact{ return (m_next); } public function GetManifolds():Array{ return (null); } public function GetShape2():b2Shape{ return (m_shape2); } public function GetManifoldCount():int{ return (m_manifoldCount); } public function Update(listener:b2ContactListener):void{ var oldCount:int; var newCount:int; var body1:b2Body; var body2:b2Body; oldCount = m_manifoldCount; Evaluate(listener); newCount = m_manifoldCount; body1 = m_shape1.m_body; body2 = m_shape2.m_body; if ((((newCount == 0)) && ((oldCount > 0)))){ body1.WakeUp(); body2.WakeUp(); }; if (((((((body1.IsStatic()) || (body1.IsBullet()))) || (body2.IsStatic()))) || (body2.IsBullet()))){ m_flags = (m_flags & ~(e_slowFlag)); } else { m_flags = (m_flags | e_slowFlag); }; } public function Evaluate(listener:b2ContactListener):void{ } public static function InitializeRegisters():void{ var i:int; var j:int; s_registers = new Array(b2Shape.e_shapeTypeCount); i = 0; while (i < b2Shape.e_shapeTypeCount) { s_registers[i] = new Array(b2Shape.e_shapeTypeCount); j = 0; while (j < b2Shape.e_shapeTypeCount) { s_registers[i][j] = new b2ContactRegister(); j++; }; i++; }; AddType(b2CircleContact.Create, b2CircleContact.Destroy, b2Shape.e_circleShape, b2Shape.e_circleShape); AddType(b2PolyAndCircleContact.Create, b2PolyAndCircleContact.Destroy, b2Shape.e_polygonShape, b2Shape.e_circleShape); AddType(b2PolygonContact.Create, b2PolygonContact.Destroy, b2Shape.e_polygonShape, b2Shape.e_polygonShape); } public static function Destroy(contact:b2Contact, allocator):void{ var type1:int; var type2:int; var reg:b2ContactRegister; var destroyFcn:Function; if (contact.m_manifoldCount > 0){ contact.m_shape1.m_body.WakeUp(); contact.m_shape2.m_body.WakeUp(); }; type1 = contact.m_shape1.m_type; type2 = contact.m_shape2.m_type; reg = s_registers[type1][type2]; destroyFcn = reg.destroyFcn; destroyFcn(contact, allocator); } public static function AddType(createFcn:Function, destroyFcn:Function, type1:int, type2:int):void{ s_registers[type1][type2].createFcn = createFcn; s_registers[type1][type2].destroyFcn = destroyFcn; s_registers[type1][type2].primary = true; if (type1 != type2){ s_registers[type2][type1].createFcn = createFcn; s_registers[type2][type1].destroyFcn = destroyFcn; s_registers[type2][type1].primary = false; }; } public static function Create(shape1:b2Shape, shape2:b2Shape, allocator):b2Contact{ var type1:int; var type2:int; var reg:b2ContactRegister; var createFcn:Function; var c:b2Contact; var i:int; var m:b2Manifold; if (s_initialized == false){ InitializeRegisters(); s_initialized = true; }; type1 = shape1.m_type; type2 = shape2.m_type; reg = s_registers[type1][type2]; createFcn = reg.createFcn; if (createFcn != null){ if (reg.primary){ return (createFcn(shape1, shape2, allocator)); }; c = createFcn(shape2, shape1, allocator); i = 0; while (i < c.m_manifoldCount) { m = c.GetManifolds()[i]; m.normal = m.normal.Negative(); i++; }; return (c); //unresolved jump }; return (null); } } }//package Box2D.Dynamics.Contacts
Section 40
//b2ContactConstraint (Box2D.Dynamics.Contacts.b2ContactConstraint) package Box2D.Dynamics.Contacts { import Box2D.Dynamics.*; import Box2D.Common.Math.*; import Box2D.Collision.*; import Box2D.Common.*; public class b2ContactConstraint { public var points:Array; public var restitution:Number; public var body1:b2Body; public var manifold:b2Manifold; public var normal:b2Vec2; public var body2:b2Body; public var friction:Number; public var pointCount:int; public function b2ContactConstraint(){ var i:int; normal = new b2Vec2(); super(); points = new Array(b2Settings.b2_maxManifoldPoints); i = 0; while (i < b2Settings.b2_maxManifoldPoints) { points[i] = new b2ContactConstraintPoint(); i++; }; } } }//package Box2D.Dynamics.Contacts
Section 41
//b2ContactConstraintPoint (Box2D.Dynamics.Contacts.b2ContactConstraintPoint) package Box2D.Dynamics.Contacts { import Box2D.Common.Math.*; public class b2ContactConstraintPoint { public var r2:b2Vec2; public var separation:Number; public var positionImpulse:Number; public var normalImpulse:Number; public var equalizedMass:Number; public var tangentMass:Number; public var tangentImpulse:Number; public var localAnchor1:b2Vec2; public var localAnchor2:b2Vec2; public var normalMass:Number; public var velocityBias:Number; public var r1:b2Vec2; public function b2ContactConstraintPoint(){ localAnchor1 = new b2Vec2(); localAnchor2 = new b2Vec2(); r1 = new b2Vec2(); r2 = new b2Vec2(); super(); } } }//package Box2D.Dynamics.Contacts
Section 42
//b2ContactEdge (Box2D.Dynamics.Contacts.b2ContactEdge) package Box2D.Dynamics.Contacts { import Box2D.Dynamics.*; public class b2ContactEdge { public var next:b2ContactEdge; public var other:b2Body; public var contact:b2Contact; public var prev:b2ContactEdge; public function b2ContactEdge(){ super(); } } }//package Box2D.Dynamics.Contacts
Section 43
//b2ContactRegister (Box2D.Dynamics.Contacts.b2ContactRegister) package Box2D.Dynamics.Contacts { public class b2ContactRegister { public var primary:Boolean; public var createFcn:Function; public var destroyFcn:Function; public function b2ContactRegister(){ super(); } } }//package Box2D.Dynamics.Contacts
Section 44
//b2ContactResult (Box2D.Dynamics.Contacts.b2ContactResult) package Box2D.Dynamics.Contacts { import Box2D.Common.Math.*; import Box2D.Collision.*; import Box2D.Collision.Shapes.*; public class b2ContactResult { public var normal:b2Vec2; public var position:b2Vec2; public var shape1:b2Shape; public var shape2:b2Shape; public var normalImpulse:Number; public var tangentImpulse:Number; public var id:b2ContactID; public function b2ContactResult(){ position = new b2Vec2(); normal = new b2Vec2(); id = new b2ContactID(); super(); } } }//package Box2D.Dynamics.Contacts
Section 45
//b2ContactSolver (Box2D.Dynamics.Contacts.b2ContactSolver) package Box2D.Dynamics.Contacts { import Box2D.Dynamics.*; import Box2D.Common.Math.*; import Box2D.Collision.*; import Box2D.Common.*; public class b2ContactSolver { public var m_constraintCount:int; public var m_constraints:Array; public var m_allocator; public var m_step:b2TimeStep; public function b2ContactSolver(step:b2TimeStep, contacts:Array, contactCount:int, allocator){ var contact:b2Contact; var i:int; var tVec:b2Vec2; var tMat:b2Mat22; var count:int; var b1:b2Body; var b2:b2Body; var manifoldCount:int; var manifolds:Array; var friction:Number; var restitution:Number; var v1X:Number; var v1Y:Number; var v2X:Number; var v2Y:Number; var w1:Number; var w2:Number; var j:int; var manifold:b2Manifold; var normalX:Number; var normalY:Number; var c:b2ContactConstraint; var k:uint; var cp:b2ManifoldPoint; var ccp:b2ContactConstraintPoint; var tX:Number; var tY:Number; var r1X:Number; var r1Y:Number; var r2X:Number; var r2Y:Number; var r1Sqr:Number; var r2Sqr:Number; var rn1:Number; var rn2:Number; var kNormal:Number; var kEqualized:Number; var tangentX:Number; var tangentY:Number; var rt1:Number; var rt2:Number; var kTangent:Number; var vRel:Number; m_step = new b2TimeStep(); m_constraints = new Array(); super(); m_step.dt = step.dt; m_step.inv_dt = step.inv_dt; m_step.maxIterations = step.maxIterations; m_allocator = allocator; m_constraintCount = 0; i = 0; while (i < contactCount) { contact = contacts[i]; m_constraintCount = (m_constraintCount + contact.m_manifoldCount); i++; }; i = 0; while (i < m_constraintCount) { m_constraints[i] = new b2ContactConstraint(); i++; }; count = 0; i = 0; while (i < contactCount) { contact = contacts[i]; b1 = contact.m_shape1.m_body; b2 = contact.m_shape2.m_body; manifoldCount = contact.m_manifoldCount; manifolds = contact.GetManifolds(); friction = contact.m_friction; restitution = contact.m_restitution; v1X = b1.m_linearVelocity.x; v1Y = b1.m_linearVelocity.y; v2X = b2.m_linearVelocity.x; v2Y = b2.m_linearVelocity.y; w1 = b1.m_angularVelocity; w2 = b2.m_angularVelocity; j = 0; while (j < manifoldCount) { manifold = manifolds[j]; normalX = manifold.normal.x; normalY = manifold.normal.y; c = m_constraints[count]; c.body1 = b1; c.body2 = b2; c.manifold = manifold; c.normal.x = normalX; c.normal.y = normalY; c.pointCount = manifold.pointCount; c.friction = friction; c.restitution = restitution; k = 0; while (k < c.pointCount) { cp = manifold.points[k]; ccp = c.points[k]; ccp.normalImpulse = cp.normalImpulse; ccp.tangentImpulse = cp.tangentImpulse; ccp.separation = cp.separation; ccp.positionImpulse = 0; ccp.localAnchor1.SetV(cp.localPoint1); ccp.localAnchor2.SetV(cp.localPoint2); tMat = b1.m_xf.R; r1X = (cp.localPoint1.x - b1.m_sweep.localCenter.x); r1Y = (cp.localPoint1.y - b1.m_sweep.localCenter.y); tX = ((tMat.col1.x * r1X) + (tMat.col2.x * r1Y)); r1Y = ((tMat.col1.y * r1X) + (tMat.col2.y * r1Y)); r1X = tX; ccp.r1.Set(r1X, r1Y); tMat = b2.m_xf.R; r2X = (cp.localPoint2.x - b2.m_sweep.localCenter.x); r2Y = (cp.localPoint2.y - b2.m_sweep.localCenter.y); tX = ((tMat.col1.x * r2X) + (tMat.col2.x * r2Y)); r2Y = ((tMat.col1.y * r2X) + (tMat.col2.y * r2Y)); r2X = tX; ccp.r2.Set(r2X, r2Y); r1Sqr = ((r1X * r1X) + (r1Y * r1Y)); r2Sqr = ((r2X * r2X) + (r2Y * r2Y)); rn1 = ((r1X * normalX) + (r1Y * normalY)); rn2 = ((r2X * normalX) + (r2Y * normalY)); kNormal = (b1.m_invMass + b2.m_invMass); kNormal = (kNormal + ((b1.m_invI * (r1Sqr - (rn1 * rn1))) + (b2.m_invI * (r2Sqr - (rn2 * rn2))))); ccp.normalMass = (1 / kNormal); kEqualized = ((b1.m_mass * b1.m_invMass) + (b2.m_mass * b2.m_invMass)); kEqualized = (kEqualized + (((b1.m_mass * b1.m_invI) * (r1Sqr - (rn1 * rn1))) + ((b2.m_mass * b2.m_invI) * (r2Sqr - (rn2 * rn2))))); ccp.equalizedMass = (1 / kEqualized); tangentX = normalY; tangentY = -(normalX); rt1 = ((r1X * tangentX) + (r1Y * tangentY)); rt2 = ((r2X * tangentX) + (r2Y * tangentY)); kTangent = (b1.m_invMass + b2.m_invMass); kTangent = (kTangent + ((b1.m_invI * (r1Sqr - (rt1 * rt1))) + (b2.m_invI * (r2Sqr - (rt2 * rt2))))); ccp.tangentMass = (1 / kTangent); ccp.velocityBias = 0; if (ccp.separation > 0){ ccp.velocityBias = (-60 * ccp.separation); }; tX = (((v2X + (-(w2) * r2Y)) - v1X) - (-(w1) * r1Y)); tY = (((v2Y + (w2 * r2X)) - v1Y) - (w1 * r1X)); vRel = ((c.normal.x * tX) + (c.normal.y * tY)); if (vRel < -(b2Settings.b2_velocityThreshold)){ ccp.velocityBias = (ccp.velocityBias + (-(c.restitution) * vRel)); }; k++; }; count++; j++; }; i++; }; } public function InitVelocityConstraints(step:b2TimeStep):void{ var tVec:b2Vec2; var tVec2:b2Vec2; var tMat:b2Mat22; var i:int; var c:b2ContactConstraint; var b1:b2Body; var b2:b2Body; var invMass1:Number; var invI1:Number; var invMass2:Number; var invI2:Number; var normalX:Number; var normalY:Number; var tangentX:Number; var tangentY:Number; var tX:Number; var j:int; var tCount:int; var ccp:b2ContactConstraintPoint; var PX:Number; var PY:Number; var ccp2:b2ContactConstraintPoint; i = 0; while (i < m_constraintCount) { c = m_constraints[i]; b1 = c.body1; b2 = c.body2; invMass1 = b1.m_invMass; invI1 = b1.m_invI; invMass2 = b2.m_invMass; invI2 = b2.m_invI; normalX = c.normal.x; normalY = c.normal.y; tangentX = normalY; tangentY = -(normalX); if (step.warmStarting){ tCount = c.pointCount; j = 0; while (j < tCount) { ccp = c.points[j]; ccp.normalImpulse = (ccp.normalImpulse * step.dtRatio); ccp.tangentImpulse = (ccp.tangentImpulse * step.dtRatio); PX = ((ccp.normalImpulse * normalX) + (ccp.tangentImpulse * tangentX)); PY = ((ccp.normalImpulse * normalY) + (ccp.tangentImpulse * tangentY)); b1.m_angularVelocity = (b1.m_angularVelocity - (invI1 * ((ccp.r1.x * PY) - (ccp.r1.y * PX)))); b1.m_linearVelocity.x = (b1.m_linearVelocity.x - (invMass1 * PX)); b1.m_linearVelocity.y = (b1.m_linearVelocity.y - (invMass1 * PY)); b2.m_angularVelocity = (b2.m_angularVelocity + (invI2 * ((ccp.r2.x * PY) - (ccp.r2.y * PX)))); b2.m_linearVelocity.x = (b2.m_linearVelocity.x + (invMass2 * PX)); b2.m_linearVelocity.y = (b2.m_linearVelocity.y + (invMass2 * PY)); j++; }; } else { tCount = c.pointCount; j = 0; while (j < tCount) { ccp2 = c.points[j]; ccp2.normalImpulse = 0; ccp2.tangentImpulse = 0; j++; }; }; i++; }; } public function SolvePositionConstraints(baumgarte:Number):Boolean{ var minSeparation:Number; var tMat:b2Mat22; var tVec:b2Vec2; var i:int; var c:b2ContactConstraint; var b1:b2Body; var b2:b2Body; var b1_sweep_c:b2Vec2; var b1_sweep_a:Number; var b2_sweep_c:b2Vec2; var b2_sweep_a:Number; var invMass1:Number; var invI1:Number; var invMass2:Number; var invI2:Number; var normalX:Number; var normalY:Number; var tCount:int; var j:int; var ccp:b2ContactConstraintPoint; var r1X:Number; var r1Y:Number; var r2X:Number; var r2Y:Number; var tX:Number; var p1X:Number; var p1Y:Number; var p2X:Number; var p2Y:Number; var dpX:Number; var dpY:Number; var separation:Number; var C:Number; var dImpulse:Number; var impulse0:Number; var impulseX:Number; var impulseY:Number; minSeparation = 0; i = 0; while (i < m_constraintCount) { c = m_constraints[i]; b1 = c.body1; b2 = c.body2; b1_sweep_c = b1.m_sweep.c; b1_sweep_a = b1.m_sweep.a; b2_sweep_c = b2.m_sweep.c; b2_sweep_a = b2.m_sweep.a; invMass1 = (b1.m_mass * b1.m_invMass); invI1 = (b1.m_mass * b1.m_invI); invMass2 = (b2.m_mass * b2.m_invMass); invI2 = (b2.m_mass * b2.m_invI); normalX = c.normal.x; normalY = c.normal.y; tCount = c.pointCount; j = 0; while (j < tCount) { ccp = c.points[j]; tMat = b1.m_xf.R; tVec = b1.m_sweep.localCenter; r1X = (ccp.localAnchor1.x - tVec.x); r1Y = (ccp.localAnchor1.y - tVec.y); tX = ((tMat.col1.x * r1X) + (tMat.col2.x * r1Y)); r1Y = ((tMat.col1.y * r1X) + (tMat.col2.y * r1Y)); r1X = tX; tMat = b2.m_xf.R; tVec = b2.m_sweep.localCenter; r2X = (ccp.localAnchor2.x - tVec.x); r2Y = (ccp.localAnchor2.y - tVec.y); tX = ((tMat.col1.x * r2X) + (tMat.col2.x * r2Y)); r2Y = ((tMat.col1.y * r2X) + (tMat.col2.y * r2Y)); r2X = tX; p1X = (b1_sweep_c.x + r1X); p1Y = (b1_sweep_c.y + r1Y); p2X = (b2_sweep_c.x + r2X); p2Y = (b2_sweep_c.y + r2Y); dpX = (p2X - p1X); dpY = (p2Y - p1Y); separation = (((dpX * normalX) + (dpY * normalY)) + ccp.separation); minSeparation = b2Math.b2Min(minSeparation, separation); C = (baumgarte * b2Math.b2Clamp((separation + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0)); dImpulse = (-(ccp.equalizedMass) * C); impulse0 = ccp.positionImpulse; ccp.positionImpulse = b2Math.b2Max((impulse0 + dImpulse), 0); dImpulse = (ccp.positionImpulse - impulse0); impulseX = (dImpulse * normalX); impulseY = (dImpulse * normalY); b1_sweep_c.x = (b1_sweep_c.x - (invMass1 * impulseX)); b1_sweep_c.y = (b1_sweep_c.y - (invMass1 * impulseY)); b1_sweep_a = (b1_sweep_a - (invI1 * ((r1X * impulseY) - (r1Y * impulseX)))); b1.m_sweep.a = b1_sweep_a; b1.SynchronizeTransform(); b2_sweep_c.x = (b2_sweep_c.x + (invMass2 * impulseX)); b2_sweep_c.y = (b2_sweep_c.y + (invMass2 * impulseY)); b2_sweep_a = (b2_sweep_a + (invI2 * ((r2X * impulseY) - (r2Y * impulseX)))); b2.m_sweep.a = b2_sweep_a; b2.SynchronizeTransform(); j++; }; i++; }; return ((minSeparation >= (-1.5 * b2Settings.b2_linearSlop))); } public function SolveVelocityConstraints():void{ var j:int; var ccp:b2ContactConstraintPoint; var r1X:Number; var r1Y:Number; var r2X:Number; var r2Y:Number; var dvX:Number; var dvY:Number; var vn:Number; var vt:Number; var lambda_n:Number; var lambda_t:Number; var newImpulse_n:Number; var newImpulse_t:Number; var PX:Number; var PY:Number; var tMat:b2Mat22; var tVec:b2Vec2; var i:int; var c:b2ContactConstraint; var b1:b2Body; var b2:b2Body; var w1:Number; var w2:Number; var v1:b2Vec2; var v2:b2Vec2; var invMass1:Number; var invI1:Number; var invMass2:Number; var invI2:Number; var normalX:Number; var normalY:Number; var tangentX:Number; var tangentY:Number; var friction:Number; var tX:Number; var tCount:int; var maxFriction:Number; i = 0; while (i < m_constraintCount) { c = m_constraints[i]; b1 = c.body1; b2 = c.body2; w1 = b1.m_angularVelocity; w2 = b2.m_angularVelocity; v1 = b1.m_linearVelocity; v2 = b2.m_linearVelocity; invMass1 = b1.m_invMass; invI1 = b1.m_invI; invMass2 = b2.m_invMass; invI2 = b2.m_invI; normalX = c.normal.x; normalY = c.normal.y; tangentX = normalY; tangentY = -(normalX); friction = c.friction; tCount = c.pointCount; j = 0; while (j < tCount) { ccp = c.points[j]; dvX = (((v2.x + (-(w2) * ccp.r2.y)) - v1.x) - (-(w1) * ccp.r1.y)); dvY = (((v2.y + (w2 * ccp.r2.x)) - v1.y) - (w1 * ccp.r1.x)); vn = ((dvX * normalX) + (dvY * normalY)); lambda_n = (-(ccp.normalMass) * (vn - ccp.velocityBias)); vt = ((dvX * tangentX) + (dvY * tangentY)); lambda_t = (ccp.tangentMass * -(vt)); newImpulse_n = b2Math.b2Max((ccp.normalImpulse + lambda_n), 0); lambda_n = (newImpulse_n - ccp.normalImpulse); maxFriction = (friction * ccp.normalImpulse); newImpulse_t = b2Math.b2Clamp((ccp.tangentImpulse + lambda_t), -(maxFriction), maxFriction); lambda_t = (newImpulse_t - ccp.tangentImpulse); PX = ((lambda_n * normalX) + (lambda_t * tangentX)); PY = ((lambda_n * normalY) + (lambda_t * tangentY)); v1.x = (v1.x - (invMass1 * PX)); v1.y = (v1.y - (invMass1 * PY)); w1 = (w1 - (invI1 * ((ccp.r1.x * PY) - (ccp.r1.y * PX)))); v2.x = (v2.x + (invMass2 * PX)); v2.y = (v2.y + (invMass2 * PY)); w2 = (w2 + (invI2 * ((ccp.r2.x * PY) - (ccp.r2.y * PX)))); ccp.normalImpulse = newImpulse_n; ccp.tangentImpulse = newImpulse_t; j++; }; b1.m_angularVelocity = w1; b2.m_angularVelocity = w2; i++; }; } public function FinalizeVelocityConstraints():void{ var i:int; var c:b2ContactConstraint; var m:b2Manifold; var j:int; var point1:b2ManifoldPoint; var point2:b2ContactConstraintPoint; i = 0; while (i < m_constraintCount) { c = m_constraints[i]; m = c.manifold; j = 0; while (j < c.pointCount) { point1 = m.points[j]; point2 = c.points[j]; point1.normalImpulse = point2.normalImpulse; point1.tangentImpulse = point2.tangentImpulse; j++; }; i++; }; } } }//package Box2D.Dynamics.Contacts
Section 46
//b2NullContact (Box2D.Dynamics.Contacts.b2NullContact) package Box2D.Dynamics.Contacts { import Box2D.Dynamics.*; public class b2NullContact extends b2Contact { public function b2NullContact(){ super(); } override public function GetManifolds():Array{ return (null); } override public function Evaluate(l:b2ContactListener):void{ } } }//package Box2D.Dynamics.Contacts
Section 47
//b2PolyAndCircleContact (Box2D.Dynamics.Contacts.b2PolyAndCircleContact) package Box2D.Dynamics.Contacts { import Box2D.Dynamics.*; import Box2D.Common.Math.*; import Box2D.Collision.*; import Box2D.Collision.Shapes.*; import Box2D.Common.*; public class b2PolyAndCircleContact extends b2Contact { private var m_manifolds:Array; private var m0:b2Manifold; public var m_manifold:b2Manifold; private static const s_evalCP:b2ContactPoint = new b2ContactPoint(); public function b2PolyAndCircleContact(shape1:b2Shape, shape2:b2Shape){ var point:b2ManifoldPoint; m_manifolds = [new b2Manifold()]; m0 = new b2Manifold(); super(shape1, shape2); m_manifold = m_manifolds[0]; b2Settings.b2Assert((m_shape1.m_type == b2Shape.e_polygonShape)); b2Settings.b2Assert((m_shape2.m_type == b2Shape.e_circleShape)); m_manifold.pointCount = 0; point = m_manifold.points[0]; point.normalImpulse = 0; point.tangentImpulse = 0; } override public function GetManifolds():Array{ return (m_manifolds); } override public function Evaluate(listener:b2ContactListener):void{ var i:int; var v1:b2Vec2; var v2:b2Vec2; var mp0:b2ManifoldPoint; var b1:b2Body; var b2:b2Body; var persisted:Array; var cp:b2ContactPoint; var mp:b2ManifoldPoint; var found:Boolean; var idKey:uint; var j:int; b1 = m_shape1.m_body; b2 = m_shape2.m_body; m0.Set(m_manifold); b2Collision.b2CollidePolygonAndCircle(m_manifold, (m_shape1 as b2PolygonShape), b1.m_xf, (m_shape2 as b2CircleShape), b2.m_xf); persisted = [false, false]; cp = s_evalCP; cp.shape1 = m_shape1; cp.shape2 = m_shape2; cp.friction = m_friction; cp.restitution = m_restitution; if (m_manifold.pointCount > 0){ i = 0; while (i < m_manifold.pointCount) { mp = m_manifold.points[i]; mp.normalImpulse = 0; mp.tangentImpulse = 0; found = false; idKey = mp.id._key; j = 0; while (j < m0.pointCount) { if (persisted[j] == true){ } else { mp0 = m0.points[j]; if (mp0.id._key == idKey){ persisted[j] = true; mp.normalImpulse = mp0.normalImpulse; mp.tangentImpulse = mp0.tangentImpulse; found = true; if (listener != null){ cp.position = b1.GetWorldPoint(mp.localPoint1); v1 = b1.GetLinearVelocityFromLocalPoint(mp.localPoint1); v2 = b2.GetLinearVelocityFromLocalPoint(mp.localPoint2); cp.velocity.Set((v2.x - v1.x), (v2.y - v1.y)); cp.normal.SetV(m_manifold.normal); cp.separation = mp.separation; cp.id.key = idKey; listener.Persist(cp); }; break; }; }; j++; }; if ((((found == false)) && (!((listener == null))))){ cp.position = b1.GetWorldPoint(mp.localPoint1); v1 = b1.GetLinearVelocityFromLocalPoint(mp.localPoint1); v2 = b2.GetLinearVelocityFromLocalPoint(mp.localPoint2); cp.velocity.Set((v2.x - v1.x), (v2.y - v1.y)); cp.normal.SetV(m_manifold.normal); cp.separation = mp.separation; cp.id.key = idKey; listener.Add(cp); }; i++; }; m_manifoldCount = 1; } else { m_manifoldCount = 0; }; if (listener == null){ return; }; i = 0; while (i < m0.pointCount) { if (persisted[i]){ } else { mp0 = m0.points[i]; cp.position = b1.GetWorldPoint(mp0.localPoint1); v1 = b1.GetLinearVelocityFromLocalPoint(mp0.localPoint1); v2 = b2.GetLinearVelocityFromLocalPoint(mp0.localPoint2); cp.velocity.Set((v2.x - v1.x), (v2.y - v1.y)); cp.normal.SetV(m0.normal); cp.separation = mp0.separation; cp.id.key = mp0.id._key; listener.Remove(cp); }; i++; }; } public static function Destroy(contact:b2Contact, allocator):void{ } public static function Create(shape1:b2Shape, shape2:b2Shape, allocator):b2Contact{ return (new b2PolyAndCircleContact(shape1, shape2)); } } }//package Box2D.Dynamics.Contacts
Section 48
//b2PolygonContact (Box2D.Dynamics.Contacts.b2PolygonContact) package Box2D.Dynamics.Contacts { import Box2D.Dynamics.*; import Box2D.Common.Math.*; import Box2D.Collision.*; import Box2D.Collision.Shapes.*; public class b2PolygonContact extends b2Contact { private var m_manifolds:Array; private var m0:b2Manifold; public var m_manifold:b2Manifold; private static const s_evalCP:b2ContactPoint = new b2ContactPoint(); public function b2PolygonContact(shape1:b2Shape, shape2:b2Shape):void{ m0 = new b2Manifold(); m_manifolds = [new b2Manifold()]; super(shape1, shape2); m_manifold = m_manifolds[0]; m_manifold.pointCount = 0; } override public function GetManifolds():Array{ return (m_manifolds); } override public function Evaluate(listener:b2ContactListener):void{ var v1:b2Vec2; var v2:b2Vec2; var mp0:b2ManifoldPoint; var b1:b2Body; var b2:b2Body; var cp:b2ContactPoint; var i:int; var persisted:Array; var mp:b2ManifoldPoint; var found:Boolean; var idKey:uint; var j:int; b1 = m_shape1.m_body; b2 = m_shape2.m_body; m0.Set(m_manifold); b2Collision.b2CollidePolygons(m_manifold, (m_shape1 as b2PolygonShape), b1.m_xf, (m_shape2 as b2PolygonShape), b2.m_xf); persisted = [false, false]; cp = s_evalCP; cp.shape1 = m_shape1; cp.shape2 = m_shape2; cp.friction = m_friction; cp.restitution = m_restitution; if (m_manifold.pointCount > 0){ i = 0; while (i < m_manifold.pointCount) { mp = m_manifold.points[i]; mp.normalImpulse = 0; mp.tangentImpulse = 0; found = false; idKey = mp.id._key; j = 0; while (j < m0.pointCount) { if (persisted[j] == true){ } else { mp0 = m0.points[j]; if (mp0.id._key == idKey){ persisted[j] = true; mp.normalImpulse = mp0.normalImpulse; mp.tangentImpulse = mp0.tangentImpulse; found = true; if (listener != null){ cp.position = b1.GetWorldPoint(mp.localPoint1); v1 = b1.GetLinearVelocityFromLocalPoint(mp.localPoint1); v2 = b2.GetLinearVelocityFromLocalPoint(mp.localPoint2); cp.velocity.Set((v2.x - v1.x), (v2.y - v1.y)); cp.normal.SetV(m_manifold.normal); cp.separation = mp.separation; cp.id.key = idKey; listener.Persist(cp); }; break; }; }; j++; }; if ((((found == false)) && (!((listener == null))))){ cp.position = b1.GetWorldPoint(mp.localPoint1); v1 = b1.GetLinearVelocityFromLocalPoint(mp.localPoint1); v2 = b2.GetLinearVelocityFromLocalPoint(mp.localPoint2); cp.velocity.Set((v2.x - v1.x), (v2.y - v1.y)); cp.normal.SetV(m_manifold.normal); cp.separation = mp.separation; cp.id.key = idKey; listener.Add(cp); }; i++; }; m_manifoldCount = 1; } else { m_manifoldCount = 0; }; if (listener == null){ return; }; i = 0; while (i < m0.pointCount) { if (persisted[i]){ } else { mp0 = m0.points[i]; cp.position = b1.GetWorldPoint(mp0.localPoint1); v1 = b1.GetLinearVelocityFromLocalPoint(mp0.localPoint1); v2 = b2.GetLinearVelocityFromLocalPoint(mp0.localPoint2); cp.velocity.Set((v2.x - v1.x), (v2.y - v1.y)); cp.normal.SetV(m0.normal); cp.separation = mp0.separation; cp.id.key = mp0.id._key; listener.Remove(cp); }; i++; }; } public static function Destroy(contact:b2Contact, allocator):void{ } public static function Create(shape1:b2Shape, shape2:b2Shape, allocator):b2Contact{ return (new b2PolygonContact(shape1, shape2)); } } }//package Box2D.Dynamics.Contacts
Section 49
//b2DistanceJoint (Box2D.Dynamics.Joints.b2DistanceJoint) package Box2D.Dynamics.Joints { import Box2D.Dynamics.*; import Box2D.Common.Math.*; import Box2D.Common.*; public class b2DistanceJoint extends b2Joint { public var m_mass:Number; public var m_u:b2Vec2; public var m_impulse:Number; public var m_dampingRatio:Number; public var m_frequencyHz:Number; public var m_localAnchor2:b2Vec2; public var m_localAnchor1:b2Vec2; public var m_bias:Number; public var m_gamma:Number; public var m_length:Number; public function b2DistanceJoint(def:b2DistanceJointDef){ var tMat:b2Mat22; var tX:Number; var tY:Number; m_localAnchor1 = new b2Vec2(); m_localAnchor2 = new b2Vec2(); m_u = new b2Vec2(); super(def); m_localAnchor1.SetV(def.localAnchor1); m_localAnchor2.SetV(def.localAnchor2); m_length = def.length; m_frequencyHz = def.frequencyHz; m_dampingRatio = def.dampingRatio; m_impulse = 0; m_gamma = 0; m_bias = 0; m_inv_dt = 0; } override public function GetAnchor1():b2Vec2{ return (m_body1.GetWorldPoint(m_localAnchor1)); } override public function GetAnchor2():b2Vec2{ return (m_body2.GetWorldPoint(m_localAnchor2)); } override public function GetReactionForce():b2Vec2{ var F:b2Vec2; F = new b2Vec2(); F.SetV(m_u); F.Multiply((m_inv_dt * m_impulse)); return (F); } override public function SolvePositionConstraints():Boolean{ var tMat:b2Mat22; var b1:b2Body; var b2:b2Body; var r1X:Number; var r1Y:Number; var tX:Number; var r2X:Number; var r2Y:Number; var dX:Number; var dY:Number; var length:Number; var C:Number; var impulse:Number; var PX:Number; var PY:Number; if (m_frequencyHz > 0){ return (true); }; b1 = m_body1; b2 = m_body2; tMat = b1.m_xf.R; r1X = (m_localAnchor1.x - b1.m_sweep.localCenter.x); r1Y = (m_localAnchor1.y - b1.m_sweep.localCenter.y); tX = ((tMat.col1.x * r1X) + (tMat.col2.x * r1Y)); r1Y = ((tMat.col1.y * r1X) + (tMat.col2.y * r1Y)); r1X = tX; tMat = b2.m_xf.R; r2X = (m_localAnchor2.x - b2.m_sweep.localCenter.x); r2Y = (m_localAnchor2.y - b2.m_sweep.localCenter.y); tX = ((tMat.col1.x * r2X) + (tMat.col2.x * r2Y)); r2Y = ((tMat.col1.y * r2X) + (tMat.col2.y * r2Y)); r2X = tX; dX = (((b2.m_sweep.c.x + r2X) - b1.m_sweep.c.x) - r1X); dY = (((b2.m_sweep.c.y + r2Y) - b1.m_sweep.c.y) - r1Y); length = Math.sqrt(((dX * dX) + (dY * dY))); dX = (dX / length); dY = (dY / length); C = (length - m_length); C = b2Math.b2Clamp(C, -(b2Settings.b2_maxLinearCorrection), b2Settings.b2_maxLinearCorrection); impulse = (-(m_mass) * C); m_u.Set(dX, dY); PX = (impulse * m_u.x); PY = (impulse * m_u.y); b1.m_sweep.c.x = (b1.m_sweep.c.x - (b1.m_invMass * PX)); b1.m_sweep.c.y = (b1.m_sweep.c.y - (b1.m_invMass * PY)); b1.m_sweep.a = (b1.m_sweep.a - (b1.m_invI * ((r1X * PY) - (r1Y * PX)))); b2.m_sweep.c.x = (b2.m_sweep.c.x + (b2.m_invMass * PX)); b2.m_sweep.c.y = (b2.m_sweep.c.y + (b2.m_invMass * PY)); b2.m_sweep.a = (b2.m_sweep.a + (b2.m_invI * ((r2X * PY) - (r2Y * PX)))); b1.SynchronizeTransform(); b2.SynchronizeTransform(); return ((b2Math.b2Abs(C) < b2Settings.b2_linearSlop)); } override public function InitVelocityConstraints(step:b2TimeStep):void{ var tMat:b2Mat22; var tX:Number; var b1:b2Body; var b2:b2Body; var r1X:Number; var r1Y:Number; var r2X:Number; var r2Y:Number; var length:Number; var cr1u:Number; var cr2u:Number; var invMass:Number; var C:Number; var omega:Number; var d:Number; var k:Number; var PX:Number; var PY:Number; m_inv_dt = step.inv_dt; b1 = m_body1; b2 = m_body2; tMat = b1.m_xf.R; r1X = (m_localAnchor1.x - b1.m_sweep.localCenter.x); r1Y = (m_localAnchor1.y - b1.m_sweep.localCenter.y); tX = ((tMat.col1.x * r1X) + (tMat.col2.x * r1Y)); r1Y = ((tMat.col1.y * r1X) + (tMat.col2.y * r1Y)); r1X = tX; tMat = b2.m_xf.R; r2X = (m_localAnchor2.x - b2.m_sweep.localCenter.x); r2Y = (m_localAnchor2.y - b2.m_sweep.localCenter.y); tX = ((tMat.col1.x * r2X) + (tMat.col2.x * r2Y)); r2Y = ((tMat.col1.y * r2X) + (tMat.col2.y * r2Y)); r2X = tX; m_u.x = (((b2.m_sweep.c.x + r2X) - b1.m_sweep.c.x) - r1X); m_u.y = (((b2.m_sweep.c.y + r2Y) - b1.m_sweep.c.y) - r1Y); length = Math.sqrt(((m_u.x * m_u.x) + (m_u.y * m_u.y))); if (length > b2Settings.b2_linearSlop){ m_u.Multiply((1 / length)); } else { m_u.SetZero(); }; cr1u = ((r1X * m_u.y) - (r1Y * m_u.x)); cr2u = ((r2X * m_u.y) - (r2Y * m_u.x)); invMass = (((b1.m_invMass + ((b1.m_invI * cr1u) * cr1u)) + b2.m_invMass) + ((b2.m_invI * cr2u) * cr2u)); m_mass = (1 / invMass); if (m_frequencyHz > 0){ C = (length - m_length); omega = ((2 * Math.PI) * m_frequencyHz); d = (((2 * m_mass) * m_dampingRatio) * omega); k = ((m_mass * omega) * omega); m_gamma = (1 / (step.dt * (d + (step.dt * k)))); m_bias = (((C * step.dt) * k) * m_gamma); m_mass = (1 / (invMass + m_gamma)); }; if (step.warmStarting){ m_impulse = (m_impulse * step.dtRatio); PX = (m_impulse * m_u.x); PY = (m_impulse * m_u.y); b1.m_linearVelocity.x = (b1.m_linearVelocity.x - (b1.m_invMass * PX)); b1.m_linearVelocity.y = (b1.m_linearVelocity.y - (b1.m_invMass * PY)); b1.m_angularVelocity = (b1.m_angularVelocity - (b1.m_invI * ((r1X * PY) - (r1Y * PX)))); b2.m_linearVelocity.x = (b2.m_linearVelocity.x + (b2.m_invMass * PX)); b2.m_linearVelocity.y = (b2.m_linearVelocity.y + (b2.m_invMass * PY)); b2.m_angularVelocity = (b2.m_angularVelocity + (b2.m_invI * ((r2X * PY) - (r2Y * PX)))); } else { m_impulse = 0; }; } override public function GetReactionTorque():Number{ return (0); } override public function SolveVelocityConstraints(step:b2TimeStep):void{ var tMat:b2Mat22; var b1:b2Body; var b2:b2Body; var r1X:Number; var r1Y:Number; var tX:Number; var r2X:Number; var r2Y:Number; var v1X:Number; var v1Y:Number; var v2X:Number; var v2Y:Number; var Cdot:Number; var impulse:Number; var PX:Number; var PY:Number; b1 = m_body1; b2 = m_body2; tMat = b1.m_xf.R; r1X = (m_localAnchor1.x - b1.m_sweep.localCenter.x); r1Y = (m_localAnchor1.y - b1.m_sweep.localCenter.y); tX = ((tMat.col1.x * r1X) + (tMat.col2.x * r1Y)); r1Y = ((tMat.col1.y * r1X) + (tMat.col2.y * r1Y)); r1X = tX; tMat = b2.m_xf.R; r2X = (m_localAnchor2.x - b2.m_sweep.localCenter.x); r2Y = (m_localAnchor2.y - b2.m_sweep.localCenter.y); tX = ((tMat.col1.x * r2X) + (tMat.col2.x * r2Y)); r2Y = ((tMat.col1.y * r2X) + (tMat.col2.y * r2Y)); r2X = tX; v1X = (b1.m_linearVelocity.x + (-(b1.m_angularVelocity) * r1Y)); v1Y = (b1.m_linearVelocity.y + (b1.m_angularVelocity * r1X)); v2X = (b2.m_linearVelocity.x + (-(b2.m_angularVelocity) * r2Y)); v2Y = (b2.m_linearVelocity.y + (b2.m_angularVelocity * r2X)); Cdot = ((m_u.x * (v2X - v1X)) + (m_u.y * (v2Y - v1Y))); impulse = (-(m_mass) * ((Cdot + m_bias) + (m_gamma * m_impulse))); m_impulse = (m_impulse + impulse); PX = (impulse * m_u.x); PY = (impulse * m_u.y); b1.m_linearVelocity.x = (b1.m_linearVelocity.x - (b1.m_invMass * PX)); b1.m_linearVelocity.y = (b1.m_linearVelocity.y - (b1.m_invMass * PY)); b1.m_angularVelocity = (b1.m_angularVelocity - (b1.m_invI * ((r1X * PY) - (r1Y * PX)))); b2.m_linearVelocity.x = (b2.m_linearVelocity.x + (b2.m_invMass * PX)); b2.m_linearVelocity.y = (b2.m_linearVelocity.y + (b2.m_invMass * PY)); b2.m_angularVelocity = (b2.m_angularVelocity + (b2.m_invI * ((r2X * PY) - (r2Y * PX)))); } } }//package Box2D.Dynamics.Joints
Section 50
//b2DistanceJointDef (Box2D.Dynamics.Joints.b2DistanceJointDef) package Box2D.Dynamics.Joints { import Box2D.Dynamics.*; import Box2D.Common.Math.*; public class b2DistanceJointDef extends b2JointDef { public var length:Number; public var dampingRatio:Number; public var frequencyHz:Number; public var localAnchor2:b2Vec2; public var localAnchor1:b2Vec2; public function b2DistanceJointDef(){ localAnchor1 = new b2Vec2(); localAnchor2 = new b2Vec2(); super(); type = b2Joint.e_distanceJoint; length = 1; frequencyHz = 0; dampingRatio = 0; } public function Initialize(b1:b2Body, b2:b2Body, anchor1:b2Vec2, anchor2:b2Vec2):void{ var dX:Number; var dY:Number; body1 = b1; body2 = b2; localAnchor1.SetV(body1.GetLocalPoint(anchor1)); localAnchor2.SetV(body2.GetLocalPoint(anchor2)); dX = (anchor2.x - anchor1.x); dY = (anchor2.y - anchor1.y); length = Math.sqrt(((dX * dX) + (dY * dY))); frequencyHz = 0; dampingRatio = 0; } } }//package Box2D.Dynamics.Joints
Section 51
//b2GearJoint (Box2D.Dynamics.Joints.b2GearJoint) package Box2D.Dynamics.Joints { import Box2D.Dynamics.*; import Box2D.Common.Math.*; import Box2D.Common.*; public class b2GearJoint extends b2Joint { public var m_force:Number; public var m_mass:Number; public var m_prismatic1:b2PrismaticJoint; public var m_prismatic2:b2PrismaticJoint; public var m_ground1:b2Body; public var m_ground2:b2Body; public var m_constant:Number; public var m_revolute1:b2RevoluteJoint; public var m_revolute2:b2RevoluteJoint; public var m_groundAnchor1:b2Vec2; public var m_groundAnchor2:b2Vec2; public var m_localAnchor1:b2Vec2; public var m_localAnchor2:b2Vec2; public var m_ratio:Number; public var m_J:b2Jacobian; public function b2GearJoint(def:b2GearJointDef){ var type1:int; var type2:int; var coordinate1:Number; var coordinate2:Number; m_groundAnchor1 = new b2Vec2(); m_groundAnchor2 = new b2Vec2(); m_localAnchor1 = new b2Vec2(); m_localAnchor2 = new b2Vec2(); m_J = new b2Jacobian(); super(def); type1 = def.joint1.m_type; type2 = def.joint2.m_type; m_revolute1 = null; m_prismatic1 = null; m_revolute2 = null; m_prismatic2 = null; m_ground1 = def.joint1.m_body1; m_body1 = def.joint1.m_body2; if (type1 == b2Joint.e_revoluteJoint){ m_revolute1 = (def.joint1 as b2RevoluteJoint); m_groundAnchor1.SetV(m_revolute1.m_localAnchor1); m_localAnchor1.SetV(m_revolute1.m_localAnchor2); coordinate1 = m_revolute1.GetJointAngle(); } else { m_prismatic1 = (def.joint1 as b2PrismaticJoint); m_groundAnchor1.SetV(m_prismatic1.m_localAnchor1); m_localAnchor1.SetV(m_prismatic1.m_localAnchor2); coordinate1 = m_prismatic1.GetJointTranslation(); }; m_ground2 = def.joint2.m_body1; m_body2 = def.joint2.m_body2; if (type2 == b2Joint.e_revoluteJoint){ m_revolute2 = (def.joint2 as b2RevoluteJoint); m_groundAnchor2.SetV(m_revolute2.m_localAnchor1); m_localAnchor2.SetV(m_revolute2.m_localAnchor2); coordinate2 = m_revolute2.GetJointAngle(); } else { m_prismatic2 = (def.joint2 as b2PrismaticJoint); m_groundAnchor2.SetV(m_prismatic2.m_localAnchor1); m_localAnchor2.SetV(m_prismatic2.m_localAnchor2); coordinate2 = m_prismatic2.GetJointTranslation(); }; m_ratio = def.ratio; m_constant = (coordinate1 + (m_ratio * coordinate2)); m_force = 0; } override public function GetAnchor1():b2Vec2{ return (m_body1.GetWorldPoint(m_localAnchor1)); } override public function GetAnchor2():b2Vec2{ return (m_body2.GetWorldPoint(m_localAnchor2)); } override public function GetReactionForce():b2Vec2{ var F:b2Vec2; F = new b2Vec2((m_force * m_J.linear2.x), (m_force * m_J.linear2.y)); return (F); } override public function SolvePositionConstraints():Boolean{ var linearError:Number; var b1:b2Body; var b2:b2Body; var coordinate1:Number; var coordinate2:Number; var C:Number; var impulse:Number; linearError = 0; b1 = m_body1; b2 = m_body2; if (m_revolute1){ coordinate1 = m_revolute1.GetJointAngle(); } else { coordinate1 = m_prismatic1.GetJointTranslation(); }; if (m_revolute2){ coordinate2 = m_revolute2.GetJointAngle(); } else { coordinate2 = m_prismatic2.GetJointTranslation(); }; C = (m_constant - (coordinate1 + (m_ratio * coordinate2))); impulse = (-(m_mass) * C); b1.m_sweep.c.x = (b1.m_sweep.c.x + ((b1.m_invMass * impulse) * m_J.linear1.x)); b1.m_sweep.c.y = (b1.m_sweep.c.y + ((b1.m_invMass * impulse) * m_J.linear1.y)); b1.m_sweep.a = (b1.m_sweep.a + ((b1.m_invI * impulse) * m_J.angular1)); b2.m_sweep.c.x = (b2.m_sweep.c.x + ((b2.m_invMass * impulse) * m_J.linear2.x)); b2.m_sweep.c.y = (b2.m_sweep.c.y + ((b2.m_invMass * impulse) * m_J.linear2.y)); b2.m_sweep.a = (b2.m_sweep.a + ((b2.m_invI * impulse) * m_J.angular2)); b1.SynchronizeTransform(); b2.SynchronizeTransform(); return ((linearError < b2Settings.b2_linearSlop)); } override public function InitVelocityConstraints(step:b2TimeStep):void{ var g1:b2Body; var g2:b2Body; var b1:b2Body; var b2:b2Body; var ugX:Number; var ugY:Number; var rX:Number; var rY:Number; var tMat:b2Mat22; var tVec:b2Vec2; var crug:Number; var tX:Number; var K:Number; var P:Number; g1 = m_ground1; g2 = m_ground2; b1 = m_body1; b2 = m_body2; K = 0; m_J.SetZero(); if (m_revolute1){ m_J.angular1 = -1; K = (K + b1.m_invI); } else { tMat = g1.m_xf.R; tVec = m_prismatic1.m_localXAxis1; ugX = ((tMat.col1.x * tVec.x) + (tMat.col2.x * tVec.y)); ugY = ((tMat.col1.y * tVec.x) + (tMat.col2.y * tVec.y)); tMat = b1.m_xf.R; rX = (m_localAnchor1.x - b1.m_sweep.localCenter.x); rY = (m_localAnchor1.y - b1.m_sweep.localCenter.y); tX = ((tMat.col1.x * rX) + (tMat.col2.x * rY)); rY = ((tMat.col1.y * rX) + (tMat.col2.y * rY)); rX = tX; crug = ((rX * ugY) - (rY * ugX)); m_J.linear1.Set(-(ugX), -(ugY)); m_J.angular1 = -(crug); K = (K + (b1.m_invMass + ((b1.m_invI * crug) * crug))); }; if (m_revolute2){ m_J.angular2 = -(m_ratio); K = (K + ((m_ratio * m_ratio) * b2.m_invI)); } else { tMat = g2.m_xf.R; tVec = m_prismatic2.m_localXAxis1; ugX = ((tMat.col1.x * tVec.x) + (tMat.col2.x * tVec.y)); ugY = ((tMat.col1.y * tVec.x) + (tMat.col2.y * tVec.y)); tMat = b2.m_xf.R; rX = (m_localAnchor2.x - b2.m_sweep.localCenter.x); rY = (m_localAnchor2.y - b2.m_sweep.localCenter.y); tX = ((tMat.col1.x * rX) + (tMat.col2.x * rY)); rY = ((tMat.col1.y * rX) + (tMat.col2.y * rY)); rX = tX; crug = ((rX * ugY) - (rY * ugX)); m_J.linear2.Set((-(m_ratio) * ugX), (-(m_ratio) * ugY)); m_J.angular2 = (-(m_ratio) * crug); K = (K + ((m_ratio * m_ratio) * (b2.m_invMass + ((b2.m_invI * crug) * crug)))); }; m_mass = (1 / K); if (step.warmStarting){ P = (step.dt * m_force); b1.m_linearVelocity.x = (b1.m_linearVelocity.x + ((b1.m_invMass * P) * m_J.linear1.x)); b1.m_linearVelocity.y = (b1.m_linearVelocity.y + ((b1.m_invMass * P) * m_J.linear1.y)); b1.m_angularVelocity = (b1.m_angularVelocity + ((b1.m_invI * P) * m_J.angular1)); b2.m_linearVelocity.x = (b2.m_linearVelocity.x + ((b2.m_invMass * P) * m_J.linear2.x)); b2.m_linearVelocity.y = (b2.m_linearVelocity.y + ((b2.m_invMass * P) * m_J.linear2.y)); b2.m_angularVelocity = (b2.m_angularVelocity + ((b2.m_invI * P) * m_J.angular2)); } else { m_force = 0; }; } override public function GetReactionTorque():Number{ var tMat:b2Mat22; var rX:Number; var rY:Number; var tX:Number; tMat = m_body2.m_xf.R; rX = (m_localAnchor1.x - m_body2.m_sweep.localCenter.x); rY = (m_localAnchor1.y - m_body2.m_sweep.localCenter.y); tX = ((tMat.col1.x * rX) + (tMat.col2.x * rY)); rY = ((tMat.col1.y * rX) + (tMat.col2.y * rY)); rX = tX; tX = ((m_force * m_J.angular2) - ((rX * (m_force * m_J.linear2.y)) - (rY * (m_force * m_J.linear2.x)))); return (tX); } public function GetRatio():Number{ return (m_ratio); } override public function SolveVelocityConstraints(step:b2TimeStep):void{ var b1:b2Body; var b2:b2Body; var Cdot:Number; var force:Number; var P:Number; b1 = m_body1; b2 = m_body2; Cdot = m_J.Compute(b1.m_linearVelocity, b1.m_angularVelocity, b2.m_linearVelocity, b2.m_angularVelocity); force = ((-(step.inv_dt) * m_mass) * Cdot); m_force = (m_force + force); P = (step.dt * force); b1.m_linearVelocity.x = (b1.m_linearVelocity.x + ((b1.m_invMass * P) * m_J.linear1.x)); b1.m_linearVelocity.y = (b1.m_linearVelocity.y + ((b1.m_invMass * P) * m_J.linear1.y)); b1.m_angularVelocity = (b1.m_angularVelocity + ((b1.m_invI * P) * m_J.angular1)); b2.m_linearVelocity.x = (b2.m_linearVelocity.x + ((b2.m_invMass * P) * m_J.linear2.x)); b2.m_linearVelocity.y = (b2.m_linearVelocity.y + ((b2.m_invMass * P) * m_J.linear2.y)); b2.m_angularVelocity = (b2.m_angularVelocity + ((b2.m_invI * P) * m_J.angular2)); } } }//package Box2D.Dynamics.Joints
Section 52
//b2GearJointDef (Box2D.Dynamics.Joints.b2GearJointDef) package Box2D.Dynamics.Joints { public class b2GearJointDef extends b2JointDef { public var joint2:b2Joint; public var joint1:b2Joint; public var ratio:Number; public function b2GearJointDef(){ super(); type = b2Joint.e_gearJoint; joint1 = null; joint2 = null; ratio = 1; } } }//package Box2D.Dynamics.Joints
Section 53
//b2Jacobian (Box2D.Dynamics.Joints.b2Jacobian) package Box2D.Dynamics.Joints { import Box2D.Common.Math.*; public class b2Jacobian { public var linear1:b2Vec2; public var linear2:b2Vec2; public var angular2:Number; public var angular1:Number; public function b2Jacobian(){ linear1 = new b2Vec2(); linear2 = new b2Vec2(); super(); } public function Set(x1:b2Vec2, a1:Number, x2:b2Vec2, a2:Number):void{ linear1.SetV(x1); angular1 = a1; linear2.SetV(x2); angular2 = a2; } public function SetZero():void{ linear1.SetZero(); angular1 = 0; linear2.SetZero(); angular2 = 0; } public function Compute(x1:b2Vec2, a1:Number, x2:b2Vec2, a2:Number):Number{ return ((((((linear1.x * x1.x) + (linear1.y * x1.y)) + (angular1 * a1)) + ((linear2.x * x2.x) + (linear2.y * x2.y))) + (angular2 * a2))); } } }//package Box2D.Dynamics.Joints
Section 54
//b2Joint (Box2D.Dynamics.Joints.b2Joint) package Box2D.Dynamics.Joints { import Box2D.Dynamics.*; import Box2D.Common.Math.*; public class b2Joint { public var m_islandFlag:Boolean; public var m_body1:b2Body; public var m_prev:b2Joint; public var m_next:b2Joint; public var m_type:int; public var m_collideConnected:Boolean; public var m_node1:b2JointEdge; public var m_node2:b2JointEdge; public var m_inv_dt:Number; public var m_userData; public var m_body2:b2Body; public static const e_unknownJoint:int = 0; public static const e_inactiveLimit:int = 0; public static const e_atUpperLimit:int = 2; public static const e_atLowerLimit:int = 1; public static const e_gearJoint:int = 6; public static const e_revoluteJoint:int = 1; public static const e_equalLimits:int = 3; public static const e_distanceJoint:int = 3; public static const e_pulleyJoint:int = 4; public static const e_prismaticJoint:int = 2; public static const e_mouseJoint:int = 5; public function b2Joint(def:b2JointDef){ m_node1 = new b2JointEdge(); m_node2 = new b2JointEdge(); super(); m_type = def.type; m_prev = null; m_next = null; m_body1 = def.body1; m_body2 = def.body2; m_collideConnected = def.collideConnected; m_islandFlag = false; m_userData = def.userData; } public function GetAnchor1():b2Vec2{ return (null); } public function GetAnchor2():b2Vec2{ return (null); } public function InitVelocityConstraints(step:b2TimeStep):void{ } public function GetType():int{ return (m_type); } public function GetBody2():b2Body{ return (m_body2); } public function GetNext():b2Joint{ return (m_next); } public function GetReactionTorque():Number{ return (0); } public function GetUserData(){ return (m_userData); } public function GetReactionForce():b2Vec2{ return (null); } public function SolvePositionConstraints():Boolean{ return (false); } public function SetUserData(data):void{ m_userData = data; } public function GetBody1():b2Body{ return (m_body1); } public function SolveVelocityConstraints(step:b2TimeStep):void{ } public function InitPositionConstraints():void{ } public static function Destroy(joint:b2Joint, allocator):void{ } public static function Create(def:b2JointDef, allocator):b2Joint{ var joint:b2Joint; joint = null; switch (def.type){ case e_distanceJoint: joint = new b2DistanceJoint((def as b2DistanceJointDef)); break; case e_mouseJoint: joint = new b2MouseJoint((def as b2MouseJointDef)); break; case e_prismaticJoint: joint = new b2PrismaticJoint((def as b2PrismaticJointDef)); break; case e_revoluteJoint: joint = new b2RevoluteJoint((def as b2RevoluteJointDef)); break; case e_pulleyJoint: joint = new b2PulleyJoint((def as b2PulleyJointDef)); break; case e_gearJoint: joint = new b2GearJoint((def as b2GearJointDef)); break; default: break; }; return (joint); } } }//package Box2D.Dynamics.Joints
Section 55
//b2JointDef (Box2D.Dynamics.Joints.b2JointDef) package Box2D.Dynamics.Joints { import Box2D.Dynamics.*; public class b2JointDef { public var collideConnected:Boolean; public var body1:b2Body; public var body2:b2Body; public var userData; public var type:int; public function b2JointDef(){ super(); type = b2Joint.e_unknownJoint; userData = null; body1 = null; body2 = null; collideConnected = false; } } }//package Box2D.Dynamics.Joints
Section 56
//b2JointEdge (Box2D.Dynamics.Joints.b2JointEdge) package Box2D.Dynamics.Joints { import Box2D.Dynamics.*; public class b2JointEdge { public var joint:b2Joint; public var other:b2Body; public var next:b2JointEdge; public var prev:b2JointEdge; public function b2JointEdge(){ super(); } } }//package Box2D.Dynamics.Joints
Section 57
//b2MouseJoint (Box2D.Dynamics.Joints.b2MouseJoint) package Box2D.Dynamics.Joints { import Box2D.Dynamics.*; import Box2D.Common.Math.*; import Box2D.Common.*; public class b2MouseJoint extends b2Joint { public var m_beta:Number; public var m_mass:b2Mat22; public var m_target:b2Vec2; public var m_impulse:b2Vec2; public var m_localAnchor:b2Vec2; private var K1:b2Mat22; private var K2:b2Mat22; private var K:b2Mat22; public var m_gamma:Number; public var m_C:b2Vec2; public var m_maxForce:Number; public function b2MouseJoint(def:b2MouseJointDef){ var tX:Number; var tY:Number; var tMat:b2Mat22; var mass:Number; var omega:Number; var d:Number; var k:Number; K = new b2Mat22(); K1 = new b2Mat22(); K2 = new b2Mat22(); m_localAnchor = new b2Vec2(); m_target = new b2Vec2(); m_impulse = new b2Vec2(); m_mass = new b2Mat22(); m_C = new b2Vec2(); super(def); m_target.SetV(def.target); tX = (m_target.x - m_body2.m_xf.position.x); tY = (m_target.y - m_body2.m_xf.position.y); tMat = m_body2.m_xf.R; m_localAnchor.x = ((tX * tMat.col1.x) + (tY * tMat.col1.y)); m_localAnchor.y = ((tX * tMat.col2.x) + (tY * tMat.col2.y)); m_maxForce = def.maxForce; m_impulse.SetZero(); mass = m_body2.m_mass; omega = ((2 * b2Settings.b2_pi) * def.frequencyHz); d = (((2 * mass) * def.dampingRatio) * omega); k = ((def.timeStep * mass) * (omega * omega)); m_gamma = (1 / (d + k)); m_beta = (k / (d + k)); } override public function GetAnchor1():b2Vec2{ return (m_target); } override public function GetAnchor2():b2Vec2{ return (m_body2.GetWorldPoint(m_localAnchor)); } override public function GetReactionForce():b2Vec2{ return (m_impulse); } override public function SolvePositionConstraints():Boolean{ return (true); } override public function InitVelocityConstraints(step:b2TimeStep):void{ var b:b2Body; var tMat:b2Mat22; var rX:Number; var rY:Number; var tX:Number; var invMass:Number; var invI:Number; var PX:Number; var PY:Number; b = m_body2; tMat = b.m_xf.R; rX = (m_localAnchor.x - b.m_sweep.localCenter.x); rY = (m_localAnchor.y - b.m_sweep.localCenter.y); tX = ((tMat.col1.x * rX) + (tMat.col2.x * rY)); rY = ((tMat.col1.y * rX) + (tMat.col2.y * rY)); rX = tX; invMass = b.m_invMass; invI = b.m_invI; K1.col1.x = invMass; K1.col2.x = 0; K1.col1.y = 0; K1.col2.y = invMass; K2.col1.x = ((invI * rY) * rY); K2.col2.x = ((-(invI) * rX) * rY); K2.col1.y = ((-(invI) * rX) * rY); K2.col2.y = ((invI * rX) * rX); K.SetM(K1); K.AddM(K2); K.col1.x = (K.col1.x + m_gamma); K.col2.y = (K.col2.y + m_gamma); K.Invert(m_mass); m_C.x = ((b.m_sweep.c.x + rX) - m_target.x); m_C.y = ((b.m_sweep.c.y + rY) - m_target.y); b.m_angularVelocity = (b.m_angularVelocity * 0.98); PX = (step.dt * m_impulse.x); PY = (step.dt * m_impulse.y); b.m_linearVelocity.x = (b.m_linearVelocity.x + (invMass * PX)); b.m_linearVelocity.y = (b.m_linearVelocity.y + (invMass * PY)); b.m_angularVelocity = (b.m_angularVelocity + (invI * ((rX * PY) - (rY * PX)))); } override public function GetReactionTorque():Number{ return (0); } public function SetTarget(target:b2Vec2):void{ if (m_body2.IsSleeping()){ m_body2.WakeUp(); }; m_target = target; } override public function SolveVelocityConstraints(step:b2TimeStep):void{ var b:b2Body; var tMat:b2Mat22; var tX:Number; var tY:Number; var rX:Number; var rY:Number; var CdotX:Number; var CdotY:Number; var forceX:Number; var forceY:Number; var oldForceX:Number; var oldForceY:Number; var forceMagnitude:Number; var PX:Number; var PY:Number; b = m_body2; tMat = b.m_xf.R; rX = (m_localAnchor.x - b.m_sweep.localCenter.x); rY = (m_localAnchor.y - b.m_sweep.localCenter.y); tX = ((tMat.col1.x * rX) + (tMat.col2.x * rY)); rY = ((tMat.col1.y * rX) + (tMat.col2.y * rY)); rX = tX; CdotX = (b.m_linearVelocity.x + (-(b.m_angularVelocity) * rY)); CdotY = (b.m_linearVelocity.y + (b.m_angularVelocity * rX)); tMat = m_mass; tX = ((CdotX + ((m_beta * step.inv_dt) * m_C.x)) + ((m_gamma * step.dt) * m_impulse.x)); tY = ((CdotY + ((m_beta * step.inv_dt) * m_C.y)) + ((m_gamma * step.dt) * m_impulse.y)); forceX = (-(step.inv_dt) * ((tMat.col1.x * tX) + (tMat.col2.x * tY))); forceY = (-(step.inv_dt) * ((tMat.col1.y * tX) + (tMat.col2.y * tY))); oldForceX = m_impulse.x; oldForceY = m_impulse.y; m_impulse.x = (m_impulse.x + forceX); m_impulse.y = (m_impulse.y + forceY); forceMagnitude = m_impulse.Length(); if (forceMagnitude > m_maxForce){ m_impulse.Multiply((m_maxForce / forceMagnitude)); }; forceX = (m_impulse.x - oldForceX); forceY = (m_impulse.y - oldForceY); PX = (step.dt * forceX); PY = (step.dt * forceY); b.m_linearVelocity.x = (b.m_linearVelocity.x + (b.m_invMass * PX)); b.m_linearVelocity.y = (b.m_linearVelocity.y + (b.m_invMass * PY)); b.m_angularVelocity = (b.m_angularVelocity + (b.m_invI * ((rX * PY) - (rY * PX)))); } } }//package Box2D.Dynamics.Joints
Section 58
//b2MouseJointDef (Box2D.Dynamics.Joints.b2MouseJointDef) package Box2D.Dynamics.Joints { import Box2D.Common.Math.*; public class b2MouseJointDef extends b2JointDef { public var frequencyHz:Number; public var dampingRatio:Number; public var maxForce:Number; public var target:b2Vec2; public var timeStep:Number; public function b2MouseJointDef(){ target = new b2Vec2(); super(); type = b2Joint.e_mouseJoint; maxForce = 0; frequencyHz = 5; dampingRatio = 0.7; timeStep = (1 / 60); } } }//package Box2D.Dynamics.Joints
Section 59
//b2PrismaticJoint (Box2D.Dynamics.Joints.b2PrismaticJoint) package Box2D.Dynamics.Joints { import Box2D.Dynamics.*; import Box2D.Common.Math.*; import Box2D.Common.*; public class b2PrismaticJoint extends b2Joint { public var m_limitForce:Number; public var m_refAngle:Number; public var m_lowerTranslation:Number; public var m_localXAxis1:b2Vec2; public var m_torque:Number; public var m_enableLimit:Boolean; public var m_motorForce:Number; public var m_force:Number; public var m_localYAxis1:b2Vec2; public var m_motorMass:Number; public var m_maxMotorForce:Number; public var m_localAnchor1:b2Vec2; public var m_localAnchor2:b2Vec2; public var m_angularMass:Number; public var m_limitState:int; public var m_linearMass:Number; public var m_upperTranslation:Number; public var m_motorJacobian:b2Jacobian; public var m_limitPositionImpulse:Number; public var m_motorSpeed:Number; public var m_linearJacobian:b2Jacobian; public var m_enableMotor:Boolean; public function b2PrismaticJoint(def:b2PrismaticJointDef){ var tMat:b2Mat22; var tX:Number; var tY:Number; m_localAnchor1 = new b2Vec2(); m_localAnchor2 = new b2Vec2(); m_localXAxis1 = new b2Vec2(); m_localYAxis1 = new b2Vec2(); m_linearJacobian = new b2Jacobian(); m_motorJacobian = new b2Jacobian(); super(def); m_localAnchor1.SetV(def.localAnchor1); m_localAnchor2.SetV(def.localAnchor2); m_localXAxis1.SetV(def.localAxis1); m_localYAxis1.x = -(m_localXAxis1.y); m_localYAxis1.y = m_localXAxis1.x; m_refAngle = def.referenceAngle; m_linearJacobian.SetZero(); m_linearMass = 0; m_force = 0; m_angularMass = 0; m_torque = 0; m_motorJacobian.SetZero(); m_motorMass = 0; m_motorForce = 0; m_limitForce = 0; m_limitPositionImpulse = 0; m_lowerTranslation = def.lowerTranslation; m_upperTranslation = def.upperTranslation; m_maxMotorForce = def.maxMotorForce; m_motorSpeed = def.motorSpeed; m_enableLimit = def.enableLimit; m_enableMotor = def.enableMotor; } override public function GetAnchor1():b2Vec2{ return (m_body1.GetWorldPoint(m_localAnchor1)); } override public function GetAnchor2():b2Vec2{ return (m_body2.GetWorldPoint(m_localAnchor2)); } public function EnableMotor(flag:Boolean):void{ m_enableMotor = flag; } public function GetUpperLimit():Number{ return (m_upperTranslation); } public function GetLowerLimit():Number{ return (m_lowerTranslation); } public function GetJointTranslation():Number{ var b1:b2Body; var b2:b2Body; var tMat:b2Mat22; var p1:b2Vec2; var p2:b2Vec2; var dX:Number; var dY:Number; var axis:b2Vec2; var translation:Number; b1 = m_body1; b2 = m_body2; p1 = b1.GetWorldPoint(m_localAnchor1); p2 = b2.GetWorldPoint(m_localAnchor2); dX = (p2.x - p1.x); dY = (p2.y - p1.y); axis = b1.GetWorldVector(m_localXAxis1); translation = ((axis.x * dX) + (axis.y * dY)); return (translation); } public function SetLimits(lower:Number, upper:Number):void{ m_lowerTranslation = lower; m_upperTranslation = upper; } public function GetMotorSpeed():Number{ return (m_motorSpeed); } override public function GetReactionForce():b2Vec2{ var tMat:b2Mat22; var ax1X:Number; var ax1Y:Number; var ay1X:Number; var ay1Y:Number; tMat = m_body1.m_xf.R; ax1X = (m_limitForce * ((tMat.col1.x * m_localXAxis1.x) + (tMat.col2.x * m_localXAxis1.y))); ax1Y = (m_limitForce * ((tMat.col1.y * m_localXAxis1.x) + (tMat.col2.y * m_localXAxis1.y))); ay1X = (m_force * ((tMat.col1.x * m_localYAxis1.x) + (tMat.col2.x * m_localYAxis1.y))); ay1Y = (m_force * ((tMat.col1.y * m_localYAxis1.x) + (tMat.col2.y * m_localYAxis1.y))); return (new b2Vec2(((m_limitForce * ax1X) + (m_force * ay1X)), ((m_limitForce * ax1Y) + (m_force * ay1Y)))); } override public function SolvePositionConstraints():Boolean{ var limitC:Number; var oldLimitImpulse:Number; var b1:b2Body; var b2:b2Body; var invMass1:Number; var invMass2:Number; var invI1:Number; var invI2:Number; var tMat:b2Mat22; var tX:Number; var r1X:Number; var r1Y:Number; var r2X:Number; var r2Y:Number; var p1X:Number; var p1Y:Number; var p2X:Number; var p2Y:Number; var dX:Number; var dY:Number; var ay1X:Number; var ay1Y:Number; var linearC:Number; var linearImpulse:Number; var positionError:Number; var angularC:Number; var angularImpulse:Number; var angularError:Number; var ax1X:Number; var ax1Y:Number; var translation:Number; var limitImpulse:Number; b1 = m_body1; b2 = m_body2; invMass1 = b1.m_invMass; invMass2 = b2.m_invMass; invI1 = b1.m_invI; invI2 = b2.m_invI; tMat = b1.m_xf.R; r1X = (m_localAnchor1.x - b1.m_sweep.localCenter.x); r1Y = (m_localAnchor1.y - b1.m_sweep.localCenter.y); tX = ((tMat.col1.x * r1X) + (tMat.col2.x * r1Y)); r1Y = ((tMat.col1.y * r1X) + (tMat.col2.y * r1Y)); r1X = tX; tMat = b2.m_xf.R; r2X = (m_localAnchor2.x - b2.m_sweep.localCenter.x); r2Y = (m_localAnchor2.y - b2.m_sweep.localCenter.y); tX = ((tMat.col1.x * r2X) + (tMat.col2.x * r2Y)); r2Y = ((tMat.col1.y * r2X) + (tMat.col2.y * r2Y)); r2X = tX; p1X = (b1.m_sweep.c.x + r1X); p1Y = (b1.m_sweep.c.y + r1Y); p2X = (b2.m_sweep.c.x + r2X); p2Y = (b2.m_sweep.c.y + r2Y); dX = (p2X - p1X); dY = (p2Y - p1Y); tMat = b1.m_xf.R; ay1X = ((tMat.col1.x * m_localYAxis1.x) + (tMat.col2.x * m_localYAxis1.y)); ay1Y = ((tMat.col1.y * m_localYAxis1.x) + (tMat.col2.y * m_localYAxis1.y)); linearC = ((ay1X * dX) + (ay1Y * dY)); linearC = b2Math.b2Clamp(linearC, -(b2Settings.b2_maxLinearCorrection), b2Settings.b2_maxLinearCorrection); linearImpulse = (-(m_linearMass) * linearC); b1.m_sweep.c.x = (b1.m_sweep.c.x + ((invMass1 * linearImpulse) * m_linearJacobian.linear1.x)); b1.m_sweep.c.y = (b1.m_sweep.c.y + ((invMass1 * linearImpulse) * m_linearJacobian.linear1.y)); b1.m_sweep.a = (b1.m_sweep.a + ((invI1 * linearImpulse) * m_linearJacobian.angular1)); b2.m_sweep.c.x = (b2.m_sweep.c.x + ((invMass2 * linearImpulse) * m_linearJacobian.linear2.x)); b2.m_sweep.c.y = (b2.m_sweep.c.y + ((invMass2 * linearImpulse) * m_linearJacobian.linear2.y)); b2.m_sweep.a = (b2.m_sweep.a + ((invI2 * linearImpulse) * m_linearJacobian.angular2)); positionError = b2Math.b2Abs(linearC); angularC = ((b2.m_sweep.a - b1.m_sweep.a) - m_refAngle); angularC = b2Math.b2Clamp(angularC, -(b2Settings.b2_maxAngularCorrection), b2Settings.b2_maxAngularCorrection); angularImpulse = (-(m_angularMass) * angularC); b1.m_sweep.a = (b1.m_sweep.a - (b1.m_invI * angularImpulse)); b2.m_sweep.a = (b2.m_sweep.a + (b2.m_invI * angularImpulse)); b1.SynchronizeTransform(); b2.SynchronizeTransform(); angularError = b2Math.b2Abs(angularC); if (((m_enableLimit) && (!((m_limitState == e_inactiveLimit))))){ tMat = b1.m_xf.R; r1X = (m_localAnchor1.x - b1.m_sweep.localCenter.x); r1Y = (m_localAnchor1.y - b1.m_sweep.localCenter.y); tX = ((tMat.col1.x * r1X) + (tMat.col2.x * r1Y)); r1Y = ((tMat.col1.y * r1X) + (tMat.col2.y * r1Y)); r1X = tX; tMat = b2.m_xf.R; r2X = (m_localAnchor2.x - b2.m_sweep.localCenter.x); r2Y = (m_localAnchor2.y - b2.m_sweep.localCenter.y); tX = ((tMat.col1.x * r2X) + (tMat.col2.x * r2Y)); r2Y = ((tMat.col1.y * r2X) + (tMat.col2.y * r2Y)); r2X = tX; p1X = (b1.m_sweep.c.x + r1X); p1Y = (b1.m_sweep.c.y + r1Y); p2X = (b2.m_sweep.c.x + r2X); p2Y = (b2.m_sweep.c.y + r2Y); dX = (p2X - p1X); dY = (p2Y - p1Y); tMat = b1.m_xf.R; ax1X = ((tMat.col1.x * m_localXAxis1.x) + (tMat.col2.x * m_localXAxis1.y)); ax1Y = ((tMat.col1.y * m_localXAxis1.x) + (tMat.col2.y * m_localXAxis1.y)); translation = ((ax1X * dX) + (ax1Y * dY)); limitImpulse = 0; if (m_limitState == e_equalLimits){ limitC = b2Math.b2Clamp(translation, -(b2Settings.b2_maxLinearCorrection), b2Settings.b2_maxLinearCorrection); limitImpulse = (-(m_motorMass) * limitC); positionError = b2Math.b2Max(positionError, b2Math.b2Abs(angularC)); } else { if (m_limitState == e_atLowerLimit){ limitC = (translation - m_lowerTranslation); positionError = b2Math.b2Max(positionError, -(limitC)); limitC = b2Math.b2Clamp((limitC + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0); limitImpulse = (-(m_motorMass) * limitC); oldLimitImpulse = m_limitPositionImpulse; m_limitPositionImpulse = b2Math.b2Max((m_limitPositionImpulse + limitImpulse), 0); limitImpulse = (m_limitPositionImpulse - oldLimitImpulse); } else { if (m_limitState == e_atUpperLimit){ limitC = (translation - m_upperTranslation); positionError = b2Math.b2Max(positionError, limitC); limitC = b2Math.b2Clamp((limitC - b2Settings.b2_linearSlop), 0, b2Settings.b2_maxLinearCorrection); limitImpulse = (-(m_motorMass) * limitC); oldLimitImpulse = m_limitPositionImpulse; m_limitPositionImpulse = b2Math.b2Min((m_limitPositionImpulse + limitImpulse), 0); limitImpulse = (m_limitPositionImpulse - oldLimitImpulse); }; }; }; b1.m_sweep.c.x = (b1.m_sweep.c.x + ((invMass1 * limitImpulse) * m_motorJacobian.linear1.x)); b1.m_sweep.c.y = (b1.m_sweep.c.y + ((invMass1 * limitImpulse) * m_motorJacobian.linear1.y)); b1.m_sweep.a = (b1.m_sweep.a + ((invI1 * limitImpulse) * m_motorJacobian.angular1)); b2.m_sweep.c.x = (b2.m_sweep.c.x + ((invMass2 * limitImpulse) * m_motorJacobian.linear2.x)); b2.m_sweep.c.y = (b2.m_sweep.c.y + ((invMass2 * limitImpulse) * m_motorJacobian.linear2.y)); b2.m_sweep.a = (b2.m_sweep.a + ((invI2 * limitImpulse) * m_motorJacobian.angular2)); b1.SynchronizeTransform(); b2.SynchronizeTransform(); }; return ((((positionError <= b2Settings.b2_linearSlop)) && ((angularError <= b2Settings.b2_angularSlop)))); } public function GetJointSpeed():Number{ var b1:b2Body; var b2:b2Body; var tMat:b2Mat22; var r1X:Number; var r1Y:Number; var tX:Number; var r2X:Number; var r2Y:Number; var p1X:Number; var p1Y:Number; var p2X:Number; var p2Y:Number; var dX:Number; var dY:Number; var axis:b2Vec2; var v1:b2Vec2; var v2:b2Vec2; var w1:Number; var w2:Number; var speed:Number; b1 = m_body1; b2 = m_body2; tMat = b1.m_xf.R; r1X = (m_localAnchor1.x - b1.m_sweep.localCenter.x); r1Y = (m_localAnchor1.y - b1.m_sweep.localCenter.y); tX = ((tMat.col1.x * r1X) + (tMat.col2.x * r1Y)); r1Y = ((tMat.col1.y * r1X) + (tMat.col2.y * r1Y)); r1X = tX; tMat = b2.m_xf.R; r2X = (m_localAnchor2.x - b2.m_sweep.localCenter.x); r2Y = (m_localAnchor2.y - b2.m_sweep.localCenter.y); tX = ((tMat.col1.x * r2X) + (tMat.col2.x * r2Y)); r2Y = ((tMat.col1.y * r2X) + (tMat.col2.y * r2Y)); r2X = tX; p1X = (b1.m_sweep.c.x + r1X); p1Y = (b1.m_sweep.c.y + r1Y); p2X = (b2.m_sweep.c.x + r2X); p2Y = (b2.m_sweep.c.y + r2Y); dX = (p2X - p1X); dY = (p2Y - p1Y); axis = b1.GetWorldVector(m_localXAxis1); v1 = b1.m_linearVelocity; v2 = b2.m_linearVelocity; w1 = b1.m_angularVelocity; w2 = b2.m_angularVelocity; speed = (((dX * (-(w1) * axis.y)) + (dY * (w1 * axis.x))) + ((axis.x * (((v2.x + (-(w2) * r2Y)) - v1.x) - (-(w1) * r1Y))) + (axis.y * (((v2.y + (w2 * r2X)) - v1.y) - (w1 * r1X))))); return (speed); } public function SetMotorSpeed(speed:Number):void{ m_motorSpeed = speed; } override public function InitVelocityConstraints(step:b2TimeStep):void{ var b1:b2Body; var b2:b2Body; var tMat:b2Mat22; var tX:Number; var r1X:Number; var r1Y:Number; var r2X:Number; var r2Y:Number; var invMass1:Number; var invMass2:Number; var invI1:Number; var invI2:Number; var ay1X:Number; var ay1Y:Number; var eX:Number; var eY:Number; var ax1X:Number; var ax1Y:Number; var dX:Number; var dY:Number; var jointTranslation:Number; var P1X:Number; var P1Y:Number; var P2X:Number; var P2Y:Number; var L1:Number; var L2:Number; b1 = m_body1; b2 = m_body2; tMat = b1.m_xf.R; r1X = (m_localAnchor1.x - b1.m_sweep.localCenter.x); r1Y = (m_localAnchor1.y - b1.m_sweep.localCenter.y); tX = ((tMat.col1.x * r1X) + (tMat.col2.x * r1Y)); r1Y = ((tMat.col1.y * r1X) + (tMat.col2.y * r1Y)); r1X = tX; tMat = b2.m_xf.R; r2X = (m_localAnchor2.x - b2.m_sweep.localCenter.x); r2Y = (m_localAnchor2.y - b2.m_sweep.localCenter.y); tX = ((tMat.col1.x * r2X) + (tMat.col2.x * r2Y)); r2Y = ((tMat.col1.y * r2X) + (tMat.col2.y * r2Y)); r2X = tX; invMass1 = b1.m_invMass; invMass2 = b2.m_invMass; invI1 = b1.m_invI; invI2 = b2.m_invI; tMat = b1.m_xf.R; ay1X = ((tMat.col1.x * m_localYAxis1.x) + (tMat.col2.x * m_localYAxis1.y)); ay1Y = ((tMat.col1.y * m_localYAxis1.x) + (tMat.col2.y * m_localYAxis1.y)); eX = ((b2.m_sweep.c.x + r2X) - b1.m_sweep.c.x); eY = ((b2.m_sweep.c.y + r2Y) - b1.m_sweep.c.y); m_linearJacobian.linear1.x = -(ay1X); m_linearJacobian.linear1.y = -(ay1Y); m_linearJacobian.linear2.x = ay1X; m_linearJacobian.linear2.y = ay1Y; m_linearJacobian.angular1 = -(((eX * ay1Y) - (eY * ay1X))); m_linearJacobian.angular2 = ((r2X * ay1Y) - (r2Y * ay1X)); m_linearMass = (((invMass1 + ((invI1 * m_linearJacobian.angular1) * m_linearJacobian.angular1)) + invMass2) + ((invI2 * m_linearJacobian.angular2) * m_linearJacobian.angular2)); m_linearMass = (1 / m_linearMass); m_angularMass = (invI1 + invI2); if (m_angularMass > Number.MIN_VALUE){ m_angularMass = (1 / m_angularMass); }; if (((m_enableLimit) || (m_enableMotor))){ tMat = b1.m_xf.R; ax1X = ((tMat.col1.x * m_localXAxis1.x) + (tMat.col2.x * m_localXAxis1.y)); ax1Y = ((tMat.col1.y * m_localXAxis1.x) + (tMat.col2.y * m_localXAxis1.y)); m_motorJacobian.linear1.x = -(ax1X); m_motorJacobian.linear1.y = -(ax1Y); m_motorJacobian.linear2.x = ax1X; m_motorJacobian.linear2.y = ax1Y; m_motorJacobian.angular1 = -(((eX * ax1Y) - (eY * ax1X))); m_motorJacobian.angular2 = ((r2X * ax1Y) - (r2Y * ax1X)); m_motorMass = (((invMass1 + ((invI1 * m_motorJacobian.angular1) * m_motorJacobian.angular1)) + invMass2) + ((invI2 * m_motorJacobian.angular2) * m_motorJacobian.angular2)); m_motorMass = (1 / m_motorMass); if (m_enableLimit){ dX = (eX - r1X); dY = (eY - r1Y); jointTranslation = ((ax1X * dX) + (ax1Y * dY)); if (b2Math.b2Abs((m_upperTranslation - m_lowerTranslation)) < (2 * b2Settings.b2_linearSlop)){ m_limitState = e_equalLimits; } else { if (jointTranslation <= m_lowerTranslation){ if (m_limitState != e_atLowerLimit){ m_limitForce = 0; }; m_limitState = e_atLowerLimit; } else { if (jointTranslation >= m_upperTranslation){ if (m_limitState != e_atUpperLimit){ m_limitForce = 0; }; m_limitState = e_atUpperLimit; } else { m_limitState = e_inactiveLimit; m_limitForce = 0; }; }; }; }; }; if (m_enableMotor == false){ m_motorForce = 0; }; if (m_enableLimit == false){ m_limitForce = 0; }; if (step.warmStarting){ P1X = (step.dt * ((m_force * m_linearJacobian.linear1.x) + ((m_motorForce + m_limitForce) * m_motorJacobian.linear1.x))); P1Y = (step.dt * ((m_force * m_linearJacobian.linear1.y) + ((m_motorForce + m_limitForce) * m_motorJacobian.linear1.y))); P2X = (step.dt * ((m_force * m_linearJacobian.linear2.x) + ((m_motorForce + m_limitForce) * m_motorJacobian.linear2.x))); P2Y = (step.dt * ((m_force * m_linearJacobian.linear2.y) + ((m_motorForce + m_limitForce) * m_motorJacobian.linear2.y))); L1 = (step.dt * (((m_force * m_linearJacobian.angular1) - m_torque) + ((m_motorForce + m_limitForce) * m_motorJacobian.angular1))); L2 = (step.dt * (((m_force * m_linearJacobian.angular2) + m_torque) + ((m_motorForce + m_limitForce) * m_motorJacobian.angular2))); b1.m_linearVelocity.x = (b1.m_linearVelocity.x + (invMass1 * P1X)); b1.m_linearVelocity.y = (b1.m_linearVelocity.y + (invMass1 * P1Y)); b1.m_angularVelocity = (b1.m_angularVelocity + (invI1 * L1)); b2.m_linearVelocity.x = (b2.m_linearVelocity.x + (invMass2 * P2X)); b2.m_linearVelocity.y = (b2.m_linearVelocity.y + (invMass2 * P2Y)); b2.m_angularVelocity = (b2.m_angularVelocity + (invI2 * L2)); } else { m_force = 0; m_torque = 0; m_limitForce = 0; m_motorForce = 0; }; m_limitPositionImpulse = 0; } public function GetMotorForce():Number{ return (m_motorForce); } public function SetMaxMotorForce(force:Number):void{ m_maxMotorForce = force; } public function EnableLimit(flag:Boolean):void{ m_enableLimit = flag; } override public function GetReactionTorque():Number{ return (m_torque); } public function IsLimitEnabled():Boolean{ return (m_enableLimit); } public function IsMotorEnabled():Boolean{ return (m_enableMotor); } override public function SolveVelocityConstraints(step:b2TimeStep):void{ var b1:b2Body; var b2:b2Body; var invMass1:Number; var invMass2:Number; var invI1:Number; var invI2:Number; var oldLimitForce:Number; var linearCdot:Number; var force:Number; var P:Number; var angularCdot:Number; var torque:Number; var L:Number; var motorCdot:Number; var motorForce:Number; var oldMotorForce:Number; var limitCdot:Number; var limitForce:Number; b1 = m_body1; b2 = m_body2; invMass1 = b1.m_invMass; invMass2 = b2.m_invMass; invI1 = b1.m_invI; invI2 = b2.m_invI; linearCdot = m_linearJacobian.Compute(b1.m_linearVelocity, b1.m_angularVelocity, b2.m_linearVelocity, b2.m_angularVelocity); force = ((-(step.inv_dt) * m_linearMass) * linearCdot); m_force = (m_force + force); P = (step.dt * force); b1.m_linearVelocity.x = (b1.m_linearVelocity.x + ((invMass1 * P) * m_linearJacobian.linear1.x)); b1.m_linearVelocity.y = (b1.m_linearVelocity.y + ((invMass1 * P) * m_linearJacobian.linear1.y)); b1.m_angularVelocity = (b1.m_angularVelocity + ((invI1 * P) * m_linearJacobian.angular1)); b2.m_linearVelocity.x = (b2.m_linearVelocity.x + ((invMass2 * P) * m_linearJacobian.linear2.x)); b2.m_linearVelocity.y = (b2.m_linearVelocity.y + ((invMass2 * P) * m_linearJacobian.linear2.y)); b2.m_angularVelocity = (b2.m_angularVelocity + ((invI2 * P) * m_linearJacobian.angular2)); angularCdot = (b2.m_angularVelocity - b1.m_angularVelocity); torque = ((-(step.inv_dt) * m_angularMass) * angularCdot); m_torque = (m_torque + torque); L = (step.dt * torque); b1.m_angularVelocity = (b1.m_angularVelocity - (invI1 * L)); b2.m_angularVelocity = (b2.m_angularVelocity + (invI2 * L)); if (((m_enableMotor) && (!((m_limitState == e_equalLimits))))){ motorCdot = (m_motorJacobian.Compute(b1.m_linearVelocity, b1.m_angularVelocity, b2.m_linearVelocity, b2.m_angularVelocity) - m_motorSpeed); motorForce = ((-(step.inv_dt) * m_motorMass) * motorCdot); oldMotorForce = m_motorForce; m_motorForce = b2Math.b2Clamp((m_motorForce + motorForce), -(m_maxMotorForce), m_maxMotorForce); motorForce = (m_motorForce - oldMotorForce); P = (step.dt * motorForce); b1.m_linearVelocity.x = (b1.m_linearVelocity.x + ((invMass1 * P) * m_motorJacobian.linear1.x)); b1.m_linearVelocity.y = (b1.m_linearVelocity.y + ((invMass1 * P) * m_motorJacobian.linear1.y)); b1.m_angularVelocity = (b1.m_angularVelocity + ((invI1 * P) * m_motorJacobian.angular1)); b2.m_linearVelocity.x = (b2.m_linearVelocity.x + ((invMass2 * P) * m_motorJacobian.linear2.x)); b2.m_linearVelocity.y = (b2.m_linearVelocity.y + ((invMass2 * P) * m_motorJacobian.linear2.y)); b2.m_angularVelocity = (b2.m_angularVelocity + ((invI2 * P) * m_motorJacobian.angular2)); }; if (((m_enableLimit) && (!((m_limitState == e_inactiveLimit))))){ limitCdot = m_motorJacobian.Compute(b1.m_linearVelocity, b1.m_angularVelocity, b2.m_linearVelocity, b2.m_angularVelocity); limitForce = ((-(step.inv_dt) * m_motorMass) * limitCdot); if (m_limitState == e_equalLimits){ m_limitForce = (m_limitForce + limitForce); } else { if (m_limitState == e_atLowerLimit){ oldLimitForce = m_limitForce; m_limitForce = b2Math.b2Max((m_limitForce + limitForce), 0); limitForce = (m_limitForce - oldLimitForce); } else { if (m_limitState == e_atUpperLimit){ oldLimitForce = m_limitForce; m_limitForce = b2Math.b2Min((m_limitForce + limitForce), 0); limitForce = (m_limitForce - oldLimitForce); }; }; }; P = (step.dt * limitForce); b1.m_linearVelocity.x = (b1.m_linearVelocity.x + ((invMass1 * P) * m_motorJacobian.linear1.x)); b1.m_linearVelocity.y = (b1.m_linearVelocity.y + ((invMass1 * P) * m_motorJacobian.linear1.y)); b1.m_angularVelocity = (b1.m_angularVelocity + ((invI1 * P) * m_motorJacobian.angular1)); b2.m_linearVelocity.x = (b2.m_linearVelocity.x + ((invMass2 * P) * m_motorJacobian.linear2.x)); b2.m_linearVelocity.y = (b2.m_linearVelocity.y + ((invMass2 * P) * m_motorJacobian.linear2.y)); b2.m_angularVelocity = (b2.m_angularVelocity + ((invI2 * P) * m_motorJacobian.angular2)); }; } } }//package Box2D.Dynamics.Joints
Section 60
//b2PrismaticJointDef (Box2D.Dynamics.Joints.b2PrismaticJointDef) package Box2D.Dynamics.Joints { import Box2D.Dynamics.*; import Box2D.Common.Math.*; public class b2PrismaticJointDef extends b2JointDef { public var localAxis1:b2Vec2; public var referenceAngle:Number; public var maxMotorForce:Number; public var motorSpeed:Number; public var upperTranslation:Number; public var localAnchor1:b2Vec2; public var localAnchor2:b2Vec2; public var enableLimit:Boolean; public var enableMotor:Boolean; public var lowerTranslation:Number; public function b2PrismaticJointDef(){ localAnchor1 = new b2Vec2(); localAnchor2 = new b2Vec2(); localAxis1 = new b2Vec2(); super(); type = b2Joint.e_prismaticJoint; localAxis1.Set(1, 0); referenceAngle = 0; enableLimit = false; lowerTranslation = 0; upperTranslation = 0; enableMotor = false; maxMotorForce = 0; motorSpeed = 0; } public function Initialize(b1:b2Body, b2:b2Body, anchor:b2Vec2, axis:b2Vec2):void{ body1 = b1; body2 = b2; localAnchor1 = body1.GetLocalPoint(anchor); localAnchor2 = body2.GetLocalPoint(anchor); localAxis1 = body1.GetLocalVector(axis); referenceAngle = (body2.GetAngle() - body1.GetAngle()); } } }//package Box2D.Dynamics.Joints
Section 61
//b2PulleyJoint (Box2D.Dynamics.Joints.b2PulleyJoint) package Box2D.Dynamics.Joints { import Box2D.Dynamics.*; import Box2D.Common.Math.*; import Box2D.Common.*; public class b2PulleyJoint extends b2Joint { public var m_ground:b2Body; public var m_maxLength2:Number; public var m_limitForce1:Number; public var m_maxLength1:Number; public var m_limitState1:int; public var m_limitState2:int; public var m_limitPositionImpulse2:Number; public var m_force:Number; public var m_limitPositionImpulse1:Number; public var m_constant:Number; public var m_state:int; public var m_ratio:Number; public var m_groundAnchor1:b2Vec2; public var m_groundAnchor2:b2Vec2; public var m_localAnchor1:b2Vec2; public var m_localAnchor2:b2Vec2; public var m_positionImpulse:Number; public var m_limitMass2:Number; public var m_limitMass1:Number; public var m_pulleyMass:Number; public var m_u1:b2Vec2; public var m_u2:b2Vec2; public var m_limitForce2:Number; public static const b2_minPulleyLength:Number = 2; public function b2PulleyJoint(def:b2PulleyJointDef){ var tMat:b2Mat22; var tX:Number; var tY:Number; m_groundAnchor1 = new b2Vec2(); m_groundAnchor2 = new b2Vec2(); m_localAnchor1 = new b2Vec2(); m_localAnchor2 = new b2Vec2(); m_u1 = new b2Vec2(); m_u2 = new b2Vec2(); super(def); m_ground = m_body1.m_world.m_groundBody; m_groundAnchor1.x = (def.groundAnchor1.x - m_ground.m_xf.position.x); m_groundAnchor1.y = (def.groundAnchor1.y - m_ground.m_xf.position.y); m_groundAnchor2.x = (def.groundAnchor2.x - m_ground.m_xf.position.x); m_groundAnchor2.y = (def.groundAnchor2.y - m_ground.m_xf.position.y); m_localAnchor1.SetV(def.localAnchor1); m_localAnchor2.SetV(def.localAnchor2); m_ratio = def.ratio; m_constant = (def.length1 + (m_ratio * def.length2)); m_maxLength1 = b2Math.b2Min(def.maxLength1, (m_constant - (m_ratio * b2_minPulleyLength))); m_maxLength2 = b2Math.b2Min(def.maxLength2, ((m_constant - b2_minPulleyLength) / m_ratio)); m_force = 0; m_limitForce1 = 0; m_limitForce2 = 0; } public function GetGroundAnchor2():b2Vec2{ var a:b2Vec2; a = m_ground.m_xf.position.Copy(); a.Add(m_groundAnchor2); return (a); } override public function GetAnchor1():b2Vec2{ return (m_body1.GetWorldPoint(m_localAnchor1)); } override public function GetAnchor2():b2Vec2{ return (m_body2.GetWorldPoint(m_localAnchor2)); } override public function GetReactionForce():b2Vec2{ var F:b2Vec2; F = m_u2.Copy(); F.Multiply(m_force); return (F); } override public function SolvePositionConstraints():Boolean{ var b1:b2Body; var b2:b2Body; var tMat:b2Mat22; var s1X:Number; var s1Y:Number; var s2X:Number; var s2Y:Number; var r1X:Number; var r1Y:Number; var r2X:Number; var r2Y:Number; var p1X:Number; var p1Y:Number; var p2X:Number; var p2Y:Number; var length1:Number; var length2:Number; var C:Number; var impulse:Number; var oldImpulse:Number; var oldLimitPositionImpulse:Number; var tX:Number; var linearError:Number; b1 = m_body1; b2 = m_body2; s1X = (m_ground.m_xf.position.x + m_groundAnchor1.x); s1Y = (m_ground.m_xf.position.y + m_groundAnchor1.y); s2X = (m_ground.m_xf.position.x + m_groundAnchor2.x); s2Y = (m_ground.m_xf.position.y + m_groundAnchor2.y); linearError = 0; if (m_state == e_atUpperLimit){ tMat = b1.m_xf.R; r1X = (m_localAnchor1.x - b1.m_sweep.localCenter.x); r1Y = (m_localAnchor1.y - b1.m_sweep.localCenter.y); tX = ((tMat.col1.x * r1X) + (tMat.col2.x * r1Y)); r1Y = ((tMat.col1.y * r1X) + (tMat.col2.y * r1Y)); r1X = tX; tMat = b2.m_xf.R; r2X = (m_localAnchor2.x - b2.m_sweep.localCenter.x); r2Y = (m_localAnchor2.y - b2.m_sweep.localCenter.y); tX = ((tMat.col1.x * r2X) + (tMat.col2.x * r2Y)); r2Y = ((tMat.col1.y * r2X) + (tMat.col2.y * r2Y)); r2X = tX; p1X = (b1.m_sweep.c.x + r1X); p1Y = (b1.m_sweep.c.y + r1Y); p2X = (b2.m_sweep.c.x + r2X); p2Y = (b2.m_sweep.c.y + r2Y); m_u1.Set((p1X - s1X), (p1Y - s1Y)); m_u2.Set((p2X - s2X), (p2Y - s2Y)); length1 = m_u1.Length(); length2 = m_u2.Length(); if (length1 > b2Settings.b2_linearSlop){ m_u1.Multiply((1 / length1)); } else { m_u1.SetZero(); }; if (length2 > b2Settings.b2_linearSlop){ m_u2.Multiply((1 / length2)); } else { m_u2.SetZero(); }; C = ((m_constant - length1) - (m_ratio * length2)); linearError = b2Math.b2Max(linearError, -(C)); C = b2Math.b2Clamp((C + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0); impulse = (-(m_pulleyMass) * C); oldImpulse = m_positionImpulse; m_positionImpulse = b2Math.b2Max(0, (m_positionImpulse + impulse)); impulse = (m_positionImpulse - oldImpulse); p1X = (-(impulse) * m_u1.x); p1Y = (-(impulse) * m_u1.y); p2X = ((-(m_ratio) * impulse) * m_u2.x); p2Y = ((-(m_ratio) * impulse) * m_u2.y); b1.m_sweep.c.x = (b1.m_sweep.c.x + (b1.m_invMass * p1X)); b1.m_sweep.c.y = (b1.m_sweep.c.y + (b1.m_invMass * p1Y)); b1.m_sweep.a = (b1.m_sweep.a + (b1.m_invI * ((r1X * p1Y) - (r1Y * p1X)))); b2.m_sweep.c.x = (b2.m_sweep.c.x + (b2.m_invMass * p2X)); b2.m_sweep.c.y = (b2.m_sweep.c.y + (b2.m_invMass * p2Y)); b2.m_sweep.a = (b2.m_sweep.a + (b2.m_invI * ((r2X * p2Y) - (r2Y * p2X)))); b1.SynchronizeTransform(); b2.SynchronizeTransform(); }; if (m_limitState1 == e_atUpperLimit){ tMat = b1.m_xf.R; r1X = (m_localAnchor1.x - b1.m_sweep.localCenter.x); r1Y = (m_localAnchor1.y - b1.m_sweep.localCenter.y); tX = ((tMat.col1.x * r1X) + (tMat.col2.x * r1Y)); r1Y = ((tMat.col1.y * r1X) + (tMat.col2.y * r1Y)); r1X = tX; p1X = (b1.m_sweep.c.x + r1X); p1Y = (b1.m_sweep.c.y + r1Y); m_u1.Set((p1X - s1X), (p1Y - s1Y)); length1 = m_u1.Length(); if (length1 > b2Settings.b2_linearSlop){ m_u1.x = (m_u1.x * (1 / length1)); m_u1.y = (m_u1.y * (1 / length1)); } else { m_u1.SetZero(); }; C = (m_maxLength1 - length1); linearError = b2Math.b2Max(linearError, -(C)); C = b2Math.b2Clamp((C + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0); impulse = (-(m_limitMass1) * C); oldLimitPositionImpulse = m_limitPositionImpulse1; m_limitPositionImpulse1 = b2Math.b2Max(0, (m_limitPositionImpulse1 + impulse)); impulse = (m_limitPositionImpulse1 - oldLimitPositionImpulse); p1X = (-(impulse) * m_u1.x); p1Y = (-(impulse) * m_u1.y); b1.m_sweep.c.x = (b1.m_sweep.c.x + (b1.m_invMass * p1X)); b1.m_sweep.c.y = (b1.m_sweep.c.y + (b1.m_invMass * p1Y)); b1.m_sweep.a = (b1.m_sweep.a + (b1.m_invI * ((r1X * p1Y) - (r1Y * p1X)))); b1.SynchronizeTransform(); }; if (m_limitState2 == e_atUpperLimit){ tMat = b2.m_xf.R; r2X = (m_localAnchor2.x - b2.m_sweep.localCenter.x); r2Y = (m_localAnchor2.y - b2.m_sweep.localCenter.y); tX = ((tMat.col1.x * r2X) + (tMat.col2.x * r2Y)); r2Y = ((tMat.col1.y * r2X) + (tMat.col2.y * r2Y)); r2X = tX; p2X = (b2.m_sweep.c.x + r2X); p2Y = (b2.m_sweep.c.y + r2Y); m_u2.Set((p2X - s2X), (p2Y - s2Y)); length2 = m_u2.Length(); if (length2 > b2Settings.b2_linearSlop){ m_u2.x = (m_u2.x * (1 / length2)); m_u2.y = (m_u2.y * (1 / length2)); } else { m_u2.SetZero(); }; C = (m_maxLength2 - length2); linearError = b2Math.b2Max(linearError, -(C)); C = b2Math.b2Clamp((C + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0); impulse = (-(m_limitMass2) * C); oldLimitPositionImpulse = m_limitPositionImpulse2; m_limitPositionImpulse2 = b2Math.b2Max(0, (m_limitPositionImpulse2 + impulse)); impulse = (m_limitPositionImpulse2 - oldLimitPositionImpulse); p2X = (-(impulse) * m_u2.x); p2Y = (-(impulse) * m_u2.y); b2.m_sweep.c.x = (b2.m_sweep.c.x + (b2.m_invMass * p2X)); b2.m_sweep.c.y = (b2.m_sweep.c.y + (b2.m_invMass * p2Y)); b2.m_sweep.a = (b2.m_sweep.a + (b2.m_invI * ((r2X * p2Y) - (r2Y * p2X)))); b2.SynchronizeTransform(); }; return ((linearError < b2Settings.b2_linearSlop)); } override public function InitVelocityConstraints(step:b2TimeStep):void{ var b1:b2Body; var b2:b2Body; var tMat:b2Mat22; var r1X:Number; var r1Y:Number; var tX:Number; var r2X:Number; var r2Y:Number; var p1X:Number; var p1Y:Number; var p2X:Number; var p2Y:Number; var s1X:Number; var s1Y:Number; var s2X:Number; var s2Y:Number; var length1:Number; var length2:Number; var C:Number; var cr1u1:Number; var cr2u2:Number; var P1X:Number; var P1Y:Number; var P2X:Number; var P2Y:Number; b1 = m_body1; b2 = m_body2; tMat = b1.m_xf.R; r1X = (m_localAnchor1.x - b1.m_sweep.localCenter.x); r1Y = (m_localAnchor1.y - b1.m_sweep.localCenter.y); tX = ((tMat.col1.x * r1X) + (tMat.col2.x * r1Y)); r1Y = ((tMat.col1.y * r1X) + (tMat.col2.y * r1Y)); r1X = tX; tMat = b2.m_xf.R; r2X = (m_localAnchor2.x - b2.m_sweep.localCenter.x); r2Y = (m_localAnchor2.y - b2.m_sweep.localCenter.y); tX = ((tMat.col1.x * r2X) + (tMat.col2.x * r2Y)); r2Y = ((tMat.col1.y * r2X) + (tMat.col2.y * r2Y)); r2X = tX; p1X = (b1.m_sweep.c.x + r1X); p1Y = (b1.m_sweep.c.y + r1Y); p2X = (b2.m_sweep.c.x + r2X); p2Y = (b2.m_sweep.c.y + r2Y); s1X = (m_ground.m_xf.position.x + m_groundAnchor1.x); s1Y = (m_ground.m_xf.position.y + m_groundAnchor1.y); s2X = (m_ground.m_xf.position.x + m_groundAnchor2.x); s2Y = (m_ground.m_xf.position.y + m_groundAnchor2.y); m_u1.Set((p1X - s1X), (p1Y - s1Y)); m_u2.Set((p2X - s2X), (p2Y - s2Y)); length1 = m_u1.Length(); length2 = m_u2.Length(); if (length1 > b2Settings.b2_linearSlop){ m_u1.Multiply((1 / length1)); } else { m_u1.SetZero(); }; if (length2 > b2Settings.b2_linearSlop){ m_u2.Multiply((1 / length2)); } else { m_u2.SetZero(); }; C = ((m_constant - length1) - (m_ratio * length2)); if (C > 0){ m_state = e_inactiveLimit; m_force = 0; } else { m_state = e_atUpperLimit; m_positionImpulse = 0; }; if (length1 < m_maxLength1){ m_limitState1 = e_inactiveLimit; m_limitForce1 = 0; } else { m_limitState1 = e_atUpperLimit; m_limitPositionImpulse1 = 0; }; if (length2 < m_maxLength2){ m_limitState2 = e_inactiveLimit; m_limitForce2 = 0; } else { m_limitState2 = e_atUpperLimit; m_limitPositionImpulse2 = 0; }; cr1u1 = ((r1X * m_u1.y) - (r1Y * m_u1.x)); cr2u2 = ((r2X * m_u2.y) - (r2Y * m_u2.x)); m_limitMass1 = (b1.m_invMass + ((b1.m_invI * cr1u1) * cr1u1)); m_limitMass2 = (b2.m_invMass + ((b2.m_invI * cr2u2) * cr2u2)); m_pulleyMass = (m_limitMass1 + ((m_ratio * m_ratio) * m_limitMass2)); m_limitMass1 = (1 / m_limitMass1); m_limitMass2 = (1 / m_limitMass2); m_pulleyMass = (1 / m_pulleyMass); if (step.warmStarting){ P1X = ((step.dt * (-(m_force) - m_limitForce1)) * m_u1.x); P1Y = ((step.dt * (-(m_force) - m_limitForce1)) * m_u1.y); P2X = ((step.dt * ((-(m_ratio) * m_force) - m_limitForce2)) * m_u2.x); P2Y = ((step.dt * ((-(m_ratio) * m_force) - m_limitForce2)) * m_u2.y); b1.m_linearVelocity.x = (b1.m_linearVelocity.x + (b1.m_invMass * P1X)); b1.m_linearVelocity.y = (b1.m_linearVelocity.y + (b1.m_invMass * P1Y)); b1.m_angularVelocity = (b1.m_angularVelocity + (b1.m_invI * ((r1X * P1Y) - (r1Y * P1X)))); b2.m_linearVelocity.x = (b2.m_linearVelocity.x + (b2.m_invMass * P2X)); b2.m_linearVelocity.y = (b2.m_linearVelocity.y + (b2.m_invMass * P2Y)); b2.m_angularVelocity = (b2.m_angularVelocity + (b2.m_invI * ((r2X * P2Y) - (r2Y * P2X)))); } else { m_force = 0; m_limitForce1 = 0; m_limitForce2 = 0; }; } override public function GetReactionTorque():Number{ return (0); } public function GetRatio():Number{ return (m_ratio); } public function GetLength2():Number{ var p:b2Vec2; var sX:Number; var sY:Number; var dX:Number; var dY:Number; p = m_body2.GetWorldPoint(m_localAnchor2); sX = (m_ground.m_xf.position.x + m_groundAnchor2.x); sY = (m_ground.m_xf.position.y + m_groundAnchor2.y); dX = (p.x - sX); dY = (p.y - sY); return (Math.sqrt(((dX * dX) + (dY * dY)))); } override public function SolveVelocityConstraints(step:b2TimeStep):void{ var b1:b2Body; var b2:b2Body; var tMat:b2Mat22; var r1X:Number; var r1Y:Number; var tX:Number; var r2X:Number; var r2Y:Number; var v1X:Number; var v1Y:Number; var v2X:Number; var v2Y:Number; var P1X:Number; var P1Y:Number; var P2X:Number; var P2Y:Number; var Cdot:Number; var force:Number; var oldForce:Number; b1 = m_body1; b2 = m_body2; tMat = b1.m_xf.R; r1X = (m_localAnchor1.x - b1.m_sweep.localCenter.x); r1Y = (m_localAnchor1.y - b1.m_sweep.localCenter.y); tX = ((tMat.col1.x * r1X) + (tMat.col2.x * r1Y)); r1Y = ((tMat.col1.y * r1X) + (tMat.col2.y * r1Y)); r1X = tX; tMat = b2.m_xf.R; r2X = (m_localAnchor2.x - b2.m_sweep.localCenter.x); r2Y = (m_localAnchor2.y - b2.m_sweep.localCenter.y); tX = ((tMat.col1.x * r2X) + (tMat.col2.x * r2Y)); r2Y = ((tMat.col1.y * r2X) + (tMat.col2.y * r2Y)); r2X = tX; if (m_state == e_atUpperLimit){ v1X = (b1.m_linearVelocity.x + (-(b1.m_angularVelocity) * r1Y)); v1Y = (b1.m_linearVelocity.y + (b1.m_angularVelocity * r1X)); v2X = (b2.m_linearVelocity.x + (-(b2.m_angularVelocity) * r2Y)); v2Y = (b2.m_linearVelocity.y + (b2.m_angularVelocity * r2X)); Cdot = (-(((m_u1.x * v1X) + (m_u1.y * v1Y))) - (m_ratio * ((m_u2.x * v2X) + (m_u2.y * v2Y)))); force = ((-(step.inv_dt) * m_pulleyMass) * Cdot); oldForce = m_force; m_force = b2Math.b2Max(0, (m_force + force)); force = (m_force - oldForce); P1X = ((-(step.dt) * force) * m_u1.x); P1Y = ((-(step.dt) * force) * m_u1.y); P2X = (((-(step.dt) * m_ratio) * force) * m_u2.x); P2Y = (((-(step.dt) * m_ratio) * force) * m_u2.y); b1.m_linearVelocity.x = (b1.m_linearVelocity.x + (b1.m_invMass * P1X)); b1.m_linearVelocity.y = (b1.m_linearVelocity.y + (b1.m_invMass * P1Y)); b1.m_angularVelocity = (b1.m_angularVelocity + (b1.m_invI * ((r1X * P1Y) - (r1Y * P1X)))); b2.m_linearVelocity.x = (b2.m_linearVelocity.x + (b2.m_invMass * P2X)); b2.m_linearVelocity.y = (b2.m_linearVelocity.y + (b2.m_invMass * P2Y)); b2.m_angularVelocity = (b2.m_angularVelocity + (b2.m_invI * ((r2X * P2Y) - (r2Y * P2X)))); }; if (m_limitState1 == e_atUpperLimit){ v1X = (b1.m_linearVelocity.x + (-(b1.m_angularVelocity) * r1Y)); v1Y = (b1.m_linearVelocity.y + (b1.m_angularVelocity * r1X)); Cdot = -(((m_u1.x * v1X) + (m_u1.y * v1Y))); force = ((-(step.inv_dt) * m_limitMass1) * Cdot); oldForce = m_limitForce1; m_limitForce1 = b2Math.b2Max(0, (m_limitForce1 + force)); force = (m_limitForce1 - oldForce); P1X = ((-(step.dt) * force) * m_u1.x); P1Y = ((-(step.dt) * force) * m_u1.y); b1.m_linearVelocity.x = (b1.m_linearVelocity.x + (b1.m_invMass * P1X)); b1.m_linearVelocity.y = (b1.m_linearVelocity.y + (b1.m_invMass * P1Y)); b1.m_angularVelocity = (b1.m_angularVelocity + (b1.m_invI * ((r1X * P1Y) - (r1Y * P1X)))); }; if (m_limitState2 == e_atUpperLimit){ v2X = (b2.m_linearVelocity.x + (-(b2.m_angularVelocity) * r2Y)); v2Y = (b2.m_linearVelocity.y + (b2.m_angularVelocity * r2X)); Cdot = -(((m_u2.x * v2X) + (m_u2.y * v2Y))); force = ((-(step.inv_dt) * m_limitMass2) * Cdot); oldForce = m_limitForce2; m_limitForce2 = b2Math.b2Max(0, (m_limitForce2 + force)); force = (m_limitForce2 - oldForce); P2X = ((-(step.dt) * force) * m_u2.x); P2Y = ((-(step.dt) * force) * m_u2.y); b2.m_linearVelocity.x = (b2.m_linearVelocity.x + (b2.m_invMass * P2X)); b2.m_linearVelocity.y = (b2.m_linearVelocity.y + (b2.m_invMass * P2Y)); b2.m_angularVelocity = (b2.m_angularVelocity + (b2.m_invI * ((r2X * P2Y) - (r2Y * P2X)))); }; } public function GetLength1():Number{ var p:b2Vec2; var sX:Number; var sY:Number; var dX:Number; var dY:Number; p = m_body1.GetWorldPoint(m_localAnchor1); sX = (m_ground.m_xf.position.x + m_groundAnchor1.x); sY = (m_ground.m_xf.position.y + m_groundAnchor1.y); dX = (p.x - sX); dY = (p.y - sY); return (Math.sqrt(((dX * dX) + (dY * dY)))); } public function GetGroundAnchor1():b2Vec2{ var a:b2Vec2; a = m_ground.m_xf.position.Copy(); a.Add(m_groundAnchor1); return (a); } } }//package Box2D.Dynamics.Joints
Section 62
//b2PulleyJointDef (Box2D.Dynamics.Joints.b2PulleyJointDef) package Box2D.Dynamics.Joints { import Box2D.Dynamics.*; import Box2D.Common.Math.*; public class b2PulleyJointDef extends b2JointDef { public var maxLength2:Number; public var length1:Number; public var length2:Number; public var maxLength1:Number; public var ratio:Number; public var groundAnchor1:b2Vec2; public var groundAnchor2:b2Vec2; public var localAnchor1:b2Vec2; public var localAnchor2:b2Vec2; public function b2PulleyJointDef(){ groundAnchor1 = new b2Vec2(); groundAnchor2 = new b2Vec2(); localAnchor1 = new b2Vec2(); localAnchor2 = new b2Vec2(); super(); type = b2Joint.e_pulleyJoint; groundAnchor1.Set(-1, 1); groundAnchor2.Set(1, 1); localAnchor1.Set(-1, 0); localAnchor2.Set(1, 0); length1 = 0; maxLength1 = 0; length2 = 0; maxLength2 = 0; ratio = 1; collideConnected = true; } public function Initialize(b1:b2Body, b2:b2Body, ga1:b2Vec2, ga2:b2Vec2, anchor1:b2Vec2, anchor2:b2Vec2, r:Number):void{ var d1X:Number; var d1Y:Number; var d2X:Number; var d2Y:Number; var C:Number; body1 = b1; body2 = b2; groundAnchor1.SetV(ga1); groundAnchor2.SetV(ga2); localAnchor1 = body1.GetLocalPoint(anchor1); localAnchor2 = body2.GetLocalPoint(anchor2); d1X = (anchor1.x - ga1.x); d1Y = (anchor1.y - ga1.y); length1 = Math.sqrt(((d1X * d1X) + (d1Y * d1Y))); d2X = (anchor2.x - ga2.x); d2Y = (anchor2.y - ga2.y); length2 = Math.sqrt(((d2X * d2X) + (d2Y * d2Y))); ratio = r; C = (length1 + (ratio * length2)); maxLength1 = (C - (ratio * b2PulleyJoint.b2_minPulleyLength)); maxLength2 = ((C - b2PulleyJoint.b2_minPulleyLength) / ratio); } } }//package Box2D.Dynamics.Joints
Section 63
//b2RevoluteJoint (Box2D.Dynamics.Joints.b2RevoluteJoint) package Box2D.Dynamics.Joints { import Box2D.Dynamics.*; import Box2D.Common.Math.*; import Box2D.Common.*; public class b2RevoluteJoint extends b2Joint { public var m_limitForce:Number; public var m_motorForce:Number; public var m_pivotMass:b2Mat22; public var m_enableLimit:Boolean; public var m_limitState:int; public var m_motorMass:Number; public var m_localAnchor1:b2Vec2; public var m_localAnchor2:b2Vec2; private var K1:b2Mat22; private var K2:b2Mat22; private var K3:b2Mat22; private var K:b2Mat22; public var m_pivotForce:b2Vec2; public var m_motorSpeed:Number; public var m_enableMotor:Boolean; public var m_limitPositionImpulse:Number; public var m_maxMotorTorque:Number; public var m_referenceAngle:Number; public var m_lowerAngle:Number; public var m_upperAngle:Number; public static var tImpulse:b2Vec2 = new b2Vec2(); public function b2RevoluteJoint(def:b2RevoluteJointDef){ K = new b2Mat22(); K1 = new b2Mat22(); K2 = new b2Mat22(); K3 = new b2Mat22(); m_localAnchor1 = new b2Vec2(); m_localAnchor2 = new b2Vec2(); m_pivotForce = new b2Vec2(); m_pivotMass = new b2Mat22(); super(def); m_localAnchor1.SetV(def.localAnchor1); m_localAnchor2.SetV(def.localAnchor2); m_referenceAngle = def.referenceAngle; m_pivotForce.Set(0, 0); m_motorForce = 0; m_limitForce = 0; m_limitPositionImpulse = 0; m_lowerAngle = def.lowerAngle; m_upperAngle = def.upperAngle; m_maxMotorTorque = def.maxMotorTorque; m_motorSpeed = def.motorSpeed; m_enableLimit = def.enableLimit; m_enableMotor = def.enableMotor; } override public function GetAnchor1():b2Vec2{ return (m_body1.GetWorldPoint(m_localAnchor1)); } override public function GetAnchor2():b2Vec2{ return (m_body2.GetWorldPoint(m_localAnchor2)); } public function EnableMotor(flag:Boolean):void{ m_enableMotor = flag; } public function GetUpperLimit():Number{ return (m_upperAngle); } public function GetLowerLimit():Number{ return (m_lowerAngle); } public function SetLimits(lower:Number, upper:Number):void{ m_lowerAngle = lower; m_upperAngle = upper; } public function GetMotorSpeed():Number{ return (m_motorSpeed); } override public function GetReactionForce():b2Vec2{ return (m_pivotForce); } override public function SolvePositionConstraints():Boolean{ var oldLimitImpulse:Number; var limitC:Number; var b1:b2Body; var b2:b2Body; var positionError:Number; var tMat:b2Mat22; var r1X:Number; var r1Y:Number; var tX:Number; var r2X:Number; var r2Y:Number; var p1X:Number; var p1Y:Number; var p2X:Number; var p2Y:Number; var ptpCX:Number; var ptpCY:Number; var invMass1:Number; var invMass2:Number; var invI1:Number; var invI2:Number; var impulseX:Number; var impulseY:Number; var angularError:Number; var angle:Number; var limitImpulse:Number; b1 = m_body1; b2 = m_body2; positionError = 0; tMat = b1.m_xf.R; r1X = (m_localAnchor1.x - b1.m_sweep.localCenter.x); r1Y = (m_localAnchor1.y - b1.m_sweep.localCenter.y); tX = ((tMat.col1.x * r1X) + (tMat.col2.x * r1Y)); r1Y = ((tMat.col1.y * r1X) + (tMat.col2.y * r1Y)); r1X = tX; tMat = b2.m_xf.R; r2X = (m_localAnchor2.x - b2.m_sweep.localCenter.x); r2Y = (m_localAnchor2.y - b2.m_sweep.localCenter.y); tX = ((tMat.col1.x * r2X) + (tMat.col2.x * r2Y)); r2Y = ((tMat.col1.y * r2X) + (tMat.col2.y * r2Y)); r2X = tX; p1X = (b1.m_sweep.c.x + r1X); p1Y = (b1.m_sweep.c.y + r1Y); p2X = (b2.m_sweep.c.x + r2X); p2Y = (b2.m_sweep.c.y + r2Y); ptpCX = (p2X - p1X); ptpCY = (p2Y - p1Y); positionError = Math.sqrt(((ptpCX * ptpCX) + (ptpCY * ptpCY))); invMass1 = b1.m_invMass; invMass2 = b2.m_invMass; invI1 = b1.m_invI; invI2 = b2.m_invI; K1.col1.x = (invMass1 + invMass2); K1.col2.x = 0; K1.col1.y = 0; K1.col2.y = (invMass1 + invMass2); K2.col1.x = ((invI1 * r1Y) * r1Y); K2.col2.x = ((-(invI1) * r1X) * r1Y); K2.col1.y = ((-(invI1) * r1X) * r1Y); K2.col2.y = ((invI1 * r1X) * r1X); K3.col1.x = ((invI2 * r2Y) * r2Y); K3.col2.x = ((-(invI2) * r2X) * r2Y); K3.col1.y = ((-(invI2) * r2X) * r2Y); K3.col2.y = ((invI2 * r2X) * r2X); K.SetM(K1); K.AddM(K2); K.AddM(K3); K.Solve(tImpulse, -(ptpCX), -(ptpCY)); impulseX = tImpulse.x; impulseY = tImpulse.y; b1.m_sweep.c.x = (b1.m_sweep.c.x - (b1.m_invMass * impulseX)); b1.m_sweep.c.y = (b1.m_sweep.c.y - (b1.m_invMass * impulseY)); b1.m_sweep.a = (b1.m_sweep.a - (b1.m_invI * ((r1X * impulseY) - (r1Y * impulseX)))); b2.m_sweep.c.x = (b2.m_sweep.c.x + (b2.m_invMass * impulseX)); b2.m_sweep.c.y = (b2.m_sweep.c.y + (b2.m_invMass * impulseY)); b2.m_sweep.a = (b2.m_sweep.a + (b2.m_invI * ((r2X * impulseY) - (r2Y * impulseX)))); b1.SynchronizeTransform(); b2.SynchronizeTransform(); angularError = 0; if (((m_enableLimit) && (!((m_limitState == e_inactiveLimit))))){ angle = ((b2.m_sweep.a - b1.m_sweep.a) - m_referenceAngle); limitImpulse = 0; if (m_limitState == e_equalLimits){ limitC = b2Math.b2Clamp(angle, -(b2Settings.b2_maxAngularCorrection), b2Settings.b2_maxAngularCorrection); limitImpulse = (-(m_motorMass) * limitC); angularError = b2Math.b2Abs(limitC); } else { if (m_limitState == e_atLowerLimit){ limitC = (angle - m_lowerAngle); angularError = b2Math.b2Max(0, -(limitC)); limitC = b2Math.b2Clamp((limitC + b2Settings.b2_angularSlop), -(b2Settings.b2_maxAngularCorrection), 0); limitImpulse = (-(m_motorMass) * limitC); oldLimitImpulse = m_limitPositionImpulse; m_limitPositionImpulse = b2Math.b2Max((m_limitPositionImpulse + limitImpulse), 0); limitImpulse = (m_limitPositionImpulse - oldLimitImpulse); } else { if (m_limitState == e_atUpperLimit){ limitC = (angle - m_upperAngle); angularError = b2Math.b2Max(0, limitC); limitC = b2Math.b2Clamp((limitC - b2Settings.b2_angularSlop), 0, b2Settings.b2_maxAngularCorrection); limitImpulse = (-(m_motorMass) * limitC); oldLimitImpulse = m_limitPositionImpulse; m_limitPositionImpulse = b2Math.b2Min((m_limitPositionImpulse + limitImpulse), 0); limitImpulse = (m_limitPositionImpulse - oldLimitImpulse); }; }; }; b1.m_sweep.a = (b1.m_sweep.a - (b1.m_invI * limitImpulse)); b2.m_sweep.a = (b2.m_sweep.a + (b2.m_invI * limitImpulse)); b1.SynchronizeTransform(); b2.SynchronizeTransform(); }; return ((((positionError <= b2Settings.b2_linearSlop)) && ((angularError <= b2Settings.b2_angularSlop)))); } public function GetJointSpeed():Number{ return ((m_body2.m_angularVelocity - m_body1.m_angularVelocity)); } public function SetMotorSpeed(speed:Number):void{ m_motorSpeed = speed; } public function SetMaxMotorTorque(torque:Number):void{ m_maxMotorTorque = torque; } public function GetJointAngle():Number{ return (((m_body2.m_sweep.a - m_body1.m_sweep.a) - m_referenceAngle)); } override public function InitVelocityConstraints(step:b2TimeStep):void{ var b1:b2Body; var b2:b2Body; var tMat:b2Mat22; var tX:Number; var r1X:Number; var r1Y:Number; var r2X:Number; var r2Y:Number; var invMass1:Number; var invMass2:Number; var invI1:Number; var invI2:Number; var jointAngle:Number; b1 = m_body1; b2 = m_body2; tMat = b1.m_xf.R; r1X = (m_localAnchor1.x - b1.m_sweep.localCenter.x); r1Y = (m_localAnchor1.y - b1.m_sweep.localCenter.y); tX = ((tMat.col1.x * r1X) + (tMat.col2.x * r1Y)); r1Y = ((tMat.col1.y * r1X) + (tMat.col2.y * r1Y)); r1X = tX; tMat = b2.m_xf.R; r2X = (m_localAnchor2.x - b2.m_sweep.localCenter.x); r2Y = (m_localAnchor2.y - b2.m_sweep.localCenter.y); tX = ((tMat.col1.x * r2X) + (tMat.col2.x * r2Y)); r2Y = ((tMat.col1.y * r2X) + (tMat.col2.y * r2Y)); r2X = tX; invMass1 = b1.m_invMass; invMass2 = b2.m_invMass; invI1 = b1.m_invI; invI2 = b2.m_invI; K1.col1.x = (invMass1 + invMass2); K1.col2.x = 0; K1.col1.y = 0; K1.col2.y = (invMass1 + invMass2); K2.col1.x = ((invI1 * r1Y) * r1Y); K2.col2.x = ((-(invI1) * r1X) * r1Y); K2.col1.y = ((-(invI1) * r1X) * r1Y); K2.col2.y = ((invI1 * r1X) * r1X); K3.col1.x = ((invI2 * r2Y) * r2Y); K3.col2.x = ((-(invI2) * r2X) * r2Y); K3.col1.y = ((-(invI2) * r2X) * r2Y); K3.col2.y = ((invI2 * r2X) * r2X); K.SetM(K1); K.AddM(K2); K.AddM(K3); K.Invert(m_pivotMass); m_motorMass = (1 / (invI1 + invI2)); if (m_enableMotor == false){ m_motorForce = 0; }; if (m_enableLimit){ jointAngle = ((b2.m_sweep.a - b1.m_sweep.a) - m_referenceAngle); if (b2Math.b2Abs((m_upperAngle - m_lowerAngle)) < (2 * b2Settings.b2_angularSlop)){ m_limitState = e_equalLimits; } else { if (jointAngle <= m_lowerAngle){ if (m_limitState != e_atLowerLimit){ m_limitForce = 0; }; m_limitState = e_atLowerLimit; } else { if (jointAngle >= m_upperAngle){ if (m_limitState != e_atUpperLimit){ m_limitForce = 0; }; m_limitState = e_atUpperLimit; } else { m_limitState = e_inactiveLimit; m_limitForce = 0; }; }; }; } else { m_limitForce = 0; }; if (step.warmStarting){ b1.m_linearVelocity.x = (b1.m_linearVelocity.x - ((step.dt * invMass1) * m_pivotForce.x)); b1.m_linearVelocity.y = (b1.m_linearVelocity.y - ((step.dt * invMass1) * m_pivotForce.y)); b1.m_angularVelocity = (b1.m_angularVelocity - ((step.dt * invI1) * ((((r1X * m_pivotForce.y) - (r1Y * m_pivotForce.x)) + m_motorForce) + m_limitForce))); b2.m_linearVelocity.x = (b2.m_linearVelocity.x + ((step.dt * invMass2) * m_pivotForce.x)); b2.m_linearVelocity.y = (b2.m_linearVelocity.y + ((step.dt * invMass2) * m_pivotForce.y)); b2.m_angularVelocity = (b2.m_angularVelocity + ((step.dt * invI2) * ((((r2X * m_pivotForce.y) - (r2Y * m_pivotForce.x)) + m_motorForce) + m_limitForce))); } else { m_pivotForce.SetZero(); m_motorForce = 0; m_limitForce = 0; }; m_limitPositionImpulse = 0; } public function EnableLimit(flag:Boolean):void{ m_enableLimit = flag; } public function GetMotorTorque():Number{ return (m_motorForce); } override public function GetReactionTorque():Number{ return (m_limitForce); } public function IsLimitEnabled():Boolean{ return (m_enableLimit); } public function IsMotorEnabled():Boolean{ return (m_enableMotor); } override public function SolveVelocityConstraints(step:b2TimeStep):void{ var b1:b2Body; var b2:b2Body; var tMat:b2Mat22; var tX:Number; var r1X:Number; var r1Y:Number; var r2X:Number; var r2Y:Number; var oldLimitForce:Number; var pivotCdotX:Number; var pivotCdotY:Number; var pivotForceX:Number; var pivotForceY:Number; var PX:Number; var PY:Number; var motorCdot:Number; var motorForce:Number; var oldMotorForce:Number; var limitCdot:Number; var limitForce:Number; b1 = m_body1; b2 = m_body2; tMat = b1.m_xf.R; r1X = (m_localAnchor1.x - b1.m_sweep.localCenter.x); r1Y = (m_localAnchor1.y - b1.m_sweep.localCenter.y); tX = ((tMat.col1.x * r1X) + (tMat.col2.x * r1Y)); r1Y = ((tMat.col1.y * r1X) + (tMat.col2.y * r1Y)); r1X = tX; tMat = b2.m_xf.R; r2X = (m_localAnchor2.x - b2.m_sweep.localCenter.x); r2Y = (m_localAnchor2.y - b2.m_sweep.localCenter.y); tX = ((tMat.col1.x * r2X) + (tMat.col2.x * r2Y)); r2Y = ((tMat.col1.y * r2X) + (tMat.col2.y * r2Y)); r2X = tX; pivotCdotX = (((b2.m_linearVelocity.x + (-(b2.m_angularVelocity) * r2Y)) - b1.m_linearVelocity.x) - (-(b1.m_angularVelocity) * r1Y)); pivotCdotY = (((b2.m_linearVelocity.y + (b2.m_angularVelocity * r2X)) - b1.m_linearVelocity.y) - (b1.m_angularVelocity * r1X)); pivotForceX = (-(step.inv_dt) * ((m_pivotMass.col1.x * pivotCdotX) + (m_pivotMass.col2.x * pivotCdotY))); pivotForceY = (-(step.inv_dt) * ((m_pivotMass.col1.y * pivotCdotX) + (m_pivotMass.col2.y * pivotCdotY))); m_pivotForce.x = (m_pivotForce.x + pivotForceX); m_pivotForce.y = (m_pivotForce.y + pivotForceY); PX = (step.dt * pivotForceX); PY = (step.dt * pivotForceY); b1.m_linearVelocity.x = (b1.m_linearVelocity.x - (b1.m_invMass * PX)); b1.m_linearVelocity.y = (b1.m_linearVelocity.y - (b1.m_invMass * PY)); b1.m_angularVelocity = (b1.m_angularVelocity - (b1.m_invI * ((r1X * PY) - (r1Y * PX)))); b2.m_linearVelocity.x = (b2.m_linearVelocity.x + (b2.m_invMass * PX)); b2.m_linearVelocity.y = (b2.m_linearVelocity.y + (b2.m_invMass * PY)); b2.m_angularVelocity = (b2.m_angularVelocity + (b2.m_invI * ((r2X * PY) - (r2Y * PX)))); if (((m_enableMotor) && (!((m_limitState == e_equalLimits))))){ motorCdot = ((b2.m_angularVelocity - b1.m_angularVelocity) - m_motorSpeed); motorForce = ((-(step.inv_dt) * m_motorMass) * motorCdot); oldMotorForce = m_motorForce; m_motorForce = b2Math.b2Clamp((m_motorForce + motorForce), -(m_maxMotorTorque), m_maxMotorTorque); motorForce = (m_motorForce - oldMotorForce); b1.m_angularVelocity = (b1.m_angularVelocity - ((b1.m_invI * step.dt) * motorForce)); b2.m_angularVelocity = (b2.m_angularVelocity + ((b2.m_invI * step.dt) * motorForce)); }; if (((m_enableLimit) && (!((m_limitState == e_inactiveLimit))))){ limitCdot = (b2.m_angularVelocity - b1.m_angularVelocity); limitForce = ((-(step.inv_dt) * m_motorMass) * limitCdot); if (m_limitState == e_equalLimits){ m_limitForce = (m_limitForce + limitForce); } else { if (m_limitState == e_atLowerLimit){ oldLimitForce = m_limitForce; m_limitForce = b2Math.b2Max((m_limitForce + limitForce), 0); limitForce = (m_limitForce - oldLimitForce); } else { if (m_limitState == e_atUpperLimit){ oldLimitForce = m_limitForce; m_limitForce = b2Math.b2Min((m_limitForce + limitForce), 0); limitForce = (m_limitForce - oldLimitForce); }; }; }; b1.m_angularVelocity = (b1.m_angularVelocity - ((b1.m_invI * step.dt) * limitForce)); b2.m_angularVelocity = (b2.m_angularVelocity + ((b2.m_invI * step.dt) * limitForce)); }; } } }//package Box2D.Dynamics.Joints
Section 64
//b2RevoluteJointDef (Box2D.Dynamics.Joints.b2RevoluteJointDef) package Box2D.Dynamics.Joints { import Box2D.Dynamics.*; import Box2D.Common.Math.*; public class b2RevoluteJointDef extends b2JointDef { public var referenceAngle:Number; public var upperAngle:Number; public var lowerAngle:Number; public var motorSpeed:Number; public var maxMotorTorque:Number; public var localAnchor1:b2Vec2; public var localAnchor2:b2Vec2; public var enableLimit:Boolean; public var enableMotor:Boolean; public function b2RevoluteJointDef(){ localAnchor1 = new b2Vec2(); localAnchor2 = new b2Vec2(); super(); type = b2Joint.e_revoluteJoint; localAnchor1.Set(0, 0); localAnchor2.Set(0, 0); referenceAngle = 0; lowerAngle = 0; upperAngle = 0; maxMotorTorque = 0; motorSpeed = 0; enableLimit = false; enableMotor = false; } public function Initialize(b1:b2Body, b2:b2Body, anchor:b2Vec2):void{ body1 = b1; body2 = b2; localAnchor1 = body1.GetLocalPoint(anchor); localAnchor2 = body2.GetLocalPoint(anchor); referenceAngle = (body2.GetAngle() - body1.GetAngle()); } } }//package Box2D.Dynamics.Joints
Section 65
//b2Body (Box2D.Dynamics.b2Body) package Box2D.Dynamics { import Box2D.Common.Math.*; import Box2D.Collision.Shapes.*; import Box2D.Dynamics.Joints.*; import Box2D.Dynamics.Contacts.*; public class b2Body { public var m_next:b2Body; public var m_contactList:b2ContactEdge; public var m_angularVelocity:Number; public var m_shapeList:b2Shape; public var m_force:b2Vec2; public var m_mass:Number; public var m_sweep:b2Sweep; public var m_xf:b2XForm; public var m_torque:Number; public var m_userData; public var m_flags:uint; public var m_world:b2World; public var m_prev:b2Body; public var m_invMass:Number; public var m_type:int; public var m_linearDamping:Number; public var m_angularDamping:Number; public var m_invI:Number; public var m_linearVelocity:b2Vec2; public var m_sleepTime:Number; public var m_shapeCount:int; public var m_jointList:b2JointEdge; public var m_I:Number; public static var e_fixedRotationFlag:uint = 64; public static var e_frozenFlag:uint = 2; public static var e_maxTypes:uint = 3; public static var e_sleepFlag:uint = 8; private static var s_massData:b2MassData = new b2MassData(); public static var e_bulletFlag:uint = 32; public static var e_staticType:uint = 1; public static var e_islandFlag:uint = 4; public static var e_allowSleepFlag:uint = 16; private static var s_xf1:b2XForm = new b2XForm(); public static var e_dynamicType:uint = 2; public function b2Body(bd:b2BodyDef, world:b2World){ var tMat:b2Mat22; var tVec:b2Vec2; m_xf = new b2XForm(); m_sweep = new b2Sweep(); m_linearVelocity = new b2Vec2(); m_force = new b2Vec2(); super(); m_flags = 0; if (bd.isBullet){ m_flags = (m_flags | e_bulletFlag); }; if (bd.fixedRotation){ m_flags = (m_flags | e_fixedRotationFlag); }; if (bd.allowSleep){ m_flags = (m_flags | e_allowSleepFlag); }; if (bd.isSleeping){ m_flags = (m_flags | e_sleepFlag); }; m_world = world; m_xf.position.SetV(bd.position); m_xf.R.Set(bd.angle); m_sweep.localCenter.SetV(bd.massData.center); m_sweep.t0 = 1; m_sweep.a0 = (m_sweep.a = bd.angle); tMat = m_xf.R; tVec = m_sweep.localCenter; m_sweep.c.x = ((tMat.col1.x * tVec.x) + (tMat.col2.x * tVec.y)); m_sweep.c.y = ((tMat.col1.y * tVec.x) + (tMat.col2.y * tVec.y)); m_sweep.c.x = (m_sweep.c.x + m_xf.position.x); m_sweep.c.y = (m_sweep.c.y + m_xf.position.y); m_sweep.c0.SetV(m_sweep.c); m_jointList = null; m_contactList = null; m_prev = null; m_next = null; m_linearDamping = bd.linearDamping; m_angularDamping = bd.angularDamping; m_force.Set(0, 0); m_torque = 0; m_linearVelocity.SetZero(); m_angularVelocity = 0; m_sleepTime = 0; m_invMass = 0; m_I = 0; m_invI = 0; m_mass = bd.massData.mass; if (m_mass > 0){ m_invMass = (1 / m_mass); }; if ((m_flags & b2Body.e_fixedRotationFlag) == 0){ m_I = bd.massData.I; }; if (m_I > 0){ m_invI = (1 / m_I); }; if ((((m_invMass == 0)) && ((m_invI == 0)))){ m_type = e_staticType; } else { m_type = e_dynamicType; }; m_userData = bd.userData; m_shapeList = null; m_shapeCount = 0; } public function GetLinearVelocityFromWorldPoint(worldPoint:b2Vec2):b2Vec2{ return (new b2Vec2((m_linearVelocity.x - (m_angularVelocity * (worldPoint.y - m_sweep.c.y))), (m_linearVelocity.y + (m_angularVelocity * (worldPoint.x - m_sweep.c.x))))); } public function SetLinearVelocity(v:b2Vec2):void{ m_linearVelocity.SetV(v); } public function WakeUp():void{ m_flags = (m_flags & ~(e_sleepFlag)); m_sleepTime = 0; } public function GetLocalCenter():b2Vec2{ return (m_sweep.localCenter); } public function ApplyTorque(torque:Number):void{ if (IsSleeping()){ WakeUp(); }; m_torque = (m_torque + torque); } public function IsFrozen():Boolean{ return (((m_flags & e_frozenFlag) == e_frozenFlag)); } public function IsDynamic():Boolean{ return ((m_type == e_dynamicType)); } public function GetLinearVelocity():b2Vec2{ return (m_linearVelocity); } public function SynchronizeTransform():void{ var tMat:b2Mat22; var tVec:b2Vec2; m_xf.R.Set(m_sweep.a); tMat = m_xf.R; tVec = m_sweep.localCenter; m_xf.position.x = (m_sweep.c.x - ((tMat.col1.x * tVec.x) + (tMat.col2.x * tVec.y))); m_xf.position.y = (m_sweep.c.y - ((tMat.col1.y * tVec.x) + (tMat.col2.y * tVec.y))); } public function GetInertia():Number{ return (m_I); } public function IsSleeping():Boolean{ return (((m_flags & e_sleepFlag) == e_sleepFlag)); } public function SetMassFromShapes():void{ var s:b2Shape; var centerX:Number; var centerY:Number; var massData:b2MassData; var tMat:b2Mat22; var tVec:b2Vec2; var oldType:int; if (m_world.m_lock == true){ return; }; m_mass = 0; m_invMass = 0; m_I = 0; m_invI = 0; centerX = 0; centerY = 0; massData = s_massData; s = m_shapeList; while (s) { s.ComputeMass(massData); m_mass = (m_mass + massData.mass); centerX = (centerX + (massData.mass * massData.center.x)); centerY = (centerY + (massData.mass * massData.center.y)); m_I = (m_I + massData.I); s = s.m_next; }; if (m_mass > 0){ m_invMass = (1 / m_mass); centerX = (centerX * m_invMass); centerY = (centerY * m_invMass); }; if ((((m_I > 0)) && (((m_flags & e_fixedRotationFlag) == 0)))){ m_I = (m_I - (m_mass * ((centerX * centerX) + (centerY * centerY)))); m_invI = (1 / m_I); } else { m_I = 0; m_invI = 0; }; m_sweep.localCenter.Set(centerX, centerY); tMat = m_xf.R; tVec = m_sweep.localCenter; m_sweep.c.x = ((tMat.col1.x * tVec.x) + (tMat.col2.x * tVec.y)); m_sweep.c.y = ((tMat.col1.y * tVec.x) + (tMat.col2.y * tVec.y)); m_sweep.c.x = (m_sweep.c.x + m_xf.position.x); m_sweep.c.y = (m_sweep.c.y + m_xf.position.y); m_sweep.c0.SetV(m_sweep.c); s = m_shapeList; while (s) { s.UpdateSweepRadius(m_sweep.localCenter); s = s.m_next; }; oldType = m_type; if ((((m_invMass == 0)) && ((m_invI == 0)))){ m_type = e_staticType; } else { m_type = e_dynamicType; }; if (oldType != m_type){ s = m_shapeList; while (s) { s.RefilterProxy(m_world.m_broadPhase, m_xf); s = s.m_next; }; }; } public function PutToSleep():void{ m_flags = (m_flags | e_sleepFlag); m_sleepTime = 0; m_linearVelocity.SetZero(); m_angularVelocity = 0; m_force.SetZero(); m_torque = 0; } public function GetJointList():b2JointEdge{ return (m_jointList); } public function SetXForm(position:b2Vec2, angle:Number):Boolean{ var s:b2Shape; var tMat:b2Mat22; var tVec:b2Vec2; var freeze:Boolean; var inRange:Boolean; if (m_world.m_lock == true){ return (true); }; if (IsFrozen()){ return (false); }; m_xf.R.Set(angle); m_xf.position.SetV(position); tMat = m_xf.R; tVec = m_sweep.localCenter; m_sweep.c.x = ((tMat.col1.x * tVec.x) + (tMat.col2.x * tVec.y)); m_sweep.c.y = ((tMat.col1.y * tVec.x) + (tMat.col2.y * tVec.y)); m_sweep.c.x = (m_sweep.c.x + m_xf.position.x); m_sweep.c.y = (m_sweep.c.y + m_xf.position.y); m_sweep.c0.SetV(m_sweep.c); m_sweep.a0 = (m_sweep.a = angle); freeze = false; s = m_shapeList; while (s) { inRange = s.Synchronize(m_world.m_broadPhase, m_xf, m_xf); if (inRange == false){ freeze = true; break; }; s = s.m_next; }; if (freeze == true){ m_flags = (m_flags | e_frozenFlag); m_linearVelocity.SetZero(); m_angularVelocity = 0; s = m_shapeList; while (s) { s.DestroyProxy(m_world.m_broadPhase); s = s.m_next; }; return (false); }; m_world.m_broadPhase.Commit(); return (true); } public function GetLocalPoint(worldPoint:b2Vec2):b2Vec2{ return (b2Math.b2MulXT(m_xf, worldPoint)); } public function ApplyForce(force:b2Vec2, point:b2Vec2):void{ if (IsSleeping()){ WakeUp(); }; m_force.x = (m_force.x + force.x); m_force.y = (m_force.y + force.y); m_torque = (m_torque + (((point.x - m_sweep.c.x) * force.y) - ((point.y - m_sweep.c.y) * force.x))); } public function SynchronizeShapes():Boolean{ var xf1:b2XForm; var tMat:b2Mat22; var tVec:b2Vec2; var s:b2Shape; var inRange:Boolean; xf1 = s_xf1; xf1.R.Set(m_sweep.a0); tMat = xf1.R; tVec = m_sweep.localCenter; xf1.position.x = (m_sweep.c0.x - ((tMat.col1.x * tVec.x) + (tMat.col2.x * tVec.y))); xf1.position.y = (m_sweep.c0.y - ((tMat.col1.y * tVec.x) + (tMat.col2.y * tVec.y))); inRange = true; s = m_shapeList; while (s) { inRange = s.Synchronize(m_world.m_broadPhase, xf1, m_xf); if (inRange == false){ break; }; s = s.m_next; }; if (inRange == false){ m_flags = (m_flags | e_frozenFlag); m_linearVelocity.SetZero(); m_angularVelocity = 0; s = m_shapeList; while (s) { s.DestroyProxy(m_world.m_broadPhase); s = s.m_next; }; return (false); }; return (true); } public function GetAngle():Number{ return (m_sweep.a); } public function GetXForm():b2XForm{ return (m_xf); } public function ApplyImpulse(impulse:b2Vec2, point:b2Vec2):void{ if (IsSleeping()){ WakeUp(); }; m_linearVelocity.x = (m_linearVelocity.x + (m_invMass * impulse.x)); m_linearVelocity.y = (m_linearVelocity.y + (m_invMass * impulse.y)); m_angularVelocity = (m_angularVelocity + (m_invI * (((point.x - m_sweep.c.x) * impulse.y) - ((point.y - m_sweep.c.y) * impulse.x)))); } public function GetNext():b2Body{ return (m_next); } public function GetMass():Number{ return (m_mass); } public function GetLinearVelocityFromLocalPoint(localPoint:b2Vec2):b2Vec2{ var A:b2Mat22; var worldPoint:b2Vec2; A = m_xf.R; worldPoint = new b2Vec2(((A.col1.x * localPoint.x) + (A.col2.x * localPoint.y)), ((A.col1.y * localPoint.x) + (A.col2.y * localPoint.y))); worldPoint.x = (worldPoint.x + m_xf.position.x); worldPoint.y = (worldPoint.y + m_xf.position.y); return (new b2Vec2((m_linearVelocity.x + (m_angularVelocity * (worldPoint.y - m_sweep.c.y))), (m_linearVelocity.x - (m_angularVelocity * (worldPoint.x - m_sweep.c.x))))); } public function GetAngularVelocity():Number{ return (m_angularVelocity); } public function SetAngularVelocity(omega:Number):void{ m_angularVelocity = omega; } public function SetMass(massData:b2MassData):void{ var s:b2Shape; var tMat:b2Mat22; var tVec:b2Vec2; var oldType:int; if (m_world.m_lock == true){ return; }; m_invMass = 0; m_I = 0; m_invI = 0; m_mass = massData.mass; if (m_mass > 0){ m_invMass = (1 / m_mass); }; if ((m_flags & b2Body.e_fixedRotationFlag) == 0){ m_I = massData.I; }; if (m_I > 0){ m_invI = (1 / m_I); }; m_sweep.localCenter.SetV(massData.center); tMat = m_xf.R; tVec = m_sweep.localCenter; m_sweep.c.x = ((tMat.col1.x * tVec.x) + (tMat.col2.x * tVec.y)); m_sweep.c.y = ((tMat.col1.y * tVec.x) + (tMat.col2.y * tVec.y)); m_sweep.c.x = (m_sweep.c.x + m_xf.position.x); m_sweep.c.y = (m_sweep.c.y + m_xf.position.y); m_sweep.c0.SetV(m_sweep.c); s = m_shapeList; while (s) { s.UpdateSweepRadius(m_sweep.localCenter); s = s.m_next; }; oldType = m_type; if ((((m_invMass == 0)) && ((m_invI == 0)))){ m_type = e_staticType; } else { m_type = e_dynamicType; }; if (oldType != m_type){ s = m_shapeList; while (s) { s.RefilterProxy(m_world.m_broadPhase, m_xf); s = s.m_next; }; }; } public function IsStatic():Boolean{ return ((m_type == e_staticType)); } public function GetWorldVector(localVector:b2Vec2):b2Vec2{ return (b2Math.b2MulMV(m_xf.R, localVector)); } public function GetShapeList():b2Shape{ return (m_shapeList); } public function Advance(t:Number):void{ m_sweep.Advance(t); m_sweep.c.SetV(m_sweep.c0); m_sweep.a = m_sweep.a0; SynchronizeTransform(); } public function SetBullet(flag:Boolean):void{ if (flag){ m_flags = (m_flags | e_bulletFlag); } else { m_flags = (m_flags & ~(e_bulletFlag)); }; } public function CreateShape(def:b2ShapeDef):b2Shape{ var s:b2Shape; if (m_world.m_lock == true){ return (null); }; s = b2Shape.Create(def, m_world.m_blockAllocator); s.m_next = m_shapeList; m_shapeList = s; m_shapeCount++; s.m_body = this; s.CreateProxy(m_world.m_broadPhase, m_xf); s.UpdateSweepRadius(m_sweep.localCenter); return (s); } public function IsConnected(other:b2Body):Boolean{ var jn:b2JointEdge; jn = m_jointList; while (jn) { if (jn.other == other){ return ((jn.joint.m_collideConnected == false)); }; jn = jn.next; }; return (false); } public function DestroyShape(s:b2Shape):void{ var node:b2Shape; var ppS:b2Shape; var found:Boolean; if (m_world.m_lock == true){ return; }; s.DestroyProxy(m_world.m_broadPhase); node = m_shapeList; ppS = null; found = false; while (node != null) { if (node == s){ if (ppS){ ppS.m_next = s.m_next; } else { m_shapeList = s.m_next; }; found = true; break; }; ppS = node; node = node.m_next; }; s.m_body = null; s.m_next = null; m_shapeCount--; b2Shape.Destroy(s, m_world.m_blockAllocator); } public function GetUserData(){ return (m_userData); } public function IsBullet():Boolean{ return (((m_flags & e_bulletFlag) == e_bulletFlag)); } public function GetWorldCenter():b2Vec2{ return (m_sweep.c); } public function AllowSleeping(flag:Boolean):void{ if (flag){ m_flags = (m_flags | e_allowSleepFlag); } else { m_flags = (m_flags & ~(e_allowSleepFlag)); WakeUp(); }; } public function SetUserData(data):void{ m_userData = data; } public function GetLocalVector(worldVector:b2Vec2):b2Vec2{ return (b2Math.b2MulTMV(m_xf.R, worldVector)); } public function GetWorldPoint(localPoint:b2Vec2):b2Vec2{ var A:b2Mat22; var u:b2Vec2; A = m_xf.R; u = new b2Vec2(((A.col1.x * localPoint.x) + (A.col2.x * localPoint.y)), ((A.col1.y * localPoint.x) + (A.col2.y * localPoint.y))); u.x = (u.x + m_xf.position.x); u.y = (u.y + m_xf.position.y); return (u); } public function GetWorld():b2World{ return (m_world); } public function GetPosition():b2Vec2{ return (m_xf.position); } } }//package Box2D.Dynamics
Section 66
//b2BodyDef (Box2D.Dynamics.b2BodyDef) package Box2D.Dynamics { import Box2D.Common.Math.*; import Box2D.Collision.Shapes.*; public class b2BodyDef { public var isSleeping:Boolean; public var position:b2Vec2; public var isBullet:Boolean; public var allowSleep:Boolean; public var userData; public var angularDamping:Number; public var fixedRotation:Boolean; public var angle:Number; public var linearDamping:Number; public var massData:b2MassData; public function b2BodyDef(){ massData = new b2MassData(); position = new b2Vec2(); super(); massData.center.SetZero(); massData.mass = 0; massData.I = 0; userData = null; position.Set(0, 0); angle = 0; linearDamping = 0; angularDamping = 0; allowSleep = true; isSleeping = false; fixedRotation = false; isBullet = false; } } }//package Box2D.Dynamics
Section 67
//b2BoundaryListener (Box2D.Dynamics.b2BoundaryListener) package Box2D.Dynamics { public class b2BoundaryListener { public function b2BoundaryListener(){ super(); } public function Violation(body:b2Body):void{ } } }//package Box2D.Dynamics
Section 68
//b2ContactFilter (Box2D.Dynamics.b2ContactFilter) package Box2D.Dynamics { import Box2D.Collision.Shapes.*; public class b2ContactFilter { public static var b2_defaultFilter:b2ContactFilter = new (b2ContactFilter); ; public function b2ContactFilter(){ super(); } public function ShouldCollide(shape1:b2Shape, shape2:b2Shape):Boolean{ var filter1:b2FilterData; var filter2:b2FilterData; var collide:Boolean; filter1 = shape1.GetFilterData(); filter2 = shape2.GetFilterData(); if ((((filter1.groupIndex == filter2.groupIndex)) && (!((filter1.groupIndex == 0))))){ return ((filter1.groupIndex > 0)); }; collide = ((!(((filter1.maskBits & filter2.categoryBits) == 0))) && (!(((filter1.categoryBits & filter2.maskBits) == 0)))); return (collide); } } }//package Box2D.Dynamics
Section 69
//b2ContactListener (Box2D.Dynamics.b2ContactListener) package Box2D.Dynamics { import Box2D.Collision.*; import Box2D.Dynamics.Contacts.*; public class b2ContactListener { public function b2ContactListener(){ super(); } public function Add(point:b2ContactPoint):void{ } public function Remove(point:b2ContactPoint):void{ } public function Persist(point:b2ContactPoint):void{ } public function Result(point:b2ContactResult):void{ } } }//package Box2D.Dynamics
Section 70
//b2ContactManager (Box2D.Dynamics.b2ContactManager) package Box2D.Dynamics { import Box2D.Common.Math.*; import Box2D.Collision.*; import Box2D.Collision.Shapes.*; import Box2D.Dynamics.Contacts.*; public class b2ContactManager extends b2PairCallback { public var m_world:b2World; public var m_destroyImmediate:Boolean; public var m_nullContact:b2NullContact; private static const s_evalCP:b2ContactPoint = new b2ContactPoint(); public function b2ContactManager(){ m_nullContact = new b2NullContact(); super(); m_world = null; m_destroyImmediate = false; } override public function PairAdded(proxyUserData1, proxyUserData2){ var shape1:b2Shape; var shape2:b2Shape; var body1:b2Body; var body2:b2Body; var c:b2Contact; shape1 = (proxyUserData1 as b2Shape); shape2 = (proxyUserData2 as b2Shape); body1 = shape1.m_body; body2 = shape2.m_body; if (((body1.IsStatic()) && (body2.IsStatic()))){ return (m_nullContact); }; if (shape1.m_body == shape2.m_body){ return (m_nullContact); }; if (body2.IsConnected(body1)){ return (m_nullContact); }; if (((!((m_world.m_contactFilter == null))) && ((m_world.m_contactFilter.ShouldCollide(shape1, shape2) == false)))){ return (m_nullContact); }; c = b2Contact.Create(shape1, shape2, m_world.m_blockAllocator); if (c == null){ return (m_nullContact); }; shape1 = c.m_shape1; shape2 = c.m_shape2; body1 = shape1.m_body; body2 = shape2.m_body; c.m_prev = null; c.m_next = m_world.m_contactList; if (m_world.m_contactList != null){ m_world.m_contactList.m_prev = c; }; m_world.m_contactList = c; c.m_node1.contact = c; c.m_node1.other = body2; c.m_node1.prev = null; c.m_node1.next = body1.m_contactList; if (body1.m_contactList != null){ body1.m_contactList.prev = c.m_node1; }; body1.m_contactList = c.m_node1; c.m_node2.contact = c; c.m_node2.other = body1; c.m_node2.prev = null; c.m_node2.next = body2.m_contactList; if (body2.m_contactList != null){ body2.m_contactList.prev = c.m_node2; }; body2.m_contactList = c.m_node2; m_world.m_contactCount++; return (c); } override public function PairRemoved(proxyUserData1, proxyUserData2, pairUserData):void{ var c:b2Contact; if (pairUserData == null){ return; }; c = (pairUserData as b2Contact); if (c == m_nullContact){ return; }; Destroy(c); } public function Destroy(c:b2Contact):void{ var shape1:b2Shape; var shape2:b2Shape; var manifoldCount:int; var body1:b2Body; var body2:b2Body; var b1:b2Body; var b2:b2Body; var manifolds:Array; var cp:b2ContactPoint; var i:int; var manifold:b2Manifold; var j:int; var mp:b2ManifoldPoint; var v1:b2Vec2; var v2:b2Vec2; shape1 = c.m_shape1; shape2 = c.m_shape2; manifoldCount = c.m_manifoldCount; if ((((manifoldCount > 0)) && (m_world.m_contactListener))){ b1 = shape1.m_body; b2 = shape2.m_body; manifolds = c.GetManifolds(); cp = s_evalCP; cp.shape1 = c.m_shape1; cp.shape2 = c.m_shape2; cp.friction = c.m_friction; cp.restitution = c.m_restitution; i = 0; while (i < manifoldCount) { manifold = manifolds[i]; cp.normal.SetV(manifold.normal); j = 0; while (j < manifold.pointCount) { mp = manifold.points[j]; cp.position = b1.GetWorldPoint(mp.localPoint1); v1 = b1.GetLinearVelocityFromLocalPoint(mp.localPoint1); v2 = b2.GetLinearVelocityFromLocalPoint(mp.localPoint2); cp.velocity.Set((v2.x - v1.x), (v2.y - v1.y)); cp.separation = mp.separation; cp.id.key = mp.id._key; m_world.m_contactListener.Remove(cp); j++; }; i++; }; }; if (c.m_prev){ c.m_prev.m_next = c.m_next; }; if (c.m_next){ c.m_next.m_prev = c.m_prev; }; if (c == m_world.m_contactList){ m_world.m_contactList = c.m_next; }; body1 = shape1.m_body; body2 = shape2.m_body; if (c.m_node1.prev){ c.m_node1.prev.next = c.m_node1.next; }; if (c.m_node1.next){ c.m_node1.next.prev = c.m_node1.prev; }; if (c.m_node1 == body1.m_contactList){ body1.m_contactList = c.m_node1.next; }; if (c.m_node2.prev){ c.m_node2.prev.next = c.m_node2.next; }; if (c.m_node2.next){ c.m_node2.next.prev = c.m_node2.prev; }; if (c.m_node2 == body2.m_contactList){ body2.m_contactList = c.m_node2.next; }; b2Contact.Destroy(c, m_world.m_blockAllocator); m_world.m_contactCount--; } public function Collide():void{ var c:b2Contact; var body1:b2Body; var body2:b2Body; c = m_world.m_contactList; while (c) { body1 = c.m_shape1.m_body; body2 = c.m_shape2.m_body; if (((body1.IsSleeping()) && (body2.IsSleeping()))){ } else { c.Update(m_world.m_contactListener); }; c = c.m_next; }; } } }//package Box2D.Dynamics
Section 71
//b2DebugDraw (Box2D.Dynamics.b2DebugDraw) package Box2D.Dynamics { import flash.display.*; import Box2D.Common.Math.*; import Box2D.Collision.*; import Box2D.Collision.Shapes.*; import Box2D.Dynamics.Contacts.*; import Box2D.Common.*; public class b2DebugDraw { public var m_xformScale:Number;// = 1 public var m_fillAlpha:Number;// = 1 public var m_alpha:Number;// = 1 public var m_lineThickness:Number;// = 1 public var m_drawFlags:uint; public var m_sprite:Sprite; public var m_drawScale:Number;// = 1 public static var e_coreShapeBit:uint = 4; public static var e_shapeBit:uint = 1; public static var e_centerOfMassBit:uint = 64; public static var e_aabbBit:uint = 8; public static var e_obbBit:uint = 16; public static var e_pairBit:uint = 32; public static var e_jointBit:uint = 2; public function b2DebugDraw(){ m_drawScale = 1; m_lineThickness = 1; m_alpha = 1; m_fillAlpha = 1; m_xformScale = 1; super(); m_drawFlags = 0; } public function DrawSolidPolygon(vertices:Array, vertexCount:int, color:b2Color):void{ var i:int; m_sprite.graphics.lineStyle(m_lineThickness, color.color, m_alpha); m_sprite.graphics.moveTo((vertices[0].x * m_drawScale), (vertices[0].y * m_drawScale)); m_sprite.graphics.beginFill(color.color, m_fillAlpha); i = 1; while (i < vertexCount) { m_sprite.graphics.lineTo((vertices[i].x * m_drawScale), (vertices[i].y * m_drawScale)); i++; }; m_sprite.graphics.lineTo((vertices[0].x * m_drawScale), (vertices[0].y * m_drawScale)); m_sprite.graphics.endFill(); } public function DrawCircle(center:b2Vec2, radius:Number, color:b2Color):void{ m_sprite.graphics.lineStyle(m_lineThickness, color.color, m_alpha); m_sprite.graphics.drawCircle((center.x * m_drawScale), (center.y * m_drawScale), (radius * m_drawScale)); } public function DrawXForm(xf:b2XForm):void{ m_sprite.graphics.lineStyle(m_lineThickness, 0xFF0000, m_alpha); m_sprite.graphics.moveTo((xf.position.x * m_drawScale), (xf.position.y * m_drawScale)); m_sprite.graphics.lineTo(((xf.position.x + (m_xformScale * xf.R.col1.x)) * m_drawScale), ((xf.position.y + (m_xformScale * xf.R.col1.y)) * m_drawScale)); m_sprite.graphics.lineStyle(m_lineThickness, 0xFF00, m_alpha); m_sprite.graphics.moveTo((xf.position.x * m_drawScale), (xf.position.y * m_drawScale)); m_sprite.graphics.lineTo(((xf.position.x + (m_xformScale * xf.R.col2.x)) * m_drawScale), ((xf.position.y + (m_xformScale * xf.R.col2.y)) * m_drawScale)); } public function ClearFlags(flags:uint):void{ m_drawFlags = (m_drawFlags & ~(flags)); } public function DrawSolidCircle(center:b2Vec2, radius:Number, axis:b2Vec2, color:b2Color):void{ m_sprite.graphics.lineStyle(m_lineThickness, color.color, m_alpha); m_sprite.graphics.moveTo(0, 0); m_sprite.graphics.beginFill(color.color, m_fillAlpha); m_sprite.graphics.drawCircle((center.x * m_drawScale), (center.y * m_drawScale), (radius * m_drawScale)); m_sprite.graphics.endFill(); m_sprite.graphics.moveTo((center.x * m_drawScale), (center.y * m_drawScale)); m_sprite.graphics.lineTo(((center.x + (axis.x * radius)) * m_drawScale), ((center.y + (axis.y * radius)) * m_drawScale)); } public function SetFlags(flags:uint):void{ m_drawFlags = flags; } public function AppendFlags(flags:uint):void{ m_drawFlags = (m_drawFlags | flags); } public function DrawSegment(p1:b2Vec2, p2:b2Vec2, color:b2Color):void{ m_sprite.graphics.lineStyle(m_lineThickness, color.color, m_alpha); m_sprite.graphics.moveTo((p1.x * m_drawScale), (p1.y * m_drawScale)); m_sprite.graphics.lineTo((p2.x * m_drawScale), (p2.y * m_drawScale)); } public function GetFlags():uint{ return (m_drawFlags); } public function DrawPolygon(vertices:Array, vertexCount:int, color:b2Color):void{ var i:int; m_sprite.graphics.lineStyle(m_lineThickness, color.color, m_alpha); m_sprite.graphics.moveTo((vertices[0].x * m_drawScale), (vertices[0].y * m_drawScale)); i = 1; while (i < vertexCount) { m_sprite.graphics.lineTo((vertices[i].x * m_drawScale), (vertices[i].y * m_drawScale)); i++; }; m_sprite.graphics.lineTo((vertices[0].x * m_drawScale), (vertices[0].y * m_drawScale)); } } }//package Box2D.Dynamics
Section 72
//b2DestructionListener (Box2D.Dynamics.b2DestructionListener) package Box2D.Dynamics { import Box2D.Collision.Shapes.*; import Box2D.Dynamics.Joints.*; public class b2DestructionListener { public function b2DestructionListener(){ super(); } public function SayGoodbyeJoint(joint:b2Joint):void{ } public function SayGoodbyeShape(shape:b2Shape):void{ } } }//package Box2D.Dynamics
Section 73
//b2Island (Box2D.Dynamics.b2Island) package Box2D.Dynamics { import Box2D.Common.Math.*; import Box2D.Collision.*; import Box2D.Dynamics.Joints.*; import Box2D.Dynamics.Contacts.*; import Box2D.Common.*; public class b2Island { public var m_joints:Array; public var m_listener:b2ContactListener; public var m_positionIterationCount:int; public var m_bodyCapacity:int; public var m_bodies:Array; public var m_jointCapacity:int; public var m_contactCount:int; public var m_contacts:Array; public var m_contactCapacity:int; public var m_jointCount:int; public var m_allocator; public var m_bodyCount:int; private static var s_reportCR:b2ContactResult = new b2ContactResult(); public function b2Island(bodyCapacity:int, contactCapacity:int, jointCapacity:int, allocator, listener:b2ContactListener){ var i:int; super(); m_bodyCapacity = bodyCapacity; m_contactCapacity = contactCapacity; m_jointCapacity = jointCapacity; m_bodyCount = 0; m_contactCount = 0; m_jointCount = 0; m_allocator = allocator; m_listener = listener; m_bodies = new Array(bodyCapacity); i = 0; while (i < bodyCapacity) { m_bodies[i] = null; i++; }; m_contacts = new Array(contactCapacity); i = 0; while (i < contactCapacity) { m_contacts[i] = null; i++; }; m_joints = new Array(jointCapacity); i = 0; while (i < jointCapacity) { m_joints[i] = null; i++; }; m_positionIterationCount = 0; } public function AddBody(body:b2Body):void{ var _local2 = m_bodyCount++; m_bodies[_local2] = body; } public function AddJoint(joint:b2Joint):void{ var _local2 = m_jointCount++; m_joints[_local2] = joint; } public function Report(constraints:Array):void{ var tMat:b2Mat22; var tVec:b2Vec2; var i:int; var c:b2Contact; var cc:b2ContactConstraint; var cr:b2ContactResult; var b1:b2Body; var manifoldCount:int; var manifolds:Array; var j:int; var manifold:b2Manifold; var k:int; var point:b2ManifoldPoint; var ccp:b2ContactConstraintPoint; if (m_listener == null){ return; }; i = 0; while (i < m_contactCount) { c = m_contacts[i]; cc = constraints[i]; cr = s_reportCR; cr.shape1 = c.m_shape1; cr.shape2 = c.m_shape2; b1 = cr.shape1.m_body; manifoldCount = c.m_manifoldCount; manifolds = c.GetManifolds(); j = 0; while (j < manifoldCount) { manifold = manifolds[j]; cr.normal.SetV(manifold.normal); k = 0; while (k < manifold.pointCount) { point = manifold.points[k]; ccp = cc.points[k]; cr.position = b1.GetWorldPoint(point.localPoint1); cr.normalImpulse = ccp.normalImpulse; cr.tangentImpulse = ccp.tangentImpulse; cr.id.key = point.id.key; m_listener.Result(cr); k++; }; j++; }; i++; }; } public function Solve(step:b2TimeStep, gravity:b2Vec2, correctPositions:Boolean, allowSleep:Boolean):void{ var i:int; var b:b2Body; var joint:b2Joint; var contactSolver:b2ContactSolver; var j:int; var contactsOkay:Boolean; var jointsOkay:Boolean; var jointOkay:Boolean; var minSleepTime:Number; var linTolSqr:Number; var angTolSqr:Number; i = 0; while (i < m_bodyCount) { b = m_bodies[i]; if (b.IsStatic()){ } else { b.m_linearVelocity.x = (b.m_linearVelocity.x + (step.dt * (gravity.x + (b.m_invMass * b.m_force.x)))); b.m_linearVelocity.y = (b.m_linearVelocity.y + (step.dt * (gravity.y + (b.m_invMass * b.m_force.y)))); b.m_angularVelocity = (b.m_angularVelocity + ((step.dt * b.m_invI) * b.m_torque)); b.m_force.SetZero(); b.m_torque = 0; b.m_linearVelocity.Multiply(b2Math.b2Clamp((1 - (step.dt * b.m_linearDamping)), 0, 1)); b.m_angularVelocity = (b.m_angularVelocity * b2Math.b2Clamp((1 - (step.dt * b.m_angularDamping)), 0, 1)); if (b.m_linearVelocity.LengthSquared() > b2Settings.b2_maxLinearVelocitySquared){ b.m_linearVelocity.Normalize(); b.m_linearVelocity.x = (b.m_linearVelocity.x * b2Settings.b2_maxLinearVelocity); b.m_linearVelocity.y = (b.m_linearVelocity.y * b2Settings.b2_maxLinearVelocity); }; if ((b.m_angularVelocity * b.m_angularVelocity) > b2Settings.b2_maxAngularVelocitySquared){ if (b.m_angularVelocity < 0){ b.m_angularVelocity = -(b2Settings.b2_maxAngularVelocity); } else { b.m_angularVelocity = b2Settings.b2_maxAngularVelocity; }; }; }; i++; }; contactSolver = new b2ContactSolver(step, m_contacts, m_contactCount, m_allocator); contactSolver.InitVelocityConstraints(step); i = 0; while (i < m_jointCount) { joint = m_joints[i]; joint.InitVelocityConstraints(step); i++; }; i = 0; while (i < step.maxIterations) { contactSolver.SolveVelocityConstraints(); j = 0; while (j < m_jointCount) { joint = m_joints[j]; joint.SolveVelocityConstraints(step); j++; }; i++; }; contactSolver.FinalizeVelocityConstraints(); i = 0; while (i < m_bodyCount) { b = m_bodies[i]; if (b.IsStatic()){ } else { b.m_sweep.c0.SetV(b.m_sweep.c); b.m_sweep.a0 = b.m_sweep.a; b.m_sweep.c.x = (b.m_sweep.c.x + (step.dt * b.m_linearVelocity.x)); b.m_sweep.c.y = (b.m_sweep.c.y + (step.dt * b.m_linearVelocity.y)); b.m_sweep.a = (b.m_sweep.a + (step.dt * b.m_angularVelocity)); b.SynchronizeTransform(); }; i++; }; if (correctPositions){ i = 0; while (i < m_jointCount) { joint = m_joints[i]; joint.InitPositionConstraints(); i++; }; m_positionIterationCount = 0; while (m_positionIterationCount < step.maxIterations) { contactsOkay = contactSolver.SolvePositionConstraints(b2Settings.b2_contactBaumgarte); jointsOkay = true; i = 0; while (i < m_jointCount) { joint = m_joints[i]; jointOkay = joint.SolvePositionConstraints(); jointsOkay = ((jointsOkay) && (jointOkay)); i++; }; if (((contactsOkay) && (jointsOkay))){ break; }; m_positionIterationCount++; }; }; Report(contactSolver.m_constraints); if (allowSleep){ minSleepTime = Number.MAX_VALUE; linTolSqr = (b2Settings.b2_linearSleepTolerance * b2Settings.b2_linearSleepTolerance); angTolSqr = (b2Settings.b2_angularSleepTolerance * b2Settings.b2_angularSleepTolerance); i = 0; while (i < m_bodyCount) { b = m_bodies[i]; if (b.m_invMass == 0){ } else { if ((b.m_flags & b2Body.e_allowSleepFlag) == 0){ b.m_sleepTime = 0; minSleepTime = 0; }; if (((((((b.m_flags & b2Body.e_allowSleepFlag) == 0)) || (((b.m_angularVelocity * b.m_angularVelocity) > angTolSqr)))) || ((b2Math.b2Dot(b.m_linearVelocity, b.m_linearVelocity) > linTolSqr)))){ b.m_sleepTime = 0; minSleepTime = 0; } else { b.m_sleepTime = (b.m_sleepTime + step.dt); minSleepTime = b2Math.b2Min(minSleepTime, b.m_sleepTime); }; }; i++; }; if (minSleepTime >= b2Settings.b2_timeToSleep){ i = 0; while (i < m_bodyCount) { b = m_bodies[i]; b.m_flags = (b.m_flags | b2Body.e_sleepFlag); b.m_linearVelocity.SetZero(); b.m_angularVelocity = 0; i++; }; }; }; } public function AddContact(contact:b2Contact):void{ var _local2 = m_contactCount++; m_contacts[_local2] = contact; } public function Clear():void{ m_bodyCount = 0; m_contactCount = 0; m_jointCount = 0; } public function SolveTOI(subStep:b2TimeStep):void{ var i:int; var contactSolver:b2ContactSolver; var k_toiBaumgarte:Number; var b:b2Body; var contactsOkay:Boolean; contactSolver = new b2ContactSolver(subStep, m_contacts, m_contactCount, m_allocator); i = 0; while (i < subStep.maxIterations) { contactSolver.SolveVelocityConstraints(); i++; }; i = 0; while (i < m_bodyCount) { b = m_bodies[i]; if (b.IsStatic()){ } else { b.m_sweep.c0.SetV(b.m_sweep.c); b.m_sweep.a0 = b.m_sweep.a; b.m_sweep.c.x = (b.m_sweep.c.x + (subStep.dt * b.m_linearVelocity.x)); b.m_sweep.c.y = (b.m_sweep.c.y + (subStep.dt * b.m_linearVelocity.y)); b.m_sweep.a = (b.m_sweep.a + (subStep.dt * b.m_angularVelocity)); b.SynchronizeTransform(); }; i++; }; k_toiBaumgarte = 0.75; i = 0; while (i < subStep.maxIterations) { contactsOkay = contactSolver.SolvePositionConstraints(k_toiBaumgarte); if (contactsOkay){ break; }; i++; }; Report(contactSolver.m_constraints); } } }//package Box2D.Dynamics
Section 74
//b2TimeStep (Box2D.Dynamics.b2TimeStep) package Box2D.Dynamics { public class b2TimeStep { public var warmStarting:Boolean; public var positionCorrection:Boolean; public var dt:Number; public var maxIterations:int; public var dtRatio:Number; public var inv_dt:Number; public function b2TimeStep(){ super(); } } }//package Box2D.Dynamics
Section 75
//b2World (Box2D.Dynamics.b2World) package Box2D.Dynamics { import Box2D.Common.Math.*; import Box2D.Collision.*; import Box2D.Collision.Shapes.*; import Box2D.Dynamics.Joints.*; import Box2D.Dynamics.Contacts.*; import Box2D.Common.*; public class b2World { public var m_inv_dt0:Number; public var m_boundaryListener:b2BoundaryListener; public var m_contactList:b2Contact; public var m_blockAllocator; public var m_contactListener:b2ContactListener; public var m_allowSleep:Boolean; public var m_broadPhase:b2BroadPhase; public var m_destructionListener:b2DestructionListener; public var m_jointCount:int; public var m_bodyCount:int; public var m_lock:Boolean; public var m_positionIterationCount:int; public var m_groundBody:b2Body; public var m_contactCount:int; public var m_debugDraw:b2DebugDraw; public var m_contactFilter:b2ContactFilter; public var m_bodyList:b2Body; public var m_stackAllocator; public var m_jointList:b2Joint; public var m_gravity:b2Vec2; public var m_contactManager:b2ContactManager; private static var s_jointColor:b2Color = new b2Color(0.5, 0.8, 0.8); public static var m_continuousPhysics:Boolean; public static var m_warmStarting:Boolean; private static var s_coreColor:b2Color = new b2Color(0.9, 0.6, 0.6); public static var m_positionCorrection:Boolean; private static var s_xf:b2XForm = new b2XForm(); public function b2World(worldAABB:b2AABB, gravity:b2Vec2, doSleep:Boolean){ var bd:b2BodyDef; m_contactManager = new b2ContactManager(); super(); m_destructionListener = null; m_boundaryListener = null; m_contactFilter = b2ContactFilter.b2_defaultFilter; m_contactListener = null; m_debugDraw = null; m_bodyList = null; m_contactList = null; m_jointList = null; m_bodyCount = 0; m_contactCount = 0; m_jointCount = 0; m_positionCorrection = true; m_warmStarting = true; m_continuousPhysics = true; m_allowSleep = doSleep; m_gravity = gravity; m_lock = false; m_inv_dt0 = 0; m_contactManager.m_world = this; m_broadPhase = new b2BroadPhase(worldAABB, m_contactManager); bd = new b2BodyDef(); m_groundBody = CreateBody(bd); } public function DrawJoint(joint:b2Joint):void{ var b1:b2Body; var b2:b2Body; var xf1:b2XForm; var xf2:b2XForm; var x1:b2Vec2; var x2:b2Vec2; var p1:b2Vec2; var p2:b2Vec2; var color:b2Color; var pulley:b2PulleyJoint; var s1:b2Vec2; var s2:b2Vec2; b1 = joint.m_body1; b2 = joint.m_body2; xf1 = b1.m_xf; xf2 = b2.m_xf; x1 = xf1.position; x2 = xf2.position; p1 = joint.GetAnchor1(); p2 = joint.GetAnchor2(); color = s_jointColor; switch (joint.m_type){ case b2Joint.e_distanceJoint: m_debugDraw.DrawSegment(p1, p2, color); break; case b2Joint.e_pulleyJoint: pulley = (joint as b2PulleyJoint); s1 = pulley.GetGroundAnchor1(); s2 = pulley.GetGroundAnchor2(); m_debugDraw.DrawSegment(s1, p1, color); m_debugDraw.DrawSegment(s2, p2, color); m_debugDraw.DrawSegment(s1, s2, color); break; case b2Joint.e_mouseJoint: m_debugDraw.DrawSegment(p1, p2, color); break; default: if (b1 != m_groundBody){ m_debugDraw.DrawSegment(x1, p1, color); }; m_debugDraw.DrawSegment(p1, p2, color); if (b2 != m_groundBody){ m_debugDraw.DrawSegment(x2, p2, color); }; }; } public function Refilter(shape:b2Shape):void{ shape.RefilterProxy(m_broadPhase, shape.m_body.m_xf); } public function SetDebugDraw(debugDraw:b2DebugDraw):void{ m_debugDraw = debugDraw; } public function SetContinuousPhysics(flag:Boolean):void{ m_continuousPhysics = flag; } public function GetProxyCount():int{ return (m_broadPhase.m_proxyCount); } public function DrawDebugData():void{ var flags:uint; var i:int; var b:b2Body; var s:b2Shape; var j:b2Joint; var bp:b2BroadPhase; var invQ:b2Vec2; var x1:b2Vec2; var x2:b2Vec2; var color:b2Color; var xf:b2XForm; var b1:b2AABB; var b2:b2AABB; var vs:Array; var core:Boolean; var index:uint; var pair:b2Pair; var p1:b2Proxy; var p2:b2Proxy; var worldLower:b2Vec2; var worldUpper:b2Vec2; var p:b2Proxy; var poly:b2PolygonShape; var obb:b2OBB; var h:b2Vec2; var tMat:b2Mat22; var tVec:b2Vec2; var tX:Number; if (m_debugDraw == null){ return; }; m_debugDraw.m_sprite.graphics.clear(); flags = m_debugDraw.GetFlags(); invQ = new b2Vec2(); x1 = new b2Vec2(); x2 = new b2Vec2(); color = new b2Color(0, 0, 0); b1 = new b2AABB(); b2 = new b2AABB(); vs = [new b2Vec2(), new b2Vec2(), new b2Vec2(), new b2Vec2()]; if ((flags & b2DebugDraw.e_shapeBit)){ core = ((flags & b2DebugDraw.e_coreShapeBit) == b2DebugDraw.e_coreShapeBit); b = m_bodyList; while (b) { xf = b.m_xf; s = b.GetShapeList(); while (s) { if (b.IsStatic()){ DrawShape(s, xf, new b2Color(0.5, 0.9, 0.5), core); } else { if (b.IsSleeping()){ DrawShape(s, xf, new b2Color(0.5, 0.5, 0.9), core); } else { DrawShape(s, xf, new b2Color(0.9, 0.9, 0.9), core); }; }; s = s.m_next; }; b = b.m_next; }; }; if ((flags & b2DebugDraw.e_jointBit)){ j = m_jointList; while (j) { DrawJoint(j); j = j.m_next; }; }; if ((flags & b2DebugDraw.e_pairBit)){ bp = m_broadPhase; invQ.Set((1 / bp.m_quantizationFactor.x), (1 / bp.m_quantizationFactor.y)); color.Set(0.9, 0.9, 0.3); i = 0; while (i < b2Pair.b2_tableCapacity) { index = bp.m_pairManager.m_hashTable[i]; while (index != b2Pair.b2_nullPair) { pair = bp.m_pairManager.m_pairs[index]; p1 = bp.m_proxyPool[pair.proxyId1]; p2 = bp.m_proxyPool[pair.proxyId2]; b1.lowerBound.x = (bp.m_worldAABB.lowerBound.x + (invQ.x * bp.m_bounds[0][p1.lowerBounds[0]].value)); b1.lowerBound.y = (bp.m_worldAABB.lowerBound.y + (invQ.y * bp.m_bounds[1][p1.lowerBounds[1]].value)); b1.upperBound.x = (bp.m_worldAABB.lowerBound.x + (invQ.x * bp.m_bounds[0][p1.upperBounds[0]].value)); b1.upperBound.y = (bp.m_worldAABB.lowerBound.y + (invQ.y * bp.m_bounds[1][p1.upperBounds[1]].value)); b2.lowerBound.x = (bp.m_worldAABB.lowerBound.x + (invQ.x * bp.m_bounds[0][p2.lowerBounds[0]].value)); b2.lowerBound.y = (bp.m_worldAABB.lowerBound.y + (invQ.y * bp.m_bounds[1][p2.lowerBounds[1]].value)); b2.upperBound.x = (bp.m_worldAABB.lowerBound.x + (invQ.x * bp.m_bounds[0][p2.upperBounds[0]].value)); b2.upperBound.y = (bp.m_worldAABB.lowerBound.y + (invQ.y * bp.m_bounds[1][p2.upperBounds[1]].value)); x1.x = (0.5 * (b1.lowerBound.x + b1.upperBound.x)); x1.y = (0.5 * (b1.lowerBound.y + b1.upperBound.y)); x2.x = (0.5 * (b2.lowerBound.x + b2.upperBound.x)); x2.y = (0.5 * (b2.lowerBound.y + b2.upperBound.y)); m_debugDraw.DrawSegment(x1, x2, color); index = pair.next; }; i++; }; }; if ((flags & b2DebugDraw.e_aabbBit)){ bp = m_broadPhase; worldLower = bp.m_worldAABB.lowerBound; worldUpper = bp.m_worldAABB.upperBound; invQ.Set((1 / bp.m_quantizationFactor.x), (1 / bp.m_quantizationFactor.y)); color.Set(0.9, 0.3, 0.9); i = 0; while (i < b2Settings.b2_maxProxies) { p = bp.m_proxyPool[i]; if (p.IsValid() == false){ } else { b1.lowerBound.x = (worldLower.x + (invQ.x * bp.m_bounds[0][p.lowerBounds[0]].value)); b1.lowerBound.y = (worldLower.y + (invQ.y * bp.m_bounds[1][p.lowerBounds[1]].value)); b1.upperBound.x = (worldLower.x + (invQ.x * bp.m_bounds[0][p.upperBounds[0]].value)); b1.upperBound.y = (worldLower.y + (invQ.y * bp.m_bounds[1][p.upperBounds[1]].value)); vs[0].Set(b1.lowerBound.x, b1.lowerBound.y); vs[1].Set(b1.upperBound.x, b1.lowerBound.y); vs[2].Set(b1.upperBound.x, b1.upperBound.y); vs[3].Set(b1.lowerBound.x, b1.upperBound.y); m_debugDraw.DrawPolygon(vs, 4, color); }; i++; }; vs[0].Set(worldLower.x, worldLower.y); vs[1].Set(worldUpper.x, worldLower.y); vs[2].Set(worldUpper.x, worldUpper.y); vs[3].Set(worldLower.x, worldUpper.y); m_debugDraw.DrawPolygon(vs, 4, new b2Color(0.3, 0.9, 0.9)); }; if ((flags & b2DebugDraw.e_obbBit)){ color.Set(0.5, 0.3, 0.5); b = m_bodyList; while (b) { xf = b.m_xf; s = b.GetShapeList(); while (s) { if (s.m_type != b2Shape.e_polygonShape){ } else { poly = (s as b2PolygonShape); obb = poly.GetOBB(); h = obb.extents; vs[0].Set(-(h.x), -(h.y)); vs[1].Set(h.x, -(h.y)); vs[2].Set(h.x, h.y); vs[3].Set(-(h.x), h.y); i = 0; while (i < 4) { tMat = obb.R; tVec = vs[i]; tX = (obb.center.x + ((tMat.col1.x * tVec.x) + (tMat.col2.x * tVec.y))); vs[i].y = (obb.center.y + ((tMat.col1.y * tVec.x) + (tMat.col2.y * tVec.y))); vs[i].x = tX; tMat = xf.R; tX = (xf.position.x + ((tMat.col1.x * tVec.x) + (tMat.col2.x * tVec.y))); vs[i].y = (xf.position.y + ((tMat.col1.y * tVec.x) + (tMat.col2.y * tVec.y))); vs[i].x = tX; i++; }; m_debugDraw.DrawPolygon(vs, 4, color); }; s = s.m_next; }; b = b.m_next; }; }; if ((flags & b2DebugDraw.e_centerOfMassBit)){ b = m_bodyList; while (b) { xf = s_xf; xf.R = b.m_xf.R; xf.position = b.GetWorldCenter(); m_debugDraw.DrawXForm(xf); b = b.m_next; }; }; } public function DestroyBody(b:b2Body):void{ var jn:b2JointEdge; var s:b2Shape; var jn0:b2JointEdge; var s0:b2Shape; if (m_lock == true){ return; }; jn = b.m_jointList; while (jn) { jn0 = jn; jn = jn.next; if (m_destructionListener){ m_destructionListener.SayGoodbyeJoint(jn0.joint); }; DestroyJoint(jn0.joint); }; s = b.m_shapeList; while (s) { s0 = s; s = s.m_next; if (m_destructionListener){ m_destructionListener.SayGoodbyeShape(s0); }; s0.DestroyProxy(m_broadPhase); b2Shape.Destroy(s0, m_blockAllocator); }; if (b.m_prev){ b.m_prev.m_next = b.m_next; }; if (b.m_next){ b.m_next.m_prev = b.m_prev; }; if (b == m_bodyList){ m_bodyList = b.m_next; }; m_bodyCount--; } public function SetContactFilter(filter:b2ContactFilter):void{ m_contactFilter = filter; } public function GetGroundBody():b2Body{ return (m_groundBody); } public function DrawShape(shape:b2Shape, xf:b2XForm, color:b2Color, core:Boolean):void{ var coreColor:b2Color; var circle:b2CircleShape; var center:b2Vec2; var radius:Number; var axis:b2Vec2; var i:int; var poly:b2PolygonShape; var vertexCount:int; var localVertices:Array; var vertices:Array; var localCoreVertices:Array; coreColor = s_coreColor; switch (shape.m_type){ case b2Shape.e_circleShape: circle = (shape as b2CircleShape); center = b2Math.b2MulX(xf, circle.m_localPosition); radius = circle.m_radius; axis = xf.R.col1; m_debugDraw.DrawSolidCircle(center, radius, axis, color); if (core){ m_debugDraw.DrawCircle(center, (radius - b2Settings.b2_toiSlop), coreColor); }; break; case b2Shape.e_polygonShape: poly = (shape as b2PolygonShape); vertexCount = poly.GetVertexCount(); localVertices = poly.GetVertices(); vertices = new Array(b2Settings.b2_maxPolygonVertices); i = 0; while (i < vertexCount) { vertices[i] = b2Math.b2MulX(xf, localVertices[i]); i++; }; m_debugDraw.DrawSolidPolygon(vertices, vertexCount, color); if (core){ localCoreVertices = poly.GetCoreVertices(); i = 0; while (i < vertexCount) { vertices[i] = b2Math.b2MulX(xf, localCoreVertices[i]); i++; }; m_debugDraw.DrawPolygon(vertices, vertexCount, coreColor); }; break; }; } public function GetContactCount():int{ return (m_contactCount); } public function Solve(step:b2TimeStep):void{ var b:b2Body; var island:b2Island; var c:b2Contact; var j:b2Joint; var stackSize:int; var stack:Array; var seed:b2Body; var stackCount:int; var i:int; var other:b2Body; var cn:b2ContactEdge; var jn:b2JointEdge; var inRange:Boolean; m_positionIterationCount = 0; island = new b2Island(m_bodyCount, m_contactCount, m_jointCount, m_stackAllocator, m_contactListener); b = m_bodyList; while (b) { b.m_flags = (b.m_flags & ~(b2Body.e_islandFlag)); b = b.m_next; }; c = m_contactList; while (c) { c.m_flags = (c.m_flags & ~(b2Contact.e_islandFlag)); c = c.m_next; }; j = m_jointList; while (j) { j.m_islandFlag = false; j = j.m_next; }; stackSize = m_bodyCount; stack = new Array(stackSize); seed = m_bodyList; while (seed) { if ((seed.m_flags & ((b2Body.e_islandFlag | b2Body.e_sleepFlag) | b2Body.e_frozenFlag))){ } else { if (seed.IsStatic()){ } else { island.Clear(); stackCount = 0; var _temp1 = stackCount; stackCount = (stackCount + 1); var _local15 = _temp1; stack[_local15] = seed; seed.m_flags = (seed.m_flags | b2Body.e_islandFlag); while (stackCount > 0) { --stackCount; b = stack[stackCount]; island.AddBody(b); b.m_flags = (b.m_flags & ~(b2Body.e_sleepFlag)); if (b.IsStatic()){ } else { cn = b.m_contactList; while (cn) { if ((cn.contact.m_flags & (b2Contact.e_islandFlag | b2Contact.e_nonSolidFlag))){ } else { if (cn.contact.m_manifoldCount == 0){ } else { island.AddContact(cn.contact); cn.contact.m_flags = (cn.contact.m_flags | b2Contact.e_islandFlag); other = cn.other; if ((other.m_flags & b2Body.e_islandFlag)){ } else { var _temp2 = stackCount; stackCount = (stackCount + 1); var _local16 = _temp2; stack[_local16] = other; other.m_flags = (other.m_flags | b2Body.e_islandFlag); }; }; }; cn = cn.next; }; jn = b.m_jointList; while (jn) { if (jn.joint.m_islandFlag == true){ } else { island.AddJoint(jn.joint); jn.joint.m_islandFlag = true; other = jn.other; if ((other.m_flags & b2Body.e_islandFlag)){ } else { var _temp3 = stackCount; stackCount = (stackCount + 1); _local16 = _temp3; stack[_local16] = other; other.m_flags = (other.m_flags | b2Body.e_islandFlag); }; }; jn = jn.next; }; }; }; island.Solve(step, m_gravity, m_positionCorrection, m_allowSleep); if (island.m_positionIterationCount > m_positionIterationCount){ m_positionIterationCount = island.m_positionIterationCount; }; i = 0; while (i < island.m_bodyCount) { b = island.m_bodies[i]; if (b.IsStatic()){ b.m_flags = (b.m_flags & ~(b2Body.e_islandFlag)); }; i++; }; }; }; seed = seed.m_next; }; b = m_bodyList; while (b) { if ((b.m_flags & (b2Body.e_sleepFlag | b2Body.e_frozenFlag))){ } else { if (b.IsStatic()){ } else { inRange = b.SynchronizeShapes(); if ((((inRange == false)) && (!((m_boundaryListener == null))))){ m_boundaryListener.Violation(b); }; }; }; b = b.m_next; }; m_broadPhase.Commit(); } public function Query(aabb:b2AABB, shapes:Array, maxCount:int):int{ var results:Array; var count:int; var i:int; results = new Array(maxCount); count = m_broadPhase.QueryAABB(aabb, results, maxCount); i = 0; while (i < count) { shapes[i] = results[i]; i++; }; return (count); } public function SetGravity(gravity:b2Vec2):void{ m_gravity = gravity; } public function SolveTOI(step:b2TimeStep):void{ var b:b2Body; var s1:b2Shape; var s2:b2Shape; var b1:b2Body; var b2:b2Body; var cn:b2ContactEdge; var island:b2Island; var stackSize:int; var stack:Array; var c:b2Contact; var minContact:b2Contact; var minTOI:Number; var seed:b2Body; var stackCount:int; var subStep:b2TimeStep; var i:int; var toi:Number; var t0:Number; var other:b2Body; var inRange:Boolean; island = new b2Island(m_bodyCount, b2Settings.b2_maxTOIContactsPerIsland, 0, m_stackAllocator, m_contactListener); stackSize = m_bodyCount; stack = new Array(stackSize); b = m_bodyList; while (b) { b.m_flags = (b.m_flags & ~(b2Body.e_islandFlag)); b.m_sweep.t0 = 0; b = b.m_next; }; c = m_contactList; while (c) { c.m_flags = (c.m_flags & ~((b2Contact.e_toiFlag | b2Contact.e_islandFlag))); c = c.m_next; }; while (true) { minContact = null; minTOI = 1; c = m_contactList; for (;c;(c = c.m_next)) { if ((c.m_flags & (b2Contact.e_slowFlag | b2Contact.e_nonSolidFlag))){ } else { toi = 1; if ((c.m_flags & b2Contact.e_toiFlag)){ toi = c.m_toi; } else { s1 = c.m_shape1; s2 = c.m_shape2; b1 = s1.m_body; b2 = s2.m_body; if (((((b1.IsStatic()) || (b1.IsSleeping()))) && (((b2.IsStatic()) || (b2.IsSleeping()))))){ continue; }; t0 = b1.m_sweep.t0; if (b1.m_sweep.t0 < b2.m_sweep.t0){ t0 = b2.m_sweep.t0; b1.m_sweep.Advance(t0); } else { if (b2.m_sweep.t0 < b1.m_sweep.t0){ t0 = b1.m_sweep.t0; b2.m_sweep.Advance(t0); }; }; toi = b2TimeOfImpact.TimeOfImpact(c.m_shape1, b1.m_sweep, c.m_shape2, b2.m_sweep); if ((((toi > 0)) && ((toi < 1)))){ toi = (((1 - toi) * t0) + toi); if (toi > 1){ toi = 1; }; }; c.m_toi = toi; c.m_flags = (c.m_flags | b2Contact.e_toiFlag); }; if ((((Number.MIN_VALUE < toi)) && ((toi < minTOI)))){ minContact = c; minTOI = toi; }; }; }; if ((((minContact == null)) || (((1 - (100 * Number.MIN_VALUE)) < minTOI)))){ break; }; s1 = minContact.m_shape1; s2 = minContact.m_shape2; b1 = s1.m_body; b2 = s2.m_body; b1.Advance(minTOI); b2.Advance(minTOI); minContact.Update(m_contactListener); minContact.m_flags = (minContact.m_flags & ~(b2Contact.e_toiFlag)); if (minContact.m_manifoldCount == 0){ } else { seed = b1; if (seed.IsStatic()){ seed = b2; }; island.Clear(); stackCount = 0; var _temp1 = stackCount; stackCount = (stackCount + 1); var _local22 = _temp1; stack[_local22] = seed; seed.m_flags = (seed.m_flags | b2Body.e_islandFlag); while (stackCount > 0) { --stackCount; b = stack[stackCount]; island.AddBody(b); b.m_flags = (b.m_flags & ~(b2Body.e_sleepFlag)); if (b.IsStatic()){ } else { cn = b.m_contactList; while (cn) { if (island.m_contactCount == island.m_contactCapacity){ } else { if ((cn.contact.m_flags & ((b2Contact.e_islandFlag | b2Contact.e_slowFlag) | b2Contact.e_nonSolidFlag))){ } else { if (cn.contact.m_manifoldCount == 0){ } else { island.AddContact(cn.contact); cn.contact.m_flags = (cn.contact.m_flags | b2Contact.e_islandFlag); other = cn.other; if ((other.m_flags & b2Body.e_islandFlag)){ } else { if (other.IsStatic() == false){ other.Advance(minTOI); other.WakeUp(); }; var _temp2 = stackCount; stackCount = (stackCount + 1); var _local23 = _temp2; stack[_local23] = other; other.m_flags = (other.m_flags | b2Body.e_islandFlag); }; }; }; }; cn = cn.next; }; }; }; subStep = new b2TimeStep(); subStep.dt = ((1 - minTOI) * step.dt); subStep.inv_dt = (1 / subStep.dt); subStep.maxIterations = step.maxIterations; island.SolveTOI(subStep); i = 0; while (i < island.m_bodyCount) { b = island.m_bodies[i]; b.m_flags = (b.m_flags & ~(b2Body.e_islandFlag)); if ((b.m_flags & (b2Body.e_sleepFlag | b2Body.e_frozenFlag))){ } else { if (b.IsStatic()){ } else { inRange = b.SynchronizeShapes(); if ((((inRange == false)) && (!((m_boundaryListener == null))))){ m_boundaryListener.Violation(b); }; cn = b.m_contactList; while (cn) { cn.contact.m_flags = (cn.contact.m_flags & ~(b2Contact.e_toiFlag)); cn = cn.next; }; }; }; i++; }; i = 0; while (i < island.m_contactCount) { c = island.m_contacts[i]; c.m_flags = (c.m_flags & ~((b2Contact.e_toiFlag | b2Contact.e_islandFlag))); i++; }; m_broadPhase.Commit(); }; }; } public function GetJointList():b2Joint{ return (m_jointList); } public function Validate():void{ m_broadPhase.Validate(); } public function GetPairCount():int{ return (m_broadPhase.m_pairManager.m_pairCount); } public function GetBodyList():b2Body{ return (m_bodyList); } public function SetWarmStarting(flag:Boolean):void{ m_warmStarting = flag; } public function SetPositionCorrection(flag:Boolean):void{ m_positionCorrection = flag; } public function CreateJoint(def:b2JointDef):b2Joint{ var j:b2Joint; var b:b2Body; var s:b2Shape; j = b2Joint.Create(def, m_blockAllocator); j.m_prev = null; j.m_next = m_jointList; if (m_jointList){ m_jointList.m_prev = j; }; m_jointList = j; m_jointCount++; j.m_node1.joint = j; j.m_node1.other = j.m_body2; j.m_node1.prev = null; j.m_node1.next = j.m_body1.m_jointList; if (j.m_body1.m_jointList){ j.m_body1.m_jointList.prev = j.m_node1; }; j.m_body1.m_jointList = j.m_node1; j.m_node2.joint = j; j.m_node2.other = j.m_body1; j.m_node2.prev = null; j.m_node2.next = j.m_body2.m_jointList; if (j.m_body2.m_jointList){ j.m_body2.m_jointList.prev = j.m_node2; }; j.m_body2.m_jointList = j.m_node2; if (def.collideConnected == false){ b = ((def.body1.m_shapeCount < def.body2.m_shapeCount)) ? def.body1 : def.body2; s = b.m_shapeList; while (s) { s.RefilterProxy(m_broadPhase, b.m_xf); s = s.m_next; }; }; return (j); } public function DestroyJoint(j:b2Joint):void{ var collideConnected:Boolean; var body1:b2Body; var body2:b2Body; var b:b2Body; var s:b2Shape; collideConnected = j.m_collideConnected; if (j.m_prev){ j.m_prev.m_next = j.m_next; }; if (j.m_next){ j.m_next.m_prev = j.m_prev; }; if (j == m_jointList){ m_jointList = j.m_next; }; body1 = j.m_body1; body2 = j.m_body2; body1.WakeUp(); body2.WakeUp(); if (j.m_node1.prev){ j.m_node1.prev.next = j.m_node1.next; }; if (j.m_node1.next){ j.m_node1.next.prev = j.m_node1.prev; }; if (j.m_node1 == body1.m_jointList){ body1.m_jointList = j.m_node1.next; }; j.m_node1.prev = null; j.m_node1.next = null; if (j.m_node2.prev){ j.m_node2.prev.next = j.m_node2.next; }; if (j.m_node2.next){ j.m_node2.next.prev = j.m_node2.prev; }; if (j.m_node2 == body2.m_jointList){ body2.m_jointList = j.m_node2.next; }; j.m_node2.prev = null; j.m_node2.next = null; b2Joint.Destroy(j, m_blockAllocator); m_jointCount--; if (collideConnected == false){ b = ((body1.m_shapeCount < body2.m_shapeCount)) ? body1 : body2; s = b.m_shapeList; while (s) { s.RefilterProxy(m_broadPhase, b.m_xf); s = s.m_next; }; }; } public function SetContactListener(listener:b2ContactListener):void{ m_contactListener = listener; } public function CreateBody(def:b2BodyDef):b2Body{ var b:b2Body; if (m_lock == true){ return (null); }; b = new b2Body(def, this); b.m_prev = null; b.m_next = m_bodyList; if (m_bodyList){ m_bodyList.m_prev = b; }; m_bodyList = b; m_bodyCount++; return (b); } public function SetBoundaryListener(listener:b2BoundaryListener):void{ m_boundaryListener = listener; } public function SetDestructionListener(listener:b2DestructionListener):void{ m_destructionListener = listener; } public function Step(dt:Number, iterations:int):void{ var step:b2TimeStep; m_lock = true; step = new b2TimeStep(); step.dt = dt; step.maxIterations = iterations; if (dt > 0){ step.inv_dt = (1 / dt); } else { step.inv_dt = 0; }; step.dtRatio = (m_inv_dt0 * dt); step.positionCorrection = m_positionCorrection; step.warmStarting = m_warmStarting; m_contactManager.Collide(); if (step.dt > 0){ Solve(step); }; if (((m_continuousPhysics) && ((step.dt > 0)))){ SolveTOI(step); }; DrawDebugData(); m_inv_dt0 = step.inv_dt; m_lock = false; } public function GetBodyCount():int{ return (m_bodyCount); } public function GetJointCount():int{ return (m_jointCount); } } }//package Box2D.Dynamics
Section 76
//AuxFunctions (caurina.transitions.AuxFunctions) package caurina.transitions { public class AuxFunctions { public function AuxFunctions(){ super(); } public static function getObjectLength(p_object:Object):uint{ var totalProperties:uint; var pName:String; totalProperties = 0; for (pName in p_object) { totalProperties++; }; return (totalProperties); } public static function numberToG(p_num:Number):Number{ return (((p_num & 0xFF00) >> 8)); } public static function numberToB(p_num:Number):Number{ return ((p_num & 0xFF)); } public static function numberToR(p_num:Number):Number{ return (((p_num & 0xFF0000) >> 16)); } public static function concatObjects(... _args):Object{ var finalObject:Object; var currentObject:Object; var i:int; var prop:String; finalObject = {}; i = 0; while (i < _args.length) { currentObject = _args[i]; for (prop in currentObject) { if (currentObject[prop] == null){ delete finalObject[prop]; } else { finalObject[prop] = currentObject[prop]; }; }; i++; }; return (finalObject); } } }//package caurina.transitions
Section 77
//Equations (caurina.transitions.Equations) package caurina.transitions { public class Equations { public function Equations(){ super(); trace("Equations is a static class and should not be instantiated."); } public static function easeOutBounce(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{ t = (t / d); if (t < (1 / 2.75)){ return (((c * ((7.5625 * t) * t)) + b)); }; if (t < (2 / 2.75)){ t = (t - (1.5 / 2.75)); return (((c * (((7.5625 * t) * t) + 0.75)) + b)); }; if (t < (2.5 / 2.75)){ t = (t - (2.25 / 2.75)); return (((c * (((7.5625 * t) * t) + 0.9375)) + b)); }; t = (t - (2.625 / 2.75)); return (((c * (((7.5625 * t) * t) + 0.984375)) + b)); } public static function easeInOutElastic(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{ var p:Number; var s:Number; var a:Number; if (t == 0){ return (b); }; t = (t / (d / 2)); if (t == 2){ return ((b + c)); }; p = (((!(Boolean(p_params))) || (isNaN(p_params.period)))) ? (d * (0.3 * 1.5)) : p_params.period; a = (((!(Boolean(p_params))) || (isNaN(p_params.amplitude)))) ? 0 : p_params.amplitude; if (((!(Boolean(a))) || ((a < Math.abs(c))))){ a = c; s = (p / 4); } else { s = ((p / (2 * Math.PI)) * Math.asin((c / a))); }; if (t < 1){ --t; return (((-0.5 * ((a * Math.pow(2, (10 * t))) * Math.sin(((((t * d) - s) * (2 * Math.PI)) / p)))) + b)); }; --t; return ((((((a * Math.pow(2, (-10 * t))) * Math.sin(((((t * d) - s) * (2 * Math.PI)) / p))) * 0.5) + c) + b)); } public static function easeInOutQuad(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{ t = (t / (d / 2)); if (t < 1){ return (((((c / 2) * t) * t) + b)); }; --t; return ((((-(c) / 2) * ((t * (t - 2)) - 1)) + b)); } public static function easeInOutBounce(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{ if (t < (d / 2)){ return (((easeInBounce((t * 2), 0, c, d) * 0.5) + b)); }; return ((((easeOutBounce(((t * 2) - d), 0, c, d) * 0.5) + (c * 0.5)) + b)); } public static function easeInOutBack(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{ var s:Number; s = (((!(Boolean(p_params))) || (isNaN(p_params.overshoot)))) ? 1.70158 : p_params.overshoot; t = (t / (d / 2)); if (t < 1){ s = (s * 1.525); return ((((c / 2) * ((t * t) * (((s + 1) * t) - s))) + b)); }; t = (t - 2); s = (s * 1.525); return ((((c / 2) * (((t * t) * (((s + 1) * t) + s)) + 2)) + b)); } public static function easeOutInCubic(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{ if (t < (d / 2)){ return (easeOutCubic((t * 2), b, (c / 2), d, p_params)); }; return (easeInCubic(((t * 2) - d), (b + (c / 2)), (c / 2), d, p_params)); } public static function easeNone(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{ return ((((c * t) / d) + b)); } public static function easeOutBack(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{ var s:Number; s = (((!(Boolean(p_params))) || (isNaN(p_params.overshoot)))) ? 1.70158 : p_params.overshoot; t = ((t / d) - 1); return (((c * (((t * t) * (((s + 1) * t) + s)) + 1)) + b)); } public static function easeInOutSine(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{ return ((((-(c) / 2) * (Math.cos(((Math.PI * t) / d)) - 1)) + b)); } public static function easeInBack(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{ var s:Number; s = (((!(Boolean(p_params))) || (isNaN(p_params.overshoot)))) ? 1.70158 : p_params.overshoot; t = (t / d); return (((((c * t) * t) * (((s + 1) * t) - s)) + b)); } public static function easeInQuart(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{ t = (t / d); return ((((((c * t) * t) * t) * t) + b)); } public static function easeOutInQuint(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{ if (t < (d / 2)){ return (easeOutQuint((t * 2), b, (c / 2), d, p_params)); }; return (easeInQuint(((t * 2) - d), (b + (c / 2)), (c / 2), d, p_params)); } public static function easeOutInBounce(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{ if (t < (d / 2)){ return (easeOutBounce((t * 2), b, (c / 2), d, p_params)); }; return (easeInBounce(((t * 2) - d), (b + (c / 2)), (c / 2), d, p_params)); } public static function init():void{ Tweener.registerTransition("easenone", easeNone); Tweener.registerTransition("linear", easeNone); Tweener.registerTransition("easeinquad", easeInQuad); Tweener.registerTransition("easeoutquad", easeOutQuad); Tweener.registerTransition("easeinoutquad", easeInOutQuad); Tweener.registerTransition("easeoutinquad", easeOutInQuad); Tweener.registerTransition("easeincubic", easeInCubic); Tweener.registerTransition("easeoutcubic", easeOutCubic); Tweener.registerTransition("easeinoutcubic", easeInOutCubic); Tweener.registerTransition("easeoutincubic", easeOutInCubic); Tweener.registerTransition("easeinquart", easeInQuart); Tweener.registerTransition("easeoutquart", easeOutQuart); Tweener.registerTransition("easeinoutquart", easeInOutQuart); Tweener.registerTransition("easeoutinquart", easeOutInQuart); Tweener.registerTransition("easeinquint", easeInQuint); Tweener.registerTransition("easeoutquint", easeOutQuint); Tweener.registerTransition("easeinoutquint", easeInOutQuint); Tweener.registerTransition("easeoutinquint", easeOutInQuint); Tweener.registerTransition("easeinsine", easeInSine); Tweener.registerTransition("easeoutsine", easeOutSine); Tweener.registerTransition("easeinoutsine", easeInOutSine); Tweener.registerTransition("easeoutinsine", easeOutInSine); Tweener.registerTransition("easeincirc", easeInCirc); Tweener.registerTransition("easeoutcirc", easeOutCirc); Tweener.registerTransition("easeinoutcirc", easeInOutCirc); Tweener.registerTransition("easeoutincirc", easeOutInCirc); Tweener.registerTransition("easeinexpo", easeInExpo); Tweener.registerTransition("easeoutexpo", easeOutExpo); Tweener.registerTransition("easeinoutexpo", easeInOutExpo); Tweener.registerTransition("easeoutinexpo", easeOutInExpo); Tweener.registerTransition("easeinelastic", easeInElastic); Tweener.registerTransition("easeoutelastic", easeOutElastic); Tweener.registerTransition("easeinoutelastic", easeInOutElastic); Tweener.registerTransition("easeoutinelastic", easeOutInElastic); Tweener.registerTransition("easeinback", easeInBack); Tweener.registerTransition("easeoutback", easeOutBack); Tweener.registerTransition("easeinoutback", easeInOutBack); Tweener.registerTransition("easeoutinback", easeOutInBack); Tweener.registerTransition("easeinbounce", easeInBounce); Tweener.registerTransition("easeoutbounce", easeOutBounce); Tweener.registerTransition("easeinoutbounce", easeInOutBounce); Tweener.registerTransition("easeoutinbounce", easeOutInBounce); } public static function easeOutExpo(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{ return (((t)==d) ? (b + c) : (((c * 1.001) * (-(Math.pow(2, ((-10 * t) / d))) + 1)) + b)); } public static function easeOutInBack(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{ if (t < (d / 2)){ return (easeOutBack((t * 2), b, (c / 2), d, p_params)); }; return (easeInBack(((t * 2) - d), (b + (c / 2)), (c / 2), d, p_params)); } public static function easeInExpo(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{ return (((t)==0) ? b : (((c * Math.pow(2, (10 * ((t / d) - 1)))) + b) - (c * 0.001))); } public static function easeInCubic(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{ t = (t / d); return (((((c * t) * t) * t) + b)); } public static function easeInQuint(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{ t = (t / d); return (((((((c * t) * t) * t) * t) * t) + b)); } public static function easeInOutCirc(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{ t = (t / (d / 2)); if (t < 1){ return ((((-(c) / 2) * (Math.sqrt((1 - (t * t))) - 1)) + b)); }; t = (t - 2); return ((((c / 2) * (Math.sqrt((1 - (t * t))) + 1)) + b)); } public static function easeInQuad(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{ t = (t / d); return ((((c * t) * t) + b)); } public static function easeInBounce(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{ return (((c - easeOutBounce((d - t), 0, c, d)) + b)); } public static function easeOutInExpo(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{ if (t < (d / 2)){ return (easeOutExpo((t * 2), b, (c / 2), d, p_params)); }; return (easeInExpo(((t * 2) - d), (b + (c / 2)), (c / 2), d, p_params)); } public static function easeOutQuart(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{ t = ((t / d) - 1); return (((-(c) * ((((t * t) * t) * t) - 1)) + b)); } public static function easeInSine(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{ return ((((-(c) * Math.cos(((t / d) * (Math.PI / 2)))) + c) + b)); } public static function easeInOutQuart(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{ t = (t / (d / 2)); if (t < 1){ return (((((((c / 2) * t) * t) * t) * t) + b)); }; t = (t - 2); return ((((-(c) / 2) * ((((t * t) * t) * t) - 2)) + b)); } public static function easeOutQuad(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{ t = (t / d); return ((((-(c) * t) * (t - 2)) + b)); } public static function easeOutInElastic(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{ if (t < (d / 2)){ return (easeOutElastic((t * 2), b, (c / 2), d, p_params)); }; return (easeInElastic(((t * 2) - d), (b + (c / 2)), (c / 2), d, p_params)); } public static function easeInElastic(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{ var p:Number; var s:Number; var a:Number; if (t == 0){ return (b); }; t = (t / d); if (t == 1){ return ((b + c)); }; p = (((!(Boolean(p_params))) || (isNaN(p_params.period)))) ? (d * 0.3) : p_params.period; a = (((!(Boolean(p_params))) || (isNaN(p_params.amplitude)))) ? 0 : p_params.amplitude; if (((!(Boolean(a))) || ((a < Math.abs(c))))){ a = c; s = (p / 4); } else { s = ((p / (2 * Math.PI)) * Math.asin((c / a))); }; --t; return ((-(((a * Math.pow(2, (10 * t))) * Math.sin(((((t * d) - s) * (2 * Math.PI)) / p)))) + b)); } public static function easeOutCubic(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{ t = ((t / d) - 1); return (((c * (((t * t) * t) + 1)) + b)); } public static function easeOutQuint(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{ t = ((t / d) - 1); return (((c * (((((t * t) * t) * t) * t) + 1)) + b)); } public static function easeOutInQuad(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{ if (t < (d / 2)){ return (easeOutQuad((t * 2), b, (c / 2), d, p_params)); }; return (easeInQuad(((t * 2) - d), (b + (c / 2)), (c / 2), d, p_params)); } public static function easeOutSine(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{ return (((c * Math.sin(((t / d) * (Math.PI / 2)))) + b)); } public static function easeInOutCubic(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{ t = (t / (d / 2)); if (t < 1){ return ((((((c / 2) * t) * t) * t) + b)); }; t = (t - 2); return ((((c / 2) * (((t * t) * t) + 2)) + b)); } public static function easeInOutQuint(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{ t = (t / (d / 2)); if (t < 1){ return ((((((((c / 2) * t) * t) * t) * t) * t) + b)); }; t = (t - 2); return ((((c / 2) * (((((t * t) * t) * t) * t) + 2)) + b)); } public static function easeInCirc(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{ t = (t / d); return (((-(c) * (Math.sqrt((1 - (t * t))) - 1)) + b)); } public static function easeOutInSine(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{ if (t < (d / 2)){ return (easeOutSine((t * 2), b, (c / 2), d, p_params)); }; return (easeInSine(((t * 2) - d), (b + (c / 2)), (c / 2), d, p_params)); } public static function easeInOutExpo(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{ if (t == 0){ return (b); }; if (t == d){ return ((b + c)); }; t = (t / (d / 2)); if (t < 1){ return (((((c / 2) * Math.pow(2, (10 * (t - 1)))) + b) - (c * 0.0005))); }; --t; return (((((c / 2) * 1.0005) * (-(Math.pow(2, (-10 * t))) + 2)) + b)); } public static function easeOutElastic(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{ var p:Number; var s:Number; var a:Number; if (t == 0){ return (b); }; t = (t / d); if (t == 1){ return ((b + c)); }; p = (((!(Boolean(p_params))) || (isNaN(p_params.period)))) ? (d * 0.3) : p_params.period; a = (((!(Boolean(p_params))) || (isNaN(p_params.amplitude)))) ? 0 : p_params.amplitude; if (((!(Boolean(a))) || ((a < Math.abs(c))))){ a = c; s = (p / 4); } else { s = ((p / (2 * Math.PI)) * Math.asin((c / a))); }; return (((((a * Math.pow(2, (-10 * t))) * Math.sin(((((t * d) - s) * (2 * Math.PI)) / p))) + c) + b)); } public static function easeOutCirc(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{ t = ((t / d) - 1); return (((c * Math.sqrt((1 - (t * t)))) + b)); } public static function easeOutInQuart(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{ if (t < (d / 2)){ return (easeOutQuart((t * 2), b, (c / 2), d, p_params)); }; return (easeInQuart(((t * 2) - d), (b + (c / 2)), (c / 2), d, p_params)); } public static function easeOutInCirc(t:Number, b:Number, c:Number, d:Number, p_params:Object=null):Number{ if (t < (d / 2)){ return (easeOutCirc((t * 2), b, (c / 2), d, p_params)); }; return (easeInCirc(((t * 2) - d), (b + (c / 2)), (c / 2), d, p_params)); } } }//package caurina.transitions
Section 78
//PropertyInfoObj (caurina.transitions.PropertyInfoObj) package caurina.transitions { public class PropertyInfoObj { public var originalValueComplete:Object; public var modifierParameters:Array; public var isSpecialProperty:Boolean; public var hasModifier:Boolean; public var valueComplete:Number; public var extra:Object; public var valueStart:Number; public var modifierFunction:Function; public var arrayIndex:Number; public function PropertyInfoObj(p_valueStart:Number, p_valueComplete:Number, p_originalValueComplete:Object, p_arrayIndex:Number, p_extra:Object, p_isSpecialProperty:Boolean, p_modifierFunction:Function, p_modifierParameters:Array){ super(); valueStart = p_valueStart; valueComplete = p_valueComplete; originalValueComplete = p_originalValueComplete; arrayIndex = p_arrayIndex; extra = p_extra; isSpecialProperty = p_isSpecialProperty; hasModifier = Boolean(p_modifierFunction); modifierFunction = p_modifierFunction; modifierParameters = p_modifierParameters; } public function toString():String{ var returnStr:String; returnStr = "\n[PropertyInfoObj "; returnStr = (returnStr + ("valueStart:" + String(valueStart))); returnStr = (returnStr + ", "); returnStr = (returnStr + ("valueComplete:" + String(valueComplete))); returnStr = (returnStr + ", "); returnStr = (returnStr + ("originalValueComplete:" + String(originalValueComplete))); returnStr = (returnStr + ", "); returnStr = (returnStr + ("arrayIndex:" + String(arrayIndex))); returnStr = (returnStr + ", "); returnStr = (returnStr + ("extra:" + String(extra))); returnStr = (returnStr + ", "); returnStr = (returnStr + ("isSpecialProperty:" + String(isSpecialProperty))); returnStr = (returnStr + ", "); returnStr = (returnStr + ("hasModifier:" + String(hasModifier))); returnStr = (returnStr + ", "); returnStr = (returnStr + ("modifierFunction:" + String(modifierFunction))); returnStr = (returnStr + ", "); returnStr = (returnStr + ("modifierParameters:" + String(modifierParameters))); returnStr = (returnStr + "]\n"); return (returnStr); } public function clone():PropertyInfoObj{ var nProperty:PropertyInfoObj; nProperty = new PropertyInfoObj(valueStart, valueComplete, originalValueComplete, arrayIndex, extra, isSpecialProperty, modifierFunction, modifierParameters); return (nProperty); } } }//package caurina.transitions
Section 79
//SpecialProperty (caurina.transitions.SpecialProperty) package caurina.transitions { public class SpecialProperty { public var parameters:Array; public var preProcess:Function; public var setValue:Function; public var getValue:Function; public function SpecialProperty(p_getFunction:Function, p_setFunction:Function, p_parameters:Array=null, p_preProcessFunction:Function=null){ super(); getValue = p_getFunction; setValue = p_setFunction; parameters = p_parameters; preProcess = p_preProcessFunction; } public function toString():String{ var value:String; value = ""; value = (value + "[SpecialProperty "); value = (value + ("getValue:" + String(getValue))); value = (value + ", "); value = (value + ("setValue:" + String(setValue))); value = (value + ", "); value = (value + ("parameters:" + String(parameters))); value = (value + ", "); value = (value + ("preProcess:" + String(preProcess))); value = (value + "]"); return (value); } } }//package caurina.transitions
Section 80
//SpecialPropertyModifier (caurina.transitions.SpecialPropertyModifier) package caurina.transitions { public class SpecialPropertyModifier { public var getValue:Function; public var modifyValues:Function; public function SpecialPropertyModifier(p_modifyFunction:Function, p_getFunction:Function){ super(); modifyValues = p_modifyFunction; getValue = p_getFunction; } public function toString():String{ var value:String; value = ""; value = (value + "[SpecialPropertyModifier "); value = (value + ("modifyValues:" + String(modifyValues))); value = (value + ", "); value = (value + ("getValue:" + String(getValue))); value = (value + "]"); return (value); } } }//package caurina.transitions
Section 81
//SpecialPropertySplitter (caurina.transitions.SpecialPropertySplitter) package caurina.transitions { public class SpecialPropertySplitter { public var parameters:Array; public var splitValues:Function; public function SpecialPropertySplitter(p_splitFunction:Function, p_parameters:Array){ super(); splitValues = p_splitFunction; parameters = p_parameters; } public function toString():String{ var value:String; value = ""; value = (value + "[SpecialPropertySplitter "); value = (value + ("splitValues:" + String(splitValues))); value = (value + ", "); value = (value + ("parameters:" + String(parameters))); value = (value + "]"); return (value); } } }//package caurina.transitions
Section 82
//Tweener (caurina.transitions.Tweener) package caurina.transitions { import flash.display.*; import flash.events.*; import flash.utils.*; public class Tweener { private static var _timeScale:Number = 1; private static var _currentTimeFrame:Number; private static var _specialPropertySplitterList:Object; public static var autoOverwrite:Boolean = true; private static var _engineExists:Boolean = false; private static var _currentTime:Number; private static var _tweenList:Array; private static var _specialPropertyModifierList:Object; private static var _specialPropertyList:Object; private static var _transitionList:Object; private static var _inited:Boolean = false; private static var __tweener_controller__:MovieClip; public function Tweener(){ super(); trace("Tweener is a static class and should not be instantiated."); } public static function registerSpecialPropertyModifier(p_name:String, p_modifyFunction:Function, p_getFunction:Function):void{ var spm:SpecialPropertyModifier; if (!_inited){ init(); }; spm = new SpecialPropertyModifier(p_modifyFunction, p_getFunction); _specialPropertyModifierList[p_name] = spm; } public static function registerSpecialProperty(p_name:String, p_getFunction:Function, p_setFunction:Function, p_parameters:Array=null, p_preProcessFunction:Function=null):void{ var sp:SpecialProperty; if (!_inited){ init(); }; sp = new SpecialProperty(p_getFunction, p_setFunction, p_parameters, p_preProcessFunction); _specialPropertyList[p_name] = sp; } public static function init(... _args):void{ _inited = true; _transitionList = new Object(); Equations.init(); _specialPropertyList = new Object(); _specialPropertyModifierList = new Object(); _specialPropertySplitterList = new Object(); } private static function updateTweens():Boolean{ var i:int; if (_tweenList.length == 0){ return (false); }; i = 0; while (i < _tweenList.length) { if ((((_tweenList[i] == undefined)) || (!(_tweenList[i].isPaused)))){ if (!updateTweenByIndex(i)){ removeTweenByIndex(i); }; if (_tweenList[i] == null){ removeTweenByIndex(i, true); i--; }; }; i++; }; return (true); } public static function addCaller(p_scopes:Object=null, p_parameters:Object=null):Boolean{ var i:Number; var rScopes:Array; var p_obj:Object; var rTime:Number; var rDelay:Number; var rTransition:Function; var nTween:TweenListObj; var myT:Number; var trans:String; if (!Boolean(p_scopes)){ return (false); }; if ((p_scopes is Array)){ rScopes = p_scopes.concat(); } else { rScopes = [p_scopes]; }; p_obj = p_parameters; if (!_inited){ init(); }; if (((!(_engineExists)) || (!(Boolean(__tweener_controller__))))){ startEngine(); }; rTime = (isNaN(p_obj.time)) ? 0 : p_obj.time; rDelay = (isNaN(p_obj.delay)) ? 0 : p_obj.delay; if (typeof(p_obj.transition) == "string"){ trans = p_obj.transition.toLowerCase(); rTransition = _transitionList[trans]; } else { rTransition = p_obj.transition; }; if (!Boolean(rTransition)){ rTransition = _transitionList["easeoutexpo"]; }; i = 0; while (i < rScopes.length) { if (p_obj.useFrames == true){ nTween = new TweenListObj(rScopes[i], (_currentTimeFrame + (rDelay / _timeScale)), (_currentTimeFrame + ((rDelay + rTime) / _timeScale)), true, rTransition, p_obj.transitionParams); } else { nTween = new TweenListObj(rScopes[i], (_currentTime + ((rDelay * 1000) / _timeScale)), (_currentTime + (((rDelay * 1000) + (rTime * 1000)) / _timeScale)), false, rTransition, p_obj.transitionParams); }; nTween.properties = null; nTween.onStart = p_obj.onStart; nTween.onUpdate = p_obj.onUpdate; nTween.onComplete = p_obj.onComplete; nTween.onOverwrite = p_obj.onOverwrite; nTween.onStartParams = p_obj.onStartParams; nTween.onUpdateParams = p_obj.onUpdateParams; nTween.onCompleteParams = p_obj.onCompleteParams; nTween.onOverwriteParams = p_obj.onOverwriteParams; nTween.onStartScope = p_obj.onStartScope; nTween.onUpdateScope = p_obj.onUpdateScope; nTween.onCompleteScope = p_obj.onCompleteScope; nTween.onOverwriteScope = p_obj.onOverwriteScope; nTween.onErrorScope = p_obj.onErrorScope; nTween.isCaller = true; nTween.count = p_obj.count; nTween.waitFrames = p_obj.waitFrames; _tweenList.push(nTween); if ((((rTime == 0)) && ((rDelay == 0)))){ myT = (_tweenList.length - 1); updateTweenByIndex(myT); removeTweenByIndex(myT); }; i++; }; return (true); } public static function pauseAllTweens():Boolean{ var paused:Boolean; var i:uint; if (!Boolean(_tweenList)){ return (false); }; paused = false; i = 0; while (i < _tweenList.length) { pauseTweenByIndex(i); paused = true; i++; }; return (paused); } public static function removeTweens(p_scope:Object, ... _args):Boolean{ var properties:Array; var i:uint; var sps:SpecialPropertySplitter; var specialProps:Array; var j:uint; properties = new Array(); i = 0; while (i < _args.length) { if ((((typeof(_args[i]) == "string")) && ((properties.indexOf(_args[i]) == -1)))){ if (_specialPropertySplitterList[_args[i]]){ sps = _specialPropertySplitterList[_args[i]]; specialProps = sps.splitValues(p_scope, null); j = 0; while (j < specialProps.length) { properties.push(specialProps[j].name); j++; }; } else { properties.push(_args[i]); }; }; i++; }; return (affectTweens(removeTweenByIndex, p_scope, properties)); } public static function updateFrame():void{ _currentTimeFrame++; } public static function splitTweens(p_tween:Number, p_properties:Array):uint{ var originalTween:TweenListObj; var newTween:TweenListObj; var i:uint; var pName:String; var found:Boolean; originalTween = _tweenList[p_tween]; newTween = originalTween.clone(false); i = 0; while (i < p_properties.length) { pName = p_properties[i]; if (Boolean(originalTween.properties[pName])){ originalTween.properties[pName] = undefined; delete originalTween.properties[pName]; }; i++; }; for (pName in newTween.properties) { found = false; i = 0; while (i < p_properties.length) { if (p_properties[i] == pName){ found = true; break; }; i++; }; if (!found){ newTween.properties[pName] = undefined; delete newTween.properties[pName]; }; }; _tweenList.push(newTween); return ((_tweenList.length - 1)); } public static function resumeTweenByIndex(p_tween:Number):Boolean{ var tTweening:TweenListObj; var cTime:Number; tTweening = _tweenList[p_tween]; if ((((tTweening == null)) || (!(tTweening.isPaused)))){ return (false); }; cTime = getCurrentTweeningTime(tTweening); tTweening.timeStart = (tTweening.timeStart + (cTime - tTweening.timePaused)); tTweening.timeComplete = (tTweening.timeComplete + (cTime - tTweening.timePaused)); tTweening.timePaused = undefined; tTweening.isPaused = false; return (true); } public static function getVersion():String{ return ("AS3 1.33.74"); } public static function onEnterFrame(e:Event):void{ var hasUpdated:Boolean; updateTime(); updateFrame(); hasUpdated = false; hasUpdated = updateTweens(); if (!hasUpdated){ stopEngine(); }; } public static function updateTime():void{ _currentTime = getTimer(); } private static function updateTweenByIndex(i:Number):Boolean{ var tTweening:TweenListObj; var isOver:Boolean; var mustUpdate:Boolean; var nv:Number; var t:Number; var b:Number; var c:Number; var d:Number; var pName:String; var eventScope:Object; var tScope:Object; var cTime:Number; var tProperty:Object; var pv:Number; var i = i; tTweening = _tweenList[i]; if ((((tTweening == null)) || (!(Boolean(tTweening.scope))))){ return (false); }; isOver = false; cTime = getCurrentTweeningTime(tTweening); if (cTime >= tTweening.timeStart){ tScope = tTweening.scope; if (tTweening.isCaller){ do { t = (((tTweening.timeComplete - tTweening.timeStart) / tTweening.count) * (tTweening.timesCalled + 1)); b = tTweening.timeStart; c = (tTweening.timeComplete - tTweening.timeStart); d = (tTweening.timeComplete - tTweening.timeStart); nv = tTweening.transition(t, b, c, d); //unresolved if if (Boolean(tTweening.onUpdate)){ eventScope = (Boolean(tTweening.onUpdateScope)) ? tTweening.onUpdateScope : tScope; tTweening.onUpdate.apply(eventScope, tTweening.onUpdateParams); continue; var _slot1 = e1; handleError(tTweening, _slot1, "onUpdate"); }; } while (tTweening.timesCalled++, !(tTweening.timesCalled >= tTweening.count)); } else { mustUpdate = (((((tTweening.skipUpdates < 1)) || (!(tTweening.skipUpdates)))) || ((tTweening.updatesSkipped >= tTweening.skipUpdates))); if (cTime >= tTweening.timeComplete){ isOver = true; mustUpdate = true; }; if (!tTweening.hasStarted){ if (Boolean(tTweening.onStart)){ eventScope = (Boolean(tTweening.onStartScope)) ? tTweening.onStartScope : tScope; tTweening.onStart.apply(eventScope, tTweening.onStartParams); //unresolved jump var _slot1 = e2; handleError(tTweening, _slot1, "onStart"); }; for (pName in tTweening.properties) { if (tTweening.properties[pName].isSpecialProperty){ if (Boolean(_specialPropertyList[pName].preProcess)){ tTweening.properties[pName].valueComplete = _specialPropertyList[pName].preProcess(tScope, _specialPropertyList[pName].parameters, tTweening.properties[pName].originalValueComplete, tTweening.properties[pName].extra); }; pv = _specialPropertyList[pName].getValue(tScope, _specialPropertyList[pName].parameters, tTweening.properties[pName].extra); } else { pv = tScope[pName]; }; tTweening.properties[pName].valueStart = (isNaN(pv)) ? tTweening.properties[pName].valueComplete : pv; }; mustUpdate = true; tTweening.hasStarted = true; }; if (mustUpdate){ for (pName in tTweening.properties) { tProperty = tTweening.properties[pName]; if (isOver){ nv = tProperty.valueComplete; } else { if (tProperty.hasModifier){ t = (cTime - tTweening.timeStart); d = (tTweening.timeComplete - tTweening.timeStart); nv = tTweening.transition(t, 0, 1, d, tTweening.transitionParams); nv = tProperty.modifierFunction(tProperty.valueStart, tProperty.valueComplete, nv, tProperty.modifierParameters); } else { t = (cTime - tTweening.timeStart); b = tProperty.valueStart; c = (tProperty.valueComplete - tProperty.valueStart); d = (tTweening.timeComplete - tTweening.timeStart); nv = tTweening.transition(t, b, c, d, tTweening.transitionParams); }; }; if (tTweening.rounded){ nv = Math.round(nv); }; if (tProperty.isSpecialProperty){ _specialPropertyList[pName].setValue(tScope, nv, _specialPropertyList[pName].parameters, tTweening.properties[pName].extra); } else { tScope[pName] = nv; }; }; tTweening.updatesSkipped = 0; if (Boolean(tTweening.onUpdate)){ eventScope = (Boolean(tTweening.onUpdateScope)) ? tTweening.onUpdateScope : tScope; tTweening.onUpdate.apply(eventScope, tTweening.onUpdateParams); //unresolved jump var _slot1 = e3; handleError(tTweening, _slot1, "onUpdate"); }; } else { tTweening.updatesSkipped++; }; }; if (((isOver) && (Boolean(tTweening.onComplete)))){ eventScope = (Boolean(tTweening.onCompleteScope)) ? tTweening.onCompleteScope : tScope; tTweening.onComplete.apply(eventScope, tTweening.onCompleteParams); //unresolved jump var _slot1 = e4; handleError(tTweening, _slot1, "onComplete"); }; return (!(isOver)); }; return (true); } public static function setTimeScale(p_time:Number):void{ var i:Number; var cTime:Number; if (isNaN(p_time)){ p_time = 1; }; if (p_time < 1E-5){ p_time = 1E-5; }; if (p_time != _timeScale){ if (_tweenList != null){ i = 0; while (i < _tweenList.length) { cTime = getCurrentTweeningTime(_tweenList[i]); _tweenList[i].timeStart = (cTime - (((cTime - _tweenList[i].timeStart) * _timeScale) / p_time)); _tweenList[i].timeComplete = (cTime - (((cTime - _tweenList[i].timeComplete) * _timeScale) / p_time)); if (_tweenList[i].timePaused != undefined){ _tweenList[i].timePaused = (cTime - (((cTime - _tweenList[i].timePaused) * _timeScale) / p_time)); }; i++; }; }; _timeScale = p_time; }; } public static function resumeAllTweens():Boolean{ var resumed:Boolean; var i:uint; if (!Boolean(_tweenList)){ return (false); }; resumed = false; i = 0; while (i < _tweenList.length) { resumeTweenByIndex(i); resumed = true; i++; }; return (resumed); } private static function handleError(pTweening:TweenListObj, pError:Error, pCallBackName:String):void{ var eventScope:Object; var pTweening = pTweening; var pError = pError; var pCallBackName = pCallBackName; if (((Boolean(pTweening.onError)) && ((pTweening.onError is Function)))){ eventScope = (Boolean(pTweening.onErrorScope)) ? pTweening.onErrorScope : pTweening.scope; pTweening.onError.apply(eventScope, [pTweening.scope, pError]); //unresolved jump var _slot1 = metaError; printError(((((String(pTweening.scope) + " raised an error while executing the 'onError' handler. Original error:\n ") + pError.getStackTrace()) + "\nonError error: ") + _slot1.getStackTrace())); } else { if (!Boolean(pTweening.onError)){ printError(((((String(pTweening.scope) + " raised an error while executing the '") + pCallBackName) + "'handler. \n") + pError.getStackTrace())); }; }; } private static function startEngine():void{ _engineExists = true; _tweenList = new Array(); __tweener_controller__ = new MovieClip(); __tweener_controller__.addEventListener(Event.ENTER_FRAME, Tweener.onEnterFrame); _currentTimeFrame = 0; updateTime(); } public static function removeAllTweens():Boolean{ var removed:Boolean; var i:uint; if (!Boolean(_tweenList)){ return (false); }; removed = false; i = 0; while (i < _tweenList.length) { removeTweenByIndex(i); removed = true; i++; }; return (removed); } public static function addTween(p_scopes:Object=null, p_parameters:Object=null):Boolean{ var i:Number; var j:Number; var istr:String; var rScopes:Array; var p_obj:Object; var rTime:Number; var rDelay:Number; var rProperties:Array; var restrictedWords:Object; var modifiedProperties:Object; var rTransition:Function; var nProperties:Object; var nTween:TweenListObj; var myT:Number; var splitProperties:Array; var splitProperties2:Array; var tempModifiedProperties:Array; var trans:String; if (!Boolean(p_scopes)){ return (false); }; if ((p_scopes is Array)){ rScopes = p_scopes.concat(); } else { rScopes = [p_scopes]; }; p_obj = TweenListObj.makePropertiesChain(p_parameters); if (!_inited){ init(); }; if (((!(_engineExists)) || (!(Boolean(__tweener_controller__))))){ startEngine(); }; rTime = (isNaN(p_obj.time)) ? 0 : p_obj.time; rDelay = (isNaN(p_obj.delay)) ? 0 : p_obj.delay; rProperties = new Array(); restrictedWords = {overwrite:true, time:true, delay:true, useFrames:true, skipUpdates:true, transition:true, transitionParams:true, onStart:true, onUpdate:true, onComplete:true, onOverwrite:true, onError:true, rounded:true, onStartParams:true, onUpdateParams:true, onCompleteParams:true, onOverwriteParams:true, onStartScope:true, onUpdateScope:true, onCompleteScope:true, onOverwriteScope:true, onErrorScope:true}; modifiedProperties = new Object(); for (istr in p_obj) { if (!restrictedWords[istr]){ if (_specialPropertySplitterList[istr]){ splitProperties = _specialPropertySplitterList[istr].splitValues(p_obj[istr], _specialPropertySplitterList[istr].parameters); i = 0; while (i < splitProperties.length) { if (_specialPropertySplitterList[splitProperties[i].name]){ splitProperties2 = _specialPropertySplitterList[splitProperties[i].name].splitValues(splitProperties[i].value, _specialPropertySplitterList[splitProperties[i].name].parameters); j = 0; while (j < splitProperties2.length) { rProperties[splitProperties2[j].name] = {valueStart:undefined, valueComplete:splitProperties2[j].value, arrayIndex:splitProperties2[j].arrayIndex, isSpecialProperty:false}; j++; }; } else { rProperties[splitProperties[i].name] = {valueStart:undefined, valueComplete:splitProperties[i].value, arrayIndex:splitProperties[i].arrayIndex, isSpecialProperty:false}; }; i++; }; } else { if (_specialPropertyModifierList[istr] != undefined){ tempModifiedProperties = _specialPropertyModifierList[istr].modifyValues(p_obj[istr]); i = 0; while (i < tempModifiedProperties.length) { modifiedProperties[tempModifiedProperties[i].name] = {modifierParameters:tempModifiedProperties[i].parameters, modifierFunction:_specialPropertyModifierList[istr].getValue}; i++; }; } else { rProperties[istr] = {valueStart:undefined, valueComplete:p_obj[istr]}; }; }; }; }; for (istr in rProperties) { if (_specialPropertyList[istr] != undefined){ rProperties[istr].isSpecialProperty = true; } else { if (rScopes[0][istr] == undefined){ printError((((("The property '" + istr) + "' doesn't seem to be a normal object property of ") + String(rScopes[0])) + " or a registered special property.")); }; }; }; for (istr in modifiedProperties) { if (rProperties[istr] != undefined){ rProperties[istr].modifierParameters = modifiedProperties[istr].modifierParameters; rProperties[istr].modifierFunction = modifiedProperties[istr].modifierFunction; }; }; if (typeof(p_obj.transition) == "string"){ trans = p_obj.transition.toLowerCase(); rTransition = _transitionList[trans]; } else { rTransition = p_obj.transition; }; if (!Boolean(rTransition)){ rTransition = _transitionList["easeoutexpo"]; }; i = 0; while (i < rScopes.length) { nProperties = new Object(); for (istr in rProperties) { nProperties[istr] = new PropertyInfoObj(rProperties[istr].valueStart, rProperties[istr].valueComplete, rProperties[istr].valueComplete, rProperties[istr].arrayIndex, {}, rProperties[istr].isSpecialProperty, rProperties[istr].modifierFunction, rProperties[istr].modifierParameters); }; if (p_obj.useFrames == true){ nTween = new TweenListObj(rScopes[i], (_currentTimeFrame + (rDelay / _timeScale)), (_currentTimeFrame + ((rDelay + rTime) / _timeScale)), true, rTransition, p_obj.transitionParams); } else { nTween = new TweenListObj(rScopes[i], (_currentTime + ((rDelay * 1000) / _timeScale)), (_currentTime + (((rDelay * 1000) + (rTime * 1000)) / _timeScale)), false, rTransition, p_obj.transitionParams); }; nTween.properties = nProperties; nTween.onStart = p_obj.onStart; nTween.onUpdate = p_obj.onUpdate; nTween.onComplete = p_obj.onComplete; nTween.onOverwrite = p_obj.onOverwrite; nTween.onError = p_obj.onError; nTween.onStartParams = p_obj.onStartParams; nTween.onUpdateParams = p_obj.onUpdateParams; nTween.onCompleteParams = p_obj.onCompleteParams; nTween.onOverwriteParams = p_obj.onOverwriteParams; nTween.onStartScope = p_obj.onStartScope; nTween.onUpdateScope = p_obj.onUpdateScope; nTween.onCompleteScope = p_obj.onCompleteScope; nTween.onOverwriteScope = p_obj.onOverwriteScope; nTween.onErrorScope = p_obj.onErrorScope; nTween.rounded = p_obj.rounded; nTween.skipUpdates = p_obj.skipUpdates; if (((p_obj.overwrite == undefined)) ? autoOverwrite : p_obj.overwrite){ removeTweensByTime(nTween.scope, nTween.properties, nTween.timeStart, nTween.timeComplete); }; _tweenList.push(nTween); if ((((rTime == 0)) && ((rDelay == 0)))){ myT = (_tweenList.length - 1); updateTweenByIndex(myT); removeTweenByIndex(myT); }; i++; }; return (true); } public static function registerTransition(p_name:String, p_function:Function):void{ if (!_inited){ init(); }; _transitionList[p_name] = p_function; } public static function printError(p_message:String):void{ trace(("## [Tweener] Error: " + p_message)); } private static function affectTweens(p_affectFunction:Function, p_scope:Object, p_properties:Array):Boolean{ var affected:Boolean; var i:uint; var affectedProperties:Array; var j:uint; var objectProperties:uint; var slicedTweenIndex:uint; affected = false; if (!Boolean(_tweenList)){ return (false); }; i = 0; while (i < _tweenList.length) { if (((_tweenList[i]) && ((_tweenList[i].scope == p_scope)))){ if (p_properties.length == 0){ p_affectFunction(i); affected = true; } else { affectedProperties = new Array(); j = 0; while (j < p_properties.length) { if (Boolean(_tweenList[i].properties[p_properties[j]])){ affectedProperties.push(p_properties[j]); }; j++; }; if (affectedProperties.length > 0){ objectProperties = AuxFunctions.getObjectLength(_tweenList[i].properties); if (objectProperties == affectedProperties.length){ p_affectFunction(i); affected = true; } else { slicedTweenIndex = splitTweens(i, affectedProperties); p_affectFunction(slicedTweenIndex); affected = true; }; }; }; }; i++; }; return (affected); } public static function getTweens(p_scope:Object):Array{ var i:uint; var pName:String; var tList:Array; if (!Boolean(_tweenList)){ return ([]); }; tList = new Array(); i = 0; while (i < _tweenList.length) { if (((Boolean(_tweenList[i])) && ((_tweenList[i].scope == p_scope)))){ for (pName in _tweenList[i].properties) { tList.push(pName); }; }; i++; }; return (tList); } public static function isTweening(p_scope:Object):Boolean{ var i:uint; if (!Boolean(_tweenList)){ return (false); }; i = 0; while (i < _tweenList.length) { if (((Boolean(_tweenList[i])) && ((_tweenList[i].scope == p_scope)))){ return (true); }; i++; }; return (false); } public static function pauseTweenByIndex(p_tween:Number):Boolean{ var tTweening:TweenListObj; tTweening = _tweenList[p_tween]; if ((((tTweening == null)) || (tTweening.isPaused))){ return (false); }; tTweening.timePaused = getCurrentTweeningTime(tTweening); tTweening.isPaused = true; return (true); } public static function getCurrentTweeningTime(p_tweening:Object):Number{ return ((p_tweening.useFrames) ? _currentTimeFrame : _currentTime); } public static function getTweenCount(p_scope:Object):Number{ var i:uint; var c:Number; if (!Boolean(_tweenList)){ return (0); }; c = 0; i = 0; while (i < _tweenList.length) { if (((Boolean(_tweenList[i])) && ((_tweenList[i].scope == p_scope)))){ c = (c + AuxFunctions.getObjectLength(_tweenList[i].properties)); }; i++; }; return (c); } private static function stopEngine():void{ _engineExists = false; _tweenList = null; _currentTime = 0; _currentTimeFrame = 0; __tweener_controller__.removeEventListener(Event.ENTER_FRAME, Tweener.onEnterFrame); __tweener_controller__ = null; } public static function removeTweensByTime(p_scope:Object, p_properties:Object, p_timeStart:Number, p_timeComplete:Number):Boolean{ var removed:Boolean; var removedLocally:Boolean; var i:uint; var tl:uint; var pName:String; var eventScope:Object; var p_scope = p_scope; var p_properties = p_properties; var p_timeStart = p_timeStart; var p_timeComplete = p_timeComplete; removed = false; tl = _tweenList.length; i = 0; while (i < tl) { if (((Boolean(_tweenList[i])) && ((p_scope == _tweenList[i].scope)))){ if ((((p_timeComplete > _tweenList[i].timeStart)) && ((p_timeStart < _tweenList[i].timeComplete)))){ removedLocally = false; for (pName in _tweenList[i].properties) { if (Boolean(p_properties[pName])){ if (Boolean(_tweenList[i].onOverwrite)){ eventScope = (Boolean(_tweenList[i].onOverwriteScope)) ? _tweenList[i].onOverwriteScope : _tweenList[i].scope; _tweenList[i].onOverwrite.apply(eventScope, _tweenList[i].onOverwriteParams); //unresolved jump var _slot1 = e; handleError(_tweenList[i], _slot1, "onOverwrite"); }; _tweenList[i].properties[pName] = undefined; delete _tweenList[i].properties[pName]; removedLocally = true; removed = true; }; }; if (removedLocally){ if (AuxFunctions.getObjectLength(_tweenList[i].properties) == 0){ removeTweenByIndex(i); }; }; }; }; i = (i + 1); }; return (removed); } public static function registerSpecialPropertySplitter(p_name:String, p_splitFunction:Function, p_parameters:Array=null):void{ var sps:SpecialPropertySplitter; if (!_inited){ init(); }; sps = new SpecialPropertySplitter(p_splitFunction, p_parameters); _specialPropertySplitterList[p_name] = sps; } public static function removeTweenByIndex(i:Number, p_finalRemoval:Boolean=false):Boolean{ _tweenList[i] = null; if (p_finalRemoval){ _tweenList.splice(i, 1); }; return (true); } public static function resumeTweens(p_scope:Object, ... _args):Boolean{ var properties:Array; var i:uint; properties = new Array(); i = 0; while (i < _args.length) { if ((((typeof(_args[i]) == "string")) && ((properties.indexOf(_args[i]) == -1)))){ properties.push(_args[i]); }; i++; }; return (affectTweens(resumeTweenByIndex, p_scope, properties)); } public static function pauseTweens(p_scope:Object, ... _args):Boolean{ var properties:Array; var i:uint; properties = new Array(); i = 0; while (i < _args.length) { if ((((typeof(_args[i]) == "string")) && ((properties.indexOf(_args[i]) == -1)))){ properties.push(_args[i]); }; i++; }; return (affectTweens(pauseTweenByIndex, p_scope, properties)); } } }//package caurina.transitions
Section 83
//TweenListObj (caurina.transitions.TweenListObj) package caurina.transitions { public class TweenListObj { public var onUpdate:Function; public var useFrames:Boolean; public var hasStarted:Boolean; public var onOverwriteParams:Array; public var timeStart:Number; public var count:Number; public var timeComplete:Number; public var onStartParams:Array; public var onUpdateScope:Object; public var rounded:Boolean; public var onUpdateParams:Array; public var properties:Object; public var onComplete:Function; public var transitionParams:Object; public var updatesSkipped:Number; public var onStart:Function; public var onOverwriteScope:Object; public var skipUpdates:Number; public var onStartScope:Object; public var scope:Object; public var transition:Function; public var timePaused:Number; public var onCompleteParams:Array; public var timesCalled:Number; public var isCaller:Boolean; public var onError:Function; public var onErrorScope:Object; public var onOverwrite:Function; public var isPaused:Boolean; public var waitFrames:Boolean; public var onCompleteScope:Object; public function TweenListObj(p_scope:Object, p_timeStart:Number, p_timeComplete:Number, p_useFrames:Boolean, p_transition:Function, p_transitionParams:Object){ super(); scope = p_scope; timeStart = p_timeStart; timeComplete = p_timeComplete; useFrames = p_useFrames; transition = p_transition; transitionParams = p_transitionParams; properties = new Object(); isPaused = false; timePaused = undefined; isCaller = false; updatesSkipped = 0; timesCalled = 0; skipUpdates = 0; hasStarted = false; } public function clone(omitEvents:Boolean):TweenListObj{ var nTween:TweenListObj; var pName:String; nTween = new TweenListObj(scope, timeStart, timeComplete, useFrames, transition, transitionParams); nTween.properties = new Array(); for (pName in properties) { nTween.properties[pName] = properties[pName].clone(); }; nTween.skipUpdates = skipUpdates; nTween.updatesSkipped = updatesSkipped; if (!omitEvents){ nTween.onStart = onStart; nTween.onUpdate = onUpdate; nTween.onComplete = onComplete; nTween.onOverwrite = onOverwrite; nTween.onError = onError; nTween.onStartParams = onStartParams; nTween.onUpdateParams = onUpdateParams; nTween.onCompleteParams = onCompleteParams; nTween.onOverwriteParams = onOverwriteParams; nTween.onStartScope = onStartScope; nTween.onUpdateScope = onUpdateScope; nTween.onCompleteScope = onCompleteScope; nTween.onOverwriteScope = onOverwriteScope; nTween.onErrorScope = onErrorScope; }; nTween.rounded = rounded; nTween.isPaused = isPaused; nTween.timePaused = timePaused; nTween.isCaller = isCaller; nTween.count = count; nTween.timesCalled = timesCalled; nTween.waitFrames = waitFrames; nTween.hasStarted = hasStarted; return (nTween); } public function toString():String{ var returnStr:String; var isFirst:Boolean; var i:String; returnStr = "\n[TweenListObj "; returnStr = (returnStr + ("scope:" + String(scope))); returnStr = (returnStr + ", properties:"); isFirst = true; for (i in properties) { if (!isFirst){ returnStr = (returnStr + ","); }; returnStr = (returnStr + ("[name:" + properties[i].name)); returnStr = (returnStr + (",valueStart:" + properties[i].valueStart)); returnStr = (returnStr + (",valueComplete:" + properties[i].valueComplete)); returnStr = (returnStr + "]"); isFirst = false; }; returnStr = (returnStr + (", timeStart:" + String(timeStart))); returnStr = (returnStr + (", timeComplete:" + String(timeComplete))); returnStr = (returnStr + (", useFrames:" + String(useFrames))); returnStr = (returnStr + (", transition:" + String(transition))); returnStr = (returnStr + (", transitionParams:" + String(transitionParams))); if (skipUpdates){ returnStr = (returnStr + (", skipUpdates:" + String(skipUpdates))); }; if (updatesSkipped){ returnStr = (returnStr + (", updatesSkipped:" + String(updatesSkipped))); }; if (Boolean(onStart)){ returnStr = (returnStr + (", onStart:" + String(onStart))); }; if (Boolean(onUpdate)){ returnStr = (returnStr + (", onUpdate:" + String(onUpdate))); }; if (Boolean(onComplete)){ returnStr = (returnStr + (", onComplete:" + String(onComplete))); }; if (Boolean(onOverwrite)){ returnStr = (returnStr + (", onOverwrite:" + String(onOverwrite))); }; if (Boolean(onError)){ returnStr = (returnStr + (", onError:" + String(onError))); }; if (onStartParams){ returnStr = (returnStr + (", onStartParams:" + String(onStartParams))); }; if (onUpdateParams){ returnStr = (returnStr + (", onUpdateParams:" + String(onUpdateParams))); }; if (onCompleteParams){ returnStr = (returnStr + (", onCompleteParams:" + String(onCompleteParams))); }; if (onOverwriteParams){ returnStr = (returnStr + (", onOverwriteParams:" + String(onOverwriteParams))); }; if (onStartScope){ returnStr = (returnStr + (", onStartScope:" + String(onStartScope))); }; if (onUpdateScope){ returnStr = (returnStr + (", onUpdateScope:" + String(onUpdateScope))); }; if (onCompleteScope){ returnStr = (returnStr + (", onCompleteScope:" + String(onCompleteScope))); }; if (onOverwriteScope){ returnStr = (returnStr + (", onOverwriteScope:" + String(onOverwriteScope))); }; if (onErrorScope){ returnStr = (returnStr + (", onErrorScope:" + String(onErrorScope))); }; if (rounded){ returnStr = (returnStr + (", rounded:" + String(rounded))); }; if (isPaused){ returnStr = (returnStr + (", isPaused:" + String(isPaused))); }; if (timePaused){ returnStr = (returnStr + (", timePaused:" + String(timePaused))); }; if (isCaller){ returnStr = (returnStr + (", isCaller:" + String(isCaller))); }; if (count){ returnStr = (returnStr + (", count:" + String(count))); }; if (timesCalled){ returnStr = (returnStr + (", timesCalled:" + String(timesCalled))); }; if (waitFrames){ returnStr = (returnStr + (", waitFrames:" + String(waitFrames))); }; if (hasStarted){ returnStr = (returnStr + (", hasStarted:" + String(hasStarted))); }; returnStr = (returnStr + "]\n"); return (returnStr); } public static function makePropertiesChain(p_obj:Object):Object{ var baseObject:Object; var chainedObject:Object; var chain:Object; var currChainObj:Object; var len:Number; var i:Number; var k:Number; baseObject = p_obj.base; if (baseObject){ chainedObject = {}; if ((baseObject is Array)){ chain = []; k = 0; while (k < baseObject.length) { chain.push(baseObject[k]); k++; }; } else { chain = [baseObject]; }; chain.push(p_obj); len = chain.length; i = 0; while (i < len) { if (chain[i]["base"]){ currChainObj = AuxFunctions.concatObjects(makePropertiesChain(chain[i]["base"]), chain[i]); } else { currChainObj = chain[i]; }; chainedObject = AuxFunctions.concatObjects(chainedObject, currChainObj); i++; }; if (chainedObject["base"]){ delete chainedObject["base"]; }; return (chainedObject); //unresolved jump }; return (p_obj); } } }//package caurina.transitions
Section 84
//03_151 (CoalExpress4_fla.03_151) package CoalExpress4_fla { import flash.display.*; public dynamic class 03_151 extends MovieClip { public function 03_151(){ super(); addFrameScript(0, frame1, 3, frame4, 28, frame29); } function frame1(){ stop(); } function frame4(){ stop(); } function frame29(){ stop(); } } }//package CoalExpress4_fla
Section 85
//04_161 (CoalExpress4_fla.04_161) package CoalExpress4_fla { import flash.display.*; public dynamic class 04_161 extends MovieClip { public function 04_161(){ super(); addFrameScript(0, frame1, 3, frame4, 31, frame32); } function frame1(){ stop(); } function frame4(){ stop(); } function frame32(){ stop(); } } }//package CoalExpress4_fla
Section 86
//05_167 (CoalExpress4_fla.05_167) package CoalExpress4_fla { import flash.display.*; public dynamic class 05_167 extends MovieClip { public function 05_167(){ super(); addFrameScript(0, frame1, 1, frame2); } function frame1(){ stop(); } function frame2(){ stop(); } } }//package CoalExpress4_fla
Section 87
//05_171 (CoalExpress4_fla.05_171) package CoalExpress4_fla { import flash.display.*; public dynamic class 05_171 extends MovieClip { public function 05_171(){ super(); addFrameScript(0, frame1, 3, frame4, 29, frame30); } function frame1(){ stop(); } function frame4(){ stop(); } function frame30(){ stop(); } } }//package CoalExpress4_fla
Section 88
//05_45 (CoalExpress4_fla.05_45) package CoalExpress4_fla { import flash.display.*; public dynamic class 05_45 extends MovieClip { public function 05_45(){ super(); addFrameScript(16, frame17); } function frame17(){ stop(); } } }//package CoalExpress4_fla
Section 89
//12_37 (CoalExpress4_fla.12_37) package CoalExpress4_fla { import flash.display.*; public dynamic class 12_37 extends MovieClip { public function 12_37(){ super(); addFrameScript(0, frame1); } function frame1(){ stop(); } } }//package CoalExpress4_fla
Section 90
//14_44 (CoalExpress4_fla.14_44) package CoalExpress4_fla { import flash.display.*; public dynamic class 14_44 extends MovieClip { public function 14_44(){ super(); addFrameScript(0, frame1, 1, frame2); } function frame1(){ stop(); } function frame2(){ stop(); } } }//package CoalExpress4_fla
Section 91
//15_47 (CoalExpress4_fla.15_47) package CoalExpress4_fla { import flash.display.*; public dynamic class 15_47 extends MovieClip { public function 15_47(){ super(); addFrameScript(0, frame1); } function frame1(){ stop(); } } }//package CoalExpress4_fla
Section 92
//9_30 (CoalExpress4_fla.9_30) package CoalExpress4_fla { import flash.display.*; public dynamic class 9_30 extends MovieClip { public function 9_30(){ super(); addFrameScript(0, frame1); } function frame1(){ stop(); } } }//package CoalExpress4_fla
Section 93
//logo_animation_2 (CoalExpress4_fla.logo_animation_2) package CoalExpress4_fla { import flash.display.*; import flash.events.*; import flash.media.*; import flash.net.*; public dynamic class logo_animation_2 extends MovieClip { public var getURL:URLRequest; public var urlButton:SimpleButton; public function logo_animation_2(){ super(); addFrameScript(0, frame1, 85, frame86); } function frame86(){ stop(); SoundMixer.stopAll(); } function frame1(){ getURL = new URLRequest("http://www.sillybull.com/?utm_source=games&utm_medium=coalexpress4pl"); urlButton.addEventListener(MouseEvent.CLICK, urlClick); } public function urlClick(event:MouseEvent):void{ navigateToURL(getURL); } } }//package CoalExpress4_fla
Section 94
//MainTimeline (CoalExpress4_fla.MainTimeline) package CoalExpress4_fla { import flash.display.*; import flash.media.*; public dynamic class MainTimeline extends MovieClip { public function MainTimeline(){ super(); addFrameScript(0, frame1, 2, frame3); } function frame3(){ SoundMixer.stopAll(); stop(); addChild(new Main()); } function frame1(){ MochiBot.track(this, "ab6467d0"); stop(); } } }//package CoalExpress4_fla
Section 95
//s_198 (CoalExpress4_fla.s_198) package CoalExpress4_fla { import flash.display.*; public dynamic class s_198 extends MovieClip { public function s_198(){ super(); addFrameScript(0, frame1, 1, frame2, 2, frame3, 3, frame4); } function frame3(){ stop(); } function frame1(){ stop(); } function frame4(){ stop(); } function frame2(){ stop(); } } }//package CoalExpress4_fla
Section 96
//s_208 (CoalExpress4_fla.s_208) package CoalExpress4_fla { import flash.display.*; public dynamic class s_208 extends MovieClip { public function s_208(){ super(); addFrameScript(0, frame1, 1, frame2, 2, frame3, 3, frame4); } function frame3(){ stop(); } function frame1(){ stop(); } function frame4(){ stop(); } function frame2(){ stop(); } } }//package CoalExpress4_fla
Section 97
//shopmenu1_250 (CoalExpress4_fla.shopmenu1_250) package CoalExpress4_fla { import flash.display.*; public dynamic class shopmenu1_250 extends MovieClip { public var i5:MovieClip; public var i4:MovieClip; public var i1:MovieClip; public var i2:MovieClip; public var i3:MovieClip; public function shopmenu1_250(){ super(); } } }//package CoalExpress4_fla
Section 98
//shopmenu2_267 (CoalExpress4_fla.shopmenu2_267) package CoalExpress4_fla { import flash.display.*; public dynamic class shopmenu2_267 extends MovieClip { public var i5:MovieClip; public var i4:MovieClip; public var i1:MovieClip; public var i2:MovieClip; public var i3:MovieClip; public function shopmenu2_267(){ super(); } } }//package CoalExpress4_fla
Section 99
//shopmenu3_284 (CoalExpress4_fla.shopmenu3_284) package CoalExpress4_fla { import flash.display.*; public dynamic class shopmenu3_284 extends MovieClip { public var i5:MovieClip; public var i4:MovieClip; public var i1:MovieClip; public var i2:MovieClip; public var i3:MovieClip; public function shopmenu3_284(){ super(); } } }//package CoalExpress4_fla
Section 100
//shopmenu4_301 (CoalExpress4_fla.shopmenu4_301) package CoalExpress4_fla { import flash.display.*; public dynamic class shopmenu4_301 extends MovieClip { public var i5:MovieClip; public var i4:MovieClip; public var i1:MovieClip; public var i2:MovieClip; public var i3:MovieClip; public function shopmenu4_301(){ super(); } } }//package CoalExpress4_fla
Section 101
//shopmenu5_318 (CoalExpress4_fla.shopmenu5_318) package CoalExpress4_fla { import flash.display.*; public dynamic class shopmenu5_318 extends MovieClip { public var i5:MovieClip; public var i4:MovieClip; public var i1:MovieClip; public var i2:MovieClip; public var i3:MovieClip; public function shopmenu5_318(){ super(); } } }//package CoalExpress4_fla
Section 102
//Timeline_1 (CoalExpress4_fla.Timeline_1) package CoalExpress4_fla { import flash.display.*; import flash.events.*; import flash.media.*; import flash.system.*; public dynamic class Timeline_1 extends MovieClip { public const FRAME_RATE_ADJUST:Boolean = true; public const LOADER_FRAME_RATE:Number = 30; public const AUTO_PLAY:Boolean = false; public var bar:MovieClip; public var logoAnimation:MovieClip; public var loadingComplete:Boolean; public var playBtn:SimpleButton; public var movieFrameRate:Number; public var initialized:Boolean; public function Timeline_1(){ super(); addFrameScript(0, frame1, 22, frame23, 36, frame37); } public function init():void{ if (initialized){ return; }; gotoAndStop(1); movieFrameRate = 0; if (((FRAME_RATE_ADJUST) && (stage))){ movieFrameRate = stage.frameRate; stage.frameRate = LOADER_FRAME_RATE; }; initialized = true; stop(); if (((root) && ((root is MovieClip)))){ MovieClip(root).stop(); }; loadingComplete = false; addEventListener(Event.ENTER_FRAME, enterFrameHandler, false, 0, true); if (meetsVersion([9, 0, 28, 0])){ addEventListener(Event.REMOVED_FROM_STAGE, cleanup, false, 0, true); }; enterFrameHandler(); } public function enterFrameHandler(e:Event=null):void{ var loaded:Number; if (((((!(movieFrameRate)) && (FRAME_RATE_ADJUST))) && (stage))){ movieFrameRate = stage.frameRate; stage.frameRate = LOADER_FRAME_RATE; }; if (!loadingComplete){ loaded = 0; if (loaderInfo){ loaded = (loaderInfo.bytesLoaded / loaderInfo.bytesTotal); }; if (bar){ bar.scaleX = loaded; }; if (loaded == 1){ loadingComplete = true; if (AUTO_PLAY){ startMovie(); } else { gotoAndPlay("loaded"); }; }; }; } public function meetsVersion(version:Array):Boolean{ var playerVersion:Array; var i:uint; playerVersion = String(Capabilities.version.split(" ")[1]).split(","); i = 0; while (i < version.length) { if (uint(playerVersion[i]) > version[i]){ return (true); }; if (uint(playerVersion[i]) < version[i]){ return (false); }; i++; }; return (true); } function frame1(){ initialized = false; init(); } function frame23(){ playBtn.addEventListener(MouseEvent.CLICK, playM); stop(); } function frame37(){ startMovie(); stop(); SoundMixer.stopAll(); } public function playM(event:MouseEvent):void{ logoAnimation.stop(); SoundMixer.stopAll(); gotoAndPlay("playOut"); } public function cleanup(e:Event=null){ if (initialized){ removeEventListener(Event.ENTER_FRAME, enterFrameHandler); if (meetsVersion([9, 0, 28, 0])){ removeEventListener(Event.REMOVED_FROM_STAGE, cleanup); }; if (movieFrameRate){ stage.frameRate = movieFrameRate; movieFrameRate = 0; }; }; initialized = false; } public function startMovie():void{ cleanup(); if (((root) && ((root is MovieClip)))){ MovieClip(root).play(); }; dispatchEvent(new Event(Event.COMPLETE)); } } }//package CoalExpress4_fla
Section 103
//Timeline_103 (CoalExpress4_fla.Timeline_103) package CoalExpress4_fla { import flash.display.*; public dynamic class Timeline_103 extends MovieClip { public function Timeline_103(){ super(); addFrameScript(0, frame1); } function frame1(){ stop(); } } }//package CoalExpress4_fla
Section 104
//Timeline_106 (CoalExpress4_fla.Timeline_106) package CoalExpress4_fla { import flash.display.*; public dynamic class Timeline_106 extends MovieClip { public var n1:MovieClip; public var n2:MovieClip; public var n0:MovieClip; public function Timeline_106(){ super(); } } }//package CoalExpress4_fla
Section 105
//Timeline_112 (CoalExpress4_fla.Timeline_112) package CoalExpress4_fla { import flash.display.*; public dynamic class Timeline_112 extends MovieClip { public function Timeline_112(){ super(); addFrameScript(0, frame1, 1, frame2); } function frame1(){ stop(); } function frame2(){ stop(); } } }//package CoalExpress4_fla
Section 106
//Timeline_115 (CoalExpress4_fla.Timeline_115) package CoalExpress4_fla { import flash.display.*; public dynamic class Timeline_115 extends MovieClip { public function Timeline_115(){ super(); addFrameScript(0, frame1, 1, frame2); } function frame1(){ stop(); } function frame2(){ stop(); } } }//package CoalExpress4_fla
Section 107
//Timeline_126 (CoalExpress4_fla.Timeline_126) package CoalExpress4_fla { import flash.display.*; public dynamic class Timeline_126 extends MovieClip { public function Timeline_126(){ super(); addFrameScript(0, frame1); } function frame1(){ stop(); } } }//package CoalExpress4_fla
Section 108
//Timeline_130 (CoalExpress4_fla.Timeline_130) package CoalExpress4_fla { import flash.display.*; public dynamic class Timeline_130 extends MovieClip { public function Timeline_130(){ super(); addFrameScript(0, frame1); } function frame1(){ stop(); } } }//package CoalExpress4_fla
Section 109
//Timeline_136 (CoalExpress4_fla.Timeline_136) package CoalExpress4_fla { import flash.display.*; public dynamic class Timeline_136 extends MovieClip { public function Timeline_136(){ super(); addFrameScript(0, frame1); } function frame1(){ stop(); } } }//package CoalExpress4_fla
Section 110
//Timeline_140 (CoalExpress4_fla.Timeline_140) package CoalExpress4_fla { import flash.display.*; public dynamic class Timeline_140 extends MovieClip { public function Timeline_140(){ super(); addFrameScript(0, frame1); } function frame1(){ stop(); } } }//package CoalExpress4_fla
Section 111
//Timeline_146 (CoalExpress4_fla.Timeline_146) package CoalExpress4_fla { import flash.display.*; public dynamic class Timeline_146 extends MovieClip { public function Timeline_146(){ super(); addFrameScript(0, frame1); } function frame1(){ stop(); } } }//package CoalExpress4_fla
Section 112
//Timeline_150 (CoalExpress4_fla.Timeline_150) package CoalExpress4_fla { import flash.display.*; public dynamic class Timeline_150 extends MovieClip { public function Timeline_150(){ super(); addFrameScript(0, frame1); } function frame1(){ stop(); } } }//package CoalExpress4_fla
Section 113
//Timeline_156 (CoalExpress4_fla.Timeline_156) package CoalExpress4_fla { import flash.display.*; public dynamic class Timeline_156 extends MovieClip { public function Timeline_156(){ super(); addFrameScript(0, frame1); } function frame1(){ stop(); } } }//package CoalExpress4_fla
Section 114
//Timeline_160 (CoalExpress4_fla.Timeline_160) package CoalExpress4_fla { import flash.display.*; public dynamic class Timeline_160 extends MovieClip { public function Timeline_160(){ super(); addFrameScript(0, frame1); } function frame1(){ stop(); } } }//package CoalExpress4_fla
Section 115
//Timeline_166 (CoalExpress4_fla.Timeline_166) package CoalExpress4_fla { import flash.display.*; public dynamic class Timeline_166 extends MovieClip { public function Timeline_166(){ super(); addFrameScript(0, frame1); } function frame1(){ stop(); } } }//package CoalExpress4_fla
Section 116
//Timeline_170 (CoalExpress4_fla.Timeline_170) package CoalExpress4_fla { import flash.display.*; public dynamic class Timeline_170 extends MovieClip { public function Timeline_170(){ super(); addFrameScript(0, frame1); } function frame1(){ stop(); } } }//package CoalExpress4_fla
Section 117
//Timeline_179 (CoalExpress4_fla.Timeline_179) package CoalExpress4_fla { import flash.display.*; public dynamic class Timeline_179 extends MovieClip { public function Timeline_179(){ super(); addFrameScript(0, frame1); } function frame1(){ stop(); } } }//package CoalExpress4_fla
Section 118
//Timeline_182 (CoalExpress4_fla.Timeline_182) package CoalExpress4_fla { import flash.display.*; public dynamic class Timeline_182 extends MovieClip { public function Timeline_182(){ super(); addFrameScript(0, frame1); } function frame1(){ stop(); } } }//package CoalExpress4_fla
Section 119
//Timeline_185 (CoalExpress4_fla.Timeline_185) package CoalExpress4_fla { import flash.display.*; public dynamic class Timeline_185 extends MovieClip { public function Timeline_185(){ super(); addFrameScript(0, frame1); } function frame1(){ stop(); } } }//package CoalExpress4_fla
Section 120
//Timeline_188 (CoalExpress4_fla.Timeline_188) package CoalExpress4_fla { import flash.display.*; public dynamic class Timeline_188 extends MovieClip { public function Timeline_188(){ super(); addFrameScript(0, frame1); } function frame1(){ stop(); } } }//package CoalExpress4_fla
Section 121
//Timeline_193 (CoalExpress4_fla.Timeline_193) package CoalExpress4_fla { import flash.display.*; public dynamic class Timeline_193 extends MovieClip { public function Timeline_193(){ super(); addFrameScript(0, frame1); } function frame1(){ stop(); } } }//package CoalExpress4_fla
Section 122
//Timeline_21 (CoalExpress4_fla.Timeline_21) package CoalExpress4_fla { import flash.display.*; public dynamic class Timeline_21 extends MovieClip { public var b1:MovieClip; public var b2:MovieClip; public var b5:MovieClip; public var b8:MovieClip; public var b4:MovieClip; public var b6:MovieClip; public var b3:MovieClip; public var b7:MovieClip; public var c1:MovieClip; public var c3:MovieClip; public var c4:MovieClip; public var c5:MovieClip; public var c6:MovieClip; public var c7:MovieClip; public var c8:MovieClip; public var c2:MovieClip; public var c9:MovieClip; public var d4:MovieClip; public var d5:MovieClip; public var d6:MovieClip; public var d1:MovieClip; public var d2:MovieClip; public var d3:MovieClip; public var e2:MovieClip; public var e3:MovieClip; public var e4:MovieClip; public var e5:MovieClip; public var e6:MovieClip; public var e1:MovieClip; public var f2:MovieClip; public var f5:MovieClip; public var f6:MovieClip; public var f7:MovieClip; public var f3:MovieClip; public var f4:MovieClip; public var f8:MovieClip; public var g2:MovieClip; public var g3:MovieClip; public var g4:MovieClip; public var g5:MovieClip; public var g6:MovieClip; public var g1:MovieClip; public var f9:MovieClip; public var f1:MovieClip; public var h1:MovieClip; public var h3:MovieClip; public var h5:MovieClip; public var h6:MovieClip; public var h7:MovieClip; public var h2:MovieClip; public var h4:MovieClip; public var i1:MovieClip; public var i3:MovieClip; public var i2:MovieClip; public var j3:MovieClip; public var j5:MovieClip; public var j7:MovieClip; public var j8:MovieClip; public var j6:MovieClip; public var j2:MovieClip; public var j4:MovieClip; public var k4:MovieClip; public var k5:MovieClip; public var k1:MovieClip; public var k2:MovieClip; public var k3:MovieClip; public var l1:MovieClip; public var l3:MovieClip; public var l2:MovieClip; public var j1:MovieClip; public var m1:MovieClip; public var m3:MovieClip; public var m4:MovieClip; public var m5:MovieClip; public var m2:MovieClip; public var n1:MovieClip; public var n2:MovieClip; public var o1:MovieClip; public var o2:MovieClip; public var c10:MovieClip; public var a1:MovieClip; public var a2:MovieClip; public var a3:MovieClip; public var a4:MovieClip; public function Timeline_21(){ super(); } } }//package CoalExpress4_fla
Section 123
//Timeline_213 (CoalExpress4_fla.Timeline_213) package CoalExpress4_fla { import flash.display.*; public dynamic class Timeline_213 extends MovieClip { public var t2:MovieClip; public var t3:MovieClip; public var t1:MovieClip; public var t4:MovieClip; public function Timeline_213(){ super(); addFrameScript(0, frame1); } function frame1(){ stop(); } } }//package CoalExpress4_fla
Section 124
//Timeline_214 (CoalExpress4_fla.Timeline_214) package CoalExpress4_fla { import flash.display.*; public dynamic class Timeline_214 extends MovieClip { public function Timeline_214(){ super(); addFrameScript(0, frame1); } function frame1(){ stop(); } } }//package CoalExpress4_fla
Section 125
//Timeline_217 (CoalExpress4_fla.Timeline_217) package CoalExpress4_fla { import flash.display.*; public dynamic class Timeline_217 extends MovieClip { public function Timeline_217(){ super(); addFrameScript(0, frame1); } function frame1(){ stop(); } } }//package CoalExpress4_fla
Section 126
//Timeline_220 (CoalExpress4_fla.Timeline_220) package CoalExpress4_fla { import flash.display.*; public dynamic class Timeline_220 extends MovieClip { public function Timeline_220(){ super(); addFrameScript(0, frame1); } function frame1(){ stop(); } } }//package CoalExpress4_fla
Section 127
//Timeline_223 (CoalExpress4_fla.Timeline_223) package CoalExpress4_fla { import flash.display.*; public dynamic class Timeline_223 extends MovieClip { public function Timeline_223(){ super(); addFrameScript(0, frame1); } function frame1(){ stop(); } } }//package CoalExpress4_fla
Section 128
//Timeline_252 (CoalExpress4_fla.Timeline_252) package CoalExpress4_fla { import flash.display.*; public dynamic class Timeline_252 extends MovieClip { public function Timeline_252(){ super(); addFrameScript(0, frame1); } function frame1(){ stop(); } } }//package CoalExpress4_fla
Section 129
//Timeline_255 (CoalExpress4_fla.Timeline_255) package CoalExpress4_fla { import flash.display.*; public dynamic class Timeline_255 extends MovieClip { public function Timeline_255(){ super(); addFrameScript(0, frame1); } function frame1(){ stop(); } } }//package CoalExpress4_fla
Section 130
//Timeline_258 (CoalExpress4_fla.Timeline_258) package CoalExpress4_fla { import flash.display.*; public dynamic class Timeline_258 extends MovieClip { public function Timeline_258(){ super(); addFrameScript(0, frame1); } function frame1(){ stop(); } } }//package CoalExpress4_fla
Section 131
//Timeline_261 (CoalExpress4_fla.Timeline_261) package CoalExpress4_fla { import flash.display.*; public dynamic class Timeline_261 extends MovieClip { public function Timeline_261(){ super(); addFrameScript(0, frame1); } function frame1(){ stop(); } } }//package CoalExpress4_fla
Section 132
//Timeline_264 (CoalExpress4_fla.Timeline_264) package CoalExpress4_fla { import flash.display.*; public dynamic class Timeline_264 extends MovieClip { public function Timeline_264(){ super(); addFrameScript(0, frame1); } function frame1(){ stop(); } } }//package CoalExpress4_fla
Section 133
//Timeline_269 (CoalExpress4_fla.Timeline_269) package CoalExpress4_fla { import flash.display.*; public dynamic class Timeline_269 extends MovieClip { public function Timeline_269(){ super(); addFrameScript(0, frame1); } function frame1(){ stop(); } } }//package CoalExpress4_fla
Section 134
//Timeline_272 (CoalExpress4_fla.Timeline_272) package CoalExpress4_fla { import flash.display.*; public dynamic class Timeline_272 extends MovieClip { public function Timeline_272(){ super(); addFrameScript(0, frame1); } function frame1(){ stop(); } } }//package CoalExpress4_fla
Section 135
//Timeline_275 (CoalExpress4_fla.Timeline_275) package CoalExpress4_fla { import flash.display.*; public dynamic class Timeline_275 extends MovieClip { public function Timeline_275(){ super(); addFrameScript(0, frame1); } function frame1(){ stop(); } } }//package CoalExpress4_fla
Section 136
//Timeline_278 (CoalExpress4_fla.Timeline_278) package CoalExpress4_fla { import flash.display.*; public dynamic class Timeline_278 extends MovieClip { public function Timeline_278(){ super(); addFrameScript(0, frame1); } function frame1(){ stop(); } } }//package CoalExpress4_fla
Section 137
//Timeline_281 (CoalExpress4_fla.Timeline_281) package CoalExpress4_fla { import flash.display.*; public dynamic class Timeline_281 extends MovieClip { public function Timeline_281(){ super(); addFrameScript(0, frame1); } function frame1(){ stop(); } } }//package CoalExpress4_fla
Section 138
//Timeline_286 (CoalExpress4_fla.Timeline_286) package CoalExpress4_fla { import flash.display.*; public dynamic class Timeline_286 extends MovieClip { public function Timeline_286(){ super(); addFrameScript(0, frame1); } function frame1(){ stop(); } } }//package CoalExpress4_fla
Section 139
//Timeline_289 (CoalExpress4_fla.Timeline_289) package CoalExpress4_fla { import flash.display.*; public dynamic class Timeline_289 extends MovieClip { public function Timeline_289(){ super(); addFrameScript(0, frame1); } function frame1(){ stop(); } } }//package CoalExpress4_fla
Section 140
//Timeline_292 (CoalExpress4_fla.Timeline_292) package CoalExpress4_fla { import flash.display.*; public dynamic class Timeline_292 extends MovieClip { public function Timeline_292(){ super(); addFrameScript(0, frame1); } function frame1(){ stop(); } } }//package CoalExpress4_fla
Section 141
//Timeline_295 (CoalExpress4_fla.Timeline_295) package CoalExpress4_fla { import flash.display.*; public dynamic class Timeline_295 extends MovieClip { public function Timeline_295(){ super(); addFrameScript(0, frame1); } function frame1(){ stop(); } } }//package CoalExpress4_fla
Section 142
//Timeline_298 (CoalExpress4_fla.Timeline_298) package CoalExpress4_fla { import flash.display.*; public dynamic class Timeline_298 extends MovieClip { public function Timeline_298(){ super(); addFrameScript(0, frame1); } function frame1(){ stop(); } } }//package CoalExpress4_fla
Section 143
//Timeline_303 (CoalExpress4_fla.Timeline_303) package CoalExpress4_fla { import flash.display.*; public dynamic class Timeline_303 extends MovieClip { public function Timeline_303(){ super(); addFrameScript(0, frame1); } function frame1(){ stop(); } } }//package CoalExpress4_fla
Section 144
//Timeline_306 (CoalExpress4_fla.Timeline_306) package CoalExpress4_fla { import flash.display.*; public dynamic class Timeline_306 extends MovieClip { public function Timeline_306(){ super(); addFrameScript(0, frame1); } function frame1(){ stop(); } } }//package CoalExpress4_fla
Section 145
//Timeline_309 (CoalExpress4_fla.Timeline_309) package CoalExpress4_fla { import flash.display.*; public dynamic class Timeline_309 extends MovieClip { public function Timeline_309(){ super(); addFrameScript(0, frame1); } function frame1(){ stop(); } } }//package CoalExpress4_fla
Section 146
//Timeline_31 (CoalExpress4_fla.Timeline_31) package CoalExpress4_fla { import flash.display.*; public dynamic class Timeline_31 extends MovieClip { public function Timeline_31(){ super(); addFrameScript(0, frame1); } function frame1(){ stop(); } } }//package CoalExpress4_fla
Section 147
//Timeline_312 (CoalExpress4_fla.Timeline_312) package CoalExpress4_fla { import flash.display.*; public dynamic class Timeline_312 extends MovieClip { public function Timeline_312(){ super(); addFrameScript(0, frame1); } function frame1(){ stop(); } } }//package CoalExpress4_fla
Section 148
//Timeline_315 (CoalExpress4_fla.Timeline_315) package CoalExpress4_fla { import flash.display.*; public dynamic class Timeline_315 extends MovieClip { public function Timeline_315(){ super(); addFrameScript(0, frame1); } function frame1(){ stop(); } } }//package CoalExpress4_fla
Section 149
//Timeline_320 (CoalExpress4_fla.Timeline_320) package CoalExpress4_fla { import flash.display.*; public dynamic class Timeline_320 extends MovieClip { public function Timeline_320(){ super(); addFrameScript(0, frame1); } function frame1(){ stop(); } } }//package CoalExpress4_fla
Section 150
//Timeline_323 (CoalExpress4_fla.Timeline_323) package CoalExpress4_fla { import flash.display.*; public dynamic class Timeline_323 extends MovieClip { public function Timeline_323(){ super(); addFrameScript(0, frame1); } function frame1(){ stop(); } } }//package CoalExpress4_fla
Section 151
//Timeline_326 (CoalExpress4_fla.Timeline_326) package CoalExpress4_fla { import flash.display.*; public dynamic class Timeline_326 extends MovieClip { public function Timeline_326(){ super(); addFrameScript(0, frame1); } function frame1(){ stop(); } } }//package CoalExpress4_fla
Section 152
//Timeline_329 (CoalExpress4_fla.Timeline_329) package CoalExpress4_fla { import flash.display.*; public dynamic class Timeline_329 extends MovieClip { public function Timeline_329(){ super(); addFrameScript(0, frame1); } function frame1(){ stop(); } } }//package CoalExpress4_fla
Section 153
//Timeline_33 (CoalExpress4_fla.Timeline_33) package CoalExpress4_fla { import flash.display.*; public dynamic class Timeline_33 extends MovieClip { public function Timeline_33(){ super(); addFrameScript(0, frame1); } function frame1(){ stop(); } } }//package CoalExpress4_fla
Section 154
//Timeline_332 (CoalExpress4_fla.Timeline_332) package CoalExpress4_fla { import flash.display.*; public dynamic class Timeline_332 extends MovieClip { public function Timeline_332(){ super(); addFrameScript(0, frame1); } function frame1(){ stop(); } } }//package CoalExpress4_fla
Section 155
//Timeline_34 (CoalExpress4_fla.Timeline_34) package CoalExpress4_fla { import flash.display.*; public dynamic class Timeline_34 extends MovieClip { public function Timeline_34(){ super(); addFrameScript(24, frame25); } function frame25(){ stop(); } } }//package CoalExpress4_fla
Section 156
//Timeline_342 (CoalExpress4_fla.Timeline_342) package CoalExpress4_fla { import flash.display.*; public dynamic class Timeline_342 extends MovieClip { public function Timeline_342(){ super(); addFrameScript(0, frame1); } function frame1(){ stop(); } } }//package CoalExpress4_fla
Section 157
//Timeline_348 (CoalExpress4_fla.Timeline_348) package CoalExpress4_fla { import flash.display.*; public dynamic class Timeline_348 extends MovieClip { public function Timeline_348(){ super(); addFrameScript(0, frame1); } function frame1(){ stop(); } } }//package CoalExpress4_fla
Section 158
//Timeline_360 (CoalExpress4_fla.Timeline_360) package CoalExpress4_fla { import flash.display.*; public dynamic class Timeline_360 extends MovieClip { public var link:MovieClip; public function Timeline_360(){ super(); } } }//package CoalExpress4_fla
Section 159
//Timeline_38 (CoalExpress4_fla.Timeline_38) package CoalExpress4_fla { import flash.display.*; public dynamic class Timeline_38 extends MovieClip { public function Timeline_38(){ super(); addFrameScript(0, frame1); } function frame1(){ stop(); } } }//package CoalExpress4_fla
Section 160
//Timeline_40 (CoalExpress4_fla.Timeline_40) package CoalExpress4_fla { import flash.display.*; public dynamic class Timeline_40 extends MovieClip { public function Timeline_40(){ super(); addFrameScript(0, frame1); } function frame1(){ stop(); } } }//package CoalExpress4_fla
Section 161
//Timeline_41 (CoalExpress4_fla.Timeline_41) package CoalExpress4_fla { import flash.display.*; public dynamic class Timeline_41 extends MovieClip { public function Timeline_41(){ super(); addFrameScript(0, frame1, 27, frame28); } function frame1(){ stop(); } function frame28(){ stop(); } } }//package CoalExpress4_fla
Section 162
//Timeline_48 (CoalExpress4_fla.Timeline_48) package CoalExpress4_fla { import flash.display.*; public dynamic class Timeline_48 extends MovieClip { public function Timeline_48(){ super(); addFrameScript(0, frame1); } function frame1(){ stop(); } } }//package CoalExpress4_fla
Section 163
//Timeline_50 (CoalExpress4_fla.Timeline_50) package CoalExpress4_fla { import flash.display.*; public dynamic class Timeline_50 extends MovieClip { public function Timeline_50(){ super(); addFrameScript(0, frame1); } function frame1(){ stop(); } } }//package CoalExpress4_fla
Section 164
//Timeline_51 (CoalExpress4_fla.Timeline_51) package CoalExpress4_fla { import flash.display.*; public dynamic class Timeline_51 extends MovieClip { public function Timeline_51(){ super(); addFrameScript(0, frame1, 25, frame26); } function frame1(){ stop(); } function frame26(){ stop(); } } }//package CoalExpress4_fla
Section 165
//Timeline_96 (CoalExpress4_fla.Timeline_96) package CoalExpress4_fla { import flash.display.*; public dynamic class Timeline_96 extends MovieClip { public function Timeline_96(){ super(); addFrameScript(0, frame1, 1, frame2); } function frame1(){ stop(); } function frame2(){ stop(); } } }//package CoalExpress4_fla
Section 166
//Timeline_99 (CoalExpress4_fla.Timeline_99) package CoalExpress4_fla { import flash.display.*; public dynamic class Timeline_99 extends MovieClip { public function Timeline_99(){ super(); addFrameScript(0, frame1, 1, frame2); } function frame1(){ stop(); } function frame2(){ stop(); } } }//package CoalExpress4_fla
Section 167
//BaseTrain (Element.BaseTrain) package Element { import flash.display.*; import UserdefinedClass.*; import flash.geom.*; import Box2D.Dynamics.*; import Box2D.Common.Math.*; import Box2D.Dynamics.Joints.*; import BaseClass.*; import flash.utils.*; public class BaseTrain extends MovieClip { public var train:MovieClip; public var speedlv:int; public var maxbal:Number;// = 150 public var trainboxcount:int; public var yanarr:Array; public var cargocontainer:Array; public var addspeed:Number;// = 0 public var spin:Number;// = 0 public var addspeedlv:int; public var ballv:int; public var motor1:b2RevoluteJoint; public var motor2:b2RevoluteJoint; public var motor3:b2RevoluteJoint; public var lunbrake:Number;// = 0 public var maxtorque:Number;// = 100 public var motortorque:Number;// = 20 public var trainbox:Array; public var lun1:MovieClip; public var lun2:MovieClip; public var lun3:MovieClip; public var motorlunspeed:Number;// = 18.8495559215388 public var lunD:Number;// = 1.5 public var lunF:Number;// = 20 public var hitmc1:MovieClip; public var hitmc2:MovieClip; public var lunR:Number;// = 0 public var motorlunmaxtorque:Number;// = 30 public var power:Number;// = 0 public var speedup:Number;// = 100 public var cargoarr:Array; public var trainD:Number;// = 0.5 public var trainF:Number;// = 0.1 public var Pworld:Box2dFactory; public var lunspeed:Number;// = 0 public var maxspeed:Number;// = 37.6991118430775 public var cargodata:Array; public var trainR:Number;// = 0 public var trainkind:int; public var maxaddspeed:Number;// = 10 public var Cargo:MovieClip; public var trainhead:Array; public var game:BaseStage; public function BaseTrain(g:BaseStage, x:Number, y:Number, kind:int){ var tempBox:MovieClip; var tempAnchor:MovieClip; trainhead = new Array("train1", "train2", "train3", "train4"); trainbox = new Array("box1", "box2", "box3", "box4"); trainF = 0.1; trainD = 0.5; trainR = 0; lunF = 20; lunD = 1.5; lunR = 0; speedup = 100; motortorque = 20; motorlunspeed = (6 * Math.PI); motorlunmaxtorque = 30; maxbal = 150; maxspeed = (12 * Math.PI); maxtorque = 100; maxaddspeed = 10; addspeed = 0; spin = 0; lunbrake = 0; power = 0; lunspeed = 0; yanarr = new Array(); cargodata = new Array([0.5, 0.1, 0], [0.3, 0.1, 0], [0.1, 0.2, 0], [0.3, 0.2, 0], [0.3, 0.2, 0], [0.5, 0.2, 0.6], [0.5, 0.5, 0], [0.2, 0.2, 0], [0.1, 0.5, 0], [0.1, 0.1, 0], [0.2, 0.2, 0], [0.3, 0.5, 0], [0.1, 0.2, 0], [0.2, 0.6, 0], [0.3, 0.5, 0]); cargoarr = new Array(["a1", "a2", "a3", "a4"], ["b1", "b2", "b3", "b4", "b5", "b6", "b7", "b8"], ["c1", "c2", "c3", "c4", "c5", "c6", "c7", "c8", "c9", "c10"], ["d1", "d2", "d3", "d4", "d5", "d6"], ["e1", "e2", "e3", "e4", "e5", "e6"], ["f1", "f2", "f3", "f4", "f5", "f6", "f7", "f8", "f9"], ["g1", "g2", "g3", "g4", "g5", "g6"], ["h1", "h2", "h3", "h4", "h5", "h6", "h7"], ["i1", "i2", "i3"], ["j1", "j2", "j3", "j4", "j5", "j6", "j7", "j8"], ["k1", "k2", "k3", "k4", "k5"], ["l1", "l2", "l3"], ["m1", "m2", "m3", "m4", "m5"], ["n1", "n2"], ["o1", "o2"]); cargocontainer = new Array(); super(); game = g; trainkind = kind; loaddata(); Pworld = Box2dFactory.getInstance(); makehead(g.car, x, y); tempAnchor = makeAnchor(train, 1, g.car); tempBox = makebox(tempAnchor, g.car); hitmc1 = (tempBox.getChildByName("hit") as MovieClip); tempAnchor = makeAnchor(tempBox, 1, g.car); tempBox = makebox(tempAnchor, g.car); hitmc2 = (tempBox.getChildByName("hit") as MovieClip); } public function unbreak():void{ (lun1.bd as b2Body).m_angularDamping = 0; (lun2.bd as b2Body).m_angularDamping = 0; (train.bd as b2Body).m_linearDamping = 0; } public function release():void{ motor1.EnableMotor(false); motor2.EnableMotor(false); motor3.EnableMotor(false); } public function makeAnchor(box1:MovieClip, num:uint, container:Sprite):MovieClip{ var tempAnchor:MovieClip; var lastAnchor:MovieClip; var i:int; var anchorpx:Number; var anchorpy:Number; lastAnchor = box1; i = 0; while (i < num) { tempAnchor = new anchor(); tempAnchor.x = ((lastAnchor.x + lastAnchor.anchor2.x) - tempAnchor.anchor1.x); tempAnchor.y = ((lastAnchor.y + lastAnchor.anchor2.y) - tempAnchor.anchor2.y); container.addChild(tempAnchor); Pworld.addToWorld((tempAnchor.x / 30), (tempAnchor.y / 30), 0, 0, 3, 0, tempAnchor, false, "train"); (tempAnchor.bd as b2Body).m_angularDamping = 10000; anchorpx = ((lastAnchor.x + lastAnchor.anchor2.x) / 30); anchorpy = ((lastAnchor.y + lastAnchor.anchor2.y) / 30); Pworld.createRevoluteJoint(lastAnchor.bd, tempAnchor.bd, new b2Vec2(anchorpx, anchorpy), true, ((-5 * Math.PI) / 180), ((5 * Math.PI) / 180)); lastAnchor = tempAnchor; i++; }; return (lastAnchor); } public function breakDown():void{ Pworld.world.DestroyJoint(motor1); Pworld.world.DestroyJoint(motor2); Pworld.world.DestroyJoint(motor3); train.gotoAndStop("die"); } public function moveR():void{ var b:b2Body; b = (train.bd as b2Body); b.ApplyTorque(spin); } public function moveL():void{ var b:b2Body; b = (train.bd as b2Body); b.ApplyTorque(-(spin)); } public function makehead(s:Sprite, x:Number, y:Number){ var trainclass:*; var p:Point; trainclass = getDefinitionByName(trainhead[trainkind].toString()); train = (new (trainclass) as MovieClip); train.x = x; train.y = y; Pworld.addToWorld((train.x / 30), (train.y / 30), train.rotation, trainF, trainD, trainR, train, false, "head"); lun1 = (train.getChildByName("l1") as MovieClip); lun2 = (train.getChildByName("l2") as MovieClip); lun3 = (train.getChildByName("l3") as MovieClip); p = MyMath.LtoG(s, lun1); lun1.x = p.x; lun1.y = p.y; p = MyMath.LtoG(s, lun2); lun2.x = p.x; lun2.y = p.y; p = MyMath.LtoG(s, lun3); lun3.x = p.x; lun3.y = p.y; Pworld.makeBodyByYuanInside((lun1.x / 30), (lun1.y / 30), lun1, lunD, lunF, lunR, false, "lun"); Pworld.makeBodyByYuanInside((lun2.x / 30), (lun2.y / 30), lun2, lunD, lunF, lunR, false, "lun"); Pworld.makeBodyByYuanInside((lun3.x / 30), (lun3.y / 30), lun3, lunD, lunF, lunR, false, "lun"); (lun1.bd as b2Body).AllowSleeping(false); (lun2.bd as b2Body).AllowSleeping(false); (lun3.bd as b2Body).AllowSleeping(false); motor1 = (Pworld.createRevoluteJoint(lun1.bd, train.bd, (lun1.bd as b2Body).GetWorldCenter(), false, 0, 0, false, 0, power) as b2RevoluteJoint); motor2 = (Pworld.createRevoluteJoint(lun2.bd, train.bd, (lun2.bd as b2Body).GetWorldCenter(), false, 0, 0, false, 0, power) as b2RevoluteJoint); motor3 = (Pworld.createRevoluteJoint(lun3.bd, train.bd, (lun3.bd as b2Body).GetWorldCenter(), false, 0, 0, false, 0, power) as b2RevoluteJoint); updataLv(s); yanarr.push(train.getChildByName("yan1")); yanarr.push(train.getChildByName("yan2")); yanarr.push(train.getChildByName("yan3")); } public function accelerate():void{ var b:b2Body; b = (train.bd as b2Body); b.ApplyForce(new b2Vec2((Math.cos(((train.rotation * Math.PI) / 180)) * speedup), (Math.sin(((train.rotation * Math.PI) / 180)) * speedup)), b.GetWorldCenter()); } public function updataboxLv(tb:MovieClip, l1:MovieClip, l2:MovieClip, l3:MovieClip, l4:MovieClip, s:Sprite){ s.addChild(l1); s.addChild(l2); s.addChild(l3); s.addChild(l4); s.addChild(tb); } public function brake():void{ var v:b2Vec2; v = (train.bd as b2Body).GetLinearVelocity(); (train.bd as b2Body).SetLinearVelocity(new b2Vec2(0, v.y)); } public function makebox(prevBox:MovieClip, container:Sprite):MovieClip{ var boxclass:*; var tb:MovieClip; var l1:MovieClip; var l2:MovieClip; var l3:MovieClip; var l4:MovieClip; var p:Point; var temparr:Array; var tempdata:Array; var len:int; var tempmc:MovieClip; var i:int; boxclass = getDefinitionByName(trainbox[trainkind].toString()); tb = (new (boxclass) as MovieClip); tb.x = ((prevBox.x + prevBox.anchor2.x) - tb.anchor1.x); tb.y = ((prevBox.y + prevBox.anchor2.y) - tb.anchor1.y); Pworld.addToWorld((tb.x / 30), (tb.y / 30), 0, trainF, trainD, trainR, tb, false, "train"); l1 = (tb.getChildByName("lun1") as MovieClip); l2 = (tb.getChildByName("lun2") as MovieClip); l3 = (tb.getChildByName("lun3") as MovieClip); l4 = (tb.getChildByName("lun4") as MovieClip); p = MyMath.LtoG(container, l1); l1.x = p.x; l1.y = p.y; p = MyMath.LtoG(container, l2); l2.x = p.x; l2.y = p.y; p = MyMath.LtoG(container, l3); l3.x = p.x; l3.y = p.y; p = MyMath.LtoG(container, l4); l4.x = p.x; l4.y = p.y; Pworld.makeBodyByYuanInside((l1.x / 30), (l1.y / 30), l1, lunD, lunF, lunR, false, "lun"); Pworld.makeBodyByYuanInside((l2.x / 30), (l2.y / 30), l2, lunD, lunF, lunR, false, "lun"); Pworld.makeBodyByYuanInside((l3.x / 30), (l3.y / 30), l3, lunD, lunF, lunR, false, "lun"); Pworld.makeBodyByYuanInside((l4.x / 30), (l4.y / 30), l4, lunD, lunF, lunR, false, "lun"); Pworld.createRevoluteJoint(l1.bd, tb.bd, (l1.bd as b2Body).GetWorldCenter(), false, 0, 0, false, 0, 150); Pworld.createRevoluteJoint(l2.bd, tb.bd, (l2.bd as b2Body).GetWorldCenter(), false, 0, 0, false, 0, 150); Pworld.createRevoluteJoint(l3.bd, tb.bd, (l3.bd as b2Body).GetWorldCenter(), false, 0, 0, false, 0, 150); Pworld.createRevoluteJoint(l4.bd, tb.bd, (l4.bd as b2Body).GetWorldCenter(), false, 0, 0, false, 0, 150); Pworld.createRevoluteJoint(prevBox.bd, tb.bd, new b2Vec2(((prevBox.x + prevBox.anchor2.x) / 30), ((prevBox.y + prevBox.anchor2.y) / 30)), true, ((-30 * Math.PI) / 180), ((30 * Math.PI) / 180)); updataboxLv(tb, l1, l2, l3, l4, container); Cargo = (tb.getChildByName("cargo") as MovieClip); temparr = new Array(); temparr = cargoarr[(game.lv - 1)]; tempdata = new Array(); tempdata = cargodata[(game.lv - 1)]; len = temparr.length; i = 0; while (i < len) { tempmc = (Cargo.getChildByName(temparr[i]) as MovieClip); if (game.lv == 10){ p = MyMath.LtoG(game.cargo, tempmc); tempmc.x = p.x; tempmc.y = p.y; game.cargo.addChild(tempmc); Pworld.makeBodyByYuanInside((tempmc.x / 30), (tempmc.y / 30), tempmc, tempdata[0], tempdata[1], tempdata[2], false, "cargo"); } else { p = MyMath.LtoG(game.cargo, tempmc); tempmc.x = p.x; tempmc.y = p.y; game.cargo.addChild(tempmc); Pworld.addToWorld((tempmc.x / 30), (tempmc.y / 30), tempmc.rotation, tempdata[0], tempdata[1], tempdata[2], tempmc, false, "cargo"); }; tempmc.live = true; tempmc.crisp = 0; tempmc.hp = true; cargocontainer.push(tempmc); i++; }; tb.removeChild(Cargo); return (tb); } public function updataLv(s:Sprite){ s.addChild(lun1); s.addChild(lun2); s.addChild(lun3); s.addChild(train); } public function stopship(){ (train.bd as b2Body).m_linearDamping = 1000; (train.bd as b2Body).m_angularDamping = 1000; } public function loaddata(){ addspeed = (MyData.getInstance().train[trainkind].addspeed + MyData.getInstance().addv[0]); spin = (MyData.getInstance().train[trainkind].spin + (MyData.getInstance().addv[1] * 6)); lunbrake = (MyData.getInstance().train[trainkind].brake + (MyData.getInstance().addv[2] * 6)); power = (MyData.getInstance().train[trainkind].power + (MyData.getInstance().addv[3] * 8)); lunspeed = ((MyData.getInstance().train[trainkind].lunspeed * Math.PI) + ((MyData.getInstance().addv[4] * Math.PI) * 1)); } public function lunMoveL():void{ motor1.EnableMotor(true); motor2.EnableMotor(true); motor3.EnableMotor(true); motor2.SetMotorSpeed(lunspeed); motor2.SetMaxMotorTorque(lunbrake); motor1.SetMotorSpeed(lunspeed); motor1.SetMaxMotorTorque(lunbrake); motor3.SetMotorSpeed(lunspeed); motor3.SetMaxMotorTorque(lunbrake); } public function lunMoveR():void{ motor1.EnableMotor(true); motor2.EnableMotor(true); motor3.EnableMotor(true); motor2.SetMotorSpeed(-(lunspeed)); motor2.SetMaxMotorTorque(power); motor1.SetMotorSpeed(-(lunspeed)); motor1.SetMaxMotorTorque(power); motor3.SetMotorSpeed(-(lunspeed)); motor3.SetMaxMotorTorque(power); } public function destroy(){ Pworld.world.DestroyJoint(motor1); Pworld.world.DestroyJoint(motor2); Pworld.world.DestroyJoint(motor3); Pworld.world.DestroyBody((train.bd as b2Body)); Pworld.world.DestroyBody((lun1.bd as b2Body)); Pworld.world.DestroyBody((lun2.bd as b2Body)); Pworld.world.DestroyBody((lun3.bd as b2Body)); } } }//package Element
Section 168
//MyContactFilter (Element.MyContactFilter) package Element { import Box2D.Dynamics.*; import Box2D.Collision.Shapes.*; public class MyContactFilter extends b2ContactFilter { public function MyContactFilter(){ super(); } override public function ShouldCollide(fixtureA:b2Shape, fixtureB:b2Shape):Boolean{ var b1:b2Body; var b2:b2Body; var u1:Object; var u2:Object; b1 = fixtureA.GetBody(); b2 = fixtureB.GetBody(); u1 = b1.GetUserData(); u2 = b2.GetUserData(); if (((u1) && (u2))){ if ((((u1.type == "head")) && ((u2.type == "lun")))){ return (false); }; if ((((u2.type == "head")) && ((u1.type == "lun")))){ return (false); }; if ((((u1.type == "lun")) && ((u2.type == "cargo")))){ return (false); }; if ((((u2.type == "lun")) && ((u1.type == "cargo")))){ return (false); }; return (true); //unresolved jump }; return (true); } } }//package Element
Section 169
//MyContactListener (Element.MyContactListener) package Element { import flash.display.*; import Box2D.Dynamics.*; import Box2D.Collision.*; public class MyContactListener extends b2ContactListener { public function MyContactListener(){ super(); } override public function Add(point:b2ContactPoint):void{ var b1:*; var b2:*; var body1:b2Body; var body2:b2Body; var tempmc:MovieClip; b1 = point.shape1.GetBody().GetUserData(); b2 = point.shape2.GetBody().GetUserData(); body1 = point.shape1.GetBody(); body2 = point.shape2.GetBody(); if (((b1) && (b2))){ if (((b1.type) && (b2.type))){ if ((((b1.type == "road")) && ((b2.type == "head")))){ if ((body2.GetLinearVelocity().x + body2.GetLinearVelocity().y) >= 20){ MyData.die = true; }; } else { if ((((b2.type == "road")) && ((b1.type == "head")))){ if ((body1.GetLinearVelocity().x + body1.GetLinearVelocity().y) >= 20){ MyData.die = true; }; }; }; if ((((b1.type == "road")) && ((b2.type == "cargo")))){ body2.GetUserData().element.live = false; } else { if ((((b2.type == "road")) && ((b1.type == "cargo")))){ body1.GetUserData().element.live = false; }; }; }; }; } } }//package Element
Section 170
//MyData (Element.MyData) package Element { import Gamestage.*; public class MyData { private var _succeed:Array; private var _carvalue:Array; public var gamedata1:mydata; public var gamedata2:mydata; public var gamedata3:mydata; public var gamedata4:mydata; public var gamedata5:mydata; public var gamedata6:mydata; public var gamedata7:mydata; public var gamedata8:mydata; public var gamedata9:mydata; private var _stageclassground:Array; private var _train:Array; private var _addvv:Array; private var _character:Array; private var _traindata:Array; public var highscore:Array; public var gamedata10:mydata; public var gamedata11:mydata; public var gamedata12:mydata; public var gamedata13:mydata; public var gamedata14:mydata; public var gamedata15:mydata; private var _gamedataground:Array; private var _cargo:Array; private var _train1:Traindata; private var _train3:Traindata; private var _train2:Traindata; private var _train4:Traindata; private var _addv:Array; private var _BGB:Array; private var _charv:Array; public static var strdata:Array = new Array("THIS IS THE FIRST STAGE, YOU CAN LEARN THE BASICS OF COAL EXPRESS HERE.", "EVERY ISLAND HAS 3 LEVELS, BUT YOU MUST COMPLETE EACH ONE TO PROGRESS TO THE NEXT.", "WITH THE MONEY YOU EARN YOU CAN UPGRADE YOUR TRAIN, YOU CAN ALSO BUY NEW TRAINS.", "AS YOU CAN SEE THERE IS A HIDDEN TRAIN IN THE SHOP, YOU MUST COMPLETE ALL LEVELS TO UNLOCK THIS TRAIN.", "GTRANSPORT 4 BOXES IN 65 SECONDS TO GET \"BRONZE\" \nTRANSPORT 6 BOXES IN 55 SECONDS TO GET \"SILVER\" \nTRANSPORT 7 BOXES IN 45 SECONDS TO GET \"GOLD\"", "TRANSPORT 3 ANIMALS IN 65 SECONDS TO GET \"BRONZE\" \nTRANSPORT 5 ANIMALS IN 55 SECONDS TO GET \"SILVER\" \nTRANSPORT 5 ANIMALS IN 45 SECONDS TO GET \"GOLD\"", "TRANSPORT 8 BALLS IN 65 SECONDS TO GET \"BRONZE\" \nTRANSPORT 10 BALLS IN 55 SECONDS TO GET \"SILVER\" \nTRANSPORT 14 BALLS IN 45 SECONDS TO GET \"GOLD\"", "TRANSPORT 6 WOODS IN 65 SECONDS TO GET \"BRONZE\" \nTRANSPORT 8 WOODS IN 55 SECONDS TO GET \"SILVER\" \nTRANSPORT 10 WOODS IN 45 SECONDS TO GET \"GOLD\"", "TRANSPORT 6 FLOWERS IN 90 SECONDS TO GET \"BRONZE\" \nTRANSPORT 8 FLOWERS IN 85 SECONDS TO GET \"SILVER\" \nTRANSPORT 10 FLOWERS IN 80 SECONDS TO GET \"GOLD\"", "TRANSPORT 5 TYRES IN 70 SECONDS TO GET \"BRONZE\" \nTRANSPORT 7 TYRES IN 65 SECONDS TO GET \"SILVER\" \nTRANSPORT 9 TYRES IN 60 SECONDS TO GET \"GOLD\"", "TRANSPORT 6 STONES IN 65 SECONDS TO GET \"BRONZE\" \nTRANSPORT 8 STONES IN 60 SECONDS TO GET \"SILVER\" \nTRANSPORT 10 STONES IN 50 SECONDS TO GET \"GOLD\"", "TRANSPORT 1 GLASS IN 90 SECONDS TO GET \"BRONZE\" \nTRANSPORT 2 GLASS IN 85 SECONDS TO GET \"SILVER\" \nTRANSPORT 3 GLASS IN 80 SECONDS TO GET \"GOLD\"", "TRANSPORT 1 GAS-TANK IN 80 SECONDS TO GET \"BRONZE\" \nTRANSPORT 2 GAS-TANK IN 75 SECONDS TO GET \"SILVER\" \nTRANSPORT 3 GAS-TANK IN 60 SECONDS TO GET \"GOLD\"", "TRANSPORT 6 COALS IN 110 SECONDS TO GET \"BRONZE\" \nTRANSPORT 8 COALS IN 90 SECONDS TO GET \"SILVER\" \nTRANSPORT 10 COALS IN 80 SECONDS TO GET \"GOLD\"", "THE SHOP CAN UPGRADE YOUR TRAIN,CLICK TO VISIT.", "CLICK HERE TO VIEW YOUR ACHIEVEMENTS,EVERY LEVEL CAN GET 3 ACHIEVEMENTS"); public static var Troad:Boolean = true; public static var die:Boolean = false; public static var _instance:MyData; public function MyData(){ var i:int; gamedata1 = new mydata(); gamedata2 = new mydata(); gamedata3 = new mydata(); gamedata4 = new mydata(); gamedata5 = new mydata(); gamedata6 = new mydata(); gamedata7 = new mydata(); gamedata8 = new mydata(); gamedata9 = new mydata(); gamedata10 = new mydata(); gamedata11 = new mydata(); gamedata12 = new mydata(); gamedata13 = new mydata(); gamedata14 = new mydata(); gamedata15 = new mydata(); _gamedataground = new Array(gamedata1, gamedata2, gamedata3, gamedata4, gamedata5, gamedata6, gamedata7, gamedata8, gamedata9, gamedata10, gamedata11, gamedata12, gamedata13, gamedata14, gamedata15); _stageclassground = new Array(GameStage1, GameStage2, GameStage3, GameStage4, GameStage5, GameStage6, GameStage7, GameStage8, GameStage9, GameStage10, GameStage11, GameStage12, GameStage13, GameStage14, GameStage15); highscore = new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); _traindata = new Array(1, 0, 0, 0); _carvalue = new Array(0, 10000, 15000, 25000); _addvv = new Array(1000, 2000, 5000, 10000, 20000); _cargo = new Array(100, 80, 80, 160, 200, 160, 260, 260, 700, 300, 500, 900, 600, 1700, 2000); _succeed = new Array(); _character = new Array(); _addv = new Array(0, 0, 0, 0, 0); _charv = new Array(100, 200, 300, 400, 500, 600, 700, 800, 900); _BGB = new Array("BG1", "BG2", "", "BG4", "BG5"); _train1 = new Traindata(); _train2 = new Traindata(); _train3 = new Traindata(); _train4 = new Traindata(); _train = new Array(_train1, _train2, _train3, _train4); super(); gamedata1.gameroad = new Array("as", "r12", "r13", "r14", "r15", "ae"); gamedata1.mission = 1; gamedata1.gametime = 60; gamedata1.JYTcargo = new Array(6, 6, 7); gamedata1.JYTtime = new Array(120, 55, 45); gamedata2.gameroad = new Array("as", "r22", "r23", "r24", "r25", "ae"); gamedata2.mission = 2; gamedata2.gametime = 60; gamedata2.JYTcargo = new Array(10, 4, 5); gamedata2.JYTtime = new Array(130, 55, 45); gamedata3.gameroad = new Array("as", "r32", "r33", "r34", "r35", "be"); gamedata3.mission = 3; gamedata3.gametime = 70; gamedata3.JYTcargo = new Array(14, 10, 14); gamedata3.JYTtime = new Array(150, 55, 45); gamedata4.gameroad = new Array("bs", "r42", "r43", "r44", "r45", "r46", "be"); gamedata4.mission = 4; gamedata4.gametime = 80; gamedata4.JYTcargo = new Array(8, 8, 10); gamedata4.JYTtime = new Array(160, 55, 45); gamedata5.gameroad = new Array("bs", "r52", "r53", "r54", "r55", "r56", "be"); gamedata5.mission = 5; gamedata5.gametime = 90; gamedata5.JYTcargo = new Array(8, 8, 10); gamedata5.JYTtime = new Array(180, 85, 80); gamedata6.gameroad = new Array("bs", "r62", "r63", "r64", "r65", "r66", "ce"); gamedata6.mission = 6; gamedata6.gametime = 100; gamedata6.JYTcargo = new Array(14, 7, 9); gamedata6.JYTtime = new Array(160, 65, 60); gamedata7.gameroad = new Array("cs", "r72", "r73", "r74", "r75", "r76", "ce"); gamedata7.mission = 7; gamedata7.gametime = 120; gamedata7.JYTcargo = new Array(9, 8, 10); gamedata7.JYTtime = new Array(160, 60, 50); gamedata8.gameroad = new Array("cs", "r82", "r83", "r84", "r85", "r86", "ce"); gamedata8.mission = 8; gamedata8.gametime = 120; gamedata8.JYTcargo = new Array(10, 2, 3); gamedata8.JYTtime = new Array(180, 85, 80); gamedata9.gameroad = new Array("cs", "r92", "r93", "r94", "r95", "r96", "de"); gamedata9.mission = 9; gamedata9.gametime = 120; gamedata9.JYTcargo = new Array(3, 2, 2); gamedata9.JYTtime = new Array(180, 75, 60); gamedata10.gameroad = new Array("ds", "r104", "r105", "r106", "r107", "r108", "de"); gamedata10.mission = 10; gamedata10.gametime = 120; gamedata10.JYTcargo = new Array(8, 8, 10); gamedata10.JYTtime = new Array(140, 90, 80); gamedata11.gameroad = new Array("ds", "r113", "r114", "r115", "r116", "r117", "de"); gamedata11.mission = 11; gamedata11.JYTcargo = new Array(4, 4, 5); gamedata11.JYTtime = new Array(180, 90, 80); gamedata12.gameroad = new Array("ds", "r124", "r125", "r127", "r128", "r129", "ee"); gamedata12.mission = 12; gamedata12.JYTcargo = new Array(3, 4, 5); gamedata12.JYTtime = new Array(170, 90, 80); gamedata13.gameroad = new Array("es", "r132", "r133", "r134", "r135", "r136", "r1310", "ee"); gamedata13.mission = 13; gamedata13.JYTcargo = new Array(7, 4, 5); gamedata13.JYTtime = new Array(270, 90, 80); gamedata14.gameroad = new Array("es", "r142", "r143", "r145", "r147", "r149", "r1410", "ee"); gamedata14.mission = 14; gamedata14.JYTcargo = new Array(2, 4, 5); gamedata14.JYTtime = new Array(130, 90, 80); gamedata15.gameroad = new Array("es", "r153", "r156", "r157", "r158", "r159", "r1510", "ee"); gamedata15.mission = 15; gamedata15.JYTcargo = new Array(2, 4, 5); gamedata15.JYTtime = new Array(110, 90, 80); i = 0; while (i < 40) { succeed.push(false); i++; }; train1.addspeed = 1; train1.spin = 25; train1.brake = 35; train1.power = 40; train1.lunspeed = 8; train2.addspeed = 1; train2.spin = 30; train2.brake = 40; train2.power = 45; train2.lunspeed = 9; train3.addspeed = 1; train3.spin = 40; train3.brake = 50; train3.power = 55; train3.lunspeed = 10; train4.addspeed = 3; train4.spin = 50; train4.brake = 60; train4.power = 65; train4.lunspeed = 12; } public function get train():Array{ return (_train); } public function set succeed(value:Array):void{ _succeed = value; } public function set train(value:Array):void{ _train = value; } public function get gamedataground():Array{ return (_gamedataground); } public function get carvalue():Array{ return (_carvalue); } public function get character():Array{ return (_character); } public function get train3():Traindata{ return (_train3); } public function get BGB():Array{ return (_BGB); } public function get traindata():Array{ return (_traindata); } public function get stageclassground():Array{ return (_stageclassground); } public function get train2():Traindata{ return (_train2); } public function get addvv():Array{ return (_addvv); } public function set charv(value:Array):void{ _charv = value; } public function get succeed():Array{ return (_succeed); } public function get train1():Traindata{ return (_train1); } public function set character(value:Array):void{ _character = value; } public function set addvv(value:Array):void{ _addvv = value; } public function set carvalue(value:Array):void{ _carvalue = value; } public function set train3(value:Traindata):void{ _train3 = value; } public function set train4(value:Traindata):void{ _train4 = value; } public function set train2(value:Traindata):void{ _train2 = value; } public function set traindata(value:Array):void{ _traindata = value; } public function get train4():Traindata{ return (_train4); } public function get charv():Array{ return (_charv); } public function get cargo():Array{ return (_cargo); } public function set addv(value:Array):void{ _addv = value; } public function set BGB(value:Array):void{ _BGB = value; } public function set train1(value:Traindata):void{ _train1 = value; } public function get addv():Array{ return (_addv); } public static function getInstance():MyData{ if (_instance == null){ _instance = new (MyData); }; return (_instance); } public static function clear(){ _instance = null; } } }//package Element class bikedata { private var _motortorque:Number; public var addlunspeed:Number; private var _bikeD:Number; private var _bikeF:Number; private var _bikeR:Number; private var _LD:Number; private var _LF:Number; private var _LR:Number; public var addbraketorque:Number; private var _braketorque:Number; public var addupspeed:Number; private var _upspeed:Number; public var addluntorque:Number; private var _motorlunspeed:Number; public var addtorque:Number; private var _motorlunmaxtorque:Number; private function bikedata(){ super(); } public function get bikeF():Number{ return (_bikeF); } public function set bikeF(value:Number):void{ _bikeF = value; } public function get bikeR():Number{ return (_bikeR); } public function get upspeed():Number{ return (_upspeed); } public function set bikeD(value:Number):void{ _bikeD = value; } public function set upspeed(value:Number):void{ _upspeed = value; } public function get bikeD():Number{ return (_bikeD); } public function get LR():Number{ return (_LR); } public function set motortorque(value:Number):void{ _motortorque = value; } public function set bikeR(value:Number):void{ _bikeR = value; } public function set motorlunspeed(value:Number):void{ _motorlunspeed = value; } public function set LR(value:Number):void{ _LR = value; } public function get motortorque():Number{ return (_motortorque); } public function get motorlunspeed():Number{ return (_motorlunspeed); } public function set braketorque(value:Number):void{ _braketorque = value; } public function set LD(value:Number):void{ _LD = value; } public function set LF(value:Number):void{ _LF = value; } public function get braketorque():Number{ return (_braketorque); } public function get LD():Number{ return (_LD); } public function get LF():Number{ return (_LF); } public function set motorlunmaxtorque(value:Number):void{ _motorlunmaxtorque = value; } public function get motorlunmaxtorque():Number{ return (_motorlunmaxtorque); } } class mydata { private var _frontroad:Array; private var _mission:int; private var _JYTcargo:Array; private var _gametime:int; private var _gameroad:Array; private var _JYTtime:Array; private function mydata(){ super(); } public function get frontroad():Array{ return (_frontroad); } public function get mission():int{ return (_mission); } public function get gameroad():Array{ return (_gameroad); } public function set mission(value:int):void{ _mission = value; } public function set frontroad(value:Array):void{ _frontroad = value; } public function set gameroad(value:Array):void{ _gameroad = value; } public function set JYTtime(value:Array):void{ _JYTtime = value; } public function set JYTcargo(value:Array):void{ _JYTcargo = value; } public function get JYTtime():Array{ return (_JYTtime); } public function get JYTcargo():Array{ return (_JYTcargo); } public function set gametime(value:int):void{ _gametime = value; } public function get gametime():int{ return (_gametime); } }
Section 171
//Traindata (Element.Traindata) package Element { public class Traindata { private var _power:int; private var _lunspeed:int; private var _count:int;// = 0 private var _MaxA:int; private var _MaxB:int; private var _spin:int; private var _addspeed:int; private var _brake:int; private var _MaxS:int; private var _isBuy:Boolean;// = false public function Traindata(){ _isBuy = false; _count = 0; super(); } public function set spin(value:int):void{ _spin = value; } public function get power():int{ return (_power); } public function set lunspeed(value:int):void{ _lunspeed = value; } public function get addspeed():int{ return (_addspeed); } public function get spin():int{ return (_spin); } public function set addspeed(value:int):void{ _addspeed = value; } public function set brake(value:int):void{ _brake = value; } public function set power(value:int):void{ _power = value; } public function get lunspeed():int{ return (_lunspeed); } public function get brake():int{ return (_brake); } } }//package Element
Section 172
//GameStage1 (Gamestage.GameStage1) package Gamestage { import BaseClass.*; public class GameStage1 extends BaseStage { public function GameStage1(mainobj:Object){ super(mainobj); } } }//package Gamestage
Section 173
//GameStage10 (Gamestage.GameStage10) package Gamestage { import BaseClass.*; public class GameStage10 extends BaseStage { public function GameStage10(mainobj:Object){ super(mainobj); } } }//package Gamestage
Section 174
//GameStage11 (Gamestage.GameStage11) package Gamestage { import BaseClass.*; public class GameStage11 extends BaseStage { public function GameStage11(mainobj:Object){ super(mainobj); } } }//package Gamestage
Section 175
//GameStage12 (Gamestage.GameStage12) package Gamestage { import Element.*; import flash.display.*; import caurina.transitions.*; import Box2D.Dynamics.*; import BaseClass.*; public class GameStage12 extends BaseStage { public function GameStage12(mainobj:Object){ super(mainobj); } override public function workcrisp():void{ var len:int; var vy:Number; var i:int; if (MyData.die){ return; }; len = trainMc.cargocontainer.length; vy = 0; i = 0; while (i < len) { vy = ((trainMc.cargocontainer[i] as MovieClip).bd as b2Body).GetLinearVelocity().y; if ((((vy > 5)) && (trainMc.cargocontainer[i].hp))){ trainMc.cargocontainer[i].gotoAndStop(2); } else { if (vy < 3){ if ((((trainMc.cargocontainer[i].currentFrame == 2)) && (trainMc.cargocontainer[i].hp))){ trainMc.cargocontainer[i].gotoAndStop(1); trainMc.cargocontainer[i].crisp = 0; }; }; }; if ((((trainMc.cargocontainer[i].currentFrame == 2)) && (trainMc.cargocontainer[i].hp))){ trainMc.cargocontainer[i].crisp++; }; if ((((trainMc.cargocontainer[i].crisp >= 60)) && (trainMc.cargocontainer[i].hp))){ trainMc.cargocontainer[i].crisp = 0; trainMc.cargocontainer[i].gotoAndStop(3); trainMc.cargocontainer[i].hp = false; Tweener.addTween(trainMc.cargocontainer[i], {alpha:0, time:2, transition:"linear"}); }; if ((((trainMc.cargocontainer[i].alpha <= 0)) && (trainMc.cargocontainer[i].live))){ trainMc.cargocontainer[i].live = false; }; i++; }; } } }//package Gamestage
Section 176
//GameStage13 (Gamestage.GameStage13) package Gamestage { import BaseClass.*; public class GameStage13 extends BaseStage { public function GameStage13(mainobj:Object){ super(mainobj); } } }//package Gamestage
Section 177
//GameStage14 (Gamestage.GameStage14) package Gamestage { import Element.*; import flash.display.*; import caurina.transitions.*; import Box2D.Dynamics.*; import BaseClass.*; public class GameStage14 extends BaseStage { public function GameStage14(mainobj:Object){ super(mainobj); } override public function workcrisp():void{ var len:int; var vy:Number; var i:int; if (MyData.die){ return; }; len = trainMc.cargocontainer.length; vy = 0; i = 0; while (i < len) { vy = ((trainMc.cargocontainer[i] as MovieClip).bd as b2Body).GetLinearVelocity().y; if ((((vy > 5)) && (trainMc.cargocontainer[i].hp))){ trainMc.cargocontainer[i].gotoAndStop(2); } else { if (vy < 3){ if ((((trainMc.cargocontainer[i].currentFrame == 2)) && (trainMc.cargocontainer[i].hp))){ trainMc.cargocontainer[i].gotoAndStop(1); trainMc.cargocontainer[i].crisp = 0; }; }; }; if ((((trainMc.cargocontainer[i].currentFrame == 2)) && (trainMc.cargocontainer[i].hp))){ trainMc.cargocontainer[i].crisp++; }; if ((((trainMc.cargocontainer[i].crisp >= 120)) && (trainMc.cargocontainer[i].hp))){ trainMc.cargocontainer[i].crisp = 0; trainMc.cargocontainer[i].gotoAndStop(3); trainMc.cargocontainer[i].hp = false; Tweener.addTween(trainMc.cargocontainer[i], {alpha:0, time:2, transition:"linear"}); }; if ((((trainMc.cargocontainer[i].alpha <= 0)) && (trainMc.cargocontainer[i].live))){ trainMc.cargocontainer[i].live = false; }; i++; }; } } }//package Gamestage
Section 178
//GameStage15 (Gamestage.GameStage15) package Gamestage { import Element.*; import flash.display.*; import caurina.transitions.*; import Box2D.Dynamics.*; import BaseClass.*; public class GameStage15 extends BaseStage { public function GameStage15(mainobj:Object){ super(mainobj); } override public function workcrisp():void{ var len:int; var vy:Number; var i:int; if (MyData.die){ return; }; len = trainMc.cargocontainer.length; vy = 0; i = 0; while (i < len) { vy = ((trainMc.cargocontainer[i] as MovieClip).bd as b2Body).GetLinearVelocity().y; if ((((vy > 5)) && (trainMc.cargocontainer[i].hp))){ trainMc.cargocontainer[i].gotoAndStop(2); } else { if (vy < 3){ if ((((trainMc.cargocontainer[i].currentFrame == 2)) && (trainMc.cargocontainer[i].hp))){ trainMc.cargocontainer[i].gotoAndStop(1); trainMc.cargocontainer[i].crisp = 0; }; }; }; if ((((trainMc.cargocontainer[i].currentFrame == 2)) && (trainMc.cargocontainer[i].hp))){ trainMc.cargocontainer[i].crisp++; }; if ((((trainMc.cargocontainer[i].crisp >= 120)) && (trainMc.cargocontainer[i].hp))){ trainMc.cargocontainer[i].crisp = 0; trainMc.cargocontainer[i].gotoAndStop(3); trainMc.cargocontainer[i].hp = false; Tweener.addTween(trainMc.cargocontainer[i], {alpha:0, time:2, transition:"linear"}); }; if ((((trainMc.cargocontainer[i].alpha <= 0)) && (trainMc.cargocontainer[i].live))){ trainMc.cargocontainer[i].live = false; }; i++; }; } } }//package Gamestage
Section 179
//GameStage2 (Gamestage.GameStage2) package Gamestage { import BaseClass.*; public class GameStage2 extends BaseStage { public function GameStage2(mainobj:Object){ super(mainobj); } } }//package Gamestage
Section 180
//GameStage3 (Gamestage.GameStage3) package Gamestage { import BaseClass.*; public class GameStage3 extends BaseStage { public function GameStage3(mainobj:Object){ super(mainobj); } } }//package Gamestage
Section 181
//GameStage4 (Gamestage.GameStage4) package Gamestage { import BaseClass.*; public class GameStage4 extends BaseStage { public function GameStage4(mainobj:Object){ super(mainobj); } } }//package Gamestage
Section 182
//GameStage5 (Gamestage.GameStage5) package Gamestage { import BaseClass.*; public class GameStage5 extends BaseStage { public function GameStage5(mainobj:Object){ super(mainobj); } } }//package Gamestage
Section 183
//GameStage6 (Gamestage.GameStage6) package Gamestage { import BaseClass.*; public class GameStage6 extends BaseStage { public function GameStage6(mainobj:Object){ super(mainobj); } } }//package Gamestage
Section 184
//GameStage7 (Gamestage.GameStage7) package Gamestage { import BaseClass.*; public class GameStage7 extends BaseStage { public function GameStage7(mainobj:Object){ super(mainobj); } } }//package Gamestage
Section 185
//GameStage8 (Gamestage.GameStage8) package Gamestage { import BaseClass.*; public class GameStage8 extends BaseStage { public function GameStage8(mainobj:Object){ super(mainobj); } } }//package Gamestage
Section 186
//GameStage9 (Gamestage.GameStage9) package Gamestage { import Element.*; import flash.display.*; import caurina.transitions.*; import Box2D.Dynamics.*; import BaseClass.*; public class GameStage9 extends BaseStage { public function GameStage9(mainobj:Object){ super(mainobj); } override public function workcrisp():void{ var len:int; var vy:Number; var i:int; if (MyData.die){ return; }; len = trainMc.cargocontainer.length; vy = 0; i = 0; while (i < len) { vy = ((trainMc.cargocontainer[i] as MovieClip).bd as b2Body).GetLinearVelocity().y; if ((((vy > 5)) && (trainMc.cargocontainer[i].hp))){ trainMc.cargocontainer[i].gotoAndStop(2); } else { if (vy < 3){ if ((((trainMc.cargocontainer[i].currentFrame == 2)) && (trainMc.cargocontainer[i].hp))){ trainMc.cargocontainer[i].gotoAndStop(1); trainMc.cargocontainer[i].crisp = 0; }; }; }; if ((((trainMc.cargocontainer[i].currentFrame == 2)) && (trainMc.cargocontainer[i].hp))){ trainMc.cargocontainer[i].crisp++; }; if ((((trainMc.cargocontainer[i].crisp >= 72)) && (trainMc.cargocontainer[i].hp))){ trainMc.cargocontainer[i].crisp = 0; trainMc.cargocontainer[i].gotoAndStop(3); trainMc.cargocontainer[i].hp = false; Tweener.addTween(trainMc.cargocontainer[i], {alpha:0, time:2, transition:"linear"}); }; if ((((trainMc.cargocontainer[i].alpha <= 0)) && (trainMc.cargocontainer[i].live))){ trainMc.cargocontainer[i].live = false; }; i++; }; } } }//package Gamestage
Section 187
//BaseSound (UserdefinedClass.BaseSound) package UserdefinedClass { import flash.media.*; import flash.utils.*; public class BaseSound { public var sdTransform:SoundTransform; public var sd:Sound; public var sdChannel:SoundChannel; public function BaseSound(soundclassname:String){ var soundclass:Object; super(); soundclass = getDefinitionByName(soundclassname); sd = (new (soundclass) as Sound); sdChannel = new SoundChannel(); } public function stopSound(){ if (sdChannel){ sdChannel.stop(); }; } public function playsound(loop:int, volume:Number=1){ sdTransform = new SoundTransform(); sdTransform.volume = volume; sdChannel = sd.play(0, loop, sdTransform); } public function setvolume(volume:Number){ sdTransform = new SoundTransform(); sdTransform.volume = volume; sdChannel.soundTransform = sdTransform; } } }//package UserdefinedClass
Section 188
//BaseUI (UserdefinedClass.BaseUI) package UserdefinedClass { import flash.display.*; public class BaseUI { public static var uisp:Sprite = new Sprite(); public function BaseUI(){ super(); } public static function setcargo(obj:MovieClip, num:int, str:String){ var temp:Array; temp = MyMath.worknum(num); (obj[(str + 0)] as MovieClip).gotoAndStop((temp[0] + 1)); (obj[(str + 1)] as MovieClip).gotoAndStop((temp[1] + 1)); } public static function setWinHighScore(obj:MovieClip, Scorenum:int){ var Temp:Array; var tempnum:Array; var len:int; var i:int; Temp = new Array(obj.h0, obj.h1, obj.h2, obj.h3, obj.h4); tempnum = MyMath.NumtoArray(Scorenum); len = tempnum.length; i = 0; while (i < 5) { if (i < len){ Temp[i].alpha = 1; Temp[i].gotoAndStop((tempnum[i] + 1)); } else { Temp[i].alpha = 0; }; i++; }; } public static function setfloattime(Mc:MovieClip, S:Number){ var tempint:Array; var tempdec:Array; tempint = MyMath.worknum(int(S)); tempdec = MyMath.worknum(int(((S - int(S)) * 100))); Mc.t2.gotoAndStop((tempint[0] + 1)); Mc.t3.gotoAndStop((tempint[1] + 1)); Mc.t0.gotoAndStop((tempdec[0] + 1)); Mc.t1.gotoAndStop((tempdec[1] + 1)); if (tempint[1] == 0){ Mc.t3.alpha = 0; } else { Mc.t3.alpha = 1; }; if (tempdec[0] == 0){ Mc.t0.alpha = 0; } else { Mc.t0.alpha = 1; }; } public static function setlv(obj:MovieClip, num:int){ var temp:Array; temp = MyMath.worknum(num); (obj.lv0 as MovieClip).gotoAndStop((temp[0] + 1)); (obj.lv1 as MovieClip).gotoAndStop((temp[1] + 1)); } public static function setP(Mc:MovieClip, val:int, max:int, str:String){ var tempP:Array; var i:int; tempP = new Array(Mc[str]["p1"], Mc[str]["p2"], Mc[str]["p3"], Mc[str]["p4"], Mc[str]["p5"], Mc[str]["p6"], Mc[str]["p7"], Mc[str]["p8"], Mc[str]["p9"], Mc[str]["p10"]); i = 0; while (i < 10) { tempP[i].gotoAndStop(3); if (i < max){ tempP[i].gotoAndStop(2); }; if (i < val){ tempP[i].gotoAndStop(1); }; i++; }; } public static function settime(Mc:MovieClip, num:int){ var timearr:Array; var timemcname:Array; var i:int; timearr = MyMath.TimeFormat(num); timemcname = new Array(Mc.t0, Mc.t1, Mc.t2, Mc.t3); i = 0; while (i < 4) { (timemcname[i] as MovieClip).gotoAndStop((timearr[i] + 1)); i++; }; } public static function setMaxscore(Mc:MovieClip, val:int, str:String, Maxval:int){ var tempP:Array; var i:int; var tempnum:Array; var len:int; tempP = new Array(); i = 0; while (i < Maxval) { tempP.push(Mc[(str + i)]); i++; }; tempnum = MyMath.NumtoArray(val); len = tempnum.length; if (val == 0){ i = 0; while (i < Maxval) { tempP[i].alpha = 0; i++; }; tempP[0].alpha = 1; return; }; i = 0; while (i < Maxval) { if (i < len){ tempP[i].alpha = 1; tempP[i].gotoAndStop((tempnum[i] + 1)); } else { tempP[i].alpha = 0; }; i++; }; } public static function setcombo(obj:MovieClip, num:int){ var temp:Array; temp = MyMath.worknum(num); (obj.c0 as MovieClip).alpha = 1; if (num > 9){ (obj.c1 as MovieClip).alpha = 1; } else { (obj.c1 as MovieClip).alpha = 0; }; (obj.c0 as MovieClip).gotoAndStop((temp[0] + 1)); (obj.c1 as MovieClip).gotoAndStop((temp[1] + 1)); } public static function showscore(scnum:int, objname, Container:DisplayObjectContainer, x:Number, y:Number, size:Number=1, flushleft:Boolean=true){ var tempnum:Array; var len:int; var i:int; var sc:MovieClip; Clr.removeAllChildren(uisp); tempnum = MyMath.NumtoArray(scnum, flushleft); len = tempnum.length; i = 0; while (i < len) { sc = (new (objname) as MovieClip); sc.scaleX = (sc.scaleY = size); sc.x = (sc.width * i); if (!flushleft){ sc.x = (-(sc.width) * i); }; sc.gotoAndStop((tempnum[i] + 1)); uisp.addChild(sc); i++; }; uisp.x = x; uisp.y = y; Container.addChild(uisp); } public static function setValue(obj:MovieClip, objname:String, frame:int){ obj[objname].gotoAndStop(frame); } public static function setScore(obj:MovieClip, Scorenum:int, str:String){ var Temp:Array; var tempnum:Array; var len:int; var i:int; Temp = new Array(obj[(str + "0")], obj[(str + "1")], obj[(str + "2")], obj[(str + "3")], obj[(str + "4")], obj[(str + "5")]); tempnum = MyMath.NumtoArray(Scorenum); len = tempnum.length; i = 0; while (i < 6) { if (i < len){ Temp[i].alpha = 1; Temp[i].gotoAndStop((tempnum[i] + 1)); } else { Temp[i].alpha = 0; }; i++; }; } public static function setWinScore(obj:MovieClip, Scorenum:int){ var Temp:Array; var tempnum:Array; var len:int; var i:int; Temp = new Array(obj.s0, obj.s1, obj.s2, obj.s3, obj.s4); tempnum = MyMath.NumtoArray(Scorenum); len = tempnum.length; i = 0; while (i < 5) { if (i < len){ Temp[i].alpha = 1; Temp[i].gotoAndStop((tempnum[i] + 1)); } else { Temp[i].alpha = 0; }; i++; }; } public static function setmax(Mc:MovieClip, val:int, max:int, str:String){ if ((max == val)){ Mc[str].gotoAndStop(2); } else { Mc[str].gotoAndStop(1); }; } public static function setalpha(alpha:Number, Mc:MovieClip, str:String, Max:int){ var tempP:Array; var i:int; tempP = new Array(); i = 0; while (i < Max) { tempP.push(Mc[(str + i)]); i++; }; i = 0; while (i < Max) { tempP[i].alpha = alpha; i++; }; } public static function setnumval(Mc:MovieClip, val:int, str:String){ var tempmc:Array; var i:int; tempmc = new Array(); i = 1; while (i < 11) { tempmc.push(Mc[(str + i)]); i++; }; i = 0; while (i < 10) { if (i < val){ tempmc[i].gotoAndStop(1); } else { tempmc[i].gotoAndStop(2); }; i++; }; } public static function setmoney(Mc:MovieClip, val:int, str:String, Maxval:int){ var tempP:Array; var i:int; var tempnum:Array; var len:int; tempP = new Array(); i = 0; while (i < Maxval) { tempP.push(Mc[(str + i)]); i++; }; tempnum = MyMath.NumtoArray(val, false); len = tempnum.length; if (val == 0){ i = 0; while (i < Maxval) { tempP[i].alpha = 0; i++; }; tempP[0].alpha = 1; tempP[0].gotoAndStop(1); return; }; i = 0; while (i < Maxval) { if (i < len){ tempP[i].alpha = 1; tempP[i].gotoAndStop((tempnum[i] + 1)); } else { tempP[i].alpha = 0; }; i++; }; } } }//package UserdefinedClass
Section 189
//Box2dFactory (UserdefinedClass.Box2dFactory) package UserdefinedClass { import flash.display.*; import flash.events.*; import Box2D.Dynamics.*; import Box2D.Common.Math.*; import Box2D.Collision.*; import Box2D.Collision.Shapes.*; import Box2D.Dynamics.Joints.*; public class Box2dFactory { public var mousecount:int;// = 0 public var mX:Number; public var mY:Number; private var _world:b2World; public var _density:Number;// = 5 public var _restitution:Number;// = 0 public var mousesp:Sprite; private var _useMouseJoint:Boolean;// = false public var _friction:Number;// = 5 private var mouse_MaxForce:int;// = 1500 private var mouseJoint:b2MouseJoint; public var tempmc:MovieClip; public var fourangle:Number; private var _stage:Stage; public static const PHYSCALE:Number = 30; public static const STEP:Number = 0.0333333333333333; public static const ITERATION:int = 10; private static var _instance:Box2dFactory; public function Box2dFactory(){ mouse_MaxForce = 1500; _useMouseJoint = false; mousecount = 0; _density = 5; _restitution = 0; _friction = 5; super(); } public function createMouse(evt:MouseEvent):void{ var body:b2Body; var mouseJointDef:b2MouseJointDef; body = (tempmc.bd as b2Body); if (body){ mouseJointDef = new b2MouseJointDef(); mouseJointDef.body1 = world.GetGroundBody(); mouseJointDef.body2 = body; mouseJointDef.target.Set((_stage.mouseX / 30), (_stage.mouseY / 30)); mouseJointDef.maxForce = mouse_MaxForce; mouseJointDef.timeStep = STEP; mouseJoint = (world.CreateJoint(mouseJointDef) as b2MouseJoint); }; } public function get world():b2World{ return (_world); } public function getBody():b2Body{ var b:b2Body; var temp:b2Body; b = world.GetBodyList(); while (b) { if (b.m_userData){ if (b.m_userData.element){ if (b.m_userData.element.name == tempmc.name){ temp = b; break; }; }; }; b = b.GetNext(); }; return (temp); } public function GetBodyAtMouse(includeStatic:Boolean=false):b2Body{ var mouseXWorldPhys:Number; var mouseYWorldPhys:Number; var vec:b2Vec2; var aabb:b2AABB; var k_maxCount:int; var shapes:Array; var count:int; var body:b2Body; var i:int; var tShape:b2Shape; var inside:Boolean; mouseXWorldPhys = (_stage.mouseX / PHYSCALE); mouseYWorldPhys = (_stage.mouseY / PHYSCALE); vec = new b2Vec2(mouseXWorldPhys, mouseYWorldPhys); aabb = new b2AABB(); aabb.lowerBound.Set((mouseXWorldPhys - 0.001), (mouseYWorldPhys - 0.001)); aabb.upperBound.Set((mouseXWorldPhys + 0.001), (mouseYWorldPhys + 0.001)); k_maxCount = 10; shapes = new Array(); count = world.Query(aabb, shapes, k_maxCount); body = null; i = 0; while (i < count) { if ((((shapes[i].GetBody().IsStatic() == false)) || (includeStatic))){ tShape = (shapes[i] as b2Shape); inside = tShape.TestPoint(tShape.GetBody().GetXForm(), vec); if (inside){ body = tShape.GetBody(); break; }; }; i++; }; return (body); } public function createRevoluteJoint(body1:b2Body, body2:b2Body, anchor:b2Vec2, enableLimit:Boolean=false, lowerAngle:Number=0, upperAngle:Number=0, enableMotor:Boolean=false, motorSpeed:Number=0, maxMotorTorque:Number=0):b2Joint{ var revoluteJointDef:b2RevoluteJointDef; revoluteJointDef = new b2RevoluteJointDef(); revoluteJointDef.Initialize(body1, body2, anchor); revoluteJointDef.enableLimit = enableLimit; revoluteJointDef.lowerAngle = lowerAngle; revoluteJointDef.upperAngle = upperAngle; revoluteJointDef.enableMotor = enableMotor; revoluteJointDef.motorSpeed = motorSpeed; revoluteJointDef.maxMotorTorque = maxMotorTorque; return (world.CreateJoint(revoluteJointDef)); } public function makeBodyByYuanInside(x, y, targetSprite, density=1, friction=1, restitution=1, bullet:Boolean=false, type:String="none", allowSleep:Boolean=true):b2Body{ var _b2BodyDef:b2BodyDef; var _b2Body:b2Body; var _loc_10:*; var _b2CircleDef:b2CircleDef; var tem:Number; var i:int; _loc_10 = undefined; _b2BodyDef = new b2BodyDef(); _b2BodyDef.position.Set(x, y); _b2BodyDef.userData = new Object(); _b2BodyDef.userData.element = targetSprite; _b2BodyDef.userData.type = type; _b2BodyDef.allowSleep = allowSleep; _b2BodyDef.isBullet = bullet; _b2Body = world.CreateBody(_b2BodyDef); targetSprite.bd = _b2Body; i = 0; while (i < targetSprite.numChildren) { _loc_10 = targetSprite.getChildAt(i); if (_loc_10.constructor == yuan){ _b2CircleDef = new b2CircleDef(); tem = _loc_10.rotation; _loc_10.rotation = 0; _b2CircleDef.radius = (_loc_10.width / 60); _loc_10.rotation = tem; _b2CircleDef.friction = friction; _b2CircleDef.density = density; _b2CircleDef.restitution = restitution; _b2Body.CreateShape(_b2CircleDef); }; i++; }; i = 0; while (i < targetSprite.numChildren) { _loc_10 = targetSprite.getChildAt(i); if (_loc_10.constructor == yuan){ targetSprite.removeChildAt(i); } else { i++; }; }; if (density != 0){ _b2Body.SetMassFromShapes(); }; return (_b2Body); } public function createGearJoint(b1:b2Body, b2:b2Body, j1:b2Joint, j2:b2Joint, rate:Number=1):b2Joint{ var gearJointDef:b2GearJointDef; gearJointDef = new b2GearJointDef(); gearJointDef.body1 = b1; gearJointDef.body2 = b2; gearJointDef.joint1 = j1; gearJointDef.joint2 = j2; gearJointDef.ratio = rate; return (world.CreateJoint(gearJointDef)); } public function createPulleyJoint(b1:b2Body, b2:b2Body, groundAnchor1:b2Vec2, groundAnchor2:b2Vec2, anchor1:b2Vec2, anchor2:b2Vec2, rate:Number=1, maxLength1:Number=100, maxLength2:Number=100):b2Joint{ var pulleyJointDef:b2PulleyJointDef; pulleyJointDef = new b2PulleyJointDef(); pulleyJointDef.Initialize(b1, b2, groundAnchor1, groundAnchor2, anchor1, anchor2, rate); pulleyJointDef.maxLength1 = maxLength1; pulleyJointDef.maxLength2 = maxLength2; return (world.CreateJoint(pulleyJointDef)); } public function mouseControlBody(sta:Stage, mcbd:MovieClip, sp:Sprite):void{ if (((!(sta)) || ((mcbd == null)))){ return; }; _stage = sta; mousesp = sp; tempmc = mcbd; tempmc.isMouse = true; _useMouseJoint = true; _stage.addEventListener(MouseEvent.MOUSE_DOWN, createMouse); _stage.addEventListener(MouseEvent.MOUSE_UP, destroyMouse); mX = _stage.mouseX; mY = _stage.mouseY; } public function createBody(x:Number, y:Number, n:int, radius:Number, angle:Number, userdata, type:String="item", four:Boolean=true):b2Body{ var shapeDef:b2PolygonDef; var bodydef:b2BodyDef; var body:b2Body; if (four){ fourangle = 0; } else { fourangle = (Math.PI * 0.25); }; shapeDef = new b2PolygonDef(); setConvexVertex(shapeDef, n, radius); bodydef = new b2BodyDef(); bodydef.angle = angle; bodydef.position.Set((x / PHYSCALE), (y / PHYSCALE)); bodydef.userData = new Object(); bodydef.userData.type = type; bodydef.userData.element = userdata; bodydef.isBullet = false; body = world.CreateBody(bodydef); userdata.bd = body; body.CreateShape(shapeDef); body.SetMassFromShapes(); return (body); } public function prismatiocJoint(param1, param2):b2Joint{ var prismaticJointDef:b2PrismaticJointDef; prismaticJointDef = undefined; prismaticJointDef = new b2PrismaticJointDef(); prismaticJointDef.Initialize(param1.bd, param2.bd, param2.bd.GetWorldCenter(), new b2Vec2(0, 1)); prismaticJointDef.lowerTranslation = -0.3; prismaticJointDef.upperTranslation = 0.3; prismaticJointDef.maxMotorForce = 700; prismaticJointDef.motorSpeed = 1; prismaticJointDef.enableLimit = true; prismaticJointDef.enableMotor = true; return (world.CreateJoint(prismaticJointDef)); } public function updata():void{ world.Step(STEP, ITERATION); setuserdata(); setMouseJointTarget(); } public function destroyMouse(evt:MouseEvent=null):void{ if (mouseJoint){ world.DestroyJoint(mouseJoint); mouseJoint = null; _stage.removeEventListener(MouseEvent.MOUSE_DOWN, createMouse); _stage.removeEventListener(MouseEvent.MOUSE_UP, destroyMouse); _useMouseJoint = false; }; } private function setuserdata(){ var b:b2Body; b = _world.m_bodyList; while (b) { if (b.m_userData){ if ((b.m_userData is Object)){ if (b.m_userData.element){ if ((b.m_userData.element is DisplayObject)){ b.m_userData.element.x = (b.GetPosition().x * 30); b.m_userData.element.y = (b.GetPosition().y * 30); b.m_userData.element.rotation = (((b.GetAngle() * 180) / Math.PI) % 360); }; }; }; }; b = b.m_next; }; } private function setMouseJointTarget():void{ var mouseXWorldPhys:Number; var mouseYWorldPhys:Number; var p2:b2Vec2; if (mouseJoint){ mouseXWorldPhys = (_stage.mouseX / PHYSCALE); mouseYWorldPhys = (_stage.mouseY / PHYSCALE); p2 = new b2Vec2(mouseXWorldPhys, mouseYWorldPhys); mouseJoint.SetTarget(p2); }; } public function clear():void{ var groundBody:b2Body; var tempBody:b2Body; var dBody:b2Body; var tempJoint:b2Joint; var dJoint:b2Joint; groundBody = _world.GetGroundBody(); tempBody = _world.GetBodyList(); while (_world.GetBodyCount() > 1) { if (tempBody != groundBody){ dBody = tempBody; tempBody = tempBody.GetNext(); _world.DestroyBody(dBody); } else { tempBody = tempBody.GetNext(); }; }; tempJoint = _world.GetJointList(); while (_world.GetJointCount() > 0) { dJoint = tempJoint; tempJoint = tempJoint.GetNext(); _world.DestroyJoint(dJoint); }; _world = null; } public function showDebug(container:DisplayObjectContainer):void{ var sp:Sprite; var dbg:b2DebugDraw; sp = new Sprite(); container.addChild(sp); dbg = new b2DebugDraw(); dbg.m_sprite = sp; dbg.m_alpha = 0.5; dbg.m_drawScale = PHYSCALE; dbg.m_fillAlpha = 0.5; dbg.m_drawFlags = b2DebugDraw.e_shapeBit; dbg.m_lineThickness = 1; world.SetDebugDraw(dbg); } public function createRound(x:Number, y:Number, radius:Number, angle:Number, userdata, type:String="item"):b2Body{ var shapeDef:b2PolygonDef; var bodydef:b2BodyDef; var body:b2Body; var circledef:b2CircleDef; shapeDef = new b2PolygonDef(); bodydef = new b2BodyDef(); circledef = new b2CircleDef(); bodydef.position.Set((x / PHYSCALE), (y / PHYSCALE)); bodydef.userData = new Object(); bodydef.userData.element = userdata; bodydef.isBullet = false; bodydef.angle = angle; bodydef.userData.type = type; circledef.radius = (radius / PHYSCALE); circledef.density = _density; circledef.restitution = _restitution; circledef.friction = _friction; body = world.CreateBody(bodydef); userdata.bd = body; body.CreateShape(circledef); body.SetMassFromShapes(); return (body); } public function setConvexVertex(shapeDef:b2PolygonDef, n:int, radius:Number, friction:Number=100, restitution:Number=0.1, density:Number=20):void{ var angle:Number; var i:int; var dx:Number; var dy:Number; shapeDef.vertexCount = n; angle = ((Math.PI * 2) / n); radius = (radius / PHYSCALE); i = 0; while (i < n) { dx = (radius * Math.cos(((angle * i) + fourangle))); dy = (radius * Math.sin(((angle * i) + fourangle))); shapeDef.vertices[i].Set(dx, dy); i++; }; shapeDef.friction = friction; shapeDef.restitution = restitution; shapeDef.density = density; } public function createWorld(gravity:b2Vec2, aabb:b2AABB, doSleep:Boolean=true):b2World{ _world = new b2World(aabb, gravity, doSleep); return (_world); } public function createPrismaticJoint(b1:b2Body, b2:b2Body, axis:b2Vec2, enableLimit:Boolean=false, lowerTranslation:Number=0, upperTranslation:Number=0, enableMotor:Boolean=false, motorSpeed:Number=0, maxMotorTorque:Number=0):b2Joint{ var prismaticJointDef:b2PrismaticJointDef; prismaticJointDef = new b2PrismaticJointDef(); prismaticJointDef.Initialize(b1, b2, b2.GetWorldCenter(), axis); prismaticJointDef.enableLimit = enableLimit; prismaticJointDef.lowerTranslation = lowerTranslation; prismaticJointDef.upperTranslation = upperTranslation; prismaticJointDef.enableMotor = enableMotor; prismaticJointDef.motorSpeed = motorSpeed; prismaticJointDef.maxMotorForce = maxMotorTorque; return (world.CreateJoint(prismaticJointDef)); } public function createDistanceJoint(body1:b2Body, body2:b2Body, anchor1:b2Vec2, anchor2:b2Vec2):b2Joint{ var distanceJointDef:b2DistanceJointDef; distanceJointDef = new b2DistanceJointDef(); distanceJointDef.Initialize(body1, body2, anchor1, anchor2); return (world.CreateJoint(distanceJointDef)); } public function addToWorld(objX:Number, objY:Number, objAngle:Number, friction:Number, objDensity:Number, restitution:Number, Obj, bullet:Boolean=false, type:String="none", allowsleep:Boolean=true):b2Body{ var _b2BodyDef:b2BodyDef; var _b2Body:b2Body; var _loc_10:*; var _b2PolygonDef:b2PolygonDef; var tem:Number; var i:int; _loc_10 = undefined; _b2BodyDef = new b2BodyDef(); _b2BodyDef.position.Set(objX, objY); _b2BodyDef.angle = objAngle; _b2BodyDef.userData = new Object(); _b2BodyDef.userData.element = Obj; _b2BodyDef.userData.type = type; _b2BodyDef.isBullet = bullet; _b2BodyDef.allowSleep = allowsleep; _b2Body = world.CreateBody(_b2BodyDef); Obj.bd = _b2Body; i = 0; while (i < Obj.numChildren) { _loc_10 = Obj.getChildAt(i); if (_loc_10.constructor == fang){ _b2PolygonDef = new b2PolygonDef(); tem = _loc_10.rotation; _loc_10.rotation = 0; _b2PolygonDef.SetAsOrientedBox((_loc_10.width / 60), (_loc_10.height / 60), new b2Vec2((_loc_10.x / 30), (_loc_10.y / 30)), (tem / 57.296)); _loc_10.rotation = tem; _b2PolygonDef.friction = friction; _b2PolygonDef.density = objDensity; _b2PolygonDef.restitution = restitution; _b2Body.CreateShape(_b2PolygonDef); }; i++; }; i = 0; while (i < Obj.numChildren) { _loc_10 = Obj.getChildAt(i); if (_loc_10.constructor == fang){ Obj.removeChildAt(i); } else { i++; }; }; if (objDensity != 0){ _b2Body.SetMassFromShapes(); }; return (_b2Body); } public static function getInstance():Box2dFactory{ if (_instance == null){ _instance = new (Box2dFactory); }; return (_instance); } } }//package UserdefinedClass
Section 190
//Camera (UserdefinedClass.Camera) package UserdefinedClass { import flash.display.*; import flash.events.*; import flash.geom.*; public class Camera { public var lockWay:String; public var lockTarget:DisplayObject; public var lockPoint:Point; public var count:int;// = 50 public var easing:Boolean;// = false public var easingRate:Number;// = 0.5 private var _isLocked:Boolean;// = false public static var LOCKWAY_NORMAL:String = "lockway_normal"; public static var Scene:DisplayObject; private static var _instance:Camera; public static var LOCKWAY_X:String = "lockway_x"; public static var LOCKWAY_Y:String = "lockway_y"; public function Camera(s:SingleEnforcer){ _isLocked = false; easing = false; easingRate = 0.5; count = 50; super(); if (s == null){ throw (new Error("using SingletonPattern")); }; } public function lookAt(t:DisplayObject, p:Point=null, lw:String="lockway_normal"):void{ if (p == null){ lockPoint = new Point(0, 0); } else { lockPoint = p; }; lockTarget = t; lockWay = lw; lockCemeraHandler(null); } private function lockWayNormal():void{ if (easing){ this.x = (this.x + (((lockTarget.x - this.x) - lockPoint.x) * easingRate)); this.y = (this.y + (((lockTarget.y - this.y) - lockPoint.y) * easingRate)); if (lockTarget.y < -200){ } else { this.y = (this.y + (((lockTarget.y - this.y) - lockPoint.y) * easingRate)); }; } else { this.x = (lockTarget.x - lockPoint.x); this.y = (lockTarget.y - lockPoint.y); }; } public function clear(){ _instance = null; } public function get isLocked():Boolean{ return (_isLocked); } private function lockWayY():void{ if (easing){ this.y = (this.y + (((lockTarget.y - this.y) - lockPoint.y) * easingRate)); } else { this.y = (lockTarget.y - lockPoint.y); }; } public function reset():void{ Scene.x = 0; Scene.y = 0; } private function lockWayX():void{ if (easing){ this.x = (this.x + (((lockTarget.x - this.x) - lockPoint.x) * easingRate)); } else { this.x = (lockTarget.x - lockPoint.x); }; } public function set y(y:Number):void{ Scene.y = -(y); } public function moveTo(p:Point, t:Point=null):void{ this.x = (t.x - p.x); this.y = (t.y - p.y); } public function set x(x:Number):void{ Scene.x = -(x); } private function lockCemeraHandler(e:Event):void{ switch (lockWay){ case LOCKWAY_NORMAL: lockWayNormal(); break; case LOCKWAY_X: lockWayX(); break; case LOCKWAY_Y: lockWayY(); break; }; } public function get y():Number{ return (-(Scene.y)); } public function get x():Number{ return (-(Scene.x)); } public static function getInstance(container:Sprite):Camera{ if (_instance == null){ Scene = container; _instance = new Camera(new SingleEnforcer()); }; return (_instance); } } }//package UserdefinedClass class SingleEnforcer { private function SingleEnforcer(){ super(); } }
Section 191
//Clr (UserdefinedClass.Clr) package UserdefinedClass { import flash.display.*; public class Clr { public function Clr(){ super(); } public static function removeAllChildren(container:DisplayObjectContainer):void{ var count:int; var i:int; count = container.numChildren; i = 0; while (i < count) { container.removeChildAt(0); i++; }; } } }//package UserdefinedClass
Section 192
//Input (UserdefinedClass.Input) package UserdefinedClass { import flash.display.*; import flash.events.*; public class Input { public static var LEFT:uint = 39; public static var P:uint = 80; public static var X:uint = 88; public static var Z:uint = 90; public static var UP:uint = 38; public static var key:Array = new Array(); public static var SHIFT:uint = 16; public static var SPACE:uint = 32; public static var sta:Stage; public static var DOWN:uint = 40; public static var RIGHT:uint = 37; public function Input(){ super(); } private static function onkeydown(e:KeyboardEvent):void{ key[e.keyCode] = true; } public static function removeinput(){ sta.removeEventListener(KeyboardEvent.KEY_UP, onkeyup); sta.removeEventListener(KeyboardEvent.KEY_DOWN, onkeydown); sta = null; } public static function addinput(_sta:Stage){ if (sta){ return; }; sta = _sta; sta.addEventListener(KeyboardEvent.KEY_UP, onkeyup); sta.addEventListener(KeyboardEvent.KEY_DOWN, onkeydown); } public static function keydownrunfun(keynum:uint, fun:Function){ var f:Function; f = fun; ((key[keynum]) && (f())); } public static function keyuprunfun(keynum:uint, fun:Function){ var f:Function; f = fun; if (key[keynum] == false){ f(); }; } private static function onkeyup(e:KeyboardEvent):void{ key[e.keyCode] = false; } } }//package UserdefinedClass
Section 193
//Mybutton (UserdefinedClass.Mybutton) package UserdefinedClass { import flash.display.*; import flash.net.*; public class Mybutton extends SimpleButton { public var netobj:Object; public function Mybutton(){ netobj = new Object(); super(); SoundControl.Mybtnground.push(this); } public function link(){ var req:URLRequest; req = (netobj["req"] as URLRequest); navigateToURL(req); } public function setlink(url:String){ netobj["req"] = new URLRequest(url); } } }//package UserdefinedClass
Section 194
//MyMath (UserdefinedClass.MyMath) package UserdefinedClass { import flash.geom.*; public class MyMath { public function MyMath(){ super(); } public static function LtoG(contain, child):Point{ var _loc_3:*; var _loc_4:*; _loc_3 = undefined; _loc_4 = undefined; _loc_3 = child.localToGlobal(new Point(0, 0)); _loc_4 = contain.globalToLocal(_loc_3); return (new Point(_loc_4.x, _loc_4.y)); } public static function FrandRange(min:Number, max:Number):Number{ var randomNum:Number; randomNum = (int((Math.random() * ((max - min) + 1))) + min); return (randomNum); } public static function TimeFormat(num:int):Array{ var minute:int; var second:int; var minutearr:Array; var secondarr:Array; if (num >= 6000){ num = 5999; }; minute = (num / 60); second = (num % 60); minutearr = worknum(minute); secondarr = worknum(second); return (new Array(secondarr[0], secondarr[1], minutearr[0], minutearr[1])); } public static function ranRangeground(min:Number, max:Number, Num:int):Array{ var temp:Array; var len:int; var rearr:Array; var _random:int; var i:int; temp = new Array(); len = ((max - min) + 1); rearr = new Array(); i = 0; while (i < len) { temp.push((min + i)); i++; }; while (Num) { _random = randRange((len - 1)); rearr.push(temp[_random]); temp.splice(_random, 1); len--; Num--; }; return (rearr); } public static function randRange(max:Number):Number{ var randomNum:Number; randomNum = int((Math.random() * (max + 1))); return (randomNum); } public static function worknum(num:int):Array{ var ten:int; var one:int; ten = (num * 0.1); one = (num % 10); return (new Array(one, ten)); } public static function NumtoArray(num:int, flushleft:Boolean=true):Array{ var str:String; var len:int; var i:int; var array:Array; str = String(num); len = str.length; i = 0; array = new Array(); while (i < len) { array.push(int(str.charAt(i))); i++; }; if (!flushleft){ array.reverse(); }; return (array); } } }//package UserdefinedClass
Section 195
//MySave (UserdefinedClass.MySave) package UserdefinedClass { import flash.net.*; public class MySave { public static var shareobj:SharedObject; public function MySave(){ super(); } public static function init(savename:String){ shareobj = SharedObject.getLocal(savename); } public static function save(){ shareobj.flush(); } public static function exist(varname:String):Boolean{ return (Boolean(((shareobj) && (shareobj.data[varname])))); } public static function getdata(varname:String){ return (shareobj.data[varname]); } public static function setdata(varname:String, vardata){ shareobj.data[varname] = vardata; } public static function clear(){ if (shareobj){ shareobj.clear(); }; } public static function cleardata(varname:String){ shareobj.data[varname] = null; delete shareobj.data[varname]; } } }//package UserdefinedClass
Section 196
//MyTime (UserdefinedClass.MyTime) package UserdefinedClass { import flash.events.*; import flash.utils.*; public class MyTime { private var endFun:Function; public var time:Timer; public var count:int; private var Fun:Function; public function MyTime(fun:Function){ super(); Fun = fun; count = 0; } public function pausetime(){ time.stop(); } public function starttime(){ time = new Timer(1000); time.addEventListener(TimerEvent.TIMER, oncountdown); time.start(); } public function oncountdown(e:TimerEvent):void{ count++; Fun(); } public function removetime(){ time.stop(); time.removeEventListener(TimerEvent.TIMER, oncountdown); } public function restart(){ time.start(); } } }//package UserdefinedClass
Section 197
//SoundControl (UserdefinedClass.SoundControl) package UserdefinedClass { import flash.media.*; public class SoundControl { public static var Mysdground:Array = new Array(); public static var Mybtnground:Array = new Array(); public static var buttonsound:Number = 1; public function SoundControl(){ super(); } public static function destorySdground(){ Mysdground = new Array(); } public static function stopallsound(){ SoundMixer.stopAll(); } public static function setsd(volume:Number){ var sdtransform:SoundTransform; var i:*; if (!Mysdground.length){ return; }; sdtransform = new SoundTransform(volume); for (i in Mysdground) { (Mysdground[i] as BaseSound).sdChannel.soundTransform = sdtransform; }; } public static function destory(){ Mybtnground = new Array(); Mysdground = new Array(); } public static function setbtnsound(volume:Number){ var sdtransform:SoundTransform; var i:*; if (!Mybtnground.length){ return; }; sdtransform = new SoundTransform(volume); for (i in Mybtnground) { (Mybtnground[i] as Mybutton).soundTransform = sdtransform; }; } public static function setallsd(volume:Number){ var sdtransform:SoundTransform; sdtransform = new SoundTransform(); sdtransform.volume = volume; SoundMixer.soundTransform = sdtransform; } } }//package UserdefinedClass
Section 198
//ae (ae) package { import flash.display.*; public dynamic class ae extends MovieClip { public var link:MovieClip; public var tail:yuan; public var endpoint:MovieClip; public var end:MovieClip; public function ae(){ super(); } } }//package
Section 199
//anchor (anchor) package { import flash.display.*; public dynamic class anchor extends MovieClip { public var anchor1:MovieClip; public var anchor2:MovieClip; public function anchor(){ super(); } } }//package
Section 200
//as (as) package { import flash.display.*; public dynamic class as extends MovieClip { public var link:MovieClip; public var tail:yuan; public function as(){ super(); } } }//package
Section 201
//be (be) package { import flash.display.*; public dynamic class be extends MovieClip { public var link:MovieClip; public var tail:yuan; public var endpoint:MovieClip; public var end:MovieClip; public function be(){ super(); } } }//package
Section 202
//BG1 (BG1) package { import flash.display.*; public dynamic class BG1 extends MovieClip { public function BG1(){ super(); } } }//package
Section 203
//BG2 (BG2) package { import flash.display.*; public dynamic class BG2 extends MovieClip { public function BG2(){ super(); } } }//package
Section 204
//BG4 (BG4) package { import flash.display.*; public dynamic class BG4 extends MovieClip { public function BG4(){ super(); } } }//package
Section 205
//BG5 (BG5) package { import flash.display.*; public dynamic class BG5 extends MovieClip { public function BG5(){ super(); } } }//package
Section 206
//BGM1 (BGM1) package { import flash.media.*; public dynamic class BGM1 extends Sound { public function BGM1(){ super(); } } }//package
Section 207
//BGM2 (BGM2) package { import flash.media.*; public dynamic class BGM2 extends Sound { public function BGM2(){ super(); } } }//package
Section 208
//BGM3 (BGM3) package { import flash.media.*; public dynamic class BGM3 extends Sound { public function BGM3(){ super(); } } }//package
Section 209
//BGM4 (BGM4) package { import flash.media.*; public dynamic class BGM4 extends Sound { public function BGM4(){ super(); } } }//package
Section 210
//BGM5 (BGM5) package { import flash.media.*; public dynamic class BGM5 extends Sound { public function BGM5(){ super(); } } }//package
Section 211
//Blackyan (Blackyan) package { import flash.display.*; public dynamic class Blackyan extends MovieClip { public function Blackyan(){ super(); addFrameScript(25, frame26); } function frame26(){ stop(); } } }//package
Section 212
//Blast_sd (Blast_sd) package { import flash.media.*; public dynamic class Blast_sd extends Sound { public function Blast_sd(){ super(); } } }//package
Section 213
//box1 (box1) package { import flash.display.*; public dynamic class box1 extends MovieClip { public var anchor1:MovieClip; public var anchor2:MovieClip; public var di:MovieClip; public var body:MovieClip; public var hit:MovieClip; public var cargo:MovieClip; public var lun1:MovieClip; public var lun2:MovieClip; public var lun3:MovieClip; public var lun4:MovieClip; public function box1(){ super(); } } }//package
Section 214
//box2 (box2) package { import flash.display.*; public dynamic class box2 extends MovieClip { public var anchor1:MovieClip; public var anchor2:MovieClip; public var di:MovieClip; public var body:MovieClip; public var hit:MovieClip; public var cargo:MovieClip; public var lun1:MovieClip; public var lun2:MovieClip; public var lun3:MovieClip; public var lun4:MovieClip; public function box2(){ super(); } } }//package
Section 215
//box3 (box3) package { import flash.display.*; public dynamic class box3 extends MovieClip { public var anchor1:MovieClip; public var anchor2:MovieClip; public var hit:MovieClip; public var cargo:MovieClip; public var lun1:MovieClip; public var lun2:MovieClip; public var lun3:MovieClip; public var lun4:MovieClip; public function box3(){ super(); } } }//package
Section 216
//box4 (box4) package { import flash.display.*; public dynamic class box4 extends MovieClip { public var anchor1:MovieClip; public var anchor2:MovieClip; public var hit:MovieClip; public var cargo:MovieClip; public var lun1:MovieClip; public var lun2:MovieClip; public var lun3:MovieClip; public var lun4:MovieClip; public function box4(){ super(); } } }//package
Section 217
//bs (bs) package { import flash.display.*; public dynamic class bs extends MovieClip { public var link:MovieClip; public var tail:yuan; public function bs(){ super(); } } }//package
Section 218
//ce (ce) package { import flash.display.*; public dynamic class ce extends MovieClip { public var link:MovieClip; public var tail:yuan; public var endpoint:MovieClip; public var end:MovieClip; public function ce(){ super(); } } }//package
Section 219
//Cover (Cover) package { import flash.display.*; public dynamic class Cover extends MovieClip { public var moregame_btn:SimpleButton; public var ce2:SimpleButton; public var ce1:SimpleButton; public var ce3:SimpleButton; public var play_btn:SimpleButton; public function Cover(){ super(); } } }//package
Section 220
//cs (cs) package { import flash.display.*; public dynamic class cs extends MovieClip { public var link:MovieClip; public var tail:yuan; public function cs(){ super(); } } }//package
Section 221
//de (de) package { import flash.display.*; public dynamic class de extends MovieClip { public var link:MovieClip; public var tail:yuan; public var endpoint:MovieClip; public var end:MovieClip; public function de(){ super(); } } }//package
Section 222
//ds (ds) package { import flash.display.*; public dynamic class ds extends MovieClip { public var link:MovieClip; public var tail:yuan; public function ds(){ super(); } } }//package
Section 223
//ee (ee) package { import flash.display.*; public dynamic class ee extends MovieClip { public var link:MovieClip; public var tail:yuan; public var endpoint:MovieClip; public var end:MovieClip; public function ee(){ super(); } } }//package
Section 224
//es (es) package { import flash.display.*; public dynamic class es extends MovieClip { public var link:MovieClip; public var tail:yuan; public function es(){ super(); } } }//package
Section 225
//fang (fang) package { import flash.display.*; public dynamic class fang extends MovieClip { public function fang(){ super(); } } }//package
Section 226
//Gameovermc (Gameovermc) package { import flash.display.*; public dynamic class Gameovermc extends MovieClip { public var moregame_btn:SimpleButton; public var retry_btn:SimpleButton; public var menu_btn:SimpleButton; public function Gameovermc(){ super(); } } }//package
Section 227
//Gameui (Gameui) package { import flash.display.*; public dynamic class Gameui extends MovieClip { public var cargo1:MovieClip; public var power:MovieClip; public var t0:MovieClip; public var t2:MovieClip; public var t3:MovieClip; public var t1:MovieClip; public var Tcargo0:MovieClip; public var res_btn:SimpleButton; public var Tcargo1:MovieClip; public var cargo0:MovieClip; public var p:MovieClip; public var music_btn:MovieClip; public var menu_btn:SimpleButton; public var pause_btn:MovieClip; public var lv0:MovieClip; public var lv1:MovieClip; public function Gameui(){ super(); } } }//package
Section 228
//gong_sd (gong_sd) package { import flash.media.*; public dynamic class gong_sd extends Sound { public function gong_sd(){ super(); } } }//package
Section 229
//Howtoplay (Howtoplay) package { import flash.display.*; public dynamic class Howtoplay extends MovieClip { public var moregame_btn:SimpleButton; public var next_btn:SimpleButton; public var res_btn:SimpleButton; public var music_btn:MovieClip; public var menu_btn:SimpleButton; public var pause_btn:MovieClip; public function Howtoplay(){ super(); } } }//package
Section 230
//Loadingmc (Loadingmc) package { import flash.display.*; public dynamic class Loadingmc extends MovieClip { public var mc:MovieClip; public function Loadingmc(){ super(); } } }//package
Section 231
//Main (Main) package { import Element.*; import flash.display.*; import flash.events.*; import caurina.transitions.*; import UserdefinedClass.*; import BaseClass.*; import flash.utils.*; import flash.net.*; public class Main extends MovieClip { public var gameui:MovieClip; public var ce1:String;// = "http://www.sillybull.com/play/coal-express" public var ce2:String;// = "http://www.sillybull.com/play/coal-express-2" public var Game:Sprite; public var Cue:Sprite; public var ce3:String;// = "http://www.sillybull.com/play/coal-express-3" public var highscore:int;// = 0 public var Debug:Sprite; public var succeed:MovieClip; public var gamestage:String; public var howtoplay:MovieClip; public var SoundBool:Boolean;// = true public var GameClass:BaseStage; public var winmc:MovieClip; public var newgamelink:String;// = "http://www.sillybull.com/" public var URLstr:String;// = "http://www.sillybull.com/?utm_source=games&utm_medium=coalexpress4pmg" public var Ui:Sprite; public var money:int; public var delaytime:Timer; public var selstage:MovieClip; public var Time:Timer; public var shop:MovieClip; public var tempgamestage:int; public var Loading:Sprite; public var loading:MovieClip; public var delayplay:Timer; public var initgamenum:int;// = 0 public var dietime:int;// = 0 public var shopmenu:Boolean;// = false public var mydata:MyData; public var sellv:MovieClip; public var sucmcarr:Array; public var selpoint:int;// = 1 public var succon:MovieClip; public var cover:MovieClip; public var stagenum:int; public var gameovermc:MovieClip; public var seltrain:int;// = 1 public var allowplay:int; public static var gong:BaseSound = new BaseSound("gong_sd"); public static var bgm3:BaseSound = new BaseSound("BGM3"); public static var bgm5:BaseSound = new BaseSound("BGM5"); public static var bgm2:BaseSound = new BaseSound("BGM2"); public static var run:BaseSound = new BaseSound("run_sd"); public static var bgm4:BaseSound = new BaseSound("BGM4"); public static var winsd:BaseSound = new BaseSound("win_sd"); public static var bao:BaseSound = new BaseSound("Blast_sd"); public static var uibgm:BaseSound = new BaseSound("UIBGM"); public static var bgm1:BaseSound = new BaseSound("BGM1"); public static var wu:BaseSound = new BaseSound("wu_sd"); public function Main(){ SoundBool = true; initgamenum = 0; highscore = 0; selpoint = 1; seltrain = 1; shopmenu = false; dietime = 0; newgamelink = "http://www.sillybull.com/"; URLstr = "http://www.sillybull.com/?utm_source=games&utm_medium=coalexpress4pmg"; ce1 = "http://www.sillybull.com/play/coal-express"; ce2 = "http://www.sillybull.com/play/coal-express-2"; ce3 = "http://www.sillybull.com/play/coal-express-3"; super(); if (stage){ init(); } else { addEventListener(Event.ADDED_TO_STAGE, init); }; } private function destroy(){ Clr.removeAllChildren(Game); Clr.removeAllChildren(Ui); Clr.removeAllChildren(Cue); Clr.removeAllChildren(Loading); } private function workuplv(min:int, max:int):Boolean{ return ((min < max)); } private function initshop(){ var temp1:Array; var temp2:Array; var i:int; BaseUI.setmoney(shop, money, "m", 6); temp1 = new Array(shop.s1, shop.s2, shop.s3, shop.s4, shop.s5); temp2 = new Array(shop.t.t1, shop.t.t2, shop.t.t3, shop.t.t4); i = 0; while (i < 5) { temp1[i].x = -700; i++; }; i = 1; while (i < 4) { if (MyData.getInstance().traindata[i] == 1){ temp2[i].gotoAndStop(2); }; i++; }; temp2[(seltrain - 1)].gotoAndStop(temp2[(seltrain - 1)].totalFrames); i = 0; while (i < 5) { worktrainaddv(temp1[i], i); i++; }; } private function worktrainaddv(mc:MovieClip, Num:int){ var tempnum:int; var tempstr:Array; var i:int; tempnum = MyData.getInstance().addv[Num]; tempstr = new Array("i1", "i2", "i3", "i4", "i5"); i = 0; while (i < 5) { if (i < (tempnum - 1)){ mc[tempstr[i]].gotoAndStop(2); } else { if (i == (tempnum - 1)){ mc[tempstr[i]].gotoAndStop(3); }; }; i++; }; } public function savesucceed(){ MySave.setdata("succeed", MyData.getInstance().succeed); MySave.save(); } private function initstage(num:int):void{ initgamenum = (num + 1); toplay(); } private function mathhighscore():int{ var HS:int; var i:int; HS = 0; i = 0; while (i < 10) { HS = (HS + MyData.getInstance().highscore[i]); i++; }; return (HS); } private function showhowtoplay():void{ gamestage = "howtoplay"; Clr.removeAllChildren(Ui); Ui.addChild(howtoplay); howtoplay.gotoAndStop(1); } private function showsuc(){ gamestage = "success"; Clr.removeAllChildren(Ui); Ui.addChild(succeed); updatasuc(); } public function removedata(){ MySave.init("CoalExpress4"); MySave.clear(); } private function toplay(){ showloading(selpoint); delayplay = new Timer(1000, 1); delayplay.start(); delayplay.addEventListener(TimerEvent.TIMER, loadgame); } public function delayrun(time:int, fun:Function){ Tweener.addTween(this, {delay:time, onComplete:fun}); } private function showselect():void{ stagenum = 0; gamestage = "select"; Clr.removeAllChildren(Ui); setselectstage(); Ui.addChild(selstage); } private function initUImc():void{ cover = new Cover(); howtoplay = new Howtoplay(); selstage = new Selstage(); sellv = new Sellv(); succeed = new Succeed(); shop = new Shop(); gameui = new Gameui(); gameovermc = new Gameovermc(); winmc = new Win(); loading = new Loadingmc(); buildsuc(); } public function suc33(){ var temp:int; var i:int; temp = 0; if (!MyData.getInstance().succeed[33]){ i = 0; while (i < 4) { temp = (temp + MyData.getInstance().traindata[i]); i++; }; if (temp == 4){ MyData.getInstance().succeed[33] = true; addmoney(2000); savemoney(); }; }; } public function suc34(){ if (!MyData.getInstance().succeed[34]){ if ((MyData.getInstance().addv[3] + MyData.getInstance().addv[4]) == 10){ MyData.getInstance().succeed[34] = true; addmoney(2000); savemoney(); }; }; } public function suc35(){ var temp:int; var i:int; temp = 0; if (!MyData.getInstance().succeed[35]){ i = 0; while (i < 5) { temp = (temp + MyData.getInstance().addv[i]); i++; }; if (temp == 25){ MyData.getInstance().succeed[35] = true; addmoney(2000); savemoney(); }; }; } public function suc37(){ var tempbool:Boolean; var i:int; if (MyData.getInstance().succeed[37]){ return; }; tempbool = true; i = 0; while (i < 15) { if (!MyData.getInstance().succeed[i]){ tempbool = false; break; }; i++; }; if (tempbool){ MyData.getInstance().succeed[37] = true; addmoney(2000); savemoney(); }; } public function suc32(){ if (!MyData.getInstance().succeed[32]){ if (money >= 100000){ MyData.getInstance().succeed[32] = true; addmoney(2000); savemoney(); }; }; } public function showgetsuc(num:int, x:Number, y:Number){ } public function suc38(){ var tempbool:Boolean; var i:int; if (MyData.getInstance().succeed[38]){ return; }; tempbool = true; i = 15; while (i < 30) { if (!MyData.getInstance().succeed[i]){ tempbool = false; break; }; i++; }; if (tempbool){ MyData.getInstance().succeed[38] = true; addmoney(2000); savemoney(); }; } public function setTime(T:int){ BaseUI.settime(gameui, T); } private function remoney(lv:int):int{ return (MyData.getInstance().charv[lv]); } public function setpoint(num:Number){ var sp:Number; var ep:Number; sp = 420; ep = 590; gameui.p.x = (((ep - sp) * (num / 100)) + 420); BaseUI.setmoney(gameui.p, int(num), "n", 3); } public function suc39(){ var tempbool:Boolean; var i:int; if (MyData.getInstance().succeed[39]){ return; }; if (!MyData.getInstance().succeed[38]){ return; }; if (!MyData.getInstance().succeed[37]){ return; }; tempbool = true; i = 0; while (i < 39) { if (!MyData.getInstance().succeed[i]){ tempbool = false; break; }; i++; }; if (tempbool){ MyData.getInstance().succeed[39] = true; addmoney(2000); savemoney(); }; } public function setcargo(num:int){ BaseUI.setcargo(gameui, num, "cargo"); } private function savedata():void{ MySave.setdata("allowplay", allowplay); MySave.save(); } private function savealldata(){ MySave.setdata("seltrain", seltrain); MySave.setdata("traindata", MyData.getInstance().traindata); MySave.setdata("highscore", MyData.getInstance().highscore); MySave.setdata("money", money); MySave.setdata("allowplay", allowplay); MySave.setdata("succeed", MyData.getInstance().succeed); MySave.setdata("addv", MyData.getInstance().addv); MySave.save(); } private function onclickbtn(e:MouseEvent):void{ if (gamestage == "cover"){ if (hitbtn(cover.play_btn)){ showhowtoplay(); return; }; if (hitbtn(cover.moregame_btn)){ navigateToURL(new URLRequest(URLstr)); return; }; if (hitbtn(cover.ce1)){ navigateToURL(new URLRequest(ce1)); return; }; if (hitbtn(cover.ce2)){ navigateToURL(new URLRequest(ce2)); return; }; if (hitbtn(cover.ce3)){ navigateToURL(new URLRequest(ce3)); return; }; }; if (gamestage == "lv"){ worksellv(); return; }; if (gamestage == "shop"){ workshop(); return; }; if (gamestage == "howtoplay"){ if (hitbtn(howtoplay.moregame_btn)){ navigateToURL(new URLRequest(URLstr)); return; }; if (hitbtn(howtoplay.next_btn)){ if (howtoplay.currentFrame == 1){ howtoplay.nextFrame(); } else { loaddata(); showselect(); }; return; }; }; if (gamestage == "select"){ setselect(); return; }; if (gamestage == "success"){ if (hitbtn(succeed.back_btn)){ showselect(); return; }; }; if (gamestage == "playing"){ if (hitbtn(GameClass.startLink)){ navigateToURL(new URLRequest(newgamelink)); return; }; if (hitbtn(GameClass.endLink)){ navigateToURL(new URLRequest(newgamelink)); return; }; if (hitbtn(gameui.pause_btn)){ gameui.pause_btn.gotoAndStop(((gameui.pause_btn.currentFrame % 2) + 1)); GameClass.pausegame(); return; }; if (hitbtn(gameui.res_btn)){ GameClass.destory(); Clr.removeAllChildren(Game); toplay(); return; }; if (hitbtn(gameui.menu_btn)){ GameClass.destory(); Clr.removeAllChildren(Game); SoundControl.stopallsound(); showselect(); Main.uibgm.playsound(1000000); return; }; if (hitbtn(gameui.music_btn)){ gameui.music_btn.gotoAndStop(((gameui.music_btn.currentFrame % 2) + 1)); if (SoundBool){ SoundBool = false; } else { SoundBool = true; }; if (SoundBool){ SoundControl.setallsd(1); } else { SoundControl.setallsd(0); }; return; }; if (hitbtn(gameui.logo_btn)){ return; }; }; if (gamestage == "over"){ if (hitbtn(gameovermc.retry_btn)){ GameClass.destory(); Clr.removeAllChildren(Game); toplay(); return; }; if (hitbtn(gameovermc.menu_btn)){ GameClass.destory(); Clr.removeAllChildren(Game); SoundControl.stopallsound(); showselect(); Main.uibgm.playsound(1000000); return; }; if (hitbtn(gameovermc.moregame_btn)){ navigateToURL(new URLRequest(URLstr)); return; }; }; if (gamestage == "win"){ if (hitbtn(winmc.menu_btn)){ GameClass.destory(); Clr.removeAllChildren(Game); SoundControl.stopallsound(); showselect(); Main.uibgm.playsound(1000000); return; }; if (hitbtn(winmc.shop_btn)){ GameClass.destory(); Clr.removeAllChildren(Game); SoundControl.stopallsound(); showshop(); return; }; if (hitbtn(winmc.moregame_btn)){ navigateToURL(new URLRequest(URLstr)); return; }; if (hitbtn(winmc.next_btn)){ if (initgamenum != 15){ if ((((((((initgamenum == 3)) || ((initgamenum == 6)))) || ((initgamenum == 9)))) || ((initgamenum == 12)))){ selpoint = (selpoint + 1); }; GameClass.destory(); Clr.removeAllChildren(Game); initstage(initgamenum); } else { GameClass.destory(); Clr.removeAllChildren(Game); SoundControl.stopallsound(); showselect(); Main.uibgm.playsound(1000000); }; return; }; if (hitbtn(winmc.retry_btn)){ GameClass.destory(); Clr.removeAllChildren(Game); toplay(); return; }; }; } private function initdata():void{ gamestage = new String(); stagenum = 0; loaddata(); } public function addmoney(am:int){ if ((money + am) <= 999999){ money = (money + am); } else { money = 999999; }; } private function ongotogame(e:TimerEvent):void{ delayplay.stop(); delayplay.removeEventListener(TimerEvent.TIMER, ongotogame); Clr.removeAllChildren(Loading); gotogame(); } public function setTcargo(num:int){ BaseUI.setcargo(gameui, num, "Tcargo"); } private function showcover():void{ SoundControl.stopallsound(); Main.uibgm.playsound(1000000); gamestage = "cover"; Clr.removeAllChildren(Ui); Ui.addChild(cover); } public function setSpeedbar(V:int){ gameui.power.gotoAndStop((V + 1)); } private function initgame():void{ gamestage = "init"; addEventListener(MouseEvent.MOUSE_DOWN, onclickbtn); addEventListener(Event.ENTER_FRAME, oncue); Input.addinput(stage); showcover(); } private function worksellv():void{ var ishit:Boolean; var tempMc:Array; var i:int; if (hitbtn(sellv.back_btn)){ showselect(); return; }; if (hitbtn(sellv.moregame_btn)){ navigateToURL(new URLRequest(URLstr)); return; }; ishit = false; tempMc = new Array(sellv.s1, sellv.s2, sellv.s3, sellv.s4, sellv.s5, sellv.s6, sellv.s7, sellv.s8, sellv.s9, sellv.s10, sellv.s11, sellv.s12, sellv.s13, sellv.s14, sellv.s15); i = 0; while (i < 15) { if (hitbtn(tempMc[i])){ if ((tempMc[i] is MovieClip)){ if (tempMc[i].totalFrames == tempMc[i].currentFrame){ ishit = true; break; }; } else { ishit = true; break; }; }; i++; }; if (!ishit){ return; }; initstage(i); } private function init(e:Event=null):void{ removeEventListener(Event.ADDED_TO_STAGE, init); initdata(); initcontainer(); initUImc(); initgame(); } public function workchtime(str:String){ var tempstr:Array; var tempnum:int; tempstr = new Array("Cow", "Leo", "Chicken", "Monkey", "Bull", "Cayman", "Elephant", "Panda", "Alpaca"); tempnum = tempstr.indexOf(str); if (tempnum != -1){ MyData.getInstance().character[tempnum] = (MyData.getInstance().character[tempnum] - 1); savealldata(); }; } private function buildsuc(){ var i:int; var j:int; var tempmc:MovieClip; succon = (succeed.getChildByName("con") as MovieClip); sucmcarr = new Array(); i = 0; while (i < 5) { j = 0; while (j < 8) { tempmc = new Suc(); succon.addChild(tempmc); tempmc.x = (j * 78); tempmc.y = (i * 69); tempmc.gotoAndStop(41); sucmcarr.push(tempmc); j++; }; i++; }; } private function updatalv():void{ var tempMc:Array; var len:int; var i:int; tempMc = new Array(sellv.s1, sellv.s2, sellv.s3, sellv.s4, sellv.s5, sellv.s6, sellv.s7, sellv.s8, sellv.s9, sellv.s10, sellv.s11, sellv.s12, sellv.s13, sellv.s14, sellv.s15); len = MySave.getdata("allowplay"); i = 0; while (i < len) { if ((tempMc[i] is MovieClip)){ tempMc[i].gotoAndStop(tempMc[i].totalFrames); }; i++; }; } private function initgameUI(){ Ui.addChild(gameui); delayplay = new Timer(1000, 1); delayplay.addEventListener(TimerEvent.TIMER, ongotogame); delayplay.start(); } public function setsucceedmc(Mc:MovieClip, Num:Array){ var tempmc:Array; var i:int; tempmc = new Array(Mc["T"], Mc["Y"], Mc["J"]); i = 0; while (i < 3) { if (Num[i]){ tempmc[i].alpha = 1; } else { tempmc[i].alpha = 0; }; i++; }; } public function savedietime(){ MySave.setdata("dietime", dietime); MySave.save(); } private function showlv(lv:int){ gamestage = "lv"; Clr.removeAllChildren(Ui); Ui.addChild(sellv); sellv.gotoAndStop(lv); updatalv(); } public function saveHS(){ MySave.setdata("highscore", MyData.getInstance().highscore); MySave.save(); } public function setpowerbar(Num:int){ gameui.power.gotoAndStop(Num); } public function savemoney(){ MySave.setdata("money", money); MySave.save(); } private function updatasuc():void{ var i:int; i = 0; while (i < 40) { if (MyData.getInstance().succeed[i]){ sucmcarr[i].gotoAndStop((i + 1)); } else { sucmcarr[i].gotoAndStop(41); }; i++; }; } private function initcontainer():void{ Game = new Sprite(); Ui = new Sprite(); Loading = new Sprite(); Debug = new Sprite(); Cue = new Sprite(); addChild(Game); addChild(Ui); addChild(Cue); addChild(Loading); addChild(Debug); } private function worktrainsel(){ var temp3:Array; var temp1:Array; var i:int; temp3 = new Array(shop.t.t1, shop.t.t2, shop.t.t3, shop.t.t4); temp1 = new Array(shop.t1, shop.t2); i = 0; while (i < 4) { if (i == (seltrain - 1)){ temp3[i].gotoAndStop(temp3[i].totalFrames); temp1[0].gotoAndStop((i + 1)); temp1[1].gotoAndStop((i + 1)); } else { if (MyData.getInstance().traindata[i]){ temp3[i].gotoAndStop((temp3[i].totalFrames - 1)); }; }; i++; }; } private function showshop(){ gamestage = "shop"; Clr.removeAllChildren(Ui); Ui.addChild(shop); initshop(); } private function updatasel(){ var temp:Array; var i:int; temp = new Array(selstage.stage1, selstage.stage2, selstage.stage3, selstage.stage4, selstage.stage5); i = 0; while (i < 5) { if ((selpoint - 1) == i){ temp[i].x = 150; temp[i].y = 70; } else { temp[i].x = 648; temp[i].y = 70; }; selstage.word.gotoAndStop(selpoint); i++; }; } private function workshop():void{ var temp1:Array; var temp2:Array; var temp3:Array; var temp4:Array; var ishit:Boolean; var i:int; var j:int; if (hitbtn(shop.back_btn)){ showselect(); return; }; if (hitbtn(shop.moregame_btn)){ navigateToURL(new URLRequest(URLstr)); return; }; temp1 = new Array(shop.b1, shop.b2, shop.b3, shop.b4, shop.b5); temp2 = new Array(shop.s1, shop.s2, shop.s3, shop.s4, shop.s5); temp3 = new Array(shop.t.t1, shop.t.t2, shop.t.t3, shop.t.t4); temp4 = new Array("i1", "i2", "i3", "i4", "i5"); ishit = false; shopmenu = false; i = 0; while (i < 5) { if (hitbtn(temp1[i])){ ishit = true; if (temp2[i].x == -700){ Tweener.addTween(temp2[i], {x:-50, time:0.3, transition:"linear"}); } else { if (temp2[i].x == -50){ Tweener.addTween(temp2[i], {x:-700, time:0.3, transition:"linear"}); }; }; }; if (temp2[i].x > -700){ shopmenu = true; }; i++; }; i = 0; while (i < 5) { j = 0; while (j < 5) { if (j == MyData.getInstance().addv[i]){ if (hitbtn(temp2[i][temp4[j]])){ ishit = true; if (money >= MyData.getInstance().addvv[MyData.getInstance().addv[i]]){ money = (money - MyData.getInstance().addvv[MyData.getInstance().addv[i]]); BaseUI.setmoney(shop, money, "m", 6); var _local8 = MyData.getInstance().addv; var _local9 = i; var _local10 = (_local8[_local9] + 1); _local8[_local9] = _local10; worktrainaddv(temp2[i], i); savealldata(); }; }; }; j++; }; i++; }; if (ishit){ return; }; if (shopmenu){ return; }; i = 0; while (i < 4) { if (hitbtn(temp3[i])){ if (MyData.getInstance().traindata[i] == 0){ if (money >= MyData.getInstance().carvalue[i]){ money = (money - MyData.getInstance().carvalue[i]); BaseUI.setmoney(shop, money, "m", 6); MyData.getInstance().traindata[i] = 1; seltrain = (i + 1); worktrainsel(); savealldata(); }; } else { seltrain = (i + 1); worktrainsel(); savealldata(); }; }; i++; }; } private function loaddata():void{ var j:int; MySave.init("CoalExpress4"); if (MySave.exist("reset")){ allowplay = MySave.getdata("allowplay"); money = MySave.getdata("money"); MyData.getInstance().succeed = MySave.getdata("succeed"); MyData.getInstance().highscore = MySave.getdata("highscore"); MyData.getInstance().addv = MySave.getdata("addv"); seltrain = MySave.getdata("seltrain"); MyData.getInstance().traindata = MySave.getdata("traindata"); dietime = MySave.getdata("dietime"); } else { MySave.setdata("reset", true); allowplay = 1; money = 0; MyData.getInstance().highscore = new Array(); j = 0; while (j < 15) { MyData.getInstance().highscore.push(0); j++; }; MySave.setdata("seltrain", seltrain); MySave.setdata("traindata", MyData.getInstance().traindata); MySave.setdata("highscore", MyData.getInstance().highscore); MySave.setdata("money", money); MySave.setdata("allowplay", allowplay); MySave.setdata("succeed", MyData.getInstance().succeed); MySave.setdata("addv", MyData.getInstance().addv); MySave.setdata("dietime", dietime); MySave.save(); }; } public function setLv(LVnum:int){ BaseUI.setlv(gameui, LVnum); } public function showloading(Num:int):void{ gamestage = "loading"; SoundControl.stopallsound(); loading.mc.gotoAndStop(Num); Loading.addChild(loading); } public function showWin(T:int, CargoNum:int, S:int, M:int){ Main.winsd.playsound(1); BaseUI.settime(winmc, T); BaseUI.setmoney(winmc, CargoNum, "c", 2); BaseUI.setmoney(winmc, S, "s", 5); BaseUI.setmoney(winmc, M, "w", 4); issave(); if ((money + M) <= 999999){ money = (money + M); } else { money = 999999; }; MySave.setdata("money", money); MySave.save(); BaseUI.setmoney(winmc, money, "m", 6); gamestage = "win"; Ui.addChild(winmc); winmc.x = (320 - (winmc.width * 0.5)); winmc.y = -600; Tweener.addTween(winmc, {y:(240 - (winmc.height * 0.5)), time:2, transition:"easeOutBounce"}); } private function issave():void{ initgamenum++; if (initgamenum > MySave.getdata("allowplay")){ if (initgamenum < 16){ allowplay = initgamenum; MySave.setdata("allowplay", allowplay); MySave.save(); }; }; initgamenum--; } public function gotogame(){ GameClass.startlistener(); gamestage = "playing"; } private function setselect():void{ var temp:Array; var unhit:Boolean; var i:int; if (hitbtn(selstage.moregame_btn)){ navigateToURL(new URLRequest(URLstr)); return; }; if (hitbtn(selstage.shop_btn)){ showshop(); return; }; if (hitbtn(selstage.ach_btn)){ showsuc(); return; }; if (hitbtn(selstage.quit_btn)){ showcover(); return; }; if (hitbtn(selstage.p1)){ if ((selpoint - 1) >= 1){ selpoint--; } else { selpoint = 5; }; updatasel(); return; }; if (hitbtn(selstage.p2)){ if ((selpoint + 1) <= 5){ selpoint++; } else { selpoint = 1; }; updatasel(); return; }; temp = new Array(selstage.stage1, selstage.stage2, selstage.stage3, selstage.stage4, selstage.stage5); unhit = true; i = 0; while (i < 5) { if (temp[i].hitTestPoint(mouseX, mouseY, true)){ if (i == 0){ unhit = false; stagenum = (i + 1); } else { if (temp[i].currentFrame == 2){ unhit = false; stagenum = (i + 1); }; }; }; i++; }; if (unhit){ return; }; showlv(stagenum); } private function setselectstage():void{ var temp:Array; var tempnum:int; var i:int; temp = new Array(selstage.stage1, selstage.stage2, selstage.stage3, selstage.stage4, selstage.stage5); updatasel(); tempnum = ((MySave.getdata("allowplay") - 1) / 3); i = 0; while (i < tempnum) { temp[(i + 1)].gotoAndStop(2); i++; }; } private function loadgame(e:TimerEvent=null){ var stageclass:Class; delayplay.stop(); delayplay.removeEventListener(TimerEvent.TIMER, loadgame); gamestage = "standby"; Clr.removeAllChildren(Ui); stageclass = (MyData.getInstance().stageclassground[(initgamenum - 1)] as Class); GameClass = new stageclass(this); Game.addChild(GameClass); initgameUI(); } private function hitbtn(btn:DisplayObject):Boolean{ if (((btn) && (btn.visible))){ return (btn.hitTestPoint(mouseX, mouseY, true)); }; return (false); } public function showGameover():void{ trace("aaaa"); gamestage = "over"; Ui.addChild(gameovermc); gameovermc.x = (320 - (gameovermc.width * 0.5)); gameovermc.y = -400; Tweener.addTween(gameovermc, {y:(240 - (gameovermc.height * 0.5)), time:2, transition:"easeOutBounce"}); } private function oncue(e:Event=null){ var i:int; var temp1:Array; var temp2:Array; var temp3:Array; var temp4:Array; var j:int; if (gamestage == "success"){ i = 0; while (i < 40) { if (hitbtn(sucmcarr[i])){ succeed.word.gotoAndStop((i + 1)); break; } else { succeed.word.gotoAndStop(41); }; i++; }; }; if (gamestage == "shop"){ temp1 = new Array(shop.b1, shop.b2, shop.b3, shop.b4, shop.b5); temp2 = new Array(shop.s1, shop.s2, shop.s3, shop.s4, shop.s5); temp3 = new Array(shop.t.t1, shop.t.t2, shop.t.t3, shop.t.t4); temp4 = new Array("i1", "i2", "i3", "i4", "i5"); shop.word.gotoAndStop(35); i = 0; while (i < 5) { if (hitbtn(temp1[i])){ shop.word.gotoAndStop((i + 1)); }; i++; }; i = 1; while (i < 4) { if (hitbtn(temp3[i])){ if (temp3[i].currentFrame == 1){ shop.word.gotoAndStop((i + 6)); } else { shop.word.gotoAndStop(35); }; }; i++; }; i = 0; while (i < 5) { j = 0; while (j < 5) { if (temp2[i][temp4[j]].currentFrame == 1){ if (hitbtn(temp2[i][temp4[j]])){ shop.word.gotoAndStop(((10 + j) + (i * 5))); }; }; j++; }; i++; }; }; suc32(); suc33(); suc34(); suc35(); if (gamestage == "select"){ suc37(); suc38(); suc39(); }; } } }//package
Section 232
//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{ var self:MochiBot; var server:String; var lv:URLVariables; var url:String; var req:URLRequest; var loader:Loader; if (Security.sandboxType == "localWithFile"){ return (null); }; self = new (MochiBot); parent.addChild(self); Security.allowDomain("*"); Security.allowInsecureDomain("*"); server = "http://core.mochibot.com/my/core.swf"; lv = new URLVariables(); lv["sb"] = Security.sandboxType; lv["v"] = Capabilities.version; lv["swfid"] = tag; lv["mv"] = "8"; lv["fv"] = "9"; url = self.root.loaderInfo.loaderURL; if (url.indexOf("http") == 0){ lv["url"] = url; } else { lv["url"] = "local"; }; req = new URLRequest(server); req.contentType = "application/x-www-form-urlencoded"; req.method = URLRequestMethod.POST; req.data = lv; loader = new Loader(); self.addChild(loader); loader.load(req); return (self); } } }//package
Section 233
//r104 (r104) package { import flash.display.*; public dynamic class r104 extends MovieClip { public var tail:yuan; public function r104(){ super(); } } }//package
Section 234
//r105 (r105) package { import flash.display.*; public dynamic class r105 extends MovieClip { public var tail:yuan; public function r105(){ super(); } } }//package
Section 235
//r106 (r106) package { import flash.display.*; public dynamic class r106 extends MovieClip { public var tail:yuan; public function r106(){ super(); } } }//package
Section 236
//r107 (r107) package { import flash.display.*; public dynamic class r107 extends MovieClip { public var tail:yuan; public function r107(){ super(); } } }//package
Section 237
//r108 (r108) package { import flash.display.*; public dynamic class r108 extends MovieClip { public var tail:yuan; public function r108(){ super(); } } }//package
Section 238
//r109 (r109) package { import flash.display.*; public dynamic class r109 extends MovieClip { public var tail:yuan; public function r109(){ super(); } } }//package
Section 239
//r11 (r11) package { import flash.display.*; public dynamic class r11 extends MovieClip { public var tail:yuan; public function r11(){ super(); } } }//package
Section 240
//r113 (r113) package { import flash.display.*; public dynamic class r113 extends MovieClip { public var tail:yuan; public function r113(){ super(); } } }//package
Section 241
//r114 (r114) package { import flash.display.*; public dynamic class r114 extends MovieClip { public var tail:yuan; public function r114(){ super(); } } }//package
Section 242
//r115 (r115) package { import flash.display.*; public dynamic class r115 extends MovieClip { public var tail:yuan; public function r115(){ super(); } } }//package
Section 243
//r116 (r116) package { import flash.display.*; public dynamic class r116 extends MovieClip { public var tail:yuan; public function r116(){ super(); } } }//package
Section 244
//r117 (r117) package { import flash.display.*; public dynamic class r117 extends MovieClip { public var tail:yuan; public function r117(){ super(); } } }//package
Section 245
//r118 (r118) package { import flash.display.*; public dynamic class r118 extends MovieClip { public var tail:yuan; public function r118(){ super(); } } }//package
Section 246
//r119 (r119) package { import flash.display.*; public dynamic class r119 extends MovieClip { public var tail:yuan; public function r119(){ super(); } } }//package
Section 247
//r12 (r12) package { import flash.display.*; public dynamic class r12 extends MovieClip { public var tail:yuan; public function r12(){ super(); } } }//package
Section 248
//r121 (r121) package { import flash.display.*; public dynamic class r121 extends MovieClip { public var tail:yuan; public function r121(){ super(); } } }//package
Section 249
//r124 (r124) package { import flash.display.*; public dynamic class r124 extends MovieClip { public var tail:yuan; public function r124(){ super(); } } }//package
Section 250
//r125 (r125) package { import flash.display.*; public dynamic class r125 extends MovieClip { public var tail:yuan; public function r125(){ super(); } } }//package
Section 251
//r127 (r127) package { import flash.display.*; public dynamic class r127 extends MovieClip { public var tail:yuan; public function r127(){ super(); } } }//package
Section 252
//r128 (r128) package { import flash.display.*; public dynamic class r128 extends MovieClip { public var tail:yuan; public function r128(){ super(); } } }//package
Section 253
//r129 (r129) package { import flash.display.*; public dynamic class r129 extends MovieClip { public var tail:yuan; public function r129(){ super(); } } }//package
Section 254
//r13 (r13) package { import flash.display.*; public dynamic class r13 extends MovieClip { public var tail:yuan; public function r13(){ super(); } } }//package
Section 255
//r131 (r131) package { import flash.display.*; public dynamic class r131 extends MovieClip { public var tail:yuan; public function r131(){ super(); } } }//package
Section 256
//r1310 (r1310) package { import flash.display.*; public dynamic class r1310 extends MovieClip { public var tail:yuan; public function r1310(){ super(); } } }//package
Section 257
//r132 (r132) package { import flash.display.*; public dynamic class r132 extends MovieClip { public var tail:yuan; public function r132(){ super(); } } }//package
Section 258
//r133 (r133) package { import flash.display.*; public dynamic class r133 extends MovieClip { public var tail:yuan; public function r133(){ super(); } } }//package
Section 259
//r134 (r134) package { import flash.display.*; public dynamic class r134 extends MovieClip { public var tail:yuan; public function r134(){ super(); } } }//package
Section 260
//r135 (r135) package { import flash.display.*; public dynamic class r135 extends MovieClip { public var tail:yuan; public function r135(){ super(); } } }//package
Section 261
//r136 (r136) package { import flash.display.*; public dynamic class r136 extends MovieClip { public var tail:yuan; public function r136(){ super(); } } }//package
Section 262
//r14 (r14) package { import flash.display.*; public dynamic class r14 extends MovieClip { public var tail:yuan; public function r14(){ super(); } } }//package
Section 263
//r141 (r141) package { import flash.display.*; public dynamic class r141 extends MovieClip { public var tail:yuan; public function r141(){ super(); } } }//package
Section 264
//r1410 (r1410) package { import flash.display.*; public dynamic class r1410 extends MovieClip { public var tail:yuan; public function r1410(){ super(); } } }//package
Section 265
//r142 (r142) package { import flash.display.*; public dynamic class r142 extends MovieClip { public var tail:yuan; public function r142(){ super(); } } }//package
Section 266
//r143 (r143) package { import flash.display.*; public dynamic class r143 extends MovieClip { public var tail:yuan; public function r143(){ super(); } } }//package
Section 267
//r145 (r145) package { import flash.display.*; public dynamic class r145 extends MovieClip { public var tail:yuan; public function r145(){ super(); } } }//package
Section 268
//r147 (r147) package { import flash.display.*; public dynamic class r147 extends MovieClip { public var tail:yuan; public function r147(){ super(); } } }//package
Section 269
//r149 (r149) package { import flash.display.*; public dynamic class r149 extends MovieClip { public var tail:yuan; public function r149(){ super(); } } }//package
Section 270
//r15 (r15) package { import flash.display.*; public dynamic class r15 extends MovieClip { public var tail:yuan; public function r15(){ super(); } } }//package
Section 271
//r151 (r151) package { import flash.display.*; public dynamic class r151 extends MovieClip { public var tail:yuan; public function r151(){ super(); } } }//package
Section 272
//r1510 (r1510) package { import flash.display.*; public dynamic class r1510 extends MovieClip { public var tail:yuan; public function r1510(){ super(); } } }//package
Section 273
//r153 (r153) package { import flash.display.*; public dynamic class r153 extends MovieClip { public var tail:yuan; public function r153(){ super(); } } }//package
Section 274
//r156 (r156) package { import flash.display.*; public dynamic class r156 extends MovieClip { public var tail:yuan; public function r156(){ super(); } } }//package
Section 275
//r157 (r157) package { import flash.display.*; public dynamic class r157 extends MovieClip { public var tail:yuan; public function r157(){ super(); } } }//package
Section 276
//r158 (r158) package { import flash.display.*; public dynamic class r158 extends MovieClip { public var tail:yuan; public function r158(){ super(); } } }//package
Section 277
//r159 (r159) package { import flash.display.*; public dynamic class r159 extends MovieClip { public var tail:yuan; public function r159(){ super(); } } }//package
Section 278
//r21 (r21) package { import flash.display.*; public dynamic class r21 extends MovieClip { public var tail:yuan; public function r21(){ super(); } } }//package
Section 279
//r22 (r22) package { import flash.display.*; public dynamic class r22 extends MovieClip { public var tail:yuan; public function r22(){ super(); } } }//package
Section 280
//r23 (r23) package { import flash.display.*; public dynamic class r23 extends MovieClip { public var tail:yuan; public function r23(){ super(); } } }//package
Section 281
//r24 (r24) package { import flash.display.*; public dynamic class r24 extends MovieClip { public var tail:yuan; public function r24(){ super(); } } }//package
Section 282
//r25 (r25) package { import flash.display.*; public dynamic class r25 extends MovieClip { public var tail:yuan; public function r25(){ super(); } } }//package
Section 283
//r31 (r31) package { import flash.display.*; public dynamic class r31 extends MovieClip { public var tail:yuan; public function r31(){ super(); } } }//package
Section 284
//r32 (r32) package { import flash.display.*; public dynamic class r32 extends MovieClip { public var tail:yuan; public function r32(){ super(); } } }//package
Section 285
//r33 (r33) package { import flash.display.*; public dynamic class r33 extends MovieClip { public var tail:yuan; public function r33(){ super(); } } }//package
Section 286
//r34 (r34) package { import flash.display.*; public dynamic class r34 extends MovieClip { public var tail:yuan; public function r34(){ super(); } } }//package
Section 287
//r35 (r35) package { import flash.display.*; public dynamic class r35 extends MovieClip { public var tail:yuan; public function r35(){ super(); } } }//package
Section 288
//r41 (r41) package { import flash.display.*; public dynamic class r41 extends MovieClip { public var tail:yuan; public function r41(){ super(); } } }//package
Section 289
//r42 (r42) package { import flash.display.*; public dynamic class r42 extends MovieClip { public var tail:yuan; public function r42(){ super(); } } }//package
Section 290
//r43 (r43) package { import flash.display.*; public dynamic class r43 extends MovieClip { public var tail:yuan; public function r43(){ super(); } } }//package
Section 291
//r44 (r44) package { import flash.display.*; public dynamic class r44 extends MovieClip { public var tail:yuan; public function r44(){ super(); } } }//package
Section 292
//r45 (r45) package { import flash.display.*; public dynamic class r45 extends MovieClip { public var tail:yuan; public function r45(){ super(); } } }//package
Section 293
//r46 (r46) package { import flash.display.*; public dynamic class r46 extends MovieClip { public var tail:yuan; public function r46(){ super(); } } }//package
Section 294
//r51 (r51) package { import flash.display.*; public dynamic class r51 extends MovieClip { public var tail:yuan; public function r51(){ super(); } } }//package
Section 295
//r52 (r52) package { import flash.display.*; public dynamic class r52 extends MovieClip { public var tail:yuan; public function r52(){ super(); } } }//package
Section 296
//r53 (r53) package { import flash.display.*; public dynamic class r53 extends MovieClip { public var tail:yuan; public function r53(){ super(); } } }//package
Section 297
//r54 (r54) package { import flash.display.*; public dynamic class r54 extends MovieClip { public var tail:yuan; public function r54(){ super(); } } }//package
Section 298
//r55 (r55) package { import flash.display.*; public dynamic class r55 extends MovieClip { public var tail:yuan; public function r55(){ super(); } } }//package
Section 299
//r56 (r56) package { import flash.display.*; public dynamic class r56 extends MovieClip { public var tail:yuan; public function r56(){ super(); } } }//package
Section 300
//r61 (r61) package { import flash.display.*; public dynamic class r61 extends MovieClip { public var tail:yuan; public function r61(){ super(); } } }//package
Section 301
//r62 (r62) package { import flash.display.*; public dynamic class r62 extends MovieClip { public var tail:yuan; public function r62(){ super(); } } }//package
Section 302
//r63 (r63) package { import flash.display.*; public dynamic class r63 extends MovieClip { public var tail:yuan; public function r63(){ super(); } } }//package
Section 303
//r64 (r64) package { import flash.display.*; public dynamic class r64 extends MovieClip { public var tail:yuan; public function r64(){ super(); } } }//package
Section 304
//r65 (r65) package { import flash.display.*; public dynamic class r65 extends MovieClip { public var tail:yuan; public function r65(){ super(); } } }//package
Section 305
//r66 (r66) package { import flash.display.*; public dynamic class r66 extends MovieClip { public var tail:yuan; public function r66(){ super(); } } }//package
Section 306
//r71 (r71) package { import flash.display.*; public dynamic class r71 extends MovieClip { public var tail:yuan; public function r71(){ super(); } } }//package
Section 307
//r72 (r72) package { import flash.display.*; public dynamic class r72 extends MovieClip { public var tail:yuan; public function r72(){ super(); } } }//package
Section 308
//r73 (r73) package { import flash.display.*; public dynamic class r73 extends MovieClip { public var tail:yuan; public function r73(){ super(); } } }//package
Section 309
//r74 (r74) package { import flash.display.*; public dynamic class r74 extends MovieClip { public var tail:yuan; public function r74(){ super(); } } }//package
Section 310
//r75 (r75) package { import flash.display.*; public dynamic class r75 extends MovieClip { public var tail:yuan; public function r75(){ super(); } } }//package
Section 311
//r76 (r76) package { import flash.display.*; public dynamic class r76 extends MovieClip { public var tail:yuan; public function r76(){ super(); } } }//package
Section 312
//r81 (r81) package { import flash.display.*; public dynamic class r81 extends MovieClip { public var tail:yuan; public function r81(){ super(); } } }//package
Section 313
//r82 (r82) package { import flash.display.*; public dynamic class r82 extends MovieClip { public var tail:yuan; public function r82(){ super(); } } }//package
Section 314
//r83 (r83) package { import flash.display.*; public dynamic class r83 extends MovieClip { public var tail:yuan; public function r83(){ super(); } } }//package
Section 315
//r84 (r84) package { import flash.display.*; public dynamic class r84 extends MovieClip { public var tail:yuan; public function r84(){ super(); } } }//package
Section 316
//r85 (r85) package { import flash.display.*; public dynamic class r85 extends MovieClip { public var tail:yuan; public function r85(){ super(); } } }//package
Section 317
//r86 (r86) package { import flash.display.*; public dynamic class r86 extends MovieClip { public var tail:yuan; public function r86(){ super(); } } }//package
Section 318
//r91 (r91) package { import flash.display.*; public dynamic class r91 extends MovieClip { public var tail:yuan; public function r91(){ super(); } } }//package
Section 319
//r92 (r92) package { import flash.display.*; public dynamic class r92 extends MovieClip { public var tail:yuan; public function r92(){ super(); } } }//package
Section 320
//r93 (r93) package { import flash.display.*; public dynamic class r93 extends MovieClip { public var tail:yuan; public function r93(){ super(); } } }//package
Section 321
//r94 (r94) package { import flash.display.*; public dynamic class r94 extends MovieClip { public var tail:yuan; public function r94(){ super(); } } }//package
Section 322
//r95 (r95) package { import flash.display.*; public dynamic class r95 extends MovieClip { public var tail:yuan; public function r95(){ super(); } } }//package
Section 323
//r96 (r96) package { import flash.display.*; public dynamic class r96 extends MovieClip { public var tail:yuan; public function r96(){ super(); } } }//package
Section 324
//run_sd (run_sd) package { import flash.media.*; public dynamic class run_sd extends Sound { public function run_sd(){ super(); } } }//package
Section 325
//Sellv (Sellv) package { import flash.display.*; public dynamic class Sellv extends MovieClip { public var back_btn:SimpleButton; public var moregame_btn:SimpleButton; public var s1:SimpleButton; public var s5:MovieClip; public var s6:MovieClip; public var s8:MovieClip; public var s7:SimpleButton; public var s9:MovieClip; public var s2:MovieClip; public var s4:SimpleButton; public var s3:MovieClip; public var s10:SimpleButton; public var s11:MovieClip; public var s12:MovieClip; public var s13:SimpleButton; public var s14:MovieClip; public var s15:MovieClip; public function Sellv(){ super(); } } }//package
Section 326
//Selstage (Selstage) package { import flash.display.*; public dynamic class Selstage extends MovieClip { public var stage3:MovieClip; public var moregame_btn:SimpleButton; public var stage1:SimpleButton; public var word:MovieClip; public var ach_btn:SimpleButton; public var stage5:MovieClip; public var stage2:MovieClip; public var quit_btn:SimpleButton; public var shop_btn:SimpleButton; public var p1:MovieClip; public var p2:MovieClip; public var stage4:MovieClip; public function Selstage(){ super(); } } }//package
Section 327
//Shipdie (Shipdie) package { import flash.display.*; public dynamic class Shipdie extends MovieClip { public function Shipdie(){ super(); addFrameScript(54, frame55); } function frame55(){ stop(); } } }//package
Section 328
//Shop (Shop) package { import flash.display.*; public dynamic class Shop extends MovieClip { public var back_btn:SimpleButton; public var moregame_btn:SimpleButton; public var b2:SimpleButton; public var b4:SimpleButton; public var b5:SimpleButton; public var b1:SimpleButton; public var b3:SimpleButton; public var word:MovieClip; public var s1:MovieClip; public var s2:MovieClip; public var s4:MovieClip; public var s5:MovieClip; public var t2:MovieClip; public var t1:MovieClip; public var m0:MovieClip; public var s3:MovieClip; public var m1:MovieClip; public var m3:MovieClip; public var m4:MovieClip; public var m5:MovieClip; public var t:MovieClip; public var m2:MovieClip; public function Shop(){ super(); } } }//package
Section 329
//Suc (Suc) package { import flash.display.*; public dynamic class Suc extends MovieClip { public function Suc(){ super(); } } }//package
Section 330
//Succeed (Succeed) package { import flash.display.*; public dynamic class Succeed extends MovieClip { public var back_btn:SimpleButton; public var word:MovieClip; public var con:MovieClip; public function Succeed(){ super(); } } }//package
Section 331
//train1 (train1) package { import flash.display.*; public dynamic class train1 extends MovieClip { public var anchor1:MovieClip; public var anchor2:MovieClip; public var l1:MovieClip; public var l3:MovieClip; public var l2:MovieClip; public var yan1:MovieClip; public var di:MovieClip; public var yan3:MovieClip; public var yan2:MovieClip; public var head:MovieClip; public function train1(){ super(); } } }//package
Section 332
//train2 (train2) package { import flash.display.*; public dynamic class train2 extends MovieClip { public var anchor1:MovieClip; public var anchor2:MovieClip; public var l1:MovieClip; public var l3:MovieClip; public var l2:MovieClip; public var yan1:MovieClip; public var di:MovieClip; public var yan3:MovieClip; public var yan2:MovieClip; public var head:MovieClip; public function train2(){ super(); } } }//package
Section 333
//train3 (train3) package { import flash.display.*; public dynamic class train3 extends MovieClip { public var anchor1:MovieClip; public var anchor2:MovieClip; public var l1:MovieClip; public var l3:MovieClip; public var l2:MovieClip; public var yan1:MovieClip; public var di:MovieClip; public var yan3:MovieClip; public var yan2:MovieClip; public var head:MovieClip; public function train3(){ super(); } } }//package
Section 334
//train4 (train4) package { import flash.display.*; public dynamic class train4 extends MovieClip { public var anchor1:MovieClip; public var anchor2:MovieClip; public var l1:MovieClip; public var l3:MovieClip; public var l2:MovieClip; public var yan1:MovieClip; public var di:MovieClip; public var yan3:MovieClip; public var yan2:MovieClip; public var head:MovieClip; public function train4(){ super(); } } }//package
Section 335
//UIBGM (UIBGM) package { import flash.media.*; public dynamic class UIBGM extends Sound { public function UIBGM(){ super(); } } }//package
Section 336
//Whiteyan (Whiteyan) package { import flash.display.*; public dynamic class Whiteyan extends MovieClip { public function Whiteyan(){ super(); addFrameScript(20, frame21); } function frame21(){ stop(); } } }//package
Section 337
//Win (Win) package { import flash.display.*; public dynamic class Win extends MovieClip { public var moregame_btn:SimpleButton; public var next_btn:SimpleButton; public var s1:MovieClip; public var s0:MovieClip; public var c0:MovieClip; public var c1:MovieClip; public var s4:MovieClip; public var t0:MovieClip; public var t2:MovieClip; public var t3:MovieClip; public var t1:MovieClip; public var s2:MovieClip; public var retry_btn:SimpleButton; public var s3:MovieClip; public var m0:MovieClip; public var m1:MovieClip; public var m3:MovieClip; public var m4:MovieClip; public var m5:MovieClip; public var menu_btn:SimpleButton; public var m2:MovieClip; public var w0:MovieClip; public var w1:MovieClip; public var w2:MovieClip; public var shop_btn:SimpleButton; public var w3:MovieClip; public function Win(){ super(); } } }//package
Section 338
//win_sd (win_sd) package { import flash.media.*; public dynamic class win_sd extends Sound { public function win_sd(){ super(); } } }//package
Section 339
//wu_sd (wu_sd) package { import flash.media.*; public dynamic class wu_sd extends Sound { public function wu_sd(){ super(); } } }//package
Section 340
//yuan (yuan) package { import flash.display.*; public dynamic class yuan extends MovieClip { public function yuan(){ super(); } } }//package

Library Items

Symbol 1 GraphicUsed by:Timeline
Symbol 2 BitmapUsed by:3 6 7 17
Symbol 3 GraphicUses:2Used by:19
Symbol 4 GraphicUsed by:5
Symbol 5 ButtonUses:4Used by:19
Symbol 6 GraphicUses:2Used by:19
Symbol 7 GraphicUses:2Used by:19
Symbol 8 GraphicUsed by:9
Symbol 9 MovieClipUses:8Used by:19
Symbol 10 SoundUsed by:19
Symbol 11 GraphicUsed by:19
Symbol 12 SoundUsed by:19
Symbol 13 GraphicUsed by:19
Symbol 14 ShapeTweeningUsed by:16
Symbol 15 GraphicUsed by:16
Symbol 16 MovieClipUses:14 15Used by:19
Symbol 17 GraphicUses:2Used by:18
Symbol 18 MovieClipUses:17Used by:19
Symbol 19 MovieClip {CoalExpress4_fla.logo_animation_2}Uses:3 5 6 7 9 10 11 12 13 16 18 SS1Used by:30
Symbol 20 GraphicUsed by:30
Symbol 21 GraphicUsed by:22
Symbol 22 MovieClipUses:21Used by:30
Symbol 23 GraphicUsed by:28 29 30
Symbol 24 GraphicUsed by:30
Symbol 25 ShapeTweeningUsed by:30
Symbol 26 GraphicUsed by:30
Symbol 27 GraphicUsed by:28 29
Symbol 28 ButtonUses:23 27Used by:30
Symbol 29 ButtonUses:23 27Used by:30
Symbol 30 MovieClip {CoalExpress4_fla.Timeline_1}Uses:19 20 22 23 24 25 26 28 29Used by:Timeline
Symbol 31 GraphicUsed by:32 419
Symbol 32 MovieClip {yuan}Uses:31Used by:41 87 123 130 137 418 948 951 957 961 970 974 981 985 989 991 993 998 1000 1002 1004 1007 1010 1013 1016 1019 1021 1023 1025 1027 1032 1035 1042 1045 1048 1051 1055 1058 1061 1064 1067 1070 1073 1075 1078 1081 1084 1087 1091 1095 1099 1103 1107 1112 1116 1120 1123 1127 1130 1134 1137 1142 1147 1152 1157 1162 1169 1173 1177 1181 1185 1189 1193 1197 1201 1205 1209 1213 1217 1221 1224 1228 1232 1236 1240 1244 1246 1248 1250 1252 1254 1256 1258 1260 1262 1264 1266 1268 1270 1283 1285 1287 1289 1291 1293 1295 1297 1298
Symbol 33 GraphicUsed by:34 167 367 372 378 382 387 393 397 402 415 423 433 440
Symbol 34 MovieClip {fang}Uses:33Used by:37 49 52 55 58 61 64 67 70 73 75 84 85 89 92 93 96 97 100 106 109 110 118 119 121 128 135 142 168 173 178 183 366 369 375 381 384 390 396 399 411 414 415 420 425 432 436 439 448 948 951 957 961 970 974 981 985 989 991 993 998 1000 1002 1004 1007 1010 1013 1016 1019 1021 1023 1025 1027 1032 1035 1042 1045 1048 1051 1055 1058 1061 1064 1067 1070 1073 1075 1078 1081 1084 1087 1091 1095 1099 1103 1107 1112 1116 1120 1123 1127 1130 1134 1137 1142 1147 1152 1157 1162 1169 1173 1177 1181 1185 1189 1193 1197 1201 1205 1209 1213 1217 1221 1224 1228 1232 1236 1240 1244 1246 1248 1250 1252 1254 1256 1258 1260 1262 1264 1266 1268 1270 1283 1285 1287 1289 1291 1293 1295 1297
Symbol 35 GraphicUsed by:36
Symbol 36 MovieClipUses:35Used by:37 121 128 135 142 168 173 178 183
Symbol 37 MovieClip {anchor}Uses:34 36Used by:1298
Symbol 38 GraphicUsed by:39
Symbol 39 MovieClip {Blackyan}Uses:38Used by:1298
Symbol 40 GraphicUsed by:41 528 529 596
Symbol 41 MovieClipUses:32 40Used by:121 168
Symbol 42 GraphicUsed by:43
Symbol 43 MovieClipUses:42Used by:121
Symbol 44 GraphicUsed by:45 545 573
Symbol 45 MovieClipUses:44Used by:121
Symbol 46 GraphicUsed by:47
Symbol 47 MovieClipUses:46Used by:121 128 135 142 948 957 970 981 989
Symbol 48 GraphicUsed by:49
Symbol 49 MovieClipUses:34 48Used by:120
Symbol 50 BitmapUsed by:51
Symbol 51 GraphicUses:50Used by:52
Symbol 52 MovieClipUses:34 51Used by:120
Symbol 53 BitmapUsed by:54
Symbol 54 GraphicUses:53Used by:55
Symbol 55 MovieClipUses:34 54Used by:120
Symbol 56 BitmapUsed by:57
Symbol 57 GraphicUses:56Used by:58
Symbol 58 MovieClipUses:34 57Used by:120
Symbol 59 BitmapUsed by:60
Symbol 60 GraphicUses:59Used by:61
Symbol 61 MovieClipUses:34 60Used by:120
Symbol 62 BitmapUsed by:63
Symbol 63 GraphicUses:62Used by:64
Symbol 64 MovieClipUses:34 63Used by:120
Symbol 65 BitmapUsed by:66
Symbol 66 GraphicUses:65Used by:67
Symbol 67 MovieClipUses:66 34Used by:120
Symbol 68 BitmapUsed by:69
Symbol 69 GraphicUses:68Used by:70
Symbol 70 MovieClipUses:69 34Used by:120
Symbol 71 GraphicUsed by:72
Symbol 72 MovieClipUses:71Used by:73 75 411 415
Symbol 73 MovieClip {CoalExpress4_fla.Timeline_31}Uses:34 72Used by:85
Symbol 74 GraphicUsed by:75 93 110 411 425 448
Symbol 75 MovieClip {CoalExpress4_fla.Timeline_33}Uses:34 72 74Used by:85
Symbol 76 GraphicUsed by:84
Symbol 77 GraphicUsed by:84
Symbol 78 GraphicUsed by:84
Symbol 79 GraphicUsed by:84
Symbol 80 GraphicUsed by:84
Symbol 81 GraphicUsed by:84
Symbol 82 GraphicUsed by:84
Symbol 83 GraphicUsed by:84 411
Symbol 84 MovieClip {CoalExpress4_fla.Timeline_34}Uses:34 76 77 78 79 80 81 82 83Used by:85
Symbol 85 MovieClip {CoalExpress4_fla.9_30}Uses:73 34 75 84Used by:120
Symbol 86 GraphicUsed by:87
Symbol 87 MovieClipUses:32 86Used by:120
Symbol 88 GraphicUsed by:89 420 423
Symbol 89 MovieClipUses:34 88Used by:120
Symbol 90 GraphicUsed by:91
Symbol 91 MovieClipUses:90Used by:92 93 96 425
Symbol 92 MovieClip {CoalExpress4_fla.Timeline_38}Uses:34 91Used by:97
Symbol 93 MovieClip {CoalExpress4_fla.Timeline_40}Uses:34 91 74Used by:97
Symbol 94 GraphicUsed by:95
Symbol 95 MovieClipUses:94Used by:96 425
Symbol 96 MovieClip {CoalExpress4_fla.Timeline_41}Uses:34 91 95Used by:97
Symbol 97 MovieClip {CoalExpress4_fla.12_37}Uses:92 34 93 96Used by:120
Symbol 98 BitmapUsed by:99
Symbol 99 GraphicUses:98Used by:100
Symbol 100 MovieClipUses:99 34Used by:120
Symbol 101 GraphicUsed by:106
Symbol 102 GraphicUsed by:106
Symbol 103 GraphicUsed by:104
Symbol 104 MovieClipUses:103Used by:105
Symbol 105 MovieClip {CoalExpress4_fla.05_45}Uses:104Used by:106 436
Symbol 106 MovieClip {CoalExpress4_fla.14_44}Uses:101 34 102 105Used by:120
Symbol 107 GraphicUsed by:108
Symbol 108 MovieClipUses:107Used by:109 110 448
Symbol 109 MovieClip {CoalExpress4_fla.Timeline_48}Uses:34 108Used by:119
Symbol 110 MovieClip {CoalExpress4_fla.Timeline_50}Uses:34 108 74Used by:119
Symbol 111 GraphicUsed by:118
Symbol 112 GraphicUsed by:118
Symbol 113 GraphicUsed by:118
Symbol 114 GraphicUsed by:118
Symbol 115 GraphicUsed by:118
Symbol 116 GraphicUsed by:118
Symbol 117 GraphicUsed by:118 448
Symbol 118 MovieClip {CoalExpress4_fla.Timeline_51}Uses:34 111 112 113 114 115 116 117Used by:119
Symbol 119 MovieClip {CoalExpress4_fla.15_47}Uses:34 109 110 118Used by:120
Symbol 120 MovieClip {CoalExpress4_fla.Timeline_21}Uses:49 52 55 58 61 64 67 70 85 87 89 97 100 106 119Used by:121 128 135 142
Symbol 121 MovieClip {box1}Uses:41 43 45 47 36 120 34Used by:1298
Symbol 122 GraphicUsed by:123 532 597 599
Symbol 123 MovieClipUses:32 122Used by:128 173
Symbol 124 GraphicUsed by:125
Symbol 125 MovieClipUses:124Used by:128
Symbol 126 GraphicUsed by:127
Symbol 127 MovieClipUses:126Used by:128
Symbol 128 MovieClip {box2}Uses:123 125 127 47 36 120 34Used by:1298
Symbol 129 GraphicUsed by:130 536 600 602
Symbol 130 MovieClipUses:32 129Used by:135 178
Symbol 131 GraphicUsed by:132
Symbol 132 MovieClipUses:131Used by:135
Symbol 133 GraphicUsed by:134
Symbol 134 MovieClipUses:133Used by:135
Symbol 135 MovieClip {box3}Uses:130 132 134 47 36 120 34Used by:1298
Symbol 136 GraphicUsed by:137 540 603 604
Symbol 137 MovieClipUses:32 136Used by:142 183
Symbol 138 GraphicUsed by:139
Symbol 139 MovieClipUses:138Used by:142
Symbol 140 GraphicUsed by:141
Symbol 141 MovieClipUses:140Used by:142
Symbol 142 MovieClip {box4}Uses:137 139 141 47 36 120 34Used by:1298
Symbol 143 GraphicUsed by:144
Symbol 144 MovieClipUses:143Used by:162
Symbol 145 GraphicUsed by:162
Symbol 146 GraphicUsed by:162
Symbol 147 GraphicUsed by:162
Symbol 148 GraphicUsed by:162
Symbol 149 GraphicUsed by:162
Symbol 150 GraphicUsed by:162
Symbol 151 GraphicUsed by:162
Symbol 152 GraphicUsed by:162
Symbol 153 GraphicUsed by:162
Symbol 154 GraphicUsed by:162
Symbol 155 GraphicUsed by:162
Symbol 156 GraphicUsed by:162
Symbol 157 GraphicUsed by:162
Symbol 158 GraphicUsed by:162
Symbol 159 GraphicUsed by:162
Symbol 160 GraphicUsed by:162
Symbol 161 GraphicUsed by:162
Symbol 162 MovieClip {Shipdie}Uses:144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161Used by:1298
Symbol 163 GraphicUsed by:164
Symbol 164 MovieClipUses:163Used by:168
Symbol 165 GraphicUsed by:166
Symbol 166 MovieClipUses:165Used by:168
Symbol 167 MovieClipUses:33Used by:168 173 178 183 941
Symbol 168 MovieClip {train1}Uses:41 164 166 167 36 34Used by:1298
Symbol 169 GraphicUsed by:170 543 559 563
Symbol 170 MovieClipUses:169Used by:173
Symbol 171 GraphicUsed by:172
Symbol 172 MovieClipUses:171Used by:173
Symbol 173 MovieClip {train2}Uses:123 170 172 167 36 34Used by:1298
Symbol 174 GraphicUsed by:175
Symbol 175 MovieClipUses:174Used by:178
Symbol 176 GraphicUsed by:177
Symbol 177 MovieClipUses:176Used by:178
Symbol 178 MovieClip {train3}Uses:130 175 177 167 36 34Used by:1298
Symbol 179 GraphicUsed by:180
Symbol 180 MovieClipUses:179Used by:183
Symbol 181 GraphicUsed by:182
Symbol 182 MovieClipUses:181Used by:183
Symbol 183 MovieClip {train4}Uses:137 180 182 167 36 34Used by:1298
Symbol 184 GraphicUsed by:185
Symbol 185 MovieClipUses:184Used by:186
Symbol 186 MovieClipUses:185Used by:187
Symbol 187 MovieClip {Whiteyan}Uses:186Used by:1298
Symbol 188 BitmapUsed by:189
Symbol 189 GraphicUses:188Used by:213
Symbol 190 GraphicUsed by:196 200 204 208 212 218 222 227 333 338 457 461 511 515 521 762 888 913 917
Symbol 191 GraphicUsed by:196
Symbol 192 GraphicUsed by:195 196
Symbol 193 GraphicUsed by:195
Symbol 194 GraphicUsed by:195
Symbol 195 MovieClipUses:192 193 194Used by:196
Symbol 196 ButtonUses:190 191 195 192Used by:213
Symbol 197 GraphicUsed by:200
Symbol 198 GraphicUsed by:200
Symbol 199 GraphicUsed by:200
Symbol 200 ButtonUses:190 197 198 199Used by:213
Symbol 201 GraphicUsed by:204
Symbol 202 GraphicUsed by:204
Symbol 203 GraphicUsed by:204
Symbol 204 ButtonUses:190 201 202 203Used by:213
Symbol 205 GraphicUsed by:208
Symbol 206 GraphicUsed by:208
Symbol 207 GraphicUsed by:208
Symbol 208 ButtonUses:190 205 206 207Used by:213
Symbol 209 GraphicUsed by:212
Symbol 210 GraphicUsed by:212
Symbol 211 GraphicUsed by:212
Symbol 212 ButtonUses:190 209 210 211Used by:213
Symbol 213 MovieClip {Cover}Uses:189 196 200 204 208 212Used by:1298
Symbol 214 GraphicUsed by:229
Symbol 215 GraphicUsed by:218
Symbol 216 GraphicUsed by:218
Symbol 217 GraphicUsed by:218
Symbol 218 ButtonUses:190 215 216 217Used by:229
Symbol 219 GraphicUsed by:222
Symbol 220 GraphicUsed by:222
Symbol 221 GraphicUsed by:222
Symbol 222 ButtonUses:190 219 220 221Used by:229
Symbol 223 GraphicUsed by:229
Symbol 224 GraphicUsed by:227
Symbol 225 GraphicUsed by:227
Symbol 226 GraphicUsed by:227
Symbol 227 ButtonUses:190 224 225 226Used by:229 923
Symbol 228 GraphicUsed by:229
Symbol 229 MovieClip {Gameovermc}Uses:214 218 222 223 227 228Used by:1298
Symbol 230 GraphicUsed by:233
Symbol 231 GraphicUsed by:233
Symbol 232 GraphicUsed by:233
Symbol 233 ButtonUses:230 231 232Used by:305
Symbol 234 GraphicUsed by:237
Symbol 235 GraphicUsed by:237
Symbol 236 GraphicUsed by:237
Symbol 237 ButtonUses:234 235 236Used by:305
Symbol 238 GraphicUsed by:241
Symbol 239 GraphicUsed by:241
Symbol 240 GraphicUsed by:241
Symbol 241 ButtonUses:238 239 240Used by:247
Symbol 242 GraphicUsed by:246
Symbol 243 GraphicUsed by:246
Symbol 244 GraphicUsed by:246 322
Symbol 245 GraphicUsed by:246
Symbol 246 ButtonUses:242 243 244 245Used by:247
Symbol 247 MovieClip {CoalExpress4_fla.Timeline_96}Uses:241 246Used by:305
Symbol 248 GraphicUsed by:251
Symbol 249 GraphicUsed by:251
Symbol 250 GraphicUsed by:251 326
Symbol 251 ButtonUses:248 249 250Used by:256
Symbol 252 GraphicUsed by:255 328
Symbol 253 GraphicUsed by:255 328
Symbol 254 GraphicUsed by:255
Symbol 255 ButtonUses:252 253 254Used by:256
Symbol 256 MovieClip {CoalExpress4_fla.Timeline_99}Uses:251 255Used by:305
Symbol 257 GraphicUsed by:267
Symbol 258 GraphicUsed by:267
Symbol 259 GraphicUsed by:267
Symbol 260 GraphicUsed by:267
Symbol 261 GraphicUsed by:267
Symbol 262 GraphicUsed by:267
Symbol 263 GraphicUsed by:267
Symbol 264 GraphicUsed by:267
Symbol 265 GraphicUsed by:267
Symbol 266 GraphicUsed by:267
Symbol 267 MovieClipUses:257 258 259 260 261 262 263 264 265 266Used by:305
Symbol 268 GraphicUsed by:305
Symbol 269 GraphicUsed by:305
Symbol 270 GraphicUsed by:287
Symbol 271 GraphicUsed by:272
Symbol 272 MovieClipUses:271Used by:287
Symbol 273 GraphicUsed by:285
Symbol 274 GraphicUsed by:285
Symbol 275 GraphicUsed by:285
Symbol 276 GraphicUsed by:285
Symbol 277 GraphicUsed by:285
Symbol 278 GraphicUsed by:285
Symbol 279 GraphicUsed by:285
Symbol 280 GraphicUsed by:285
Symbol 281 GraphicUsed by:285
Symbol 282 GraphicUsed by:285
Symbol 283 GraphicUsed by:285
Symbol 284 GraphicUsed by:285
Symbol 285 MovieClipUses:273 274 275 276 277 278 279 280 281 282 283 284Used by:287
Symbol 286 GraphicUsed by:287
Symbol 287 MovieClip {CoalExpress4_fla.Timeline_103}Uses:270 272 285 286Used by:305
Symbol 288 GraphicUsed by:305
Symbol 289 GraphicUsed by:305
Symbol 290 GraphicUsed by:304
Symbol 291 GraphicUsed by:301
Symbol 292 GraphicUsed by:301
Symbol 293 GraphicUsed by:301
Symbol 294 GraphicUsed by:301
Symbol 295 GraphicUsed by:301
Symbol 296 GraphicUsed by:301
Symbol 297 GraphicUsed by:301
Symbol 298 GraphicUsed by:301
Symbol 299 GraphicUsed by:301
Symbol 300 GraphicUsed by:301
Symbol 301 MovieClipUses:291 292 293 294 295 296 297 298 299 300Used by:304
Symbol 302 GraphicUsed by:303
Symbol 303 MovieClipUses:302Used by:304
Symbol 304 MovieClip {CoalExpress4_fla.Timeline_106}Uses:290 301 303Used by:305
Symbol 305 MovieClip {Gameui}Uses:233 237 247 256 267 268 269 287 288 289 304Used by:1298
Symbol 306 GraphicUsed by:341
Symbol 307 GraphicUsed by:310
Symbol 308 GraphicUsed by:310
Symbol 309 GraphicUsed by:310
Symbol 310 ButtonUses:307 308 309Used by:341
Symbol 311 GraphicUsed by:314
Symbol 312 GraphicUsed by:314
Symbol 313 GraphicUsed by:314
Symbol 314 ButtonUses:311 312 313Used by:341
Symbol 315 GraphicUsed by:318
Symbol 316 GraphicUsed by:318
Symbol 317 GraphicUsed by:318
Symbol 318 ButtonUses:315 316 317Used by:323
Symbol 319 GraphicUsed by:322
Symbol 320 GraphicUsed by:322
Symbol 321 GraphicUsed by:322
Symbol 322 ButtonUses:319 320 244 321Used by:323
Symbol 323 MovieClip {CoalExpress4_fla.Timeline_112}Uses:318 322Used by:341
Symbol 324 GraphicUsed by:326
Symbol 325 GraphicUsed by:326
Symbol 326 ButtonUses:324 325 250Used by:329
Symbol 327 GraphicUsed by:328
Symbol 328 ButtonUses:252 253 327Used by:329
Symbol 329 MovieClip {CoalExpress4_fla.Timeline_115}Uses:326 328Used by:341
Symbol 330 GraphicUsed by:333
Symbol 331 GraphicUsed by:333
Symbol 332 GraphicUsed by:333
Symbol 333 ButtonUses:190 330 331 332Used by:341
Symbol 334 GraphicUsed by:341
Symbol 335 GraphicUsed by:338
Symbol 336 GraphicUsed by:338
Symbol 337 GraphicUsed by:338
Symbol 338 ButtonUses:190 335 336 337Used by:341 525 836 923
Symbol 339 GraphicUsed by:341
Symbol 340 GraphicUsed by:341
Symbol 341 MovieClip {Howtoplay}Uses:306 310 314 323 329 333 334 338 339 340Used by:1298
Symbol 342 GraphicUsed by:359
Symbol 343 BitmapUsed by:344
Symbol 344 GraphicUses:343Used by:353
Symbol 345 BitmapUsed by:346
Symbol 346 GraphicUses:345Used by:353
Symbol 347 BitmapUsed by:348
Symbol 348 GraphicUses:347Used by:353
Symbol 349 BitmapUsed by:350
Symbol 350 GraphicUses:349Used by:353
Symbol 351 BitmapUsed by:352
Symbol 352 GraphicUses:351Used by:353
Symbol 353 MovieClipUses:344 346 348 350 352Used by:359
Symbol 354 GraphicUsed by:358
Symbol 355 GraphicUsed by:358
Symbol 356 GraphicUsed by:358
Symbol 357 GraphicUsed by:358
Symbol 358 MovieClipUses:354 355 356 357Used by:359
Symbol 359 MovieClip {Loadingmc}Uses:342 353 358Used by:1298
Symbol 360 BitmapUsed by:361
Symbol 361 GraphicUses:360Used by:478
Symbol 362 GraphicUsed by:478
Symbol 363 GraphicUsed by:478 517
Symbol 364 GraphicUsed by:478
Symbol 365 GraphicUsed by:366 367
Symbol 366 MovieClipUses:34 365Used by:367
Symbol 367 ButtonUses:366 33 365Used by:478
Symbol 368 GraphicUsed by:369 372
Symbol 369 MovieClipUses:34 368Used by:371 373
Symbol 370 GraphicUsed by:373
Symbol 371 MovieClipUses:369Used by:372
Symbol 372 ButtonUses:371 33 368Used by:373
Symbol 373 MovieClip {CoalExpress4_fla.Timeline_126}Uses:369 370 372Used by:478
Symbol 374 GraphicUsed by:375 378
Symbol 375 MovieClipUses:34 374Used by:377 379
Symbol 376 GraphicUsed by:379
Symbol 377 MovieClipUses:375Used by:378
Symbol 378 ButtonUses:377 33 374Used by:379
Symbol 379 MovieClip {CoalExpress4_fla.Timeline_130}Uses:375 376 378Used by:478
Symbol 380 GraphicUsed by:381 382
Symbol 381 MovieClipUses:34 380Used by:382
Symbol 382 ButtonUses:381 33 380Used by:478
Symbol 383 GraphicUsed by:384 387
Symbol 384 MovieClipUses:34 383Used by:386 388
Symbol 385 GraphicUsed by:388
Symbol 386 MovieClipUses:384Used by:387
Symbol 387 ButtonUses:386 33 383Used by:388
Symbol 388 MovieClip {CoalExpress4_fla.Timeline_136}Uses:384 385 387Used by:478
Symbol 389 GraphicUsed by:390 393
Symbol 390 MovieClipUses:34 389Used by:392 394
Symbol 391 GraphicUsed by:394
Symbol 392 MovieClipUses:390Used by:393
Symbol 393 ButtonUses:392 33 389Used by:394
Symbol 394 MovieClip {CoalExpress4_fla.Timeline_140}Uses:390 391 393Used by:478
Symbol 395 GraphicUsed by:396 397
Symbol 396 MovieClipUses:34 395Used by:397
Symbol 397 ButtonUses:396 33 395Used by:478
Symbol 398 GraphicUsed by:399 402
Symbol 399 MovieClipUses:34 398Used by:401 403
Symbol 400 GraphicUsed by:403
Symbol 401 MovieClipUses:399Used by:402
Symbol 402 ButtonUses:401 33 398Used by:403
Symbol 403 MovieClip {CoalExpress4_fla.Timeline_146}Uses:399 400 402Used by:478
Symbol 404 GraphicUsed by:411
Symbol 405 GraphicUsed by:411
Symbol 406 GraphicUsed by:411
Symbol 407 GraphicUsed by:411
Symbol 408 GraphicUsed by:411
Symbol 409 GraphicUsed by:411
Symbol 410 GraphicUsed by:411
Symbol 411 MovieClip {CoalExpress4_fla.03_151}Uses:34 72 74 404 405 406 407 408 409 410 83Used by:416
Symbol 412 GraphicUsed by:416
Symbol 413 GraphicUsed by:414 415
Symbol 414 MovieClipUses:413 34Used by:415
Symbol 415 ButtonUses:34 72 414 413 33Used by:416
Symbol 416 MovieClip {CoalExpress4_fla.Timeline_150}Uses:411 412 415Used by:478
Symbol 417 GraphicUsed by:418 419
Symbol 418 MovieClipUses:32 417Used by:419
Symbol 419 ButtonUses:418 31 417Used by:478
Symbol 420 MovieClipUses:34 88Used by:422 424
Symbol 421 GraphicUsed by:424
Symbol 422 MovieClipUses:420Used by:423
Symbol 423 ButtonUses:422 33 88Used by:424
Symbol 424 MovieClip {CoalExpress4_fla.Timeline_156}Uses:420 421 423Used by:478
Symbol 425 MovieClip {CoalExpress4_fla.04_161}Uses:34 91 74 95Used by:430
Symbol 426 GraphicUsed by:430
Symbol 427 GraphicUsed by:428 429
Symbol 428 MovieClipUses:427Used by:429
Symbol 429 ButtonUses:428 427Used by:430
Symbol 430 MovieClip {CoalExpress4_fla.Timeline_160}Uses:425 426 429Used by:478
Symbol 431 GraphicUsed by:432 433
Symbol 432 MovieClipUses:34 431Used by:433
Symbol 433 ButtonUses:432 33 431Used by:478
Symbol 434 GraphicUsed by:436
Symbol 435 GraphicUsed by:436
Symbol 436 MovieClip {CoalExpress4_fla.05_167}Uses:434 34 435 105Used by:441
Symbol 437 GraphicUsed by:441
Symbol 438 GraphicUsed by:439 440
Symbol 439 MovieClipUses:438 34Used by:440
Symbol 440 ButtonUses:439 438 33Used by:441
Symbol 441 MovieClip {CoalExpress4_fla.Timeline_166}Uses:436 437 440Used by:478
Symbol 442 GraphicUsed by:448
Symbol 443 GraphicUsed by:448
Symbol 444 GraphicUsed by:448
Symbol 445 GraphicUsed by:448
Symbol 446 GraphicUsed by:448
Symbol 447 GraphicUsed by:448
Symbol 448 MovieClip {CoalExpress4_fla.05_171}Uses:34 108 74 442 443 444 445 446 447 117Used by:453
Symbol 449 GraphicUsed by:453
Symbol 450 GraphicUsed by:451 452
Symbol 451 MovieClipUses:450Used by:452
Symbol 452 ButtonUses:451 450Used by:453
Symbol 453 MovieClip {CoalExpress4_fla.Timeline_170}Uses:448 449 452Used by:478
Symbol 454 GraphicUsed by:457
Symbol 455 GraphicUsed by:457
Symbol 456 GraphicUsed by:457
Symbol 457 ButtonUses:190 454 455 456Used by:478
Symbol 458 GraphicUsed by:461
Symbol 459 GraphicUsed by:461
Symbol 460 GraphicUsed by:461
Symbol 461 ButtonUses:190 458 459 460Used by:478
Symbol 462 BitmapUsed by:463
Symbol 463 GraphicUses:462Used by:478
Symbol 464 GraphicUsed by:478 517
Symbol 465 GraphicUsed by:478
Symbol 466 BitmapUsed by:467
Symbol 467 GraphicUses:466Used by:478
Symbol 468 GraphicUsed by:478 517
Symbol 469 GraphicUsed by:478
Symbol 470 BitmapUsed by:471
Symbol 471 GraphicUses:470Used by:478
Symbol 472 GraphicUsed by:478 517
Symbol 473 GraphicUsed by:478
Symbol 474 BitmapUsed by:475
Symbol 475 GraphicUses:474Used by:478
Symbol 476 GraphicUsed by:478 517
Symbol 477 GraphicUsed by:478
Symbol 478 MovieClip {Sellv}Uses:361 362 363 364 367 373 379 382 388 394 397 403 416 419 424 430 433 441 453 457 461 463 464 465 467 468 469 471 472 473 475 476 477Used by:1298
Symbol 479 GraphicUsed by:525
Symbol 480 BitmapUsed by:481
Symbol 481 GraphicUses:480Used by:482 483
Symbol 482 MovieClipUses:481Used by:483
Symbol 483 ButtonUses:482 481Used by:525
Symbol 484 BitmapUsed by:485 486
Symbol 485 GraphicUses:484Used by:489
Symbol 486 GraphicUses:484Used by:487 488
Symbol 487 MovieClipUses:486Used by:488
Symbol 488 ButtonUses:487 486Used by:489
Symbol 489 MovieClip {CoalExpress4_fla.Timeline_179}Uses:485 488Used by:525
Symbol 490 BitmapUsed by:491 492
Symbol 491 GraphicUses:490Used by:495
Symbol 492 GraphicUses:490Used by:493 494
Symbol 493 MovieClipUses:492Used by:494
Symbol 494 ButtonUses:493 492Used by:495
Symbol 495 MovieClip {CoalExpress4_fla.Timeline_182}Uses:491 494Used by:525
Symbol 496 BitmapUsed by:497 498
Symbol 497 GraphicUses:496Used by:501
Symbol 498 GraphicUses:496Used by:499 500
Symbol 499 MovieClipUses:498Used by:500
Symbol 500 ButtonUses:499 498Used by:501
Symbol 501 MovieClip {CoalExpress4_fla.Timeline_185}Uses:497 500Used by:525
Symbol 502 BitmapUsed by:503 504
Symbol 503 GraphicUses:502Used by:507
Symbol 504 GraphicUses:502Used by:505 506
Symbol 505 MovieClipUses:504Used by:506
Symbol 506 ButtonUses:505 504Used by:507
Symbol 507 MovieClip {CoalExpress4_fla.Timeline_188}Uses:503 506Used by:525
Symbol 508 GraphicUsed by:511
Symbol 509 GraphicUsed by:511
Symbol 510 GraphicUsed by:511
Symbol 511 ButtonUses:190 508 509 510Used by:525
Symbol 512 GraphicUsed by:515
Symbol 513 GraphicUsed by:515
Symbol 514 GraphicUsed by:515
Symbol 515 ButtonUses:190 512 513 514Used by:525
Symbol 516 GraphicUsed by:525
Symbol 517 MovieClip {CoalExpress4_fla.Timeline_193}Uses:363 464 468 472 476Used by:525
Symbol 518 GraphicUsed by:521
Symbol 519 GraphicUsed by:521
Symbol 520 GraphicUsed by:521
Symbol 521 ButtonUses:190 518 519 520Used by:525 923
Symbol 522 GraphicUsed by:523
Symbol 523 MovieClipUses:522Used by:524
Symbol 524 MovieClipUses:523Used by:525
Symbol 525 MovieClip {Selstage}Uses:479 483 489 495 501 507 338 511 515 516 517 521 524Used by:1298
Symbol 526 GraphicUsed by:836
Symbol 527 GraphicUsed by:543 555
Symbol 528 MovieClipUses:40Used by:543 554
Symbol 529 ButtonUses:40Used by:543 596
Symbol 530 GraphicUsed by:531 556
Symbol 531 MovieClipUses:530Used by:543
Symbol 532 MovieClipUses:122Used by:543 554
Symbol 533 GraphicUsed by:534 560 563
Symbol 534 MovieClipUses:533Used by:543
Symbol 535 GraphicUsed by:543 564 567
Symbol 536 MovieClipUses:129Used by:543 554
Symbol 537 GraphicUsed by:538 565 567
Symbol 538 MovieClipUses:537Used by:543
Symbol 539 GraphicUsed by:543 568 571
Symbol 540 MovieClipUses:136Used by:543 554
Symbol 541 GraphicUsed by:542 569 571
Symbol 542 MovieClipUses:541Used by:543
Symbol 543 MovieClip {CoalExpress4_fla.s_198}Uses:527 528 529 531 169 532 534 535 536 538 539 540 542Used by:836
Symbol 544 GraphicUsed by:554 572 575
Symbol 545 MovieClipUses:44Used by:554 576
Symbol 546 GraphicUsed by:554 577 580
Symbol 547 GraphicUsed by:548 578
Symbol 548 MovieClipUses:547Used by:554 581
Symbol 549 GraphicUsed by:554 582 585
Symbol 550 GraphicUsed by:551 583
Symbol 551 MovieClipUses:550Used by:554 586
Symbol 552 GraphicUsed by:553 592
Symbol 553 MovieClipUses:552Used by:554 594
Symbol 554 MovieClip {CoalExpress4_fla.s_208}Uses:544 528 545 546 532 548 549 536 551 540 553Used by:836
Symbol 555 ButtonUses:527Used by:558
Symbol 556 ButtonUses:530Used by:558
Symbol 557 GraphicUsed by:558
Symbol 558 MovieClip {CoalExpress4_fla.Timeline_214}Uses:555 556 557Used by:605
Symbol 559 ButtonUses:169Used by:563
Symbol 560 ButtonUses:533Used by:563
Symbol 561 GraphicUsed by:563 567 571 581 586 591 594 599 602 604 614 619 624 629 634 642 647 652 657 662 670 675 680 685 690 698 703 708 713 718 726 731 736 741 746
Symbol 562 GraphicUsed by:563
Symbol 563 MovieClip {CoalExpress4_fla.Timeline_217}Uses:559 560 561 562 169 533Used by:605
Symbol 564 ButtonUses:535Used by:567
Symbol 565 ButtonUses:537Used by:567
Symbol 566 GraphicUsed by:567
Symbol 567 MovieClip {CoalExpress4_fla.Timeline_220}Uses:564 565 561 566 535 537Used by:605
Symbol 568 ButtonUses:539Used by:571
Symbol 569 ButtonUses:541Used by:571
Symbol 570 GraphicUsed by:571
Symbol 571 MovieClip {CoalExpress4_fla.Timeline_223}Uses:568 569 561 570 539 541Used by:605
Symbol 572 ButtonUses:544Used by:576 591
Symbol 573 ButtonUses:44Used by:576
Symbol 574 GraphicUsed by:576
Symbol 575 MovieClipUses:544Used by:576 591
Symbol 576 MovieClipUses:572 573 574 575 545Used by:605
Symbol 577 ButtonUses:546Used by:581
Symbol 578 ButtonUses:547Used by:581
Symbol 579 GraphicUsed by:581
Symbol 580 MovieClipUses:546Used by:581
Symbol 581 MovieClipUses:577 578 561 579 580 548Used by:605
Symbol 582 ButtonUses:549Used by:586 594
Symbol 583 ButtonUses:550Used by:586
Symbol 584 GraphicUsed by:586
Symbol 585 MovieClipUses:549Used by:586 594
Symbol 586 MovieClipUses:582 583 561 584 585 551Used by:605
Symbol 587 GraphicUsed by:588 590
Symbol 588 ButtonUses:587Used by:591
Symbol 589 GraphicUsed by:591
Symbol 590 MovieClipUses:587Used by:591
Symbol 591 MovieClipUses:572 588 561 589 575 590Used by:605
Symbol 592 ButtonUses:552Used by:594
Symbol 593 GraphicUsed by:594
Symbol 594 MovieClipUses:582 592 561 593 585 553Used by:605
Symbol 595 GraphicUsed by:596
Symbol 596 MovieClipUses:529 595 40Used by:605
Symbol 597 ButtonUses:122Used by:599
Symbol 598 GraphicUsed by:599
Symbol 599 MovieClipUses:597 561 598 122Used by:605
Symbol 600 ButtonUses:129Used by:602
Symbol 601 GraphicUsed by:602 604
Symbol 602 MovieClipUses:600 561 601 129Used by:605
Symbol 603 ButtonUses:136Used by:604
Symbol 604 MovieClipUses:603 561 601 136Used by:605
Symbol 605 MovieClip {CoalExpress4_fla.Timeline_213}Uses:558 563 567 571 576 581 586 591 594 596 599 602 604Used by:836
Symbol 606 GraphicUsed by:607
Symbol 607 MovieClipUses:606Used by:635
Symbol 608 GraphicUsed by:635
Symbol 609 GraphicUsed by:610
Symbol 610 ButtonUses:609Used by:614
Symbol 611 GraphicUsed by:612
Symbol 612 MovieClipUses:611Used by:614 619 624 629 642 647 652 657 662 670 675 680 685 690 698 703 708 713 718 726 731 736 741 746
Symbol 613 GraphicUsed by:614
Symbol 614 MovieClip {CoalExpress4_fla.Timeline_252}Uses:610 561 612 613Used by:635
Symbol 615 GraphicUsed by:616 618
Symbol 616 ButtonUses:615Used by:619
Symbol 617 GraphicUsed by:619
Symbol 618 MovieClipUses:615Used by:619
Symbol 619 MovieClip {CoalExpress4_fla.Timeline_255}Uses:616 561 612 617 618Used by:635
Symbol 620 GraphicUsed by:621 623
Symbol 621 ButtonUses:620Used by:624
Symbol 622 GraphicUsed by:624
Symbol 623 MovieClipUses:620Used by:624
Symbol 624 MovieClip {CoalExpress4_fla.Timeline_258}Uses:621 561 612 622 623Used by:635
Symbol 625 GraphicUsed by:626 628
Symbol 626 ButtonUses:625Used by:629
Symbol 627 GraphicUsed by:629
Symbol 628 MovieClipUses:625Used by:629
Symbol 629 MovieClip {CoalExpress4_fla.Timeline_261}Uses:626 561 612 627 628Used by:635
Symbol 630 GraphicUsed by:631 633
Symbol 631 ButtonUses:630Used by:634
Symbol 632 GraphicUsed by:634
Symbol 633 MovieClipUses:630Used by:634
Symbol 634 MovieClip {CoalExpress4_fla.Timeline_264}Uses:631 561 632 633Used by:635
Symbol 635 MovieClip {CoalExpress4_fla.shopmenu1_250}Uses:607 608 614 619 624 629 634Used by:836
Symbol 636 GraphicUsed by:637
Symbol 637 MovieClipUses:636Used by:663
Symbol 638 GraphicUsed by:639 641
Symbol 639 ButtonUses:638Used by:642
Symbol 640 GraphicUsed by:642
Symbol 641 MovieClipUses:638Used by:642
Symbol 642 MovieClip {CoalExpress4_fla.Timeline_269}Uses:639 561 612 640 641Used by:663
Symbol 643 GraphicUsed by:644 646
Symbol 644 ButtonUses:643Used by:647
Symbol 645 GraphicUsed by:647
Symbol 646 MovieClipUses:643Used by:647
Symbol 647 MovieClip {CoalExpress4_fla.Timeline_272}Uses:644 561 612 645 646Used by:663
Symbol 648 GraphicUsed by:649 651
Symbol 649 ButtonUses:648Used by:652
Symbol 650 GraphicUsed by:652
Symbol 651 MovieClipUses:648Used by:652
Symbol 652 MovieClip {CoalExpress4_fla.Timeline_275}Uses:649 561 612 650 651Used by:663
Symbol 653 GraphicUsed by:654 656
Symbol 654 ButtonUses:653Used by:657
Symbol 655 GraphicUsed by:657
Symbol 656 MovieClipUses:653Used by:657
Symbol 657 MovieClip {CoalExpress4_fla.Timeline_278}Uses:654 561 612 655 656Used by:663
Symbol 658 GraphicUsed by:659 661
Symbol 659 ButtonUses:658Used by:662
Symbol 660 GraphicUsed by:662
Symbol 661 MovieClipUses:658Used by:662
Symbol 662 MovieClip {CoalExpress4_fla.Timeline_281}Uses:659 561 612 660 661Used by:663
Symbol 663 MovieClip {CoalExpress4_fla.shopmenu2_267}Uses:637 642 647 652 657 662Used by:836
Symbol 664 GraphicUsed by:665
Symbol 665 MovieClipUses:664Used by:691
Symbol 666 GraphicUsed by:667 669
Symbol 667 ButtonUses:666Used by:670
Symbol 668 GraphicUsed by:670
Symbol 669 MovieClipUses:666Used by:670
Symbol 670 MovieClip {CoalExpress4_fla.Timeline_286}Uses:667 561 612 668 669Used by:691
Symbol 671 GraphicUsed by:672 674
Symbol 672 ButtonUses:671Used by:675
Symbol 673 GraphicUsed by:675
Symbol 674 MovieClipUses:671Used by:675
Symbol 675 MovieClip {CoalExpress4_fla.Timeline_289}Uses:672 561 612 673 674Used by:691
Symbol 676 GraphicUsed by:677 679
Symbol 677 ButtonUses:676Used by:680
Symbol 678 GraphicUsed by:680
Symbol 679 MovieClipUses:676Used by:680
Symbol 680 MovieClip {CoalExpress4_fla.Timeline_292}Uses:677 561 612 678 679Used by:691
Symbol 681 GraphicUsed by:682 684
Symbol 682 ButtonUses:681Used by:685
Symbol 683 GraphicUsed by:685
Symbol 684 MovieClipUses:681Used by:685
Symbol 685 MovieClip {CoalExpress4_fla.Timeline_295}Uses:682 561 612 683 684Used by:691
Symbol 686 GraphicUsed by:687 689
Symbol 687 ButtonUses:686Used by:690
Symbol 688 GraphicUsed by:690
Symbol 689 MovieClipUses:686Used by:690
Symbol 690 MovieClip {CoalExpress4_fla.Timeline_298}Uses:687 561 612 688 689Used by:691
Symbol 691 MovieClip {CoalExpress4_fla.shopmenu3_284}Uses:665 670 675 680 685 690Used by:836
Symbol 692 GraphicUsed by:693
Symbol 693 MovieClipUses:692Used by:719
Symbol 694 GraphicUsed by:695 697
Symbol 695 ButtonUses:694Used by:698
Symbol 696 GraphicUsed by:698
Symbol 697 MovieClipUses:694Used by:698
Symbol 698 MovieClip {CoalExpress4_fla.Timeline_303}Uses:695 561 612 696 697Used by:719
Symbol 699 GraphicUsed by:700 702
Symbol 700 ButtonUses:699Used by:703
Symbol 701 GraphicUsed by:703
Symbol 702 MovieClipUses:699Used by:703
Symbol 703 MovieClip {CoalExpress4_fla.Timeline_306}Uses:700 561 612 701 702Used by:719
Symbol 704 GraphicUsed by:705 707
Symbol 705 ButtonUses:704Used by:708
Symbol 706 GraphicUsed by:708
Symbol 707 MovieClipUses:704Used by:708
Symbol 708 MovieClip {CoalExpress4_fla.Timeline_309}Uses:705 561 612 706 707Used by:719
Symbol 709 GraphicUsed by:710 712
Symbol 710 ButtonUses:709Used by:713
Symbol 711 GraphicUsed by:713
Symbol 712 MovieClipUses:709Used by:713
Symbol 713 MovieClip {CoalExpress4_fla.Timeline_312}Uses:710 561 612 711 712Used by:719
Symbol 714 GraphicUsed by:715 717
Symbol 715 ButtonUses:714Used by:718
Symbol 716 GraphicUsed by:718
Symbol 717 MovieClipUses:714Used by:718
Symbol 718 MovieClip {CoalExpress4_fla.Timeline_315}Uses:715 561 612 716 717Used by:719
Symbol 719 MovieClip {CoalExpress4_fla.shopmenu4_301}Uses:693 698 703 708 713 718Used by:836
Symbol 720 GraphicUsed by:721
Symbol 721 MovieClipUses:720Used by:747
Symbol 722 GraphicUsed by:723 725
Symbol 723 ButtonUses:722Used by:726
Symbol 724 GraphicUsed by:726
Symbol 725 MovieClipUses:722Used by:726
Symbol 726 MovieClip {CoalExpress4_fla.Timeline_320}Uses:723 561 612 724 725Used by:747
Symbol 727 GraphicUsed by:728 730
Symbol 728 ButtonUses:727Used by:731
Symbol 729 GraphicUsed by:731
Symbol 730 MovieClipUses:727Used by:731
Symbol 731 MovieClip {CoalExpress4_fla.Timeline_323}Uses:728 561 612 729 730Used by:747
Symbol 732 GraphicUsed by:733 735
Symbol 733 ButtonUses:732Used by:736
Symbol 734 GraphicUsed by:736
Symbol 735 MovieClipUses:732Used by:736
Symbol 736 MovieClip {CoalExpress4_fla.Timeline_326}Uses:733 561 612 734 735Used by:747
Symbol 737 GraphicUsed by:738 740
Symbol 738 ButtonUses:737Used by:741
Symbol 739 GraphicUsed by:741
Symbol 740 MovieClipUses:737Used by:741
Symbol 741 MovieClip {CoalExpress4_fla.Timeline_329}Uses:738 561 612 739 740Used by:747
Symbol 742 GraphicUsed by:743 745
Symbol 743 ButtonUses:742Used by:746
Symbol 744 GraphicUsed by:746
Symbol 745 MovieClipUses:742Used by:746
Symbol 746 MovieClip {CoalExpress4_fla.Timeline_332}Uses:743 561 612 744 745Used by:747
Symbol 747 MovieClip {CoalExpress4_fla.shopmenu5_318}Uses:721 726 731 736 741 746Used by:836
Symbol 748 GraphicUsed by:758 922
Symbol 749 GraphicUsed by:758 922
Symbol 750 GraphicUsed by:758 922
Symbol 751 GraphicUsed by:758 922
Symbol 752 GraphicUsed by:758 922
Symbol 753 GraphicUsed by:758 922
Symbol 754 GraphicUsed by:758 922
Symbol 755 GraphicUsed by:758 922
Symbol 756 GraphicUsed by:758 922
Symbol 757 GraphicUsed by:758 922
Symbol 758 MovieClipUses:748 749 750 751 752 753 754 755 756 757Used by:836
Symbol 759 GraphicUsed by:762
Symbol 760 GraphicUsed by:762
Symbol 761 GraphicUsed by:762
Symbol 762 ButtonUses:190 759 760 761Used by:836
Symbol 763 GraphicUsed by:767
Symbol 764 GraphicUsed by:767
Symbol 765 GraphicUsed by:767
Symbol 766 GraphicUsed by:767
Symbol 767 ButtonUses:763 764 765 766Used by:836
Symbol 768 GraphicUsed by:772
Symbol 769 GraphicUsed by:772
Symbol 770 GraphicUsed by:772
Symbol 771 GraphicUsed by:772
Symbol 772 ButtonUses:768 769 770 771Used by:836
Symbol 773 GraphicUsed by:777
Symbol 774 GraphicUsed by:777
Symbol 775 GraphicUsed by:777
Symbol 776 GraphicUsed by:777
Symbol 777 ButtonUses:773 774 775 776Used by:836
Symbol 778 GraphicUsed by:782
Symbol 779 GraphicUsed by:782
Symbol 780 GraphicUsed by:782
Symbol 781 GraphicUsed by:782
Symbol 782 ButtonUses:778 779 780 781Used by:836
Symbol 783 GraphicUsed by:787
Symbol 784 GraphicUsed by:787
Symbol 785 GraphicUsed by:787
Symbol 786 GraphicUsed by:787
Symbol 787 ButtonUses:783 784 785 786Used by:836
Symbol 788 GraphicUsed by:834
Symbol 789 GraphicUsed by:834
Symbol 790 GraphicUsed by:834
Symbol 791 GraphicUsed by:834
Symbol 792 GraphicUsed by:834
Symbol 793 GraphicUsed by:834
Symbol 794 GraphicUsed by:804 834 907 919
Symbol 795 GraphicUsed by:804 834 907 919
Symbol 796 GraphicUsed by:804 834 907 919
Symbol 797 GraphicUsed by:804 907 919
Symbol 798 GraphicUsed by:804 907 919
Symbol 799 GraphicUsed by:804 834 907 919
Symbol 800 GraphicUsed by:804 907 919
Symbol 801 GraphicUsed by:804 907 919
Symbol 802 GraphicUsed by:804 907 919
Symbol 803 GraphicUsed by:804 907 919
Symbol 804 MovieClipUses:794 795 796 797 798 799 800 801 802 803Used by:834
Symbol 805 GraphicUsed by:834 923
Symbol 806 GraphicUsed by:834
Symbol 807 GraphicUsed by:834
Symbol 808 GraphicUsed by:834
Symbol 809 GraphicUsed by:834
Symbol 810 GraphicUsed by:834
Symbol 811 GraphicUsed by:834
Symbol 812 GraphicUsed by:834
Symbol 813 GraphicUsed by:834
Symbol 814 GraphicUsed by:834
Symbol 815 GraphicUsed by:834
Symbol 816 GraphicUsed by:834
Symbol 817 GraphicUsed by:834
Symbol 818 GraphicUsed by:834
Symbol 819 GraphicUsed by:834
Symbol 820 GraphicUsed by:834
Symbol 821 GraphicUsed by:834
Symbol 822 GraphicUsed by:834
Symbol 823 GraphicUsed by:834
Symbol 824 GraphicUsed by:834
Symbol 825 GraphicUsed by:834
Symbol 826 GraphicUsed by:834
Symbol 827 GraphicUsed by:834
Symbol 828 GraphicUsed by:834
Symbol 829 GraphicUsed by:834
Symbol 830 GraphicUsed by:834
Symbol 831 GraphicUsed by:834
Symbol 832 GraphicUsed by:834
Symbol 833 GraphicUsed by:834
Symbol 834 MovieClip {CoalExpress4_fla.Timeline_342}Uses:788 789 790 791 792 793 804 805 806 794 795 807 799 808 796 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833Used by:836
Symbol 835 GraphicUsed by:836 923
Symbol 836 MovieClip {Shop}Uses:526 543 554 605 635 663 691 719 747 758 762 767 772 777 782 787 834 835 338Used by:1298
Symbol 837 GraphicUsed by:881
Symbol 838 GraphicUsed by:881
Symbol 839 GraphicUsed by:881
Symbol 840 GraphicUsed by:881
Symbol 841 GraphicUsed by:881
Symbol 842 GraphicUsed by:881
Symbol 843 GraphicUsed by:881
Symbol 844 GraphicUsed by:881
Symbol 845 GraphicUsed by:881
Symbol 846 GraphicUsed by:881
Symbol 847 GraphicUsed by:881
Symbol 848 GraphicUsed by:881
Symbol 849 GraphicUsed by:881
Symbol 850 GraphicUsed by:881
Symbol 851 GraphicUsed by:881
Symbol 852 GraphicUsed by:881
Symbol 853 GraphicUsed by:881
Symbol 854 GraphicUsed by:881
Symbol 855 GraphicUsed by:881
Symbol 856 GraphicUsed by:881
Symbol 857 GraphicUsed by:881
Symbol 858 GraphicUsed by:881
Symbol 859 GraphicUsed by:881
Symbol 860 GraphicUsed by:881
Symbol 861 GraphicUsed by:881
Symbol 862 GraphicUsed by:881
Symbol 863 GraphicUsed by:881
Symbol 864 GraphicUsed by:881
Symbol 865 GraphicUsed by:881
Symbol 866 GraphicUsed by:881
Symbol 867 GraphicUsed by:881
Symbol 868 GraphicUsed by:881
Symbol 869 GraphicUsed by:881
Symbol 870 GraphicUsed by:881
Symbol 871 GraphicUsed by:881
Symbol 872 GraphicUsed by:881
Symbol 873 GraphicUsed by:881
Symbol 874 GraphicUsed by:881
Symbol 875 GraphicUsed by:881
Symbol 876 GraphicUsed by:881
Symbol 877 GraphicUsed by:881
Symbol 878 GraphicUsed by:881
Symbol 879 GraphicUsed by:881
Symbol 880 GraphicUsed by:881
Symbol 881 MovieClip {Suc}Uses:837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880Used by:1298
Symbol 882 GraphicUsed by:908
Symbol 883 MovieClipUsed by:908
Symbol 884 GraphicUsed by:908
Symbol 885 GraphicUsed by:888
Symbol 886 GraphicUsed by:888
Symbol 887 GraphicUsed by:888
Symbol 888 ButtonUses:190 885 886 887Used by:908
Symbol 889 GraphicUsed by:907
Symbol 890 GraphicUsed by:907
Symbol 891 GraphicUsed by:907
Symbol 892 GraphicUsed by:907
Symbol 893 GraphicUsed by:907
Symbol 894 GraphicUsed by:907
Symbol 895 GraphicUsed by:907
Symbol 896 GraphicUsed by:907
Symbol 897 GraphicUsed by:907
Symbol 898 GraphicUsed by:907
Symbol 899 GraphicUsed by:907
Symbol 900 GraphicUsed by:907
Symbol 901 GraphicUsed by:907
Symbol 902 GraphicUsed by:907
Symbol 903 GraphicUsed by:907
Symbol 904 GraphicUsed by:907
Symbol 905 GraphicUsed by:907
Symbol 906 GraphicUsed by:907
Symbol 907 MovieClip {CoalExpress4_fla.Timeline_348}Uses:889 795 890 796 891 794 797 799 798 800 802 801 803 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906Used by:908
Symbol 908 MovieClip {Succeed}Uses:882 883 884 888 907Used by:1298
Symbol 909 GraphicUsed by:923
Symbol 910 GraphicUsed by:913
Symbol 911 GraphicUsed by:913
Symbol 912 GraphicUsed by:913
Symbol 913 ButtonUses:190 910 911 912Used by:923
Symbol 914 GraphicUsed by:917
Symbol 915 GraphicUsed by:917
Symbol 916 GraphicUsed by:917
Symbol 917 ButtonUses:190 914 915 916Used by:923
Symbol 918 GraphicUsed by:923
Symbol 919 MovieClipUses:794 795 796 797 798 799 800 801 802 803Used by:923
Symbol 920 GraphicUsed by:923
Symbol 921 GraphicUsed by:923
Symbol 922 MovieClipUses:748 749 750 751 752 753 754 755 756 757Used by:923
Symbol 923 MovieClip {Win}Uses:909 338 913 917 918 919 805 920 921 922 835 227 521Used by:1298
Symbol 924 BitmapUsed by:925
Symbol 925 GraphicUses:924Used by:926
Symbol 926 MovieClip {BG5}Uses:925Used by:1298
Symbol 927 BitmapUsed by:928
Symbol 928 GraphicUses:927Used by:929
Symbol 929 MovieClip {BG4}Uses:928Used by:1298
Symbol 930 BitmapUsed by:931
Symbol 931 GraphicUses:930Used by:932
Symbol 932 MovieClip {BG2}Uses:931Used by:1298
Symbol 933 BitmapUsed by:934
Symbol 934 GraphicUses:933Used by:935
Symbol 935 MovieClip {BG1}Uses:934Used by:1298
Symbol 936 BitmapUsed by:937
Symbol 937 GraphicUses:936Used by:938
Symbol 938 MovieClipUses:937Used by:948 951 957 961 970 974 981 985 989 991
Symbol 939 GraphicUsed by:940
Symbol 940 ButtonUses:939Used by:941
Symbol 941 MovieClip {CoalExpress4_fla.Timeline_360}Uses:167 940Used by:948 951 957 961 970 974 981 985 989 991
Symbol 942 GraphicUsed by:943
Symbol 943 MovieClipUses:942Used by:948 993 998 1000 1002 1004 1021 1023 1025 1027
Symbol 944 GraphicUsed by:948
Symbol 945 BitmapUsed by:946
Symbol 946 GraphicUses:945Used by:947
Symbol 947 MovieClipUses:946Used by:948
Symbol 948 MovieClip {ae}Uses:938 941 943 944 34 32 947 47Used by:1298
Symbol 949 BitmapUsed by:950
Symbol 950 GraphicUses:949Used by:951
Symbol 951 MovieClip {as}Uses:938 950 34 32 941Used by:1298
Symbol 952 GraphicUsed by:957
Symbol 953 GraphicUsed by:957 961 1032 1035 1042 1045 1048 1051 1055 1058 1061 1064 1067 1070 1073 1075 1078 1081 1084 1087 1091
Symbol 954 GraphicUsed by:957
Symbol 955 GraphicUsed by:956
Symbol 956 MovieClipUses:955Used by:957
Symbol 957 MovieClip {be}Uses:952 953 954 34 32 956 938 47 941Used by:1298
Symbol 958 GraphicUsed by:961
Symbol 959 GraphicUsed by:961
Symbol 960 GraphicUsed by:961
Symbol 961 MovieClip {bs}Uses:958 953 959 938 960 34 32 941Used by:1298
Symbol 962 GraphicUsed by:970
Symbol 963 GraphicUsed by:970 974 1091 1095 1099 1107 1112 1116 1120 1123 1127 1130 1134 1137 1142 1147 1152 1157 1162 1169
Symbol 964 GraphicUsed by:970 974 1091 1095 1099 1107 1112 1116 1120 1123 1127 1130 1134 1137 1142 1147 1152 1157 1162 1169
Symbol 965 GraphicUsed by:970
Symbol 966 GraphicUsed by:970 974 1091 1095 1099 1103 1107 1112 1116 1120 1123 1127 1130 1134 1137 1142 1147 1152 1157 1162 1169
Symbol 967 GraphicUsed by:970
Symbol 968 GraphicUsed by:969
Symbol 969 MovieClipUses:968Used by:970
Symbol 970 MovieClip {ce}Uses:962 963 964 938 965 966 967 34 32 969 47 941Used by:1298
Symbol 971 GraphicUsed by:974
Symbol 972 GraphicUsed by:974
Symbol 973 GraphicUsed by:974
Symbol 974 MovieClip {cs}Uses:971 963 964 938 972 966 973 34 32 941Used by:1298
Symbol 975 GraphicUsed by:981
Symbol 976 GraphicUsed by:981
Symbol 977 GraphicUsed by:981 985 1173 1177 1181 1185 1189 1193 1197 1201 1205 1209 1213 1217 1221 1224 1228 1232 1236 1240 1244
Symbol 978 GraphicUsed by:981
Symbol 979 GraphicUsed by:980
Symbol 980 MovieClipUses:979Used by:981
Symbol 981 MovieClip {de}Uses:975 938 976 977 978 34 32 980 47 941Used by:1298
Symbol 982 GraphicUsed by:985
Symbol 983 GraphicUsed by:985
Symbol 984 GraphicUsed by:985
Symbol 985 MovieClip {ds}Uses:982 938 983 977 984 34 32 941Used by:1298
Symbol 986 GraphicUsed by:989
Symbol 987 GraphicUsed by:988
Symbol 988 MovieClipUses:987Used by:989
Symbol 989 MovieClip {ee}Uses:938 986 34 32 988 47 941Used by:1298
Symbol 990 GraphicUsed by:991
Symbol 991 MovieClip {es}Uses:938 990 34 32 941Used by:1298
Symbol 992 GraphicUsed by:993
Symbol 993 MovieClip {r11}Uses:943 992 34 32Used by:1298
Symbol 994 BitmapUsed by:995
Symbol 995 GraphicUses:994Used by:996
Symbol 996 MovieClipUses:995Used by:998 1000 1002 1016 1023 1027 1042 1048 1055 1061 1067 1073 1075 1078 1081 1084 1087 1095 1099 1103 1107 1120 1123 1137 1142 1147 1157 1162 1177 1181 1185 1197 1201 1209 1213 1228 1232 1240 1246 1250 1252 1254 1256 1262 1264 1266 1270 1285 1289 1291 1293 1295
Symbol 997 GraphicUsed by:998
Symbol 998 MovieClip {r12}Uses:943 996 997 34 32Used by:1298
Symbol 999 GraphicUsed by:1000
Symbol 1000 MovieClip {r13}Uses:943 996 999 34 32Used by:1298
Symbol 1001 GraphicUsed by:1002
Symbol 1002 MovieClip {r14}Uses:943 1001 34 32 996Used by:1298
Symbol 1003 GraphicUsed by:1004
Symbol 1004 MovieClip {r15}Uses:943 1003 34 32Used by:1298
Symbol 1005 BitmapUsed by:1006
Symbol 1006 GraphicUses:1005Used by:1007
Symbol 1007 MovieClip {r21}Uses:1006 34 32Used by:1298
Symbol 1008 BitmapUsed by:1009
Symbol 1009 GraphicUses:1008Used by:1010
Symbol 1010 MovieClip {r22}Uses:1009 34 32Used by:1298
Symbol 1011 BitmapUsed by:1012
Symbol 1012 GraphicUses:1011Used by:1013
Symbol 1013 MovieClip {r23}Uses:1012 34 32Used by:1298
Symbol 1014 BitmapUsed by:1015
Symbol 1015 GraphicUses:1014Used by:1016
Symbol 1016 MovieClip {r24}Uses:996 1015 34 32Used by:1298
Symbol 1017 BitmapUsed by:1018
Symbol 1018 GraphicUses:1017Used by:1019
Symbol 1019 MovieClip {r25}Uses:1018 34 32Used by:1298
Symbol 1020 GraphicUsed by:1021
Symbol 1021 MovieClip {r31}Uses:943 1020 34 32Used by:1298
Symbol 1022 GraphicUsed by:1023
Symbol 1023 MovieClip {r32}Uses:943 996 1022 34 32Used by:1298
Symbol 1024 GraphicUsed by:1025
Symbol 1025 MovieClip {r33}Uses:943 1024 34 32Used by:1298
Symbol 1026 GraphicUsed by:1027
Symbol 1027 MovieClip {r34}Uses:943 996 1026 34 32Used by:1298
Symbol 1028 GraphicUsed by:1032
Symbol 1029 GraphicUsed by:1030
Symbol 1030 MovieClipUses:1029Used by:1032
Symbol 1031 GraphicUsed by:1032
Symbol 1032 MovieClip {r35}Uses:1028 953 1030 1031 34 32Used by:1298
Symbol 1033 GraphicUsed by:1035
Symbol 1034 GraphicUsed by:1035
Symbol 1035 MovieClip {r41}Uses:1033 953 1034 34 32Used by:1298
Symbol 1036 GraphicUsed by:1042
Symbol 1037 BitmapUsed by:1038
Symbol 1038 GraphicUses:1037Used by:1039
Symbol 1039 MovieClipUses:1038Used by:1042 1064 1075 1084 1099 1103 1112 1127 1162 1177 1181 1205 1228 1232 1240 1248 1252 1256 1258 1266 1270 1287 1291
Symbol 1040 GraphicUsed by:1042
Symbol 1041 GraphicUsed by:1042
Symbol 1042 MovieClip {r42}Uses:1036 1039 996 1040 953 1041 34 32Used by:1298
Symbol 1043 GraphicUsed by:1045
Symbol 1044 GraphicUsed by:1045
Symbol 1045 MovieClip {r43}Uses:1043 953 1044 34 32Used by:1298
Symbol 1046 GraphicUsed by:1048
Symbol 1047 GraphicUsed by:1048
Symbol 1048 MovieClip {r44}Uses:996 1046 953 1047 34 32Used by:1298
Symbol 1049 GraphicUsed by:1051
Symbol 1050 GraphicUsed by:1051
Symbol 1051 MovieClip {r45}Uses:1049 953 1050 34 32Used by:1298
Symbol 1052 GraphicUsed by:1055
Symbol 1053 GraphicUsed by:1055
Symbol 1054 GraphicUsed by:1055
Symbol 1055 MovieClip {r46}Uses:1052 996 1053 953 1054 34 32Used by:1298
Symbol 1056 GraphicUsed by:1058
Symbol 1057 GraphicUsed by:1058
Symbol 1058 MovieClip {r51}Uses:1056 953 1057 34 32Used by:1298
Symbol 1059 GraphicUsed by:1061
Symbol 1060 GraphicUsed by:1061
Symbol 1061 MovieClip {r52}Uses:1059 996 953 1060 34 32Used by:1298
Symbol 1062 GraphicUsed by:1064
Symbol 1063 GraphicUsed by:1064
Symbol 1064 MovieClip {r53}Uses:1039 1062 953 1063 34 32Used by:1298
Symbol 1065 GraphicUsed by:1067
Symbol 1066 GraphicUsed by:1067
Symbol 1067 MovieClip {r54}Uses:996 1065 953 1066 34 32Used by:1298
Symbol 1068 GraphicUsed by:1070
Symbol 1069 GraphicUsed by:1070
Symbol 1070 MovieClip {r55}Uses:1068 953 1069 34 32Used by:1298
Symbol 1071 GraphicUsed by:1073
Symbol 1072 GraphicUsed by:1073
Symbol 1073 MovieClip {r56}Uses:996 1071 953 1072 34 32Used by:1298
Symbol 1074 GraphicUsed by:1075
Symbol 1075 MovieClip {r61}Uses:996 1039 1074 953 34 32Used by:1298
Symbol 1076 GraphicUsed by:1078
Symbol 1077 GraphicUsed by:1078
Symbol 1078 MovieClip {r62}Uses:1076 996 1077 953 34 32Used by:1298
Symbol 1079 GraphicUsed by:1081
Symbol 1080 GraphicUsed by:1081
Symbol 1081 MovieClip {r63}Uses:1079 996 1080 953 34 32Used by:1298
Symbol 1082 GraphicUsed by:1084
Symbol 1083 GraphicUsed by:1084
Symbol 1084 MovieClip {r64}Uses:1039 996 1082 953 1083 34 32Used by:1298
Symbol 1085 GraphicUsed by:1087
Symbol 1086 GraphicUsed by:1087
Symbol 1087 MovieClip {r65}Uses:1085 996 1086 953 34 32Used by:1298
Symbol 1088 GraphicUsed by:1091
Symbol 1089 GraphicUsed by:1091
Symbol 1090 GraphicUsed by:1091
Symbol 1091 MovieClip {r66}Uses:1088 963 964 966 1089 1090 953 34 32Used by:1298
Symbol 1092 GraphicUsed by:1095
Symbol 1093 GraphicUsed by:1095
Symbol 1094 GraphicUsed by:1095
Symbol 1095 MovieClip {r71}Uses:1092 963 964 996 1093 966 1094 34 32Used by:1298
Symbol 1096 GraphicUsed by:1099
Symbol 1097 GraphicUsed by:1099
Symbol 1098 GraphicUsed by:1099
Symbol 1099 MovieClip {r72}Uses:1096 963 964 1039 996 1097 966 1098 34 32Used by:1298
Symbol 1100 GraphicUsed by:1103
Symbol 1101 GraphicUsed by:1103
Symbol 1102 GraphicUsed by:1103
Symbol 1103 MovieClip {r73}Uses:1100 966 1101 1039 996 1102 34 32Used by:1298
Symbol 1104 GraphicUsed by:1107
Symbol 1105 GraphicUsed by:1107
Symbol 1106 GraphicUsed by:1107
Symbol 1107 MovieClip {r74}Uses:1104 963 964 996 1105 966 1106 34 32Used by:1298
Symbol 1108 GraphicUsed by:1112
Symbol 1109 GraphicUsed by:1112
Symbol 1110 GraphicUsed by:1112
Symbol 1111 GraphicUsed by:1112
Symbol 1112 MovieClip {r75}Uses:1108 963 964 1109 1039 1110 966 1111 34 32Used by:1298
Symbol 1113 GraphicUsed by:1116
Symbol 1114 GraphicUsed by:1116
Symbol 1115 GraphicUsed by:1116
Symbol 1116 MovieClip {r76}Uses:1113 963 964 1114 966 1115 34 32Used by:1298
Symbol 1117 GraphicUsed by:1120
Symbol 1118 GraphicUsed by:1120
Symbol 1119 GraphicUsed by:1120
Symbol 1120 MovieClip {r81}Uses:1117 963 964 1118 966 996 1119 34 32Used by:1298
Symbol 1121 GraphicUsed by:1123
Symbol 1122 GraphicUsed by:1123
Symbol 1123 MovieClip {r82}Uses:1121 963 964 996 1122 966 34 32Used by:1298
Symbol 1124 GraphicUsed by:1127
Symbol 1125 GraphicUsed by:1127
Symbol 1126 GraphicUsed by:1127
Symbol 1127 MovieClip {r83}Uses:1124 963 964 1039 1125 966 1126 34 32Used by:1298
Symbol 1128 GraphicUsed by:1130
Symbol 1129 GraphicUsed by:1130
Symbol 1130 MovieClip {r84}Uses:1128 963 964 1129 966 34 32Used by:1298
Symbol 1131 GraphicUsed by:1134
Symbol 1132 GraphicUsed by:1134
Symbol 1133 GraphicUsed by:1134
Symbol 1134 MovieClip {r85}Uses:1131 963 964 1132 966 1133 34 32Used by:1298
Symbol 1135 GraphicUsed by:1137
Symbol 1136 GraphicUsed by:1137
Symbol 1137 MovieClip {r86}Uses:1135 963 964 996 1136 966 34 32Used by:1298
Symbol 1138 GraphicUsed by:1142
Symbol 1139 GraphicUsed by:1142
Symbol 1140 GraphicUsed by:1142
Symbol 1141 GraphicUsed by:1142
Symbol 1142 MovieClip {r91}Uses:1138 963 964 996 1139 966 1140 1141 34 32Used by:1298
Symbol 1143 GraphicUsed by:1147
Symbol 1144 GraphicUsed by:1147
Symbol 1145 GraphicUsed by:1147
Symbol 1146 GraphicUsed by:1147
Symbol 1147 MovieClip {r92}Uses:1143 963 964 996 1144 966 1145 1146 34 32Used by:1298
Symbol 1148 GraphicUsed by:1152
Symbol 1149 GraphicUsed by:1152
Symbol 1150 GraphicUsed by:1152
Symbol 1151 GraphicUsed by:1152
Symbol 1152 MovieClip {r93}Uses:1148 963 964 1149 966 1150 1151 34 32Used by:1298
Symbol 1153 GraphicUsed by:1157
Symbol 1154 GraphicUsed by:1157
Symbol 1155 GraphicUsed by:1157
Symbol 1156 GraphicUsed by:1157
Symbol 1157 MovieClip {r94}Uses:1153 963 964 1154 966 996 1155 1156 34 32Used by:1298
Symbol 1158 GraphicUsed by:1162
Symbol 1159 GraphicUsed by:1162
Symbol 1160 GraphicUsed by:1162
Symbol 1161 GraphicUsed by:1162
Symbol 1162 MovieClip {r95}Uses:1158 963 964 1159 966 996 1039 1160 1161 34 32Used by:1298
Symbol 1163 GraphicUsed by:1169
Symbol 1164 GraphicUsed by:1169
Symbol 1165 GraphicUsed by:1169 1173 1177 1181 1185 1189 1193 1197 1201 1205 1209 1213 1217 1221 1228 1232 1236 1240 1244
Symbol 1166 GraphicUsed by:1169
Symbol 1167 GraphicUsed by:1169
Symbol 1168 GraphicUsed by:1169
Symbol 1169 MovieClip {r96}Uses:1163 963 964 1164 1165 1166 966 1167 1168 34 32Used by:1298
Symbol 1170 GraphicUsed by:1173
Symbol 1171 GraphicUsed by:1173
Symbol 1172 GraphicUsed by:1173
Symbol 1173 MovieClip {r104}Uses:1170 1165 1171 977 1172 34 32Used by:1298
Symbol 1174 GraphicUsed by:1177
Symbol 1175 GraphicUsed by:1177
Symbol 1176 GraphicUsed by:1177
Symbol 1177 MovieClip {r105}Uses:1174 1165 996 1039 1175 977 1176 34 32Used by:1298
Symbol 1178 GraphicUsed by:1181
Symbol 1179 GraphicUsed by:1181
Symbol 1180 GraphicUsed by:1181
Symbol 1181 MovieClip {r106}Uses:1178 1165 996 1039 1179 977 1180 34 32Used by:1298
Symbol 1182 GraphicUsed by:1185
Symbol 1183 GraphicUsed by:1185
Symbol 1184 GraphicUsed by:1185
Symbol 1185 MovieClip {r107}Uses:1182 1165 996 1183 977 1184 34 32Used by:1298
Symbol 1186 GraphicUsed by:1189
Symbol 1187 GraphicUsed by:1189
Symbol 1188 GraphicUsed by:1189
Symbol 1189 MovieClip {r108}Uses:1186 1165 1187 977 1188 34 32Used by:1298
Symbol 1190 GraphicUsed by:1193
Symbol 1191 GraphicUsed by:1193
Symbol 1192 GraphicUsed by:1193
Symbol 1193 MovieClip {r109}Uses:1190 1165 1191 977 1192 34 32Used by:1298
Symbol 1194 GraphicUsed by:1197
Symbol 1195 GraphicUsed by:1197
Symbol 1196 GraphicUsed by:1197
Symbol 1197 MovieClip {r113}Uses:1194 1165 996 1195 977 1196 34 32Used by:1298
Symbol 1198 GraphicUsed by:1201
Symbol 1199 GraphicUsed by:1201
Symbol 1200 GraphicUsed by:1201
Symbol 1201 MovieClip {r114}Uses:1198 1165 996 1199 977 1200 34 32Used by:1298
Symbol 1202 GraphicUsed by:1205
Symbol 1203 GraphicUsed by:1205
Symbol 1204 GraphicUsed by:1205
Symbol 1205 MovieClip {r115}Uses:1202 1165 1039 1203 977 1204 34 32Used by:1298
Symbol 1206 GraphicUsed by:1209
Symbol 1207 GraphicUsed by:1209
Symbol 1208 GraphicUsed by:1209
Symbol 1209 MovieClip {r116}Uses:1206 1165 996 1207 977 1208 34 32Used by:1298
Symbol 1210 GraphicUsed by:1213
Symbol 1211 GraphicUsed by:1213
Symbol 1212 GraphicUsed by:1213
Symbol 1213 MovieClip {r117}Uses:1210 1165 996 1211 977 1212 34 32Used by:1298
Symbol 1214 GraphicUsed by:1217
Symbol 1215 GraphicUsed by:1217
Symbol 1216 GraphicUsed by:1217
Symbol 1217 MovieClip {r118}Uses:1214 1165 1215 977 1216 34 32Used by:1298
Symbol 1218 GraphicUsed by:1221
Symbol 1219 GraphicUsed by:1221
Symbol 1220 GraphicUsed by:1221
Symbol 1221 MovieClip {r119}Uses:1218 1165 1219 977 1220 34 32Used by:1298
Symbol 1222 GraphicUsed by:1224
Symbol 1223 GraphicUsed by:1224
Symbol 1224 MovieClip {r121}Uses:1222 977 1223 34 32Used by:1298
Symbol 1225 GraphicUsed by:1228
Symbol 1226 GraphicUsed by:1228
Symbol 1227 GraphicUsed by:1228
Symbol 1228 MovieClip {r124}Uses:1225 1165 996 1039 1226 977 1227 34 32Used by:1298
Symbol 1229 GraphicUsed by:1232
Symbol 1230 GraphicUsed by:1232
Symbol 1231 GraphicUsed by:1232
Symbol 1232 MovieClip {r125}Uses:1229 1165 1039 996 1230 977 1231 34 32Used by:1298
Symbol 1233 GraphicUsed by:1236
Symbol 1234 GraphicUsed by:1236
Symbol 1235 GraphicUsed by:1236
Symbol 1236 MovieClip {r127}Uses:1233 1165 1234 977 1235 34 32Used by:1298
Symbol 1237 GraphicUsed by:1240
Symbol 1238 GraphicUsed by:1240
Symbol 1239 GraphicUsed by:1240
Symbol 1240 MovieClip {r128}Uses:1237 1165 1039 996 1238 977 1239 34 32Used by:1298
Symbol 1241 GraphicUsed by:1244
Symbol 1242 GraphicUsed by:1244
Symbol 1243 GraphicUsed by:1244
Symbol 1244 MovieClip {r129}Uses:1241 1165 1242 977 1243 34 32Used by:1298
Symbol 1245 GraphicUsed by:1246
Symbol 1246 MovieClip {r131}Uses:996 1245 34 32Used by:1298
Symbol 1247 GraphicUsed by:1248
Symbol 1248 MovieClip {r132}Uses:1039 1247 34 32Used by:1298
Symbol 1249 GraphicUsed by:1250
Symbol 1250 MovieClip {r133}Uses:996 1249 34 32Used by:1298
Symbol 1251 GraphicUsed by:1252
Symbol 1252 MovieClip {r134}Uses:1039 996 1251 34 32Used by:1298
Symbol 1253 GraphicUsed by:1254
Symbol 1254 MovieClip {r135}Uses:996 1253 34 32Used by:1298
Symbol 1255 GraphicUsed by:1256
Symbol 1256 MovieClip {r136}Uses:1039 996 1255 34 32Used by:1298
Symbol 1257 GraphicUsed by:1258
Symbol 1258 MovieClip {r1310}Uses:1039 1257 34 32Used by:1298
Symbol 1259 GraphicUsed by:1260
Symbol 1260 MovieClip {r141}Uses:1259 34 32Used by:1298
Symbol 1261 GraphicUsed by:1262
Symbol 1262 MovieClip {r142}Uses:996 1261 34 32Used by:1298
Symbol 1263 GraphicUsed by:1264
Symbol 1264 MovieClip {r143}Uses:996 1263 34 32Used by:1298
Symbol 1265 GraphicUsed by:1266
Symbol 1266 MovieClip {r145}Uses:996 1039 1265 34 32Used by:1298
Symbol 1267 GraphicUsed by:1268
Symbol 1268 MovieClip {r147}Uses:1267 34 32Used by:1298
Symbol 1269 GraphicUsed by:1270
Symbol 1270 MovieClip {r149}Uses:996 1039 1269 34 32Used by:1298
Symbol 1271 GraphicUsed by:1283
Symbol 1272 Sound {BGM2}Used by:1283 1298
Symbol 1273 Sound {Blast_sd}Used by:1283 1298
Symbol 1274 Sound {gong_sd}Used by:1283 1298
Symbol 1275 Sound {BGM3}Used by:1283 1298
Symbol 1276 Sound {UIBGM}Used by:1283 1298
Symbol 1277 Sound {BGM4}Used by:1283 1298
Symbol 1278 Sound {wu_sd}Used by:1283 1298
Symbol 1279 Sound {run_sd}Used by:1283 1298
Symbol 1280 Sound {BGM5}Used by:1283 1298
Symbol 1281 Sound {win_sd}Used by:1283 1298
Symbol 1282 Sound {BGM1}Used by:1283 1298
Symbol 1283 MovieClip {r1410}Uses:1271 34 32 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282Used by:1298
Symbol 1284 GraphicUsed by:1285
Symbol 1285 MovieClip {r151}Uses:996 1284 34 32Used by:1298
Symbol 1286 GraphicUsed by:1287
Symbol 1287 MovieClip {r153}Uses:1039 1286 34 32Used by:1298
Symbol 1288 GraphicUsed by:1289
Symbol 1289 MovieClip {r156}Uses:996 1288 34 32Used by:1298
Symbol 1290 GraphicUsed by:1291
Symbol 1291 MovieClip {r157}Uses:996 1039 1290 34 32Used by:1298
Symbol 1292 GraphicUsed by:1293
Symbol 1293 MovieClip {r158}Uses:996 1292 34 32Used by:1298
Symbol 1294 GraphicUsed by:1295
Symbol 1295 MovieClip {r159}Uses:996 1294 34 32Used by:1298
Symbol 1296 GraphicUsed by:1297
Symbol 1297 MovieClip {r1510}Uses:1296 34 32Used by:1298
Symbol 1298 MovieClipUses:32 37 39 121 128 135 142 162 168 173 178 183 187 213 229 305 341 359 478 525 836 881 908 923 926 929 932 935 948 951 957 961 970 974 981 985 989 991 993 998 1000 1002 1004 1007 1010 1013 1016 1019 1021 1023 1025 1027 1032 1035 1042 1045 1048 1051 1055 1058 1061 1064 1067 1070 1073 1075 1078 1081 1084 1087 1091 1095 1099 1103 1107 1112 1116 1120 1123 1127 1130 1134 1137 1142 1147 1152 1157 1162 1169 1173 1177 1181 1185 1189 1193 1197 1201 1205 1209 1213 1217 1221 1224 1228 1232 1236 1240 1244 1246 1248 1250 1252 1254 1256 1258 1260 1262 1264 1266 1268 1270 1283 1285 1287 1289 1291 1293 1295 1297 1273 1274 1275 1272 1276 1277 1278 1279 1280 1281 1282Used by:Timeline
Streaming Sound 1Used by:Symbol 19 MovieClip {CoalExpress4_fla.logo_animation_2}

Instance Names

"urlButton"Symbol 19 MovieClip {CoalExpress4_fla.logo_animation_2} Frame 1Symbol 5 Button
"logoAnimation"Symbol 30 MovieClip {CoalExpress4_fla.Timeline_1} Frame 1Symbol 19 MovieClip {CoalExpress4_fla.logo_animation_2}
"bar"Symbol 30 MovieClip {CoalExpress4_fla.Timeline_1} Frame 1Symbol 22 MovieClip
"playBtn"Symbol 30 MovieClip {CoalExpress4_fla.Timeline_1} Frame 23Symbol 28 Button
"anchor1"Symbol 37 MovieClip {anchor} Frame 1Symbol 36 MovieClip
"anchor2"Symbol 37 MovieClip {anchor} Frame 1Symbol 36 MovieClip
"a3"Symbol 120 MovieClip {CoalExpress4_fla.Timeline_21} Frame 1Symbol 49 MovieClip
"a4"Symbol 120 MovieClip {CoalExpress4_fla.Timeline_21} Frame 1Symbol 49 MovieClip
"a1"Symbol 120 MovieClip {CoalExpress4_fla.Timeline_21} Frame 1Symbol 49 MovieClip
"a2"Symbol 120 MovieClip {CoalExpress4_fla.Timeline_21} Frame 1Symbol 49 MovieClip
"b5"Symbol 120 MovieClip {CoalExpress4_fla.Timeline_21} Frame 1Symbol 52 MovieClip
"b6"Symbol 120 MovieClip {CoalExpress4_fla.Timeline_21} Frame 1Symbol 52 MovieClip
"b7"Symbol 120 MovieClip {CoalExpress4_fla.Timeline_21} Frame 1Symbol 52 MovieClip
"b8"Symbol 120 MovieClip {CoalExpress4_fla.Timeline_21} Frame 1Symbol 52 MovieClip
"b1"Symbol 120 MovieClip {CoalExpress4_fla.Timeline_21} Frame 1Symbol 52 MovieClip
"b2"Symbol 120 MovieClip {CoalExpress4_fla.Timeline_21} Frame 1Symbol 52 MovieClip
"b3"Symbol 120 MovieClip {CoalExpress4_fla.Timeline_21} Frame 1Symbol 52 MovieClip
"b4"Symbol 120 MovieClip {CoalExpress4_fla.Timeline_21} Frame 1Symbol 52 MovieClip
"c6"Symbol 120 MovieClip {CoalExpress4_fla.Timeline_21} Frame 1Symbol 55 MovieClip
"c7"Symbol 120 MovieClip {CoalExpress4_fla.Timeline_21} Frame 1Symbol 55 MovieClip
"c8"Symbol 120 MovieClip {CoalExpress4_fla.Timeline_21} Frame 1Symbol 55 MovieClip
"c9"Symbol 120 MovieClip {CoalExpress4_fla.Timeline_21} Frame 1Symbol 55 MovieClip
"c10"Symbol 120 MovieClip {CoalExpress4_fla.Timeline_21} Frame 1Symbol 55 MovieClip
"c1"Symbol 120 MovieClip {CoalExpress4_fla.Timeline_21} Frame 1Symbol 55 MovieClip
"c2"Symbol 120 MovieClip {CoalExpress4_fla.Timeline_21} Frame 1Symbol 55 MovieClip
"c3"Symbol 120 MovieClip {CoalExpress4_fla.Timeline_21} Frame 1Symbol 55 MovieClip
"c4"Symbol 120 MovieClip {CoalExpress4_fla.Timeline_21} Frame 1Symbol 55 MovieClip
"c5"Symbol 120 MovieClip {CoalExpress4_fla.Timeline_21} Frame 1Symbol 55 MovieClip
"d4"Symbol 120 MovieClip {CoalExpress4_fla.Timeline_21} Frame 1Symbol 58 MovieClip
"d5"Symbol 120 MovieClip {CoalExpress4_fla.Timeline_21} Frame 1Symbol 58 MovieClip
"d6"Symbol 120 MovieClip {CoalExpress4_fla.Timeline_21} Frame 1Symbol 58 MovieClip
"d1"Symbol 120 MovieClip {CoalExpress4_fla.Timeline_21} Frame 1Symbol 58 MovieClip
"d2"Symbol 120 MovieClip {CoalExpress4_fla.Timeline_21} Frame 1Symbol 58 MovieClip
"d3"Symbol 120 MovieClip {CoalExpress4_fla.Timeline_21} Frame 1Symbol 58 MovieClip
"e4"Symbol 120 MovieClip {CoalExpress4_fla.Timeline_21} Frame 1Symbol 61 MovieClip
"e5"Symbol 120 MovieClip {CoalExpress4_fla.Timeline_21} Frame 1Symbol 61 MovieClip
"e6"Symbol 120 MovieClip {CoalExpress4_fla.Timeline_21} Frame 1Symbol 61 MovieClip
"e1"Symbol 120 MovieClip {CoalExpress4_fla.Timeline_21} Frame 1Symbol 61 MovieClip
"e2"Symbol 120 MovieClip {CoalExpress4_fla.Timeline_21} Frame 1Symbol 61 MovieClip
"e3"Symbol 120 MovieClip {CoalExpress4_fla.Timeline_21} Frame 1Symbol 61 MovieClip
"f7"Symbol 120 MovieClip {CoalExpress4_fla.Timeline_21} Frame 1Symbol 64 MovieClip
"f8"Symbol 120 MovieClip {CoalExpress4_fla.Timeline_21} Frame 1Symbol 64 MovieClip
"f9"Symbol 120 MovieClip {CoalExpress4_fla.Timeline_21} Frame 1Symbol 64 MovieClip
"f6"Symbol 120 MovieClip {CoalExpress4_fla.Timeline_21} Frame 1Symbol 64 MovieClip
"f5"Symbol 120 MovieClip {CoalExpress4_fla.Timeline_21} Frame 1Symbol 64 MovieClip
"f4"Symbol 120 MovieClip {CoalExpress4_fla.Timeline_21} Frame 1Symbol 64 MovieClip
"f1"Symbol 120 MovieClip {CoalExpress4_fla.Timeline_21} Frame 1Symbol 64 MovieClip
"f2"Symbol 120 MovieClip {CoalExpress4_fla.Timeline_21} Frame 1Symbol 64 MovieClip
"f3"Symbol 120 MovieClip {CoalExpress4_fla.Timeline_21} Frame 1Symbol 64 MovieClip
"g4"Symbol 120 MovieClip {CoalExpress4_fla.Timeline_21} Frame 1Symbol 67 MovieClip
"g5"Symbol 120 MovieClip {CoalExpress4_fla.Timeline_21} Frame 1Symbol 67 MovieClip
"g6"Symbol 120 MovieClip {CoalExpress4_fla.Timeline_21} Frame 1Symbol 67 MovieClip
"g3"Symbol 120 MovieClip {CoalExpress4_fla.Timeline_21} Frame 1Symbol 67 MovieClip
"g2"Symbol 120 MovieClip {CoalExpress4_fla.Timeline_21} Frame 1Symbol 67 MovieClip
"g1"Symbol 120 MovieClip {CoalExpress4_fla.Timeline_21} Frame 1Symbol 67 MovieClip
"h4"Symbol 120 MovieClip {CoalExpress4_fla.Timeline_21} Frame 1Symbol 70 MovieClip
"h5"Symbol 120 MovieClip {CoalExpress4_fla.Timeline_21} Frame 1Symbol 70 MovieClip
"h6"Symbol 120 MovieClip {CoalExpress4_fla.Timeline_21} Frame 1Symbol 70 MovieClip
"h7"Symbol 120 MovieClip {CoalExpress4_fla.Timeline_21} Frame 1Symbol 70 MovieClip
"h3"Symbol 120 MovieClip {CoalExpress4_fla.Timeline_21} Frame 1Symbol 70 MovieClip
"h1"Symbol 120 MovieClip {CoalExpress4_fla.Timeline_21} Frame 1Symbol 70 MovieClip
"h2"Symbol 120 MovieClip {CoalExpress4_fla.Timeline_21} Frame 1Symbol 70 MovieClip
"i1"Symbol 120 MovieClip {CoalExpress4_fla.Timeline_21} Frame 1Symbol 85 MovieClip {CoalExpress4_fla.9_30}
"i2"Symbol 120 MovieClip {CoalExpress4_fla.Timeline_21} Frame 1Symbol 85 MovieClip {CoalExpress4_fla.9_30}
"i3"Symbol 120 MovieClip {CoalExpress4_fla.Timeline_21} Frame 1Symbol 85 MovieClip {CoalExpress4_fla.9_30}
"j5"Symbol 120 MovieClip {CoalExpress4_fla.Timeline_21} Frame 1Symbol 87 MovieClip
"j6"Symbol 120 MovieClip {CoalExpress4_fla.Timeline_21} Frame 1Symbol 87 MovieClip
"j7"Symbol 120 MovieClip {CoalExpress4_fla.Timeline_21} Frame 1Symbol 87 MovieClip
"j8"Symbol 120 MovieClip {CoalExpress4_fla.Timeline_21} Frame 1Symbol 87 MovieClip
"j4"Symbol 120 MovieClip {CoalExpress4_fla.Timeline_21} Frame 1Symbol 87 MovieClip
"j3"Symbol 120 MovieClip {CoalExpress4_fla.Timeline_21} Frame 1Symbol 87 MovieClip
"j2"Symbol 120 MovieClip {CoalExpress4_fla.Timeline_21} Frame 1Symbol 87 MovieClip
"j1"Symbol 120 MovieClip {CoalExpress4_fla.Timeline_21} Frame 1Symbol 87 MovieClip
"k4"Symbol 120 MovieClip {CoalExpress4_fla.Timeline_21} Frame 1Symbol 89 MovieClip
"k5"Symbol 120 MovieClip {CoalExpress4_fla.Timeline_21} Frame 1Symbol 89 MovieClip
"k3"Symbol 120 MovieClip {CoalExpress4_fla.Timeline_21} Frame 1Symbol 89 MovieClip
"k2"Symbol 120 MovieClip {CoalExpress4_fla.Timeline_21} Frame 1Symbol 89 MovieClip
"k1"Symbol 120 MovieClip {CoalExpress4_fla.Timeline_21} Frame 1Symbol 89 MovieClip
"l2"Symbol 120 MovieClip {CoalExpress4_fla.Timeline_21} Frame 1Symbol 97 MovieClip {CoalExpress4_fla.12_37}
"l3"Symbol 120 MovieClip {CoalExpress4_fla.Timeline_21} Frame 1Symbol 97 MovieClip {CoalExpress4_fla.12_37}
"l1"Symbol 120 MovieClip {CoalExpress4_fla.Timeline_21} Frame 1Symbol 97 MovieClip {CoalExpress4_fla.12_37}
"m3"Symbol 120 MovieClip {CoalExpress4_fla.Timeline_21} Frame 1Symbol 100 MovieClip
"m4"Symbol 120 MovieClip {CoalExpress4_fla.Timeline_21} Frame 1Symbol 100 MovieClip
"m5"Symbol 120 MovieClip {CoalExpress4_fla.Timeline_21} Frame 1Symbol 100 MovieClip
"m2"Symbol 120 MovieClip {CoalExpress4_fla.Timeline_21} Frame 1Symbol 100 MovieClip
"m1"Symbol 120 MovieClip {CoalExpress4_fla.Timeline_21} Frame 1Symbol 100 MovieClip
"n1"Symbol 120 MovieClip {CoalExpress4_fla.Timeline_21} Frame 1Symbol 106 MovieClip {CoalExpress4_fla.14_44}
"n2"Symbol 120 MovieClip {CoalExpress4_fla.Timeline_21} Frame 1Symbol 106 MovieClip {CoalExpress4_fla.14_44}
"o1"Symbol 120 MovieClip {CoalExpress4_fla.Timeline_21} Frame 1Symbol 119 MovieClip {CoalExpress4_fla.15_47}
"o2"Symbol 120 MovieClip {CoalExpress4_fla.Timeline_21} Frame 1Symbol 119 MovieClip {CoalExpress4_fla.15_47}
"lun4"Symbol 121 MovieClip {box1} Frame 1Symbol 41 MovieClip
"lun3"Symbol 121 MovieClip {box1} Frame 1Symbol 41 MovieClip
"lun2"Symbol 121 MovieClip {box1} Frame 1Symbol 41 MovieClip
"lun1"Symbol 121 MovieClip {box1} Frame 1Symbol 41 MovieClip
"di"Symbol 121 MovieClip {box1} Frame 1Symbol 43 MovieClip
"body"Symbol 121 MovieClip {box1} Frame 1Symbol 45 MovieClip
"hit"Symbol 121 MovieClip {box1} Frame 1Symbol 47 MovieClip
"anchor2"Symbol 121 MovieClip {box1} Frame 1Symbol 36 MovieClip
"anchor1"Symbol 121 MovieClip {box1} Frame 1Symbol 36 MovieClip
"cargo"Symbol 121 MovieClip {box1} Frame 1Symbol 120 MovieClip {CoalExpress4_fla.Timeline_21}
"lun4"Symbol 128 MovieClip {box2} Frame 1Symbol 123 MovieClip
"lun3"Symbol 128 MovieClip {box2} Frame 1Symbol 123 MovieClip
"lun2"Symbol 128 MovieClip {box2} Frame 1Symbol 123 MovieClip
"lun1"Symbol 128 MovieClip {box2} Frame 1Symbol 123 MovieClip
"di"Symbol 128 MovieClip {box2} Frame 1Symbol 125 MovieClip
"body"Symbol 128 MovieClip {box2} Frame 1Symbol 127 MovieClip
"hit"Symbol 128 MovieClip {box2} Frame 1Symbol 47 MovieClip
"anchor2"Symbol 128 MovieClip {box2} Frame 1Symbol 36 MovieClip
"anchor1"Symbol 128 MovieClip {box2} Frame 1Symbol 36 MovieClip
"cargo"Symbol 128 MovieClip {box2} Frame 1Symbol 120 MovieClip {CoalExpress4_fla.Timeline_21}
"lun4"Symbol 135 MovieClip {box3} Frame 1Symbol 130 MovieClip
"lun3"Symbol 135 MovieClip {box3} Frame 1Symbol 130 MovieClip
"lun2"Symbol 135 MovieClip {box3} Frame 1Symbol 130 MovieClip
"lun1"Symbol 135 MovieClip {box3} Frame 1Symbol 130 MovieClip
"hit"Symbol 135 MovieClip {box3} Frame 1Symbol 47 MovieClip
"anchor2"Symbol 135 MovieClip {box3} Frame 1Symbol 36 MovieClip
"anchor1"Symbol 135 MovieClip {box3} Frame 1Symbol 36 MovieClip
"cargo"Symbol 135 MovieClip {box3} Frame 1Symbol 120 MovieClip {CoalExpress4_fla.Timeline_21}
"lun4"Symbol 142 MovieClip {box4} Frame 1Symbol 137 MovieClip
"lun3"Symbol 142 MovieClip {box4} Frame 1Symbol 137 MovieClip
"lun2"Symbol 142 MovieClip {box4} Frame 1Symbol 137 MovieClip
"lun1"Symbol 142 MovieClip {box4} Frame 1Symbol 137 MovieClip
"hit"Symbol 142 MovieClip {box4} Frame 1Symbol 47 MovieClip
"anchor2"Symbol 142 MovieClip {box4} Frame 1Symbol 36 MovieClip
"anchor1"Symbol 142 MovieClip {box4} Frame 1Symbol 36 MovieClip
"cargo"Symbol 142 MovieClip {box4} Frame 1Symbol 120 MovieClip {CoalExpress4_fla.Timeline_21}
"l3"Symbol 168 MovieClip {train1} Frame 1Symbol 41 MovieClip
"l2"Symbol 168 MovieClip {train1} Frame 1Symbol 41 MovieClip
"l1"Symbol 168 MovieClip {train1} Frame 1Symbol 41 MovieClip
"di"Symbol 168 MovieClip {train1} Frame 1Symbol 164 MovieClip
"head"Symbol 168 MovieClip {train1} Frame 1Symbol 166 MovieClip
"yan1"Symbol 168 MovieClip {train1} Frame 1Symbol 167 MovieClip
"yan2"Symbol 168 MovieClip {train1} Frame 1Symbol 167 MovieClip
"yan3"Symbol 168 MovieClip {train1} Frame 1Symbol 167 MovieClip
"anchor2"Symbol 168 MovieClip {train1} Frame 1Symbol 36 MovieClip
"anchor1"Symbol 168 MovieClip {train1} Frame 1Symbol 36 MovieClip
"l3"Symbol 173 MovieClip {train2} Frame 1Symbol 123 MovieClip
"l2"Symbol 173 MovieClip {train2} Frame 1Symbol 123 MovieClip
"l1"Symbol 173 MovieClip {train2} Frame 1Symbol 123 MovieClip
"di"Symbol 173 MovieClip {train2} Frame 1Symbol 170 MovieClip
"head"Symbol 173 MovieClip {train2} Frame 1Symbol 172 MovieClip
"yan1"Symbol 173 MovieClip {train2} Frame 1Symbol 167 MovieClip
"yan2"Symbol 173 MovieClip {train2} Frame 1Symbol 167 MovieClip
"yan3"Symbol 173 MovieClip {train2} Frame 1Symbol 167 MovieClip
"anchor2"Symbol 173 MovieClip {train2} Frame 1Symbol 36 MovieClip
"anchor1"Symbol 173 MovieClip {train2} Frame 1Symbol 36 MovieClip
"l3"Symbol 178 MovieClip {train3} Frame 1Symbol 130 MovieClip
"l2"Symbol 178 MovieClip {train3} Frame 1Symbol 130 MovieClip
"l1"Symbol 178 MovieClip {train3} Frame 1Symbol 130 MovieClip
"di"Symbol 178 MovieClip {train3} Frame 1Symbol 175 MovieClip
"head"Symbol 178 MovieClip {train3} Frame 1Symbol 177 MovieClip
"yan1"Symbol 178 MovieClip {train3} Frame 1Symbol 167 MovieClip
"yan2"Symbol 178 MovieClip {train3} Frame 1Symbol 167 MovieClip
"yan3"Symbol 178 MovieClip {train3} Frame 1Symbol 167 MovieClip
"anchor2"Symbol 178 MovieClip {train3} Frame 1Symbol 36 MovieClip
"anchor1"Symbol 178 MovieClip {train3} Frame 1Symbol 36 MovieClip
"l3"Symbol 183 MovieClip {train4} Frame 1Symbol 137 MovieClip
"l2"Symbol 183 MovieClip {train4} Frame 1Symbol 137 MovieClip
"l1"Symbol 183 MovieClip {train4} Frame 1Symbol 137 MovieClip
"di"Symbol 183 MovieClip {train4} Frame 1Symbol 180 MovieClip
"head"Symbol 183 MovieClip {train4} Frame 1Symbol 182 MovieClip
"yan1"Symbol 183 MovieClip {train4} Frame 1Symbol 167 MovieClip
"yan2"Symbol 183 MovieClip {train4} Frame 1Symbol 167 MovieClip
"yan3"Symbol 183 MovieClip {train4} Frame 1Symbol 167 MovieClip
"anchor2"Symbol 183 MovieClip {train4} Frame 1Symbol 36 MovieClip
"anchor1"Symbol 183 MovieClip {train4} Frame 1Symbol 36 MovieClip
"play_btn"Symbol 213 MovieClip {Cover} Frame 1Symbol 196 Button
"moregame_btn"Symbol 213 MovieClip {Cover} Frame 1Symbol 200 Button
"ce1"Symbol 213 MovieClip {Cover} Frame 1Symbol 204 Button
"ce2"Symbol 213 MovieClip {Cover} Frame 1Symbol 208 Button
"ce3"Symbol 213 MovieClip {Cover} Frame 1Symbol 212 Button
"moregame_btn"Symbol 229 MovieClip {Gameovermc} Frame 1Symbol 218 Button
"retry_btn"Symbol 229 MovieClip {Gameovermc} Frame 1Symbol 222 Button
"menu_btn"Symbol 229 MovieClip {Gameovermc} Frame 1Symbol 227 Button
"n0"Symbol 304 MovieClip {CoalExpress4_fla.Timeline_106} Frame 1Symbol 301 MovieClip
"n1"Symbol 304 MovieClip {CoalExpress4_fla.Timeline_106} Frame 1Symbol 301 MovieClip
"n2"Symbol 304 MovieClip {CoalExpress4_fla.Timeline_106} Frame 1Symbol 301 MovieClip
"res_btn"Symbol 305 MovieClip {Gameui} Frame 1Symbol 233 Button
"menu_btn"Symbol 305 MovieClip {Gameui} Frame 1Symbol 237 Button
"music_btn"Symbol 305 MovieClip {Gameui} Frame 1Symbol 247 MovieClip {CoalExpress4_fla.Timeline_96}
"pause_btn"Symbol 305 MovieClip {Gameui} Frame 1Symbol 256 MovieClip {CoalExpress4_fla.Timeline_99}
"lv1"Symbol 305 MovieClip {Gameui} Frame 1Symbol 267 MovieClip
"lv0"Symbol 305 MovieClip {Gameui} Frame 1Symbol 267 MovieClip
"t3"Symbol 305 MovieClip {Gameui} Frame 1Symbol 267 MovieClip
"t2"Symbol 305 MovieClip {Gameui} Frame 1Symbol 267 MovieClip
"t1"Symbol 305 MovieClip {Gameui} Frame 1Symbol 267 MovieClip
"t0"Symbol 305 MovieClip {Gameui} Frame 1Symbol 267 MovieClip
"cargo1"Symbol 305 MovieClip {Gameui} Frame 1Symbol 267 MovieClip
"cargo0"Symbol 305 MovieClip {Gameui} Frame 1Symbol 267 MovieClip
"Tcargo1"Symbol 305 MovieClip {Gameui} Frame 1Symbol 267 MovieClip
"Tcargo0"Symbol 305 MovieClip {Gameui} Frame 1Symbol 267 MovieClip
"power"Symbol 305 MovieClip {Gameui} Frame 1Symbol 287 MovieClip {CoalExpress4_fla.Timeline_103}
"p"Symbol 305 MovieClip {Gameui} Frame 1Symbol 304 MovieClip {CoalExpress4_fla.Timeline_106}
"res_btn"Symbol 341 MovieClip {Howtoplay} Frame 1Symbol 310 Button
"menu_btn"Symbol 341 MovieClip {Howtoplay} Frame 1Symbol 314 Button
"music_btn"Symbol 341 MovieClip {Howtoplay} Frame 1Symbol 323 MovieClip {CoalExpress4_fla.Timeline_112}
"pause_btn"Symbol 341 MovieClip {Howtoplay} Frame 1Symbol 329 MovieClip {CoalExpress4_fla.Timeline_115}
"next_btn"Symbol 341 MovieClip {Howtoplay} Frame 1Symbol 333 Button
"moregame_btn"Symbol 341 MovieClip {Howtoplay} Frame 1Symbol 338 Button
"mc"Symbol 359 MovieClip {Loadingmc} Frame 1Symbol 353 MovieClip
"s1"Symbol 478 MovieClip {Sellv} Frame 1Symbol 367 Button
"s2"Symbol 478 MovieClip {Sellv} Frame 1Symbol 373 MovieClip {CoalExpress4_fla.Timeline_126}
"s3"Symbol 478 MovieClip {Sellv} Frame 1Symbol 379 MovieClip {CoalExpress4_fla.Timeline_130}
"s4"Symbol 478 MovieClip {Sellv} Frame 1Symbol 382 Button
"s5"Symbol 478 MovieClip {Sellv} Frame 1Symbol 388 MovieClip {CoalExpress4_fla.Timeline_136}
"s6"Symbol 478 MovieClip {Sellv} Frame 1Symbol 394 MovieClip {CoalExpress4_fla.Timeline_140}
"s7"Symbol 478 MovieClip {Sellv} Frame 1Symbol 397 Button
"s8"Symbol 478 MovieClip {Sellv} Frame 1Symbol 403 MovieClip {CoalExpress4_fla.Timeline_146}
"s9"Symbol 478 MovieClip {Sellv} Frame 1Symbol 416 MovieClip {CoalExpress4_fla.Timeline_150}
"s10"Symbol 478 MovieClip {Sellv} Frame 1Symbol 419 Button
"s11"Symbol 478 MovieClip {Sellv} Frame 1Symbol 424 MovieClip {CoalExpress4_fla.Timeline_156}
"s12"Symbol 478 MovieClip {Sellv} Frame 1Symbol 430 MovieClip {CoalExpress4_fla.Timeline_160}
"s13"Symbol 478 MovieClip {Sellv} Frame 1Symbol 433 Button
"s14"Symbol 478 MovieClip {Sellv} Frame 1Symbol 441 MovieClip {CoalExpress4_fla.Timeline_166}
"s15"Symbol 478 MovieClip {Sellv} Frame 1Symbol 453 MovieClip {CoalExpress4_fla.Timeline_170}
"back_btn"Symbol 478 MovieClip {Sellv} Frame 1Symbol 457 Button
"moregame_btn"Symbol 478 MovieClip {Sellv} Frame 1Symbol 461 Button
"stage1"Symbol 525 MovieClip {Selstage} Frame 1Symbol 483 Button
"stage2"Symbol 525 MovieClip {Selstage} Frame 1Symbol 489 MovieClip {CoalExpress4_fla.Timeline_179}
"stage3"Symbol 525 MovieClip {Selstage} Frame 1Symbol 495 MovieClip {CoalExpress4_fla.Timeline_182}
"stage4"Symbol 525 MovieClip {Selstage} Frame 1Symbol 501 MovieClip {CoalExpress4_fla.Timeline_185}
"stage5"Symbol 525 MovieClip {Selstage} Frame 1Symbol 507 MovieClip {CoalExpress4_fla.Timeline_188}
"moregame_btn"Symbol 525 MovieClip {Selstage} Frame 1Symbol 338 Button
"quit_btn"Symbol 525 MovieClip {Selstage} Frame 1Symbol 511 Button
"ach_btn"Symbol 525 MovieClip {Selstage} Frame 1Symbol 515 Button
"word"Symbol 525 MovieClip {Selstage} Frame 1Symbol 517 MovieClip {CoalExpress4_fla.Timeline_193}
"shop_btn"Symbol 525 MovieClip {Selstage} Frame 1Symbol 521 Button
"p1"Symbol 525 MovieClip {Selstage} Frame 1Symbol 524 MovieClip
"p2"Symbol 525 MovieClip {Selstage} Frame 1Symbol 524 MovieClip
"t1"Symbol 605 MovieClip {CoalExpress4_fla.Timeline_213} Frame 1Symbol 558 MovieClip {CoalExpress4_fla.Timeline_214}
"t2"Symbol 605 MovieClip {CoalExpress4_fla.Timeline_213} Frame 1Symbol 563 MovieClip {CoalExpress4_fla.Timeline_217}
"t3"Symbol 605 MovieClip {CoalExpress4_fla.Timeline_213} Frame 1Symbol 567 MovieClip {CoalExpress4_fla.Timeline_220}
"t4"Symbol 605 MovieClip {CoalExpress4_fla.Timeline_213} Frame 1Symbol 571 MovieClip {CoalExpress4_fla.Timeline_223}
"i1"Symbol 635 MovieClip {CoalExpress4_fla.shopmenu1_250} Frame 1Symbol 614 MovieClip {CoalExpress4_fla.Timeline_252}
"i2"Symbol 635 MovieClip {CoalExpress4_fla.shopmenu1_250} Frame 1Symbol 619 MovieClip {CoalExpress4_fla.Timeline_255}
"i3"Symbol 635 MovieClip {CoalExpress4_fla.shopmenu1_250} Frame 1Symbol 624 MovieClip {CoalExpress4_fla.Timeline_258}
"i4"Symbol 635 MovieClip {CoalExpress4_fla.shopmenu1_250} Frame 1Symbol 629 MovieClip {CoalExpress4_fla.Timeline_261}
"i5"Symbol 635 MovieClip {CoalExpress4_fla.shopmenu1_250} Frame 1Symbol 634 MovieClip {CoalExpress4_fla.Timeline_264}
"i1"Symbol 663 MovieClip {CoalExpress4_fla.shopmenu2_267} Frame 1Symbol 642 MovieClip {CoalExpress4_fla.Timeline_269}
"i2"Symbol 663 MovieClip {CoalExpress4_fla.shopmenu2_267} Frame 1Symbol 647 MovieClip {CoalExpress4_fla.Timeline_272}
"i3"Symbol 663 MovieClip {CoalExpress4_fla.shopmenu2_267} Frame 1Symbol 652 MovieClip {CoalExpress4_fla.Timeline_275}
"i4"Symbol 663 MovieClip {CoalExpress4_fla.shopmenu2_267} Frame 1Symbol 657 MovieClip {CoalExpress4_fla.Timeline_278}
"i5"Symbol 663 MovieClip {CoalExpress4_fla.shopmenu2_267} Frame 1Symbol 662 MovieClip {CoalExpress4_fla.Timeline_281}
"i1"Symbol 691 MovieClip {CoalExpress4_fla.shopmenu3_284} Frame 1Symbol 670 MovieClip {CoalExpress4_fla.Timeline_286}
"i2"Symbol 691 MovieClip {CoalExpress4_fla.shopmenu3_284} Frame 1Symbol 675 MovieClip {CoalExpress4_fla.Timeline_289}
"i3"Symbol 691 MovieClip {CoalExpress4_fla.shopmenu3_284} Frame 1Symbol 680 MovieClip {CoalExpress4_fla.Timeline_292}
"i4"Symbol 691 MovieClip {CoalExpress4_fla.shopmenu3_284} Frame 1Symbol 685 MovieClip {CoalExpress4_fla.Timeline_295}
"i5"Symbol 691 MovieClip {CoalExpress4_fla.shopmenu3_284} Frame 1Symbol 690 MovieClip {CoalExpress4_fla.Timeline_298}
"i1"Symbol 719 MovieClip {CoalExpress4_fla.shopmenu4_301} Frame 1Symbol 698 MovieClip {CoalExpress4_fla.Timeline_303}
"i2"Symbol 719 MovieClip {CoalExpress4_fla.shopmenu4_301} Frame 1Symbol 703 MovieClip {CoalExpress4_fla.Timeline_306}
"i3"Symbol 719 MovieClip {CoalExpress4_fla.shopmenu4_301} Frame 1Symbol 708 MovieClip {CoalExpress4_fla.Timeline_309}
"i4"Symbol 719 MovieClip {CoalExpress4_fla.shopmenu4_301} Frame 1Symbol 713 MovieClip {CoalExpress4_fla.Timeline_312}
"i5"Symbol 719 MovieClip {CoalExpress4_fla.shopmenu4_301} Frame 1Symbol 718 MovieClip {CoalExpress4_fla.Timeline_315}
"i1"Symbol 747 MovieClip {CoalExpress4_fla.shopmenu5_318} Frame 1Symbol 726 MovieClip {CoalExpress4_fla.Timeline_320}
"i2"Symbol 747 MovieClip {CoalExpress4_fla.shopmenu5_318} Frame 1Symbol 731 MovieClip {CoalExpress4_fla.Timeline_323}
"i3"Symbol 747 MovieClip {CoalExpress4_fla.shopmenu5_318} Frame 1Symbol 736 MovieClip {CoalExpress4_fla.Timeline_326}
"i4"Symbol 747 MovieClip {CoalExpress4_fla.shopmenu5_318} Frame 1Symbol 741 MovieClip {CoalExpress4_fla.Timeline_329}
"i5"Symbol 747 MovieClip {CoalExpress4_fla.shopmenu5_318} Frame 1Symbol 746 MovieClip {CoalExpress4_fla.Timeline_332}
"t1"Symbol 836 MovieClip {Shop} Frame 1Symbol 543 MovieClip {CoalExpress4_fla.s_198}
"t2"Symbol 836 MovieClip {Shop} Frame 1Symbol 554 MovieClip {CoalExpress4_fla.s_208}
"t"Symbol 836 MovieClip {Shop} Frame 1Symbol 605 MovieClip {CoalExpress4_fla.Timeline_213}
"s1"Symbol 836 MovieClip {Shop} Frame 1Symbol 635 MovieClip {CoalExpress4_fla.shopmenu1_250}
"s2"Symbol 836 MovieClip {Shop} Frame 1Symbol 663 MovieClip {CoalExpress4_fla.shopmenu2_267}
"s3"Symbol 836 MovieClip {Shop} Frame 1Symbol 691 MovieClip {CoalExpress4_fla.shopmenu3_284}
"s4"Symbol 836 MovieClip {Shop} Frame 1Symbol 719 MovieClip {CoalExpress4_fla.shopmenu4_301}
"s5"Symbol 836 MovieClip {Shop} Frame 1Symbol 747 MovieClip {CoalExpress4_fla.shopmenu5_318}
"m0"Symbol 836 MovieClip {Shop} Frame 1Symbol 758 MovieClip
"m1"Symbol 836 MovieClip {Shop} Frame 1Symbol 758 MovieClip
"m2"Symbol 836 MovieClip {Shop} Frame 1Symbol 758 MovieClip
"back_btn"Symbol 836 MovieClip {Shop} Frame 1Symbol 762 Button
"b1"Symbol 836 MovieClip {Shop} Frame 1Symbol 767 Button
"b2"Symbol 836 MovieClip {Shop} Frame 1Symbol 772 Button
"b3"Symbol 836 MovieClip {Shop} Frame 1Symbol 777 Button
"b5"Symbol 836 MovieClip {Shop} Frame 1Symbol 782 Button
"b4"Symbol 836 MovieClip {Shop} Frame 1Symbol 787 Button
"word"Symbol 836 MovieClip {Shop} Frame 1Symbol 834 MovieClip {CoalExpress4_fla.Timeline_342}
"m3"Symbol 836 MovieClip {Shop} Frame 1Symbol 758 MovieClip
"m4"Symbol 836 MovieClip {Shop} Frame 1Symbol 758 MovieClip
"m5"Symbol 836 MovieClip {Shop} Frame 1Symbol 758 MovieClip
"moregame_btn"Symbol 836 MovieClip {Shop} Frame 1Symbol 338 Button
"con"Symbol 908 MovieClip {Succeed} Frame 1Symbol 883 MovieClip
"back_btn"Symbol 908 MovieClip {Succeed} Frame 1Symbol 888 Button
"word"Symbol 908 MovieClip {Succeed} Frame 1Symbol 907 MovieClip {CoalExpress4_fla.Timeline_348}
"moregame_btn"Symbol 923 MovieClip {Win} Frame 1Symbol 338 Button
"next_btn"Symbol 923 MovieClip {Win} Frame 1Symbol 913 Button
"retry_btn"Symbol 923 MovieClip {Win} Frame 1Symbol 917 Button
"w2"Symbol 923 MovieClip {Win} Frame 1Symbol 919 MovieClip
"w3"Symbol 923 MovieClip {Win} Frame 1Symbol 919 MovieClip
"w1"Symbol 923 MovieClip {Win} Frame 1Symbol 919 MovieClip
"t3"Symbol 923 MovieClip {Win} Frame 1Symbol 919 MovieClip
"t2"Symbol 923 MovieClip {Win} Frame 1Symbol 919 MovieClip
"t1"Symbol 923 MovieClip {Win} Frame 1Symbol 919 MovieClip
"t0"Symbol 923 MovieClip {Win} Frame 1Symbol 919 MovieClip
"c1"Symbol 923 MovieClip {Win} Frame 1Symbol 919 MovieClip
"c0"Symbol 923 MovieClip {Win} Frame 1Symbol 919 MovieClip
"s4"Symbol 923 MovieClip {Win} Frame 1Symbol 919 MovieClip
"s3"Symbol 923 MovieClip {Win} Frame 1Symbol 919 MovieClip
"s2"Symbol 923 MovieClip {Win} Frame 1Symbol 919 MovieClip
"s1"Symbol 923 MovieClip {Win} Frame 1Symbol 919 MovieClip
"m0"Symbol 923 MovieClip {Win} Frame 1Symbol 922 MovieClip
"m2"Symbol 923 MovieClip {Win} Frame 1Symbol 922 MovieClip
"m3"Symbol 923 MovieClip {Win} Frame 1Symbol 922 MovieClip
"m1"Symbol 923 MovieClip {Win} Frame 1Symbol 922 MovieClip
"m4"Symbol 923 MovieClip {Win} Frame 1Symbol 922 MovieClip
"m5"Symbol 923 MovieClip {Win} Frame 1Symbol 922 MovieClip
"s0"Symbol 923 MovieClip {Win} Frame 1Symbol 919 MovieClip
"w0"Symbol 923 MovieClip {Win} Frame 1Symbol 919 MovieClip
"menu_btn"Symbol 923 MovieClip {Win} Frame 1Symbol 227 Button
"shop_btn"Symbol 923 MovieClip {Win} Frame 1Symbol 521 Button
"link"Symbol 941 MovieClip {CoalExpress4_fla.Timeline_360} Frame 1Symbol 167 MovieClip
"link"Symbol 948 MovieClip {ae} Frame 1Symbol 941 MovieClip {CoalExpress4_fla.Timeline_360}
"tail"Symbol 948 MovieClip {ae} Frame 1Symbol 32 MovieClip {yuan}
"endpoint"Symbol 948 MovieClip {ae} Frame 1Symbol 947 MovieClip
"end"Symbol 948 MovieClip {ae} Frame 1Symbol 47 MovieClip
"tail"Symbol 951 MovieClip {as} Frame 1Symbol 32 MovieClip {yuan}
"link"Symbol 951 MovieClip {as} Frame 1Symbol 941 MovieClip {CoalExpress4_fla.Timeline_360}
"tail"Symbol 957 MovieClip {be} Frame 1Symbol 32 MovieClip {yuan}
"endpoint"Symbol 957 MovieClip {be} Frame 1Symbol 956 MovieClip
"end"Symbol 957 MovieClip {be} Frame 1Symbol 47 MovieClip
"link"Symbol 957 MovieClip {be} Frame 1Symbol 941 MovieClip {CoalExpress4_fla.Timeline_360}
"tail"Symbol 961 MovieClip {bs} Frame 1Symbol 32 MovieClip {yuan}
"link"Symbol 961 MovieClip {bs} Frame 1Symbol 941 MovieClip {CoalExpress4_fla.Timeline_360}
"tail"Symbol 970 MovieClip {ce} Frame 1Symbol 32 MovieClip {yuan}
"endpoint"Symbol 970 MovieClip {ce} Frame 1Symbol 969 MovieClip
"end"Symbol 970 MovieClip {ce} Frame 1Symbol 47 MovieClip
"link"Symbol 970 MovieClip {ce} Frame 1Symbol 941 MovieClip {CoalExpress4_fla.Timeline_360}
"tail"Symbol 974 MovieClip {cs} Frame 1Symbol 32 MovieClip {yuan}
"link"Symbol 974 MovieClip {cs} Frame 1Symbol 941 MovieClip {CoalExpress4_fla.Timeline_360}
"tail"Symbol 981 MovieClip {de} Frame 1Symbol 32 MovieClip {yuan}
"endpoint"Symbol 981 MovieClip {de} Frame 1Symbol 980 MovieClip
"end"Symbol 981 MovieClip {de} Frame 1Symbol 47 MovieClip
"link"Symbol 981 MovieClip {de} Frame 1Symbol 941 MovieClip {CoalExpress4_fla.Timeline_360}
"tail"Symbol 985 MovieClip {ds} Frame 1Symbol 32 MovieClip {yuan}
"link"Symbol 985 MovieClip {ds} Frame 1Symbol 941 MovieClip {CoalExpress4_fla.Timeline_360}
"tail"Symbol 989 MovieClip {ee} Frame 1Symbol 32 MovieClip {yuan}
"endpoint"Symbol 989 MovieClip {ee} Frame 1Symbol 988 MovieClip
"end"Symbol 989 MovieClip {ee} Frame 1Symbol 47 MovieClip
"link"Symbol 989 MovieClip {ee} Frame 1Symbol 941 MovieClip {CoalExpress4_fla.Timeline_360}
"tail"Symbol 991 MovieClip {es} Frame 1Symbol 32 MovieClip {yuan}
"link"Symbol 991 MovieClip {es} Frame 1Symbol 941 MovieClip {CoalExpress4_fla.Timeline_360}
"tail"Symbol 993 MovieClip {r11} Frame 1Symbol 32 MovieClip {yuan}
"tail"Symbol 998 MovieClip {r12} Frame 1Symbol 32 MovieClip {yuan}
"tail"Symbol 1000 MovieClip {r13} Frame 1Symbol 32 MovieClip {yuan}
"tail"Symbol 1002 MovieClip {r14} Frame 1Symbol 32 MovieClip {yuan}
"tail"Symbol 1004 MovieClip {r15} Frame 1Symbol 32 MovieClip {yuan}
"tail"Symbol 1007 MovieClip {r21} Frame 1Symbol 32 MovieClip {yuan}
"tail"Symbol 1010 MovieClip {r22} Frame 1Symbol 32 MovieClip {yuan}
"tail"Symbol 1013 MovieClip {r23} Frame 1Symbol 32 MovieClip {yuan}
"tail"Symbol 1016 MovieClip {r24} Frame 1Symbol 32 MovieClip {yuan}
"tail"Symbol 1019 MovieClip {r25} Frame 1Symbol 32 MovieClip {yuan}
"tail"Symbol 1021 MovieClip {r31} Frame 1Symbol 32 MovieClip {yuan}
"tail"Symbol 1023 MovieClip {r32} Frame 1Symbol 32 MovieClip {yuan}
"tail"Symbol 1025 MovieClip {r33} Frame 1Symbol 32 MovieClip {yuan}
"tail"Symbol 1027 MovieClip {r34} Frame 1Symbol 32 MovieClip {yuan}
"tail"Symbol 1032 MovieClip {r35} Frame 1Symbol 32 MovieClip {yuan}
"tail"Symbol 1035 MovieClip {r41} Frame 1Symbol 32 MovieClip {yuan}
"tail"Symbol 1042 MovieClip {r42} Frame 1Symbol 32 MovieClip {yuan}
"tail"Symbol 1045 MovieClip {r43} Frame 1Symbol 32 MovieClip {yuan}
"tail"Symbol 1048 MovieClip {r44} Frame 1Symbol 32 MovieClip {yuan}
"tail"Symbol 1051 MovieClip {r45} Frame 1Symbol 32 MovieClip {yuan}
"tail"Symbol 1055 MovieClip {r46} Frame 1Symbol 32 MovieClip {yuan}
"tail"Symbol 1058 MovieClip {r51} Frame 1Symbol 32 MovieClip {yuan}
"tail"Symbol 1061 MovieClip {r52} Frame 1Symbol 32 MovieClip {yuan}
"tail"Symbol 1064 MovieClip {r53} Frame 1Symbol 32 MovieClip {yuan}
"tail"Symbol 1067 MovieClip {r54} Frame 1Symbol 32 MovieClip {yuan}
"tail"Symbol 1070 MovieClip {r55} Frame 1Symbol 32 MovieClip {yuan}
"tail"Symbol 1073 MovieClip {r56} Frame 1Symbol 32 MovieClip {yuan}
"tail"Symbol 1075 MovieClip {r61} Frame 1Symbol 32 MovieClip {yuan}
"tail"Symbol 1078 MovieClip {r62} Frame 1Symbol 32 MovieClip {yuan}
"tail"Symbol 1081 MovieClip {r63} Frame 1Symbol 32 MovieClip {yuan}
"tail"Symbol 1084 MovieClip {r64} Frame 1Symbol 32 MovieClip {yuan}
"tail"Symbol 1087 MovieClip {r65} Frame 1Symbol 32 MovieClip {yuan}
"tail"Symbol 1091 MovieClip {r66} Frame 1Symbol 32 MovieClip {yuan}
"tail"Symbol 1095 MovieClip {r71} Frame 1Symbol 32 MovieClip {yuan}
"tail"Symbol 1099 MovieClip {r72} Frame 1Symbol 32 MovieClip {yuan}
"tail"Symbol 1103 MovieClip {r73} Frame 1Symbol 32 MovieClip {yuan}
"tail"Symbol 1107 MovieClip {r74} Frame 1Symbol 32 MovieClip {yuan}
"tail"Symbol 1112 MovieClip {r75} Frame 1Symbol 32 MovieClip {yuan}
"tail"Symbol 1116 MovieClip {r76} Frame 1Symbol 32 MovieClip {yuan}
"tail"Symbol 1120 MovieClip {r81} Frame 1Symbol 32 MovieClip {yuan}
"tail"Symbol 1123 MovieClip {r82} Frame 1Symbol 32 MovieClip {yuan}
"tail"Symbol 1127 MovieClip {r83} Frame 1Symbol 32 MovieClip {yuan}
"tail"Symbol 1130 MovieClip {r84} Frame 1Symbol 32 MovieClip {yuan}
"tail"Symbol 1134 MovieClip {r85} Frame 1Symbol 32 MovieClip {yuan}
"tail"Symbol 1137 MovieClip {r86} Frame 1Symbol 32 MovieClip {yuan}
"tail"Symbol 1142 MovieClip {r91} Frame 1Symbol 32 MovieClip {yuan}
"tail"Symbol 1147 MovieClip {r92} Frame 1Symbol 32 MovieClip {yuan}
"tail"Symbol 1152 MovieClip {r93} Frame 1Symbol 32 MovieClip {yuan}
"tail"Symbol 1157 MovieClip {r94} Frame 1Symbol 32 MovieClip {yuan}
"tail"Symbol 1162 MovieClip {r95} Frame 1Symbol 32 MovieClip {yuan}
"tail"Symbol 1169 MovieClip {r96} Frame 1Symbol 32 MovieClip {yuan}
"tail"Symbol 1173 MovieClip {r104} Frame 1Symbol 32 MovieClip {yuan}
"tail"Symbol 1177 MovieClip {r105} Frame 1Symbol 32 MovieClip {yuan}
"tail"Symbol 1181 MovieClip {r106} Frame 1Symbol 32 MovieClip {yuan}
"tail"Symbol 1185 MovieClip {r107} Frame 1Symbol 32 MovieClip {yuan}
"tail"Symbol 1189 MovieClip {r108} Frame 1Symbol 32 MovieClip {yuan}
"tail"Symbol 1193 MovieClip {r109} Frame 1Symbol 32 MovieClip {yuan}
"tail"Symbol 1197 MovieClip {r113} Frame 1Symbol 32 MovieClip {yuan}
"tail"Symbol 1201 MovieClip {r114} Frame 1Symbol 32 MovieClip {yuan}
"tail"Symbol 1205 MovieClip {r115} Frame 1Symbol 32 MovieClip {yuan}
"tail"Symbol 1209 MovieClip {r116} Frame 1Symbol 32 MovieClip {yuan}
"tail"Symbol 1213 MovieClip {r117} Frame 1Symbol 32 MovieClip {yuan}
"tail"Symbol 1217 MovieClip {r118} Frame 1Symbol 32 MovieClip {yuan}
"tail"Symbol 1221 MovieClip {r119} Frame 1Symbol 32 MovieClip {yuan}
"tail"Symbol 1224 MovieClip {r121} Frame 1Symbol 32 MovieClip {yuan}
"tail"Symbol 1228 MovieClip {r124} Frame 1Symbol 32 MovieClip {yuan}
"tail"Symbol 1232 MovieClip {r125} Frame 1Symbol 32 MovieClip {yuan}
"tail"Symbol 1236 MovieClip {r127} Frame 1Symbol 32 MovieClip {yuan}
"tail"Symbol 1240 MovieClip {r128} Frame 1Symbol 32 MovieClip {yuan}
"tail"Symbol 1244 MovieClip {r129} Frame 1Symbol 32 MovieClip {yuan}
"tail"Symbol 1246 MovieClip {r131} Frame 1Symbol 32 MovieClip {yuan}
"tail"Symbol 1248 MovieClip {r132} Frame 1Symbol 32 MovieClip {yuan}
"tail"Symbol 1250 MovieClip {r133} Frame 1Symbol 32 MovieClip {yuan}
"tail"Symbol 1252 MovieClip {r134} Frame 1Symbol 32 MovieClip {yuan}
"tail"Symbol 1254 MovieClip {r135} Frame 1Symbol 32 MovieClip {yuan}
"tail"Symbol 1256 MovieClip {r136} Frame 1Symbol 32 MovieClip {yuan}
"tail"Symbol 1258 MovieClip {r1310} Frame 1Symbol 32 MovieClip {yuan}
"tail"Symbol 1260 MovieClip {r141} Frame 1Symbol 32 MovieClip {yuan}
"tail"Symbol 1262 MovieClip {r142} Frame 1Symbol 32 MovieClip {yuan}
"tail"Symbol 1264 MovieClip {r143} Frame 1Symbol 32 MovieClip {yuan}
"tail"Symbol 1266 MovieClip {r145} Frame 1Symbol 32 MovieClip {yuan}
"tail"Symbol 1268 MovieClip {r147} Frame 1Symbol 32 MovieClip {yuan}
"tail"Symbol 1270 MovieClip {r149} Frame 1Symbol 32 MovieClip {yuan}
"tail"Symbol 1283 MovieClip {r1410} Frame 1Symbol 32 MovieClip {yuan}
"tail"Symbol 1285 MovieClip {r151} Frame 1Symbol 32 MovieClip {yuan}
"tail"Symbol 1287 MovieClip {r153} Frame 1Symbol 32 MovieClip {yuan}
"tail"Symbol 1289 MovieClip {r156} Frame 1Symbol 32 MovieClip {yuan}
"tail"Symbol 1291 MovieClip {r157} Frame 1Symbol 32 MovieClip {yuan}
"tail"Symbol 1293 MovieClip {r158} Frame 1Symbol 32 MovieClip {yuan}
"tail"Symbol 1295 MovieClip {r159} Frame 1Symbol 32 MovieClip {yuan}
"tail"Symbol 1297 MovieClip {r1510} Frame 1Symbol 32 MovieClip {yuan}

Special Tags

FileAttributes (69)Timeline Frame 1Access local files only, Metadata not present, AS3.
Tag 0x0FF (255)Timeline Frame 11 bytes " "
EnableDebugger2 (64)Timeline Frame 131 bytes "..$1$ce$jJSYmh1ZXtx.0fF3KtnZ60."

Labels

"loaded"Symbol 30 MovieClip {CoalExpress4_fla.Timeline_1} Frame 2
"playOut"Symbol 30 MovieClip {CoalExpress4_fla.Timeline_1} Frame 24
"1"Symbol 73 MovieClip {CoalExpress4_fla.Timeline_31} Frame 1
"1"Symbol 75 MovieClip {CoalExpress4_fla.Timeline_33} Frame 1
"2"Symbol 84 MovieClip {CoalExpress4_fla.Timeline_34} Frame 1
"1"Symbol 92 MovieClip {CoalExpress4_fla.Timeline_38} Frame 1
"1"Symbol 93 MovieClip {CoalExpress4_fla.Timeline_40} Frame 1
"2"Symbol 96 MovieClip {CoalExpress4_fla.Timeline_41} Frame 1
"1"Symbol 106 MovieClip {CoalExpress4_fla.14_44} Frame 1
"2"Symbol 106 MovieClip {CoalExpress4_fla.14_44} Frame 3
"1"Symbol 109 MovieClip {CoalExpress4_fla.Timeline_48} Frame 1
"1"Symbol 110 MovieClip {CoalExpress4_fla.Timeline_50} Frame 1
"2"Symbol 118 MovieClip {CoalExpress4_fla.Timeline_51} Frame 1
"1"Symbol 411 MovieClip {CoalExpress4_fla.03_151} Frame 1
"2"Symbol 411 MovieClip {CoalExpress4_fla.03_151} Frame 5
"1"Symbol 425 MovieClip {CoalExpress4_fla.04_161} Frame 1
"2"Symbol 425 MovieClip {CoalExpress4_fla.04_161} Frame 5
"1"Symbol 436 MovieClip {CoalExpress4_fla.05_167} Frame 1
"2"Symbol 436 MovieClip {CoalExpress4_fla.05_167} Frame 3
"1"Symbol 448 MovieClip {CoalExpress4_fla.05_171} Frame 1
"2"Symbol 448 MovieClip {CoalExpress4_fla.05_171} Frame 5




http://swfchan.com/24/118147/info.shtml
Created: 7/3 -2019 10:01:17 Last modified: 7/3 -2019 10:01:17 Server time: 22/12 -2024 11:21:06