Section 1
//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 2
//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(_arg1:b2ShapeDef){
var _local2:b2CircleDef;
m_localPosition = new b2Vec2();
super(_arg1);
_local2 = (_arg1 as b2CircleDef);
m_type = e_circleShape;
m_localPosition.SetV(_local2.localPosition);
m_radius = _local2.radius;
}
override public function TestPoint(_arg1:b2XForm, _arg2:b2Vec2):Boolean{
var _local3:b2Mat22;
var _local4:Number;
var _local5:Number;
_local3 = _arg1.R;
_local4 = (_arg1.position.x + ((_local3.col1.x * m_localPosition.x) + (_local3.col2.x * m_localPosition.y)));
_local5 = (_arg1.position.y + ((_local3.col1.y * m_localPosition.x) + (_local3.col2.y * m_localPosition.y)));
_local4 = (_arg2.x - _local4);
_local5 = (_arg2.y - _local5);
return ((((_local4 * _local4) + (_local5 * _local5)) <= (m_radius * m_radius)));
}
public function GetLocalPosition():b2Vec2{
return (m_localPosition);
}
override public function TestSegment(_arg1:b2XForm, _arg2:Array, _arg3:b2Vec2, _arg4:b2Segment, _arg5:Number):Boolean{
var _local6:b2Mat22;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
_local6 = _arg1.R;
_local7 = (_arg1.position.x + ((_local6.col1.x * m_localPosition.x) + (_local6.col2.x * m_localPosition.y)));
_local8 = (_arg1.position.x + ((_local6.col1.y * m_localPosition.x) + (_local6.col2.y * m_localPosition.y)));
_local9 = (_arg4.p1.x - _local7);
_local10 = (_arg4.p1.y - _local8);
_local11 = (((_local9 * _local9) + (_local10 * _local10)) - (m_radius * m_radius));
if (_local11 < 0){
return (false);
};
_local12 = (_arg4.p2.x - _arg4.p1.x);
_local13 = (_arg4.p2.y - _arg4.p1.y);
_local14 = ((_local9 * _local12) + (_local10 * _local13));
_local15 = ((_local12 * _local12) + (_local13 * _local13));
_local16 = ((_local14 * _local14) - (_local15 * _local11));
if ((((_local16 < 0)) || ((_local15 < Number.MIN_VALUE)))){
return (false);
};
_local17 = -((_local14 + Math.sqrt(_local16)));
if ((((0 <= _local17)) && ((_local17 <= (_arg5 * _local15))))){
_local17 = (_local17 / _local15);
_arg2[0] = _local17;
_arg3.x = (_local9 + (_local17 * _local12));
_arg3.y = (_local10 + (_local17 * _local13));
_arg3.Normalize();
return (true);
};
return (false);
}
override public function ComputeMass(_arg1:b2MassData):void{
_arg1.mass = (((m_density * b2Settings.b2_pi) * m_radius) * m_radius);
_arg1.center.SetV(m_localPosition);
_arg1.I = (_arg1.mass * (((0.5 * m_radius) * m_radius) + ((m_localPosition.x * m_localPosition.x) + (m_localPosition.y * m_localPosition.y))));
}
override public function ComputeSweptAABB(_arg1:b2AABB, _arg2:b2XForm, _arg3:b2XForm):void{
var _local4:b2Mat22;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
_local4 = _arg2.R;
_local5 = (_arg2.position.x + ((_local4.col1.x * m_localPosition.x) + (_local4.col2.x * m_localPosition.y)));
_local6 = (_arg2.position.y + ((_local4.col1.y * m_localPosition.x) + (_local4.col2.y * m_localPosition.y)));
_local4 = _arg3.R;
_local7 = (_arg3.position.x + ((_local4.col1.x * m_localPosition.x) + (_local4.col2.x * m_localPosition.y)));
_local8 = (_arg3.position.y + ((_local4.col1.y * m_localPosition.x) + (_local4.col2.y * m_localPosition.y)));
_arg1.lowerBound.Set((((_local5 < _local7)) ? _local5 : _local7 - m_radius), (((_local6 < _local8)) ? _local6 : _local8 - m_radius));
_arg1.upperBound.Set((((_local5 > _local7)) ? _local5 : _local7 + m_radius), (((_local6 > _local8)) ? _local6 : _local8 + m_radius));
}
public function GetRadius():Number{
return (m_radius);
}
override public function UpdateSweepRadius(_arg1:b2Vec2):void{
var _local2:Number;
var _local3:Number;
_local2 = (m_localPosition.x - _arg1.x);
_local3 = (m_localPosition.y - _arg1.y);
_local2 = Math.sqrt(((_local2 * _local2) + (_local3 * _local3)));
m_sweepRadius = ((_local2 + m_radius) - b2Settings.b2_toiSlop);
}
override public function ComputeAABB(_arg1:b2AABB, _arg2:b2XForm):void{
var _local3:b2Mat22;
var _local4:Number;
var _local5:Number;
_local3 = _arg2.R;
_local4 = (_arg2.position.x + ((_local3.col1.x * m_localPosition.x) + (_local3.col2.x * m_localPosition.y)));
_local5 = (_arg2.position.y + ((_local3.col1.y * m_localPosition.x) + (_local3.col2.y * m_localPosition.y)));
_arg1.lowerBound.Set((_local4 - m_radius), (_local5 - m_radius));
_arg1.upperBound.Set((_local4 + m_radius), (_local5 + m_radius));
}
}
}//package Box2D.Collision.Shapes
Section 3
//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 _local1:b2FilterData;
_local1 = new b2FilterData();
_local1.categoryBits = categoryBits;
_local1.maskBits = maskBits;
_local1.groupIndex = groupIndex;
return (_local1);
}
}
}//package Box2D.Collision.Shapes
Section 4
//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 5
//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 _local1:int;
vertices = new Array(b2Settings.b2_maxPolygonVertices);
super();
type = b2Shape.e_polygonShape;
vertexCount = 0;
_local1 = 0;
while (_local1 < b2Settings.b2_maxPolygonVertices) {
vertices[_local1] = new b2Vec2();
_local1++;
};
}
public function SetAsOrientedBox(_arg1:Number, _arg2:Number, _arg3:b2Vec2=null, _arg4:Number=0):void{
var _local5:b2Vec2;
var _local6:b2Mat22;
var _local7:int;
vertexCount = 4;
vertices[0].Set(-(_arg1), -(_arg2));
vertices[1].Set(_arg1, -(_arg2));
vertices[2].Set(_arg1, _arg2);
vertices[3].Set(-(_arg1), _arg2);
if (_arg3){
_local5 = _arg3;
_local6 = s_mat;
_local6.Set(_arg4);
_local7 = 0;
while (_local7 < vertexCount) {
_arg3 = vertices[_local7];
_arg1 = (_local5.x + ((_local6.col1.x * _arg3.x) + (_local6.col2.x * _arg3.y)));
_arg3.y = (_local5.y + ((_local6.col1.y * _arg3.x) + (_local6.col2.y * _arg3.y)));
_arg3.x = _arg1;
_local7++;
};
};
}
public function SetAsBox(_arg1:Number, _arg2:Number):void{
vertexCount = 4;
vertices[0].Set(-(_arg1), -(_arg2));
vertices[1].Set(_arg1, -(_arg2));
vertices[2].Set(_arg1, _arg2);
vertices[3].Set(-(_arg1), _arg2);
}
}
}//package Box2D.Collision.Shapes
Section 6
//b2PolygonShape (Box2D.Collision.Shapes.b2PolygonShape)
package Box2D.Collision.Shapes {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
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(_arg1:b2ShapeDef){
var _local2:b2PolygonDef;
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17: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(_arg1);
m_type = e_polygonShape;
_local2 = (_arg1 as b2PolygonDef);
m_vertexCount = _local2.vertexCount;
_local4 = _local3;
_local5 = _local3;
_local3 = 0;
while (_local3 < m_vertexCount) {
m_vertices[_local3] = _local2.vertices[_local3].Copy();
_local3++;
};
_local3 = 0;
while (_local3 < m_vertexCount) {
_local4 = _local3;
_local5 = (((_local3 + 1) < m_vertexCount)) ? (_local3 + 1) : 0;
_local6 = (m_vertices[_local5].x - m_vertices[_local4].x);
_local7 = (m_vertices[_local5].y - m_vertices[_local4].y);
_local8 = Math.sqrt(((_local6 * _local6) + (_local7 * _local7)));
m_normals[_local3] = new b2Vec2((_local7 / _local8), (-(_local6) / _local8));
_local3++;
};
m_centroid = ComputeCentroid(_local2.vertices, _local2.vertexCount);
ComputeOBB(m_obb, m_vertices, m_vertexCount);
_local3 = 0;
while (_local3 < m_vertexCount) {
_local4 = (((_local3 - 1) >= 0)) ? (_local3 - 1) : (m_vertexCount - 1);
_local5 = _local3;
_local9 = m_normals[_local4].x;
_local10 = m_normals[_local4].y;
_local11 = m_normals[_local5].x;
_local12 = m_normals[_local5].y;
_local13 = (m_vertices[_local3].x - m_centroid.x);
_local14 = (m_vertices[_local3].y - m_centroid.y);
_local15 = (((_local9 * _local13) + (_local10 * _local14)) - b2Settings.b2_toiSlop);
_local16 = (((_local11 * _local13) + (_local12 * _local14)) - b2Settings.b2_toiSlop);
_local17 = (1 / ((_local9 * _local12) - (_local10 * _local11)));
m_coreVertices[_local3] = new b2Vec2(((_local17 * ((_local12 * _local15) - (_local10 * _local16))) + m_centroid.x), ((_local17 * ((_local9 * _local16) - (_local11 * _local15))) + m_centroid.y));
_local3++;
};
}
override public function TestPoint(_arg1:b2XForm, _arg2:b2Vec2):Boolean{
var _local3:b2Vec2;
var _local4:b2Mat22;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:int;
var _local10:Number;
_local4 = _arg1.R;
_local5 = (_arg2.x - _arg1.position.x);
_local6 = (_arg2.y - _arg1.position.y);
_local7 = ((_local5 * _local4.col1.x) + (_local6 * _local4.col1.y));
_local8 = ((_local5 * _local4.col2.x) + (_local6 * _local4.col2.y));
_local9 = 0;
while (_local9 < m_vertexCount) {
_local3 = m_vertices[_local9];
_local5 = (_local7 - _local3.x);
_local6 = (_local8 - _local3.y);
_local3 = m_normals[_local9];
_local10 = ((_local3.x * _local5) + (_local3.y * _local6));
if (_local10 > 0){
return (false);
};
_local9++;
};
return (true);
}
public function GetCoreVertices():Array{
return (m_coreVertices);
}
override public function TestSegment(_arg1:b2XForm, _arg2:Array, _arg3:b2Vec2, _arg4:b2Segment, _arg5:Number):Boolean{
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:b2Mat22;
var _local11:b2Vec2;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:int;
var _local19:int;
var _local20:Number;
var _local21:Number;
_local6 = 0;
_local7 = _arg5;
_local8 = (_arg4.p1.x - _arg1.position.x);
_local9 = (_arg4.p1.y - _arg1.position.y);
_local10 = _arg1.R;
_local12 = ((_local8 * _local10.col1.x) + (_local9 * _local10.col1.y));
_local13 = ((_local8 * _local10.col2.x) + (_local9 * _local10.col2.y));
_local8 = (_arg4.p2.x - _arg1.position.x);
_local9 = (_arg4.p2.y - _arg1.position.y);
_local10 = _arg1.R;
_local14 = ((_local8 * _local10.col1.x) + (_local9 * _local10.col1.y));
_local15 = ((_local8 * _local10.col2.x) + (_local9 * _local10.col2.y));
_local16 = (_local14 - _local12);
_local17 = (_local15 - _local13);
_local18 = -1;
_local19 = 0;
while (_local19 < m_vertexCount) {
_local11 = m_vertices[_local19];
_local8 = (_local11.x - _local12);
_local9 = (_local11.y - _local13);
_local11 = m_normals[_local19];
_local20 = ((_local11.x * _local8) + (_local11.y * _local9));
_local21 = ((_local11.x * _local16) + (_local11.y * _local17));
if ((((_local21 < 0)) && ((_local20 < (_local6 * _local21))))){
_local6 = (_local20 / _local21);
_local18 = _local19;
} else {
if ((((_local21 > 0)) && ((_local20 < (_local7 * _local21))))){
_local7 = (_local20 / _local21);
};
};
if (_local7 < _local6){
return (false);
};
_local19++;
};
if (_local18 >= 0){
_arg2[0] = _local6;
_local10 = _arg1.R;
_local11 = m_normals[_local18];
_arg3.x = ((_local10.col1.x * _local11.x) + (_local10.col2.x * _local11.y));
_arg3.y = ((_local10.col1.y * _local11.x) + (_local10.col2.y * _local11.y));
return (true);
};
return (false);
}
public function GetCentroid():b2Vec2{
return (m_centroid);
}
override public function ComputeMass(_arg1:b2MassData):void{
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:int;
var _local10:b2Vec2;
var _local11:b2Vec2;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:Number;
_local2 = 0;
_local3 = 0;
_local4 = 0;
_local5 = 0;
_local6 = 0;
_local7 = 0;
_local8 = (1 / 3);
_local9 = 0;
while (_local9 < m_vertexCount) {
_local10 = m_vertices[_local9];
_local11 = (((_local9 + 1) < m_vertexCount)) ? m_vertices[int((_local9 + 1))] : m_vertices[0];
_local12 = (_local10.x - _local6);
_local13 = (_local10.y - _local7);
_local14 = (_local11.x - _local6);
_local15 = (_local11.y - _local7);
_local16 = ((_local12 * _local15) - (_local13 * _local14));
_local17 = (0.5 * _local16);
_local4 = (_local4 + _local17);
_local2 = (_local2 + ((_local17 * _local8) * ((_local6 + _local10.x) + _local11.x)));
_local3 = (_local3 + ((_local17 * _local8) * ((_local7 + _local10.y) + _local11.y)));
_local18 = _local6;
_local19 = _local7;
_local20 = _local12;
_local21 = _local13;
_local22 = _local14;
_local23 = _local15;
_local24 = ((_local8 * ((0.25 * (((_local20 * _local20) + (_local22 * _local20)) + (_local22 * _local22))) + ((_local18 * _local20) + (_local18 * _local22)))) + ((0.5 * _local18) * _local18));
_local25 = ((_local8 * ((0.25 * (((_local21 * _local21) + (_local23 * _local21)) + (_local23 * _local23))) + ((_local19 * _local21) + (_local19 * _local23)))) + ((0.5 * _local19) * _local19));
_local5 = (_local5 + (_local16 * (_local24 + _local25)));
_local9++;
};
_arg1.mass = (m_density * _local4);
_local2 = (_local2 * (1 / _local4));
_local3 = (_local3 * (1 / _local4));
_arg1.center.Set(_local2, _local3);
_arg1.I = (m_density * _local5);
}
public function Support(_arg1:b2XForm, _arg2:Number, _arg3:Number):b2Vec2{
var _local4:b2Vec2;
var _local5:b2Mat22;
var _local6:Number;
var _local7:Number;
var _local8:int;
var _local9:Number;
var _local10:int;
var _local11:Number;
_local5 = _arg1.R;
_local6 = ((_arg2 * _local5.col1.x) + (_arg3 * _local5.col1.y));
_local7 = ((_arg2 * _local5.col2.x) + (_arg3 * _local5.col2.y));
_local8 = 0;
_local4 = m_coreVertices[0];
_local9 = ((_local4.x * _local6) + (_local4.y * _local7));
_local10 = 1;
while (_local10 < m_vertexCount) {
_local4 = m_coreVertices[_local10];
_local11 = ((_local4.x * _local6) + (_local4.y * _local7));
if (_local11 > _local9){
_local8 = _local10;
_local9 = _local11;
};
_local10++;
};
_local5 = _arg1.R;
_local4 = m_coreVertices[_local8];
s_supportVec.x = (_arg1.position.x + ((_local5.col1.x * _local4.x) + (_local5.col2.x * _local4.y)));
s_supportVec.y = (_arg1.position.y + ((_local5.col1.y * _local4.x) + (_local5.col2.y * _local4.y)));
return (s_supportVec);
}
public function GetVertexCount():int{
return (m_vertexCount);
}
override public function ComputeSweptAABB(_arg1:b2AABB, _arg2:b2XForm, _arg3:b2XForm):void{
var _local4:b2AABB;
var _local5:b2AABB;
_local4 = s_sweptAABB1;
_local5 = s_sweptAABB2;
ComputeAABB(_local4, _arg2);
ComputeAABB(_local5, _arg3);
_arg1.lowerBound.Set(((_local4.lowerBound.x < _local5.lowerBound.x)) ? _local4.lowerBound.x : _local5.lowerBound.x, ((_local4.lowerBound.y < _local5.lowerBound.y)) ? _local4.lowerBound.y : _local5.lowerBound.y);
_arg1.upperBound.Set(((_local4.upperBound.x > _local5.upperBound.x)) ? _local4.upperBound.x : _local5.upperBound.x, ((_local4.upperBound.y > _local5.upperBound.y)) ? _local4.upperBound.y : _local5.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(_arg1:b2XForm):b2Vec2{
return (b2Math.b2MulX(_arg1, m_coreVertices[0]));
}
public function Centroid(_arg1:b2XForm):b2Vec2{
return (b2Math.b2MulX(_arg1, m_centroid));
}
override public function UpdateSweepRadius(_arg1:b2Vec2):void{
var _local2:b2Vec2;
var _local3:int;
var _local4:Number;
var _local5:Number;
m_sweepRadius = 0;
_local3 = 0;
while (_local3 < m_vertexCount) {
_local2 = m_coreVertices[_local3];
_local4 = (_local2.x - _arg1.x);
_local5 = (_local2.y - _arg1.y);
_local4 = Math.sqrt(((_local4 * _local4) + (_local5 * _local5)));
if (_local4 > m_sweepRadius){
m_sweepRadius = _local4;
};
_local3++;
};
}
override public function ComputeAABB(_arg1:b2AABB, _arg2:b2XForm):void{
var _local3:b2Mat22;
var _local4:b2Vec2;
var _local5:b2Mat22;
var _local6:b2Mat22;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
_local5 = s_computeMat;
_local3 = _arg2.R;
_local4 = m_obb.R.col1;
_local5.col1.x = ((_local3.col1.x * _local4.x) + (_local3.col2.x * _local4.y));
_local5.col1.y = ((_local3.col1.y * _local4.x) + (_local3.col2.y * _local4.y));
_local4 = m_obb.R.col2;
_local5.col2.x = ((_local3.col1.x * _local4.x) + (_local3.col2.x * _local4.y));
_local5.col2.y = ((_local3.col1.y * _local4.x) + (_local3.col2.y * _local4.y));
_local5.Abs();
_local6 = _local5;
_local4 = m_obb.extents;
_local7 = ((_local6.col1.x * _local4.x) + (_local6.col2.x * _local4.y));
_local8 = ((_local6.col1.y * _local4.x) + (_local6.col2.y * _local4.y));
_local3 = _arg2.R;
_local4 = m_obb.center;
_local9 = (_arg2.position.x + ((_local3.col1.x * _local4.x) + (_local3.col2.x * _local4.y)));
_local10 = (_arg2.position.y + ((_local3.col1.y * _local4.x) + (_local3.col2.y * _local4.y)));
_arg1.lowerBound.Set((_local9 - _local7), (_local10 - _local8));
_arg1.upperBound.Set((_local9 + _local7), (_local10 + _local8));
}
public static function ComputeCentroid(_arg1:Array, _arg2:int):b2Vec2{
var _local3:b2Vec2;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:int;
var _local9:b2Vec2;
var _local10:b2Vec2;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
_local3 = new b2Vec2();
_local4 = 0;
_local5 = 0;
_local6 = 0;
_local7 = (1 / 3);
_local8 = 0;
while (_local8 < _arg2) {
_local9 = _arg1[_local8];
_local10 = (((_local8 + 1) < _arg2)) ? _arg1[int((_local8 + 1))] : _arg1[0];
_local11 = (_local9.x - _local5);
_local12 = (_local9.y - _local6);
_local13 = (_local10.x - _local5);
_local14 = (_local10.y - _local6);
_local15 = ((_local11 * _local14) - (_local12 * _local13));
_local16 = (0.5 * _local15);
_local4 = (_local4 + _local16);
_local3.x = (_local3.x + ((_local16 * _local7) * ((_local5 + _local9.x) + _local10.x)));
_local3.y = (_local3.y + ((_local16 * _local7) * ((_local6 + _local9.y) + _local10.y)));
_local8++;
};
_local3.x = (_local3.x * (1 / _local4));
_local3.y = (_local3.y * (1 / _local4));
return (_local3);
}
public static function ComputeOBB(_arg1:b2OBB, _arg2:Array, _arg3:int):void{
var _local4:int;
var _local5:Array;
var _local6:Number;
var _local7:b2Vec2;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:int;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:b2Mat22;
_local5 = new Array((b2Settings.b2_maxPolygonVertices + 1));
_local4 = 0;
while (_local4 < _arg3) {
_local5[_local4] = _arg2[_local4];
_local4++;
};
_local5[_arg3] = _local5[0];
_local6 = Number.MAX_VALUE;
_local4 = 1;
while (_local4 <= _arg3) {
_local7 = _local5[int((_local4 - 1))];
_local8 = (_local5[_local4].x - _local7.x);
_local9 = (_local5[_local4].y - _local7.y);
_local10 = Math.sqrt(((_local8 * _local8) + (_local9 * _local9)));
_local8 = (_local8 / _local10);
_local9 = (_local9 / _local10);
_local11 = -(_local9);
_local12 = _local8;
_local13 = Number.MAX_VALUE;
_local14 = Number.MAX_VALUE;
_local15 = -(Number.MAX_VALUE);
_local16 = -(Number.MAX_VALUE);
_local17 = 0;
while (_local17 < _arg3) {
_local19 = (_local5[_local17].x - _local7.x);
_local20 = (_local5[_local17].y - _local7.y);
_local21 = ((_local8 * _local19) + (_local9 * _local20));
_local22 = ((_local11 * _local19) + (_local12 * _local20));
if (_local21 < _local13){
_local13 = _local21;
};
if (_local22 < _local14){
_local14 = _local22;
};
if (_local21 > _local15){
_local15 = _local21;
};
if (_local22 > _local16){
_local16 = _local22;
};
_local17++;
};
_local18 = ((_local15 - _local13) * (_local16 - _local14));
if (_local18 < (0.95 * _local6)){
_local6 = _local18;
_arg1.R.col1.x = _local8;
_arg1.R.col1.y = _local9;
_arg1.R.col2.x = _local11;
_arg1.R.col2.y = _local12;
_local23 = (0.5 * (_local13 + _local15));
_local24 = (0.5 * (_local14 + _local16));
_local25 = _arg1.R;
_arg1.center.x = (_local7.x + ((_local25.col1.x * _local23) + (_local25.col2.x * _local24)));
_arg1.center.y = (_local7.y + ((_local25.col1.y * _local23) + (_local25.col2.y * _local24)));
_arg1.extents.x = (0.5 * (_local15 - _local13));
_arg1.extents.y = (0.5 * (_local16 - _local14));
};
_local4++;
};
}
}
}//package Box2D.Collision.Shapes
Section 7
//b2Shape (Box2D.Collision.Shapes.b2Shape)
package Box2D.Collision.Shapes {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
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(_arg1:b2ShapeDef){
m_userData = _arg1.userData;
m_friction = _arg1.friction;
m_restitution = _arg1.restitution;
m_density = _arg1.density;
m_body = null;
m_sweepRadius = 0;
m_next = null;
m_proxyId = b2Pair.b2_nullProxy;
m_filter = _arg1.filter.Copy();
m_isSensor = _arg1.isSensor;
}
public function TestPoint(_arg1:b2XForm, _arg2:b2Vec2):Boolean{
return (false);
}
public function GetSweepRadius():Number{
return (m_sweepRadius);
}
public function GetNext():b2Shape{
return (m_next);
}
public function ComputeSweptAABB(_arg1:b2AABB, _arg2:b2XForm, _arg3: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(_arg1:b2XForm, _arg2:Array, _arg3:b2Vec2, _arg4:b2Segment, _arg5:Number):Boolean{
return (false);
}
public function RefilterProxy(_arg1:b2BroadPhase, _arg2:b2XForm):void{
var _local3:b2AABB;
var _local4:Boolean;
if (m_proxyId == b2Pair.b2_nullProxy){
return;
};
_arg1.DestroyProxy(m_proxyId);
_local3 = s_resetAABB;
ComputeAABB(_local3, _arg2);
_local4 = _arg1.InRange(_local3);
if (_local4){
m_proxyId = _arg1.CreateProxy(_local3, this);
} else {
m_proxyId = b2Pair.b2_nullProxy;
};
}
public function SetFilterData(_arg1:b2FilterData):void{
m_filter = _arg1.Copy();
}
public function GetUserData(){
return (m_userData);
}
public function Synchronize(_arg1:b2BroadPhase, _arg2:b2XForm, _arg3:b2XForm):Boolean{
var _local4:b2AABB;
if (m_proxyId == b2Pair.b2_nullProxy){
return (false);
};
_local4 = s_syncAABB;
ComputeSweptAABB(_local4, _arg2, _arg3);
if (_arg1.InRange(_local4)){
_arg1.MoveProxy(m_proxyId, _local4);
return (true);
};
return (false);
}
public function ComputeMass(_arg1:b2MassData):void{
}
public function IsSensor():Boolean{
return (m_isSensor);
}
public function DestroyProxy(_arg1:b2BroadPhase):void{
if (m_proxyId != b2Pair.b2_nullProxy){
_arg1.DestroyProxy(m_proxyId);
m_proxyId = b2Pair.b2_nullProxy;
};
}
public function UpdateSweepRadius(_arg1:b2Vec2):void{
}
public function ComputeAABB(_arg1:b2AABB, _arg2:b2XForm):void{
}
public function GetBody():b2Body{
return (m_body);
}
public function CreateProxy(_arg1:b2BroadPhase, _arg2:b2XForm):void{
var _local3:b2AABB;
var _local4:Boolean;
_local3 = s_proxyAABB;
ComputeAABB(_local3, _arg2);
_local4 = _arg1.InRange(_local3);
if (_local4){
m_proxyId = _arg1.CreateProxy(_local3, this);
} else {
m_proxyId = b2Pair.b2_nullProxy;
};
}
public function SetUserData(_arg1):void{
m_userData = _arg1;
}
public static function Destroy(_arg1:b2Shape, _arg2):void{
}
public static function Create(_arg1:b2ShapeDef, _arg2):b2Shape{
switch (_arg1.type){
case e_circleShape:
return (new b2CircleShape(_arg1));
case e_polygonShape:
return (new b2PolygonShape(_arg1));
default:
return (null);
};
}
}
}//package Box2D.Collision.Shapes
Section 8
//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 9
//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 _local1:Number;
var _local2:Number;
var _local3:Boolean;
_local1 = (upperBound.x - lowerBound.x);
_local2 = (upperBound.y - lowerBound.y);
_local3 = (((_local1 >= 0)) && ((_local2 >= 0)));
_local3 = ((((_local3) && (lowerBound.IsValid()))) && (upperBound.IsValid()));
return (_local3);
}
}
}//package Box2D.Collision
Section 10
//b2Bound (Box2D.Collision.b2Bound)
package Box2D.Collision {
public class b2Bound {
public var proxyId:uint;
public var stabbingCount:uint;
public var value:uint;
public function Swap(_arg1:b2Bound):void{
var _local2:uint;
var _local3:uint;
var _local4:uint;
_local2 = value;
_local3 = proxyId;
_local4 = stabbingCount;
value = _arg1.value;
proxyId = _arg1.proxyId;
stabbingCount = _arg1.stabbingCount;
_arg1.value = _local2;
_arg1.proxyId = _local3;
_arg1.stabbingCount = _local4;
}
public function IsLower():Boolean{
return (((value & 1) == 0));
}
public function IsUpper():Boolean{
return (((value & 1) == 1));
}
}
}//package Box2D.Collision
Section 11
//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 12
//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(_arg1:b2AABB, _arg2:b2PairCallback){
var _local3:int;
var _local4:Number;
var _local5:Number;
var _local6:b2Proxy;
var _local7: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, _arg2);
m_worldAABB = _arg1;
m_proxyCount = 0;
_local3 = 0;
while (_local3 < b2Settings.b2_maxProxies) {
m_queryResults[_local3] = 0;
_local3++;
};
m_bounds = new Array(2);
_local3 = 0;
while (_local3 < 2) {
m_bounds[_local3] = new Array((2 * b2Settings.b2_maxProxies));
_local7 = 0;
while (_local7 < (2 * b2Settings.b2_maxProxies)) {
m_bounds[_local3][_local7] = new b2Bound();
_local7++;
};
_local3++;
};
_local4 = (_arg1.upperBound.x - _arg1.lowerBound.x);
_local5 = (_arg1.upperBound.y - _arg1.lowerBound.y);
m_quantizationFactor.x = (b2Settings.USHRT_MAX / _local4);
m_quantizationFactor.y = (b2Settings.USHRT_MAX / _local5);
_local3 = 0;
while (_local3 < (b2Settings.b2_maxProxies - 1)) {
_local6 = new b2Proxy();
m_proxyPool[_local3] = _local6;
_local6.SetNext((_local3 + 1));
_local6.timeStamp = 0;
_local6.overlapCount = b2_invalid;
_local6.userData = null;
_local3++;
};
_local6 = new b2Proxy();
m_proxyPool[int((b2Settings.b2_maxProxies - 1))] = _local6;
_local6.SetNext(b2Pair.b2_nullProxy);
_local6.timeStamp = 0;
_local6.overlapCount = b2_invalid;
_local6.userData = null;
m_freeProxy = 0;
m_timeStamp = 1;
m_queryResultCount = 0;
}
public function QueryAABB(_arg1:b2AABB, _arg2, _arg3:int):int{
var _local4:Array;
var _local5:Array;
var _local6:uint;
var _local7:uint;
var _local8:Array;
var _local9:Array;
var _local10:int;
var _local11:int;
var _local12:b2Proxy;
_local4 = new Array();
_local5 = new Array();
ComputeBounds(_local4, _local5, _arg1);
_local8 = [_local6];
_local9 = [_local7];
Query(_local8, _local9, _local4[0], _local5[0], m_bounds[0], (2 * m_proxyCount), 0);
Query(_local8, _local9, _local4[1], _local5[1], m_bounds[1], (2 * m_proxyCount), 1);
_local10 = 0;
_local11 = 0;
while ((((_local11 < m_queryResultCount)) && ((_local10 < _arg3)))) {
_local12 = m_proxyPool[m_queryResults[_local11]];
_arg2[_local11] = _local12.userData;
_local11++;
_local10++;
};
m_queryResultCount = 0;
IncrementTimeStamp();
return (_local10);
}
public function Commit():void{
m_pairManager.Commit();
}
public function GetProxy(_arg1:int):b2Proxy{
var _local2:b2Proxy;
_local2 = m_proxyPool[_arg1];
if ((((_arg1 == b2Pair.b2_nullProxy)) || ((_local2.IsValid() == false)))){
return (null);
};
return (_local2);
}
private function IncrementTimeStamp():void{
var _local1:uint;
if (m_timeStamp == b2Settings.USHRT_MAX){
_local1 = 0;
while (_local1 < b2Settings.b2_maxProxies) {
(m_proxyPool[_local1] as b2Proxy).timeStamp = 0;
_local1++;
};
m_timeStamp = 1;
} else {
m_timeStamp++;
};
}
private function Query(_arg1:Array, _arg2:Array, _arg3:uint, _arg4:uint, _arg5:Array, _arg6:uint, _arg7:int):void{
var _local8:uint;
var _local9:uint;
var _local10:b2Bound;
var _local11:uint;
var _local12:int;
var _local13:int;
var _local14:b2Proxy;
_local8 = BinarySearch(_arg5, _arg6, _arg3);
_local9 = BinarySearch(_arg5, _arg6, _arg4);
_local11 = _local8;
while (_local11 < _local9) {
_local10 = _arg5[_local11];
if (_local10.IsLower()){
IncrementOverlapCount(_local10.proxyId);
};
_local11++;
};
if (_local8 > 0){
_local12 = (_local8 - 1);
_local10 = _arg5[_local12];
_local13 = _local10.stabbingCount;
while (_local13) {
_local10 = _arg5[_local12];
if (_local10.IsLower()){
_local14 = m_proxyPool[_local10.proxyId];
if (_local8 <= _local14.upperBounds[_arg7]){
IncrementOverlapCount(_local10.proxyId);
_local13--;
};
};
_local12--;
};
};
_arg1[0] = _local8;
_arg2[0] = _local9;
}
private function TestOverlapValidate(_arg1:b2Proxy, _arg2:b2Proxy):Boolean{
var _local3:int;
var _local4:Array;
var _local5:b2Bound;
var _local6:b2Bound;
_local3 = 0;
while (_local3 < 2) {
_local4 = m_bounds[_local3];
_local5 = _local4[_arg1.lowerBounds[_local3]];
_local6 = _local4[_arg2.upperBounds[_local3]];
if (_local5.value > _local6.value){
return (false);
};
_local5 = _local4[_arg1.upperBounds[_local3]];
_local6 = _local4[_arg2.lowerBounds[_local3]];
if (_local5.value < _local6.value){
return (false);
};
_local3++;
};
return (true);
}
private function ComputeBounds(_arg1:Array, _arg2:Array, _arg3:b2AABB):void{
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
_local4 = _arg3.lowerBound.x;
_local5 = _arg3.lowerBound.y;
_local4 = b2Math.b2Min(_local4, m_worldAABB.upperBound.x);
_local5 = b2Math.b2Min(_local5, m_worldAABB.upperBound.y);
_local4 = b2Math.b2Max(_local4, m_worldAABB.lowerBound.x);
_local5 = b2Math.b2Max(_local5, m_worldAABB.lowerBound.y);
_local6 = _arg3.upperBound.x;
_local7 = _arg3.upperBound.y;
_local6 = b2Math.b2Min(_local6, m_worldAABB.upperBound.x);
_local7 = b2Math.b2Min(_local7, m_worldAABB.upperBound.y);
_local6 = b2Math.b2Max(_local6, m_worldAABB.lowerBound.x);
_local7 = b2Math.b2Max(_local7, m_worldAABB.lowerBound.y);
_arg1[0] = (uint((m_quantizationFactor.x * (_local4 - m_worldAABB.lowerBound.x))) & (b2Settings.USHRT_MAX - 1));
_arg2[0] = ((uint((m_quantizationFactor.x * (_local6 - m_worldAABB.lowerBound.x))) & 0xFFFF) | 1);
_arg1[1] = (uint((m_quantizationFactor.y * (_local5 - m_worldAABB.lowerBound.y))) & (b2Settings.USHRT_MAX - 1));
_arg2[1] = ((uint((m_quantizationFactor.y * (_local7 - m_worldAABB.lowerBound.y))) & 0xFFFF) | 1);
}
public function CreateProxy(_arg1:b2AABB, _arg2):uint{
var _local3:uint;
var _local4:b2Proxy;
var _local5:uint;
var _local6:uint;
var _local7:Array;
var _local8:Array;
var _local9:int;
var _local10:int;
var _local11:Array;
var _local12:uint;
var _local13:uint;
var _local14:Array;
var _local15:Array;
var _local16:Array;
var _local17:int;
var _local18:int;
var _local19:b2Bound;
var _local20:b2Bound;
var _local21:b2Bound;
var _local22:int;
var _local23:b2Proxy;
_local5 = m_freeProxy;
_local4 = m_proxyPool[_local5];
m_freeProxy = _local4.GetNext();
_local4.overlapCount = 0;
_local4.userData = _arg2;
_local6 = (2 * m_proxyCount);
_local7 = new Array();
_local8 = new Array();
ComputeBounds(_local7, _local8, _arg1);
_local9 = 0;
while (_local9 < 2) {
_local11 = m_bounds[_local9];
_local14 = [_local12];
_local15 = [_local13];
Query(_local14, _local15, _local7[_local9], _local8[_local9], _local11, _local6, _local9);
_local12 = _local14[0];
_local13 = _local15[0];
_local16 = new Array();
_local18 = (_local6 - _local13);
_local17 = 0;
while (_local17 < _local18) {
_local16[_local17] = new b2Bound();
_local19 = _local16[_local17];
_local20 = _local11[int((_local13 + _local17))];
_local19.value = _local20.value;
_local19.proxyId = _local20.proxyId;
_local19.stabbingCount = _local20.stabbingCount;
_local17++;
};
_local18 = _local16.length;
_local22 = (_local13 + 2);
_local17 = 0;
while (_local17 < _local18) {
_local20 = _local16[_local17];
_local19 = _local11[int((_local22 + _local17))];
_local19.value = _local20.value;
_local19.proxyId = _local20.proxyId;
_local19.stabbingCount = _local20.stabbingCount;
_local17++;
};
_local16 = new Array();
_local18 = (_local13 - _local12);
_local17 = 0;
while (_local17 < _local18) {
_local16[_local17] = new b2Bound();
_local19 = _local16[_local17];
_local20 = _local11[int((_local12 + _local17))];
_local19.value = _local20.value;
_local19.proxyId = _local20.proxyId;
_local19.stabbingCount = _local20.stabbingCount;
_local17++;
};
_local18 = _local16.length;
_local22 = (_local12 + 1);
_local17 = 0;
while (_local17 < _local18) {
_local20 = _local16[_local17];
_local19 = _local11[int((_local22 + _local17))];
_local19.value = _local20.value;
_local19.proxyId = _local20.proxyId;
_local19.stabbingCount = _local20.stabbingCount;
_local17++;
};
_local13++;
_local19 = _local11[_local12];
_local20 = _local11[_local13];
_local19.value = _local7[_local9];
_local19.proxyId = _local5;
_local20.value = _local8[_local9];
_local20.proxyId = _local5;
_local21 = _local11[int((_local12 - 1))];
_local19.stabbingCount = ((_local12 == 0)) ? 0 : _local21.stabbingCount;
_local21 = _local11[int((_local13 - 1))];
_local20.stabbingCount = _local21.stabbingCount;
_local3 = _local12;
while (_local3 < _local13) {
_local21 = _local11[_local3];
_local21.stabbingCount++;
_local3++;
};
_local3 = _local12;
while (_local3 < (_local6 + 2)) {
_local19 = _local11[_local3];
_local23 = m_proxyPool[_local19.proxyId];
if (_local19.IsLower()){
_local23.lowerBounds[_local9] = _local3;
} else {
_local23.upperBounds[_local9] = _local3;
};
_local3++;
};
_local9++;
};
m_proxyCount++;
_local10 = 0;
while (_local10 < m_queryResultCount) {
m_pairManager.AddBufferedPair(_local5, m_queryResults[_local10]);
_local10++;
};
m_pairManager.Commit();
m_queryResultCount = 0;
IncrementTimeStamp();
return (_local5);
}
public function DestroyProxy(_arg1:uint):void{
var _local2:b2Bound;
var _local3:b2Bound;
var _local4:b2Proxy;
var _local5:int;
var _local6:int;
var _local7:int;
var _local8:Array;
var _local9:uint;
var _local10:uint;
var _local11:uint;
var _local12:uint;
var _local13:Array;
var _local14:int;
var _local15:int;
var _local16:int;
var _local17:uint;
var _local18:int;
var _local19:b2Proxy;
_local4 = m_proxyPool[_arg1];
_local5 = (2 * m_proxyCount);
_local6 = 0;
while (_local6 < 2) {
_local8 = m_bounds[_local6];
_local9 = _local4.lowerBounds[_local6];
_local10 = _local4.upperBounds[_local6];
_local2 = _local8[_local9];
_local11 = _local2.value;
_local3 = _local8[_local10];
_local12 = _local3.value;
_local13 = new Array();
_local15 = ((_local10 - _local9) - 1);
_local14 = 0;
while (_local14 < _local15) {
_local13[_local14] = new b2Bound();
_local2 = _local13[_local14];
_local3 = _local8[int(((_local9 + 1) + _local14))];
_local2.value = _local3.value;
_local2.proxyId = _local3.proxyId;
_local2.stabbingCount = _local3.stabbingCount;
_local14++;
};
_local15 = _local13.length;
_local16 = _local9;
_local14 = 0;
while (_local14 < _local15) {
_local3 = _local13[_local14];
_local2 = _local8[int((_local16 + _local14))];
_local2.value = _local3.value;
_local2.proxyId = _local3.proxyId;
_local2.stabbingCount = _local3.stabbingCount;
_local14++;
};
_local13 = new Array();
_local15 = ((_local5 - _local10) - 1);
_local14 = 0;
while (_local14 < _local15) {
_local13[_local14] = new b2Bound();
_local2 = _local13[_local14];
_local3 = _local8[int(((_local10 + 1) + _local14))];
_local2.value = _local3.value;
_local2.proxyId = _local3.proxyId;
_local2.stabbingCount = _local3.stabbingCount;
_local14++;
};
_local15 = _local13.length;
_local16 = (_local10 - 1);
_local14 = 0;
while (_local14 < _local15) {
_local3 = _local13[_local14];
_local2 = _local8[int((_local16 + _local14))];
_local2.value = _local3.value;
_local2.proxyId = _local3.proxyId;
_local2.stabbingCount = _local3.stabbingCount;
_local14++;
};
_local15 = (_local5 - 2);
_local17 = _local9;
while (_local17 < _local15) {
_local2 = _local8[_local17];
_local19 = m_proxyPool[_local2.proxyId];
if (_local2.IsLower()){
_local19.lowerBounds[_local6] = _local17;
} else {
_local19.upperBounds[_local6] = _local17;
};
_local17++;
};
_local15 = (_local10 - 1);
_local18 = _local9;
while (_local18 < _local15) {
_local2 = _local8[_local18];
_local2.stabbingCount--;
_local18++;
};
Query([0], [0], _local11, _local12, _local8, (_local5 - 2), _local6);
_local6++;
};
_local7 = 0;
while (_local7 < m_queryResultCount) {
m_pairManager.RemoveBufferedPair(_arg1, m_queryResults[_local7]);
_local7++;
};
m_pairManager.Commit();
m_queryResultCount = 0;
IncrementTimeStamp();
_local4.userData = null;
_local4.overlapCount = b2_invalid;
_local4.lowerBounds[0] = b2_invalid;
_local4.lowerBounds[1] = b2_invalid;
_local4.upperBounds[0] = b2_invalid;
_local4.upperBounds[1] = b2_invalid;
_local4.SetNext(m_freeProxy);
m_freeProxy = _arg1;
m_proxyCount--;
}
public function TestOverlap(_arg1:b2BoundValues, _arg2:b2Proxy):Boolean{
var _local3:int;
var _local4:Array;
var _local5:b2Bound;
_local3 = 0;
while (_local3 < 2) {
_local4 = m_bounds[_local3];
_local5 = _local4[_arg2.upperBounds[_local3]];
if (_arg1.lowerValues[_local3] > _local5.value){
return (false);
};
_local5 = _local4[_arg2.lowerBounds[_local3]];
if (_arg1.upperValues[_local3] < _local5.value){
return (false);
};
_local3++;
};
return (true);
}
public function Validate():void{
var _local1:b2Pair;
var _local2:b2Proxy;
var _local3:b2Proxy;
var _local4:Boolean;
var _local5:int;
var _local6:b2Bound;
var _local7:uint;
var _local8:uint;
var _local9:uint;
var _local10:b2Bound;
_local5 = 0;
while (_local5 < 2) {
_local6 = m_bounds[_local5];
_local7 = (2 * m_proxyCount);
_local8 = 0;
_local9 = 0;
while (_local9 < _local7) {
_local10 = _local6[_local9];
if (_local10.IsLower() == true){
_local8++;
} else {
_local8--;
};
_local9++;
};
_local5++;
};
}
private function IncrementOverlapCount(_arg1:uint):void{
var _local2:b2Proxy;
_local2 = m_proxyPool[_arg1];
if (_local2.timeStamp < m_timeStamp){
_local2.timeStamp = m_timeStamp;
_local2.overlapCount = 1;
} else {
_local2.overlapCount = 2;
m_queryResults[m_queryResultCount] = _arg1;
m_queryResultCount++;
};
}
public function InRange(_arg1:b2AABB):Boolean{
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
_local2 = _arg1.lowerBound.x;
_local3 = _arg1.lowerBound.y;
_local2 = (_local2 - m_worldAABB.upperBound.x);
_local3 = (_local3 - m_worldAABB.upperBound.y);
_local4 = m_worldAABB.lowerBound.x;
_local5 = m_worldAABB.lowerBound.y;
_local4 = (_local4 - _arg1.upperBound.x);
_local5 = (_local5 - _arg1.upperBound.y);
_local2 = b2Math.b2Max(_local2, _local4);
_local3 = b2Math.b2Max(_local3, _local5);
return ((b2Math.b2Max(_local2, _local3) < 0));
}
public function MoveProxy(_arg1:uint, _arg2:b2AABB):void{
var _local3:Array;
var _local4:int;
var _local5:uint;
var _local6:uint;
var _local7:b2Bound;
var _local8:b2Bound;
var _local9:b2Bound;
var _local10:uint;
var _local11:b2Proxy;
var _local12:uint;
var _local13:b2Proxy;
var _local14:b2BoundValues;
var _local15:b2BoundValues;
var _local16:Array;
var _local17:uint;
var _local18:uint;
var _local19:uint;
var _local20:uint;
var _local21:int;
var _local22:int;
var _local23:uint;
var _local24:b2Proxy;
if ((((_arg1 == b2Pair.b2_nullProxy)) || ((b2Settings.b2_maxProxies <= _arg1)))){
return;
};
if (_arg2.IsValid() == false){
return;
};
_local12 = (2 * m_proxyCount);
_local13 = m_proxyPool[_arg1];
_local14 = new b2BoundValues();
ComputeBounds(_local14.lowerValues, _local14.upperValues, _arg2);
_local15 = new b2BoundValues();
_local5 = 0;
while (_local5 < 2) {
_local7 = m_bounds[_local5][_local13.lowerBounds[_local5]];
_local15.lowerValues[_local5] = _local7.value;
_local7 = m_bounds[_local5][_local13.upperBounds[_local5]];
_local15.upperValues[_local5] = _local7.value;
_local5++;
};
_local5 = 0;
while (_local5 < 2) {
_local16 = m_bounds[_local5];
_local17 = _local13.lowerBounds[_local5];
_local18 = _local13.upperBounds[_local5];
_local19 = _local14.lowerValues[_local5];
_local20 = _local14.upperValues[_local5];
_local7 = _local16[_local17];
_local21 = (_local19 - _local7.value);
_local7.value = _local19;
_local7 = _local16[_local18];
_local22 = (_local20 - _local7.value);
_local7.value = _local20;
if (_local21 < 0){
_local6 = _local17;
while ((((_local6 > 0)) && ((_local19 < (_local16[int((_local6 - 1))] as b2Bound).value)))) {
_local7 = _local16[_local6];
_local8 = _local16[int((_local6 - 1))];
_local23 = _local8.proxyId;
_local24 = m_proxyPool[_local8.proxyId];
_local8.stabbingCount++;
if (_local8.IsUpper() == true){
if (TestOverlap(_local14, _local24)){
m_pairManager.AddBufferedPair(_arg1, _local23);
};
_local3 = _local24.upperBounds;
_local4 = _local3[_local5];
_local4++;
_local3[_local5] = _local4;
_local7.stabbingCount++;
} else {
_local3 = _local24.lowerBounds;
_local4 = _local3[_local5];
_local4++;
_local3[_local5] = _local4;
_local7.stabbingCount--;
};
_local3 = _local13.lowerBounds;
_local4 = _local3[_local5];
_local4--;
_local3[_local5] = _local4;
_local7.Swap(_local8);
_local6--;
};
};
if (_local22 > 0){
_local6 = _local18;
while ((((_local6 < (_local12 - 1))) && (((_local16[int((_local6 + 1))] as b2Bound).value <= _local20)))) {
_local7 = _local16[_local6];
_local9 = _local16[int((_local6 + 1))];
_local10 = _local9.proxyId;
_local11 = m_proxyPool[_local10];
_local9.stabbingCount++;
if (_local9.IsLower() == true){
if (TestOverlap(_local14, _local11)){
m_pairManager.AddBufferedPair(_arg1, _local10);
};
_local3 = _local11.lowerBounds;
_local4 = _local3[_local5];
_local4--;
_local3[_local5] = _local4;
_local7.stabbingCount++;
} else {
_local3 = _local11.upperBounds;
_local4 = _local3[_local5];
_local4--;
_local3[_local5] = _local4;
_local7.stabbingCount--;
};
_local3 = _local13.upperBounds;
_local4 = _local3[_local5];
_local4++;
_local3[_local5] = _local4;
_local7.Swap(_local9);
_local6++;
};
};
if (_local21 > 0){
_local6 = _local17;
while ((((_local6 < (_local12 - 1))) && (((_local16[int((_local6 + 1))] as b2Bound).value <= _local19)))) {
_local7 = _local16[_local6];
_local9 = _local16[int((_local6 + 1))];
_local10 = _local9.proxyId;
_local11 = m_proxyPool[_local10];
_local9.stabbingCount--;
if (_local9.IsUpper()){
if (TestOverlap(_local15, _local11)){
m_pairManager.RemoveBufferedPair(_arg1, _local10);
};
_local3 = _local11.upperBounds;
_local4 = _local3[_local5];
_local4--;
_local3[_local5] = _local4;
_local7.stabbingCount--;
} else {
_local3 = _local11.lowerBounds;
_local4 = _local3[_local5];
_local4--;
_local3[_local5] = _local4;
_local7.stabbingCount++;
};
_local3 = _local13.lowerBounds;
_local4 = _local3[_local5];
_local4++;
_local3[_local5] = _local4;
_local7.Swap(_local9);
_local6++;
};
};
if (_local22 < 0){
_local6 = _local18;
while ((((_local6 > 0)) && ((_local20 < (_local16[int((_local6 - 1))] as b2Bound).value)))) {
_local7 = _local16[_local6];
_local8 = _local16[int((_local6 - 1))];
_local23 = _local8.proxyId;
_local24 = m_proxyPool[_local23];
_local8.stabbingCount--;
if (_local8.IsLower() == true){
if (TestOverlap(_local15, _local24)){
m_pairManager.RemoveBufferedPair(_arg1, _local23);
};
_local3 = _local24.lowerBounds;
_local4 = _local3[_local5];
_local4++;
_local3[_local5] = _local4;
_local7.stabbingCount--;
} else {
_local3 = _local24.upperBounds;
_local4 = _local3[_local5];
_local4++;
_local3[_local5] = _local4;
_local7.stabbingCount++;
};
_local3 = _local13.upperBounds;
_local4 = _local3[_local5];
_local4--;
_local3[_local5] = _local4;
_local7.Swap(_local8);
_local6--;
};
};
_local5++;
};
}
public static function BinarySearch(_arg1:Array, _arg2:int, _arg3:uint):uint{
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:b2Bound;
_local4 = 0;
_local5 = (_arg2 - 1);
while (_local4 <= _local5) {
_local6 = ((_local4 + _local5) / 2);
_local7 = _arg1[_local6];
if (_local7.value > _arg3){
_local5 = (_local6 - 1);
} else {
if (_local7.value < _arg3){
_local4 = (_local6 + 1);
} else {
return (uint(_local6));
};
};
};
return (uint(_local4));
}
}
}//package Box2D.Collision
Section 13
//b2BufferedPair (Box2D.Collision.b2BufferedPair)
package Box2D.Collision {
public class b2BufferedPair {
public var proxyId1:uint;
public var proxyId2:uint;
}
}//package Box2D.Collision
Section 14
//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 static function EdgeSeparation(_arg1:b2PolygonShape, _arg2:b2XForm, _arg3:int, _arg4:b2PolygonShape, _arg5:b2XForm):Number{
var _local6:int;
var _local7:Array;
var _local8:Array;
var _local9:int;
var _local10:Array;
var _local11:b2Mat22;
var _local12:b2Vec2;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:int;
var _local18:Number;
var _local19:int;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:Number;
_local6 = _arg1.m_vertexCount;
_local7 = _arg1.m_vertices;
_local8 = _arg1.m_normals;
_local9 = _arg4.m_vertexCount;
_local10 = _arg4.m_vertices;
_local11 = _arg2.R;
_local12 = _local8[_arg3];
_local13 = ((_local11.col1.x * _local12.x) + (_local11.col2.x * _local12.y));
_local14 = ((_local11.col1.y * _local12.x) + (_local11.col2.y * _local12.y));
_local11 = _arg5.R;
_local15 = ((_local11.col1.x * _local13) + (_local11.col1.y * _local14));
_local16 = ((_local11.col2.x * _local13) + (_local11.col2.y * _local14));
_local17 = 0;
_local18 = Number.MAX_VALUE;
_local19 = 0;
while (_local19 < _local9) {
_local12 = _local10[_local19];
_local25 = ((_local12.x * _local15) + (_local12.y * _local16));
if (_local25 < _local18){
_local18 = _local25;
_local17 = _local19;
};
_local19++;
};
_local12 = _local7[_arg3];
_local11 = _arg2.R;
_local20 = (_arg2.position.x + ((_local11.col1.x * _local12.x) + (_local11.col2.x * _local12.y)));
_local21 = (_arg2.position.y + ((_local11.col1.y * _local12.x) + (_local11.col2.y * _local12.y)));
_local12 = _local10[_local17];
_local11 = _arg5.R;
_local22 = (_arg5.position.x + ((_local11.col1.x * _local12.x) + (_local11.col2.x * _local12.y)));
_local23 = (_arg5.position.y + ((_local11.col1.y * _local12.x) + (_local11.col2.y * _local12.y)));
_local22 = (_local22 - _local20);
_local23 = (_local23 - _local21);
_local24 = ((_local22 * _local13) + (_local23 * _local14));
return (_local24);
}
public static function b2TestOverlap(_arg1:b2AABB, _arg2:b2AABB):Boolean{
var _local3:b2Vec2;
var _local4:b2Vec2;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
_local3 = _arg2.lowerBound;
_local4 = _arg1.upperBound;
_local5 = (_local3.x - _local4.x);
_local6 = (_local3.y - _local4.y);
_local3 = _arg1.lowerBound;
_local4 = _arg2.upperBound;
_local7 = (_local3.x - _local4.x);
_local8 = (_local3.y - _local4.y);
if ((((_local5 > 0)) || ((_local6 > 0)))){
return (false);
};
if ((((_local7 > 0)) || ((_local8 > 0)))){
return (false);
};
return (true);
}
public static function FindIncidentEdge(_arg1:Array, _arg2:b2PolygonShape, _arg3:b2XForm, _arg4:int, _arg5:b2PolygonShape, _arg6:b2XForm):void{
var _local7:int;
var _local8:Array;
var _local9:int;
var _local10:Array;
var _local11:Array;
var _local12:b2Mat22;
var _local13:b2Vec2;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:int;
var _local18:Number;
var _local19:int;
var _local20:ClipVertex;
var _local21:int;
var _local22:int;
var _local23:Number;
_local7 = _arg2.m_vertexCount;
_local8 = _arg2.m_normals;
_local9 = _arg5.m_vertexCount;
_local10 = _arg5.m_vertices;
_local11 = _arg5.m_normals;
_local12 = _arg3.R;
_local13 = _local8[_arg4];
_local14 = ((_local12.col1.x * _local13.x) + (_local12.col2.x * _local13.y));
_local15 = ((_local12.col1.y * _local13.x) + (_local12.col2.y * _local13.y));
_local12 = _arg6.R;
_local16 = ((_local12.col1.x * _local14) + (_local12.col1.y * _local15));
_local15 = ((_local12.col2.x * _local14) + (_local12.col2.y * _local15));
_local14 = _local16;
_local17 = 0;
_local18 = Number.MAX_VALUE;
_local19 = 0;
while (_local19 < _local9) {
_local13 = _local11[_local19];
_local23 = ((_local14 * _local13.x) + (_local15 * _local13.y));
if (_local23 < _local18){
_local18 = _local23;
_local17 = _local19;
};
_local19++;
};
_local21 = _local17;
_local22 = (((_local21 + 1) < _local9)) ? (_local21 + 1) : 0;
_local20 = _arg1[0];
_local13 = _local10[_local21];
_local12 = _arg6.R;
_local20.v.x = (_arg6.position.x + ((_local12.col1.x * _local13.x) + (_local12.col2.x * _local13.y)));
_local20.v.y = (_arg6.position.y + ((_local12.col1.y * _local13.x) + (_local12.col2.y * _local13.y)));
_local20.id.features.referenceEdge = _arg4;
_local20.id.features.incidentEdge = _local21;
_local20.id.features.incidentVertex = 0;
_local20 = _arg1[1];
_local13 = _local10[_local22];
_local12 = _arg6.R;
_local20.v.x = (_arg6.position.x + ((_local12.col1.x * _local13.x) + (_local12.col2.x * _local13.y)));
_local20.v.y = (_arg6.position.y + ((_local12.col1.y * _local13.x) + (_local12.col2.y * _local13.y)));
_local20.id.features.referenceEdge = _arg4;
_local20.id.features.incidentEdge = _local22;
_local20.id.features.incidentVertex = 1;
}
public static function b2CollidePolygons(_arg1:b2Manifold, _arg2:b2PolygonShape, _arg3:b2XForm, _arg4:b2PolygonShape, _arg5:b2XForm):void{
var _local6:ClipVertex;
var _local7:int;
var _local8:Array;
var _local9:Number;
var _local10:int;
var _local11:Array;
var _local12:Number;
var _local13:b2PolygonShape;
var _local14:b2PolygonShape;
var _local15:b2XForm;
var _local16:b2XForm;
var _local17:int;
var _local18:uint;
var _local19:Number;
var _local20:Number;
var _local21:Array;
var _local22:int;
var _local23:Array;
var _local24:b2Vec2;
var _local25:b2Vec2;
var _local26:b2Vec2;
var _local27:b2Vec2;
var _local28:b2Vec2;
var _local29:Number;
var _local30:Number;
var _local31:Number;
var _local32:Array;
var _local33:Array;
var _local34:int;
var _local35:int;
var _local36:int;
var _local37:b2Vec2;
var _local38:Number;
var _local39:b2ManifoldPoint;
_arg1.pointCount = 0;
_local7 = 0;
_local8 = [_local7];
_local9 = FindMaxSeparation(_local8, _arg2, _arg3, _arg4, _arg5);
_local7 = _local8[0];
if (_local9 > 0){
return;
};
_local10 = 0;
_local11 = [_local10];
_local12 = FindMaxSeparation(_local11, _arg4, _arg5, _arg2, _arg3);
_local10 = _local11[0];
if (_local12 > 0){
return;
};
_local15 = new b2XForm();
_local16 = new b2XForm();
_local19 = 0.98;
_local20 = 0.001;
if (_local12 > ((_local19 * _local9) + _local20)){
_local13 = _arg4;
_local14 = _arg2;
_local15.Set(_arg5);
_local16.Set(_arg3);
_local17 = _local10;
_local18 = 1;
} else {
_local13 = _arg2;
_local14 = _arg4;
_local15.Set(_arg3);
_local16.Set(_arg5);
_local17 = _local7;
_local18 = 0;
};
_local21 = [new ClipVertex(), new ClipVertex()];
FindIncidentEdge(_local21, _local13, _local15, _local17, _local14, _local16);
_local22 = _local13.m_vertexCount;
_local23 = _local13.m_vertices;
_local24 = _local23[_local17];
_local25 = _local24.Copy();
if ((_local17 + 1) < _local22){
_local24 = _local23[int((_local17 + 1))];
_local37 = _local24.Copy();
} else {
_local24 = _local23[0];
_local37 = _local24.Copy();
};
_local26 = b2Math.SubtractVV(_local37, _local25);
_local27 = b2Math.b2MulMV(_local15.R, b2Math.SubtractVV(_local37, _local25));
_local27.Normalize();
_local28 = b2Math.b2CrossVF(_local27, 1);
_local25 = b2Math.b2MulX(_local15, _local25);
_local37 = b2Math.b2MulX(_local15, _local37);
_local29 = b2Math.b2Dot(_local28, _local25);
_local30 = -(b2Math.b2Dot(_local27, _local25));
_local31 = b2Math.b2Dot(_local27, _local37);
_local32 = [new ClipVertex(), new ClipVertex()];
_local33 = [new ClipVertex(), new ClipVertex()];
_local34 = ClipSegmentToLine(_local32, _local21, _local27.Negative(), _local30);
if (_local34 < 2){
return;
};
_local34 = ClipSegmentToLine(_local33, _local32, _local27, _local31);
if (_local34 < 2){
return;
};
_arg1.normal = (_local18) ? _local28.Negative() : _local28.Copy();
_local35 = 0;
_local36 = 0;
while (_local36 < b2Settings.b2_maxManifoldPoints) {
_local6 = _local33[_local36];
_local38 = (b2Math.b2Dot(_local28, _local6.v) - _local29);
if (_local38 <= 0){
_local39 = _arg1.points[_local35];
_local39.separation = _local38;
_local39.localPoint1 = b2Math.b2MulXT(_arg3, _local6.v);
_local39.localPoint2 = b2Math.b2MulXT(_arg5, _local6.v);
_local39.id.key = _local6.id._key;
_local39.id.features.flip = _local18;
_local35++;
};
_local36++;
};
_arg1.pointCount = _local35;
}
public static function FindMaxSeparation(_arg1:Array, _arg2:b2PolygonShape, _arg3:b2XForm, _arg4:b2PolygonShape, _arg5:b2XForm):Number{
var _local6:int;
var _local7:Array;
var _local8:b2Vec2;
var _local9:b2Mat22;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:int;
var _local15:Number;
var _local16:int;
var _local17:Number;
var _local18:int;
var _local19:Number;
var _local20:int;
var _local21:Number;
var _local22:int;
var _local23:Number;
var _local24:int;
var _local25:Number;
_local6 = _arg2.m_vertexCount;
_local7 = _arg2.m_normals;
_local9 = _arg5.R;
_local8 = _arg4.m_centroid;
_local10 = (_arg5.position.x + ((_local9.col1.x * _local8.x) + (_local9.col2.x * _local8.y)));
_local11 = (_arg5.position.y + ((_local9.col1.y * _local8.x) + (_local9.col2.y * _local8.y)));
_local9 = _arg3.R;
_local8 = _arg2.m_centroid;
_local10 = (_local10 - (_arg3.position.x + ((_local9.col1.x * _local8.x) + (_local9.col2.x * _local8.y))));
_local11 = (_local11 - (_arg3.position.y + ((_local9.col1.y * _local8.x) + (_local9.col2.y * _local8.y))));
_local12 = ((_local10 * _arg3.R.col1.x) + (_local11 * _arg3.R.col1.y));
_local13 = ((_local10 * _arg3.R.col2.x) + (_local11 * _arg3.R.col2.y));
_local14 = 0;
_local15 = -(Number.MAX_VALUE);
_local16 = 0;
while (_local16 < _local6) {
_local8 = _local7[_local16];
_local25 = ((_local8.x * _local12) + (_local8.y * _local13));
if (_local25 > _local15){
_local15 = _local25;
_local14 = _local16;
};
_local16++;
};
_local17 = EdgeSeparation(_arg2, _arg3, _local14, _arg4, _arg5);
if (_local17 > 0){
return (_local17);
};
_local18 = (((_local14 - 1) >= 0)) ? (_local14 - 1) : (_local6 - 1);
_local19 = EdgeSeparation(_arg2, _arg3, _local18, _arg4, _arg5);
if (_local19 > 0){
return (_local19);
};
_local20 = (((_local14 + 1) < _local6)) ? (_local14 + 1) : 0;
_local21 = EdgeSeparation(_arg2, _arg3, _local20, _arg4, _arg5);
if (_local21 > 0){
return (_local21);
};
if ((((_local19 > _local17)) && ((_local19 > _local21)))){
_local24 = -1;
_local22 = _local18;
_local23 = _local19;
} else {
if (_local21 > _local17){
_local24 = 1;
_local22 = _local20;
_local23 = _local21;
} else {
_arg1[0] = _local14;
return (_local17);
};
};
while (true) {
if (_local24 == -1){
_local14 = (((_local22 - 1) >= 0)) ? (_local22 - 1) : (_local6 - 1);
} else {
_local14 = (((_local22 + 1) < _local6)) ? (_local22 + 1) : 0;
};
_local17 = EdgeSeparation(_arg2, _arg3, _local14, _arg4, _arg5);
if (_local17 > 0){
return (_local17);
};
if (_local17 > _local23){
_local22 = _local14;
_local23 = _local17;
} else {
break;
};
};
_arg1[0] = _local22;
return (_local23);
}
public static function ClipSegmentToLine(_arg1:Array, _arg2:Array, _arg3:b2Vec2, _arg4:Number):int{
var _local5:ClipVertex;
var _local6:int;
var _local7:b2Vec2;
var _local8:b2Vec2;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:b2Vec2;
var _local13:ClipVertex;
_local6 = 0;
_local5 = _arg2[0];
_local7 = _local5.v;
_local5 = _arg2[1];
_local8 = _local5.v;
_local9 = (b2Math.b2Dot(_arg3, _local7) - _arg4);
_local10 = (b2Math.b2Dot(_arg3, _local8) - _arg4);
if (_local9 <= 0){
var _temp1 = _local6;
_local6 = (_local6 + 1);
var _local14 = _temp1;
_arg1[_local14] = _arg2[0];
};
if (_local10 <= 0){
var _temp2 = _local6;
_local6 = (_local6 + 1);
_local14 = _temp2;
_arg1[_local14] = _arg2[1];
};
if ((_local9 * _local10) < 0){
_local11 = (_local9 / (_local9 - _local10));
_local5 = _arg1[_local6];
_local12 = _local5.v;
_local12.x = (_local7.x + (_local11 * (_local8.x - _local7.x)));
_local12.y = (_local7.y + (_local11 * (_local8.y - _local7.y)));
_local5 = _arg1[_local6];
if (_local9 > 0){
_local13 = _arg2[0];
_local5.id = _local13.id;
} else {
_local13 = _arg2[1];
_local5.id = _local13.id;
};
_local6++;
};
return (_local6);
}
public static function b2CollideCircles(_arg1:b2Manifold, _arg2:b2CircleShape, _arg3:b2XForm, _arg4:b2CircleShape, _arg5:b2XForm):void{
var _local6:b2Mat22;
var _local7:b2Vec2;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:b2ManifoldPoint;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:Number;
_arg1.pointCount = 0;
_local6 = _arg3.R;
_local7 = _arg2.m_localPosition;
_local8 = (_arg3.position.x + ((_local6.col1.x * _local7.x) + (_local6.col2.x * _local7.y)));
_local9 = (_arg3.position.y + ((_local6.col1.y * _local7.x) + (_local6.col2.y * _local7.y)));
_local6 = _arg5.R;
_local7 = _arg4.m_localPosition;
_local10 = (_arg5.position.x + ((_local6.col1.x * _local7.x) + (_local6.col2.x * _local7.y)));
_local11 = (_arg5.position.y + ((_local6.col1.y * _local7.x) + (_local6.col2.y * _local7.y)));
_local12 = (_local10 - _local8);
_local13 = (_local11 - _local9);
_local14 = ((_local12 * _local12) + (_local13 * _local13));
_local15 = _arg2.m_radius;
_local16 = _arg4.m_radius;
_local17 = (_local15 + _local16);
if (_local14 > (_local17 * _local17)){
return;
};
if (_local14 < Number.MIN_VALUE){
_local18 = -(_local17);
_arg1.normal.Set(0, 1);
} else {
_local24 = Math.sqrt(_local14);
_local18 = (_local24 - _local17);
_local25 = (1 / _local24);
_arg1.normal.x = (_local25 * _local12);
_arg1.normal.y = (_local25 * _local13);
};
_arg1.pointCount = 1;
_local19 = _arg1.points[0];
_local19.id.key = 0;
_local19.separation = _local18;
_local8 = (_local8 + (_local15 * _arg1.normal.x));
_local9 = (_local9 + (_local15 * _arg1.normal.y));
_local10 = (_local10 - (_local16 * _arg1.normal.x));
_local11 = (_local11 - (_local16 * _arg1.normal.y));
_local20 = (0.5 * (_local8 + _local10));
_local21 = (0.5 * (_local9 + _local11));
_local22 = (_local20 - _arg3.position.x);
_local23 = (_local21 - _arg3.position.y);
_local19.localPoint1.x = ((_local22 * _arg3.R.col1.x) + (_local23 * _arg3.R.col1.y));
_local19.localPoint1.y = ((_local22 * _arg3.R.col2.x) + (_local23 * _arg3.R.col2.y));
_local22 = (_local20 - _arg5.position.x);
_local23 = (_local21 - _arg5.position.y);
_local19.localPoint2.x = ((_local22 * _arg5.R.col1.x) + (_local23 * _arg5.R.col1.y));
_local19.localPoint2.y = ((_local22 * _arg5.R.col2.x) + (_local23 * _arg5.R.col2.y));
}
public static function b2CollidePolygonAndCircle(_arg1:b2Manifold, _arg2:b2PolygonShape, _arg3:b2XForm, _arg4:b2CircleShape, _arg5:b2XForm):void{
var _local6:b2ManifoldPoint;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:b2Vec2;
var _local12:b2Mat22;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:int;
var _local19:Number;
var _local20:Number;
var _local21:int;
var _local22:Array;
var _local23:Array;
var _local24:int;
var _local25:int;
var _local26:int;
var _local27:b2Vec2;
var _local28:Number;
var _local29:Number;
var _local30:Number;
var _local31:Number;
var _local32:Number;
var _local33:Number;
var _local34:Number;
_arg1.pointCount = 0;
_local12 = _arg5.R;
_local11 = _arg4.m_localPosition;
_local13 = (_arg5.position.x + ((_local12.col1.x * _local11.x) + (_local12.col2.x * _local11.y)));
_local14 = (_arg5.position.y + ((_local12.col1.y * _local11.x) + (_local12.col2.y * _local11.y)));
_local7 = (_local13 - _arg3.position.x);
_local8 = (_local14 - _arg3.position.y);
_local12 = _arg3.R;
_local15 = ((_local7 * _local12.col1.x) + (_local8 * _local12.col1.y));
_local16 = ((_local7 * _local12.col2.x) + (_local8 * _local12.col2.y));
_local18 = 0;
_local19 = -(Number.MAX_VALUE);
_local20 = _arg4.m_radius;
_local21 = _arg2.m_vertexCount;
_local22 = _arg2.m_vertices;
_local23 = _arg2.m_normals;
_local24 = 0;
while (_local24 < _local21) {
_local11 = _local22[_local24];
_local7 = (_local15 - _local11.x);
_local8 = (_local16 - _local11.y);
_local11 = _local23[_local24];
_local34 = ((_local11.x * _local7) + (_local11.y * _local8));
if (_local34 > _local20){
return;
};
if (_local34 > _local19){
_local19 = _local34;
_local18 = _local24;
};
_local24++;
};
if (_local19 < Number.MIN_VALUE){
_arg1.pointCount = 1;
_local11 = _local23[_local18];
_local12 = _arg3.R;
_arg1.normal.x = ((_local12.col1.x * _local11.x) + (_local12.col2.x * _local11.y));
_arg1.normal.y = ((_local12.col1.y * _local11.x) + (_local12.col2.y * _local11.y));
_local6 = _arg1.points[0];
_local6.id.features.incidentEdge = _local18;
_local6.id.features.incidentVertex = b2_nullFeature;
_local6.id.features.referenceEdge = 0;
_local6.id.features.flip = 0;
_local9 = (_local13 - (_local20 * _arg1.normal.x));
_local10 = (_local14 - (_local20 * _arg1.normal.y));
_local7 = (_local9 - _arg3.position.x);
_local8 = (_local10 - _arg3.position.y);
_local12 = _arg3.R;
_local6.localPoint1.x = ((_local7 * _local12.col1.x) + (_local8 * _local12.col1.y));
_local6.localPoint1.y = ((_local7 * _local12.col2.x) + (_local8 * _local12.col2.y));
_local7 = (_local9 - _arg5.position.x);
_local8 = (_local10 - _arg5.position.y);
_local12 = _arg5.R;
_local6.localPoint2.x = ((_local7 * _local12.col1.x) + (_local8 * _local12.col1.y));
_local6.localPoint2.y = ((_local7 * _local12.col2.x) + (_local8 * _local12.col2.y));
_local6.separation = (_local19 - _local20);
return;
};
_local25 = _local18;
_local26 = (((_local25 + 1) < _local21)) ? (_local25 + 1) : 0;
_local11 = _local22[_local25];
_local27 = _local22[_local26];
_local28 = (_local27.x - _local11.x);
_local29 = (_local27.y - _local11.y);
_local30 = Math.sqrt(((_local28 * _local28) + (_local29 * _local29)));
_local28 = (_local28 / _local30);
_local29 = (_local29 / _local30);
_local7 = (_local15 - _local11.x);
_local8 = (_local16 - _local11.y);
_local31 = ((_local7 * _local28) + (_local8 * _local29));
_local6 = _arg1.points[0];
if (_local31 <= 0){
_local32 = _local11.x;
_local33 = _local11.y;
_local6.id.features.incidentEdge = b2_nullFeature;
_local6.id.features.incidentVertex = _local25;
} else {
if (_local31 >= _local30){
_local32 = _local27.x;
_local33 = _local27.y;
_local6.id.features.incidentEdge = b2_nullFeature;
_local6.id.features.incidentVertex = _local26;
} else {
_local32 = ((_local28 * _local31) + _local11.x);
_local33 = ((_local29 * _local31) + _local11.y);
_local6.id.features.incidentEdge = _local18;
_local6.id.features.incidentVertex = 0;
};
};
_local7 = (_local15 - _local32);
_local8 = (_local16 - _local33);
_local17 = Math.sqrt(((_local7 * _local7) + (_local8 * _local8)));
_local7 = (_local7 / _local17);
_local8 = (_local8 / _local17);
if (_local17 > _local20){
return;
};
_arg1.pointCount = 1;
_local12 = _arg3.R;
_arg1.normal.x = ((_local12.col1.x * _local7) + (_local12.col2.x * _local8));
_arg1.normal.y = ((_local12.col1.y * _local7) + (_local12.col2.y * _local8));
_local9 = (_local13 - (_local20 * _arg1.normal.x));
_local10 = (_local14 - (_local20 * _arg1.normal.y));
_local7 = (_local9 - _arg3.position.x);
_local8 = (_local10 - _arg3.position.y);
_local12 = _arg3.R;
_local6.localPoint1.x = ((_local7 * _local12.col1.x) + (_local8 * _local12.col1.y));
_local6.localPoint1.y = ((_local7 * _local12.col2.x) + (_local8 * _local12.col2.y));
_local7 = (_local9 - _arg5.position.x);
_local8 = (_local10 - _arg5.position.y);
_local12 = _arg5.R;
_local6.localPoint2.x = ((_local7 * _local12.col1.x) + (_local8 * _local12.col1.y));
_local6.localPoint2.y = ((_local7 * _local12.col2.x) + (_local8 * _local12.col2.y));
_local6.separation = (_local17 - _local20);
_local6.id.features.referenceEdge = 0;
_local6.id.features.flip = 0;
}
}
}//package Box2D.Collision
Section 15
//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(_arg1:b2ContactID):void{
key = _arg1._key;
}
public function Copy():b2ContactID{
var _local1:b2ContactID;
_local1 = new b2ContactID();
_local1.key = key;
return (_local1);
}
public function get key():uint{
return (_key);
}
public function set key(_arg1:uint):void{
_key = _arg1;
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 16
//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 17
//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 static function InPoints(_arg1:b2Vec2, _arg2:Array, _arg3:int):Boolean{
var _local4:Number;
var _local5:int;
var _local6:b2Vec2;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
_local4 = (100 * Number.MIN_VALUE);
_local5 = 0;
while (_local5 < _arg3) {
_local6 = _arg2[_local5];
_local7 = Math.abs((_arg1.x - _local6.x));
_local8 = Math.abs((_arg1.y - _local6.y));
_local9 = Math.max(Math.abs(_arg1.x), Math.abs(_local6.x));
_local10 = Math.max(Math.abs(_arg1.y), Math.abs(_local6.y));
if ((((_local7 < (_local4 * (_local9 + 1)))) && ((_local8 < (_local4 * (_local10 + 1)))))){
return (true);
};
_local5++;
};
return (false);
}
public static function DistanceGeneric(_arg1:b2Vec2, _arg2:b2Vec2, _arg3, _arg4:b2XForm, _arg5, _arg6:b2XForm):Number{
var _local7:b2Vec2;
var _local8:Array;
var _local9:Array;
var _local10:Array;
var _local11:int;
var _local12:Number;
var _local13:int;
var _local14:int;
var _local15:Number;
var _local16:Number;
var _local17:b2Vec2;
var _local18:b2Vec2;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:int;
_local8 = s_p1s;
_local9 = s_p2s;
_local10 = s_points;
_local11 = 0;
_arg1.SetV(_arg3.GetFirstVertex(_arg4));
_arg2.SetV(_arg5.GetFirstVertex(_arg6));
_local12 = 0;
_local13 = 20;
_local14 = 0;
while (_local14 < _local13) {
_local15 = (_arg2.x - _arg1.x);
_local16 = (_arg2.y - _arg1.y);
_local17 = _arg3.Support(_arg4, _local15, _local16);
_local18 = _arg5.Support(_arg6, -(_local15), -(_local16));
_local12 = ((_local15 * _local15) + (_local16 * _local16));
_local19 = (_local18.x - _local17.x);
_local20 = (_local18.y - _local17.y);
_local21 = ((_local15 * _local19) + (_local16 * _local20));
if ((_local12 - ((_local15 * _local19) + (_local16 * _local20))) <= (0.01 * _local12)){
if (_local11 == 0){
_arg1.SetV(_local17);
_arg2.SetV(_local18);
};
g_GJK_Iterations = _local14;
return (Math.sqrt(_local12));
};
switch (_local11){
case 0:
_local7 = _local8[0];
_local7.SetV(_local17);
_local7 = _local9[0];
_local7.SetV(_local18);
_local7 = _local10[0];
_local7.x = _local19;
_local7.y = _local20;
_arg1.SetV(_local8[0]);
_arg2.SetV(_local9[0]);
_local11++;
break;
case 1:
_local7 = _local8[1];
_local7.SetV(_local17);
_local7 = _local9[1];
_local7.SetV(_local18);
_local7 = _local10[1];
_local7.x = _local19;
_local7.y = _local20;
_local11 = ProcessTwo(_arg1, _arg2, _local8, _local9, _local10);
break;
case 2:
_local7 = _local8[2];
_local7.SetV(_local17);
_local7 = _local9[2];
_local7.SetV(_local18);
_local7 = _local10[2];
_local7.x = _local19;
_local7.y = _local20;
_local11 = ProcessThree(_arg1, _arg2, _local8, _local9, _local10);
break;
};
if (_local11 == 3){
g_GJK_Iterations = _local14;
return (0);
};
_local22 = -(Number.MAX_VALUE);
_local23 = 0;
while (_local23 < _local11) {
_local7 = _local10[_local23];
_local22 = b2Math.b2Max(_local22, ((_local7.x * _local7.x) + (_local7.y * _local7.y)));
_local23++;
};
if ((((_local11 == 3)) || ((_local12 <= ((100 * Number.MIN_VALUE) * _local22))))){
g_GJK_Iterations = _local14;
_local15 = (_arg2.x - _arg1.x);
_local16 = (_arg2.y - _arg1.y);
_local12 = ((_local15 * _local15) + (_local16 * _local16));
return (Math.sqrt(_local12));
};
_local14++;
};
g_GJK_Iterations = _local13;
return (Math.sqrt(_local12));
}
public static function DistanceCC(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:b2CircleShape, _arg4:b2XForm, _arg5:b2CircleShape, _arg6:b2XForm):Number{
var _local7:b2Mat22;
var _local8:b2Vec2;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
_local7 = _arg4.R;
_local8 = _arg3.m_localPosition;
_local9 = (_arg4.position.x + ((_local7.col1.x * _local8.x) + (_local7.col2.x * _local8.y)));
_local10 = (_arg4.position.y + ((_local7.col1.y * _local8.x) + (_local7.col2.y * _local8.y)));
_local7 = _arg6.R;
_local8 = _arg5.m_localPosition;
_local11 = (_arg6.position.x + ((_local7.col1.x * _local8.x) + (_local7.col2.x * _local8.y)));
_local12 = (_arg6.position.y + ((_local7.col1.y * _local8.x) + (_local7.col2.y * _local8.y)));
_local13 = (_local11 - _local9);
_local14 = (_local12 - _local10);
_local15 = ((_local13 * _local13) + (_local14 * _local14));
_local16 = (_arg3.m_radius - b2Settings.b2_toiSlop);
_local17 = (_arg5.m_radius - b2Settings.b2_toiSlop);
_local18 = (_local16 + _local17);
if (_local15 > (_local18 * _local18)){
_local19 = Math.sqrt(((_local13 * _local13) + (_local14 * _local14)));
_local13 = (_local13 / _local19);
_local14 = (_local14 / _local19);
_local20 = (_local19 - _local18);
_arg1.x = (_local9 + (_local16 * _local13));
_arg1.y = (_local10 + (_local16 * _local14));
_arg2.x = (_local11 - (_local17 * _local13));
_arg2.y = (_local12 - (_local17 * _local14));
return (_local20);
};
if (_local15 > (Number.MIN_VALUE * Number.MIN_VALUE)){
_local19 = Math.sqrt(((_local13 * _local13) + (_local14 * _local14)));
_local13 = (_local13 / _local19);
_local14 = (_local14 / _local19);
_arg1.x = (_local9 + (_local16 * _local13));
_arg1.y = (_local10 + (_local16 * _local14));
_arg2.x = _arg1.x;
_arg2.y = _arg1.y;
return (0);
};
_arg1.x = _local9;
_arg1.y = _local10;
_arg2.x = _arg1.x;
_arg2.y = _arg1.y;
return (0);
}
public static function ProcessThree(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:Array, _arg4:Array, _arg5:Array):int{
var _local6:b2Vec2;
var _local7:b2Vec2;
var _local8:b2Vec2;
var _local9:b2Vec2;
var _local10:b2Vec2;
var _local11:b2Vec2;
var _local12:b2Vec2;
var _local13:b2Vec2;
var _local14:b2Vec2;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:Number;
var _local26:Number;
var _local27:Number;
var _local28:Number;
var _local29:Number;
var _local30:Number;
var _local31:Number;
var _local32:Number;
var _local33:Number;
var _local34:Number;
var _local35:Number;
var _local36:Number;
var _local37:Number;
var _local38:Number;
var _local39:Number;
var _local40:Number;
var _local41:Number;
_local6 = _arg5[0];
_local7 = _arg5[1];
_local8 = _arg5[2];
_local9 = _arg3[0];
_local10 = _arg3[1];
_local11 = _arg3[2];
_local12 = _arg4[0];
_local13 = _arg4[1];
_local14 = _arg4[2];
_local15 = _local6.x;
_local16 = _local6.y;
_local17 = _local7.x;
_local18 = _local7.y;
_local19 = _local8.x;
_local20 = _local8.y;
_local21 = (_local17 - _local15);
_local22 = (_local18 - _local16);
_local23 = (_local19 - _local15);
_local24 = (_local20 - _local16);
_local25 = (_local19 - _local17);
_local26 = (_local20 - _local18);
_local27 = -(((_local15 * _local21) + (_local16 * _local22)));
_local28 = ((_local17 * _local21) + (_local18 * _local22));
_local29 = -(((_local15 * _local23) + (_local16 * _local24)));
_local30 = ((_local19 * _local23) + (_local20 * _local24));
_local31 = -(((_local17 * _local25) + (_local18 * _local26)));
_local32 = ((_local19 * _local25) + (_local20 * _local26));
if ((((_local30 <= 0)) && ((_local32 <= 0)))){
_arg1.SetV(_local11);
_arg2.SetV(_local14);
_local9.SetV(_local11);
_local12.SetV(_local14);
_local6.SetV(_local8);
return (1);
};
_local33 = ((_local21 * _local24) - (_local22 * _local23));
_local34 = (_local33 * ((_local15 * _local18) - (_local16 * _local17)));
_local36 = (_local33 * ((_local17 * _local20) - (_local18 * _local19)));
if ((((((((_local36 <= 0)) && ((_local31 >= 0)))) && ((_local32 >= 0)))) && (((_local31 + _local32) > 0)))){
_local35 = (_local31 / (_local31 + _local32));
_arg1.x = (_local10.x + (_local35 * (_local11.x - _local10.x)));
_arg1.y = (_local10.y + (_local35 * (_local11.y - _local10.y)));
_arg2.x = (_local13.x + (_local35 * (_local14.x - _local13.x)));
_arg2.y = (_local13.y + (_local35 * (_local14.y - _local13.y)));
_local9.SetV(_local11);
_local12.SetV(_local14);
_local6.SetV(_local8);
return (2);
};
_local37 = (_local33 * ((_local19 * _local16) - (_local20 * _local15)));
if ((((((((_local37 <= 0)) && ((_local29 >= 0)))) && ((_local30 >= 0)))) && (((_local29 + _local30) > 0)))){
_local35 = (_local29 / (_local29 + _local30));
_arg1.x = (_local9.x + (_local35 * (_local11.x - _local9.x)));
_arg1.y = (_local9.y + (_local35 * (_local11.y - _local9.y)));
_arg2.x = (_local12.x + (_local35 * (_local14.x - _local12.x)));
_arg2.y = (_local12.y + (_local35 * (_local14.y - _local12.y)));
_local10.SetV(_local11);
_local13.SetV(_local14);
_local7.SetV(_local8);
return (2);
};
_local38 = ((_local36 + _local37) + _local34);
_local38 = (1 / _local38);
_local39 = (_local36 * _local38);
_local40 = (_local37 * _local38);
_local41 = ((1 - _local39) - _local40);
_arg1.x = (((_local39 * _local9.x) + (_local40 * _local10.x)) + (_local41 * _local11.x));
_arg1.y = (((_local39 * _local9.y) + (_local40 * _local10.y)) + (_local41 * _local11.y));
_arg2.x = (((_local39 * _local12.x) + (_local40 * _local13.x)) + (_local41 * _local14.x));
_arg2.y = (((_local39 * _local12.y) + (_local40 * _local13.y)) + (_local41 * _local14.y));
return (3);
}
public static function DistancePC(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:b2PolygonShape, _arg4:b2XForm, _arg5:b2CircleShape, _arg6:b2XForm):Number{
var _local7:b2Mat22;
var _local8:b2Vec2;
var _local9:b2Point;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
_local9 = gPoint;
_local8 = _arg5.m_localPosition;
_local7 = _arg6.R;
_local9.p.x = (_arg6.position.x + ((_local7.col1.x * _local8.x) + (_local7.col2.x * _local8.y)));
_local9.p.y = (_arg6.position.y + ((_local7.col1.y * _local8.x) + (_local7.col2.y * _local8.y)));
_local10 = DistanceGeneric(_arg1, _arg2, _arg3, _arg4, _local9, b2Math.b2XForm_identity);
_local11 = (_arg5.m_radius - b2Settings.b2_toiSlop);
if (_local10 > _local11){
_local10 = (_local10 - _local11);
_local12 = (_arg2.x - _arg1.x);
_local13 = (_arg2.y - _arg1.y);
_local14 = Math.sqrt(((_local12 * _local12) + (_local13 * _local13)));
_local12 = (_local12 / _local14);
_local13 = (_local13 / _local14);
_arg2.x = (_arg2.x - (_local11 * _local12));
_arg2.y = (_arg2.y - (_local11 * _local13));
} else {
_local10 = 0;
_arg2.x = _arg1.x;
_arg2.y = _arg1.y;
};
return (_local10);
}
public static function Distance(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:b2Shape, _arg4:b2XForm, _arg5:b2Shape, _arg6:b2XForm):Number{
var _local7:int;
var _local8:int;
_local7 = _arg3.m_type;
_local8 = _arg5.m_type;
if ((((_local7 == b2Shape.e_circleShape)) && ((_local8 == b2Shape.e_circleShape)))){
return (DistanceCC(_arg1, _arg2, (_arg3 as b2CircleShape), _arg4, (_arg5 as b2CircleShape), _arg6));
};
if ((((_local7 == b2Shape.e_polygonShape)) && ((_local8 == b2Shape.e_circleShape)))){
return (DistancePC(_arg1, _arg2, (_arg3 as b2PolygonShape), _arg4, (_arg5 as b2CircleShape), _arg6));
};
if ((((_local7 == b2Shape.e_circleShape)) && ((_local8 == b2Shape.e_polygonShape)))){
return (DistancePC(_arg2, _arg1, (_arg5 as b2PolygonShape), _arg6, (_arg3 as b2CircleShape), _arg4));
};
if ((((_local7 == b2Shape.e_polygonShape)) && ((_local8 == b2Shape.e_polygonShape)))){
return (DistanceGeneric(_arg1, _arg2, (_arg3 as b2PolygonShape), _arg4, (_arg5 as b2PolygonShape), _arg6));
};
return (0);
}
public static function ProcessTwo(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:Array, _arg4:Array, _arg5:Array):int{
var _local6:b2Vec2;
var _local7:b2Vec2;
var _local8:b2Vec2;
var _local9:b2Vec2;
var _local10:b2Vec2;
var _local11:b2Vec2;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
_local6 = _arg5[0];
_local7 = _arg5[1];
_local8 = _arg3[0];
_local9 = _arg3[1];
_local10 = _arg4[0];
_local11 = _arg4[1];
_local12 = -(_local7.x);
_local13 = -(_local7.y);
_local14 = (_local6.x - _local7.x);
_local15 = (_local6.y - _local7.y);
_local16 = Math.sqrt(((_local14 * _local14) + (_local15 * _local15)));
_local14 = (_local14 / _local16);
_local15 = (_local15 / _local16);
_local17 = ((_local12 * _local14) + (_local13 * _local15));
if ((((_local17 <= 0)) || ((_local16 < Number.MIN_VALUE)))){
_arg1.SetV(_local9);
_arg2.SetV(_local11);
_local8.SetV(_local9);
_local10.SetV(_local11);
_local6.SetV(_local7);
return (1);
};
_local17 = (_local17 / _local16);
_arg1.x = (_local9.x + (_local17 * (_local8.x - _local9.x)));
_arg1.y = (_local9.y + (_local17 * (_local8.y - _local9.y)));
_arg2.x = (_local11.x + (_local17 * (_local10.x - _local11.x)));
_arg2.y = (_local11.y + (_local17 * (_local10.y - _local11.y)));
return (2);
}
}
}//package Box2D.Collision
Section 18
//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 _local1:int;
pointCount = 0;
super();
points = new Array(b2Settings.b2_maxManifoldPoints);
_local1 = 0;
while (_local1 < b2Settings.b2_maxManifoldPoints) {
points[_local1] = new b2ManifoldPoint();
_local1++;
};
normal = new b2Vec2();
}
public function Set(_arg1:b2Manifold):void{
var _local2:int;
pointCount = _arg1.pointCount;
_local2 = 0;
while (_local2 < b2Settings.b2_maxManifoldPoints) {
(points[_local2] as b2ManifoldPoint).Set(_arg1.points[_local2]);
_local2++;
};
normal.SetV(_arg1.normal);
}
public function Reset():void{
var _local1:int;
_local1 = 0;
while (_local1 < b2Settings.b2_maxManifoldPoints) {
(points[_local1] as b2ManifoldPoint).Reset();
_local1++;
};
normal.SetZero();
pointCount = 0;
}
}
}//package Box2D.Collision
Section 19
//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(_arg1:b2ManifoldPoint):void{
localPoint1.SetV(_arg1.localPoint1);
localPoint2.SetV(_arg1.localPoint2);
separation = _arg1.separation;
normalImpulse = _arg1.normalImpulse;
tangentImpulse = _arg1.tangentImpulse;
id.key = _arg1.id.key;
}
public function Reset():void{
localPoint1.SetZero();
localPoint2.SetZero();
separation = 0;
normalImpulse = 0;
tangentImpulse = 0;
id.key = 0;
}
}
}//package Box2D.Collision
Section 20
//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 21
//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 22
//b2PairCallback (Box2D.Collision.b2PairCallback)
package Box2D.Collision {
public class b2PairCallback {
public function PairRemoved(_arg1, _arg2, _arg3):void{
}
public function PairAdded(_arg1, _arg2){
return (null);
}
}
}//package Box2D.Collision
Section 23
//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 _local1:uint;
super();
m_hashTable = new Array(b2Pair.b2_tableCapacity);
_local1 = 0;
while (_local1 < b2Pair.b2_tableCapacity) {
m_hashTable[_local1] = b2Pair.b2_nullPair;
_local1++;
};
m_pairs = new Array(b2Settings.b2_maxPairs);
_local1 = 0;
while (_local1 < b2Settings.b2_maxPairs) {
m_pairs[_local1] = new b2Pair();
_local1++;
};
m_pairBuffer = new Array(b2Settings.b2_maxPairs);
_local1 = 0;
while (_local1 < b2Settings.b2_maxPairs) {
m_pairBuffer[_local1] = new b2BufferedPair();
_local1++;
};
_local1 = 0;
while (_local1 < b2Settings.b2_maxPairs) {
m_pairs[_local1].proxyId1 = b2Pair.b2_nullProxy;
m_pairs[_local1].proxyId2 = b2Pair.b2_nullProxy;
m_pairs[_local1].userData = null;
m_pairs[_local1].status = 0;
m_pairs[_local1].next = (_local1 + 1);
_local1++;
};
m_pairs[int((b2Settings.b2_maxPairs - 1))].next = b2Pair.b2_nullPair;
m_pairCount = 0;
m_pairBufferCount = 0;
}
private function FindHash(_arg1:uint, _arg2:uint, _arg3:uint):b2Pair{
var _local4:b2Pair;
var _local5:uint;
_local5 = m_hashTable[_arg3];
_local4 = m_pairs[_local5];
while (((!((_local5 == b2Pair.b2_nullPair))) && ((Equals(_local4, _arg1, _arg2) == false)))) {
_local5 = _local4.next;
_local4 = m_pairs[_local5];
};
if (_local5 == b2Pair.b2_nullPair){
return (null);
};
return (_local4);
}
private function Find(_arg1:uint, _arg2:uint):b2Pair{
var _local3:uint;
var _local4:uint;
if (_arg1 > _arg2){
_local4 = _arg1;
_arg1 = _arg2;
_arg2 = _local4;
};
_local3 = (Hash(_arg1, _arg2) & b2Pair.b2_tableMask);
return (FindHash(_arg1, _arg2, _local3));
}
private function ValidateBuffer():void{
}
public function Commit():void{
var _local1:b2BufferedPair;
var _local2:int;
var _local3:int;
var _local4:Array;
var _local5:b2Pair;
var _local6:b2Proxy;
var _local7:b2Proxy;
_local3 = 0;
_local4 = m_broadPhase.m_proxyPool;
_local2 = 0;
while (_local2 < m_pairBufferCount) {
_local1 = m_pairBuffer[_local2];
_local5 = Find(_local1.proxyId1, _local1.proxyId2);
_local5.ClearBuffered();
_local6 = _local4[_local5.proxyId1];
_local7 = _local4[_local5.proxyId2];
if (_local5.IsRemoved()){
if (_local5.IsFinal() == true){
m_callback.PairRemoved(_local6.userData, _local7.userData, _local5.userData);
};
_local1 = m_pairBuffer[_local3];
_local1.proxyId1 = _local5.proxyId1;
_local1.proxyId2 = _local5.proxyId2;
_local3++;
} else {
if (_local5.IsFinal() == false){
_local5.userData = m_callback.PairAdded(_local6.userData, _local7.userData);
_local5.SetFinal();
};
};
_local2++;
};
_local2 = 0;
while (_local2 < _local3) {
_local1 = m_pairBuffer[_local2];
RemovePair(_local1.proxyId1, _local1.proxyId2);
_local2++;
};
m_pairBufferCount = 0;
if (b2BroadPhase.s_validate){
ValidateTable();
};
}
public function RemoveBufferedPair(_arg1:int, _arg2:int):void{
var _local3:b2BufferedPair;
var _local4:b2Pair;
_local4 = Find(_arg1, _arg2);
if (_local4 == null){
return;
};
if (_local4.IsBuffered() == false){
_local4.SetBuffered();
_local3 = m_pairBuffer[m_pairBufferCount];
_local3.proxyId1 = _local4.proxyId1;
_local3.proxyId2 = _local4.proxyId2;
m_pairBufferCount++;
};
_local4.SetRemoved();
if (b2BroadPhase.s_validate){
ValidateBuffer();
};
}
private function RemovePair(_arg1:uint, _arg2:uint){
var _local3:b2Pair;
var _local4:uint;
var _local5:uint;
var _local6:b2Pair;
var _local7:uint;
var _local8:uint;
var _local9:*;
if (_arg1 > _arg2){
_local7 = _arg1;
_arg1 = _arg2;
_arg2 = _local7;
};
_local4 = (Hash(_arg1, _arg2) & b2Pair.b2_tableMask);
_local5 = m_hashTable[_local4];
_local6 = null;
while (_local5 != b2Pair.b2_nullPair) {
if (Equals(m_pairs[_local5], _arg1, _arg2)){
_local8 = _local5;
_local3 = m_pairs[_local5];
if (_local6){
_local6.next = _local3.next;
} else {
m_hashTable[_local4] = _local3.next;
};
_local3 = m_pairs[_local8];
_local9 = _local3.userData;
_local3.next = m_freePair;
_local3.proxyId1 = b2Pair.b2_nullProxy;
_local3.proxyId2 = b2Pair.b2_nullProxy;
_local3.userData = null;
_local3.status = 0;
m_freePair = _local8;
m_pairCount--;
return (_local9);
} else {
_local6 = m_pairs[_local5];
_local5 = _local6.next;
};
};
return (null);
}
public function Initialize(_arg1:b2BroadPhase, _arg2:b2PairCallback):void{
m_broadPhase = _arg1;
m_callback = _arg2;
}
public function AddBufferedPair(_arg1:int, _arg2:int):void{
var _local3:b2BufferedPair;
var _local4:b2Pair;
_local4 = AddPair(_arg1, _arg2);
if (_local4.IsBuffered() == false){
_local4.SetBuffered();
_local3 = m_pairBuffer[m_pairBufferCount];
_local3.proxyId1 = _local4.proxyId1;
_local3.proxyId2 = _local4.proxyId2;
m_pairBufferCount++;
};
_local4.ClearRemoved();
if (b2BroadPhase.s_validate){
ValidateBuffer();
};
}
private function AddPair(_arg1:uint, _arg2:uint):b2Pair{
var _local3:uint;
var _local4:b2Pair;
var _local5:uint;
var _local6:uint;
if (_arg1 > _arg2){
_local6 = _arg1;
_arg1 = _arg2;
_arg2 = _local6;
};
_local3 = (Hash(_arg1, _arg2) & b2Pair.b2_tableMask);
_local4 = FindHash(_arg1, _arg2, _local3);
if (_local4 != null){
return (_local4);
};
_local5 = m_freePair;
_local4 = m_pairs[_local5];
m_freePair = _local4.next;
_local4.proxyId1 = _arg1;
_local4.proxyId2 = _arg2;
_local4.status = 0;
_local4.userData = null;
_local4.next = m_hashTable[_local3];
m_hashTable[_local3] = _local5;
m_pairCount++;
return (_local4);
}
private function ValidateTable():void{
}
public static function EqualsPair(_arg1:b2BufferedPair, _arg2:b2BufferedPair):Boolean{
return ((((_arg1.proxyId1 == _arg2.proxyId1)) && ((_arg1.proxyId2 == _arg2.proxyId2))));
}
public static function Hash(_arg1:uint, _arg2:uint):uint{
var _local3:uint;
_local3 = (((_arg2 << 16) & 4294901760) | _arg1);
_local3 = (~(_local3) + ((_local3 << 15) & 4294934528));
_local3 = (_local3 ^ ((_local3 >> 12) & 1048575));
_local3 = (_local3 + ((_local3 << 2) & 4294967292));
_local3 = (_local3 ^ ((_local3 >> 4) & 268435455));
_local3 = (_local3 * 2057);
_local3 = (_local3 ^ ((_local3 >> 16) & 0xFFFF));
return (_local3);
}
public static function Equals(_arg1:b2Pair, _arg2:uint, _arg3:uint):Boolean{
return ((((_arg1.proxyId1 == _arg2)) && ((_arg1.proxyId2 == _arg3))));
}
}
}//package Box2D.Collision
Section 24
//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(_arg1:b2XForm):b2Vec2{
return (p);
}
public function Support(_arg1:b2XForm, _arg2:Number, _arg3:Number):b2Vec2{
return (p);
}
}
}//package Box2D.Collision
Section 25
//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(_arg1:uint):void{
lowerBounds[0] = (_arg1 & 0xFFFF);
}
}
}//package Box2D.Collision
Section 26
//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(_arg1:Array, _arg2:b2Vec2, _arg3:b2Segment, _arg4:Number):Boolean{
var _local5:b2Vec2;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
_local5 = _arg3.p1;
_local6 = (_arg3.p2.x - _local5.x);
_local7 = (_arg3.p2.y - _local5.y);
_local8 = (p2.x - p1.x);
_local9 = (p2.y - p1.y);
_local10 = _local9;
_local11 = -(_local8);
_local12 = (100 * Number.MIN_VALUE);
_local13 = -(((_local6 * _local10) + (_local7 * _local11)));
if (_local13 > _local12){
_local14 = (_local5.x - p1.x);
_local15 = (_local5.y - p1.y);
_local16 = ((_local14 * _local10) + (_local15 * _local11));
if ((((0 <= _local16)) && ((_local16 <= (_arg4 * _local13))))){
_local17 = ((-(_local7) * _local15) + (_local7 * _local14));
if (((((-(_local12) * _local13) <= _local17)) && ((_local17 <= (_local13 * (1 + _local12)))))){
_local16 = (_local16 / _local13);
_local18 = Math.sqrt(((_local10 * _local10) + (_local11 * _local11)));
_local10 = (_local10 / _local18);
_local11 = (_local11 / _local18);
_arg1[0] = _local16;
_arg2.Set(_local10, _local11);
return (true);
};
};
};
return (false);
}
}
}//package Box2D.Collision
Section 27
//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 static function TimeOfImpact(_arg1:b2Shape, _arg2:b2Sweep, _arg3:b2Shape, _arg4:b2Sweep):Number{
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:b2Vec2;
var _local18:b2Vec2;
var _local19:int;
var _local20:int;
var _local21:Number;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:Number;
var _local26:b2XForm;
var _local27:b2XForm;
var _local28:Number;
var _local29:Number;
var _local30:Number;
var _local31:Number;
_local7 = _arg1.m_sweepRadius;
_local8 = _arg3.m_sweepRadius;
_local9 = _arg2.t0;
_local10 = (_arg2.c.x - _arg2.c0.x);
_local11 = (_arg2.c.y - _arg2.c0.y);
_local12 = (_arg4.c.x - _arg4.c0.x);
_local13 = (_arg4.c.y - _arg4.c0.y);
_local14 = (_arg2.a - _arg2.a0);
_local15 = (_arg4.a - _arg4.a0);
_local16 = 0;
_local17 = s_p1;
_local18 = s_p2;
_local19 = 20;
_local20 = 0;
_local21 = 0;
_local22 = 0;
_local23 = 0;
_local24 = 0;
while (true) {
_local25 = (((1 - _local16) * _local9) + _local16);
_local26 = s_xf1;
_local27 = s_xf2;
_arg2.GetXForm(_local26, _local25);
_arg4.GetXForm(_local27, _local25);
_local23 = b2Distance.Distance(_local17, _local18, _arg1, _local26, _arg3, _local27);
if (_local20 == 0){
if (_local23 > (2 * b2Settings.b2_toiSlop)){
_local24 = (1.5 * b2Settings.b2_toiSlop);
} else {
_local5 = (0.05 * b2Settings.b2_toiSlop);
_local6 = (_local23 - (0.5 * b2Settings.b2_toiSlop));
_local24 = ((_local5 > _local6)) ? _local5 : _local6;
};
};
if (((((_local23 - _local24) < (0.05 * b2Settings.b2_toiSlop))) || ((_local20 == _local19)))){
break;
};
_local21 = (_local18.x - _local17.x);
_local22 = (_local18.y - _local17.y);
_local28 = Math.sqrt(((_local21 * _local21) + (_local22 * _local22)));
_local21 = (_local21 / _local28);
_local22 = (_local22 / _local28);
_local29 = ((((_local21 * (_local10 - _local12)) + (_local22 * (_local11 - _local13))) + (((_local14 < 0)) ? -(_local14) : _local14 * _local7)) + (((_local15 < 0)) ? -(_local15) : _local15 * _local8));
if (_local29 == 0){
_local16 = 1;
break;
};
_local30 = ((_local23 - _local24) / _local29);
_local31 = (_local16 + _local30);
if ((((_local31 < 0)) || ((1 < _local31)))){
_local16 = 1;
break;
};
if (_local31 < ((1 + (100 * Number.MIN_VALUE)) * _local16)){
break;
};
_local16 = _local31;
_local20++;
};
return (_local16);
}
}
}//package Box2D.Collision
Section 28
//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 29
//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 get referenceEdge():int{
return (_referenceEdge);
}
public function set incidentVertex(_arg1:int):void{
_incidentVertex = _arg1;
_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(_arg1:int):void{
_referenceEdge = _arg1;
_m_id._key = ((_m_id._key & 4294967040) | (_referenceEdge & 0xFF));
}
public function set flip(_arg1:int):void{
_flip = _arg1;
_m_id._key = ((_m_id._key & 0xFFFFFF) | ((_flip << 24) & 4278190080));
}
public function get incidentVertex():int{
return (_incidentVertex);
}
public function set incidentEdge(_arg1:int):void{
_incidentEdge = _arg1;
_m_id._key = ((_m_id._key & 4294902015) | ((_incidentEdge << 8) & 0xFF00));
}
}
}//package Box2D.Collision
Section 30
//b2Mat22 (Box2D.Common.Math.b2Mat22)
package Box2D.Common.Math {
public class b2Mat22 {
public var col1:b2Vec2;
public var col2:b2Vec2;
public function b2Mat22(_arg1:Number=0, _arg2:b2Vec2=null, _arg3:b2Vec2=null){
var _local4:Number;
var _local5:Number;
col1 = new b2Vec2();
col2 = new b2Vec2();
super();
if (((!((_arg2 == null))) && (!((_arg3 == null))))){
col1.SetV(_arg2);
col2.SetV(_arg3);
} else {
_local4 = Math.cos(_arg1);
_local5 = Math.sin(_arg1);
col1.x = _local4;
col2.x = -(_local5);
col1.y = _local5;
col2.y = _local4;
};
}
public function SetIdentity():void{
col1.x = 1;
col2.x = 0;
col1.y = 0;
col2.y = 1;
}
public function Set(_arg1:Number):void{
var _local2:Number;
var _local3:Number;
_local2 = Math.cos(_arg1);
_local3 = Math.sin(_arg1);
col1.x = _local2;
col2.x = -(_local3);
col1.y = _local3;
col2.y = _local2;
}
public function SetVV(_arg1:b2Vec2, _arg2:b2Vec2):void{
col1.SetV(_arg1);
col2.SetV(_arg2);
}
public function SetZero():void{
col1.x = 0;
col2.x = 0;
col1.y = 0;
col2.y = 0;
}
public function SetM(_arg1:b2Mat22):void{
col1.SetV(_arg1.col1);
col2.SetV(_arg1.col2);
}
public function AddM(_arg1:b2Mat22):void{
col1.x = (col1.x + _arg1.col1.x);
col1.y = (col1.y + _arg1.col1.y);
col2.x = (col2.x + _arg1.col2.x);
col2.y = (col2.y + _arg1.col2.y);
}
public function Abs():void{
col1.Abs();
col2.Abs();
}
public function Copy():b2Mat22{
return (new b2Mat22(0, col1, col2));
}
public function Invert(_arg1:b2Mat22):b2Mat22{
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
_local2 = col1.x;
_local3 = col2.x;
_local4 = col1.y;
_local5 = col2.y;
_local6 = ((_local2 * _local5) - (_local3 * _local4));
_local6 = (1 / _local6);
_arg1.col1.x = (_local6 * _local5);
_arg1.col2.x = (-(_local6) * _local3);
_arg1.col1.y = (-(_local6) * _local4);
_arg1.col2.y = (_local6 * _local2);
return (_arg1);
}
public function GetAngle():Number{
return (Math.atan2(col1.y, col1.x));
}
public function Solve(_arg1:b2Vec2, _arg2:Number, _arg3:Number):b2Vec2{
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
_local4 = col1.x;
_local5 = col2.x;
_local6 = col1.y;
_local7 = col2.y;
_local8 = ((_local4 * _local7) - (_local5 * _local6));
_local8 = (1 / _local8);
_arg1.x = (_local8 * ((_local7 * _arg2) - (_local5 * _arg3)));
_arg1.y = (_local8 * ((_local4 * _arg3) - (_local6 * _arg2)));
return (_arg1);
}
}
}//package Box2D.Common.Math
Section 31
//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 static function b2CrossVF(_arg1:b2Vec2, _arg2:Number):b2Vec2{
var _local3:b2Vec2;
_local3 = new b2Vec2((_arg2 * _arg1.y), (-(_arg2) * _arg1.x));
return (_local3);
}
public static function AddVV(_arg1:b2Vec2, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2;
_local3 = new b2Vec2((_arg1.x + _arg2.x), (_arg1.y + _arg2.y));
return (_local3);
}
public static function b2IsValid(_arg1:Number):Boolean{
return (isFinite(_arg1));
}
public static function b2MinV(_arg1:b2Vec2, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2;
_local3 = new b2Vec2(b2Min(_arg1.x, _arg2.x), b2Min(_arg1.y, _arg2.y));
return (_local3);
}
public static function b2MulX(_arg1:b2XForm, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2;
_local3 = b2MulMV(_arg1.R, _arg2);
_local3.x = (_local3.x + _arg1.position.x);
_local3.y = (_local3.y + _arg1.position.y);
return (_local3);
}
public static function b2DistanceSquared(_arg1:b2Vec2, _arg2:b2Vec2):Number{
var _local3:Number;
var _local4:Number;
_local3 = (_arg1.x - _arg2.x);
_local4 = (_arg1.y - _arg2.y);
return (((_local3 * _local3) + (_local4 * _local4)));
}
public static function b2Swap(_arg1:Array, _arg2:Array):void{
var _local3:*;
_local3 = _arg1[0];
_arg1[0] = _arg2[0];
_arg2[0] = _local3;
}
public static function b2AbsM(_arg1:b2Mat22):b2Mat22{
var _local2:b2Mat22;
_local2 = new b2Mat22(0, b2AbsV(_arg1.col1), b2AbsV(_arg1.col2));
return (_local2);
}
public static function SubtractVV(_arg1:b2Vec2, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2;
_local3 = new b2Vec2((_arg1.x - _arg2.x), (_arg1.y - _arg2.y));
return (_local3);
}
public static function b2MulXT(_arg1:b2XForm, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2;
var _local4:Number;
_local3 = SubtractVV(_arg2, _arg1.position);
_local4 = ((_local3.x * _arg1.R.col1.x) + (_local3.y * _arg1.R.col1.y));
_local3.y = ((_local3.x * _arg1.R.col2.x) + (_local3.y * _arg1.R.col2.y));
_local3.x = _local4;
return (_local3);
}
public static function b2Abs(_arg1:Number):Number{
return (((_arg1 > 0)) ? _arg1 : -(_arg1));
}
public static function b2Clamp(_arg1:Number, _arg2:Number, _arg3:Number):Number{
return (b2Max(_arg2, b2Min(_arg1, _arg3)));
}
public static function b2AbsV(_arg1:b2Vec2):b2Vec2{
var _local2:b2Vec2;
_local2 = new b2Vec2(b2Abs(_arg1.x), b2Abs(_arg1.y));
return (_local2);
}
public static function MulFV(_arg1:Number, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2;
_local3 = new b2Vec2((_arg1 * _arg2.x), (_arg1 * _arg2.y));
return (_local3);
}
public static function b2CrossVV(_arg1:b2Vec2, _arg2:b2Vec2):Number{
return (((_arg1.x * _arg2.y) - (_arg1.y * _arg2.x)));
}
public static function b2Dot(_arg1:b2Vec2, _arg2:b2Vec2):Number{
return (((_arg1.x * _arg2.x) + (_arg1.y * _arg2.y)));
}
public static function b2CrossFV(_arg1:Number, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2;
_local3 = new b2Vec2((-(_arg1) * _arg2.y), (_arg1 * _arg2.x));
return (_local3);
}
public static function AddMM(_arg1:b2Mat22, _arg2:b2Mat22):b2Mat22{
var _local3:b2Mat22;
_local3 = new b2Mat22(0, AddVV(_arg1.col1, _arg2.col1), AddVV(_arg1.col2, _arg2.col2));
return (_local3);
}
public static function b2Distance(_arg1:b2Vec2, _arg2:b2Vec2):Number{
var _local3:Number;
var _local4:Number;
_local3 = (_arg1.x - _arg2.x);
_local4 = (_arg1.y - _arg2.y);
return (Math.sqrt(((_local3 * _local3) + (_local4 * _local4))));
}
public static function b2MulTMM(_arg1:b2Mat22, _arg2:b2Mat22):b2Mat22{
var _local3:b2Vec2;
var _local4:b2Vec2;
var _local5:b2Mat22;
_local3 = new b2Vec2(b2Dot(_arg1.col1, _arg2.col1), b2Dot(_arg1.col2, _arg2.col1));
_local4 = new b2Vec2(b2Dot(_arg1.col1, _arg2.col2), b2Dot(_arg1.col2, _arg2.col2));
_local5 = new b2Mat22(0, _local3, _local4);
return (_local5);
}
public static function b2MaxV(_arg1:b2Vec2, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2;
_local3 = new b2Vec2(b2Max(_arg1.x, _arg2.x), b2Max(_arg1.y, _arg2.y));
return (_local3);
}
public static function b2IsPowerOfTwo(_arg1:uint):Boolean{
var _local2:Boolean;
_local2 = (((_arg1 > 0)) && (((_arg1 & (_arg1 - 1)) == 0)));
return (_local2);
}
public static function b2ClampV(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:b2Vec2):b2Vec2{
return (b2MaxV(_arg2, b2MinV(_arg1, _arg3)));
}
public static function b2RandomRange(_arg1:Number, _arg2:Number):Number{
var _local3:Number;
_local3 = Math.random();
_local3 = (((_arg2 - _arg1) * _local3) + _arg1);
return (_local3);
}
public static function b2MulTMV(_arg1:b2Mat22, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2;
_local3 = new b2Vec2(b2Dot(_arg2, _arg1.col1), b2Dot(_arg2, _arg1.col2));
return (_local3);
}
public static function b2Min(_arg1:Number, _arg2:Number):Number{
return (((_arg1 < _arg2)) ? _arg1 : _arg2);
}
public static function b2Random():Number{
return (((Math.random() * 2) - 1));
}
public static function b2MulMM(_arg1:b2Mat22, _arg2:b2Mat22):b2Mat22{
var _local3:b2Mat22;
_local3 = new b2Mat22(0, b2MulMV(_arg1, _arg2.col1), b2MulMV(_arg1, _arg2.col2));
return (_local3);
}
public static function b2NextPowerOfTwo(_arg1:uint):uint{
_arg1 = (_arg1 | ((_arg1 >> 1) & 2147483647));
_arg1 = (_arg1 | ((_arg1 >> 2) & 1073741823));
_arg1 = (_arg1 | ((_arg1 >> 4) & 268435455));
_arg1 = (_arg1 | ((_arg1 >> 8) & 0xFFFFFF));
_arg1 = (_arg1 | ((_arg1 >> 16) & 0xFFFF));
return ((_arg1 + 1));
}
public static function b2Max(_arg1:Number, _arg2:Number):Number{
return (((_arg1 > _arg2)) ? _arg1 : _arg2);
}
public static function b2MulMV(_arg1:b2Mat22, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2;
_local3 = new b2Vec2(((_arg1.col1.x * _arg2.x) + (_arg1.col2.x * _arg2.y)), ((_arg1.col1.y * _arg2.x) + (_arg1.col2.y * _arg2.y)));
return (_local3);
}
}
}//package Box2D.Common.Math
Section 32
//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(_arg1:Number):void{
var _local2:Number;
if ((((t0 < _arg1)) && (((1 - t0) > Number.MIN_VALUE)))){
_local2 = ((_arg1 - t0) / (1 - t0));
c0.x = (((1 - _local2) * c0.x) + (_local2 * c.x));
c0.y = (((1 - _local2) * c0.y) + (_local2 * c.y));
a0 = (((1 - _local2) * a0) + (_local2 * a));
t0 = _arg1;
};
}
public function GetXForm(_arg1:b2XForm, _arg2:Number):void{
var _local3:b2Mat22;
var _local4:Number;
var _local5:Number;
if ((1 - t0) > Number.MIN_VALUE){
_local4 = ((_arg2 - t0) / (1 - t0));
_arg1.position.x = (((1 - _local4) * c0.x) + (_local4 * c.x));
_arg1.position.y = (((1 - _local4) * c0.y) + (_local4 * c.y));
_local5 = (((1 - _local4) * a0) + (_local4 * a));
_arg1.R.Set(_local5);
} else {
_arg1.position.SetV(c);
_arg1.R.Set(a);
};
_local3 = _arg1.R;
_arg1.position.x = (_arg1.position.x - ((_local3.col1.x * localCenter.x) + (_local3.col2.x * localCenter.y)));
_arg1.position.y = (_arg1.position.y - ((_local3.col1.y * localCenter.x) + (_local3.col2.y * localCenter.y)));
}
}
}//package Box2D.Common.Math
Section 33
//b2Vec2 (Box2D.Common.Math.b2Vec2)
package Box2D.Common.Math {
public class b2Vec2 {
public var x:Number;
public var y:Number;
public function b2Vec2(_arg1:Number=0, _arg2:Number=0):void{
x = _arg1;
y = _arg2;
}
public function Set(_arg1:Number=0, _arg2:Number=0):void{
x = _arg1;
y = _arg2;
}
public function Multiply(_arg1:Number):void{
x = (x * _arg1);
y = (y * _arg1);
}
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(_arg1:b2Vec2):void{
x = (x + _arg1.x);
y = (y + _arg1.y);
}
public function MaxV(_arg1:b2Vec2):void{
x = ((x > _arg1.x)) ? x : _arg1.x;
y = ((y > _arg1.y)) ? y : _arg1.y;
}
public function SetV(_arg1:b2Vec2):void{
x = _arg1.x;
y = _arg1.y;
}
public function Negative():b2Vec2{
return (new b2Vec2(-(x), -(y)));
}
public function CrossVF(_arg1:Number):void{
var _local2:Number;
_local2 = x;
x = (_arg1 * y);
y = (-(_arg1) * _local2);
}
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(_arg1:b2Mat22):void{
var _local2:Number;
_local2 = b2Math.b2Dot(this, _arg1.col1);
y = b2Math.b2Dot(this, _arg1.col2);
x = _local2;
}
public function IsValid():Boolean{
return (((b2Math.b2IsValid(x)) && (b2Math.b2IsValid(y))));
}
public function MinV(_arg1:b2Vec2):void{
x = ((x < _arg1.x)) ? x : _arg1.x;
y = ((y < _arg1.y)) ? y : _arg1.y;
}
public function MulM(_arg1:b2Mat22):void{
var _local2:Number;
_local2 = x;
x = ((_arg1.col1.x * _local2) + (_arg1.col2.x * y));
y = ((_arg1.col1.y * _local2) + (_arg1.col2.y * y));
}
public function Normalize():Number{
var _local1:Number;
var _local2:Number;
_local1 = Math.sqrt(((x * x) + (y * y)));
if (_local1 < Number.MIN_VALUE){
return (0);
};
_local2 = (1 / _local1);
x = (x * _local2);
y = (y * _local2);
return (_local1);
}
public function Subtract(_arg1:b2Vec2):void{
x = (x - _arg1.x);
y = (y - _arg1.y);
}
public function CrossFV(_arg1:Number):void{
var _local2:Number;
_local2 = x;
x = (-(_arg1) * y);
y = (_arg1 * _local2);
}
public static function Make(_arg1:Number, _arg2:Number):b2Vec2{
return (new b2Vec2(_arg1, _arg2));
}
}
}//package Box2D.Common.Math
Section 34
//b2XForm (Box2D.Common.Math.b2XForm)
package Box2D.Common.Math {
public class b2XForm {
public var R:b2Mat22;
public var position:b2Vec2;
public function b2XForm(_arg1:b2Vec2=null, _arg2:b2Mat22=null):void{
position = new b2Vec2();
R = new b2Mat22();
super();
if (_arg1){
position.SetV(_arg1);
R.SetM(_arg2);
};
}
public function Initialize(_arg1:b2Vec2, _arg2:b2Mat22):void{
position.SetV(_arg1);
R.SetM(_arg2);
}
public function Set(_arg1:b2XForm):void{
position.SetV(_arg1.position);
R.SetM(_arg1.R);
}
public function SetIdentity():void{
position.SetZero();
R.SetIdentity();
}
}
}//package Box2D.Common.Math
Section 35
//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(_arg1:Number, _arg2:Number, _arg3:Number){
_r = 0;
_g = 0;
_b = 0;
super();
_r = uint((0xFF * b2Math.b2Clamp(_arg1, 0, 1)));
_g = uint((0xFF * b2Math.b2Clamp(_arg2, 0, 1)));
_b = uint((0xFF * b2Math.b2Clamp(_arg3, 0, 1)));
}
public function Set(_arg1:Number, _arg2:Number, _arg3:Number):void{
_r = uint((0xFF * b2Math.b2Clamp(_arg1, 0, 1)));
_g = uint((0xFF * b2Math.b2Clamp(_arg2, 0, 1)));
_b = uint((0xFF * b2Math.b2Clamp(_arg3, 0, 1)));
}
public function get color():uint{
return (((_r | (_g << 8)) | (_b << 16)));
}
public function set r(_arg1:Number):void{
_r = uint((0xFF * b2Math.b2Clamp(_arg1, 0, 1)));
}
public function set b(_arg1:Number):void{
_b = uint((0xFF * b2Math.b2Clamp(_arg1, 0, 1)));
}
public function set g(_arg1:Number):void{
_g = uint((0xFF * b2Math.b2Clamp(_arg1, 0, 1)));
}
}
}//package Box2D.Common
Section 36
//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 static function b2Assert(_arg1:Boolean):void{
var _local2:b2Vec2;
if (!_arg1){
_local2.x++;
};
}
}
}//package Box2D.Common
Section 37
//b2CircleContact (Box2D.Dynamics.Contacts.b2CircleContact)
package Box2D.Dynamics.Contacts {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Collision.Shapes.*;
import Box2D.Collision.*;
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(_arg1:b2Shape, _arg2:b2Shape){
var _local3:b2ManifoldPoint;
m_manifolds = [new b2Manifold()];
m0 = new b2Manifold();
super(_arg1, _arg2);
m_manifold = m_manifolds[0];
m_manifold.pointCount = 0;
_local3 = m_manifold.points[0];
_local3.normalImpulse = 0;
_local3.tangentImpulse = 0;
}
override public function GetManifolds():Array{
return (m_manifolds);
}
override public function Evaluate(_arg1:b2ContactListener):void{
var _local2:b2Vec2;
var _local3:b2Vec2;
var _local4:b2ManifoldPoint;
var _local5:b2Body;
var _local6:b2Body;
var _local7:b2ContactPoint;
var _local8:b2ManifoldPoint;
_local5 = m_shape1.m_body;
_local6 = m_shape2.m_body;
m0.Set(m_manifold);
b2Collision.b2CollideCircles(m_manifold, (m_shape1 as b2CircleShape), _local5.m_xf, (m_shape2 as b2CircleShape), _local6.m_xf);
_local7 = s_evalCP;
_local7.shape1 = m_shape1;
_local7.shape2 = m_shape2;
_local7.friction = m_friction;
_local7.restitution = m_restitution;
if (m_manifold.pointCount > 0){
m_manifoldCount = 1;
_local8 = m_manifold.points[0];
if (m0.pointCount == 0){
_local8.normalImpulse = 0;
_local8.tangentImpulse = 0;
if (_arg1){
_local7.position = _local5.GetWorldPoint(_local8.localPoint1);
_local2 = _local5.GetLinearVelocityFromLocalPoint(_local8.localPoint1);
_local3 = _local6.GetLinearVelocityFromLocalPoint(_local8.localPoint2);
_local7.velocity.Set((_local3.x - _local2.x), (_local3.y - _local2.y));
_local7.normal.SetV(m_manifold.normal);
_local7.separation = _local8.separation;
_local7.id.key = _local8.id._key;
_arg1.Add(_local7);
};
} else {
_local4 = m0.points[0];
_local8.normalImpulse = _local4.normalImpulse;
_local8.tangentImpulse = _local4.tangentImpulse;
if (_arg1){
_local7.position = _local5.GetWorldPoint(_local8.localPoint1);
_local2 = _local5.GetLinearVelocityFromLocalPoint(_local8.localPoint1);
_local3 = _local6.GetLinearVelocityFromLocalPoint(_local8.localPoint2);
_local7.velocity.Set((_local3.x - _local2.x), (_local3.y - _local2.y));
_local7.normal.SetV(m_manifold.normal);
_local7.separation = _local8.separation;
_local7.id.key = _local8.id._key;
_arg1.Persist(_local7);
};
};
} else {
m_manifoldCount = 0;
if ((((m0.pointCount > 0)) && (_arg1))){
_local4 = m0.points[0];
_local7.position = _local5.GetWorldPoint(_local4.localPoint1);
_local2 = _local5.GetLinearVelocityFromLocalPoint(_local4.localPoint1);
_local3 = _local6.GetLinearVelocityFromLocalPoint(_local4.localPoint2);
_local7.velocity.Set((_local3.x - _local2.x), (_local3.y - _local2.y));
_local7.normal.SetV(m0.normal);
_local7.separation = _local4.separation;
_local7.id.key = _local4.id._key;
_arg1.Remove(_local7);
};
};
}
public static function Destroy(_arg1:b2Contact, _arg2):void{
}
public static function Create(_arg1:b2Shape, _arg2:b2Shape, _arg3):b2Contact{
return (new b2CircleContact(_arg1, _arg2));
}
}
}//package Box2D.Dynamics.Contacts
Section 38
//b2Contact (Box2D.Dynamics.Contacts.b2Contact)
package Box2D.Dynamics.Contacts {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Collision.Shapes.*;
import Box2D.Collision.*;
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(_arg1:b2Shape=null, _arg2:b2Shape=null){
m_node1 = new b2ContactEdge();
m_node2 = new b2ContactEdge();
super();
m_flags = 0;
if (((!(_arg1)) || (!(_arg2)))){
m_shape1 = null;
m_shape2 = null;
return;
};
if (((_arg1.IsSensor()) || (_arg2.IsSensor()))){
m_flags = (m_flags | e_nonSolidFlag);
};
m_shape1 = _arg1;
m_shape2 = _arg2;
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(_arg1:b2ContactListener):void{
var _local2:int;
var _local3:int;
var _local4:b2Body;
var _local5:b2Body;
_local2 = m_manifoldCount;
Evaluate(_arg1);
_local3 = m_manifoldCount;
_local4 = m_shape1.m_body;
_local5 = m_shape2.m_body;
if ((((_local3 == 0)) && ((_local2 > 0)))){
_local4.WakeUp();
_local5.WakeUp();
};
if (((((((_local4.IsStatic()) || (_local4.IsBullet()))) || (_local5.IsStatic()))) || (_local5.IsBullet()))){
m_flags = (m_flags & ~(e_slowFlag));
} else {
m_flags = (m_flags | e_slowFlag);
};
}
public function Evaluate(_arg1:b2ContactListener):void{
}
public static function InitializeRegisters():void{
var _local1:int;
var _local2:int;
s_registers = new Array(b2Shape.e_shapeTypeCount);
_local1 = 0;
while (_local1 < b2Shape.e_shapeTypeCount) {
s_registers[_local1] = new Array(b2Shape.e_shapeTypeCount);
_local2 = 0;
while (_local2 < b2Shape.e_shapeTypeCount) {
s_registers[_local1][_local2] = new b2ContactRegister();
_local2++;
};
_local1++;
};
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(_arg1:b2Contact, _arg2):void{
var _local3:int;
var _local4:int;
var _local5:b2ContactRegister;
var _local6:Function;
if (_arg1.m_manifoldCount > 0){
_arg1.m_shape1.m_body.WakeUp();
_arg1.m_shape2.m_body.WakeUp();
};
_local3 = _arg1.m_shape1.m_type;
_local4 = _arg1.m_shape2.m_type;
_local5 = s_registers[_local3][_local4];
_local6 = _local5.destroyFcn;
_local6(_arg1, _arg2);
}
public static function AddType(_arg1:Function, _arg2:Function, _arg3:int, _arg4:int):void{
s_registers[_arg3][_arg4].createFcn = _arg1;
s_registers[_arg3][_arg4].destroyFcn = _arg2;
s_registers[_arg3][_arg4].primary = true;
if (_arg3 != _arg4){
s_registers[_arg4][_arg3].createFcn = _arg1;
s_registers[_arg4][_arg3].destroyFcn = _arg2;
s_registers[_arg4][_arg3].primary = false;
};
}
public static function Create(_arg1:b2Shape, _arg2:b2Shape, _arg3):b2Contact{
var _local4:int;
var _local5:int;
var _local6:b2ContactRegister;
var _local7:Function;
var _local8:b2Contact;
var _local9:int;
var _local10:b2Manifold;
if (s_initialized == false){
InitializeRegisters();
s_initialized = true;
};
_local4 = _arg1.m_type;
_local5 = _arg2.m_type;
_local6 = s_registers[_local4][_local5];
_local7 = _local6.createFcn;
if (_local7 != null){
if (_local6.primary){
return (_local7(_arg1, _arg2, _arg3));
};
_local8 = _local7(_arg2, _arg1, _arg3);
_local9 = 0;
while (_local9 < _local8.m_manifoldCount) {
_local10 = _local8.GetManifolds()[_local9];
_local8.GetManifolds()[_local9].normal = _local10.normal.Negative();
_local9++;
};
return (_local8);
//unresolved jump
};
return (null);
}
}
}//package Box2D.Dynamics.Contacts
Section 39
//b2ContactConstraint (Box2D.Dynamics.Contacts.b2ContactConstraint)
package Box2D.Dynamics.Contacts {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
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 _local1:int;
normal = new b2Vec2();
super();
points = new Array(b2Settings.b2_maxManifoldPoints);
_local1 = 0;
while (_local1 < b2Settings.b2_maxManifoldPoints) {
points[_local1] = new b2ContactConstraintPoint();
_local1++;
};
}
}
}//package Box2D.Dynamics.Contacts
Section 40
//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 41
//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;
}
}//package Box2D.Dynamics.Contacts
Section 42
//b2ContactRegister (Box2D.Dynamics.Contacts.b2ContactRegister)
package Box2D.Dynamics.Contacts {
public class b2ContactRegister {
public var primary:Boolean;
public var createFcn:Function;
public var destroyFcn:Function;
}
}//package Box2D.Dynamics.Contacts
Section 43
//b2ContactResult (Box2D.Dynamics.Contacts.b2ContactResult)
package Box2D.Dynamics.Contacts {
import Box2D.Common.Math.*;
import Box2D.Collision.Shapes.*;
import Box2D.Collision.*;
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 44
//b2ContactSolver (Box2D.Dynamics.Contacts.b2ContactSolver)
package Box2D.Dynamics.Contacts {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
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(_arg1:b2TimeStep, _arg2:Array, _arg3:int, _arg4){
var _local5:b2Contact;
var _local6:int;
var _local7:b2Vec2;
var _local8:b2Mat22;
var _local9:int;
var _local10:b2Body;
var _local11:b2Body;
var _local12:int;
var _local13:Array;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:int;
var _local23:b2Manifold;
var _local24:Number;
var _local25:Number;
var _local26:b2ContactConstraint;
var _local27:uint;
var _local28:b2ManifoldPoint;
var _local29:b2ContactConstraintPoint;
var _local30:Number;
var _local31:Number;
var _local32:Number;
var _local33:Number;
var _local34:Number;
var _local35:Number;
var _local36:Number;
var _local37:Number;
var _local38:Number;
var _local39:Number;
var _local40:Number;
var _local41:Number;
var _local42:Number;
var _local43:Number;
var _local44:Number;
var _local45:Number;
var _local46:Number;
var _local47:Number;
m_step = new b2TimeStep();
m_constraints = new Array();
super();
m_step.dt = _arg1.dt;
m_step.inv_dt = _arg1.inv_dt;
m_step.maxIterations = _arg1.maxIterations;
m_allocator = _arg4;
m_constraintCount = 0;
_local6 = 0;
while (_local6 < _arg3) {
_local5 = _arg2[_local6];
m_constraintCount = (m_constraintCount + _local5.m_manifoldCount);
_local6++;
};
_local6 = 0;
while (_local6 < m_constraintCount) {
m_constraints[_local6] = new b2ContactConstraint();
_local6++;
};
_local9 = 0;
_local6 = 0;
while (_local6 < _arg3) {
_local5 = _arg2[_local6];
_local10 = _local5.m_shape1.m_body;
_local11 = _local5.m_shape2.m_body;
_local12 = _local5.m_manifoldCount;
_local13 = _local5.GetManifolds();
_local14 = _local5.m_friction;
_local15 = _local5.m_restitution;
_local16 = _local10.m_linearVelocity.x;
_local17 = _local10.m_linearVelocity.y;
_local18 = _local11.m_linearVelocity.x;
_local19 = _local11.m_linearVelocity.y;
_local20 = _local10.m_angularVelocity;
_local21 = _local11.m_angularVelocity;
_local22 = 0;
while (_local22 < _local12) {
_local23 = _local13[_local22];
_local24 = _local23.normal.x;
_local25 = _local23.normal.y;
_local26 = m_constraints[_local9];
_local26.body1 = _local10;
_local26.body2 = _local11;
_local26.manifold = _local23;
_local26.normal.x = _local24;
_local26.normal.y = _local25;
_local26.pointCount = _local23.pointCount;
_local26.friction = _local14;
_local26.restitution = _local15;
_local27 = 0;
while (_local27 < _local26.pointCount) {
_local28 = _local23.points[_local27];
_local29 = _local26.points[_local27];
_local29.normalImpulse = _local28.normalImpulse;
_local29.tangentImpulse = _local28.tangentImpulse;
_local29.separation = _local28.separation;
_local29.positionImpulse = 0;
_local29.localAnchor1.SetV(_local28.localPoint1);
_local29.localAnchor2.SetV(_local28.localPoint2);
_local8 = _local10.m_xf.R;
_local32 = (_local28.localPoint1.x - _local10.m_sweep.localCenter.x);
_local33 = (_local28.localPoint1.y - _local10.m_sweep.localCenter.y);
_local30 = ((_local8.col1.x * _local32) + (_local8.col2.x * _local33));
_local33 = ((_local8.col1.y * _local32) + (_local8.col2.y * _local33));
_local32 = _local30;
_local29.r1.Set(_local32, _local33);
_local8 = _local11.m_xf.R;
_local34 = (_local28.localPoint2.x - _local11.m_sweep.localCenter.x);
_local35 = (_local28.localPoint2.y - _local11.m_sweep.localCenter.y);
_local30 = ((_local8.col1.x * _local34) + (_local8.col2.x * _local35));
_local35 = ((_local8.col1.y * _local34) + (_local8.col2.y * _local35));
_local34 = _local30;
_local29.r2.Set(_local34, _local35);
_local36 = ((_local32 * _local32) + (_local33 * _local33));
_local37 = ((_local34 * _local34) + (_local35 * _local35));
_local38 = ((_local32 * _local24) + (_local33 * _local25));
_local39 = ((_local34 * _local24) + (_local35 * _local25));
_local40 = (_local10.m_invMass + _local11.m_invMass);
_local40 = (_local40 + ((_local10.m_invI * (_local36 - (_local38 * _local38))) + (_local11.m_invI * (_local37 - (_local39 * _local39)))));
_local29.normalMass = (1 / _local40);
_local41 = ((_local10.m_mass * _local10.m_invMass) + (_local11.m_mass * _local11.m_invMass));
_local41 = (_local41 + (((_local10.m_mass * _local10.m_invI) * (_local36 - (_local38 * _local38))) + ((_local11.m_mass * _local11.m_invI) * (_local37 - (_local39 * _local39)))));
_local29.equalizedMass = (1 / _local41);
_local42 = _local25;
_local43 = -(_local24);
_local44 = ((_local32 * _local42) + (_local33 * _local43));
_local45 = ((_local34 * _local42) + (_local35 * _local43));
_local46 = (_local10.m_invMass + _local11.m_invMass);
_local46 = (_local46 + ((_local10.m_invI * (_local36 - (_local44 * _local44))) + (_local11.m_invI * (_local37 - (_local45 * _local45)))));
_local29.tangentMass = (1 / _local46);
_local29.velocityBias = 0;
if (_local29.separation > 0){
_local29.velocityBias = (-60 * _local29.separation);
};
_local30 = (((_local18 + (-(_local21) * _local35)) - _local16) - (-(_local20) * _local33));
_local31 = (((_local19 + (_local21 * _local34)) - _local17) - (_local20 * _local32));
_local47 = ((_local26.normal.x * _local30) + (_local26.normal.y * _local31));
if (_local47 < -(b2Settings.b2_velocityThreshold)){
_local29.velocityBias = (_local29.velocityBias + (-(_local26.restitution) * _local47));
};
_local27++;
};
_local9++;
_local22++;
};
_local6++;
};
}
public function InitVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Vec2;
var _local3:b2Vec2;
var _local4:b2Mat22;
var _local5:int;
var _local6:b2ContactConstraint;
var _local7:b2Body;
var _local8:b2Body;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:int;
var _local19:int;
var _local20:b2ContactConstraintPoint;
var _local21:Number;
var _local22:Number;
var _local23:b2ContactConstraintPoint;
_local5 = 0;
while (_local5 < m_constraintCount) {
_local6 = m_constraints[_local5];
_local7 = _local6.body1;
_local8 = _local6.body2;
_local9 = _local7.m_invMass;
_local10 = _local7.m_invI;
_local11 = _local8.m_invMass;
_local12 = _local8.m_invI;
_local13 = _local6.normal.x;
_local14 = _local6.normal.y;
_local15 = _local14;
_local16 = -(_local13);
if (_arg1.warmStarting){
_local19 = _local6.pointCount;
_local18 = 0;
while (_local18 < _local19) {
_local20 = _local6.points[_local18];
_local6.points[_local18].normalImpulse = (_local20.normalImpulse * _arg1.dtRatio);
_local20.tangentImpulse = (_local20.tangentImpulse * _arg1.dtRatio);
_local21 = ((_local20.normalImpulse * _local13) + (_local20.tangentImpulse * _local15));
_local22 = ((_local20.normalImpulse * _local14) + (_local20.tangentImpulse * _local16));
_local7.m_angularVelocity = (_local7.m_angularVelocity - (_local10 * ((_local20.r1.x * _local22) - (_local20.r1.y * _local21))));
_local7.m_linearVelocity.x = (_local7.m_linearVelocity.x - (_local9 * _local21));
_local7.m_linearVelocity.y = (_local7.m_linearVelocity.y - (_local9 * _local22));
_local8.m_angularVelocity = (_local8.m_angularVelocity + (_local12 * ((_local20.r2.x * _local22) - (_local20.r2.y * _local21))));
_local8.m_linearVelocity.x = (_local8.m_linearVelocity.x + (_local11 * _local21));
_local8.m_linearVelocity.y = (_local8.m_linearVelocity.y + (_local11 * _local22));
_local18++;
};
} else {
_local19 = _local6.pointCount;
_local18 = 0;
while (_local18 < _local19) {
_local23 = _local6.points[_local18];
_local23.normalImpulse = 0;
_local23.tangentImpulse = 0;
_local18++;
};
};
_local5++;
};
}
public function SolvePositionConstraints(_arg1:Number):Boolean{
var _local2:Number;
var _local3:b2Mat22;
var _local4:b2Vec2;
var _local5:int;
var _local6:b2ContactConstraint;
var _local7:b2Body;
var _local8:b2Body;
var _local9:b2Vec2;
var _local10:Number;
var _local11:b2Vec2;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:int;
var _local20:int;
var _local21:b2ContactConstraintPoint;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:Number;
var _local26:Number;
var _local27:Number;
var _local28:Number;
var _local29:Number;
var _local30:Number;
var _local31:Number;
var _local32:Number;
var _local33:Number;
var _local34:Number;
var _local35:Number;
var _local36:Number;
var _local37:Number;
var _local38:Number;
_local2 = 0;
_local5 = 0;
while (_local5 < m_constraintCount) {
_local6 = m_constraints[_local5];
_local7 = _local6.body1;
_local8 = _local6.body2;
_local9 = _local7.m_sweep.c;
_local10 = _local7.m_sweep.a;
_local11 = _local8.m_sweep.c;
_local12 = _local8.m_sweep.a;
_local13 = (_local7.m_mass * _local7.m_invMass);
_local14 = (_local7.m_mass * _local7.m_invI);
_local15 = (_local8.m_mass * _local8.m_invMass);
_local16 = (_local8.m_mass * _local8.m_invI);
_local17 = _local6.normal.x;
_local18 = _local6.normal.y;
_local19 = _local6.pointCount;
_local20 = 0;
while (_local20 < _local19) {
_local21 = _local6.points[_local20];
_local3 = _local7.m_xf.R;
_local4 = _local7.m_sweep.localCenter;
_local22 = (_local21.localAnchor1.x - _local4.x);
_local23 = (_local21.localAnchor1.y - _local4.y);
_local26 = ((_local3.col1.x * _local22) + (_local3.col2.x * _local23));
_local23 = ((_local3.col1.y * _local22) + (_local3.col2.y * _local23));
_local22 = _local26;
_local3 = _local8.m_xf.R;
_local4 = _local8.m_sweep.localCenter;
_local24 = (_local21.localAnchor2.x - _local4.x);
_local25 = (_local21.localAnchor2.y - _local4.y);
_local26 = ((_local3.col1.x * _local24) + (_local3.col2.x * _local25));
_local25 = ((_local3.col1.y * _local24) + (_local3.col2.y * _local25));
_local24 = _local26;
_local27 = (_local9.x + _local22);
_local28 = (_local9.y + _local23);
_local29 = (_local11.x + _local24);
_local30 = (_local11.y + _local25);
_local31 = (_local29 - _local27);
_local32 = (_local30 - _local28);
_local33 = (((_local31 * _local17) + (_local32 * _local18)) + _local21.separation);
_local2 = b2Math.b2Min(_local2, _local33);
_local34 = (_arg1 * b2Math.b2Clamp((_local33 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0));
_local35 = (-(_local21.equalizedMass) * _local34);
_local36 = _local21.positionImpulse;
_local21.positionImpulse = b2Math.b2Max((_local36 + _local35), 0);
_local35 = (_local21.positionImpulse - _local36);
_local37 = (_local35 * _local17);
_local38 = (_local35 * _local18);
_local9.x = (_local9.x - (_local13 * _local37));
_local9.y = (_local9.y - (_local13 * _local38));
_local10 = (_local10 - (_local14 * ((_local22 * _local38) - (_local23 * _local37))));
_local7.m_sweep.a = _local10;
_local7.SynchronizeTransform();
_local11.x = (_local11.x + (_local15 * _local37));
_local11.y = (_local11.y + (_local15 * _local38));
_local12 = (_local12 + (_local16 * ((_local24 * _local38) - (_local25 * _local37))));
_local8.m_sweep.a = _local12;
_local8.SynchronizeTransform();
_local20++;
};
_local5++;
};
return ((_local2 >= (-1.5 * b2Settings.b2_linearSlop)));
}
public function SolveVelocityConstraints():void{
var _local1:int;
var _local2:b2ContactConstraintPoint;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:b2Mat22;
var _local18:b2Vec2;
var _local19:int;
var _local20:b2ContactConstraint;
var _local21:b2Body;
var _local22:b2Body;
var _local23:Number;
var _local24:Number;
var _local25:b2Vec2;
var _local26:b2Vec2;
var _local27:Number;
var _local28:Number;
var _local29:Number;
var _local30:Number;
var _local31:Number;
var _local32:Number;
var _local33:Number;
var _local34:Number;
var _local35:Number;
var _local36:Number;
var _local37:int;
var _local38:Number;
_local19 = 0;
while (_local19 < m_constraintCount) {
_local20 = m_constraints[_local19];
_local21 = _local20.body1;
_local22 = _local20.body2;
_local23 = _local21.m_angularVelocity;
_local24 = _local22.m_angularVelocity;
_local25 = _local21.m_linearVelocity;
_local26 = _local22.m_linearVelocity;
_local27 = _local21.m_invMass;
_local28 = _local21.m_invI;
_local29 = _local22.m_invMass;
_local30 = _local22.m_invI;
_local31 = _local20.normal.x;
_local32 = _local20.normal.y;
_local33 = _local32;
_local34 = -(_local31);
_local35 = _local20.friction;
_local37 = _local20.pointCount;
_local1 = 0;
while (_local1 < _local37) {
_local2 = _local20.points[_local1];
_local7 = (((_local26.x + (-(_local24) * _local2.r2.y)) - _local25.x) - (-(_local23) * _local2.r1.y));
_local8 = (((_local26.y + (_local24 * _local2.r2.x)) - _local25.y) - (_local23 * _local2.r1.x));
_local9 = ((_local7 * _local31) + (_local8 * _local32));
_local11 = (-(_local2.normalMass) * (_local9 - _local2.velocityBias));
_local10 = ((_local7 * _local33) + (_local8 * _local34));
_local12 = (_local2.tangentMass * -(_local10));
_local13 = b2Math.b2Max((_local2.normalImpulse + _local11), 0);
_local11 = (_local13 - _local2.normalImpulse);
_local38 = (_local35 * _local2.normalImpulse);
_local14 = b2Math.b2Clamp((_local2.tangentImpulse + _local12), -(_local38), _local38);
_local12 = (_local14 - _local2.tangentImpulse);
_local15 = ((_local11 * _local31) + (_local12 * _local33));
_local16 = ((_local11 * _local32) + (_local12 * _local34));
_local25.x = (_local25.x - (_local27 * _local15));
_local25.y = (_local25.y - (_local27 * _local16));
_local23 = (_local23 - (_local28 * ((_local2.r1.x * _local16) - (_local2.r1.y * _local15))));
_local26.x = (_local26.x + (_local29 * _local15));
_local26.y = (_local26.y + (_local29 * _local16));
_local24 = (_local24 + (_local30 * ((_local2.r2.x * _local16) - (_local2.r2.y * _local15))));
_local2.normalImpulse = _local13;
_local2.tangentImpulse = _local14;
_local1++;
};
_local21.m_angularVelocity = _local23;
_local22.m_angularVelocity = _local24;
_local19++;
};
}
public function FinalizeVelocityConstraints():void{
var _local1:int;
var _local2:b2ContactConstraint;
var _local3:b2Manifold;
var _local4:int;
var _local5:b2ManifoldPoint;
var _local6:b2ContactConstraintPoint;
_local1 = 0;
while (_local1 < m_constraintCount) {
_local2 = m_constraints[_local1];
_local3 = _local2.manifold;
_local4 = 0;
while (_local4 < _local2.pointCount) {
_local5 = _local3.points[_local4];
_local6 = _local2.points[_local4];
_local5.normalImpulse = _local6.normalImpulse;
_local5.tangentImpulse = _local6.tangentImpulse;
_local4++;
};
_local1++;
};
}
}
}//package Box2D.Dynamics.Contacts
Section 45
//b2NullContact (Box2D.Dynamics.Contacts.b2NullContact)
package Box2D.Dynamics.Contacts {
import Box2D.Dynamics.*;
public class b2NullContact extends b2Contact {
override public function GetManifolds():Array{
return (null);
}
override public function Evaluate(_arg1:b2ContactListener):void{
}
}
}//package Box2D.Dynamics.Contacts
Section 46
//b2PolyAndCircleContact (Box2D.Dynamics.Contacts.b2PolyAndCircleContact)
package Box2D.Dynamics.Contacts {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Collision.Shapes.*;
import Box2D.Collision.*;
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(_arg1:b2Shape, _arg2:b2Shape){
var _local3:b2ManifoldPoint;
m_manifolds = [new b2Manifold()];
m0 = new b2Manifold();
super(_arg1, _arg2);
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;
_local3 = m_manifold.points[0];
_local3.normalImpulse = 0;
_local3.tangentImpulse = 0;
}
override public function GetManifolds():Array{
return (m_manifolds);
}
override public function Evaluate(_arg1:b2ContactListener):void{
var _local2:int;
var _local3:b2Vec2;
var _local4:b2Vec2;
var _local5:b2ManifoldPoint;
var _local6:b2Body;
var _local7:b2Body;
var _local8:Array;
var _local9:b2ContactPoint;
var _local10:b2ManifoldPoint;
var _local11:Boolean;
var _local12:uint;
var _local13:int;
_local6 = m_shape1.m_body;
_local7 = m_shape2.m_body;
m0.Set(m_manifold);
b2Collision.b2CollidePolygonAndCircle(m_manifold, (m_shape1 as b2PolygonShape), _local6.m_xf, (m_shape2 as b2CircleShape), _local7.m_xf);
_local8 = [false, false];
_local9 = s_evalCP;
_local9.shape1 = m_shape1;
_local9.shape2 = m_shape2;
_local9.friction = m_friction;
_local9.restitution = m_restitution;
if (m_manifold.pointCount > 0){
_local2 = 0;
while (_local2 < m_manifold.pointCount) {
_local10 = m_manifold.points[_local2];
_local10.normalImpulse = 0;
_local10.tangentImpulse = 0;
_local11 = false;
_local12 = _local10.id._key;
_local13 = 0;
while (_local13 < m0.pointCount) {
if (_local8[_local13] == true){
} else {
_local5 = m0.points[_local13];
if (_local5.id._key == _local12){
_local8[_local13] = true;
_local10.normalImpulse = _local5.normalImpulse;
_local10.tangentImpulse = _local5.tangentImpulse;
_local11 = true;
if (_arg1 != null){
_local9.position = _local6.GetWorldPoint(_local10.localPoint1);
_local3 = _local6.GetLinearVelocityFromLocalPoint(_local10.localPoint1);
_local4 = _local7.GetLinearVelocityFromLocalPoint(_local10.localPoint2);
_local9.velocity.Set((_local4.x - _local3.x), (_local4.y - _local3.y));
_local9.normal.SetV(m_manifold.normal);
_local9.separation = _local10.separation;
_local9.id.key = _local12;
_arg1.Persist(_local9);
};
break;
};
};
_local13++;
};
if ((((_local11 == false)) && (!((_arg1 == null))))){
_local9.position = _local6.GetWorldPoint(_local10.localPoint1);
_local3 = _local6.GetLinearVelocityFromLocalPoint(_local10.localPoint1);
_local4 = _local7.GetLinearVelocityFromLocalPoint(_local10.localPoint2);
_local9.velocity.Set((_local4.x - _local3.x), (_local4.y - _local3.y));
_local9.normal.SetV(m_manifold.normal);
_local9.separation = _local10.separation;
_local9.id.key = _local12;
_arg1.Add(_local9);
};
_local2++;
};
m_manifoldCount = 1;
} else {
m_manifoldCount = 0;
};
if (_arg1 == null){
return;
};
_local2 = 0;
while (_local2 < m0.pointCount) {
if (_local8[_local2]){
} else {
_local5 = m0.points[_local2];
_local9.position = _local6.GetWorldPoint(_local5.localPoint1);
_local3 = _local6.GetLinearVelocityFromLocalPoint(_local5.localPoint1);
_local4 = _local7.GetLinearVelocityFromLocalPoint(_local5.localPoint2);
_local9.velocity.Set((_local4.x - _local3.x), (_local4.y - _local3.y));
_local9.normal.SetV(m0.normal);
_local9.separation = _local5.separation;
_local9.id.key = _local5.id._key;
_arg1.Remove(_local9);
};
_local2++;
};
}
public static function Destroy(_arg1:b2Contact, _arg2):void{
}
public static function Create(_arg1:b2Shape, _arg2:b2Shape, _arg3):b2Contact{
return (new b2PolyAndCircleContact(_arg1, _arg2));
}
}
}//package Box2D.Dynamics.Contacts
Section 47
//b2PolygonContact (Box2D.Dynamics.Contacts.b2PolygonContact)
package Box2D.Dynamics.Contacts {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Collision.Shapes.*;
import Box2D.Collision.*;
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(_arg1:b2Shape, _arg2:b2Shape):void{
m0 = new b2Manifold();
m_manifolds = [new b2Manifold()];
super(_arg1, _arg2);
m_manifold = m_manifolds[0];
m_manifold.pointCount = 0;
}
override public function GetManifolds():Array{
return (m_manifolds);
}
override public function Evaluate(_arg1:b2ContactListener):void{
var _local2:b2Vec2;
var _local3:b2Vec2;
var _local4:b2ManifoldPoint;
var _local5:b2Body;
var _local6:b2Body;
var _local7:b2ContactPoint;
var _local8:int;
var _local9:Array;
var _local10:b2ManifoldPoint;
var _local11:Boolean;
var _local12:uint;
var _local13:int;
_local5 = m_shape1.m_body;
_local6 = m_shape2.m_body;
m0.Set(m_manifold);
b2Collision.b2CollidePolygons(m_manifold, (m_shape1 as b2PolygonShape), _local5.m_xf, (m_shape2 as b2PolygonShape), _local6.m_xf);
_local9 = [false, false];
_local7 = s_evalCP;
_local7.shape1 = m_shape1;
_local7.shape2 = m_shape2;
_local7.friction = m_friction;
_local7.restitution = m_restitution;
if (m_manifold.pointCount > 0){
_local8 = 0;
while (_local8 < m_manifold.pointCount) {
_local10 = m_manifold.points[_local8];
_local10.normalImpulse = 0;
_local10.tangentImpulse = 0;
_local11 = false;
_local12 = _local10.id._key;
_local13 = 0;
while (_local13 < m0.pointCount) {
if (_local9[_local13] == true){
} else {
_local4 = m0.points[_local13];
if (_local4.id._key == _local12){
_local9[_local13] = true;
_local10.normalImpulse = _local4.normalImpulse;
_local10.tangentImpulse = _local4.tangentImpulse;
_local11 = true;
if (_arg1 != null){
_local7.position = _local5.GetWorldPoint(_local10.localPoint1);
_local2 = _local5.GetLinearVelocityFromLocalPoint(_local10.localPoint1);
_local3 = _local6.GetLinearVelocityFromLocalPoint(_local10.localPoint2);
_local7.velocity.Set((_local3.x - _local2.x), (_local3.y - _local2.y));
_local7.normal.SetV(m_manifold.normal);
_local7.separation = _local10.separation;
_local7.id.key = _local12;
_arg1.Persist(_local7);
};
break;
};
};
_local13++;
};
if ((((_local11 == false)) && (!((_arg1 == null))))){
_local7.position = _local5.GetWorldPoint(_local10.localPoint1);
_local2 = _local5.GetLinearVelocityFromLocalPoint(_local10.localPoint1);
_local3 = _local6.GetLinearVelocityFromLocalPoint(_local10.localPoint2);
_local7.velocity.Set((_local3.x - _local2.x), (_local3.y - _local2.y));
_local7.normal.SetV(m_manifold.normal);
_local7.separation = _local10.separation;
_local7.id.key = _local12;
_arg1.Add(_local7);
};
_local8++;
};
m_manifoldCount = 1;
} else {
m_manifoldCount = 0;
};
if (_arg1 == null){
return;
};
_local8 = 0;
while (_local8 < m0.pointCount) {
if (_local9[_local8]){
} else {
_local4 = m0.points[_local8];
_local7.position = _local5.GetWorldPoint(_local4.localPoint1);
_local2 = _local5.GetLinearVelocityFromLocalPoint(_local4.localPoint1);
_local3 = _local6.GetLinearVelocityFromLocalPoint(_local4.localPoint2);
_local7.velocity.Set((_local3.x - _local2.x), (_local3.y - _local2.y));
_local7.normal.SetV(m0.normal);
_local7.separation = _local4.separation;
_local7.id.key = _local4.id._key;
_arg1.Remove(_local7);
};
_local8++;
};
}
public static function Destroy(_arg1:b2Contact, _arg2):void{
}
public static function Create(_arg1:b2Shape, _arg2:b2Shape, _arg3):b2Contact{
return (new b2PolygonContact(_arg1, _arg2));
}
}
}//package Box2D.Dynamics.Contacts
Section 48
//b2DistanceJoint (Box2D.Dynamics.Joints.b2DistanceJoint)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
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(_arg1:b2DistanceJointDef){
var _local2:b2Mat22;
var _local3:Number;
var _local4:Number;
m_localAnchor1 = new b2Vec2();
m_localAnchor2 = new b2Vec2();
m_u = new b2Vec2();
super(_arg1);
m_localAnchor1.SetV(_arg1.localAnchor1);
m_localAnchor2.SetV(_arg1.localAnchor2);
m_length = _arg1.length;
m_frequencyHz = _arg1.frequencyHz;
m_dampingRatio = _arg1.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 _local1:b2Vec2;
_local1 = new b2Vec2();
_local1.SetV(m_u);
_local1.Multiply((m_inv_dt * m_impulse));
return (_local1);
}
override public function SolvePositionConstraints():Boolean{
var _local1:b2Mat22;
var _local2:b2Body;
var _local3:b2Body;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
if (m_frequencyHz > 0){
return (true);
};
_local2 = m_body1;
_local3 = m_body2;
_local1 = _local2.m_xf.R;
_local4 = (m_localAnchor1.x - _local2.m_sweep.localCenter.x);
_local5 = (m_localAnchor1.y - _local2.m_sweep.localCenter.y);
_local6 = ((_local1.col1.x * _local4) + (_local1.col2.x * _local5));
_local5 = ((_local1.col1.y * _local4) + (_local1.col2.y * _local5));
_local4 = _local6;
_local1 = _local3.m_xf.R;
_local7 = (m_localAnchor2.x - _local3.m_sweep.localCenter.x);
_local8 = (m_localAnchor2.y - _local3.m_sweep.localCenter.y);
_local6 = ((_local1.col1.x * _local7) + (_local1.col2.x * _local8));
_local8 = ((_local1.col1.y * _local7) + (_local1.col2.y * _local8));
_local7 = _local6;
_local9 = (((_local3.m_sweep.c.x + _local7) - _local2.m_sweep.c.x) - _local4);
_local10 = (((_local3.m_sweep.c.y + _local8) - _local2.m_sweep.c.y) - _local5);
_local11 = Math.sqrt(((_local9 * _local9) + (_local10 * _local10)));
_local9 = (_local9 / _local11);
_local10 = (_local10 / _local11);
_local12 = (_local11 - m_length);
_local12 = b2Math.b2Clamp(_local12, -(b2Settings.b2_maxLinearCorrection), b2Settings.b2_maxLinearCorrection);
_local13 = (-(m_mass) * _local12);
m_u.Set(_local9, _local10);
_local14 = (_local13 * m_u.x);
_local15 = (_local13 * m_u.y);
_local2.m_sweep.c.x = (_local2.m_sweep.c.x - (_local2.m_invMass * _local14));
_local2.m_sweep.c.y = (_local2.m_sweep.c.y - (_local2.m_invMass * _local15));
_local2.m_sweep.a = (_local2.m_sweep.a - (_local2.m_invI * ((_local4 * _local15) - (_local5 * _local14))));
_local3.m_sweep.c.x = (_local3.m_sweep.c.x + (_local3.m_invMass * _local14));
_local3.m_sweep.c.y = (_local3.m_sweep.c.y + (_local3.m_invMass * _local15));
_local3.m_sweep.a = (_local3.m_sweep.a + (_local3.m_invI * ((_local7 * _local15) - (_local8 * _local14))));
_local2.SynchronizeTransform();
_local3.SynchronizeTransform();
return ((b2Math.b2Abs(_local12) < b2Settings.b2_linearSlop));
}
override public function InitVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Mat22;
var _local3:Number;
var _local4:b2Body;
var _local5:b2Body;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
m_inv_dt = _arg1.inv_dt;
_local4 = m_body1;
_local5 = m_body2;
_local2 = _local4.m_xf.R;
_local6 = (m_localAnchor1.x - _local4.m_sweep.localCenter.x);
_local7 = (m_localAnchor1.y - _local4.m_sweep.localCenter.y);
_local3 = ((_local2.col1.x * _local6) + (_local2.col2.x * _local7));
_local7 = ((_local2.col1.y * _local6) + (_local2.col2.y * _local7));
_local6 = _local3;
_local2 = _local5.m_xf.R;
_local8 = (m_localAnchor2.x - _local5.m_sweep.localCenter.x);
_local9 = (m_localAnchor2.y - _local5.m_sweep.localCenter.y);
_local3 = ((_local2.col1.x * _local8) + (_local2.col2.x * _local9));
_local9 = ((_local2.col1.y * _local8) + (_local2.col2.y * _local9));
_local8 = _local3;
m_u.x = (((_local5.m_sweep.c.x + _local8) - _local4.m_sweep.c.x) - _local6);
m_u.y = (((_local5.m_sweep.c.y + _local9) - _local4.m_sweep.c.y) - _local7);
_local10 = Math.sqrt(((m_u.x * m_u.x) + (m_u.y * m_u.y)));
if (_local10 > b2Settings.b2_linearSlop){
m_u.Multiply((1 / _local10));
} else {
m_u.SetZero();
};
_local11 = ((_local6 * m_u.y) - (_local7 * m_u.x));
_local12 = ((_local8 * m_u.y) - (_local9 * m_u.x));
_local13 = (((_local4.m_invMass + ((_local4.m_invI * _local11) * _local11)) + _local5.m_invMass) + ((_local5.m_invI * _local12) * _local12));
m_mass = (1 / _local13);
if (m_frequencyHz > 0){
_local14 = (_local10 - m_length);
_local15 = ((2 * Math.PI) * m_frequencyHz);
_local16 = (((2 * m_mass) * m_dampingRatio) * _local15);
_local17 = ((m_mass * _local15) * _local15);
m_gamma = (1 / (_arg1.dt * (_local16 + (_arg1.dt * _local17))));
m_bias = (((_local14 * _arg1.dt) * _local17) * m_gamma);
m_mass = (1 / (_local13 + m_gamma));
};
if (_arg1.warmStarting){
m_impulse = (m_impulse * _arg1.dtRatio);
_local18 = (m_impulse * m_u.x);
_local19 = (m_impulse * m_u.y);
_local4.m_linearVelocity.x = (_local4.m_linearVelocity.x - (_local4.m_invMass * _local18));
_local4.m_linearVelocity.y = (_local4.m_linearVelocity.y - (_local4.m_invMass * _local19));
_local4.m_angularVelocity = (_local4.m_angularVelocity - (_local4.m_invI * ((_local6 * _local19) - (_local7 * _local18))));
_local5.m_linearVelocity.x = (_local5.m_linearVelocity.x + (_local5.m_invMass * _local18));
_local5.m_linearVelocity.y = (_local5.m_linearVelocity.y + (_local5.m_invMass * _local19));
_local5.m_angularVelocity = (_local5.m_angularVelocity + (_local5.m_invI * ((_local8 * _local19) - (_local9 * _local18))));
} else {
m_impulse = 0;
};
}
override public function GetReactionTorque():Number{
return (0);
}
override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Mat22;
var _local3:b2Body;
var _local4:b2Body;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
_local3 = m_body1;
_local4 = m_body2;
_local2 = _local3.m_xf.R;
_local5 = (m_localAnchor1.x - _local3.m_sweep.localCenter.x);
_local6 = (m_localAnchor1.y - _local3.m_sweep.localCenter.y);
_local7 = ((_local2.col1.x * _local5) + (_local2.col2.x * _local6));
_local6 = ((_local2.col1.y * _local5) + (_local2.col2.y * _local6));
_local5 = _local7;
_local2 = _local4.m_xf.R;
_local8 = (m_localAnchor2.x - _local4.m_sweep.localCenter.x);
_local9 = (m_localAnchor2.y - _local4.m_sweep.localCenter.y);
_local7 = ((_local2.col1.x * _local8) + (_local2.col2.x * _local9));
_local9 = ((_local2.col1.y * _local8) + (_local2.col2.y * _local9));
_local8 = _local7;
_local10 = (_local3.m_linearVelocity.x + (-(_local3.m_angularVelocity) * _local6));
_local11 = (_local3.m_linearVelocity.y + (_local3.m_angularVelocity * _local5));
_local12 = (_local4.m_linearVelocity.x + (-(_local4.m_angularVelocity) * _local9));
_local13 = (_local4.m_linearVelocity.y + (_local4.m_angularVelocity * _local8));
_local14 = ((m_u.x * (_local12 - _local10)) + (m_u.y * (_local13 - _local11)));
_local15 = (-(m_mass) * ((_local14 + m_bias) + (m_gamma * m_impulse)));
m_impulse = (m_impulse + _local15);
_local16 = (_local15 * m_u.x);
_local17 = (_local15 * m_u.y);
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x - (_local3.m_invMass * _local16));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y - (_local3.m_invMass * _local17));
_local3.m_angularVelocity = (_local3.m_angularVelocity - (_local3.m_invI * ((_local5 * _local17) - (_local6 * _local16))));
_local4.m_linearVelocity.x = (_local4.m_linearVelocity.x + (_local4.m_invMass * _local16));
_local4.m_linearVelocity.y = (_local4.m_linearVelocity.y + (_local4.m_invMass * _local17));
_local4.m_angularVelocity = (_local4.m_angularVelocity + (_local4.m_invI * ((_local8 * _local17) - (_local9 * _local16))));
}
}
}//package Box2D.Dynamics.Joints
Section 49
//b2DistanceJointDef (Box2D.Dynamics.Joints.b2DistanceJointDef)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
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(_arg1:b2Body, _arg2:b2Body, _arg3:b2Vec2, _arg4:b2Vec2):void{
var _local5:Number;
var _local6:Number;
body1 = _arg1;
body2 = _arg2;
localAnchor1.SetV(body1.GetLocalPoint(_arg3));
localAnchor2.SetV(body2.GetLocalPoint(_arg4));
_local5 = (_arg4.x - _arg3.x);
_local6 = (_arg4.y - _arg3.y);
length = Math.sqrt(((_local5 * _local5) + (_local6 * _local6)));
frequencyHz = 0;
dampingRatio = 0;
}
}
}//package Box2D.Dynamics.Joints
Section 50
//b2GearJoint (Box2D.Dynamics.Joints.b2GearJoint)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
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(_arg1:b2GearJointDef){
var _local2:int;
var _local3:int;
var _local4:Number;
var _local5:Number;
m_groundAnchor1 = new b2Vec2();
m_groundAnchor2 = new b2Vec2();
m_localAnchor1 = new b2Vec2();
m_localAnchor2 = new b2Vec2();
m_J = new b2Jacobian();
super(_arg1);
_local2 = _arg1.joint1.m_type;
_local3 = _arg1.joint2.m_type;
m_revolute1 = null;
m_prismatic1 = null;
m_revolute2 = null;
m_prismatic2 = null;
m_ground1 = _arg1.joint1.m_body1;
m_body1 = _arg1.joint1.m_body2;
if (_local2 == b2Joint.e_revoluteJoint){
m_revolute1 = (_arg1.joint1 as b2RevoluteJoint);
m_groundAnchor1.SetV(m_revolute1.m_localAnchor1);
m_localAnchor1.SetV(m_revolute1.m_localAnchor2);
_local4 = m_revolute1.GetJointAngle();
} else {
m_prismatic1 = (_arg1.joint1 as b2PrismaticJoint);
m_groundAnchor1.SetV(m_prismatic1.m_localAnchor1);
m_localAnchor1.SetV(m_prismatic1.m_localAnchor2);
_local4 = m_prismatic1.GetJointTranslation();
};
m_ground2 = _arg1.joint2.m_body1;
m_body2 = _arg1.joint2.m_body2;
if (_local3 == b2Joint.e_revoluteJoint){
m_revolute2 = (_arg1.joint2 as b2RevoluteJoint);
m_groundAnchor2.SetV(m_revolute2.m_localAnchor1);
m_localAnchor2.SetV(m_revolute2.m_localAnchor2);
_local5 = m_revolute2.GetJointAngle();
} else {
m_prismatic2 = (_arg1.joint2 as b2PrismaticJoint);
m_groundAnchor2.SetV(m_prismatic2.m_localAnchor1);
m_localAnchor2.SetV(m_prismatic2.m_localAnchor2);
_local5 = m_prismatic2.GetJointTranslation();
};
m_ratio = _arg1.ratio;
m_constant = (_local4 + (m_ratio * _local5));
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 _local1:b2Vec2;
_local1 = new b2Vec2((m_force * m_J.linear2.x), (m_force * m_J.linear2.y));
return (_local1);
}
override public function SolvePositionConstraints():Boolean{
var _local1:Number;
var _local2:b2Body;
var _local3:b2Body;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
_local1 = 0;
_local2 = m_body1;
_local3 = m_body2;
if (m_revolute1){
_local4 = m_revolute1.GetJointAngle();
} else {
_local4 = m_prismatic1.GetJointTranslation();
};
if (m_revolute2){
_local5 = m_revolute2.GetJointAngle();
} else {
_local5 = m_prismatic2.GetJointTranslation();
};
_local6 = (m_constant - (_local4 + (m_ratio * _local5)));
_local7 = (-(m_mass) * _local6);
_local2.m_sweep.c.x = (_local2.m_sweep.c.x + ((_local2.m_invMass * _local7) * m_J.linear1.x));
_local2.m_sweep.c.y = (_local2.m_sweep.c.y + ((_local2.m_invMass * _local7) * m_J.linear1.y));
_local2.m_sweep.a = (_local2.m_sweep.a + ((_local2.m_invI * _local7) * m_J.angular1));
_local3.m_sweep.c.x = (_local3.m_sweep.c.x + ((_local3.m_invMass * _local7) * m_J.linear2.x));
_local3.m_sweep.c.y = (_local3.m_sweep.c.y + ((_local3.m_invMass * _local7) * m_J.linear2.y));
_local3.m_sweep.a = (_local3.m_sweep.a + ((_local3.m_invI * _local7) * m_J.angular2));
_local2.SynchronizeTransform();
_local3.SynchronizeTransform();
return ((_local1 < b2Settings.b2_linearSlop));
}
override public function InitVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Body;
var _local3:b2Body;
var _local4:b2Body;
var _local5:b2Body;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:b2Mat22;
var _local11:b2Vec2;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
_local2 = m_ground1;
_local3 = m_ground2;
_local4 = m_body1;
_local5 = m_body2;
_local14 = 0;
m_J.SetZero();
if (m_revolute1){
m_J.angular1 = -1;
_local14 = (_local14 + _local4.m_invI);
} else {
_local10 = _local2.m_xf.R;
_local11 = m_prismatic1.m_localXAxis1;
_local6 = ((_local10.col1.x * _local11.x) + (_local10.col2.x * _local11.y));
_local7 = ((_local10.col1.y * _local11.x) + (_local10.col2.y * _local11.y));
_local10 = _local4.m_xf.R;
_local8 = (m_localAnchor1.x - _local4.m_sweep.localCenter.x);
_local9 = (m_localAnchor1.y - _local4.m_sweep.localCenter.y);
_local13 = ((_local10.col1.x * _local8) + (_local10.col2.x * _local9));
_local9 = ((_local10.col1.y * _local8) + (_local10.col2.y * _local9));
_local8 = _local13;
_local12 = ((_local8 * _local7) - (_local9 * _local6));
m_J.linear1.Set(-(_local6), -(_local7));
m_J.angular1 = -(_local12);
_local14 = (_local14 + (_local4.m_invMass + ((_local4.m_invI * _local12) * _local12)));
};
if (m_revolute2){
m_J.angular2 = -(m_ratio);
_local14 = (_local14 + ((m_ratio * m_ratio) * _local5.m_invI));
} else {
_local10 = _local3.m_xf.R;
_local11 = m_prismatic2.m_localXAxis1;
_local6 = ((_local10.col1.x * _local11.x) + (_local10.col2.x * _local11.y));
_local7 = ((_local10.col1.y * _local11.x) + (_local10.col2.y * _local11.y));
_local10 = _local5.m_xf.R;
_local8 = (m_localAnchor2.x - _local5.m_sweep.localCenter.x);
_local9 = (m_localAnchor2.y - _local5.m_sweep.localCenter.y);
_local13 = ((_local10.col1.x * _local8) + (_local10.col2.x * _local9));
_local9 = ((_local10.col1.y * _local8) + (_local10.col2.y * _local9));
_local8 = _local13;
_local12 = ((_local8 * _local7) - (_local9 * _local6));
m_J.linear2.Set((-(m_ratio) * _local6), (-(m_ratio) * _local7));
m_J.angular2 = (-(m_ratio) * _local12);
_local14 = (_local14 + ((m_ratio * m_ratio) * (_local5.m_invMass + ((_local5.m_invI * _local12) * _local12))));
};
m_mass = (1 / _local14);
if (_arg1.warmStarting){
_local15 = (_arg1.dt * m_force);
_local4.m_linearVelocity.x = (_local4.m_linearVelocity.x + ((_local4.m_invMass * _local15) * m_J.linear1.x));
_local4.m_linearVelocity.y = (_local4.m_linearVelocity.y + ((_local4.m_invMass * _local15) * m_J.linear1.y));
_local4.m_angularVelocity = (_local4.m_angularVelocity + ((_local4.m_invI * _local15) * m_J.angular1));
_local5.m_linearVelocity.x = (_local5.m_linearVelocity.x + ((_local5.m_invMass * _local15) * m_J.linear2.x));
_local5.m_linearVelocity.y = (_local5.m_linearVelocity.y + ((_local5.m_invMass * _local15) * m_J.linear2.y));
_local5.m_angularVelocity = (_local5.m_angularVelocity + ((_local5.m_invI * _local15) * m_J.angular2));
} else {
m_force = 0;
};
}
override public function GetReactionTorque():Number{
var _local1:b2Mat22;
var _local2:Number;
var _local3:Number;
var _local4:Number;
_local1 = m_body2.m_xf.R;
_local2 = (m_localAnchor1.x - m_body2.m_sweep.localCenter.x);
_local3 = (m_localAnchor1.y - m_body2.m_sweep.localCenter.y);
_local4 = ((_local1.col1.x * _local2) + (_local1.col2.x * _local3));
_local3 = ((_local1.col1.y * _local2) + (_local1.col2.y * _local3));
_local2 = _local4;
_local4 = ((m_force * m_J.angular2) - ((_local2 * (m_force * m_J.linear2.y)) - (_local3 * (m_force * m_J.linear2.x))));
return (_local4);
}
public function GetRatio():Number{
return (m_ratio);
}
override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Body;
var _local3:b2Body;
var _local4:Number;
var _local5:Number;
var _local6:Number;
_local2 = m_body1;
_local3 = m_body2;
_local4 = m_J.Compute(_local2.m_linearVelocity, _local2.m_angularVelocity, _local3.m_linearVelocity, _local3.m_angularVelocity);
_local5 = ((-(_arg1.inv_dt) * m_mass) * _local4);
m_force = (m_force + _local5);
_local6 = (_arg1.dt * _local5);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + ((_local2.m_invMass * _local6) * m_J.linear1.x));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + ((_local2.m_invMass * _local6) * m_J.linear1.y));
_local2.m_angularVelocity = (_local2.m_angularVelocity + ((_local2.m_invI * _local6) * m_J.angular1));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_local3.m_invMass * _local6) * m_J.linear2.x));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_local3.m_invMass * _local6) * m_J.linear2.y));
_local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local3.m_invI * _local6) * m_J.angular2));
}
}
}//package Box2D.Dynamics.Joints
Section 51
//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(){
type = b2Joint.e_gearJoint;
joint1 = null;
joint2 = null;
ratio = 1;
}
}
}//package Box2D.Dynamics.Joints
Section 52
//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(_arg1:b2Vec2, _arg2:Number, _arg3:b2Vec2, _arg4:Number):void{
linear1.SetV(_arg1);
angular1 = _arg2;
linear2.SetV(_arg3);
angular2 = _arg4;
}
public function SetZero():void{
linear1.SetZero();
angular1 = 0;
linear2.SetZero();
angular2 = 0;
}
public function Compute(_arg1:b2Vec2, _arg2:Number, _arg3:b2Vec2, _arg4:Number):Number{
return ((((((linear1.x * _arg1.x) + (linear1.y * _arg1.y)) + (angular1 * _arg2)) + ((linear2.x * _arg3.x) + (linear2.y * _arg3.y))) + (angular2 * _arg4)));
}
}
}//package Box2D.Dynamics.Joints
Section 53
//b2Joint (Box2D.Dynamics.Joints.b2Joint)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
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(_arg1:b2JointDef){
m_node1 = new b2JointEdge();
m_node2 = new b2JointEdge();
super();
m_type = _arg1.type;
m_prev = null;
m_next = null;
m_body1 = _arg1.body1;
m_body2 = _arg1.body2;
m_collideConnected = _arg1.collideConnected;
m_islandFlag = false;
m_userData = _arg1.userData;
}
public function GetAnchor1():b2Vec2{
return (null);
}
public function GetAnchor2():b2Vec2{
return (null);
}
public function InitVelocityConstraints(_arg1: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(_arg1):void{
m_userData = _arg1;
}
public function GetBody1():b2Body{
return (m_body1);
}
public function SolveVelocityConstraints(_arg1:b2TimeStep):void{
}
public function InitPositionConstraints():void{
}
public static function Destroy(_arg1:b2Joint, _arg2):void{
}
public static function Create(_arg1:b2JointDef, _arg2):b2Joint{
var _local3:b2Joint;
_local3 = null;
switch (_arg1.type){
case e_distanceJoint:
_local3 = new b2DistanceJoint((_arg1 as b2DistanceJointDef));
break;
case e_mouseJoint:
_local3 = new b2MouseJoint((_arg1 as b2MouseJointDef));
break;
case e_prismaticJoint:
_local3 = new b2PrismaticJoint((_arg1 as b2PrismaticJointDef));
break;
case e_revoluteJoint:
_local3 = new b2RevoluteJoint((_arg1 as b2RevoluteJointDef));
break;
case e_pulleyJoint:
_local3 = new b2PulleyJoint((_arg1 as b2PulleyJointDef));
break;
case e_gearJoint:
_local3 = new b2GearJoint((_arg1 as b2GearJointDef));
break;
default:
break;
};
return (_local3);
}
}
}//package Box2D.Dynamics.Joints
Section 54
//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(){
type = b2Joint.e_unknownJoint;
userData = null;
body1 = null;
body2 = null;
collideConnected = false;
}
}
}//package Box2D.Dynamics.Joints
Section 55
//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;
}
}//package Box2D.Dynamics.Joints
Section 56
//b2MouseJoint (Box2D.Dynamics.Joints.b2MouseJoint)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
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(_arg1:b2MouseJointDef){
var _local2:Number;
var _local3:Number;
var _local4:b2Mat22;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8: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(_arg1);
m_target.SetV(_arg1.target);
_local2 = (m_target.x - m_body2.m_xf.position.x);
_local3 = (m_target.y - m_body2.m_xf.position.y);
_local4 = m_body2.m_xf.R;
m_localAnchor.x = ((_local2 * _local4.col1.x) + (_local3 * _local4.col1.y));
m_localAnchor.y = ((_local2 * _local4.col2.x) + (_local3 * _local4.col2.y));
m_maxForce = _arg1.maxForce;
m_impulse.SetZero();
_local5 = m_body2.m_mass;
_local6 = ((2 * b2Settings.b2_pi) * _arg1.frequencyHz);
_local7 = (((2 * _local5) * _arg1.dampingRatio) * _local6);
_local8 = ((_arg1.timeStep * _local5) * (_local6 * _local6));
m_gamma = (1 / (_local7 + _local8));
m_beta = (_local8 / (_local7 + _local8));
}
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(_arg1:b2TimeStep):void{
var _local2:b2Body;
var _local3:b2Mat22;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
_local2 = m_body2;
_local3 = _local2.m_xf.R;
_local4 = (m_localAnchor.x - _local2.m_sweep.localCenter.x);
_local5 = (m_localAnchor.y - _local2.m_sweep.localCenter.y);
_local6 = ((_local3.col1.x * _local4) + (_local3.col2.x * _local5));
_local5 = ((_local3.col1.y * _local4) + (_local3.col2.y * _local5));
_local4 = _local6;
_local7 = _local2.m_invMass;
_local8 = _local2.m_invI;
K1.col1.x = _local7;
K1.col2.x = 0;
K1.col1.y = 0;
K1.col2.y = _local7;
K2.col1.x = ((_local8 * _local5) * _local5);
K2.col2.x = ((-(_local8) * _local4) * _local5);
K2.col1.y = ((-(_local8) * _local4) * _local5);
K2.col2.y = ((_local8 * _local4) * _local4);
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 = ((_local2.m_sweep.c.x + _local4) - m_target.x);
m_C.y = ((_local2.m_sweep.c.y + _local5) - m_target.y);
_local2.m_angularVelocity = (_local2.m_angularVelocity * 0.98);
_local9 = (_arg1.dt * m_impulse.x);
_local10 = (_arg1.dt * m_impulse.y);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local7 * _local9));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local7 * _local10));
_local2.m_angularVelocity = (_local2.m_angularVelocity + (_local8 * ((_local4 * _local10) - (_local5 * _local9))));
}
override public function GetReactionTorque():Number{
return (0);
}
public function SetTarget(_arg1:b2Vec2):void{
if (m_body2.IsSleeping()){
m_body2.WakeUp();
};
m_target = _arg1;
}
override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Body;
var _local3:b2Mat22;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
_local2 = m_body2;
_local3 = _local2.m_xf.R;
_local6 = (m_localAnchor.x - _local2.m_sweep.localCenter.x);
_local7 = (m_localAnchor.y - _local2.m_sweep.localCenter.y);
_local4 = ((_local3.col1.x * _local6) + (_local3.col2.x * _local7));
_local7 = ((_local3.col1.y * _local6) + (_local3.col2.y * _local7));
_local6 = _local4;
_local8 = (_local2.m_linearVelocity.x + (-(_local2.m_angularVelocity) * _local7));
_local9 = (_local2.m_linearVelocity.y + (_local2.m_angularVelocity * _local6));
_local3 = m_mass;
_local4 = ((_local8 + ((m_beta * _arg1.inv_dt) * m_C.x)) + ((m_gamma * _arg1.dt) * m_impulse.x));
_local5 = ((_local9 + ((m_beta * _arg1.inv_dt) * m_C.y)) + ((m_gamma * _arg1.dt) * m_impulse.y));
_local10 = (-(_arg1.inv_dt) * ((_local3.col1.x * _local4) + (_local3.col2.x * _local5)));
_local11 = (-(_arg1.inv_dt) * ((_local3.col1.y * _local4) + (_local3.col2.y * _local5)));
_local12 = m_impulse.x;
_local13 = m_impulse.y;
m_impulse.x = (m_impulse.x + _local10);
m_impulse.y = (m_impulse.y + _local11);
_local14 = m_impulse.Length();
if (_local14 > m_maxForce){
m_impulse.Multiply((m_maxForce / _local14));
};
_local10 = (m_impulse.x - _local12);
_local11 = (m_impulse.y - _local13);
_local15 = (_arg1.dt * _local10);
_local16 = (_arg1.dt * _local11);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local2.m_invMass * _local15));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local2.m_invMass * _local16));
_local2.m_angularVelocity = (_local2.m_angularVelocity + (_local2.m_invI * ((_local6 * _local16) - (_local7 * _local15))));
}
}
}//package Box2D.Dynamics.Joints
Section 57
//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 58
//b2PrismaticJoint (Box2D.Dynamics.Joints.b2PrismaticJoint)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
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(_arg1:b2PrismaticJointDef){
var _local2:b2Mat22;
var _local3:Number;
var _local4: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(_arg1);
m_localAnchor1.SetV(_arg1.localAnchor1);
m_localAnchor2.SetV(_arg1.localAnchor2);
m_localXAxis1.SetV(_arg1.localAxis1);
m_localYAxis1.x = -(m_localXAxis1.y);
m_localYAxis1.y = m_localXAxis1.x;
m_refAngle = _arg1.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 = _arg1.lowerTranslation;
m_upperTranslation = _arg1.upperTranslation;
m_maxMotorForce = _arg1.maxMotorForce;
m_motorSpeed = _arg1.motorSpeed;
m_enableLimit = _arg1.enableLimit;
m_enableMotor = _arg1.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(_arg1:Boolean):void{
m_enableMotor = _arg1;
}
public function GetUpperLimit():Number{
return (m_upperTranslation);
}
public function GetLowerLimit():Number{
return (m_lowerTranslation);
}
public function GetJointTranslation():Number{
var _local1:b2Body;
var _local2:b2Body;
var _local3:b2Mat22;
var _local4:b2Vec2;
var _local5:b2Vec2;
var _local6:Number;
var _local7:Number;
var _local8:b2Vec2;
var _local9:Number;
_local1 = m_body1;
_local2 = m_body2;
_local4 = _local1.GetWorldPoint(m_localAnchor1);
_local5 = _local2.GetWorldPoint(m_localAnchor2);
_local6 = (_local5.x - _local4.x);
_local7 = (_local5.y - _local4.y);
_local8 = _local1.GetWorldVector(m_localXAxis1);
_local9 = ((_local8.x * _local6) + (_local8.y * _local7));
return (_local9);
}
public function SetLimits(_arg1:Number, _arg2:Number):void{
m_lowerTranslation = _arg1;
m_upperTranslation = _arg2;
}
public function GetMotorSpeed():Number{
return (m_motorSpeed);
}
override public function GetReactionForce():b2Vec2{
var _local1:b2Mat22;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
_local1 = m_body1.m_xf.R;
_local2 = (m_limitForce * ((_local1.col1.x * m_localXAxis1.x) + (_local1.col2.x * m_localXAxis1.y)));
_local3 = (m_limitForce * ((_local1.col1.y * m_localXAxis1.x) + (_local1.col2.y * m_localXAxis1.y)));
_local4 = (m_force * ((_local1.col1.x * m_localYAxis1.x) + (_local1.col2.x * m_localYAxis1.y)));
_local5 = (m_force * ((_local1.col1.y * m_localYAxis1.x) + (_local1.col2.y * m_localYAxis1.y)));
return (new b2Vec2(((m_limitForce * _local2) + (m_force * _local4)), ((m_limitForce * _local3) + (m_force * _local5))));
}
override public function SolvePositionConstraints():Boolean{
var _local1:Number;
var _local2:Number;
var _local3:b2Body;
var _local4:b2Body;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:b2Mat22;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:Number;
var _local26:Number;
var _local27:Number;
var _local28:Number;
var _local29:Number;
var _local30:Number;
var _local31:Number;
var _local32:Number;
_local3 = m_body1;
_local4 = m_body2;
_local5 = _local3.m_invMass;
_local6 = _local4.m_invMass;
_local7 = _local3.m_invI;
_local8 = _local4.m_invI;
_local9 = _local3.m_xf.R;
_local11 = (m_localAnchor1.x - _local3.m_sweep.localCenter.x);
_local12 = (m_localAnchor1.y - _local3.m_sweep.localCenter.y);
_local10 = ((_local9.col1.x * _local11) + (_local9.col2.x * _local12));
_local12 = ((_local9.col1.y * _local11) + (_local9.col2.y * _local12));
_local11 = _local10;
_local9 = _local4.m_xf.R;
_local13 = (m_localAnchor2.x - _local4.m_sweep.localCenter.x);
_local14 = (m_localAnchor2.y - _local4.m_sweep.localCenter.y);
_local10 = ((_local9.col1.x * _local13) + (_local9.col2.x * _local14));
_local14 = ((_local9.col1.y * _local13) + (_local9.col2.y * _local14));
_local13 = _local10;
_local15 = (_local3.m_sweep.c.x + _local11);
_local16 = (_local3.m_sweep.c.y + _local12);
_local17 = (_local4.m_sweep.c.x + _local13);
_local18 = (_local4.m_sweep.c.y + _local14);
_local19 = (_local17 - _local15);
_local20 = (_local18 - _local16);
_local9 = _local3.m_xf.R;
_local21 = ((_local9.col1.x * m_localYAxis1.x) + (_local9.col2.x * m_localYAxis1.y));
_local22 = ((_local9.col1.y * m_localYAxis1.x) + (_local9.col2.y * m_localYAxis1.y));
_local23 = ((_local21 * _local19) + (_local22 * _local20));
_local23 = b2Math.b2Clamp(_local23, -(b2Settings.b2_maxLinearCorrection), b2Settings.b2_maxLinearCorrection);
_local24 = (-(m_linearMass) * _local23);
_local3.m_sweep.c.x = (_local3.m_sweep.c.x + ((_local5 * _local24) * m_linearJacobian.linear1.x));
_local3.m_sweep.c.y = (_local3.m_sweep.c.y + ((_local5 * _local24) * m_linearJacobian.linear1.y));
_local3.m_sweep.a = (_local3.m_sweep.a + ((_local7 * _local24) * m_linearJacobian.angular1));
_local4.m_sweep.c.x = (_local4.m_sweep.c.x + ((_local6 * _local24) * m_linearJacobian.linear2.x));
_local4.m_sweep.c.y = (_local4.m_sweep.c.y + ((_local6 * _local24) * m_linearJacobian.linear2.y));
_local4.m_sweep.a = (_local4.m_sweep.a + ((_local8 * _local24) * m_linearJacobian.angular2));
_local25 = b2Math.b2Abs(_local23);
_local26 = ((_local4.m_sweep.a - _local3.m_sweep.a) - m_refAngle);
_local26 = b2Math.b2Clamp(_local26, -(b2Settings.b2_maxAngularCorrection), b2Settings.b2_maxAngularCorrection);
_local27 = (-(m_angularMass) * _local26);
_local3.m_sweep.a = (_local3.m_sweep.a - (_local3.m_invI * _local27));
_local4.m_sweep.a = (_local4.m_sweep.a + (_local4.m_invI * _local27));
_local3.SynchronizeTransform();
_local4.SynchronizeTransform();
_local28 = b2Math.b2Abs(_local26);
if (((m_enableLimit) && (!((m_limitState == e_inactiveLimit))))){
_local9 = _local3.m_xf.R;
_local11 = (m_localAnchor1.x - _local3.m_sweep.localCenter.x);
_local12 = (m_localAnchor1.y - _local3.m_sweep.localCenter.y);
_local10 = ((_local9.col1.x * _local11) + (_local9.col2.x * _local12));
_local12 = ((_local9.col1.y * _local11) + (_local9.col2.y * _local12));
_local11 = _local10;
_local9 = _local4.m_xf.R;
_local13 = (m_localAnchor2.x - _local4.m_sweep.localCenter.x);
_local14 = (m_localAnchor2.y - _local4.m_sweep.localCenter.y);
_local10 = ((_local9.col1.x * _local13) + (_local9.col2.x * _local14));
_local14 = ((_local9.col1.y * _local13) + (_local9.col2.y * _local14));
_local13 = _local10;
_local15 = (_local3.m_sweep.c.x + _local11);
_local16 = (_local3.m_sweep.c.y + _local12);
_local17 = (_local4.m_sweep.c.x + _local13);
_local18 = (_local4.m_sweep.c.y + _local14);
_local19 = (_local17 - _local15);
_local20 = (_local18 - _local16);
_local9 = _local3.m_xf.R;
_local29 = ((_local9.col1.x * m_localXAxis1.x) + (_local9.col2.x * m_localXAxis1.y));
_local30 = ((_local9.col1.y * m_localXAxis1.x) + (_local9.col2.y * m_localXAxis1.y));
_local31 = ((_local29 * _local19) + (_local30 * _local20));
_local32 = 0;
if (m_limitState == e_equalLimits){
_local1 = b2Math.b2Clamp(_local31, -(b2Settings.b2_maxLinearCorrection), b2Settings.b2_maxLinearCorrection);
_local32 = (-(m_motorMass) * _local1);
_local25 = b2Math.b2Max(_local25, b2Math.b2Abs(_local26));
} else {
if (m_limitState == e_atLowerLimit){
_local1 = (_local31 - m_lowerTranslation);
_local25 = b2Math.b2Max(_local25, -(_local1));
_local1 = b2Math.b2Clamp((_local1 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0);
_local32 = (-(m_motorMass) * _local1);
_local2 = m_limitPositionImpulse;
m_limitPositionImpulse = b2Math.b2Max((m_limitPositionImpulse + _local32), 0);
_local32 = (m_limitPositionImpulse - _local2);
} else {
if (m_limitState == e_atUpperLimit){
_local1 = (_local31 - m_upperTranslation);
_local25 = b2Math.b2Max(_local25, _local1);
_local1 = b2Math.b2Clamp((_local1 - b2Settings.b2_linearSlop), 0, b2Settings.b2_maxLinearCorrection);
_local32 = (-(m_motorMass) * _local1);
_local2 = m_limitPositionImpulse;
m_limitPositionImpulse = b2Math.b2Min((m_limitPositionImpulse + _local32), 0);
_local32 = (m_limitPositionImpulse - _local2);
};
};
};
_local3.m_sweep.c.x = (_local3.m_sweep.c.x + ((_local5 * _local32) * m_motorJacobian.linear1.x));
_local3.m_sweep.c.y = (_local3.m_sweep.c.y + ((_local5 * _local32) * m_motorJacobian.linear1.y));
_local3.m_sweep.a = (_local3.m_sweep.a + ((_local7 * _local32) * m_motorJacobian.angular1));
_local4.m_sweep.c.x = (_local4.m_sweep.c.x + ((_local6 * _local32) * m_motorJacobian.linear2.x));
_local4.m_sweep.c.y = (_local4.m_sweep.c.y + ((_local6 * _local32) * m_motorJacobian.linear2.y));
_local4.m_sweep.a = (_local4.m_sweep.a + ((_local8 * _local32) * m_motorJacobian.angular2));
_local3.SynchronizeTransform();
_local4.SynchronizeTransform();
};
return ((((_local25 <= b2Settings.b2_linearSlop)) && ((_local28 <= b2Settings.b2_angularSlop))));
}
public function GetJointSpeed():Number{
var _local1:b2Body;
var _local2:b2Body;
var _local3:b2Mat22;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:b2Vec2;
var _local16:b2Vec2;
var _local17:b2Vec2;
var _local18:Number;
var _local19:Number;
var _local20:Number;
_local1 = m_body1;
_local2 = m_body2;
_local3 = _local1.m_xf.R;
_local4 = (m_localAnchor1.x - _local1.m_sweep.localCenter.x);
_local5 = (m_localAnchor1.y - _local1.m_sweep.localCenter.y);
_local6 = ((_local3.col1.x * _local4) + (_local3.col2.x * _local5));
_local5 = ((_local3.col1.y * _local4) + (_local3.col2.y * _local5));
_local4 = _local6;
_local3 = _local2.m_xf.R;
_local7 = (m_localAnchor2.x - _local2.m_sweep.localCenter.x);
_local8 = (m_localAnchor2.y - _local2.m_sweep.localCenter.y);
_local6 = ((_local3.col1.x * _local7) + (_local3.col2.x * _local8));
_local8 = ((_local3.col1.y * _local7) + (_local3.col2.y * _local8));
_local7 = _local6;
_local9 = (_local1.m_sweep.c.x + _local4);
_local10 = (_local1.m_sweep.c.y + _local5);
_local11 = (_local2.m_sweep.c.x + _local7);
_local12 = (_local2.m_sweep.c.y + _local8);
_local13 = (_local11 - _local9);
_local14 = (_local12 - _local10);
_local15 = _local1.GetWorldVector(m_localXAxis1);
_local16 = _local1.m_linearVelocity;
_local17 = _local2.m_linearVelocity;
_local18 = _local1.m_angularVelocity;
_local19 = _local2.m_angularVelocity;
_local20 = (((_local13 * (-(_local18) * _local15.y)) + (_local14 * (_local18 * _local15.x))) + ((_local15.x * (((_local17.x + (-(_local19) * _local8)) - _local16.x) - (-(_local18) * _local5))) + (_local15.y * (((_local17.y + (_local19 * _local7)) - _local16.y) - (_local18 * _local4)))));
return (_local20);
}
public function SetMotorSpeed(_arg1:Number):void{
m_motorSpeed = _arg1;
}
override public function InitVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Body;
var _local3:b2Body;
var _local4:b2Mat22;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:Number;
var _local26:Number;
var _local27:Number;
var _local28:Number;
_local2 = m_body1;
_local3 = m_body2;
_local4 = _local2.m_xf.R;
_local6 = (m_localAnchor1.x - _local2.m_sweep.localCenter.x);
_local7 = (m_localAnchor1.y - _local2.m_sweep.localCenter.y);
_local5 = ((_local4.col1.x * _local6) + (_local4.col2.x * _local7));
_local7 = ((_local4.col1.y * _local6) + (_local4.col2.y * _local7));
_local6 = _local5;
_local4 = _local3.m_xf.R;
_local8 = (m_localAnchor2.x - _local3.m_sweep.localCenter.x);
_local9 = (m_localAnchor2.y - _local3.m_sweep.localCenter.y);
_local5 = ((_local4.col1.x * _local8) + (_local4.col2.x * _local9));
_local9 = ((_local4.col1.y * _local8) + (_local4.col2.y * _local9));
_local8 = _local5;
_local10 = _local2.m_invMass;
_local11 = _local3.m_invMass;
_local12 = _local2.m_invI;
_local13 = _local3.m_invI;
_local4 = _local2.m_xf.R;
_local14 = ((_local4.col1.x * m_localYAxis1.x) + (_local4.col2.x * m_localYAxis1.y));
_local15 = ((_local4.col1.y * m_localYAxis1.x) + (_local4.col2.y * m_localYAxis1.y));
_local16 = ((_local3.m_sweep.c.x + _local8) - _local2.m_sweep.c.x);
_local17 = ((_local3.m_sweep.c.y + _local9) - _local2.m_sweep.c.y);
m_linearJacobian.linear1.x = -(_local14);
m_linearJacobian.linear1.y = -(_local15);
m_linearJacobian.linear2.x = _local14;
m_linearJacobian.linear2.y = _local15;
m_linearJacobian.angular1 = -(((_local16 * _local15) - (_local17 * _local14)));
m_linearJacobian.angular2 = ((_local8 * _local15) - (_local9 * _local14));
m_linearMass = (((_local10 + ((_local12 * m_linearJacobian.angular1) * m_linearJacobian.angular1)) + _local11) + ((_local13 * m_linearJacobian.angular2) * m_linearJacobian.angular2));
m_linearMass = (1 / m_linearMass);
m_angularMass = (_local12 + _local13);
if (m_angularMass > Number.MIN_VALUE){
m_angularMass = (1 / m_angularMass);
};
if (((m_enableLimit) || (m_enableMotor))){
_local4 = _local2.m_xf.R;
_local18 = ((_local4.col1.x * m_localXAxis1.x) + (_local4.col2.x * m_localXAxis1.y));
_local19 = ((_local4.col1.y * m_localXAxis1.x) + (_local4.col2.y * m_localXAxis1.y));
m_motorJacobian.linear1.x = -(_local18);
m_motorJacobian.linear1.y = -(_local19);
m_motorJacobian.linear2.x = _local18;
m_motorJacobian.linear2.y = _local19;
m_motorJacobian.angular1 = -(((_local16 * _local19) - (_local17 * _local18)));
m_motorJacobian.angular2 = ((_local8 * _local19) - (_local9 * _local18));
m_motorMass = (((_local10 + ((_local12 * m_motorJacobian.angular1) * m_motorJacobian.angular1)) + _local11) + ((_local13 * m_motorJacobian.angular2) * m_motorJacobian.angular2));
m_motorMass = (1 / m_motorMass);
if (m_enableLimit){
_local20 = (_local16 - _local6);
_local21 = (_local17 - _local7);
_local22 = ((_local18 * _local20) + (_local19 * _local21));
if (b2Math.b2Abs((m_upperTranslation - m_lowerTranslation)) < (2 * b2Settings.b2_linearSlop)){
m_limitState = e_equalLimits;
} else {
if (_local22 <= m_lowerTranslation){
if (m_limitState != e_atLowerLimit){
m_limitForce = 0;
};
m_limitState = e_atLowerLimit;
} else {
if (_local22 >= 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 (_arg1.warmStarting){
_local23 = (_arg1.dt * ((m_force * m_linearJacobian.linear1.x) + ((m_motorForce + m_limitForce) * m_motorJacobian.linear1.x)));
_local24 = (_arg1.dt * ((m_force * m_linearJacobian.linear1.y) + ((m_motorForce + m_limitForce) * m_motorJacobian.linear1.y)));
_local25 = (_arg1.dt * ((m_force * m_linearJacobian.linear2.x) + ((m_motorForce + m_limitForce) * m_motorJacobian.linear2.x)));
_local26 = (_arg1.dt * ((m_force * m_linearJacobian.linear2.y) + ((m_motorForce + m_limitForce) * m_motorJacobian.linear2.y)));
_local27 = (_arg1.dt * (((m_force * m_linearJacobian.angular1) - m_torque) + ((m_motorForce + m_limitForce) * m_motorJacobian.angular1)));
_local28 = (_arg1.dt * (((m_force * m_linearJacobian.angular2) + m_torque) + ((m_motorForce + m_limitForce) * m_motorJacobian.angular2)));
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local10 * _local23));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local10 * _local24));
_local2.m_angularVelocity = (_local2.m_angularVelocity + (_local12 * _local27));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + (_local11 * _local25));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + (_local11 * _local26));
_local3.m_angularVelocity = (_local3.m_angularVelocity + (_local13 * _local28));
} 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(_arg1:Number):void{
m_maxMotorForce = _arg1;
}
public function EnableLimit(_arg1:Boolean):void{
m_enableLimit = _arg1;
}
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(_arg1:b2TimeStep):void{
var _local2:b2Body;
var _local3:b2Body;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
_local2 = m_body1;
_local3 = m_body2;
_local4 = _local2.m_invMass;
_local5 = _local3.m_invMass;
_local6 = _local2.m_invI;
_local7 = _local3.m_invI;
_local9 = m_linearJacobian.Compute(_local2.m_linearVelocity, _local2.m_angularVelocity, _local3.m_linearVelocity, _local3.m_angularVelocity);
_local10 = ((-(_arg1.inv_dt) * m_linearMass) * _local9);
m_force = (m_force + _local10);
_local11 = (_arg1.dt * _local10);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + ((_local4 * _local11) * m_linearJacobian.linear1.x));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + ((_local4 * _local11) * m_linearJacobian.linear1.y));
_local2.m_angularVelocity = (_local2.m_angularVelocity + ((_local6 * _local11) * m_linearJacobian.angular1));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_local5 * _local11) * m_linearJacobian.linear2.x));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_local5 * _local11) * m_linearJacobian.linear2.y));
_local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local7 * _local11) * m_linearJacobian.angular2));
_local12 = (_local3.m_angularVelocity - _local2.m_angularVelocity);
_local13 = ((-(_arg1.inv_dt) * m_angularMass) * _local12);
m_torque = (m_torque + _local13);
_local14 = (_arg1.dt * _local13);
_local2.m_angularVelocity = (_local2.m_angularVelocity - (_local6 * _local14));
_local3.m_angularVelocity = (_local3.m_angularVelocity + (_local7 * _local14));
if (((m_enableMotor) && (!((m_limitState == e_equalLimits))))){
_local15 = (m_motorJacobian.Compute(_local2.m_linearVelocity, _local2.m_angularVelocity, _local3.m_linearVelocity, _local3.m_angularVelocity) - m_motorSpeed);
_local16 = ((-(_arg1.inv_dt) * m_motorMass) * _local15);
_local17 = m_motorForce;
m_motorForce = b2Math.b2Clamp((m_motorForce + _local16), -(m_maxMotorForce), m_maxMotorForce);
_local16 = (m_motorForce - _local17);
_local11 = (_arg1.dt * _local16);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + ((_local4 * _local11) * m_motorJacobian.linear1.x));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + ((_local4 * _local11) * m_motorJacobian.linear1.y));
_local2.m_angularVelocity = (_local2.m_angularVelocity + ((_local6 * _local11) * m_motorJacobian.angular1));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_local5 * _local11) * m_motorJacobian.linear2.x));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_local5 * _local11) * m_motorJacobian.linear2.y));
_local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local7 * _local11) * m_motorJacobian.angular2));
};
if (((m_enableLimit) && (!((m_limitState == e_inactiveLimit))))){
_local18 = m_motorJacobian.Compute(_local2.m_linearVelocity, _local2.m_angularVelocity, _local3.m_linearVelocity, _local3.m_angularVelocity);
_local19 = ((-(_arg1.inv_dt) * m_motorMass) * _local18);
if (m_limitState == e_equalLimits){
m_limitForce = (m_limitForce + _local19);
} else {
if (m_limitState == e_atLowerLimit){
_local8 = m_limitForce;
m_limitForce = b2Math.b2Max((m_limitForce + _local19), 0);
_local19 = (m_limitForce - _local8);
} else {
if (m_limitState == e_atUpperLimit){
_local8 = m_limitForce;
m_limitForce = b2Math.b2Min((m_limitForce + _local19), 0);
_local19 = (m_limitForce - _local8);
};
};
};
_local11 = (_arg1.dt * _local19);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + ((_local4 * _local11) * m_motorJacobian.linear1.x));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + ((_local4 * _local11) * m_motorJacobian.linear1.y));
_local2.m_angularVelocity = (_local2.m_angularVelocity + ((_local6 * _local11) * m_motorJacobian.angular1));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_local5 * _local11) * m_motorJacobian.linear2.x));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_local5 * _local11) * m_motorJacobian.linear2.y));
_local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local7 * _local11) * m_motorJacobian.angular2));
};
}
}
}//package Box2D.Dynamics.Joints
Section 59
//b2PrismaticJointDef (Box2D.Dynamics.Joints.b2PrismaticJointDef)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
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(_arg1:b2Body, _arg2:b2Body, _arg3:b2Vec2, _arg4:b2Vec2):void{
body1 = _arg1;
body2 = _arg2;
localAnchor1 = body1.GetLocalPoint(_arg3);
localAnchor2 = body2.GetLocalPoint(_arg3);
localAxis1 = body1.GetLocalVector(_arg4);
referenceAngle = (body2.GetAngle() - body1.GetAngle());
}
}
}//package Box2D.Dynamics.Joints
Section 60
//b2PulleyJoint (Box2D.Dynamics.Joints.b2PulleyJoint)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
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(_arg1:b2PulleyJointDef){
var _local2:b2Mat22;
var _local3:Number;
var _local4: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(_arg1);
m_ground = m_body1.m_world.m_groundBody;
m_groundAnchor1.x = (_arg1.groundAnchor1.x - m_ground.m_xf.position.x);
m_groundAnchor1.y = (_arg1.groundAnchor1.y - m_ground.m_xf.position.y);
m_groundAnchor2.x = (_arg1.groundAnchor2.x - m_ground.m_xf.position.x);
m_groundAnchor2.y = (_arg1.groundAnchor2.y - m_ground.m_xf.position.y);
m_localAnchor1.SetV(_arg1.localAnchor1);
m_localAnchor2.SetV(_arg1.localAnchor2);
m_ratio = _arg1.ratio;
m_constant = (_arg1.length1 + (m_ratio * _arg1.length2));
m_maxLength1 = b2Math.b2Min(_arg1.maxLength1, (m_constant - (m_ratio * b2_minPulleyLength)));
m_maxLength2 = b2Math.b2Min(_arg1.maxLength2, ((m_constant - b2_minPulleyLength) / m_ratio));
m_force = 0;
m_limitForce1 = 0;
m_limitForce2 = 0;
}
public function GetGroundAnchor2():b2Vec2{
var _local1:b2Vec2;
_local1 = m_ground.m_xf.position.Copy();
_local1.Add(m_groundAnchor2);
return (_local1);
}
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 _local1:b2Vec2;
_local1 = m_u2.Copy();
_local1.Multiply(m_force);
return (_local1);
}
override public function SolvePositionConstraints():Boolean{
var _local1:b2Body;
var _local2:b2Body;
var _local3:b2Mat22;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:Number;
_local1 = m_body1;
_local2 = m_body2;
_local4 = (m_ground.m_xf.position.x + m_groundAnchor1.x);
_local5 = (m_ground.m_xf.position.y + m_groundAnchor1.y);
_local6 = (m_ground.m_xf.position.x + m_groundAnchor2.x);
_local7 = (m_ground.m_xf.position.y + m_groundAnchor2.y);
_local23 = 0;
if (m_state == e_atUpperLimit){
_local3 = _local1.m_xf.R;
_local8 = (m_localAnchor1.x - _local1.m_sweep.localCenter.x);
_local9 = (m_localAnchor1.y - _local1.m_sweep.localCenter.y);
_local22 = ((_local3.col1.x * _local8) + (_local3.col2.x * _local9));
_local9 = ((_local3.col1.y * _local8) + (_local3.col2.y * _local9));
_local8 = _local22;
_local3 = _local2.m_xf.R;
_local10 = (m_localAnchor2.x - _local2.m_sweep.localCenter.x);
_local11 = (m_localAnchor2.y - _local2.m_sweep.localCenter.y);
_local22 = ((_local3.col1.x * _local10) + (_local3.col2.x * _local11));
_local11 = ((_local3.col1.y * _local10) + (_local3.col2.y * _local11));
_local10 = _local22;
_local12 = (_local1.m_sweep.c.x + _local8);
_local13 = (_local1.m_sweep.c.y + _local9);
_local14 = (_local2.m_sweep.c.x + _local10);
_local15 = (_local2.m_sweep.c.y + _local11);
m_u1.Set((_local12 - _local4), (_local13 - _local5));
m_u2.Set((_local14 - _local6), (_local15 - _local7));
_local16 = m_u1.Length();
_local17 = m_u2.Length();
if (_local16 > b2Settings.b2_linearSlop){
m_u1.Multiply((1 / _local16));
} else {
m_u1.SetZero();
};
if (_local17 > b2Settings.b2_linearSlop){
m_u2.Multiply((1 / _local17));
} else {
m_u2.SetZero();
};
_local18 = ((m_constant - _local16) - (m_ratio * _local17));
_local23 = b2Math.b2Max(_local23, -(_local18));
_local18 = b2Math.b2Clamp((_local18 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0);
_local19 = (-(m_pulleyMass) * _local18);
_local20 = m_positionImpulse;
m_positionImpulse = b2Math.b2Max(0, (m_positionImpulse + _local19));
_local19 = (m_positionImpulse - _local20);
_local12 = (-(_local19) * m_u1.x);
_local13 = (-(_local19) * m_u1.y);
_local14 = ((-(m_ratio) * _local19) * m_u2.x);
_local15 = ((-(m_ratio) * _local19) * m_u2.y);
_local1.m_sweep.c.x = (_local1.m_sweep.c.x + (_local1.m_invMass * _local12));
_local1.m_sweep.c.y = (_local1.m_sweep.c.y + (_local1.m_invMass * _local13));
_local1.m_sweep.a = (_local1.m_sweep.a + (_local1.m_invI * ((_local8 * _local13) - (_local9 * _local12))));
_local2.m_sweep.c.x = (_local2.m_sweep.c.x + (_local2.m_invMass * _local14));
_local2.m_sweep.c.y = (_local2.m_sweep.c.y + (_local2.m_invMass * _local15));
_local2.m_sweep.a = (_local2.m_sweep.a + (_local2.m_invI * ((_local10 * _local15) - (_local11 * _local14))));
_local1.SynchronizeTransform();
_local2.SynchronizeTransform();
};
if (m_limitState1 == e_atUpperLimit){
_local3 = _local1.m_xf.R;
_local8 = (m_localAnchor1.x - _local1.m_sweep.localCenter.x);
_local9 = (m_localAnchor1.y - _local1.m_sweep.localCenter.y);
_local22 = ((_local3.col1.x * _local8) + (_local3.col2.x * _local9));
_local9 = ((_local3.col1.y * _local8) + (_local3.col2.y * _local9));
_local8 = _local22;
_local12 = (_local1.m_sweep.c.x + _local8);
_local13 = (_local1.m_sweep.c.y + _local9);
m_u1.Set((_local12 - _local4), (_local13 - _local5));
_local16 = m_u1.Length();
if (_local16 > b2Settings.b2_linearSlop){
m_u1.x = (m_u1.x * (1 / _local16));
m_u1.y = (m_u1.y * (1 / _local16));
} else {
m_u1.SetZero();
};
_local18 = (m_maxLength1 - _local16);
_local23 = b2Math.b2Max(_local23, -(_local18));
_local18 = b2Math.b2Clamp((_local18 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0);
_local19 = (-(m_limitMass1) * _local18);
_local21 = m_limitPositionImpulse1;
m_limitPositionImpulse1 = b2Math.b2Max(0, (m_limitPositionImpulse1 + _local19));
_local19 = (m_limitPositionImpulse1 - _local21);
_local12 = (-(_local19) * m_u1.x);
_local13 = (-(_local19) * m_u1.y);
_local1.m_sweep.c.x = (_local1.m_sweep.c.x + (_local1.m_invMass * _local12));
_local1.m_sweep.c.y = (_local1.m_sweep.c.y + (_local1.m_invMass * _local13));
_local1.m_sweep.a = (_local1.m_sweep.a + (_local1.m_invI * ((_local8 * _local13) - (_local9 * _local12))));
_local1.SynchronizeTransform();
};
if (m_limitState2 == e_atUpperLimit){
_local3 = _local2.m_xf.R;
_local10 = (m_localAnchor2.x - _local2.m_sweep.localCenter.x);
_local11 = (m_localAnchor2.y - _local2.m_sweep.localCenter.y);
_local22 = ((_local3.col1.x * _local10) + (_local3.col2.x * _local11));
_local11 = ((_local3.col1.y * _local10) + (_local3.col2.y * _local11));
_local10 = _local22;
_local14 = (_local2.m_sweep.c.x + _local10);
_local15 = (_local2.m_sweep.c.y + _local11);
m_u2.Set((_local14 - _local6), (_local15 - _local7));
_local17 = m_u2.Length();
if (_local17 > b2Settings.b2_linearSlop){
m_u2.x = (m_u2.x * (1 / _local17));
m_u2.y = (m_u2.y * (1 / _local17));
} else {
m_u2.SetZero();
};
_local18 = (m_maxLength2 - _local17);
_local23 = b2Math.b2Max(_local23, -(_local18));
_local18 = b2Math.b2Clamp((_local18 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0);
_local19 = (-(m_limitMass2) * _local18);
_local21 = m_limitPositionImpulse2;
m_limitPositionImpulse2 = b2Math.b2Max(0, (m_limitPositionImpulse2 + _local19));
_local19 = (m_limitPositionImpulse2 - _local21);
_local14 = (-(_local19) * m_u2.x);
_local15 = (-(_local19) * m_u2.y);
_local2.m_sweep.c.x = (_local2.m_sweep.c.x + (_local2.m_invMass * _local14));
_local2.m_sweep.c.y = (_local2.m_sweep.c.y + (_local2.m_invMass * _local15));
_local2.m_sweep.a = (_local2.m_sweep.a + (_local2.m_invI * ((_local10 * _local15) - (_local11 * _local14))));
_local2.SynchronizeTransform();
};
return ((_local23 < b2Settings.b2_linearSlop));
}
override public function InitVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Body;
var _local3:b2Body;
var _local4:b2Mat22;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:Number;
var _local26:Number;
_local2 = m_body1;
_local3 = m_body2;
_local4 = _local2.m_xf.R;
_local5 = (m_localAnchor1.x - _local2.m_sweep.localCenter.x);
_local6 = (m_localAnchor1.y - _local2.m_sweep.localCenter.y);
_local7 = ((_local4.col1.x * _local5) + (_local4.col2.x * _local6));
_local6 = ((_local4.col1.y * _local5) + (_local4.col2.y * _local6));
_local5 = _local7;
_local4 = _local3.m_xf.R;
_local8 = (m_localAnchor2.x - _local3.m_sweep.localCenter.x);
_local9 = (m_localAnchor2.y - _local3.m_sweep.localCenter.y);
_local7 = ((_local4.col1.x * _local8) + (_local4.col2.x * _local9));
_local9 = ((_local4.col1.y * _local8) + (_local4.col2.y * _local9));
_local8 = _local7;
_local10 = (_local2.m_sweep.c.x + _local5);
_local11 = (_local2.m_sweep.c.y + _local6);
_local12 = (_local3.m_sweep.c.x + _local8);
_local13 = (_local3.m_sweep.c.y + _local9);
_local14 = (m_ground.m_xf.position.x + m_groundAnchor1.x);
_local15 = (m_ground.m_xf.position.y + m_groundAnchor1.y);
_local16 = (m_ground.m_xf.position.x + m_groundAnchor2.x);
_local17 = (m_ground.m_xf.position.y + m_groundAnchor2.y);
m_u1.Set((_local10 - _local14), (_local11 - _local15));
m_u2.Set((_local12 - _local16), (_local13 - _local17));
_local18 = m_u1.Length();
_local19 = m_u2.Length();
if (_local18 > b2Settings.b2_linearSlop){
m_u1.Multiply((1 / _local18));
} else {
m_u1.SetZero();
};
if (_local19 > b2Settings.b2_linearSlop){
m_u2.Multiply((1 / _local19));
} else {
m_u2.SetZero();
};
_local20 = ((m_constant - _local18) - (m_ratio * _local19));
if (_local20 > 0){
m_state = e_inactiveLimit;
m_force = 0;
} else {
m_state = e_atUpperLimit;
m_positionImpulse = 0;
};
if (_local18 < m_maxLength1){
m_limitState1 = e_inactiveLimit;
m_limitForce1 = 0;
} else {
m_limitState1 = e_atUpperLimit;
m_limitPositionImpulse1 = 0;
};
if (_local19 < m_maxLength2){
m_limitState2 = e_inactiveLimit;
m_limitForce2 = 0;
} else {
m_limitState2 = e_atUpperLimit;
m_limitPositionImpulse2 = 0;
};
_local21 = ((_local5 * m_u1.y) - (_local6 * m_u1.x));
_local22 = ((_local8 * m_u2.y) - (_local9 * m_u2.x));
m_limitMass1 = (_local2.m_invMass + ((_local2.m_invI * _local21) * _local21));
m_limitMass2 = (_local3.m_invMass + ((_local3.m_invI * _local22) * _local22));
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 (_arg1.warmStarting){
_local23 = ((_arg1.dt * (-(m_force) - m_limitForce1)) * m_u1.x);
_local24 = ((_arg1.dt * (-(m_force) - m_limitForce1)) * m_u1.y);
_local25 = ((_arg1.dt * ((-(m_ratio) * m_force) - m_limitForce2)) * m_u2.x);
_local26 = ((_arg1.dt * ((-(m_ratio) * m_force) - m_limitForce2)) * m_u2.y);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local2.m_invMass * _local23));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local2.m_invMass * _local24));
_local2.m_angularVelocity = (_local2.m_angularVelocity + (_local2.m_invI * ((_local5 * _local24) - (_local6 * _local23))));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + (_local3.m_invMass * _local25));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + (_local3.m_invMass * _local26));
_local3.m_angularVelocity = (_local3.m_angularVelocity + (_local3.m_invI * ((_local8 * _local26) - (_local9 * _local25))));
} 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 _local1:b2Vec2;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
_local1 = m_body2.GetWorldPoint(m_localAnchor2);
_local2 = (m_ground.m_xf.position.x + m_groundAnchor2.x);
_local3 = (m_ground.m_xf.position.y + m_groundAnchor2.y);
_local4 = (_local1.x - _local2);
_local5 = (_local1.y - _local3);
return (Math.sqrt(((_local4 * _local4) + (_local5 * _local5))));
}
override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Body;
var _local3:b2Body;
var _local4:b2Mat22;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
_local2 = m_body1;
_local3 = m_body2;
_local4 = _local2.m_xf.R;
_local5 = (m_localAnchor1.x - _local2.m_sweep.localCenter.x);
_local6 = (m_localAnchor1.y - _local2.m_sweep.localCenter.y);
_local7 = ((_local4.col1.x * _local5) + (_local4.col2.x * _local6));
_local6 = ((_local4.col1.y * _local5) + (_local4.col2.y * _local6));
_local5 = _local7;
_local4 = _local3.m_xf.R;
_local8 = (m_localAnchor2.x - _local3.m_sweep.localCenter.x);
_local9 = (m_localAnchor2.y - _local3.m_sweep.localCenter.y);
_local7 = ((_local4.col1.x * _local8) + (_local4.col2.x * _local9));
_local9 = ((_local4.col1.y * _local8) + (_local4.col2.y * _local9));
_local8 = _local7;
if (m_state == e_atUpperLimit){
_local10 = (_local2.m_linearVelocity.x + (-(_local2.m_angularVelocity) * _local6));
_local11 = (_local2.m_linearVelocity.y + (_local2.m_angularVelocity * _local5));
_local12 = (_local3.m_linearVelocity.x + (-(_local3.m_angularVelocity) * _local9));
_local13 = (_local3.m_linearVelocity.y + (_local3.m_angularVelocity * _local8));
_local18 = (-(((m_u1.x * _local10) + (m_u1.y * _local11))) - (m_ratio * ((m_u2.x * _local12) + (m_u2.y * _local13))));
_local19 = ((-(_arg1.inv_dt) * m_pulleyMass) * _local18);
_local20 = m_force;
m_force = b2Math.b2Max(0, (m_force + _local19));
_local19 = (m_force - _local20);
_local14 = ((-(_arg1.dt) * _local19) * m_u1.x);
_local15 = ((-(_arg1.dt) * _local19) * m_u1.y);
_local16 = (((-(_arg1.dt) * m_ratio) * _local19) * m_u2.x);
_local17 = (((-(_arg1.dt) * m_ratio) * _local19) * m_u2.y);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local2.m_invMass * _local14));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local2.m_invMass * _local15));
_local2.m_angularVelocity = (_local2.m_angularVelocity + (_local2.m_invI * ((_local5 * _local15) - (_local6 * _local14))));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + (_local3.m_invMass * _local16));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + (_local3.m_invMass * _local17));
_local3.m_angularVelocity = (_local3.m_angularVelocity + (_local3.m_invI * ((_local8 * _local17) - (_local9 * _local16))));
};
if (m_limitState1 == e_atUpperLimit){
_local10 = (_local2.m_linearVelocity.x + (-(_local2.m_angularVelocity) * _local6));
_local11 = (_local2.m_linearVelocity.y + (_local2.m_angularVelocity * _local5));
_local18 = -(((m_u1.x * _local10) + (m_u1.y * _local11)));
_local19 = ((-(_arg1.inv_dt) * m_limitMass1) * _local18);
_local20 = m_limitForce1;
m_limitForce1 = b2Math.b2Max(0, (m_limitForce1 + _local19));
_local19 = (m_limitForce1 - _local20);
_local14 = ((-(_arg1.dt) * _local19) * m_u1.x);
_local15 = ((-(_arg1.dt) * _local19) * m_u1.y);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local2.m_invMass * _local14));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local2.m_invMass * _local15));
_local2.m_angularVelocity = (_local2.m_angularVelocity + (_local2.m_invI * ((_local5 * _local15) - (_local6 * _local14))));
};
if (m_limitState2 == e_atUpperLimit){
_local12 = (_local3.m_linearVelocity.x + (-(_local3.m_angularVelocity) * _local9));
_local13 = (_local3.m_linearVelocity.y + (_local3.m_angularVelocity * _local8));
_local18 = -(((m_u2.x * _local12) + (m_u2.y * _local13)));
_local19 = ((-(_arg1.inv_dt) * m_limitMass2) * _local18);
_local20 = m_limitForce2;
m_limitForce2 = b2Math.b2Max(0, (m_limitForce2 + _local19));
_local19 = (m_limitForce2 - _local20);
_local16 = ((-(_arg1.dt) * _local19) * m_u2.x);
_local17 = ((-(_arg1.dt) * _local19) * m_u2.y);
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + (_local3.m_invMass * _local16));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + (_local3.m_invMass * _local17));
_local3.m_angularVelocity = (_local3.m_angularVelocity + (_local3.m_invI * ((_local8 * _local17) - (_local9 * _local16))));
};
}
public function GetLength1():Number{
var _local1:b2Vec2;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
_local1 = m_body1.GetWorldPoint(m_localAnchor1);
_local2 = (m_ground.m_xf.position.x + m_groundAnchor1.x);
_local3 = (m_ground.m_xf.position.y + m_groundAnchor1.y);
_local4 = (_local1.x - _local2);
_local5 = (_local1.y - _local3);
return (Math.sqrt(((_local4 * _local4) + (_local5 * _local5))));
}
public function GetGroundAnchor1():b2Vec2{
var _local1:b2Vec2;
_local1 = m_ground.m_xf.position.Copy();
_local1.Add(m_groundAnchor1);
return (_local1);
}
}
}//package Box2D.Dynamics.Joints
Section 61
//b2PulleyJointDef (Box2D.Dynamics.Joints.b2PulleyJointDef)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
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(_arg1:b2Body, _arg2:b2Body, _arg3:b2Vec2, _arg4:b2Vec2, _arg5:b2Vec2, _arg6:b2Vec2, _arg7:Number):void{
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
body1 = _arg1;
body2 = _arg2;
groundAnchor1.SetV(_arg3);
groundAnchor2.SetV(_arg4);
localAnchor1 = body1.GetLocalPoint(_arg5);
localAnchor2 = body2.GetLocalPoint(_arg6);
_local8 = (_arg5.x - _arg3.x);
_local9 = (_arg5.y - _arg3.y);
length1 = Math.sqrt(((_local8 * _local8) + (_local9 * _local9)));
_local10 = (_arg6.x - _arg4.x);
_local11 = (_arg6.y - _arg4.y);
length2 = Math.sqrt(((_local10 * _local10) + (_local11 * _local11)));
ratio = _arg7;
_local12 = (length1 + (ratio * length2));
maxLength1 = (_local12 - (ratio * b2PulleyJoint.b2_minPulleyLength));
maxLength2 = ((_local12 - b2PulleyJoint.b2_minPulleyLength) / ratio);
}
}
}//package Box2D.Dynamics.Joints
Section 62
//b2RevoluteJoint (Box2D.Dynamics.Joints.b2RevoluteJoint)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
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(_arg1: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(_arg1);
m_localAnchor1.SetV(_arg1.localAnchor1);
m_localAnchor2.SetV(_arg1.localAnchor2);
m_referenceAngle = _arg1.referenceAngle;
m_pivotForce.Set(0, 0);
m_motorForce = 0;
m_limitForce = 0;
m_limitPositionImpulse = 0;
m_lowerAngle = _arg1.lowerAngle;
m_upperAngle = _arg1.upperAngle;
m_maxMotorTorque = _arg1.maxMotorTorque;
m_motorSpeed = _arg1.motorSpeed;
m_enableLimit = _arg1.enableLimit;
m_enableMotor = _arg1.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(_arg1:Boolean):void{
m_enableMotor = _arg1;
}
public function GetUpperLimit():Number{
return (m_upperAngle);
}
public function GetLowerLimit():Number{
return (m_lowerAngle);
}
public function SetLimits(_arg1:Number, _arg2:Number):void{
m_lowerAngle = _arg1;
m_upperAngle = _arg2;
}
public function GetMotorSpeed():Number{
return (m_motorSpeed);
}
override public function GetReactionForce():b2Vec2{
return (m_pivotForce);
}
override public function SolvePositionConstraints():Boolean{
var _local1:Number;
var _local2:Number;
var _local3:b2Body;
var _local4:b2Body;
var _local5:Number;
var _local6:b2Mat22;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:Number;
var _local26:Number;
_local3 = m_body1;
_local4 = m_body2;
_local5 = 0;
_local6 = _local3.m_xf.R;
_local7 = (m_localAnchor1.x - _local3.m_sweep.localCenter.x);
_local8 = (m_localAnchor1.y - _local3.m_sweep.localCenter.y);
_local9 = ((_local6.col1.x * _local7) + (_local6.col2.x * _local8));
_local8 = ((_local6.col1.y * _local7) + (_local6.col2.y * _local8));
_local7 = _local9;
_local6 = _local4.m_xf.R;
_local10 = (m_localAnchor2.x - _local4.m_sweep.localCenter.x);
_local11 = (m_localAnchor2.y - _local4.m_sweep.localCenter.y);
_local9 = ((_local6.col1.x * _local10) + (_local6.col2.x * _local11));
_local11 = ((_local6.col1.y * _local10) + (_local6.col2.y * _local11));
_local10 = _local9;
_local12 = (_local3.m_sweep.c.x + _local7);
_local13 = (_local3.m_sweep.c.y + _local8);
_local14 = (_local4.m_sweep.c.x + _local10);
_local15 = (_local4.m_sweep.c.y + _local11);
_local16 = (_local14 - _local12);
_local17 = (_local15 - _local13);
_local5 = Math.sqrt(((_local16 * _local16) + (_local17 * _local17)));
_local18 = _local3.m_invMass;
_local19 = _local4.m_invMass;
_local20 = _local3.m_invI;
_local21 = _local4.m_invI;
K1.col1.x = (_local18 + _local19);
K1.col2.x = 0;
K1.col1.y = 0;
K1.col2.y = (_local18 + _local19);
K2.col1.x = ((_local20 * _local8) * _local8);
K2.col2.x = ((-(_local20) * _local7) * _local8);
K2.col1.y = ((-(_local20) * _local7) * _local8);
K2.col2.y = ((_local20 * _local7) * _local7);
K3.col1.x = ((_local21 * _local11) * _local11);
K3.col2.x = ((-(_local21) * _local10) * _local11);
K3.col1.y = ((-(_local21) * _local10) * _local11);
K3.col2.y = ((_local21 * _local10) * _local10);
K.SetM(K1);
K.AddM(K2);
K.AddM(K3);
K.Solve(tImpulse, -(_local16), -(_local17));
_local22 = tImpulse.x;
_local23 = tImpulse.y;
_local3.m_sweep.c.x = (_local3.m_sweep.c.x - (_local3.m_invMass * _local22));
_local3.m_sweep.c.y = (_local3.m_sweep.c.y - (_local3.m_invMass * _local23));
_local3.m_sweep.a = (_local3.m_sweep.a - (_local3.m_invI * ((_local7 * _local23) - (_local8 * _local22))));
_local4.m_sweep.c.x = (_local4.m_sweep.c.x + (_local4.m_invMass * _local22));
_local4.m_sweep.c.y = (_local4.m_sweep.c.y + (_local4.m_invMass * _local23));
_local4.m_sweep.a = (_local4.m_sweep.a + (_local4.m_invI * ((_local10 * _local23) - (_local11 * _local22))));
_local3.SynchronizeTransform();
_local4.SynchronizeTransform();
_local24 = 0;
if (((m_enableLimit) && (!((m_limitState == e_inactiveLimit))))){
_local25 = ((_local4.m_sweep.a - _local3.m_sweep.a) - m_referenceAngle);
_local26 = 0;
if (m_limitState == e_equalLimits){
_local2 = b2Math.b2Clamp(_local25, -(b2Settings.b2_maxAngularCorrection), b2Settings.b2_maxAngularCorrection);
_local26 = (-(m_motorMass) * _local2);
_local24 = b2Math.b2Abs(_local2);
} else {
if (m_limitState == e_atLowerLimit){
_local2 = (_local25 - m_lowerAngle);
_local24 = b2Math.b2Max(0, -(_local2));
_local2 = b2Math.b2Clamp((_local2 + b2Settings.b2_angularSlop), -(b2Settings.b2_maxAngularCorrection), 0);
_local26 = (-(m_motorMass) * _local2);
_local1 = m_limitPositionImpulse;
m_limitPositionImpulse = b2Math.b2Max((m_limitPositionImpulse + _local26), 0);
_local26 = (m_limitPositionImpulse - _local1);
} else {
if (m_limitState == e_atUpperLimit){
_local2 = (_local25 - m_upperAngle);
_local24 = b2Math.b2Max(0, _local2);
_local2 = b2Math.b2Clamp((_local2 - b2Settings.b2_angularSlop), 0, b2Settings.b2_maxAngularCorrection);
_local26 = (-(m_motorMass) * _local2);
_local1 = m_limitPositionImpulse;
m_limitPositionImpulse = b2Math.b2Min((m_limitPositionImpulse + _local26), 0);
_local26 = (m_limitPositionImpulse - _local1);
};
};
};
_local3.m_sweep.a = (_local3.m_sweep.a - (_local3.m_invI * _local26));
_local4.m_sweep.a = (_local4.m_sweep.a + (_local4.m_invI * _local26));
_local3.SynchronizeTransform();
_local4.SynchronizeTransform();
};
return ((((_local5 <= b2Settings.b2_linearSlop)) && ((_local24 <= b2Settings.b2_angularSlop))));
}
public function GetJointSpeed():Number{
return ((m_body2.m_angularVelocity - m_body1.m_angularVelocity));
}
public function SetMotorSpeed(_arg1:Number):void{
m_motorSpeed = _arg1;
}
public function SetMaxMotorTorque(_arg1:Number):void{
m_maxMotorTorque = _arg1;
}
public function GetJointAngle():Number{
return (((m_body2.m_sweep.a - m_body1.m_sweep.a) - m_referenceAngle));
}
override public function InitVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Body;
var _local3:b2Body;
var _local4:b2Mat22;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
_local2 = m_body1;
_local3 = m_body2;
_local4 = _local2.m_xf.R;
_local6 = (m_localAnchor1.x - _local2.m_sweep.localCenter.x);
_local7 = (m_localAnchor1.y - _local2.m_sweep.localCenter.y);
_local5 = ((_local4.col1.x * _local6) + (_local4.col2.x * _local7));
_local7 = ((_local4.col1.y * _local6) + (_local4.col2.y * _local7));
_local6 = _local5;
_local4 = _local3.m_xf.R;
_local8 = (m_localAnchor2.x - _local3.m_sweep.localCenter.x);
_local9 = (m_localAnchor2.y - _local3.m_sweep.localCenter.y);
_local5 = ((_local4.col1.x * _local8) + (_local4.col2.x * _local9));
_local9 = ((_local4.col1.y * _local8) + (_local4.col2.y * _local9));
_local8 = _local5;
_local10 = _local2.m_invMass;
_local11 = _local3.m_invMass;
_local12 = _local2.m_invI;
_local13 = _local3.m_invI;
K1.col1.x = (_local10 + _local11);
K1.col2.x = 0;
K1.col1.y = 0;
K1.col2.y = (_local10 + _local11);
K2.col1.x = ((_local12 * _local7) * _local7);
K2.col2.x = ((-(_local12) * _local6) * _local7);
K2.col1.y = ((-(_local12) * _local6) * _local7);
K2.col2.y = ((_local12 * _local6) * _local6);
K3.col1.x = ((_local13 * _local9) * _local9);
K3.col2.x = ((-(_local13) * _local8) * _local9);
K3.col1.y = ((-(_local13) * _local8) * _local9);
K3.col2.y = ((_local13 * _local8) * _local8);
K.SetM(K1);
K.AddM(K2);
K.AddM(K3);
K.Invert(m_pivotMass);
m_motorMass = (1 / (_local12 + _local13));
if (m_enableMotor == false){
m_motorForce = 0;
};
if (m_enableLimit){
_local14 = ((_local3.m_sweep.a - _local2.m_sweep.a) - m_referenceAngle);
if (b2Math.b2Abs((m_upperAngle - m_lowerAngle)) < (2 * b2Settings.b2_angularSlop)){
m_limitState = e_equalLimits;
} else {
if (_local14 <= m_lowerAngle){
if (m_limitState != e_atLowerLimit){
m_limitForce = 0;
};
m_limitState = e_atLowerLimit;
} else {
if (_local14 >= 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 (_arg1.warmStarting){
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x - ((_arg1.dt * _local10) * m_pivotForce.x));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y - ((_arg1.dt * _local10) * m_pivotForce.y));
_local2.m_angularVelocity = (_local2.m_angularVelocity - ((_arg1.dt * _local12) * ((((_local6 * m_pivotForce.y) - (_local7 * m_pivotForce.x)) + m_motorForce) + m_limitForce)));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_arg1.dt * _local11) * m_pivotForce.x));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_arg1.dt * _local11) * m_pivotForce.y));
_local3.m_angularVelocity = (_local3.m_angularVelocity + ((_arg1.dt * _local13) * ((((_local8 * m_pivotForce.y) - (_local9 * m_pivotForce.x)) + m_motorForce) + m_limitForce)));
} else {
m_pivotForce.SetZero();
m_motorForce = 0;
m_limitForce = 0;
};
m_limitPositionImpulse = 0;
}
public function EnableLimit(_arg1:Boolean):void{
m_enableLimit = _arg1;
}
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(_arg1:b2TimeStep):void{
var _local2:b2Body;
var _local3:b2Body;
var _local4:b2Mat22;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
_local2 = m_body1;
_local3 = m_body2;
_local4 = _local2.m_xf.R;
_local6 = (m_localAnchor1.x - _local2.m_sweep.localCenter.x);
_local7 = (m_localAnchor1.y - _local2.m_sweep.localCenter.y);
_local5 = ((_local4.col1.x * _local6) + (_local4.col2.x * _local7));
_local7 = ((_local4.col1.y * _local6) + (_local4.col2.y * _local7));
_local6 = _local5;
_local4 = _local3.m_xf.R;
_local8 = (m_localAnchor2.x - _local3.m_sweep.localCenter.x);
_local9 = (m_localAnchor2.y - _local3.m_sweep.localCenter.y);
_local5 = ((_local4.col1.x * _local8) + (_local4.col2.x * _local9));
_local9 = ((_local4.col1.y * _local8) + (_local4.col2.y * _local9));
_local8 = _local5;
_local11 = (((_local3.m_linearVelocity.x + (-(_local3.m_angularVelocity) * _local9)) - _local2.m_linearVelocity.x) - (-(_local2.m_angularVelocity) * _local7));
_local12 = (((_local3.m_linearVelocity.y + (_local3.m_angularVelocity * _local8)) - _local2.m_linearVelocity.y) - (_local2.m_angularVelocity * _local6));
_local13 = (-(_arg1.inv_dt) * ((m_pivotMass.col1.x * _local11) + (m_pivotMass.col2.x * _local12)));
_local14 = (-(_arg1.inv_dt) * ((m_pivotMass.col1.y * _local11) + (m_pivotMass.col2.y * _local12)));
m_pivotForce.x = (m_pivotForce.x + _local13);
m_pivotForce.y = (m_pivotForce.y + _local14);
_local15 = (_arg1.dt * _local13);
_local16 = (_arg1.dt * _local14);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x - (_local2.m_invMass * _local15));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y - (_local2.m_invMass * _local16));
_local2.m_angularVelocity = (_local2.m_angularVelocity - (_local2.m_invI * ((_local6 * _local16) - (_local7 * _local15))));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + (_local3.m_invMass * _local15));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + (_local3.m_invMass * _local16));
_local3.m_angularVelocity = (_local3.m_angularVelocity + (_local3.m_invI * ((_local8 * _local16) - (_local9 * _local15))));
if (((m_enableMotor) && (!((m_limitState == e_equalLimits))))){
_local17 = ((_local3.m_angularVelocity - _local2.m_angularVelocity) - m_motorSpeed);
_local18 = ((-(_arg1.inv_dt) * m_motorMass) * _local17);
_local19 = m_motorForce;
m_motorForce = b2Math.b2Clamp((m_motorForce + _local18), -(m_maxMotorTorque), m_maxMotorTorque);
_local18 = (m_motorForce - _local19);
_local2.m_angularVelocity = (_local2.m_angularVelocity - ((_local2.m_invI * _arg1.dt) * _local18));
_local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local3.m_invI * _arg1.dt) * _local18));
};
if (((m_enableLimit) && (!((m_limitState == e_inactiveLimit))))){
_local20 = (_local3.m_angularVelocity - _local2.m_angularVelocity);
_local21 = ((-(_arg1.inv_dt) * m_motorMass) * _local20);
if (m_limitState == e_equalLimits){
m_limitForce = (m_limitForce + _local21);
} else {
if (m_limitState == e_atLowerLimit){
_local10 = m_limitForce;
m_limitForce = b2Math.b2Max((m_limitForce + _local21), 0);
_local21 = (m_limitForce - _local10);
} else {
if (m_limitState == e_atUpperLimit){
_local10 = m_limitForce;
m_limitForce = b2Math.b2Min((m_limitForce + _local21), 0);
_local21 = (m_limitForce - _local10);
};
};
};
_local2.m_angularVelocity = (_local2.m_angularVelocity - ((_local2.m_invI * _arg1.dt) * _local21));
_local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local3.m_invI * _arg1.dt) * _local21));
};
}
}
}//package Box2D.Dynamics.Joints
Section 63
//b2RevoluteJointDef (Box2D.Dynamics.Joints.b2RevoluteJointDef)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
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(_arg1:b2Body, _arg2:b2Body, _arg3:b2Vec2):void{
body1 = _arg1;
body2 = _arg2;
localAnchor1 = body1.GetLocalPoint(_arg3);
localAnchor2 = body2.GetLocalPoint(_arg3);
referenceAngle = (body2.GetAngle() - body1.GetAngle());
}
}
}//package Box2D.Dynamics.Joints
Section 64
//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(_arg1:b2BodyDef, _arg2:b2World){
var _local3:b2Mat22;
var _local4:b2Vec2;
m_xf = new b2XForm();
m_sweep = new b2Sweep();
m_linearVelocity = new b2Vec2();
m_force = new b2Vec2();
super();
m_flags = 0;
if (_arg1.isBullet){
m_flags = (m_flags | e_bulletFlag);
};
if (_arg1.fixedRotation){
m_flags = (m_flags | e_fixedRotationFlag);
};
if (_arg1.allowSleep){
m_flags = (m_flags | e_allowSleepFlag);
};
if (_arg1.isSleeping){
m_flags = (m_flags | e_sleepFlag);
};
m_world = _arg2;
m_xf.position.SetV(_arg1.position);
m_xf.R.Set(_arg1.angle);
m_sweep.localCenter.SetV(_arg1.massData.center);
m_sweep.t0 = 1;
m_sweep.a0 = (m_sweep.a = _arg1.angle);
_local3 = m_xf.R;
_local4 = m_sweep.localCenter;
m_sweep.c.x = ((_local3.col1.x * _local4.x) + (_local3.col2.x * _local4.y));
m_sweep.c.y = ((_local3.col1.y * _local4.x) + (_local3.col2.y * _local4.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 = _arg1.linearDamping;
m_angularDamping = _arg1.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 = _arg1.massData.mass;
if (m_mass > 0){
m_invMass = (1 / m_mass);
};
if ((m_flags & b2Body.e_fixedRotationFlag) == 0){
m_I = _arg1.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 = _arg1.userData;
m_shapeList = null;
m_shapeCount = 0;
}
public function GetLinearVelocityFromWorldPoint(_arg1:b2Vec2):b2Vec2{
return (new b2Vec2((m_linearVelocity.x + (m_angularVelocity * (_arg1.y - m_sweep.c.y))), (m_linearVelocity.x - (m_angularVelocity * (_arg1.x - m_sweep.c.x)))));
}
public function SetLinearVelocity(_arg1:b2Vec2):void{
m_linearVelocity.SetV(_arg1);
}
public function WakeUp():void{
m_flags = (m_flags & ~(e_sleepFlag));
m_sleepTime = 0;
}
public function GetLocalCenter():b2Vec2{
return (m_sweep.localCenter);
}
public function ApplyTorque(_arg1:Number):void{
if (IsSleeping()){
WakeUp();
};
m_torque = (m_torque + _arg1);
}
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 _local1:b2Mat22;
var _local2:b2Vec2;
m_xf.R.Set(m_sweep.a);
_local1 = m_xf.R;
_local2 = m_sweep.localCenter;
m_xf.position.x = (m_sweep.c.x - ((_local1.col1.x * _local2.x) + (_local1.col2.x * _local2.y)));
m_xf.position.y = (m_sweep.c.y - ((_local1.col1.y * _local2.x) + (_local1.col2.y * _local2.y)));
}
public function GetInertia():Number{
return (m_I);
}
public function IsSleeping():Boolean{
return (((m_flags & e_sleepFlag) == e_sleepFlag));
}
public function SetMassFromShapes():void{
var _local1:b2Shape;
var _local2:Number;
var _local3:Number;
var _local4:b2MassData;
var _local5:b2Mat22;
var _local6:b2Vec2;
var _local7:int;
if (m_world.m_lock == true){
return;
};
m_mass = 0;
m_invMass = 0;
m_I = 0;
m_invI = 0;
_local2 = 0;
_local3 = 0;
_local4 = s_massData;
_local1 = m_shapeList;
while (_local1) {
_local1.ComputeMass(_local4);
m_mass = (m_mass + _local4.mass);
_local2 = (_local2 + (_local4.mass * _local4.center.x));
_local3 = (_local3 + (_local4.mass * _local4.center.y));
m_I = (m_I + _local4.I);
_local1 = _local1.m_next;
};
if (m_mass > 0){
m_invMass = (1 / m_mass);
_local2 = (_local2 * m_invMass);
_local3 = (_local3 * m_invMass);
};
if ((((m_I > 0)) && (((m_flags & e_fixedRotationFlag) == 0)))){
m_I = (m_I - (m_mass * ((_local2 * _local2) + (_local3 * _local3))));
m_invI = (1 / m_I);
} else {
m_I = 0;
m_invI = 0;
};
m_sweep.localCenter.Set(_local2, _local3);
_local5 = m_xf.R;
_local6 = m_sweep.localCenter;
m_sweep.c.x = ((_local5.col1.x * _local6.x) + (_local5.col2.x * _local6.y));
m_sweep.c.y = ((_local5.col1.y * _local6.x) + (_local5.col2.y * _local6.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);
_local1 = m_shapeList;
while (_local1) {
_local1.UpdateSweepRadius(m_sweep.localCenter);
_local1 = _local1.m_next;
};
_local7 = m_type;
if ((((m_invMass == 0)) && ((m_invI == 0)))){
m_type = e_staticType;
} else {
m_type = e_dynamicType;
};
if (_local7 != m_type){
_local1 = m_shapeList;
while (_local1) {
_local1.RefilterProxy(m_world.m_broadPhase, m_xf);
_local1 = _local1.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(_arg1:b2Vec2, _arg2:Number):Boolean{
var _local3:b2Shape;
var _local4:b2Mat22;
var _local5:b2Vec2;
var _local6:Boolean;
var _local7:Boolean;
if (m_world.m_lock == true){
return (true);
};
if (IsFrozen()){
return (false);
};
m_xf.R.Set(_arg2);
m_xf.position.SetV(_arg1);
_local4 = m_xf.R;
_local5 = m_sweep.localCenter;
m_sweep.c.x = ((_local4.col1.x * _local5.x) + (_local4.col2.x * _local5.y));
m_sweep.c.y = ((_local4.col1.y * _local5.x) + (_local4.col2.y * _local5.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 = _arg2);
_local6 = false;
_local3 = m_shapeList;
while (_local3) {
_local7 = _local3.Synchronize(m_world.m_broadPhase, m_xf, m_xf);
if (_local7 == false){
_local6 = true;
break;
};
_local3 = _local3.m_next;
};
if (_local6 == true){
m_flags = (m_flags | e_frozenFlag);
m_linearVelocity.SetZero();
m_angularVelocity = 0;
_local3 = m_shapeList;
while (_local3) {
_local3.DestroyProxy(m_world.m_broadPhase);
_local3 = _local3.m_next;
};
return (false);
};
m_world.m_broadPhase.Commit();
return (true);
}
public function GetLocalPoint(_arg1:b2Vec2):b2Vec2{
return (b2Math.b2MulXT(m_xf, _arg1));
}
public function ApplyForce(_arg1:b2Vec2, _arg2:b2Vec2):void{
if (IsSleeping()){
WakeUp();
};
m_force.x = (m_force.x + _arg1.x);
m_force.y = (m_force.y + _arg1.y);
m_torque = (m_torque + (((_arg2.x - m_sweep.c.x) * _arg1.y) - ((_arg2.y - m_sweep.c.y) * _arg1.x)));
}
public function SynchronizeShapes():Boolean{
var _local1:b2XForm;
var _local2:b2Mat22;
var _local3:b2Vec2;
var _local4:b2Shape;
var _local5:Boolean;
_local1 = s_xf1;
_local1.R.Set(m_sweep.a0);
_local2 = _local1.R;
_local3 = m_sweep.localCenter;
_local1.position.x = (m_sweep.c0.x - ((_local2.col1.x * _local3.x) + (_local2.col2.x * _local3.y)));
_local1.position.y = (m_sweep.c0.y - ((_local2.col1.y * _local3.x) + (_local2.col2.y * _local3.y)));
_local5 = true;
_local4 = m_shapeList;
while (_local4) {
_local5 = _local4.Synchronize(m_world.m_broadPhase, _local1, m_xf);
if (_local5 == false){
break;
};
_local4 = _local4.m_next;
};
if (_local5 == false){
m_flags = (m_flags | e_frozenFlag);
m_linearVelocity.SetZero();
m_angularVelocity = 0;
_local4 = m_shapeList;
while (_local4) {
_local4.DestroyProxy(m_world.m_broadPhase);
_local4 = _local4.m_next;
};
return (false);
};
return (true);
}
public function GetAngle():Number{
return (m_sweep.a);
}
public function GetXForm():b2XForm{
return (m_xf);
}
public function ApplyImpulse(_arg1:b2Vec2, _arg2:b2Vec2):void{
if (IsSleeping()){
WakeUp();
};
m_linearVelocity.x = (m_linearVelocity.x + (m_invMass * _arg1.x));
m_linearVelocity.y = (m_linearVelocity.y + (m_invMass * _arg1.y));
m_angularVelocity = (m_angularVelocity + (m_invI * (((_arg2.x - m_sweep.c.x) * _arg1.y) - ((_arg2.y - m_sweep.c.y) * _arg1.x))));
}
public function GetNext():b2Body{
return (m_next);
}
public function GetMass():Number{
return (m_mass);
}
public function GetLinearVelocityFromLocalPoint(_arg1:b2Vec2):b2Vec2{
var _local2:b2Mat22;
var _local3:b2Vec2;
_local2 = m_xf.R;
_local3 = new b2Vec2(((_local2.col1.x * _arg1.x) + (_local2.col2.x * _arg1.y)), ((_local2.col1.y * _arg1.x) + (_local2.col2.y * _arg1.y)));
_local3.x = (_local3.x + m_xf.position.x);
_local3.y = (_local3.y + m_xf.position.y);
return (new b2Vec2((m_linearVelocity.x + (m_angularVelocity * (_local3.y - m_sweep.c.y))), (m_linearVelocity.x - (m_angularVelocity * (_local3.x - m_sweep.c.x)))));
}
public function GetAngularVelocity():Number{
return (m_angularVelocity);
}
public function SetAngularVelocity(_arg1:Number):void{
m_angularVelocity = _arg1;
}
public function SetMass(_arg1:b2MassData):void{
var _local2:b2Shape;
var _local3:b2Mat22;
var _local4:b2Vec2;
var _local5:int;
if (m_world.m_lock == true){
return;
};
m_invMass = 0;
m_I = 0;
m_invI = 0;
m_mass = _arg1.mass;
if (m_mass > 0){
m_invMass = (1 / m_mass);
};
if ((m_flags & b2Body.e_fixedRotationFlag) == 0){
m_I = _arg1.I;
};
if (m_I > 0){
m_invI = (1 / m_I);
};
m_sweep.localCenter.SetV(_arg1.center);
_local3 = m_xf.R;
_local4 = m_sweep.localCenter;
m_sweep.c.x = ((_local3.col1.x * _local4.x) + (_local3.col2.x * _local4.y));
m_sweep.c.y = ((_local3.col1.y * _local4.x) + (_local3.col2.y * _local4.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);
_local2 = m_shapeList;
while (_local2) {
_local2.UpdateSweepRadius(m_sweep.localCenter);
_local2 = _local2.m_next;
};
_local5 = m_type;
if ((((m_invMass == 0)) && ((m_invI == 0)))){
m_type = e_staticType;
} else {
m_type = e_dynamicType;
};
if (_local5 != m_type){
_local2 = m_shapeList;
while (_local2) {
_local2.RefilterProxy(m_world.m_broadPhase, m_xf);
_local2 = _local2.m_next;
};
};
}
public function IsStatic():Boolean{
return ((m_type == e_staticType));
}
public function GetWorldVector(_arg1:b2Vec2):b2Vec2{
return (b2Math.b2MulMV(m_xf.R, _arg1));
}
public function GetShapeList():b2Shape{
return (m_shapeList);
}
public function Advance(_arg1:Number):void{
m_sweep.Advance(_arg1);
m_sweep.c.SetV(m_sweep.c0);
m_sweep.a = m_sweep.a0;
SynchronizeTransform();
}
public function SetBullet(_arg1:Boolean):void{
if (_arg1){
m_flags = (m_flags | e_bulletFlag);
} else {
m_flags = (m_flags & ~(e_bulletFlag));
};
}
public function CreateShape(_arg1:b2ShapeDef):b2Shape{
var _local2:b2Shape;
if (m_world.m_lock == true){
return (null);
};
_local2 = b2Shape.Create(_arg1, m_world.m_blockAllocator);
_local2.m_next = m_shapeList;
m_shapeList = _local2;
m_shapeCount++;
_local2.m_body = this;
_local2.CreateProxy(m_world.m_broadPhase, m_xf);
_local2.UpdateSweepRadius(m_sweep.localCenter);
return (_local2);
}
public function IsConnected(_arg1:b2Body):Boolean{
var _local2:b2JointEdge;
_local2 = m_jointList;
while (_local2) {
if (_local2.other == _arg1){
return ((_local2.joint.m_collideConnected == false));
};
_local2 = _local2.next;
};
return (false);
}
public function DestroyShape(_arg1:b2Shape):void{
var _local2:b2Shape;
var _local3:b2Shape;
var _local4:Boolean;
if (m_world.m_lock == true){
return;
};
_arg1.DestroyProxy(m_world.m_broadPhase);
_local2 = m_shapeList;
_local3 = null;
_local4 = false;
while (_local2 != null) {
if (_local2 == _arg1){
if (_local3){
_local3.m_next = _arg1.m_next;
} else {
m_shapeList = _arg1.m_next;
};
_local4 = true;
break;
};
_local3 = _local2;
_local2 = _local2.m_next;
};
_arg1.m_body = null;
_arg1.m_next = null;
m_shapeCount--;
b2Shape.Destroy(_arg1, 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(_arg1:Boolean):void{
if (_arg1){
m_flags = (m_flags | e_allowSleepFlag);
} else {
m_flags = (m_flags & ~(e_allowSleepFlag));
WakeUp();
};
}
public function SetUserData(_arg1):void{
m_userData = _arg1;
}
public function GetLocalVector(_arg1:b2Vec2):b2Vec2{
return (b2Math.b2MulTMV(m_xf.R, _arg1));
}
public function GetWorldPoint(_arg1:b2Vec2):b2Vec2{
var _local2:b2Mat22;
var _local3:b2Vec2;
_local2 = m_xf.R;
_local3 = new b2Vec2(((_local2.col1.x * _arg1.x) + (_local2.col2.x * _arg1.y)), ((_local2.col1.y * _arg1.x) + (_local2.col2.y * _arg1.y)));
_local3.x = (_local3.x + m_xf.position.x);
_local3.y = (_local3.y + m_xf.position.y);
return (_local3);
}
public function GetWorld():b2World{
return (m_world);
}
public function GetPosition():b2Vec2{
return (m_xf.position);
}
}
}//package Box2D.Dynamics
Section 65
//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 66
//b2BoundaryListener (Box2D.Dynamics.b2BoundaryListener)
package Box2D.Dynamics {
public class b2BoundaryListener {
public function Violation(_arg1:b2Body):void{
}
}
}//package Box2D.Dynamics
Section 67
//b2ContactFilter (Box2D.Dynamics.b2ContactFilter)
package Box2D.Dynamics {
import Box2D.Common.Math.*;
import Box2D.Collision.Shapes.*;
import Box2D.Collision.*;
import Box2D.Common.*;
import Box2D.Dynamics.Contacts.*;
public class b2ContactFilter {
public static var b2_defaultFilter:b2ContactFilter = new (b2ContactFilter);
;
function checkForBadKnights(_arg1, _arg2){
if (_arg2.myType != "floor"){
if (_arg2.goodBad == true){
return (true);
};
};
return (false);
}
function checkForKnights(_arg1, _arg2){
if (_arg2.myType != "floor"){
if (_arg2.goodBad == false){
if (_arg2.myType != "potion3"){
return (true);
};
};
};
return (false);
}
function checkForBoulders(_arg1, _arg2){
if (_arg2.myType != "floor"){
if (_arg2.myType != "catapultRod"){
if (_arg2.myType != "catapultCup"){
if (_arg2.myType != "catapultBase"){
if (_arg2.goodBad == false){
return (true);
};
};
};
};
};
return (false);
}
public function ShouldCollide(_arg1:b2Shape, _arg2:b2Shape):Boolean{
var _local3:*;
var _local4:Boolean;
var _local5:b2FilterData;
var _local6:b2FilterData;
var _local7:Boolean;
var _local8:*;
var _local9:*;
if (_arg1.m_body.m_userData != null){
_local3 = _arg1.m_body.m_userData.rt;
} else {
if (_arg2.m_body.m_userData != null){
_local3 = _arg2.m_body.m_userData.rt;
};
};
_local4 = false;
if (_local3 != null){
if (_local3.bodyGrabbed == _arg1.m_body){
_local4 = true;
} else {
if (_local3.bodyGrabbed == _arg2.m_body){
_local4 = true;
};
};
};
if (_local4 == false){
if (_arg1.m_body.m_userData != null){
if (_arg1.m_body.m_userData.myType == "archer"){
};
};
if (_arg2.m_body.m_userData != null){
if (_arg2.m_body.m_userData.myType == "archer"){
};
};
if (_arg1.m_body.m_userData != null){
if (_arg1.m_body.m_userData.myType == "block"){
if (_arg1.m_body.m_userData.currentFrame > 1){
if (_arg2.m_body.m_userData.myType != "blockEnemy"){
if (_arg2.m_body.m_userData.myType != "block"){
if (_arg2.m_body.m_userData.myType != "wood"){
if (_arg2.m_body.m_userData.myType != "foor"){
if (_arg2.m_body.m_userData.goodBad == false){
return (false);
};
};
};
};
};
};
} else {
if (_arg1.m_body.m_userData.myType == "blockEnemy"){
if (_arg1.m_body.m_userData.currentFrame > 1){
if (_arg2.m_body.m_userData.myType != "block"){
if (_arg2.m_body.m_userData.myType != "blockEnemy"){
if (_arg2.m_body.m_userData.myType != "wood"){
if (_arg2.m_body.m_userData.myType != "foor"){
if (_arg2.m_body.m_userData.goodBad == true){
return (false);
};
};
};
};
};
};
} else {
if (_arg2.m_body.m_userData.myType == "block"){
if (_arg2.m_body.m_userData.currentFrame > 1){
if (_arg1.m_body.m_userData.myType != "block"){
if (_arg1.m_body.m_userData.myType != "blockEnemy"){
if (_arg1.m_body.m_userData.myType != "wood"){
if (_arg1.m_body.m_userData.myType != "floor"){
if (_arg1.m_body.m_userData.goodBad == false){
return (false);
};
};
};
};
};
};
} else {
if (_arg2.m_body.m_userData.myType == "blockEnemy"){
if (_arg2.m_body.m_userData.currentFrame > 1){
if (_arg1.m_body.m_userData.myType != "block"){
if (_arg1.m_body.m_userData.myType != "blockEnemy"){
if (_arg1.m_body.m_userData.myType != "wood"){
if (_arg1.m_body.m_userData.myType != "floor"){
if (_arg1.m_body.m_userData.goodBad == true){
return (false);
};
};
};
};
};
};
} else {
if (_arg1.m_body.m_userData.myType == "kingBad1"){
if (_arg2.m_body.m_userData.goodBad == true){
return (false);
};
} else {
if (_arg2.m_body.m_userData.myType == "kingBad1"){
if (_arg1.m_body.m_userData.goodBad == true){
return (false);
};
};
};
};
};
};
};
_local8 = _arg1.m_body.m_userData;
_local9 = _arg2.m_body.m_userData;
if (_arg1.m_body.m_userData.myType == "knight"){
if (checkForKnights(_local8, _local9)){
return (false);
};
} else {
if (_arg2.m_body.m_userData.myType == "knight"){
if (checkForKnights(_local9, _local8)){
return (false);
};
};
};
if (_arg1.m_body.m_userData.myType == "badKnight2"){
if (checkForBadKnights(_local8, _local9)){
return (false);
};
} else {
if (_arg2.m_body.m_userData.myType == "badKnight2"){
if (checkForBadKnights(_local9, _local8)){
return (false);
};
};
};
if (_arg1.m_body.m_userData.myType == "badKnight1"){
if (checkForBadKnights(_local8, _local9)){
return (false);
};
} else {
if (_arg2.m_body.m_userData.myType == "badKnight1"){
if (checkForBadKnights(_local9, _local8)){
return (false);
};
};
};
if (_arg1.m_body.m_userData.myType == "boulder"){
if (checkForBoulders(_local8, _local9)){
return (false);
};
} else {
if (_arg2.m_body.m_userData.myType == "boulder"){
if (checkForBoulders(_local9, _local8)){
return (false);
};
};
};
if (_arg1.m_body.m_userData.myType == "cannonBall"){
if (checkForBoulders(_local8, _local9)){
return (false);
};
} else {
if (_arg2.m_body.m_userData.myType == "cannonBall"){
if (checkForBoulders(_local9, _local8)){
return (false);
};
};
};
if (_arg1.m_body.m_userData.myType == "badKnight3"){
if (checkForBadKnights(_local8, _local9)){
return (false);
};
} else {
if (_arg2.m_body.m_userData.myType == "badKnight3"){
if (checkForBadKnights(_local9, _local8)){
return (false);
};
};
};
if (_arg1.m_body.m_userData.myType == "kingGood"){
if (checkForKingGood(_local8, _local9)){
return (false);
};
} else {
if (_arg2.m_body.m_userData.myType == "kingGood"){
if (checkForKingGood(_local9, _local8)){
return (false);
};
};
};
if (_arg1.m_body.m_userData.myType == "kingBad"){
if (checkForKingBad(_local8, _local9)){
return (false);
};
} else {
if (_arg2.m_body.m_userData.myType == "kingBad"){
if (checkForKingBad(_local9, _local8)){
return (false);
};
};
};
};
_local5 = _arg1.GetFilterData();
_local6 = _arg2.GetFilterData();
if ((((_local5.groupIndex == _local6.groupIndex)) && (!((_local5.groupIndex == 0))))){
return ((_local5.groupIndex > 0));
};
_local7 = ((!(((_local5.maskBits & _local6.categoryBits) == 0))) && (!(((_local5.categoryBits & _local6.maskBits) == 0))));
return (_local7);
//unresolved jump
};
return (false);
}
function checkForKingGood(_arg1, _arg2){
if (_arg2.myType == "floor"){
return (false);
};
if (_arg2.buildingBit == true){
return (false);
};
if (_arg2.goodBad == false){
return (true);
};
}
function checkForKingBad(_arg1, _arg2){
if (_arg2.myType == "floor"){
return (false);
};
if (_arg2.buildingBit == false){
return (false);
};
return (true);
}
function checkForPotions(_arg1, _arg2){
if (_arg2.myType != "floor"){
if (_arg2.myType != "catapultRod"){
if (_arg2.myType != "catapultCup"){
if (_arg2.myType != "catapultBase"){
if (_arg2.goodBad == true){
return (true);
};
};
};
};
};
return (false);
}
}
}//package Box2D.Dynamics
Section 68
//b2ContactListener (Box2D.Dynamics.b2ContactListener)
package Box2D.Dynamics {
import Box2D.Common.Math.*;
import Box2D.Collision.Shapes.*;
import Box2D.Collision.*;
import Box2D.Common.*;
import Box2D.Dynamics.Contacts.*;
public class b2ContactListener {
var myName2:String;
var goodBad1:Boolean;
var goodBad2:Boolean;
var myName1:String;
function checkForBadKnight1(_arg1:b2ContactPoint){
if (goodBad2 == false){
if (myName2 != "floor"){
if (_arg1.shape2.GetBody().GetUserData().energy > 0){
if (myName2 != "kingGood"){
_arg1.shape1.GetBody().GetUserData().collisionWith = _arg1.shape2.GetBody().GetUserData();
} else {
_arg1.shape1.GetBody().GetUserData().collisionWithS = _arg1.shape2.GetBody().GetUserData();
_arg1.shape2.GetBody().GetUserData().collisionWithS = _arg1.shape1.GetBody().GetUserData();
};
};
};
} else {
if (_arg1.shape1.GetBody().GetUserData().myObject != null){
if (myName2 == "blockEnemy"){
_arg1.shape1.GetBody().GetUserData().collisionWith = _arg1.shape2.GetBody().GetUserData();
};
};
};
}
public function Persist(_arg1:b2ContactPoint):void{
}
public function Remove(_arg1:b2ContactPoint):void{
}
public function Add(_arg1:b2ContactPoint):void{
if (_arg1.shape1.GetBody().GetUserData() != null){
if (_arg1.shape2.GetBody().GetUserData() != null){
myName1 = _arg1.shape1.GetBody().GetUserData().myType;
myName2 = _arg1.shape2.GetBody().GetUserData().myType;
if (_arg1.shape1.GetBody().GetUserData() != null){
goodBad1 = _arg1.shape1.GetBody().GetUserData().goodBad;
};
if (_arg1.shape2.GetBody().GetUserData() != null){
goodBad2 = _arg1.shape2.GetBody().GetUserData().goodBad;
};
if (myName1 == "knight"){
if (goodBad2 == true){
if (myName2 != "blockEnemy"){
if (myName2 != "woodBad"){
if (myName2 != "woodBlockEnemy"){
if (_arg1.shape2.GetBody().GetUserData().energy > 0){
_arg1.shape1.GetBody().GetUserData().collisionWithS = _arg1.shape2.GetBody().GetUserData();
_arg1.shape2.GetBody().GetUserData().collisionWithS = _arg1.shape1.GetBody().GetUserData();
};
} else {
_arg1.shape1.GetBody().GetUserData().collisionWith = _arg1.shape2.GetBody().GetUserData();
};
} else {
if (_arg1.shape2.GetBody().GetUserData().energy > 0){
_arg1.shape1.GetBody().GetUserData().collisionWithW = _arg1.shape2.GetBody().GetUserData();
};
};
} else {
if (_arg1.shape2.GetBody().GetUserData().energy > 0){
_arg1.shape1.GetBody().GetUserData().collisionWith = _arg1.shape2.GetBody().GetUserData();
};
};
} else {
if (myName2 != "floor"){
if (_arg1.shape1.GetBody().GetUserData().myObject != null){
if (myName2 != "knight"){
if (myName2 == "potion3"){
_arg1.shape2.GetBody().GetUserData().collisionWith = _arg1.shape1.GetBody().GetUserData();
} else {
_arg1.shape1.GetBody().GetUserData().collisionWith = _arg1.shape2.GetBody().GetUserData();
};
};
};
};
};
} else {
if (myName2 == "knight"){
if (goodBad1 == true){
if (myName1 != "blockEnemy"){
if (myName1 != "woodBad"){
if (myName1 != "woodBlockEnemy"){
if (_arg1.shape1.GetBody().GetUserData().energy > 0){
_arg1.shape2.GetBody().GetUserData().collisionWithS = _arg1.shape1.GetBody().GetUserData();
_arg1.shape1.GetBody().GetUserData().collisionWithS = _arg1.shape2.GetBody().GetUserData();
};
} else {
if (_arg1.shape1.GetBody().GetUserData().energy > 0){
_arg1.shape2.GetBody().GetUserData().collisionWith = _arg1.shape1.GetBody().GetUserData();
};
};
} else {
if (_arg1.shape1.GetBody().GetUserData().energy > 0){
_arg1.shape2.GetBody().GetUserData().collisionWithW = _arg1.shape1.GetBody().GetUserData();
};
};
} else {
if (_arg1.shape1.GetBody().GetUserData().energy > 0){
_arg1.shape2.GetBody().GetUserData().collisionWith = _arg1.shape1.GetBody().GetUserData();
};
};
} else {
if (myName1 != "floor"){
if (_arg1.shape2.GetBody().GetUserData().myObject != null){
if (myName1 != "knight"){
if (myName1 == "potion3"){
_arg1.shape1.GetBody().GetUserData().collisionWith = _arg1.shape2.GetBody().GetUserData();
} else {
_arg1.shape2.GetBody().GetUserData().collisionWith = _arg1.shape1.GetBody().GetUserData();
};
};
};
};
};
} else {
if (myName1 == "archer"){
if (goodBad2 == true){
if (myName2 != "blockEnemy"){
if (myName2 != "woodBad"){
if (_arg1.shape2.GetBody().GetUserData().energy > 0){
_arg1.shape1.GetBody().GetUserData().collisionWithS = _arg1.shape2.GetBody().GetUserData();
_arg1.shape2.GetBody().GetUserData().collisionWithS = _arg1.shape1.GetBody().GetUserData();
};
} else {
if (_arg1.shape2.GetBody().GetUserData().energy > 0){
_arg1.shape1.GetBody().GetUserData().collisionWithW = _arg1.shape2.GetBody().GetUserData();
};
};
} else {
if (_arg1.shape2.GetBody().GetUserData().energy > 0){
_arg1.shape1.GetBody().GetUserData().collisionWith = _arg1.shape2.GetBody().GetUserData();
};
};
} else {
if (myName2 != "floor"){
if (_arg1.shape1.GetBody().GetUserData().myObject != null){
if (myName2 != "knight"){
if (myName2 == "potion3"){
_arg1.shape2.GetBody().GetUserData().collisionWith = _arg1.shape1.GetBody().GetUserData();
} else {
_arg1.shape1.GetBody().GetUserData().collisionWith = _arg1.shape2.GetBody().GetUserData();
};
};
};
};
};
} else {
if (myName2 == "archer"){
if (goodBad1 == true){
if (myName1 != "blockEnemy"){
if (myName1 != "woodBad"){
if (_arg1.shape1.GetBody().GetUserData().energy > 0){
_arg1.shape2.GetBody().GetUserData().collisionWithS = _arg1.shape1.GetBody().GetUserData();
_arg1.shape1.GetBody().GetUserData().collisionWithS = _arg1.shape2.GetBody().GetUserData();
};
} else {
if (_arg1.shape1.GetBody().GetUserData().energy > 0){
_arg1.shape2.GetBody().GetUserData().collisionWithW = _arg1.shape1.GetBody().GetUserData();
};
};
} else {
if (_arg1.shape1.GetBody().GetUserData().energy > 0){
_arg1.shape2.GetBody().GetUserData().collisionWith = _arg1.shape1.GetBody().GetUserData();
};
};
} else {
if (myName1 != "floor"){
if (_arg1.shape2.GetBody().GetUserData().myObject != null){
if (myName1 != "knight"){
if (myName1 == "potion3"){
_arg1.shape1.GetBody().GetUserData().collisionWith = _arg1.shape2.GetBody().GetUserData();
} else {
_arg1.shape2.GetBody().GetUserData().collisionWith = _arg1.shape1.GetBody().GetUserData();
};
};
};
};
};
} else {
if (myName1 == "wizard"){
if (goodBad2 == true){
if (myName2 != "blockEnemy"){
if (myName2 != "woodBad"){
if (_arg1.shape2.GetBody().GetUserData().energy > 0){
_arg1.shape1.GetBody().GetUserData().collisionWithS = _arg1.shape2.GetBody().GetUserData();
_arg1.shape2.GetBody().GetUserData().collisionWithS = _arg1.shape1.GetBody().GetUserData();
};
} else {
if (_arg1.shape2.GetBody().GetUserData().energy > 0){
_arg1.shape1.GetBody().GetUserData().collisionWithW = _arg1.shape2.GetBody().GetUserData();
};
};
} else {
if (_arg1.shape2.GetBody().GetUserData().energy > 0){
_arg1.shape1.GetBody().GetUserData().collisionWith = _arg1.shape2.GetBody().GetUserData();
};
};
} else {
if (myName2 != "floor"){
if (_arg1.shape1.GetBody().GetUserData().myObject != null){
if (myName2 != "knight"){
if (myName2 == "potion3"){
_arg1.shape2.GetBody().GetUserData().collisionWith = _arg1.shape1.GetBody().GetUserData();
} else {
_arg1.shape1.GetBody().GetUserData().collisionWith = _arg1.shape2.GetBody().GetUserData();
};
};
};
};
};
} else {
if (myName2 == "wizard"){
if (goodBad1 == true){
if (myName1 != "blockEnemy"){
if (myName1 != "woodBad"){
if (_arg1.shape1.GetBody().GetUserData().energy > 0){
_arg1.shape2.GetBody().GetUserData().collisionWithS = _arg1.shape1.GetBody().GetUserData();
_arg1.shape1.GetBody().GetUserData().collisionWithS = _arg1.shape2.GetBody().GetUserData();
};
} else {
if (_arg1.shape1.GetBody().GetUserData().energy > 0){
_arg1.shape2.GetBody().GetUserData().collisionWithW = _arg1.shape1.GetBody().GetUserData();
};
};
} else {
if (_arg1.shape1.GetBody().GetUserData().energy > 0){
_arg1.shape2.GetBody().GetUserData().collisionWith = _arg1.shape1.GetBody().GetUserData();
};
};
} else {
if (myName1 != "floor"){
if (_arg1.shape2.GetBody().GetUserData().myObject != null){
if (myName1 != "knight"){
if (myName1 == "potion3"){
_arg1.shape1.GetBody().GetUserData().collisionWith = _arg1.shape2.GetBody().GetUserData();
} else {
_arg1.shape2.GetBody().GetUserData().collisionWith = _arg1.shape1.GetBody().GetUserData();
};
};
};
};
};
} else {
if (myName1 == "badKnight1"){
checkForBadKnight1(_arg1);
} else {
if (myName2 == "badKnight1"){
checkForBadKnight2(_arg1);
} else {
if (myName1 == "badKnight2"){
checkForBadKnight1(_arg1);
} else {
if (myName2 == "badKnight2"){
checkForBadKnight2(_arg1);
} else {
if (myName1 == "badKnight3"){
checkForBadKnight1(_arg1);
} else {
if (myName2 == "badKnight3"){
checkForBadKnight2(_arg1);
} else {
if (myName1 == "viking1"){
checkForBadKnight1(_arg1);
} else {
if (myName2 == "viking1"){
checkForBadKnight2(_arg1);
} else {
if (myName1 == "ram"){
checkForBadKnight1(_arg1);
} else {
if (myName2 == "ram"){
checkForBadKnight2(_arg1);
} else {
if (myName1 == "boulder"){
if (myName2 != "floor"){
if (_arg1.shape2.GetBody().GetUserData().goodBad == true){
_arg1.shape1.GetBody().GetUserData().collisionWith = _arg1.shape2.GetBody().GetUserData();
};
} else {
_arg1.shape1.GetBody().GetUserData().decreaseEnergy(100);
};
} else {
if (myName2 == "boulder"){
if (myName1 != "floor"){
if (_arg1.shape1.GetBody().GetUserData().goodBad == true){
_arg1.shape2.GetBody().GetUserData().collisionWith = _arg1.shape1.GetBody().GetUserData();
};
} else {
_arg1.shape2.GetBody().GetUserData().decreaseEnergy(100);
};
} else {
if (myName1 == "cannonBall"){
if (myName2 != "floor"){
if (_arg1.shape2.GetBody().GetUserData().goodBad == true){
_arg1.shape1.GetBody().GetUserData().collisionWith = _arg1.shape2.GetBody().GetUserData();
};
} else {
_arg1.shape1.GetBody().GetUserData().decreaseEnergy(100);
};
} else {
if (myName2 == "cannonBall"){
if (myName1 != "floor"){
if (_arg1.shape1.GetBody().GetUserData().goodBad == true){
_arg1.shape2.GetBody().GetUserData().collisionWith = _arg1.shape1.GetBody().GetUserData();
};
} else {
_arg1.shape2.GetBody().GetUserData().decreaseEnergy(100);
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
if (myName1 == "floor"){
if (_arg1.shape2.GetBody().GetUserData().y != 0){
_arg1.shape2.GetBody().GetUserData().setupPuffSmoke();
};
} else {
if (myName2 == "floor"){
if (_arg1.shape1.GetBody().GetUserData().y != 0){
_arg1.shape1.GetBody().GetUserData().setupPuffSmoke();
};
};
};
};
};
}
function checkForBadKnight2(_arg1:b2ContactPoint){
if (goodBad1 == false){
if (myName1 != "floor"){
if (_arg1.shape1.GetBody().GetUserData().energy > 0){
if (myName1 != "kingGood"){
_arg1.shape2.GetBody().GetUserData().collisionWith = _arg1.shape1.GetBody().GetUserData();
} else {
_arg1.shape2.GetBody().GetUserData().collisionWithS = _arg1.shape1.GetBody().GetUserData();
_arg1.shape1.GetBody().GetUserData().collisionWithS = _arg1.shape2.GetBody().GetUserData();
};
};
};
} else {
if (_arg1.shape2.GetBody().GetUserData().myObject != null){
if (myName1 == "blockEnemy"){
_arg1.shape2.GetBody().GetUserData().collisionWith = _arg1.shape1.GetBody().GetUserData();
};
};
};
}
public function Result(_arg1:b2ContactResult):void{
}
}
}//package Box2D.Dynamics
Section 69
//b2ContactManager (Box2D.Dynamics.b2ContactManager)
package Box2D.Dynamics {
import Box2D.Common.Math.*;
import Box2D.Collision.Shapes.*;
import Box2D.Collision.*;
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(_arg1, _arg2){
var _local3:b2Shape;
var _local4:b2Shape;
var _local5:b2Body;
var _local6:b2Body;
var _local7:b2Contact;
_local3 = (_arg1 as b2Shape);
_local4 = (_arg2 as b2Shape);
_local5 = _local3.m_body;
_local6 = _local4.m_body;
if (((_local5.IsStatic()) && (_local6.IsStatic()))){
return (m_nullContact);
};
if (_local3.m_body == _local4.m_body){
return (m_nullContact);
};
if (_local6.IsConnected(_local5)){
return (m_nullContact);
};
if (((!((m_world.m_contactFilter == null))) && ((m_world.m_contactFilter.ShouldCollide(_local3, _local4) == false)))){
return (m_nullContact);
};
_local7 = b2Contact.Create(_local3, _local4, m_world.m_blockAllocator);
if (_local7 == null){
return (m_nullContact);
};
_local3 = _local7.m_shape1;
_local4 = _local7.m_shape2;
_local5 = _local3.m_body;
_local6 = _local4.m_body;
_local7.m_prev = null;
_local7.m_next = m_world.m_contactList;
if (m_world.m_contactList != null){
m_world.m_contactList.m_prev = _local7;
};
m_world.m_contactList = _local7;
_local7.m_node1.contact = _local7;
_local7.m_node1.other = _local6;
_local7.m_node1.prev = null;
_local7.m_node1.next = _local5.m_contactList;
if (_local5.m_contactList != null){
_local5.m_contactList.prev = _local7.m_node1;
};
_local5.m_contactList = _local7.m_node1;
_local7.m_node2.contact = _local7;
_local7.m_node2.other = _local5;
_local7.m_node2.prev = null;
_local7.m_node2.next = _local6.m_contactList;
if (_local6.m_contactList != null){
_local6.m_contactList.prev = _local7.m_node2;
};
_local6.m_contactList = _local7.m_node2;
m_world.m_contactCount++;
return (_local7);
}
override public function PairRemoved(_arg1, _arg2, _arg3):void{
var _local4:b2Contact;
if (_arg3 == null){
return;
};
_local4 = (_arg3 as b2Contact);
if (_local4 == m_nullContact){
return;
};
Destroy(_local4);
}
public function Destroy(_arg1:b2Contact):void{
var _local2:b2Shape;
var _local3:b2Shape;
var _local4:int;
var _local5:b2Body;
var _local6:b2Body;
var _local7:b2Body;
var _local8:b2Body;
var _local9:Array;
var _local10:b2ContactPoint;
var _local11:int;
var _local12:b2Manifold;
var _local13:int;
var _local14:b2ManifoldPoint;
var _local15:b2Vec2;
var _local16:b2Vec2;
_local2 = _arg1.m_shape1;
_local3 = _arg1.m_shape2;
_local4 = _arg1.m_manifoldCount;
if ((((_local4 > 0)) && (m_world.m_contactListener))){
_local7 = _local2.m_body;
_local8 = _local3.m_body;
_local9 = _arg1.GetManifolds();
_local10 = s_evalCP;
_local10.shape1 = _arg1.m_shape1;
_local10.shape2 = _arg1.m_shape1;
_local10.friction = _arg1.m_friction;
_local10.restitution = _arg1.m_restitution;
_local11 = 0;
while (_local11 < _local4) {
_local12 = _local9[_local11];
_local10.normal.SetV(_local12.normal);
_local13 = 0;
while (_local13 < _local12.pointCount) {
_local14 = _local12.points[_local13];
_local10.position = _local7.GetWorldPoint(_local14.localPoint1);
_local15 = _local7.GetLinearVelocityFromLocalPoint(_local14.localPoint1);
_local16 = _local8.GetLinearVelocityFromLocalPoint(_local14.localPoint2);
_local10.velocity.Set((_local16.x - _local15.x), (_local16.y - _local15.y));
_local10.separation = _local14.separation;
_local10.id.key = _local14.id._key;
m_world.m_contactListener.Remove(_local10);
_local13++;
};
_local11++;
};
};
if (_arg1.m_prev){
_arg1.m_prev.m_next = _arg1.m_next;
};
if (_arg1.m_next){
_arg1.m_next.m_prev = _arg1.m_prev;
};
if (_arg1 == m_world.m_contactList){
m_world.m_contactList = _arg1.m_next;
};
_local5 = _local2.m_body;
_local6 = _local3.m_body;
if (_arg1.m_node1.prev){
_arg1.m_node1.prev.next = _arg1.m_node1.next;
};
if (_arg1.m_node1.next){
_arg1.m_node1.next.prev = _arg1.m_node1.prev;
};
if (_arg1.m_node1 == _local5.m_contactList){
_local5.m_contactList = _arg1.m_node1.next;
};
if (_arg1.m_node2.prev){
_arg1.m_node2.prev.next = _arg1.m_node2.next;
};
if (_arg1.m_node2.next){
_arg1.m_node2.next.prev = _arg1.m_node2.prev;
};
if (_arg1.m_node2 == _local6.m_contactList){
_local6.m_contactList = _arg1.m_node2.next;
};
b2Contact.Destroy(_arg1, m_world.m_blockAllocator);
m_world.m_contactCount--;
}
public function Collide():void{
var _local1:b2Contact;
var _local2:b2Body;
var _local3:b2Body;
_local1 = m_world.m_contactList;
while (_local1) {
_local2 = _local1.m_shape1.m_body;
_local3 = _local1.m_shape2.m_body;
if (((_local2.IsSleeping()) && (_local3.IsSleeping()))){
} else {
_local1.Update(m_world.m_contactListener);
};
_local1 = _local1.m_next;
};
}
}
}//package Box2D.Dynamics
Section 70
//b2DebugDraw (Box2D.Dynamics.b2DebugDraw)
package Box2D.Dynamics {
import flash.display.*;
import Box2D.Common.Math.*;
import Box2D.Collision.Shapes.*;
import Box2D.Collision.*;
import Box2D.Common.*;
import Box2D.Dynamics.Contacts.*;
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(_arg1:Array, _arg2:int, _arg3:b2Color):void{
var _local4:int;
m_sprite.graphics.lineStyle(m_lineThickness, _arg3.color, m_alpha);
m_sprite.graphics.moveTo((_arg1[0].x * m_drawScale), (_arg1[0].y * m_drawScale));
m_sprite.graphics.beginFill(_arg3.color, m_fillAlpha);
_local4 = 1;
while (_local4 < _arg2) {
m_sprite.graphics.lineTo((_arg1[_local4].x * m_drawScale), (_arg1[_local4].y * m_drawScale));
_local4++;
};
m_sprite.graphics.lineTo((_arg1[0].x * m_drawScale), (_arg1[0].y * m_drawScale));
m_sprite.graphics.endFill();
}
public function DrawCircle(_arg1:b2Vec2, _arg2:Number, _arg3:b2Color):void{
m_sprite.graphics.lineStyle(m_lineThickness, _arg3.color, m_alpha);
m_sprite.graphics.drawCircle((_arg1.x * m_drawScale), (_arg1.y * m_drawScale), (_arg2 * m_drawScale));
}
public function DrawXForm(_arg1:b2XForm):void{
m_sprite.graphics.lineStyle(m_lineThickness, 0xFF0000, m_alpha);
m_sprite.graphics.moveTo((_arg1.position.x * m_drawScale), (_arg1.position.y * m_drawScale));
m_sprite.graphics.lineTo(((_arg1.position.x + (m_xformScale * _arg1.R.col1.x)) * m_drawScale), ((_arg1.position.y + (m_xformScale * _arg1.R.col1.y)) * m_drawScale));
m_sprite.graphics.lineStyle(m_lineThickness, 0xFF00, m_alpha);
m_sprite.graphics.moveTo((_arg1.position.x * m_drawScale), (_arg1.position.y * m_drawScale));
m_sprite.graphics.lineTo(((_arg1.position.x + (m_xformScale * _arg1.R.col2.x)) * m_drawScale), ((_arg1.position.y + (m_xformScale * _arg1.R.col2.y)) * m_drawScale));
}
public function ClearFlags(_arg1:uint):void{
m_drawFlags = (m_drawFlags & ~(_arg1));
}
public function DrawSolidCircle(_arg1:b2Vec2, _arg2:Number, _arg3:b2Vec2, _arg4:b2Color):void{
m_sprite.graphics.lineStyle(m_lineThickness, _arg4.color, m_alpha);
m_sprite.graphics.moveTo(0, 0);
m_sprite.graphics.beginFill(_arg4.color, m_fillAlpha);
m_sprite.graphics.drawCircle((_arg1.x * m_drawScale), (_arg1.y * m_drawScale), (_arg2 * m_drawScale));
m_sprite.graphics.endFill();
m_sprite.graphics.moveTo((_arg1.x * m_drawScale), (_arg1.y * m_drawScale));
m_sprite.graphics.lineTo(((_arg1.x + (_arg3.x * _arg2)) * m_drawScale), ((_arg1.y + (_arg3.y * _arg2)) * m_drawScale));
}
public function SetFlags(_arg1:uint):void{
m_drawFlags = _arg1;
}
public function AppendFlags(_arg1:uint):void{
m_drawFlags = (m_drawFlags | _arg1);
}
public function DrawSegment(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:b2Color):void{
m_sprite.graphics.lineStyle(m_lineThickness, _arg3.color, m_alpha);
m_sprite.graphics.moveTo((_arg1.x * m_drawScale), (_arg1.y * m_drawScale));
m_sprite.graphics.lineTo((_arg2.x * m_drawScale), (_arg2.y * m_drawScale));
}
public function GetFlags():uint{
return (m_drawFlags);
}
public function DrawPolygon(_arg1:Array, _arg2:int, _arg3:b2Color):void{
var _local4:int;
m_sprite.graphics.lineStyle(m_lineThickness, _arg3.color, m_alpha);
m_sprite.graphics.moveTo((_arg1[0].x * m_drawScale), (_arg1[0].y * m_drawScale));
_local4 = 1;
while (_local4 < _arg2) {
m_sprite.graphics.lineTo((_arg1[_local4].x * m_drawScale), (_arg1[_local4].y * m_drawScale));
_local4++;
};
m_sprite.graphics.lineTo((_arg1[0].x * m_drawScale), (_arg1[0].y * m_drawScale));
}
}
}//package Box2D.Dynamics
Section 71
//b2DestructionListener (Box2D.Dynamics.b2DestructionListener)
package Box2D.Dynamics {
import Box2D.Collision.Shapes.*;
import Box2D.Dynamics.Joints.*;
public class b2DestructionListener {
public function SayGoodbyeJoint(_arg1:b2Joint):void{
}
public function SayGoodbyeShape(_arg1:b2Shape):void{
}
}
}//package Box2D.Dynamics
Section 72
//b2Island (Box2D.Dynamics.b2Island)
package Box2D.Dynamics {
import Box2D.Common.Math.*;
import Box2D.Dynamics.Joints.*;
import Box2D.Collision.*;
import Box2D.Common.*;
import Box2D.Dynamics.Contacts.*;
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(_arg1:int, _arg2:int, _arg3:int, _arg4, _arg5:b2ContactListener){
var _local6:int;
super();
m_bodyCapacity = _arg1;
m_contactCapacity = _arg2;
m_jointCapacity = _arg3;
m_bodyCount = 0;
m_contactCount = 0;
m_jointCount = 0;
m_allocator = _arg4;
m_listener = _arg5;
m_bodies = new Array(_arg1);
_local6 = 0;
while (_local6 < _arg1) {
m_bodies[_local6] = null;
_local6++;
};
m_contacts = new Array(_arg2);
_local6 = 0;
while (_local6 < _arg2) {
m_contacts[_local6] = null;
_local6++;
};
m_joints = new Array(_arg3);
_local6 = 0;
while (_local6 < _arg3) {
m_joints[_local6] = null;
_local6++;
};
m_positionIterationCount = 0;
}
public function AddBody(_arg1:b2Body):void{
var _local2 = m_bodyCount++;
m_bodies[_local2] = _arg1;
}
public function AddJoint(_arg1:b2Joint):void{
var _local2 = m_jointCount++;
m_joints[_local2] = _arg1;
}
public function Report(_arg1:Array):void{
var _local2:b2Mat22;
var _local3:b2Vec2;
var _local4:int;
var _local5:b2Contact;
var _local6:b2ContactConstraint;
var _local7:b2ContactResult;
var _local8:b2Body;
var _local9:int;
var _local10:Array;
var _local11:int;
var _local12:b2Manifold;
var _local13:int;
var _local14:b2ManifoldPoint;
var _local15:b2ContactConstraintPoint;
if (m_listener == null){
return;
};
_local4 = 0;
while (_local4 < m_contactCount) {
_local5 = m_contacts[_local4];
_local6 = _arg1[_local4];
_local7 = s_reportCR;
_local7.shape1 = _local5.m_shape1;
_local7.shape2 = _local5.m_shape2;
_local8 = _local7.shape1.m_body;
_local9 = _local5.m_manifoldCount;
_local10 = _local5.GetManifolds();
_local11 = 0;
while (_local11 < _local9) {
_local12 = _local10[_local11];
_local7.normal.SetV(_local12.normal);
_local13 = 0;
while (_local13 < _local12.pointCount) {
_local14 = _local12.points[_local13];
_local15 = _local6.points[_local13];
_local7.position = _local8.GetWorldPoint(_local14.localPoint1);
_local7.normalImpulse = _local15.normalImpulse;
_local7.tangentImpulse = _local15.tangentImpulse;
_local7.id.key = _local14.id.key;
m_listener.Result(_local7);
_local13++;
};
_local11++;
};
_local4++;
};
}
public function Solve(_arg1:b2TimeStep, _arg2:b2Vec2, _arg3:Boolean, _arg4:Boolean):void{
var _local5:int;
var _local6:b2Body;
var _local7:b2Joint;
var _local8:b2ContactSolver;
var _local9:int;
var _local10:Boolean;
var _local11:Boolean;
var _local12:Boolean;
var _local13:Number;
var _local14:Number;
var _local15:Number;
_local5 = 0;
while (_local5 < m_bodyCount) {
_local6 = m_bodies[_local5];
if (_local6.IsStatic()){
} else {
_local6.m_linearVelocity.x = (_local6.m_linearVelocity.x + (_arg1.dt * (_arg2.x + (_local6.m_invMass * _local6.m_force.x))));
_local6.m_linearVelocity.y = (_local6.m_linearVelocity.y + (_arg1.dt * (_arg2.y + (_local6.m_invMass * _local6.m_force.y))));
_local6.m_angularVelocity = (_local6.m_angularVelocity + ((_arg1.dt * _local6.m_invI) * _local6.m_torque));
_local6.m_force.SetZero();
_local6.m_torque = 0;
_local6.m_linearVelocity.Multiply(b2Math.b2Clamp((1 - (_arg1.dt * _local6.m_linearDamping)), 0, 1));
_local6.m_angularVelocity = (_local6.m_angularVelocity * b2Math.b2Clamp((1 - (_arg1.dt * _local6.m_angularDamping)), 0, 1));
if (_local6.m_linearVelocity.LengthSquared() > b2Settings.b2_maxLinearVelocitySquared){
_local6.m_linearVelocity.Normalize();
_local6.m_linearVelocity.x = (_local6.m_linearVelocity.x * b2Settings.b2_maxLinearVelocity);
_local6.m_linearVelocity.y = (_local6.m_linearVelocity.y * b2Settings.b2_maxLinearVelocity);
};
if ((_local6.m_angularVelocity * _local6.m_angularVelocity) > b2Settings.b2_maxAngularVelocitySquared){
if (_local6.m_angularVelocity < 0){
_local6.m_angularVelocity = -(b2Settings.b2_maxAngularVelocity);
} else {
_local6.m_angularVelocity = b2Settings.b2_maxAngularVelocity;
};
};
};
_local5++;
};
_local8 = new b2ContactSolver(_arg1, m_contacts, m_contactCount, m_allocator);
_local8.InitVelocityConstraints(_arg1);
_local5 = 0;
while (_local5 < m_jointCount) {
_local7 = m_joints[_local5];
_local7.InitVelocityConstraints(_arg1);
_local5++;
};
_local5 = 0;
while (_local5 < _arg1.maxIterations) {
_local8.SolveVelocityConstraints();
_local9 = 0;
while (_local9 < m_jointCount) {
_local7 = m_joints[_local9];
_local7.SolveVelocityConstraints(_arg1);
_local9++;
};
_local5++;
};
_local8.FinalizeVelocityConstraints();
_local5 = 0;
while (_local5 < m_bodyCount) {
_local6 = m_bodies[_local5];
if (_local6.IsStatic()){
} else {
_local6.m_sweep.c0.SetV(_local6.m_sweep.c);
_local6.m_sweep.a0 = _local6.m_sweep.a;
_local6.m_sweep.c.x = (_local6.m_sweep.c.x + (_arg1.dt * _local6.m_linearVelocity.x));
_local6.m_sweep.c.y = (_local6.m_sweep.c.y + (_arg1.dt * _local6.m_linearVelocity.y));
_local6.m_sweep.a = (_local6.m_sweep.a + (_arg1.dt * _local6.m_angularVelocity));
_local6.SynchronizeTransform();
};
_local5++;
};
if (_arg3){
_local5 = 0;
while (_local5 < m_jointCount) {
_local7 = m_joints[_local5];
_local7.InitPositionConstraints();
_local5++;
};
m_positionIterationCount = 0;
while (m_positionIterationCount < _arg1.maxIterations) {
_local10 = _local8.SolvePositionConstraints(b2Settings.b2_contactBaumgarte);
_local11 = true;
_local5 = 0;
while (_local5 < m_jointCount) {
_local7 = m_joints[_local5];
_local12 = _local7.SolvePositionConstraints();
_local11 = ((_local11) && (_local12));
_local5++;
};
if (((_local10) && (_local11))){
break;
};
m_positionIterationCount++;
};
};
Report(_local8.m_constraints);
if (_arg4){
_local13 = Number.MAX_VALUE;
_local14 = (b2Settings.b2_linearSleepTolerance * b2Settings.b2_linearSleepTolerance);
_local15 = (b2Settings.b2_angularSleepTolerance * b2Settings.b2_angularSleepTolerance);
_local5 = 0;
while (_local5 < m_bodyCount) {
_local6 = m_bodies[_local5];
if (_local6.m_invMass == 0){
} else {
if ((_local6.m_flags & b2Body.e_allowSleepFlag) == 0){
_local6.m_sleepTime = 0;
_local13 = 0;
};
if (((((((_local6.m_flags & b2Body.e_allowSleepFlag) == 0)) || (((_local6.m_angularVelocity * _local6.m_angularVelocity) > _local15)))) || ((b2Math.b2Dot(_local6.m_linearVelocity, _local6.m_linearVelocity) > _local14)))){
_local6.m_sleepTime = 0;
_local13 = 0;
} else {
_local6.m_sleepTime = (_local6.m_sleepTime + _arg1.dt);
_local13 = b2Math.b2Min(_local13, _local6.m_sleepTime);
};
};
_local5++;
};
if (_local13 >= b2Settings.b2_timeToSleep){
_local5 = 0;
while (_local5 < m_bodyCount) {
_local6 = m_bodies[_local5];
m_bodies[_local5].m_flags = (_local6.m_flags | b2Body.e_sleepFlag);
_local6.m_linearVelocity.SetZero();
_local6.m_angularVelocity = 0;
_local5++;
};
};
};
}
public function AddContact(_arg1:b2Contact):void{
var _local2 = m_contactCount++;
m_contacts[_local2] = _arg1;
}
public function Clear():void{
m_bodyCount = 0;
m_contactCount = 0;
m_jointCount = 0;
}
public function SolveTOI(_arg1:b2TimeStep):void{
var _local2:int;
var _local3:b2ContactSolver;
var _local4:Number;
var _local5:b2Body;
var _local6:Boolean;
_local3 = new b2ContactSolver(_arg1, m_contacts, m_contactCount, m_allocator);
_local2 = 0;
while (_local2 < _arg1.maxIterations) {
_local3.SolveVelocityConstraints();
_local2++;
};
_local2 = 0;
while (_local2 < m_bodyCount) {
_local5 = m_bodies[_local2];
if (_local5.IsStatic()){
} else {
_local5.m_sweep.c0.SetV(_local5.m_sweep.c);
_local5.m_sweep.a0 = _local5.m_sweep.a;
_local5.m_sweep.c.x = (_local5.m_sweep.c.x + (_arg1.dt * _local5.m_linearVelocity.x));
_local5.m_sweep.c.y = (_local5.m_sweep.c.y + (_arg1.dt * _local5.m_linearVelocity.y));
_local5.m_sweep.a = (_local5.m_sweep.a + (_arg1.dt * _local5.m_angularVelocity));
_local5.SynchronizeTransform();
};
_local2++;
};
_local4 = 0.75;
_local2 = 0;
while (_local2 < _arg1.maxIterations) {
_local6 = _local3.SolvePositionConstraints(_local4);
if (_local6){
break;
};
_local2++;
};
Report(_local3.m_constraints);
}
}
}//package Box2D.Dynamics
Section 73
//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;
}
}//package Box2D.Dynamics
Section 74
//b2World (Box2D.Dynamics.b2World)
package Box2D.Dynamics {
import Box2D.Common.Math.*;
import Box2D.Collision.Shapes.*;
import Box2D.Dynamics.Joints.*;
import Box2D.Collision.*;
import Box2D.Common.*;
import Box2D.Dynamics.Contacts.*;
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(_arg1:b2AABB, _arg2:b2Vec2, _arg3:Boolean){
var _local4: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 = _arg3;
m_gravity = _arg2;
m_lock = false;
m_inv_dt0 = 0;
m_contactManager.m_world = this;
m_broadPhase = new b2BroadPhase(_arg1, m_contactManager);
_local4 = new b2BodyDef();
m_groundBody = CreateBody(_local4);
}
public function DrawJoint(_arg1:b2Joint):void{
var _local2:b2Body;
var _local3:b2Body;
var _local4:b2XForm;
var _local5:b2XForm;
var _local6:b2Vec2;
var _local7:b2Vec2;
var _local8:b2Vec2;
var _local9:b2Vec2;
var _local10:b2Color;
var _local11:b2PulleyJoint;
var _local12:b2Vec2;
var _local13:b2Vec2;
_local2 = _arg1.m_body1;
_local3 = _arg1.m_body2;
_local4 = _local2.m_xf;
_local5 = _local3.m_xf;
_local6 = _local4.position;
_local7 = _local5.position;
_local8 = _arg1.GetAnchor1();
_local9 = _arg1.GetAnchor2();
_local10 = s_jointColor;
switch (_arg1.m_type){
case b2Joint.e_distanceJoint:
m_debugDraw.DrawSegment(_local8, _local9, _local10);
break;
case b2Joint.e_pulleyJoint:
_local11 = (_arg1 as b2PulleyJoint);
_local12 = _local11.GetGroundAnchor1();
_local13 = _local11.GetGroundAnchor2();
m_debugDraw.DrawSegment(_local12, _local8, _local10);
m_debugDraw.DrawSegment(_local13, _local9, _local10);
m_debugDraw.DrawSegment(_local12, _local13, _local10);
break;
case b2Joint.e_mouseJoint:
m_debugDraw.DrawSegment(_local8, _local9, _local10);
break;
default:
if (_local2 != m_groundBody){
m_debugDraw.DrawSegment(_local6, _local8, _local10);
};
m_debugDraw.DrawSegment(_local8, _local9, _local10);
if (_local3 != m_groundBody){
m_debugDraw.DrawSegment(_local7, _local9, _local10);
};
};
}
public function Refilter(_arg1:b2Shape):void{
_arg1.RefilterProxy(m_broadPhase, _arg1.m_body.m_xf);
}
public function SetDebugDraw(_arg1:b2DebugDraw):void{
m_debugDraw = _arg1;
}
public function SetContinuousPhysics(_arg1:Boolean):void{
m_continuousPhysics = _arg1;
}
public function GetProxyCount():int{
return (m_broadPhase.m_proxyCount);
}
public function DrawDebugData():void{
var _local1:uint;
var _local2:int;
var _local3:b2Body;
var _local4:b2Shape;
var _local5:b2Joint;
var _local6:b2BroadPhase;
var _local7:b2Vec2;
var _local8:b2Vec2;
var _local9:b2Vec2;
var _local10:b2Color;
var _local11:b2XForm;
var _local12:b2AABB;
var _local13:b2AABB;
var _local14:Array;
var _local15:Boolean;
var _local16:uint;
var _local17:b2Pair;
var _local18:b2Proxy;
var _local19:b2Proxy;
var _local20:b2Vec2;
var _local21:b2Vec2;
var _local22:b2Proxy;
var _local23:b2PolygonShape;
var _local24:b2OBB;
var _local25:b2Vec2;
var _local26:b2Mat22;
var _local27:b2Vec2;
var _local28:Number;
if (m_debugDraw == null){
return;
};
m_debugDraw.m_sprite.graphics.clear();
_local1 = m_debugDraw.GetFlags();
_local7 = new b2Vec2();
_local8 = new b2Vec2();
_local9 = new b2Vec2();
_local10 = new b2Color(0, 0, 0);
_local12 = new b2AABB();
_local13 = new b2AABB();
_local14 = [new b2Vec2(), new b2Vec2(), new b2Vec2(), new b2Vec2()];
if ((_local1 & b2DebugDraw.e_shapeBit)){
_local15 = ((_local1 & b2DebugDraw.e_coreShapeBit) == b2DebugDraw.e_coreShapeBit);
_local3 = m_bodyList;
while (_local3) {
_local11 = _local3.m_xf;
_local4 = _local3.GetShapeList();
while (_local4) {
if (_local3.IsStatic()){
DrawShape(_local4, _local11, new b2Color(0.5, 0.9, 0.5), _local15);
} else {
if (_local3.IsSleeping()){
DrawShape(_local4, _local11, new b2Color(0.5, 0.5, 0.9), _local15);
} else {
DrawShape(_local4, _local11, new b2Color(0.9, 0.9, 0.9), _local15);
};
};
_local4 = _local4.m_next;
};
_local3 = _local3.m_next;
};
};
if ((_local1 & b2DebugDraw.e_jointBit)){
_local5 = m_jointList;
while (_local5) {
DrawJoint(_local5);
_local5 = _local5.m_next;
};
};
if ((_local1 & b2DebugDraw.e_pairBit)){
_local6 = m_broadPhase;
_local7.Set((1 / _local6.m_quantizationFactor.x), (1 / _local6.m_quantizationFactor.y));
_local10.Set(0.9, 0.9, 0.3);
_local2 = 0;
while (_local2 < b2Pair.b2_tableCapacity) {
_local16 = _local6.m_pairManager.m_hashTable[_local2];
while (_local16 != b2Pair.b2_nullPair) {
_local17 = _local6.m_pairManager.m_pairs[_local16];
_local18 = _local6.m_proxyPool[_local17.proxyId1];
_local19 = _local6.m_proxyPool[_local17.proxyId2];
_local12.lowerBound.x = (_local6.m_worldAABB.lowerBound.x + (_local7.x * _local6.m_bounds[0][_local18.lowerBounds[0]].value));
_local12.lowerBound.y = (_local6.m_worldAABB.lowerBound.y + (_local7.y * _local6.m_bounds[1][_local18.lowerBounds[1]].value));
_local12.upperBound.x = (_local6.m_worldAABB.lowerBound.x + (_local7.x * _local6.m_bounds[0][_local18.upperBounds[0]].value));
_local12.upperBound.y = (_local6.m_worldAABB.lowerBound.y + (_local7.y * _local6.m_bounds[1][_local18.upperBounds[1]].value));
_local13.lowerBound.x = (_local6.m_worldAABB.lowerBound.x + (_local7.x * _local6.m_bounds[0][_local19.lowerBounds[0]].value));
_local13.lowerBound.y = (_local6.m_worldAABB.lowerBound.y + (_local7.y * _local6.m_bounds[1][_local19.lowerBounds[1]].value));
_local13.upperBound.x = (_local6.m_worldAABB.lowerBound.x + (_local7.x * _local6.m_bounds[0][_local19.upperBounds[0]].value));
_local13.upperBound.y = (_local6.m_worldAABB.lowerBound.y + (_local7.y * _local6.m_bounds[1][_local19.upperBounds[1]].value));
_local8.x = (0.5 * (_local12.lowerBound.x + _local12.upperBound.x));
_local8.y = (0.5 * (_local12.lowerBound.y + _local12.upperBound.y));
_local9.x = (0.5 * (_local13.lowerBound.x + _local13.upperBound.x));
_local9.y = (0.5 * (_local13.lowerBound.y + _local13.upperBound.y));
m_debugDraw.DrawSegment(_local8, _local9, _local10);
_local16 = _local17.next;
};
_local2++;
};
};
if ((_local1 & b2DebugDraw.e_aabbBit)){
_local6 = m_broadPhase;
_local20 = _local6.m_worldAABB.lowerBound;
_local21 = _local6.m_worldAABB.upperBound;
_local7.Set((1 / _local6.m_quantizationFactor.x), (1 / _local6.m_quantizationFactor.y));
_local10.Set(0.9, 0.3, 0.9);
_local2 = 0;
while (_local2 < b2Settings.b2_maxProxies) {
_local22 = _local6.m_proxyPool[_local2];
if (_local22.IsValid() == false){
} else {
_local12.lowerBound.x = (_local20.x + (_local7.x * _local6.m_bounds[0][_local22.lowerBounds[0]].value));
_local12.lowerBound.y = (_local20.y + (_local7.y * _local6.m_bounds[1][_local22.lowerBounds[1]].value));
_local12.upperBound.x = (_local20.x + (_local7.x * _local6.m_bounds[0][_local22.upperBounds[0]].value));
_local12.upperBound.y = (_local20.y + (_local7.y * _local6.m_bounds[1][_local22.upperBounds[1]].value));
_local14[0].Set(_local12.lowerBound.x, _local12.lowerBound.y);
_local14[1].Set(_local12.upperBound.x, _local12.lowerBound.y);
_local14[2].Set(_local12.upperBound.x, _local12.upperBound.y);
_local14[3].Set(_local12.lowerBound.x, _local12.upperBound.y);
m_debugDraw.DrawPolygon(_local14, 4, _local10);
};
_local2++;
};
_local14[0].Set(_local20.x, _local20.y);
_local14[1].Set(_local21.x, _local20.y);
_local14[2].Set(_local21.x, _local21.y);
_local14[3].Set(_local20.x, _local21.y);
m_debugDraw.DrawPolygon(_local14, 4, new b2Color(0.3, 0.9, 0.9));
};
if ((_local1 & b2DebugDraw.e_obbBit)){
_local10.Set(0.5, 0.3, 0.5);
_local3 = m_bodyList;
while (_local3) {
_local11 = _local3.m_xf;
_local4 = _local3.GetShapeList();
while (_local4) {
if (_local4.m_type != b2Shape.e_polygonShape){
} else {
_local23 = (_local4 as b2PolygonShape);
_local24 = _local23.GetOBB();
_local25 = _local24.extents;
_local14[0].Set(-(_local25.x), -(_local25.y));
_local14[1].Set(_local25.x, -(_local25.y));
_local14[2].Set(_local25.x, _local25.y);
_local14[3].Set(-(_local25.x), _local25.y);
_local2 = 0;
while (_local2 < 4) {
_local26 = _local24.R;
_local27 = _local14[_local2];
_local28 = (_local24.center.x + ((_local26.col1.x * _local27.x) + (_local26.col2.x * _local27.y)));
_local14[_local2].y = (_local24.center.y + ((_local26.col1.y * _local27.x) + (_local26.col2.y * _local27.y)));
_local14[_local2].x = _local28;
_local26 = _local11.R;
_local28 = (_local11.position.x + ((_local26.col1.x * _local27.x) + (_local26.col2.x * _local27.y)));
_local14[_local2].y = (_local11.position.y + ((_local26.col1.y * _local27.x) + (_local26.col2.y * _local27.y)));
_local14[_local2].x = _local28;
_local2++;
};
m_debugDraw.DrawPolygon(_local14, 4, _local10);
};
_local4 = _local4.m_next;
};
_local3 = _local3.m_next;
};
};
if ((_local1 & b2DebugDraw.e_centerOfMassBit)){
_local3 = m_bodyList;
while (_local3) {
_local11 = s_xf;
_local11.R = _local3.m_xf.R;
_local11.position = _local3.GetWorldCenter();
m_debugDraw.DrawXForm(_local11);
_local3 = _local3.m_next;
};
};
}
public function DestroyBody(_arg1:b2Body):void{
var _local2:b2JointEdge;
var _local3:b2Shape;
var _local4:b2JointEdge;
var _local5:b2Shape;
if (m_lock == true){
return;
};
_local2 = _arg1.m_jointList;
while (_local2) {
_local4 = _local2;
_local2 = _local2.next;
if (m_destructionListener){
m_destructionListener.SayGoodbyeJoint(_local4.joint);
};
DestroyJoint(_local4.joint);
};
_local3 = _arg1.m_shapeList;
while (_local3) {
_local5 = _local3;
_local3 = _local3.m_next;
if (m_destructionListener){
m_destructionListener.SayGoodbyeShape(_local5);
};
_local5.DestroyProxy(m_broadPhase);
b2Shape.Destroy(_local5, m_blockAllocator);
};
if (_arg1.m_prev){
_arg1.m_prev.m_next = _arg1.m_next;
};
if (_arg1.m_next){
_arg1.m_next.m_prev = _arg1.m_prev;
};
if (_arg1 == m_bodyList){
m_bodyList = _arg1.m_next;
};
m_bodyCount--;
}
public function SetContactFilter(_arg1:b2ContactFilter):void{
m_contactFilter = _arg1;
}
public function GetGroundBody():b2Body{
return (m_groundBody);
}
public function DrawShape(_arg1:b2Shape, _arg2:b2XForm, _arg3:b2Color, _arg4:Boolean):void{
var _local5:b2Color;
var _local6:b2CircleShape;
var _local7:b2Vec2;
var _local8:Number;
var _local9:b2Vec2;
var _local10:int;
var _local11:b2PolygonShape;
var _local12:int;
var _local13:Array;
var _local14:Array;
var _local15:Array;
_local5 = s_coreColor;
switch (_arg1.m_type){
case b2Shape.e_circleShape:
_local6 = (_arg1 as b2CircleShape);
_local7 = b2Math.b2MulX(_arg2, _local6.m_localPosition);
_local8 = _local6.m_radius;
_local9 = _arg2.R.col1;
m_debugDraw.DrawSolidCircle(_local7, _local8, _local9, _arg3);
if (_arg4){
m_debugDraw.DrawCircle(_local7, (_local8 - b2Settings.b2_toiSlop), _local5);
};
break;
case b2Shape.e_polygonShape:
_local11 = (_arg1 as b2PolygonShape);
_local12 = _local11.GetVertexCount();
_local13 = _local11.GetVertices();
_local14 = new Array(b2Settings.b2_maxPolygonVertices);
_local10 = 0;
while (_local10 < _local12) {
_local14[_local10] = b2Math.b2MulX(_arg2, _local13[_local10]);
_local10++;
};
m_debugDraw.DrawSolidPolygon(_local14, _local12, _arg3);
if (_arg4){
_local15 = _local11.GetCoreVertices();
_local10 = 0;
while (_local10 < _local12) {
_local14[_local10] = b2Math.b2MulX(_arg2, _local15[_local10]);
_local10++;
};
m_debugDraw.DrawPolygon(_local14, _local12, _local5);
};
break;
};
}
public function GetContactCount():int{
return (m_contactCount);
}
public function Solve(_arg1:b2TimeStep):void{
var _local2:b2Body;
var _local3:b2Island;
var _local4:b2Contact;
var _local5:b2Joint;
var _local6:int;
var _local7:Array;
var _local8:b2Body;
var _local9:int;
var _local10:int;
var _local11:b2Body;
var _local12:b2ContactEdge;
var _local13:b2JointEdge;
var _local14:Boolean;
m_positionIterationCount = 0;
_local3 = new b2Island(m_bodyCount, m_contactCount, m_jointCount, m_stackAllocator, m_contactListener);
_local2 = m_bodyList;
while (_local2) {
_local2.m_flags = (_local2.m_flags & ~(b2Body.e_islandFlag));
_local2 = _local2.m_next;
};
_local4 = m_contactList;
while (_local4) {
_local4.m_flags = (_local4.m_flags & ~(b2Contact.e_islandFlag));
_local4 = _local4.m_next;
};
_local5 = m_jointList;
while (_local5) {
_local5.m_islandFlag = false;
_local5 = _local5.m_next;
};
_local6 = m_bodyCount;
_local7 = new Array(_local6);
_local8 = m_bodyList;
while (_local8) {
if ((_local8.m_flags & ((b2Body.e_islandFlag | b2Body.e_sleepFlag) | b2Body.e_frozenFlag))){
} else {
if (_local8.IsStatic()){
} else {
_local3.Clear();
_local9 = 0;
var _temp1 = _local9;
_local9 = (_local9 + 1);
var _local15 = _temp1;
_local7[_local15] = _local8;
_local8.m_flags = (_local8.m_flags | b2Body.e_islandFlag);
while (_local9 > 0) {
--_local9;
_local2 = _local7[_local9];
_local3.AddBody(_local2);
_local2.m_flags = (_local2.m_flags & ~(b2Body.e_sleepFlag));
if (_local2.IsStatic()){
} else {
_local12 = _local2.m_contactList;
while (_local12) {
if ((_local12.contact.m_flags & (b2Contact.e_islandFlag | b2Contact.e_nonSolidFlag))){
} else {
if (_local12.contact.m_manifoldCount == 0){
} else {
_local3.AddContact(_local12.contact);
_local12.contact.m_flags = (_local12.contact.m_flags | b2Contact.e_islandFlag);
_local11 = _local12.other;
if ((_local11.m_flags & b2Body.e_islandFlag)){
} else {
var _temp2 = _local9;
_local9 = (_local9 + 1);
var _local16 = _temp2;
_local7[_local16] = _local11;
_local11.m_flags = (_local11.m_flags | b2Body.e_islandFlag);
};
};
};
_local12 = _local12.next;
};
_local13 = _local2.m_jointList;
while (_local13) {
if (_local13.joint.m_islandFlag == true){
} else {
_local3.AddJoint(_local13.joint);
_local13.joint.m_islandFlag = true;
_local11 = _local13.other;
if ((_local11.m_flags & b2Body.e_islandFlag)){
} else {
var _temp3 = _local9;
_local9 = (_local9 + 1);
_local16 = _temp3;
_local7[_local16] = _local11;
_local11.m_flags = (_local11.m_flags | b2Body.e_islandFlag);
};
};
_local13 = _local13.next;
};
};
};
_local3.Solve(_arg1, m_gravity, m_positionCorrection, m_allowSleep);
if (_local3.m_positionIterationCount > m_positionIterationCount){
m_positionIterationCount = _local3.m_positionIterationCount;
};
_local10 = 0;
while (_local10 < _local3.m_bodyCount) {
_local2 = _local3.m_bodies[_local10];
if (_local2.IsStatic()){
_local2.m_flags = (_local2.m_flags & ~(b2Body.e_islandFlag));
};
_local10++;
};
};
};
_local8 = _local8.m_next;
};
_local2 = m_bodyList;
while (_local2) {
if ((_local2.m_flags & (b2Body.e_sleepFlag | b2Body.e_frozenFlag))){
} else {
if (_local2.IsStatic()){
} else {
_local14 = _local2.SynchronizeShapes();
if ((((_local14 == false)) && (!((m_boundaryListener == null))))){
m_boundaryListener.Violation(_local2);
};
};
};
_local2 = _local2.m_next;
};
m_broadPhase.Commit();
}
public function Query(_arg1:b2AABB, _arg2:Array, _arg3:int):int{
var _local4:Array;
var _local5:int;
var _local6:int;
_local4 = new Array(_arg3);
_local5 = m_broadPhase.QueryAABB(_arg1, _local4, _arg3);
_local6 = 0;
while (_local6 < _local5) {
_arg2[_local6] = _local4[_local6];
_local6++;
};
return (_local5);
}
public function SetGravity(_arg1:b2Vec2):void{
m_gravity = _arg1;
}
public function SolveTOI(_arg1:b2TimeStep):void{
var _local2:b2Body;
var _local3:b2Shape;
var _local4:b2Shape;
var _local5:b2Body;
var _local6:b2Body;
var _local7:b2ContactEdge;
var _local8:b2Island;
var _local9:int;
var _local10:Array;
var _local11:b2Contact;
var _local12:b2Contact;
var _local13:Number;
var _local14:b2Body;
var _local15:int;
var _local16:b2TimeStep;
var _local17:int;
var _local18:Number;
var _local19:Number;
var _local20:b2Body;
var _local21:Boolean;
_local8 = new b2Island(m_bodyCount, b2Settings.b2_maxTOIContactsPerIsland, 0, m_stackAllocator, m_contactListener);
_local9 = m_bodyCount;
_local10 = new Array(_local9);
_local2 = m_bodyList;
while (_local2) {
_local2.m_flags = (_local2.m_flags & ~(b2Body.e_islandFlag));
_local2.m_sweep.t0 = 0;
_local2 = _local2.m_next;
};
_local11 = m_contactList;
while (_local11) {
_local11.m_flags = (_local11.m_flags & ~((b2Contact.e_toiFlag | b2Contact.e_islandFlag)));
_local11 = _local11.m_next;
};
while (true) {
_local12 = null;
_local13 = 1;
_local11 = m_contactList;
for (;_local11;(_local11 = _local11.m_next)) {
if ((_local11.m_flags & (b2Contact.e_slowFlag | b2Contact.e_nonSolidFlag))){
} else {
_local18 = 1;
if ((_local11.m_flags & b2Contact.e_toiFlag)){
_local18 = _local11.m_toi;
} else {
_local3 = _local11.m_shape1;
_local4 = _local11.m_shape2;
_local5 = _local3.m_body;
_local6 = _local4.m_body;
if (((((_local5.IsStatic()) || (_local5.IsSleeping()))) && (((_local6.IsStatic()) || (_local6.IsSleeping()))))){
continue;
};
_local19 = _local5.m_sweep.t0;
if (_local5.m_sweep.t0 < _local6.m_sweep.t0){
_local19 = _local6.m_sweep.t0;
_local5.m_sweep.Advance(_local19);
} else {
if (_local6.m_sweep.t0 < _local5.m_sweep.t0){
_local19 = _local5.m_sweep.t0;
_local6.m_sweep.Advance(_local19);
};
};
_local18 = b2TimeOfImpact.TimeOfImpact(_local11.m_shape1, _local5.m_sweep, _local11.m_shape2, _local6.m_sweep);
if ((((_local18 > 0)) && ((_local18 < 1)))){
_local18 = (((1 - _local18) * _local19) + _local18);
if (_local18 > 1){
_local18 = 1;
};
};
_local11.m_toi = _local18;
_local11.m_flags = (_local11.m_flags | b2Contact.e_toiFlag);
};
if ((((Number.MIN_VALUE < _local18)) && ((_local18 < _local13)))){
_local12 = _local11;
_local13 = _local18;
};
};
};
if ((((_local12 == null)) || (((1 - (100 * Number.MIN_VALUE)) < _local13)))){
break;
};
_local3 = _local12.m_shape1;
_local4 = _local12.m_shape2;
_local5 = _local3.m_body;
_local6 = _local4.m_body;
_local5.Advance(_local13);
_local6.Advance(_local13);
_local12.Update(m_contactListener);
_local12.m_flags = (_local12.m_flags & ~(b2Contact.e_toiFlag));
if (_local12.m_manifoldCount == 0){
} else {
_local14 = _local5;
if (_local14.IsStatic()){
_local14 = _local6;
};
_local8.Clear();
_local15 = 0;
var _temp1 = _local15;
_local15 = (_local15 + 1);
var _local22 = _temp1;
_local10[_local22] = _local14;
_local14.m_flags = (_local14.m_flags | b2Body.e_islandFlag);
while (_local15 > 0) {
--_local15;
_local2 = _local10[_local15];
_local8.AddBody(_local2);
_local2.m_flags = (_local2.m_flags & ~(b2Body.e_sleepFlag));
if (_local2.IsStatic()){
} else {
_local7 = _local2.m_contactList;
while (_local7) {
if (_local8.m_contactCount == _local8.m_contactCapacity){
} else {
if ((_local7.contact.m_flags & ((b2Contact.e_islandFlag | b2Contact.e_slowFlag) | b2Contact.e_nonSolidFlag))){
} else {
if (_local7.contact.m_manifoldCount == 0){
} else {
_local8.AddContact(_local7.contact);
_local7.contact.m_flags = (_local7.contact.m_flags | b2Contact.e_islandFlag);
_local20 = _local7.other;
if ((_local20.m_flags & b2Body.e_islandFlag)){
} else {
if (_local20.IsStatic() == false){
_local20.Advance(_local13);
_local20.WakeUp();
};
var _temp2 = _local15;
_local15 = (_local15 + 1);
var _local23 = _temp2;
_local10[_local23] = _local20;
_local20.m_flags = (_local20.m_flags | b2Body.e_islandFlag);
};
};
};
};
_local7 = _local7.next;
};
};
};
_local16 = new b2TimeStep();
_local16.dt = ((1 - _local13) * _arg1.dt);
_local16.inv_dt = (1 / _local16.dt);
_local16.maxIterations = _arg1.maxIterations;
_local8.SolveTOI(_local16);
_local17 = 0;
while (_local17 < _local8.m_bodyCount) {
_local2 = _local8.m_bodies[_local17];
_local2.m_flags = (_local2.m_flags & ~(b2Body.e_islandFlag));
if ((_local2.m_flags & (b2Body.e_sleepFlag | b2Body.e_frozenFlag))){
} else {
if (_local2.IsStatic()){
} else {
_local21 = _local2.SynchronizeShapes();
if ((((_local21 == false)) && (!((m_boundaryListener == null))))){
m_boundaryListener.Violation(_local2);
};
_local7 = _local2.m_contactList;
while (_local7) {
_local7.contact.m_flags = (_local7.contact.m_flags & ~(b2Contact.e_toiFlag));
_local7 = _local7.next;
};
};
};
_local17++;
};
_local17 = 0;
while (_local17 < _local8.m_contactCount) {
_local11 = _local8.m_contacts[_local17];
_local8.m_contacts[_local17].m_flags = (_local11.m_flags & ~((b2Contact.e_toiFlag | b2Contact.e_islandFlag)));
_local17++;
};
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(_arg1:Boolean):void{
m_warmStarting = _arg1;
}
public function SetPositionCorrection(_arg1:Boolean):void{
m_positionCorrection = _arg1;
}
public function CreateJoint(_arg1:b2JointDef):b2Joint{
var _local2:b2Joint;
var _local3:b2Body;
var _local4:b2Shape;
_local2 = b2Joint.Create(_arg1, m_blockAllocator);
_local2.m_prev = null;
_local2.m_next = m_jointList;
if (m_jointList){
m_jointList.m_prev = _local2;
};
m_jointList = _local2;
m_jointCount++;
_local2.m_node1.joint = _local2;
_local2.m_node1.other = _local2.m_body2;
_local2.m_node1.prev = null;
_local2.m_node1.next = _local2.m_body1.m_jointList;
if (_local2.m_body1.m_jointList){
_local2.m_body1.m_jointList.prev = _local2.m_node1;
};
_local2.m_body1.m_jointList = _local2.m_node1;
_local2.m_node2.joint = _local2;
_local2.m_node2.other = _local2.m_body1;
_local2.m_node2.prev = null;
_local2.m_node2.next = _local2.m_body2.m_jointList;
if (_local2.m_body2.m_jointList){
_local2.m_body2.m_jointList.prev = _local2.m_node2;
};
_local2.m_body2.m_jointList = _local2.m_node2;
if (_arg1.collideConnected == false){
_local3 = ((_arg1.body1.m_shapeCount < _arg1.body2.m_shapeCount)) ? _arg1.body1 : _arg1.body2;
_local4 = _local3.m_shapeList;
while (_local4) {
_local4.RefilterProxy(m_broadPhase, _local3.m_xf);
_local4 = _local4.m_next;
};
};
return (_local2);
}
public function DestroyJoint(_arg1:b2Joint):void{
var _local2:Boolean;
var _local3:b2Body;
var _local4:b2Body;
var _local5:b2Body;
var _local6:b2Shape;
_local2 = _arg1.m_collideConnected;
if (_arg1.m_prev){
_arg1.m_prev.m_next = _arg1.m_next;
};
if (_arg1.m_next){
_arg1.m_next.m_prev = _arg1.m_prev;
};
if (_arg1 == m_jointList){
m_jointList = _arg1.m_next;
};
_local3 = _arg1.m_body1;
_local4 = _arg1.m_body2;
_local3.WakeUp();
_local4.WakeUp();
if (_arg1.m_node1.prev){
_arg1.m_node1.prev.next = _arg1.m_node1.next;
};
if (_arg1.m_node1.next){
_arg1.m_node1.next.prev = _arg1.m_node1.prev;
};
if (_arg1.m_node1 == _local3.m_jointList){
_local3.m_jointList = _arg1.m_node1.next;
};
_arg1.m_node1.prev = null;
_arg1.m_node1.next = null;
if (_arg1.m_node2.prev){
_arg1.m_node2.prev.next = _arg1.m_node2.next;
};
if (_arg1.m_node2.next){
_arg1.m_node2.next.prev = _arg1.m_node2.prev;
};
if (_arg1.m_node2 == _local4.m_jointList){
_local4.m_jointList = _arg1.m_node2.next;
};
_arg1.m_node2.prev = null;
_arg1.m_node2.next = null;
b2Joint.Destroy(_arg1, m_blockAllocator);
m_jointCount--;
if (_local2 == false){
_local5 = ((_local3.m_shapeCount < _local4.m_shapeCount)) ? _local3 : _local4;
_local6 = _local5.m_shapeList;
while (_local6) {
_local6.RefilterProxy(m_broadPhase, _local5.m_xf);
_local6 = _local6.m_next;
};
};
}
public function SetContactListener(_arg1:b2ContactListener):void{
m_contactListener = _arg1;
}
public function CreateBody(_arg1:b2BodyDef):b2Body{
var _local2:b2Body;
if (m_lock == true){
return (null);
};
_local2 = new b2Body(_arg1, this);
_local2.m_prev = null;
_local2.m_next = m_bodyList;
if (m_bodyList){
m_bodyList.m_prev = _local2;
};
m_bodyList = _local2;
m_bodyCount++;
return (_local2);
}
public function SetBoundaryListener(_arg1:b2BoundaryListener):void{
m_boundaryListener = _arg1;
}
public function SetDestructionListener(_arg1:b2DestructionListener):void{
m_destructionListener = _arg1;
}
public function Step(_arg1:Number, _arg2:int):void{
var _local3:b2TimeStep;
m_lock = true;
_local3 = new b2TimeStep();
_local3.dt = _arg1;
_local3.maxIterations = _arg2;
if (_arg1 > 0){
_local3.inv_dt = (1 / _arg1);
} else {
_local3.inv_dt = 0;
};
_local3.dtRatio = (m_inv_dt0 * _arg1);
_local3.positionCorrection = m_positionCorrection;
_local3.warmStarting = m_warmStarting;
m_contactManager.Collide();
if (_local3.dt > 0){
Solve(_local3);
};
if (((m_continuousPhysics) && ((_local3.dt > 0)))){
SolveTOI(_local3);
};
DrawDebugData();
m_inv_dt0 = _local3.inv_dt;
m_lock = false;
}
public function GetBodyCount():int{
return (m_bodyCount);
}
public function GetJointCount():int{
return (m_jointCount);
}
}
}//package Box2D.Dynamics
Section 75
//as3_shared_objects (classesAS3.as3_shared_objects)
package classesAS3 {
import flash.display.*;
import flash.net.*;
import flash.text.*;
public class as3_shared_objects extends Sprite {
var shared:SharedObject;
public function as3_shared_objects(){
shared = SharedObject.getLocal("qfpreloaded2");
if (shared.data.visits == undefined){
shared.data.visits = 1;
shared.data.levelNumber = 1;
shared.data.score = 0;
};
shared.close();
}
public function show_text(_arg1){
var _local2:TextField;
var _local3:TextFormat;
_local2 = new TextField();
_local3 = new TextFormat();
_local3.font = "Lucida Console";
_local3.color = 0xFFFF00;
_local2.width = 300;
_local2.defaultTextFormat = _local3;
_local2.x = 25;
_local2.y = 15;
addChild(_local2);
_local2.appendText((("You visited this page " + _arg1) + " times"));
}
public function saveGameCookie(_arg1, _arg2){
shared = SharedObject.getLocal("qfpreloaded2");
shared.data.levelNumber = _arg2;
shared.data.score = _arg1;
shared.close();
}
public function newGame(){
var _local1:Object;
shared = SharedObject.getLocal("qfpreloaded2");
shared.data.visits++;
shared.data.levelNumber = 1;
shared.data.score = 0;
_local1 = new Object();
_local1.visits = shared.data.visits;
_local1.levelNumber = shared.data.levelNumber;
_local1.score = shared.data.score;
shared.close();
return (_local1);
}
public function loadOldGame(){
var _local1:Object;
shared = SharedObject.getLocal("qfpreloaded2");
_local1 = new Object();
if (shared.data.visits != undefined){
_local1.visits = shared.data.visits;
_local1.levelNumber = shared.data.levelNumber;
_local1.score = shared.data.score;
} else {
_local1.visits++;
_local1.levelNumber = 1;
_local1.score = 0;
};
shared.close();
return (_local1);
}
}
}//package classesAS3
Section 76
//GameArcher1 (classesAS3.GameArcher1)
package classesAS3 {
import flash.display.*;
public class GameArcher1 extends MovieClip {
public var myType:String;
public var goodBad:Boolean;
public var myObject:Object;
public var mySmoke;
public var collisionWith:MovieClip;
public var collisionWithS:MovieClip;
public var collisionWithW:MovieClip;
public var noRotation:Boolean;
public var myShapeDef:Object;
public var myParent:Object;
public var rt:Object;
public var soldier:MovieClip;
public var energy:Number;
public var filterData:Object;
public var myBodyDef:Object;
public var buildingBit:Boolean;// = false
public function GameArcher1(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6){
buildingBit = false;
super();
rt = _arg1;
myBodyDef = _arg2;
myShapeDef = _arg3;
myType = _arg4;
myParent = _arg5;
mySmoke = null;
goodBad = _arg6;
energy = 100;
noRotation = true;
}
function destroyMe(){
if (rt.bodyGrabbed == myBodyDef){
rt.bodyGrabbed = null;
};
rt.m_world.DestroyBody(myBodyDef);
removeMe();
}
public function removeMe(){
myParent.removeChild(this);
}
public function checkOffScreen(){
if (this.x > 1700){
destroyMe();
} else {
if (this.x < -250){
destroyMe();
};
};
if (this.y > 800){
destroyMe();
};
}
public function setupPuffSmoke(){
if (mySmoke == null){
mySmoke = new GameHitFloorSmoke(rt, myParent, this);
mySmoke.x = this.x;
mySmoke.y = this.y;
myParent.addChild(mySmoke);
};
}
}
}//package classesAS3
Section 77
//GameBadArcher1 (classesAS3.GameBadArcher1)
package classesAS3 {
import flash.display.*;
public class GameBadArcher1 extends MovieClip {
public var myType:String;
public var goodBad:Boolean;
public var myObject:Object;
public var mySmoke;
public var collisionWith:MovieClip;
public var collisionWithS:MovieClip;
public var noRotation:Boolean;
public var myShapeDef:Object;
public var myParent:Object;
public var rt:Object;
public var energy:Number;
public var filterData:Object;
public var myBodyDef:Object;
public var buildingBit:Boolean;// = false
public function GameBadArcher1(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6){
buildingBit = false;
super();
addFrameScript(0, frame1);
rt = _arg1;
myBodyDef = _arg2;
myShapeDef = _arg3;
myType = _arg4;
myParent = _arg5;
mySmoke = null;
goodBad = _arg6;
energy = 100;
noRotation = true;
}
function destroyMe(){
if (rt.bodyGrabbed == myBodyDef){
rt.bodyGrabbed = null;
};
rt.m_world.DestroyBody(myBodyDef);
removeMe();
}
public function removeMe(){
myObject.remove();
this.stop();
}
function frame1(){
stop();
}
public function checkOffScreen(){
if (this.x > 1700){
destroyMe();
} else {
if (this.x < -50){
destroyMe();
};
};
if (this.y > 800){
destroyMe();
};
}
public function decreaseEnergy(_arg1){
myObject.decreaseEnergy(_arg1);
}
public function setupPuffSmoke(){
if (mySmoke == null){
mySmoke = new GameHitFloorSmoke(rt, myParent, this);
mySmoke.x = this.x;
mySmoke.y = this.y;
myParent.addChild(mySmoke);
};
}
}
}//package classesAS3
Section 78
//GameBadArcher2 (classesAS3.GameBadArcher2)
package classesAS3 {
import flash.display.*;
public class GameBadArcher2 extends MovieClip {
public var goodBad:Boolean;
public var myObject:Object;
public var myType:String;
public var mySmoke;
public var collisionWith:MovieClip;
public var collisionWithS:MovieClip;
public var noRotation:Boolean;
public var myShapeDef:Object;
public var myParent:Object;
public var rt:Object;
public var archer:MovieClip;
public var energy:Number;
public var filterData:Object;
public var myBodyDef:Object;
public var buildingBit:Boolean;// = false
public function GameBadArcher2(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6){
buildingBit = false;
super();
addFrameScript(0, frame1);
rt = _arg1;
myBodyDef = _arg2;
myShapeDef = _arg3;
myType = _arg4;
myParent = _arg5;
mySmoke = null;
goodBad = _arg6;
energy = 100;
noRotation = true;
}
function destroyMe(){
if (rt.bodyGrabbed == myBodyDef){
rt.bodyGrabbed = null;
};
rt.m_world.DestroyBody(myBodyDef);
removeMe();
}
public function removeMe(){
myObject.remove();
this.stop();
}
function frame1(){
stop();
}
public function checkOffScreen(){
if (this.x > 1700){
destroyMe();
} else {
if (this.x < -50){
destroyMe();
};
};
if (this.y > 800){
destroyMe();
};
}
public function decreaseEnergy(_arg1){
myObject.decreaseEnergy(_arg1);
}
public function setupPuffSmoke(){
if (mySmoke == null){
mySmoke = new GameHitFloorSmoke(rt, myParent, this);
mySmoke.x = this.x;
mySmoke.y = this.y;
myParent.addChild(mySmoke);
};
}
}
}//package classesAS3
Section 79
//GameBadGuy (classesAS3.GameBadGuy)
package classesAS3 {
import flash.display.*;
import Box2D.Common.Math.*;
import flash.media.*;
import classesAS3.*;
import flash.filters.*;
class GameBadGuy {
var xVel:Number;// = 0
var myDamageDelay:Number;
var hitVel;
var yPos:Number;// = 0
var cArraylength:Number;
var inToGround:Number;
var myOldAnimationState:Number;
var numberOfMissiles;// = 0
public var soldierState:int;
var myDamage:Number;
var range:Number;
var energyMc:MovieClip;
var rt:Object;
var speed:Number;// = 0
var gravity:Number;
var delayToMove:Number;
var collisionArray:Array;
var myName:String;
var projectileMc:Object;
var speedOld:Number;
var energyBarMc:GameEnergyBar;
var dead:Boolean;
var yVel:Number;// = 0
var glowFilter:GlowFilter;
var distanceArray:Array;
var myParent:Object;
var mC:Object;
var energy:Number;// = 0
public var frozen:Boolean;// = false
var myFireDelay:Number;
var energyBarOn:Number;
var Useful:GameUseful;
var energyStart:Number;// = 0
var xPos:Number;// = 0
var headHitBlock:Object;
var xOrigin:Number;// = 0
var myScoreValue:Number;
var missileName:String;
var delayToFireMissile:Number;// = 1
var targetX:Number;
var targetY:Number;
public var myCurrentSound:SoundChannel;
var filterDelay:Number;
var myRange:Number;
var xDir:Number;
var collisionCheck:Number;
var yOrigin:Number;// = 0
public static const SOLDIER_STATE_DEFEND:int = 1;
public static const SOLDIER_STATE_FALLING:int = 4;
public static const SOLDIER_E_MOVE:int = 5;
public static const SOLDIER_STATE_RETREAT:int = 3;
public static const SOLDIER_E_STAND:int = 0;
public static const SOLDIER_STATE_ATTACK:int = 0;
public static const SOLDIER_E_BUILD:int = 2;
public static const SOLDIER_STATE_MOVE:int = 5;
public static const SOLDIER_STATE_FIGHTING:int = 2;
function GameBadGuy(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8, _arg9){
var _local10:Number;
xOrigin = 0;
yOrigin = 0;
xPos = 0;
yPos = 0;
xVel = 0;
yVel = 0;
speed = 0;
energyStart = 0;
energy = 0;
delayToFireMissile = 1;
numberOfMissiles = 0;
frozen = false;
super();
mC = _arg5;
mC.myObject = this;
rt = _arg2;
cArraylength = 4;
myDamage = _arg9;
if (mC.myType == "badArcher2"){
myFireDelay = _arg6.RandomNumber(20, 40);
myRange = 450;
} else {
myFireDelay = _arg6.RandomNumber(80, 120);
myRange = 380;
};
Useful = _arg6;
myScoreValue = _arg8;
_local10 = Useful.RandomNumber(1, 10);
_local10 = (_local10 - 10);
collisionArray = new Array();
dead = false;
inToGround = 0;
xOrigin = _arg3;
yOrigin = _arg4;
xPos = 0;
yPos = 0;
xVel = 0;
yVel = 0;
myParent = mC.myParent;
hitVel = 0;
energyBarOn = 0;
gravity = 0.1;
_local10 = Useful.RandomNumber(1, 10);
_local10 = (_local10 / 100);
_arg7 = (_arg7 + _local10);
speed = _arg7;
speedOld = _arg7;
xDir = 1;
mC.scaleX = -1;
distanceArray = new Array();
glowFilter = new GlowFilter(0xFFFFFF, 1, 3, 3, 3, 1);
numberOfMissiles = 0;
myDamageDelay = 8;
energyStart = 100;
energy = energyStart;
soldierState = SOLDIER_STATE_ATTACK;
filterDelay = 1;
if (mC.myType == "badArcher2"){
mC.myType = "badArcher1";
myName = "badArcher2";
};
myName = _arg1;
collisionCheck = 0;
delayToMove = _arg9;
if (myName == "bird"){
xVel = -(speed);
updatePosition2();
} else {
if (myName == "dragon"){
xVel = -(speed);
updatePosition2();
} else {
updatePosition();
};
};
targetX = mC.x;
myOldAnimationState = mC.currentFrame;
}
function applyGravity(){
yVel = (yVel + gravity);
}
function updatePosition(){
var _local1:b2Vec2;
if (frozen == false){
xVel = (xDir * speed);
_local1 = mC.myBodyDef.GetLinearVelocity();
_local1.x = xVel;
mC.myBodyDef.WakeUp();
mC.myBodyDef.SetLinearVelocity(_local1);
};
}
function checkIfInRange(){
var _local1:*;
if (rt.movedOverHalf == true){
if (rt.inGameGoodGuysMc.numChildren > 0){
findEnemy();
if (distanceArray.length > 0){
_local1 = myRange;
if (mC.x > distanceArray[0].distSprite.x){
xDir = -1;
mC.scaleX = 1;
} else {
xDir = 1;
mC.scaleX = -1;
};
if (mC.currentFrame != 2){
speed = speedOld;
mC.gotoAndStop("run");
};
soldierState = SOLDIER_STATE_ATTACK;
};
updatePosition();
};
};
}
function checkIfStuck(){
var _local1:Object;
var _local2:Object;
var _local3:Object;
var _local4:b2Vec2;
var _local5:b2Vec2;
_local1 = new Object();
_local1.xPos = mC.x;
_local1.yPos = mC.y;
collisionArray.push(_local1);
_local2 = collisionArray[0];
if (collisionArray.length >= cArraylength){
_local3 = collisionArray[(cArraylength - 1)];
if (_local2.xPos == mC.x){
if (_local2.yPos == mC.y){
_local4 = new b2Vec2();
xVel = (xDir * speed);
_local4.x = xVel;
_local4.y = (_local4.y - -50000);
_local5 = mC.myBodyDef.GetPosition();
mC.myBodyDef.ApplyImpulse(_local4, _local5);
};
};
if (collisionArray.length > cArraylength){
collisionArray.shift();
};
};
}
function findEnemy(){
var _local1:Object;
var _local2:MovieClip;
var _local3:int;
var _local4:Object;
var _local5:Boolean;
distanceArray = new Array();
_local1 = new Object();
_local3 = 0;
while (_local3 < rt.inGameBuildingsMc.numChildren) {
_local4 = new Object();
_local2 = rt.inGameBuildingsMc.getChildAt(_local3);
if (_local2.myType != "wood"){
if (_local2.myType != "boulder"){
if (_local2.energy != null){
if (_local2.energy > 0){
_local5 = false;
if (rt.Box2d.bodyGrabbed != null){
if (_local2 == rt.Box2d.bodyGrabbed.m_userData){
_local5 = true;
};
};
if (_local5 == false){
_local4.distSprite = _local2;
_local4.dist = Useful.getDistance(mC.x, mC.y, _local4.distSprite.x, _local4.distSprite.y);
distanceArray.push(_local4);
};
};
};
};
};
_local3++;
};
_local3 = 0;
while (_local3 < rt.inGameGoodGuysMc.numChildren) {
_local4 = new Object();
if (rt.inGameGoodGuysMc.getChildAt(_local3).myType != "floor"){
if (rt.inGameGoodGuysMc.getChildAt(_local3).myType != "catapultBase"){
if (rt.inGameGoodGuysMc.getChildAt(_local3).myType != "catapultRod"){
if (rt.inGameGoodGuysMc.getChildAt(_local3).myType != "wood"){
if (rt.inGameGoodGuysMc.getChildAt(_local3).myType != "kingGood"){
if (rt.inGameGoodGuysMc.getChildAt(_local3).energy != null){
if (rt.inGameGoodGuysMc.getChildAt(_local3).energy > 0){
_local5 = false;
if (rt.Box2d.bodyGrabbed != null){
if (rt.inGameGoodGuysMc.getChildAt(_local3) == rt.Box2d.bodyGrabbed.m_userData){
_local5 = true;
};
};
if (_local5 == false){
_local4.distSprite = rt.inGameGoodGuysMc.getChildAt(_local3);
_local4.dist = Useful.getDistance(mC.x, mC.y, _local4.distSprite.x, _local4.distSprite.y);
distanceArray.push(_local4);
};
};
};
} else {
_local5 = false;
if (rt.Box2d.bodyGrabbed != null){
if (rt.inGameGoodGuysMc.getChildAt(_local3) == rt.Box2d.bodyGrabbed.m_userData){
_local5 = true;
};
};
if (_local5 == false){
_local1.distSprite = rt.inGameGoodGuysMc.getChildAt(_local3);
_local1.dist = Useful.getDistance(mC.x, mC.y, _local1.distSprite.x, _local1.distSprite.y);
};
};
};
};
};
};
_local3++;
};
distanceArray.sortOn("dist", Array.NUMERIC);
if (_local1.dist < 270){
distanceArray.splice(0, 0, _local1);
} else {
if (distanceArray.length > 0){
if (distanceArray[0].dist > myRange){
distanceArray.splice(0, 0, _local1);
} else {
distanceArray.push(_local1);
};
} else {
distanceArray.splice(0, 0, _local1);
};
};
}
function updatePosition2(){
var _local1:*;
var _local2:*;
xPos = (xPos + xVel);
yPos = (yPos + yVel);
_local1 = mC.x;
_local2 = mC.y;
mC.x = (xOrigin + xPos);
mC.y = (yOrigin + yPos);
}
function checkForFire(){
var _local1:*;
var _local2:Object;
var _local3:Object;
delayToFireMissile--;
if (delayToFireMissile == 0){
_local1 = myFireDelay;
delayToFireMissile = _local1;
mC.gotoAndStop("attack");
_local2 = distanceArray[0].distSprite;
if (_local2.x > mC.x){
xDir = 1;
mC.scaleX = -1;
} else {
xDir = -1;
mC.scaleX = 1;
};
if (myName == "badArcher2"){
projectileMc = new evilWizardMissle();
} else {
projectileMc = new GameArrow();
};
rt.inGameMissilesMc.addChild(projectileMc);
_local3 = Useful.pointTowards(_local2.x, _local2.y, mC.x, mC.y);
rt.missilesArray.push(new GameMissile(projectileMc, rt, mC.x, mC.y, "", Useful, _local3, 16, this, myDamage));
};
}
public function remove(){
var _local1:int;
var _local2:Number;
var _local3:*;
if (myCurrentSound != null){
myCurrentSound.stop();
};
_local1 = 0;
while (_local1 < rt.inGameEnemyMc.numChildren) {
if (rt.inGameEnemyMc.getChildAt(_local1) == mC){
rt.inGameEnemyMc.removeChild(mC);
mC.stop();
};
_local1++;
};
_local2 = -1;
_local3 = 0;
while (_local3 < rt.badGuysArray.length) {
if (this == rt.badGuysArray[_local3]){
_local2 = _local3;
};
_local3++;
};
if (_local2 >= 0){
rt.badGuysArray.splice(_local2, 1);
};
}
function checkForFire2(){
var _local1:*;
var _local2:Object;
var _local3:Object;
delayToFireMissile--;
if (delayToFireMissile == 0){
_local1 = myFireDelay;
delayToFireMissile = _local1;
mC.gotoAndStop("attack");
_local2 = distanceArray[0].distSprite;
if (myName == "bird"){
projectileMc = new GameRock();
} else {
projectileMc = new GameFireBall();
};
rt.inGameMissilesMc.addChild(projectileMc);
_local3 = Useful.pointTowards(_local2.x, _local2.y, mC.x, mC.y);
rt.missilesArray.push(new GameMissile(projectileMc, rt, mC.x, mC.y, "", Useful, _local3, 16, this, myDamage));
};
}
function swordAttack(){
var _local1:Object;
delayToFireMissile--;
if (delayToFireMissile == 0){
delayToFireMissile = 10;
if (mC.currentFrame != 4){
mC.gotoAndStop("shoot");
};
_local1 = distanceArray[0].distSprite;
if (_local1 == rt.Player){
rt.decreaseEnergy(1);
} else {
_local1.decreaseEnergy(mC.x, myDamage);
};
};
}
function decreaseEnergy(_arg1){
var _local2:Number;
var _local3:*;
if (mC.myType == "badArcher1"){
};
myDamageDelay--;
if (myDamageDelay == 0){
myDamageDelay = 8;
if (energy > 0){
energy = (energy - _arg1);
if (energyBarOn == 0){
energyBarOn = 1;
energyBarMc = new GameEnergyBar(this);
mC.addChild(energyBarMc);
};
energyBarMc.x = 0;
energyBarMc.y = -35;
_local2 = (energy / 10);
energyBarMc.bar.bar.y = int((10 - _local2));
if (energy <= 0){
rt.increaseScore(myScoreValue);
rt.increaseMoney(myScoreValue);
_local3 = new GameRisingMoney(rt, rt.inGameScoreMc, myScoreValue);
rt.inGameScoreMc.addChild(_local3);
_local3.x = mC.x;
_local3.y = (mC.y - 10);
inToGround = 0;
dead = true;
myCurrentSound = rt.Sounds.playSoundFx("die_v1_Fx", 1, 0, 1);
mC.gotoAndStop("die");
if (myName != "bird"){
if (myName != "dragon"){
rt.Box2d.m_world.DestroyBody(mC.myBodyDef);
};
};
return (true);
};
if (myName == "bird"){
updatePosition2();
} else {
if (myName == "dragon"){
updatePosition2();
} else {
updatePosition();
};
};
};
};
return (false);
}
function findEnemyTarget(){
var _local1:int;
var _local2:Boolean;
var _local3:Object;
var _local4:*;
distanceArray = new Array();
_local1 = 0;
while (_local1 < rt.badGuysArray.length) {
if (rt.badGuysArray[_local1].dead == false){
_local2 = false;
_local3 = new Object();
_local3.distSprite = rt.badGuysArray[_local1];
_local3.dist = Useful.getDistanceQ(mC.x, mC.y, rt.badGuysArray[_local1].mC.x, rt.badGuysArray[_local1].mC.y);
_local4 = myRange;
if (_local3.dist < _local4){
if (myName == "grenader"){
distanceArray.push(_local3);
} else {
if (Useful.checkForLOS(mC.x, (mC.y - 5), _local3.distSprite.mC.x, (_local3.distSprite.mC.y - 25), _local3.distSprite.mC) == false){
distanceArray.push(_local3);
};
};
};
};
_local1++;
};
distanceArray.sortOn("dist", Array.NUMERIC);
}
function mainLoop(){
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:b2Vec2;
var _local6:Number;
if (dead == false){
if (filterDelay > 1){
filterDelay--;
if (filterDelay == 1){
mC.filters = [];
};
};
if (delayToMove > 0){
delayToMove--;
} else {
if (frozen == false){
if (myName == "bird"){
if (rt.inGameGoodGuysMc.numChildren > 0){
findEnemy();
if (distanceArray.length > 0){
_local1 = (375 - mC.y);
_local1 = int((_local1 / 10));
_local2 = (myRange + _local1);
if (distanceArray[0].dist < _local2){
_local3 = 0;
if (distanceArray[0].distSprite.y < mC.y){
_local3 = (mC.y - distanceArray[0].distSprite.y);
} else {
_local3 = (distanceArray[0].distSprite.y - mC.y);
};
checkForFire2();
};
};
};
updatePosition2();
if (mC.x < -50){
remove();
};
} else {
if (myName == "dragon"){
if (rt.inGameGoodGuysMc.numChildren > 0){
findEnemy();
if (distanceArray.length > 0){
_local1 = (375 - mC.y);
_local1 = int((_local1 / 10));
_local2 = (myRange + _local1);
if (distanceArray[0].dist < _local2){
_local3 = 0;
if (distanceArray[0].distSprite.y < mC.y){
_local3 = (mC.y - distanceArray[0].distSprite.y);
} else {
_local3 = (distanceArray[0].distSprite.y - mC.y);
};
checkForFire2();
};
};
};
updatePosition2();
if (mC.x < -50){
remove();
};
} else {
if (mC.myType == "badArcher1"){
if (rt.Box2d.bodyGrabbed != mC.myBodyDef){
if (rt.inGameGoodGuysMc.numChildren > 0){
findEnemy();
if (distanceArray.length > 0){
_local1 = (375 - mC.y);
_local1 = int((_local1 / 10));
_local2 = (myRange + _local1);
if (distanceArray[0].dist < _local2){
_local3 = 0;
if (distanceArray[0].distSprite.y < mC.y){
_local3 = (mC.y - distanceArray[0].distSprite.y);
} else {
_local3 = (distanceArray[0].distSprite.y - mC.y);
};
if (_local3 < 20){
if (mC.x > distanceArray[0].distSprite.x){
xDir = -1;
mC.scaleX = 1;
} else {
xDir = 1;
mC.scaleX = -1;
};
};
checkForFire();
};
};
};
};
} else {
if (rt.Box2d.bodyGrabbed != mC.myBodyDef){
if (mC.collisionWith != null){
if (mC.collisionWith.energy > 0){
if (mC.collisionWith.myType == "block"){
_local4 = (mC.y - mC.collisionWith.y);
if (_local4 > 10){
if (headHitBlock != mC.collisionWith){
headHitBlock = mC.collisionWith;
collisionCheck = 10;
decreaseEnergy(10);
};
};
if (soldierState != SOLDIER_STATE_FIGHTING){
mC.gotoAndStop("attack");
soldierState = SOLDIER_STATE_FIGHTING;
};
if (mC.collisionWith.decreaseEnergy(myDamage)){
soldierState = SOLDIER_STATE_ATTACK;
mC.collisionWith = null;
};
} else {
if (mC.collisionWith.myType == "woodBlock"){
_local4 = (mC.y - mC.collisionWith.y);
if (_local4 > 10){
if (headHitBlock != mC.collisionWith){
headHitBlock = mC.collisionWith;
collisionCheck = 10;
decreaseEnergy(10);
};
};
if (soldierState != SOLDIER_STATE_FIGHTING){
mC.gotoAndStop("attack");
soldierState = SOLDIER_STATE_FIGHTING;
};
if (mC.collisionWith.decreaseEnergy(myDamage)){
soldierState = SOLDIER_STATE_ATTACK;
mC.collisionWith = null;
};
} else {
if (mC.collisionWith.myType == "blockEnemy"){
_local4 = (mC.collisionWith.y - mC.y);
if (mC.collisionWith.y > mC.y){
soldierState = SOLDIER_STATE_ATTACK;
mC.collisionWith = null;
};
} else {
if (mC.collisionWith.myType == "wood"){
if (soldierState != SOLDIER_STATE_FIGHTING){
mC.gotoAndStop("attack");
soldierState = SOLDIER_STATE_FIGHTING;
};
if (mC.collisionWith.decreaseEnergy(myDamage)){
soldierState = SOLDIER_STATE_ATTACK;
mC.collisionWith = null;
};
} else {
if (mC.collisionWith.myType == "boulder"){
if (mC.collisionWith == undefined){
soldierState = SOLDIER_STATE_ATTACK;
mC.collisionWith = null;
} else {
if (mC.collisionWith.currentFrame > 4){
soldierState = SOLDIER_STATE_ATTACK;
mC.collisionWith = null;
} else {
if (soldierState != SOLDIER_STATE_FIGHTING){
mC.gotoAndStop("attack");
soldierState = SOLDIER_STATE_FIGHTING;
};
_local5 = mC.myBodyDef.GetLinearVelocity();
decreaseEnergy(25);
if (mC.collisionWith.decreaseEnergy(myDamage)){
soldierState = SOLDIER_STATE_ATTACK;
mC.collisionWith = null;
};
};
};
} else {
soldierState = SOLDIER_STATE_ATTACK;
};
};
};
};
};
if (soldierState == SOLDIER_STATE_FIGHTING){
if (rt.Box2d.bodyGrabbed == null){
if (mC.x > mC.collisionWith.x){
xDir = -1;
mC.scaleX = 1;
} else {
xDir = 1;
mC.scaleX = -1;
};
} else {
if (mC.collisionWith == rt.Box2d.bodyGrabbed.m_userData){
mC.collisionWith = null;
soldierState = SOLDIER_STATE_ATTACK;
} else {
if (mC.x > mC.collisionWith.x){
xDir = -1;
mC.scaleX = 1;
} else {
xDir = 1;
mC.scaleX = -1;
};
};
};
};
} else {
mC.collisionWith = null;
mC.gotoAndStop("attack");
soldierState = SOLDIER_STATE_FIGHTING;
};
};
if (mC.collisionWithS != null){
if (mC.collisionWithS.myType == "kingGood"){
if (soldierState != SOLDIER_STATE_FIGHTING){
mC.gotoAndStop("attack");
soldierState = SOLDIER_STATE_FIGHTING;
};
if (rt.decreaseEnergy(myDamage)){
soldierState = SOLDIER_STATE_ATTACK;
mC.collisionWithS.gotoAndStop("die");
mC.collisionWithS = null;
} else {
if (mC.collisionWithS.collisionWithS == null){
mC.collisionWithS.collisionWithS = mC;
};
};
} else {
if (mC.collisionWithS.soldier.currentFrame != 5){
if (mC.collisionWithS.collisionWithS == null){
mC.collisionWithS.collisionWithS = mC;
};
_local6 = Useful.getDistance(mC.x, mC.y, mC.collisionWithS.x, mC.collisionWithS.y);
if (_local6 > 40){
soldierState = SOLDIER_STATE_ATTACK;
} else {
if (mC.collisionWithS.myType == "knight"){
if (soldierState != SOLDIER_STATE_FIGHTING){
mC.gotoAndStop("attack");
soldierState = SOLDIER_STATE_FIGHTING;
};
if (mC.collisionWithS.myObject.decreaseEnergy(myDamage)){
soldierState = SOLDIER_STATE_ATTACK;
mC.collisionWithS = null;
};
} else {
if (mC.collisionWithS.myType == "archer"){
if (soldierState != SOLDIER_STATE_FIGHTING){
mC.gotoAndStop("attack");
soldierState = SOLDIER_STATE_FIGHTING;
};
if (mC.collisionWithS.myObject.decreaseEnergy((myDamage + 2))){
soldierState = SOLDIER_STATE_ATTACK;
mC.collisionWithS = null;
};
} else {
if (mC.collisionWithS.myType == "wizard"){
if (soldierState != SOLDIER_STATE_FIGHTING){
mC.gotoAndStop("attack");
soldierState = SOLDIER_STATE_FIGHTING;
};
if (mC.collisionWithS.myObject.decreaseEnergy((myDamage + 2))){
soldierState = SOLDIER_STATE_ATTACK;
mC.collisionWithS = null;
};
} else {
if (mC.collisionWithS.myType == "knight3"){
if (soldierState != SOLDIER_STATE_FIGHTING){
mC.gotoAndStop("attack");
soldierState = SOLDIER_STATE_FIGHTING;
};
if (mC.collisionWithS.myObject.decreaseEnergy(myDamage)){
soldierState = SOLDIER_STATE_ATTACK;
mC.collisionWithS = null;
};
} else {
if (mC.collisionWithS.myType == "knight4"){
if (soldierState != SOLDIER_STATE_FIGHTING){
mC.gotoAndStop("attack");
soldierState = SOLDIER_STATE_FIGHTING;
};
if (mC.collisionWithS.myObject.decreaseEnergy(myDamage)){
soldierState = SOLDIER_STATE_ATTACK;
mC.collisionWithS = null;
};
};
};
};
};
};
};
} else {
mC.collisionWithS = null;
soldierState = SOLDIER_STATE_ATTACK;
};
};
if (soldierState == SOLDIER_STATE_FIGHTING){
if (rt.Box2d.bodyGrabbed == null){
if (mC.x > mC.collisionWithS.x){
xDir = -1;
mC.scaleX = 1;
} else {
xDir = 1;
mC.scaleX = -1;
};
} else {
if (mC.collisionWithS == rt.Box2d.bodyGrabbed.m_userData){
mC.collisionWithS = null;
soldierState = SOLDIER_STATE_ATTACK;
} else {
if (mC.x > mC.collisionWithS.x){
xDir = -1;
mC.scaleX = 1;
} else {
xDir = 1;
mC.scaleX = -1;
};
};
};
};
};
if (soldierState == SOLDIER_STATE_ATTACK){
checkIfInRange();
} else {
if (soldierState == SOLDIER_STATE_DEFEND){
if (mC.currentFrame != 1){
mC.gotoAndStop(1);
};
if (mC.collisionWith != null){
if (mC.collisionWith.myType == "block"){
_local6 = Useful.getDistance(mC.x, mC.y, mC.collisionWith.x, mC.collisionWith.y);
if (_local6 > 40){
soldierState = SOLDIER_STATE_ATTACK;
};
};
};
} else {
if (soldierState == SOLDIER_STATE_FIGHTING){
if (mC.collisionWithS == null){
if (mC.collisionWith == null){
soldierState = SOLDIER_STATE_ATTACK;
};
};
};
};
};
if (mC.currentFrame == 2){
checkIfStuck();
};
} else {
if (mC.currentFrame != 6){
mC.gotoAndStop("pickedUp");
};
};
};
};
};
};
};
} else {
if (mC.currentFrame != 5){
remove();
};
};
}
}
}//package classesAS3
Section 80
//GameBadKnight1 (classesAS3.GameBadKnight1)
package classesAS3 {
import flash.display.*;
public class GameBadKnight1 extends MovieClip {
public var myType:String;
public var goodBad:Boolean;
public var myObject:Object;
public var mySmoke;
public var collisionWith:MovieClip;
public var collisionWithS:MovieClip;
public var noRotation:Boolean;
public var myShapeDef:Object;
public var myParent:Object;
public var rt:Object;
public var energy:Number;
public var filterData:Object;
public var myBodyDef:Object;
public var buildingBit:Boolean;// = false
public function GameBadKnight1(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6){
buildingBit = false;
super();
addFrameScript(0, frame1);
rt = _arg1;
myBodyDef = _arg2;
myShapeDef = _arg3;
myType = _arg4;
myParent = _arg5;
mySmoke = null;
goodBad = _arg6;
energy = 100;
noRotation = true;
}
function destroyMe(){
rt.m_world.DestroyBody(myBodyDef);
removeMe();
}
public function removeMe(){
myObject.remove();
this.stop();
}
function frame1(){
stop();
}
public function checkOffScreen(){
if (this.x > 1700){
destroyMe();
} else {
if (this.x < -50){
destroyMe();
};
};
if (this.y > 800){
destroyMe();
};
}
public function decreaseEnergy(_arg1){
myObject.decreaseEnergy(_arg1);
}
public function setupPuffSmoke(){
if (mySmoke == null){
mySmoke = new GameHitFloorSmoke(rt, myParent, this);
mySmoke.x = this.x;
mySmoke.y = this.y;
myParent.addChild(mySmoke);
};
}
}
}//package classesAS3
Section 81
//GameBadKnight2 (classesAS3.GameBadKnight2)
package classesAS3 {
import flash.display.*;
public class GameBadKnight2 extends MovieClip {
public var myType:String;
public var goodBad:Boolean;
public var myObject:Object;
public var mySmoke;
public var collisionWith:MovieClip;
public var collisionWithS:MovieClip;
public var noRotation:Boolean;
public var myShapeDef:Object;
public var myParent:Object;
public var rt:Object;
public var energy:Number;
public var filterData:Object;
public var myBodyDef:Object;
public var buildingBit:Boolean;// = false
public function GameBadKnight2(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6){
buildingBit = false;
super();
addFrameScript(0, frame1);
rt = _arg1;
myBodyDef = _arg2;
myShapeDef = _arg3;
myType = _arg4;
myParent = _arg5;
mySmoke = null;
goodBad = _arg6;
energy = 100;
noRotation = true;
}
function destroyMe(){
rt.m_world.DestroyBody(myBodyDef);
removeMe();
}
public function removeMe(){
myObject.remove();
this.stop();
}
function frame1(){
stop();
}
public function checkOffScreen(){
if (this.x > 1700){
destroyMe();
} else {
if (this.x < -50){
destroyMe();
};
};
if (this.y > 800){
destroyMe();
};
}
public function decreaseEnergy(_arg1){
myObject.decreaseEnergy(_arg1);
}
public function setupPuffSmoke(){
if (mySmoke == null){
mySmoke = new GameHitFloorSmoke(rt, myParent, this);
mySmoke.x = this.x;
mySmoke.y = this.y;
myParent.addChild(mySmoke);
};
}
}
}//package classesAS3
Section 82
//GameBadKnight3 (classesAS3.GameBadKnight3)
package classesAS3 {
import flash.display.*;
public class GameBadKnight3 extends MovieClip {
public var myType:String;
public var goodBad:Boolean;
public var myObject:Object;
public var mySmoke;
public var collisionWith:MovieClip;
public var collisionWithS:MovieClip;
public var noRotation:Boolean;
public var myShapeDef:Object;
public var myParent:Object;
public var rt:Object;
public var energy:Number;
public var filterData:Object;
public var myBodyDef:Object;
public var buildingBit:Boolean;// = false
public function GameBadKnight3(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6){
buildingBit = false;
super();
addFrameScript(0, frame1);
rt = _arg1;
myBodyDef = _arg2;
myShapeDef = _arg3;
myType = _arg4;
myParent = _arg5;
mySmoke = null;
goodBad = _arg6;
energy = 100;
noRotation = true;
}
function destroyMe(){
rt.m_world.DestroyBody(myBodyDef);
removeMe();
}
public function removeMe(){
myObject.remove();
this.stop();
}
function frame1(){
stop();
}
public function checkOffScreen(){
if (this.x > 1700){
destroyMe();
} else {
if (this.x < -50){
destroyMe();
};
};
if (this.y > 800){
destroyMe();
};
}
public function decreaseEnergy(_arg1){
myObject.decreaseEnergy(_arg1);
}
public function setupPuffSmoke(){
if (mySmoke == null){
mySmoke = new GameHitFloorSmoke(rt, myParent, this);
mySmoke.x = this.x;
mySmoke.y = this.y;
myParent.addChild(mySmoke);
};
}
}
}//package classesAS3
Section 83
//GameBlock (classesAS3.GameBlock)
package classesAS3 {
import flash.display.*;
public class GameBlock extends MovieClip {
public var myType:String;
public var goodBad:Boolean;
public var myObject:Object;
public var mySmoke;
public var collisionWith:MovieClip;
var myDelay:Number;// = 5
public var noRotation:Boolean;
public var myShapeDef:Object;
public var myParent:Object;
public var rt:Object;
public var energy:Number;
public var block:MovieClip;
public var filterData:Object;
public var myBodyDef:Object;
public var buildingBit:Boolean;// = true
public function GameBlock(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7){
buildingBit = true;
myDelay = 5;
super();
addFrameScript(0, frame1, 2, frame3);
this.gotoAndStop(1);
rt = _arg1;
myBodyDef = _arg2;
myShapeDef = _arg3;
myType = _arg4;
myParent = _arg5;
mySmoke = null;
goodBad = _arg7;
noRotation = false;
energy = _arg6;
}
function destroyMe(){
if (rt.bodyGrabbed == myBodyDef){
rt.bodyGrabbed = null;
};
rt.m_world.DestroyBody(myBodyDef);
removeMe();
}
public function removeMe(){
myParent.removeChild(this);
}
function frame3(){
gotoAndStop(2);
}
function frame1(){
stop();
}
public function checkOffScreen(){
if (this.x > 1700){
destroyMe();
} else {
if (this.x < -250){
destroyMe();
};
};
if (this.y > 800){
destroyMe();
};
}
public function decreaseEnergy(_arg1):Boolean{
var _local2:Number;
myDelay--;
if (myDelay == 0){
myDelay = 30;
if (energy > 0){
energy = (energy - _arg1);
if (energy <= 0){
rt.m_world.DestroyBody(myBodyDef);
block.gotoAndPlay("blockBreak");
return (true);
};
_local2 = int(((100 - energy) / 25));
block.gotoAndStop((_local2 + 1));
return (false);
};
};
return (false);
}
public function setupPuffSmoke(){
if (mySmoke == null){
mySmoke = new GameHitFloorSmoke(rt, myParent, this);
mySmoke.x = this.x;
mySmoke.y = this.y;
myParent.addChild(mySmoke);
};
}
}
}//package classesAS3
Section 84
//GameBlockEnemy (classesAS3.GameBlockEnemy)
package classesAS3 {
import flash.display.*;
public class GameBlockEnemy extends MovieClip {
public var myType:String;
public var goodBad:Boolean;
public var myObject:Object;
public var mySmoke;
public var collisionWith:MovieClip;
var myDelay:Number;// = 5
public var noRotation:Boolean;
public var myShapeDef:Object;
public var myParent:Object;
public var rt:Object;
public var energy:Number;
public var block:MovieClip;
public var filterData:Object;
public var myBodyDef:Object;
public var buildingBit:Boolean;// = true
public function GameBlockEnemy(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7){
buildingBit = true;
myDelay = 5;
super();
addFrameScript(0, frame1, 2, frame3);
this.gotoAndStop(1);
rt = _arg1;
myBodyDef = _arg2;
myShapeDef = _arg3;
myType = _arg4;
myParent = _arg5;
mySmoke = null;
goodBad = _arg7;
noRotation = false;
energy = _arg6;
}
function destroyMe(){
rt.m_world.DestroyBody(myBodyDef);
removeMe();
}
public function removeMe(){
myParent.removeChild(this);
}
function frame3(){
gotoAndStop(2);
}
function frame1(){
stop();
}
public function checkOffScreen(){
if (this.x > 1700){
destroyMe();
} else {
if (this.x < -50){
destroyMe();
};
};
if (this.y > 800){
destroyMe();
};
}
public function decreaseEnergy(_arg1):Boolean{
var _local2:Number;
myDelay--;
if (myDelay == 0){
myDelay = 5;
if (energy > 0){
energy = (energy - _arg1);
if (energy <= 0){
rt.m_world.DestroyBody(myBodyDef);
block.gotoAndPlay("blockBreak");
return (true);
};
_local2 = int(((100 - energy) / 25));
block.gotoAndStop((_local2 + 1));
return (false);
};
};
return (false);
}
public function setupPuffSmoke(){
if (mySmoke == null){
mySmoke = new GameHitFloorSmoke(rt, myParent, this);
mySmoke.x = this.x;
mySmoke.y = this.y;
myParent.addChild(mySmoke);
decreaseEnergy(5);
};
}
}
}//package classesAS3
Section 85
//GameBoulder (classesAS3.GameBoulder)
package classesAS3 {
import flash.display.*;
public class GameBoulder extends MovieClip {
public var myType:String;
public var goodBad:Boolean;
public var myObject:Object;
public var mySmoke;
public var collisionWith:MovieClip;
public var noRotation:Boolean;
public var myShapeDef:Object;
public var myParent:Object;
public var rt:Object;
public var energy:Number;
public var filterData:Object;
public var myBodyDef:Object;
public var buildingBit:Boolean;// = false
public function GameBoulder(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6){
buildingBit = false;
super();
addFrameScript(0, frame1, 6, frame7);
rt = _arg1;
myBodyDef = _arg2;
myShapeDef = _arg3;
myType = _arg4;
myParent = _arg5;
mySmoke = null;
goodBad = _arg6;
energy = 100;
noRotation = false;
}
function destroyMe(){
if (rt.bodyGrabbed == myBodyDef){
rt.bodyGrabbed = null;
};
rt.m_world.DestroyBody(myBodyDef);
myBodyDef = null;
removeMe();
}
public function removeMe(){
var _local1:Number;
var _local2:*;
if (myParent != null){
_local1 = -1;
_local2 = 0;
while (_local2 < rt.rt.bouldersArray.length) {
if (this == rt.rt.bouldersArray[_local2]){
_local1 = _local2;
};
_local2++;
};
if (_local1 != -1){
rt.rt.bouldersArray.splice(_local1, 1);
myParent.removeChild(this);
this.stop();
};
};
}
function frame7(){
this.removeMe();
}
function frame1(){
stop();
}
function checkForFlying(){
var _local1:int;
var _local2:*;
_local1 = 0;
while (_local1 < rt.rt.inGameEnemyMc.numChildren) {
_local2 = rt.rt.inGameEnemyMc.getChildAt(_local1);
if (_local2.myObject != null){
if (_local2.myType != "smoke"){
if (_local2.myObject.myName == "bird"){
if (this.hitTestObject(_local2.myObject.mC)){
_local2.myObject.decreaseEnergy(35);
decreaseEnergy(100);
};
} else {
if (_local2.myObject.myName == "dragon"){
if (this.hitTestObject(_local2.myObject.mC)){
_local2.myObject.decreaseEnergy(15);
decreaseEnergy(100);
};
};
};
};
};
_local1++;
};
}
public function checkOffScreen(){
if (this.x > 1700){
destroyMe();
} else {
if (this.x < -50){
destroyMe();
};
};
if (this.y > 800){
destroyMe();
};
}
function checkForFrozen(_arg1){
var _local2:int;
_local2 = 0;
while (_local2 < rt.rt.frozenArray.length) {
if (rt.rt.frozenArray[_local2].mC == _arg1){
return (true);
};
_local2++;
};
return (false);
}
public function decreaseEnergy(_arg1):Boolean{
var _local2:Number;
if (energy > 0){
energy = (energy - _arg1);
if (energy <= 0){
rt.rt.Sounds.playSoundFx("boulderHitFx", 1, 0, 1);
rt.m_world.DestroyBody(myBodyDef);
this.gotoAndPlay("blockBreak");
return (true);
};
_local2 = int(((100 - energy) / 25));
this.gotoAndStop((_local2 + 1));
return (false);
};
return (true);
}
public function setupPuffSmoke(){
if (mySmoke == null){
mySmoke = new GameHitFloorSmoke(rt.rt, myParent, this);
mySmoke.x = this.x;
mySmoke.y = this.y;
myParent.addChild(mySmoke);
};
}
public function mainLoop(){
if (collisionWith != null){
if (collisionWith.myObject == null){
if (collisionWith.goodBad == true){
if (collisionWith.myType == "kingBad1"){
if (checkForFrozen(collisionWith)){
rt.rt.decreaseBadKingEnergy(25, collisionWith);
} else {
rt.rt.decreaseBadKingEnergy(15, collisionWith);
};
} else {
if (checkForFrozen(collisionWith)){
collisionWith.myDelay = 1;
collisionWith.decreaseEnergy(45);
} else {
if (collisionWith.myType == "blockEnemy"){
collisionWith.myDelay = 1;
collisionWith.decreaseEnergy(15);
} else {
collisionWith.myDelay = 1;
collisionWith.decreaseEnergy(35);
};
};
};
};
} else {
if (collisionWith.goodBad == true){
if (checkForFrozen(collisionWith)){
collisionWith.myObject.myDamageDelay = 1;
collisionWith.myObject.decreaseEnergy(45);
} else {
collisionWith.myObject.myDamageDelay = 1;
collisionWith.myObject.decreaseEnergy(25);
};
};
};
decreaseEnergy(100);
collisionWith = null;
} else {
checkForFlying();
if (this.x < 80){
if (this.y > 260){
destroyMe();
};
} else {
if (this.y < -100){
destroyMe();
};
};
};
}
}
}//package classesAS3
Section 86
//GameBoulderLarge (classesAS3.GameBoulderLarge)
package classesAS3 {
import flash.display.*;
public class GameBoulderLarge extends MovieClip {
public var myType:String;
public var myShapeDef:Object;
public var myParent:Object;
public var rt:Object;
public var myBodyDef:Object;
public function GameBoulderLarge(_arg1, _arg2, _arg3, _arg4, _arg5){
rt = _arg1;
myBodyDef = _arg2;
myShapeDef = _arg3;
myType = _arg4;
myParent = _arg5;
}
}
}//package classesAS3
Section 87
//GameBox2d (classesAS3.GameBox2d)
package classesAS3 {
import flash.display.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Collision.Shapes.*;
import Box2D.Dynamics.Joints.*;
import Box2D.Collision.*;
public class GameBox2d {
public var joint_added:b2RevoluteJoint;
public var the_rev_joint:b2RevoluteJointDef;
public var Useful:GameUseful;
public var bodyGrabbed:b2Body;// = null
public var the_joint:b2DistanceJointDef;
public var real_y_mouse:Number;
public var worldGravityVy:Number;
public var rt:Object;
public var worldGravityVx:Number;
public var m_world:b2World;
public var m_iterations:int;// = 10
public var mousePVec:b2Vec2;
public var m_timeStep:Number;// = 0.0333333333333333
public var gravity:b2Vec2;
public var BxScalingFactor:Number;
public var pixels_in_a_meter;// = 30
public var mouseJoint:b2MouseJoint;
public var worldAABB:b2AABB;
public var real_x_mouse:Number;
public static const BAD_FLAG:Boolean = true;
public static const GOOD_FLAG:Boolean = false;
public function GameBox2d(_arg1, _arg2, _arg3){
m_iterations = 10;
m_timeStep = (1 / 30);
mousePVec = new b2Vec2();
pixels_in_a_meter = 30;
worldAABB = new b2AABB();
gravity = new b2Vec2(0, 10);
bodyGrabbed = null;
the_joint = new b2DistanceJointDef();
the_rev_joint = new b2RevoluteJointDef();
super();
rt = _arg1;
Useful = _arg2;
BxScalingFactor = _arg3;
worldGravityVx = 0;
worldGravityVy = 20;
}
public function setupBox2d(){
var _local1:b2AABB;
var _local2:b2Vec2;
var _local3:Boolean;
var _local4:*;
var _local5:b2Body;
var _local6:b2BodyDef;
var _local7:b2PolygonDef;
var _local8:b2CircleDef;
var _local9:Number;
var _local10:Number;
_local1 = new b2AABB();
_local1.lowerBound.Set(-100, -100);
_local1.upperBound.Set(100, 100);
_local2 = new b2Vec2(worldGravityVx, worldGravityVy);
_local3 = true;
m_world = new b2World(_local1, _local2, _local3);
_local4 = new b2ContactListener();
m_world.SetContactListener(_local4);
_local6 = new b2BodyDef();
_local6.position.Set(27, 15.3);
_local7 = new b2PolygonDef();
_local7.SetAsBox(30, 3);
_local7.friction = 0.3;
_local7.density = 0;
_local6.userData = new GameFloor(this, null, null, "floor", rt.inGameFloorMc, 100, GOOD_FLAG);
rt.floorMc = _local6.userData;
_local6.userData.width = ((40 * 2) * 30);
_local6.userData.height = ((30 * 2) * 3);
rt.inGameFloorMc.addChild(_local6.userData);
rt.cliffMc = new goodCliff();
rt.inGameCliffMc.addChild(rt.cliffMc);
rt.cliffMc.x = -25;
rt.cliffMc.y = 330;
rt.tentMc = new tent();
rt.inGameCliffMc.addChild(rt.tentMc);
rt.tentMc.x = 120;
rt.tentMc.y = 300;
_local5 = m_world.CreateBody(_local6);
_local5.CreateShape(_local7);
_local5.SetMassFromShapes();
_local6 = new b2BodyDef();
_local6.position.Set(0.4, 12);
_local7 = new b2PolygonDef();
_local9 = (Useful.bxConvertToMetres(rt.cliffMc.width, BxScalingFactor) / 2);
_local10 = (Useful.bxConvertToMetres(rt.cliffMc.height, BxScalingFactor) / 2);
_local7.SetAsBox(_local9, _local10);
_local7.friction = 0.3;
_local7.density = 0;
_local5 = m_world.CreateBody(_local6);
_local5.CreateShape(_local7);
_local5.SetMassFromShapes();
rt.setupEnemyCastle();
rt.setupKingBad();
rt.setupKingGood();
}
public function GetBodyAtMouse(_arg1:Boolean=false):b2Body{
var _local2:Number;
var _local3:b2AABB;
var _local4:int;
var _local5:Array;
var _local6:int;
var _local7:b2Body;
var _local8:int;
var _local9:b2Shape;
var _local10:Boolean;
var _local11:*;
_local2 = (rt.stage.mouseX - rt.spritesMc.x);
if (rt.inGameZoomMc.scaleX == 1){
real_x_mouse = (_local2 / pixels_in_a_meter);
real_y_mouse = (rt.stage.mouseY / pixels_in_a_meter);
mousePVec.Set(real_x_mouse, real_y_mouse);
_local3 = new b2AABB();
_local3.lowerBound.Set((real_x_mouse - 0.001), (real_y_mouse - 0.001));
_local3.upperBound.Set((real_x_mouse + 0.001), (real_y_mouse + 0.001));
_local4 = 10;
_local5 = new Array();
_local6 = m_world.Query(_local3, _local5, _local4);
_local7 = null;
_local8 = 0;
while (_local8 < _local6) {
if ((((_local5[_local8].m_body.IsStatic() == false)) || (_arg1))){
_local9 = (_local5[_local8] as b2Shape);
_local10 = (_local5[_local8] as b2Shape).TestPoint(_local9.m_body.GetXForm(), mousePVec);
if (_local10){
if (_local9.m_body.m_userData.myType == "archer"){
_local7 = _local9.m_body;
break;
};
if (_local9.m_body.m_userData.myType == "wizard"){
_local7 = _local9.m_body;
break;
} else {
if (_local9.m_body.m_userData.myType == "block"){
_local7 = _local9.m_body;
break;
};
};
if (_local9.m_body.m_userData.myType == "wood"){
_local7 = _local9.m_body;
break;
};
if (_local9.m_body.m_userData.myType == "woodBlock"){
_local7 = _local9.m_body;
break;
};
};
};
_local8++;
};
} else {
_local11 = getScaledPos2();
_local7 = null;
if (_local11 != null){
_local7 = _local11;
};
};
return (_local7);
}
public function setupGrabbedItem(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8){
var _local9:b2Body;
var _local10:b2BodyDef;
var _local11:b2PolygonDef;
var _local12:b2CircleDef;
var _local13:*;
var _local14:Boolean;
var _local15:Number;
var _local16:Number;
var _local17:*;
var _local18:Number;
var _local19:Number;
var _local20:b2Shape;
var _local21:*;
var _local22:Number;
var _local23:b2MassData;
var _local24:b2Vec2;
_local14 = false;
if (_arg5 == "grab"){
_local15 = (rt.stage.mouseX - rt.spritesMc.x);
_local16 = rt.stage.mouseY;
if (_local16 > 500){
_local16 = 460;
};
} else {
if (_arg5 == "random"){
_local15 = Useful.RandomNumber(100, 700);
_local16 = 0;
} else {
_local15 = _arg6;
_local16 = _arg7;
};
};
_local10 = new b2BodyDef();
_local10.position.x = Useful.bxConvertToMetres(_local15, BxScalingFactor);
_local10.position.y = Useful.bxConvertToMetres(_local16, BxScalingFactor);
if (_arg1 == "blockEnemy"){
_local17 = new GameBlockEnemy(this, null, null, _arg1, rt.inGameEnemyMc, 100, BAD_FLAG);
_local17.gotoAndStop(_arg8);
_local18 = (Useful.bxConvertToMetres(_local17.width, BxScalingFactor) / 2);
_local19 = (Useful.bxConvertToMetres(_local17.height, BxScalingFactor) / 2);
_local11 = new b2PolygonDef();
_local11.SetAsBox(_local18, _local19);
_local11.density = _arg2;
_local11.friction = _arg3;
_local11.restitution = _arg4;
_local10.userData = _local17;
_local17.myShapeDef = _local11;
_local9 = m_world.CreateBody(_local10);
_local9.CreateShape(_local11);
rt.inGameEnemyMc.addChild(_local10.userData);
} else {
if (_arg1 == "woodBlockEnemy"){
_local17 = new GameWoodBlockEn(this, null, null, _arg1, rt.inGameEnemyMc, 100, BAD_FLAG);
_local17.gotoAndStop(_arg8);
_local18 = (Useful.bxConvertToMetres(_local17.width, BxScalingFactor) / 2);
_local19 = (Useful.bxConvertToMetres(_local17.height, BxScalingFactor) / 2);
_local11 = new b2PolygonDef();
_local11.SetAsBox(_local18, _local19);
_local11.density = _arg2;
_local11.friction = _arg3;
_local11.restitution = _arg4;
_local10.userData = _local17;
_local17.myShapeDef = _local11;
_local9 = m_world.CreateBody(_local10);
_local9.CreateShape(_local11);
rt.inGameEnemyMc.addChild(_local10.userData);
} else {
if (_arg1 == "woodBlock"){
_local17 = new GameWoodBlock(this, null, null, _arg1, rt.inGameBuildingsMc, 100, GOOD_FLAG);
_local18 = (Useful.bxConvertToMetres(_local17.width, BxScalingFactor) / 2);
_local19 = (Useful.bxConvertToMetres(_local17.height, BxScalingFactor) / 2);
_local11 = new b2PolygonDef();
_local11.SetAsBox(_local18, _local19);
_local11.density = _arg2;
_local11.friction = _arg3;
_local11.restitution = _arg4;
_local10.userData = _local17;
_local17.myShapeDef = _local11;
_local9 = m_world.CreateBody(_local10);
_local9.CreateShape(_local11);
rt.inGameBuildingsMc.addChild(_local10.userData);
} else {
if (_arg1 == "block"){
_local17 = new GameBlock(this, null, null, _arg1, rt.inGameBuildingsMc, 100, GOOD_FLAG);
_local18 = (Useful.bxConvertToMetres(_local17.width, BxScalingFactor) / 2);
_local19 = (Useful.bxConvertToMetres(_local17.height, BxScalingFactor) / 2);
_local11 = new b2PolygonDef();
_local11.SetAsBox(_local18, _local19);
_local11.density = _arg2;
_local11.friction = _arg3;
_local11.restitution = _arg4;
_local10.userData = _local17;
_local17.myShapeDef = _local11;
_local9 = m_world.CreateBody(_local10);
_local9.CreateShape(_local11);
rt.inGameBuildingsMc.addChild(_local10.userData);
} else {
if (_arg1 == "badKnight2"){
_local17 = new GameBadKnight2(this, null, null, _arg1, rt.inGameEnemyMc, BAD_FLAG);
_local18 = (Useful.bxConvertToMetres(22, BxScalingFactor) / 2);
_local19 = (Useful.bxConvertToMetres(24, BxScalingFactor) / 2);
_local11 = new b2PolygonDef();
_local11.SetAsBox(_local18, _local19);
_local11.density = _arg2;
_local11.friction = _arg3;
_local11.restitution = _arg4;
_local10.fixedRotation = true;
_local10.userData = _local17;
_local10.allowSleep = false;
_local17.myShapeDef = _local11;
_local9 = m_world.CreateBody(_local10);
_local9.CreateShape(_local11);
rt.inGameEnemyMc.addChild(_local10.userData);
} else {
if (_arg1 == "badArcher2"){
_local17 = new GameBadArcher2(this, null, null, _arg1, rt.inGameEnemyMc, BAD_FLAG);
_local18 = (Useful.bxConvertToMetres(22, BxScalingFactor) / 2);
_local19 = (Useful.bxConvertToMetres(24, BxScalingFactor) / 2);
_local11 = new b2PolygonDef();
_local11.SetAsBox(_local18, _local19);
_local11.density = _arg2;
_local11.friction = _arg3;
_local11.restitution = _arg4;
_local10.fixedRotation = true;
_local10.userData = _local17;
_local10.allowSleep = false;
_local17.myShapeDef = _local11;
_local9 = m_world.CreateBody(_local10);
_local9.CreateShape(_local11);
rt.inGameEnemyMc.addChild(_local10.userData);
} else {
if (_arg1 == "badArcher1"){
_local17 = new GameBadArcher1(this, null, null, _arg1, rt.inGameEnemyMc, BAD_FLAG);
_local18 = (Useful.bxConvertToMetres(22, BxScalingFactor) / 2);
_local19 = (Useful.bxConvertToMetres(24, BxScalingFactor) / 2);
_local11 = new b2PolygonDef();
_local11.SetAsBox(_local18, _local19);
_local11.density = _arg2;
_local11.friction = _arg3;
_local11.restitution = _arg4;
_local10.fixedRotation = true;
_local10.userData = _local17;
_local10.allowSleep = false;
_local17.myShapeDef = _local11;
_local9 = m_world.CreateBody(_local10);
_local9.CreateShape(_local11);
rt.inGameEnemyMc.addChild(_local10.userData);
} else {
if (_arg1 == "badKnight3"){
_local17 = new GameBadKnight3(this, null, null, _arg1, rt.inGameEnemyMc, BAD_FLAG);
_local18 = (Useful.bxConvertToMetres(22, BxScalingFactor) / 2);
_local19 = (Useful.bxConvertToMetres(24, BxScalingFactor) / 2);
_local11 = new b2PolygonDef();
_local11.SetAsBox(_local18, _local19);
_local11.density = _arg2;
_local11.friction = _arg3;
_local11.restitution = _arg4;
_local10.fixedRotation = true;
_local10.userData = _local17;
_local10.allowSleep = false;
_local17.myShapeDef = _local11;
_local9 = m_world.CreateBody(_local10);
_local9.CreateShape(_local11);
rt.inGameEnemyMc.addChild(_local10.userData);
} else {
if (_arg1 == "badKnight1"){
_local17 = new GameBadKnight1(this, null, null, _arg1, rt.inGameEnemyMc, BAD_FLAG);
_local18 = (Useful.bxConvertToMetres(22, BxScalingFactor) / 2);
_local19 = (Useful.bxConvertToMetres(24, BxScalingFactor) / 2);
_local11 = new b2PolygonDef();
_local11.SetAsBox(_local18, _local19);
_local11.density = _arg2;
_local11.friction = _arg3;
_local11.restitution = _arg4;
_local10.fixedRotation = true;
_local10.userData = _local17;
_local10.allowSleep = false;
_local17.myShapeDef = _local11;
_local9 = m_world.CreateBody(_local10);
_local9.CreateShape(_local11);
rt.inGameEnemyMc.addChild(_local10.userData);
} else {
if (_arg1 == "viking1"){
_arg1 = "badKnight1";
_local17 = new GameViking1(this, null, null, _arg1, rt.inGameEnemyMc, BAD_FLAG);
_local18 = (Useful.bxConvertToMetres(22, BxScalingFactor) / 2);
_local19 = (Useful.bxConvertToMetres(24, BxScalingFactor) / 2);
_local11 = new b2PolygonDef();
_local11.SetAsBox(_local18, _local19);
_local11.density = _arg2;
_local11.friction = _arg3;
_local11.restitution = _arg4;
_local10.fixedRotation = true;
_local10.userData = _local17;
_local10.allowSleep = false;
_local17.myShapeDef = _local11;
_local9 = m_world.CreateBody(_local10);
_local9.CreateShape(_local11);
rt.inGameEnemyMc.addChild(_local10.userData);
} else {
if (_arg1 == "ram"){
_arg1 = "badKnight1";
_local17 = new GameRam1(this, null, null, _arg1, rt.inGameEnemyMc, BAD_FLAG);
_local18 = (Useful.bxConvertToMetres(22, BxScalingFactor) / 2);
_local19 = (Useful.bxConvertToMetres(24, BxScalingFactor) / 2);
_local11 = new b2PolygonDef();
_local11.SetAsBox(_local18, _local19);
_local11.density = _arg2;
_local11.friction = _arg3;
_local11.restitution = _arg4;
_local10.fixedRotation = true;
_local10.userData = _local17;
_local10.allowSleep = false;
_local17.myShapeDef = _local11;
_local9 = m_world.CreateBody(_local10);
_local9.CreateShape(_local11);
rt.inGameEnemyMc.addChild(_local10.userData);
} else {
if (_arg1 == "kingGood"){
_local17 = new GameKingGood(this, null, null, _arg1, rt.inGameGoodGuysMc, GOOD_FLAG);
_local18 = (Useful.bxConvertToMetres(26, BxScalingFactor) / 2);
_local19 = (Useful.bxConvertToMetres(24, BxScalingFactor) / 2);
_local11 = new b2PolygonDef();
_local11.SetAsBox(_local18, _local19);
_local11.density = _arg2;
_local11.friction = _arg3;
_local11.restitution = _arg4;
_local10.userData = _local17;
_local17.myShapeDef = _local11;
_local9 = m_world.CreateBody(_local10);
_local9.CreateShape(_local11);
rt.goodKingMc = _local17;
rt.inGameGoodGuysMc.addChild(_local10.userData);
} else {
if (_arg1 == "archer"){
_local17 = new GameArcher1(this, null, null, _arg1, rt.inGameGoodGuysMc, GOOD_FLAG);
_local18 = (Useful.bxConvertToMetres(26, BxScalingFactor) / 2);
_local19 = (Useful.bxConvertToMetres(24, BxScalingFactor) / 2);
_local11 = new b2PolygonDef();
_local11.SetAsBox(_local18, _local19);
_local11.density = _arg2;
_local11.friction = _arg3;
_local11.restitution = _arg4;
_local10.userData = _local17;
_local10.allowSleep = false;
_local17.myShapeDef = _local11;
_local9 = m_world.CreateBody(_local10);
_local9.CreateShape(_local11);
rt.inGameGoodGuysMc.addChild(_local10.userData);
} else {
if (_arg1 == "wizard"){
_local17 = new GameWizard1(this, null, null, _arg1, rt.inGameGoodGuysMc, GOOD_FLAG);
_local18 = (Useful.bxConvertToMetres(26, BxScalingFactor) / 2);
_local19 = (Useful.bxConvertToMetres(24, BxScalingFactor) / 2);
_local11 = new b2PolygonDef();
_local11.SetAsBox(_local18, _local19);
_local11.density = _arg2;
_local11.friction = _arg3;
_local11.restitution = _arg4;
_local10.userData = _local17;
_local10.allowSleep = false;
_local17.myShapeDef = _local11;
_local9 = m_world.CreateBody(_local10);
_local9.CreateShape(_local11);
rt.inGameGoodGuysMc.addChild(_local10.userData);
} else {
if (_arg1 == "knight2"){
_local17 = new GameKnight2(this, null, null, _arg1, rt.inGameGoodGuysMc, GOOD_FLAG);
_local18 = (Useful.bxConvertToMetres(26, BxScalingFactor) / 2);
_local19 = (Useful.bxConvertToMetres(24, BxScalingFactor) / 2);
_local11 = new b2PolygonDef();
_local11.SetAsBox(_local18, _local19);
_local11.density = _arg2;
_local11.friction = _arg3;
_local11.restitution = _arg4;
_local10.userData = _local17;
_local10.allowSleep = false;
_local17.myShapeDef = _local11;
_local9 = m_world.CreateBody(_local10);
_local9.CreateShape(_local11);
rt.inGameGoodGuysMc.addChild(_local10.userData);
rt.setupGoodGuy(_local17);
} else {
if (_arg1 == "knight"){
_local17 = new GameKnight1(this, null, null, _arg1, rt.inGameGoodGuysMc, GOOD_FLAG);
_local18 = (Useful.bxConvertToMetres(26, BxScalingFactor) / 2);
_local19 = (Useful.bxConvertToMetres(24, BxScalingFactor) / 2);
_local11 = new b2PolygonDef();
_local11.SetAsBox(_local18, _local19);
_local11.density = _arg2;
_local11.friction = _arg3;
_local11.restitution = _arg4;
_local10.userData = _local17;
_local10.allowSleep = false;
_local17.myShapeDef = _local11;
_local9 = m_world.CreateBody(_local10);
_local9.CreateShape(_local11);
rt.inGameGoodGuysMc.addChild(_local10.userData);
rt.setupGoodGuy(_local17);
} else {
if (_arg1 == "knight4"){
_local17 = new GameKnight4(this, null, null, _arg1, rt.inGameGoodGuysMc, GOOD_FLAG);
_local18 = (Useful.bxConvertToMetres(26, BxScalingFactor) / 2);
_local19 = (Useful.bxConvertToMetres(24, BxScalingFactor) / 2);
_local11 = new b2PolygonDef();
_local11.SetAsBox(_local18, _local19);
_local11.density = _arg2;
_local11.friction = _arg3;
_local11.restitution = _arg4;
_local10.userData = _local17;
_local10.allowSleep = false;
_local17.myShapeDef = _local11;
_local9 = m_world.CreateBody(_local10);
_local9.CreateShape(_local11);
rt.inGameGoodGuysMc.addChild(_local10.userData);
rt.setupGoodGuy(_local17);
} else {
if (_arg1 == "knight3"){
_local17 = new GameKnight3(this, null, null, _arg1, rt.inGameGoodGuysMc, GOOD_FLAG);
_local18 = (Useful.bxConvertToMetres(26, BxScalingFactor) / 2);
_local19 = (Useful.bxConvertToMetres(24, BxScalingFactor) / 2);
_local11 = new b2PolygonDef();
_local11.SetAsBox(_local18, _local19);
_local11.density = _arg2;
_local11.friction = _arg3;
_local11.restitution = _arg4;
_local10.userData = _local17;
_local10.allowSleep = false;
_local17.myShapeDef = _local11;
_local9 = m_world.CreateBody(_local10);
_local9.CreateShape(_local11);
rt.inGameGoodGuysMc.addChild(_local10.userData);
rt.setupGoodGuy(_local17);
} else {
if (_arg1 == "wood"){
_local17 = new GamePlank(this, null, null, _arg1, rt.inGameBuildingsMc, GOOD_FLAG);
_local18 = (Useful.bxConvertToMetres(_local17.width, BxScalingFactor) / 2);
_local19 = (Useful.bxConvertToMetres(_local17.height, BxScalingFactor) / 2);
_local11 = new b2PolygonDef();
_local11.SetAsBox(_local18, _local19);
_local11.density = _arg2;
_local11.friction = _arg3;
_local11.restitution = _arg4;
_local10.userData = _local17;
_local17.myShapeDef = _local11;
_local9 = m_world.CreateBody(_local10);
_local9.CreateShape(_local11);
rt.inGameBuildingsMc.addChild(_local10.userData);
} else {
if (_arg1 == "woodBad"){
_local17 = new GamePlank(this, null, null, _arg1, rt.inGameEnemyMc, BAD_FLAG);
_local18 = (Useful.bxConvertToMetres(_local17.width, BxScalingFactor) / 2);
_local19 = (Useful.bxConvertToMetres(_local17.height, BxScalingFactor) / 2);
_local11 = new b2PolygonDef();
_local11.SetAsBox(_local18, _local19);
_local11.density = _arg2;
_local11.friction = _arg3;
_local11.restitution = _arg4;
_local10.userData = _local17;
_local17.myShapeDef = _local11;
_local9 = m_world.CreateBody(_local10);
_local9.CreateShape(_local11);
rt.inGameEnemyMc.addChild(_local10.userData);
} else {
if (_arg1 == "boulder"){
if (rt.catapultItem == null){
_local17 = new GameBoulder(this, null, null, _arg1, rt.inGameBuildingsMc, GOOD_FLAG);
_local18 = (Useful.bxConvertToMetres(_local17.width, BxScalingFactor) / 2);
_local19 = (Useful.bxConvertToMetres(_local17.height, BxScalingFactor) / 2);
_local12 = new b2CircleDef();
_local12.radius = _local18;
_local12.density = _arg2;
_local12.friction = _arg3;
_local12.restitution = _arg4;
_local10.userData = _local17;
_local17.myShapeDef = _local12;
_local9 = m_world.CreateBody(_local10);
_local9.CreateShape(_local12);
rt.inGameBuildingsMc.addChild(_local10.userData);
rt.bouldersArray.push(_local17);
if (rt.catapultItem != null){
rt.catapultItem.destroyMe();
rt.catapultItem = null;
} else {
rt.catapultItem = _local17;
};
} else {
_local14 = true;
};
} else {
if (_arg1 == "cannonBall"){
if (rt.catapultItem == null){
_local17 = new GameCannonBall(this, null, null, _arg1, rt.inGameBuildingsMc, GOOD_FLAG);
_local18 = (Useful.bxConvertToMetres(_local17.width, BxScalingFactor) / 2);
_local19 = (Useful.bxConvertToMetres(_local17.height, BxScalingFactor) / 2);
_local12 = new b2CircleDef();
_local12.radius = _local18;
_local12.density = _arg2;
_local12.friction = _arg3;
_local12.restitution = _arg4;
_local10.userData = _local17;
_local17.myShapeDef = _local12;
_local9 = m_world.CreateBody(_local10);
_local9.CreateShape(_local12);
rt.inGameBuildingsMc.addChild(_local10.userData);
rt.bouldersArray.push(_local17);
if (rt.catapultItem != null){
rt.catapultItem.destroyMe();
rt.catapultItem = null;
} else {
rt.catapultItem = _local17;
};
} else {
_local14 = true;
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
if (_local14 == false){
_local17.myBodyDef = _local9;
_local20 = _local9.GetShapeList();
_local17.filterData = _local20.GetFilterData();
if (_arg5 == "grab"){
_local21 = _local20.GetFilterData();
_local21.categoryBits = 0;
_local20.SetFilterData(_local21);
m_world.Refilter(_local20);
};
_local9.SetMassFromShapes();
if (_arg5 == "grab"){
bodyGrabbed = _local9;
rt.setupSelectionBox(bodyGrabbed.m_userData);
bodyGrabbed.m_userData.myParent.setChildIndex(bodyGrabbed.m_userData, (bodyGrabbed.m_userData.myParent.numChildren - 1));
_local22 = bodyGrabbed.GetMass();
_local23 = new b2MassData();
_local23.mass = _local22;
bodyGrabbed.SetMass(_local23);
_local24 = new b2Vec2();
_local24 = bodyGrabbed.GetPosition();
bodyGrabbed.SetXForm(_local24, 0);
setupMouseJoint();
};
return (_local17);
//unresolved jump
};
return (null);
}
public function runBox2d(){
var _local1:b2Body;
var _local2:*;
var _local3:*;
var _local4:*;
var _local5:*;
var _local6:b2Vec2;
var _local7:Boolean;
var _local8:Boolean;
m_world.Step(m_timeStep, m_iterations);
if (mouseJoint){
_local2 = getScaledPosX();
_local3 = getScaledPosY();
_local4 = (_local2 / pixels_in_a_meter);
_local5 = (_local3 / pixels_in_a_meter);
_local6 = new b2Vec2(_local4, _local5);
mouseJoint.SetTarget(_local6);
};
rt.numPhysObjects = 0;
_local1 = m_world.m_bodyList;
while (_local1) {
if ((_local1.m_userData is Sprite)){
rt.numPhysObjects++;
_local7 = false;
if (_local1.m_userData.myType == "boulder"){
if (_local1.m_userData.energy <= 0){
m_world.DestroyBody(_local1);
_local7 = true;
};
} else {
if (_local1.m_userData.myType == "cannonBall"){
if (_local1.m_userData.energy <= 0){
m_world.DestroyBody(_local1);
_local7 = true;
};
};
};
if (_local7 == false){
_local1.m_userData.x = (_local1.GetPosition().x * 30);
_local1.m_userData.y = (_local1.GetPosition().y * 30);
if (_local1.m_userData.goodBad == false){
if (_local1.m_userData.myType != "floor"){
if (_local1.m_userData.myType != "catapultRod"){
if (_local1.m_userData.x > rt.flagMc.x){
_local8 = false;
if (_local1.m_userData.buildingBit == true){
if (_local1.m_userData.x > (rt.flagMc.x + 20)){
if (bodyGrabbed != _local1){
_local1.m_userData.destroyMe();
_local8 = true;
};
};
} else {
if (_local1.m_userData.x > (rt.flagMc.x + 20)){
if (bodyGrabbed != _local1){
if (_local1.m_userData.myType == "archer"){
_local1.m_userData.destroyMe();
_local8 = true;
};
};
};
};
if (_local8 == false){
rt.movedOverHalf = true;
if (rt.selectionBoxMc != null){
if (_local1.m_userData == rt.selectionBoxMc.myParent){
rt.selectionBoxMc.myParent.removeChild(rt.selectionBoxMc);
rt.selectionBoxMc = null;
};
};
};
};
if (_local8 == false){
_local1.m_userData.checkOffScreen();
};
};
};
};
};
if (_local7 == false){
_local1.m_userData.y = (_local1.GetPosition().y * 30);
if (_local1.m_userData.noRotation == false){
_local1.m_userData.rotation = ((_local1.GetAngle() * 180) / Math.PI);
};
};
};
_local1 = _local1.m_next;
};
}
public function destroyEverything(){
var _local1:b2Body;
if (m_world != undefined){
if (m_world != null){
_local1 = m_world.m_bodyList;
while (_local1) {
if ((_local1.m_userData is Sprite)){
_local1.m_userData.myBodyDef = null;
m_world.DestroyBody(_local1);
_local1.m_userData = null;
} else {
m_world.DestroyBody(_local1);
};
_local1 = _local1.m_next;
};
};
};
m_world = null;
}
public function setupMouseJoint(){
var _local1:b2MouseJointDef;
var _local2:Number;
_local1 = new b2MouseJointDef();
_local1.body1 = m_world.GetGroundBody();
_local1.body2 = bodyGrabbed;
_local2 = (rt.stage.mouseX - rt.spritesMc.x);
_local1.target.Set((_local2 / pixels_in_a_meter), (rt.mouseY / pixels_in_a_meter));
_local1.maxForce = 6000000;
_local1.timeStep = m_timeStep;
_local1.collideConnected = false;
mouseJoint = (m_world.CreateJoint(_local1) as b2MouseJoint);
}
function getScaledPos2():Object{
var _local1:int;
var _local2:Object;
var _local3:*;
_local1 = 0;
while (_local1 < rt.inGameBuildingsMc.numChildren) {
_local2 = new Object();
_local3 = rt.inGameBuildingsMc.getChildAt(_local1);
if (_local3.myType != "smoke"){
if (_local3.goodBad == false){
if (_local3.energy != null){
if (_local3.energy > 0){
if (_local3.hitTestPoint(rt.stage.mouseX, rt.stage.mouseY, true)){
return (_local3.myBodyDef);
};
};
};
};
};
_local1++;
};
_local1 = 0;
while (_local1 < rt.inGameGoodGuysMc.numChildren) {
if (rt.inGameGoodGuysMc.getChildAt(_local1).myType == "archer"){
if (rt.inGameGoodGuysMc.getChildAt(_local1).hitTestPoint(rt.stage.mouseX, rt.stage.mouseY, true)){
_local3 = rt.inGameGoodGuysMc.getChildAt(_local1);
return (_local3.myBodyDef);
};
} else {
if (rt.inGameGoodGuysMc.getChildAt(_local1).myType == "wizard"){
if (rt.inGameGoodGuysMc.getChildAt(_local1).hitTestPoint(rt.stage.mouseX, rt.stage.mouseY, true)){
_local3 = rt.inGameGoodGuysMc.getChildAt(_local1);
return (_local3.myBodyDef);
};
};
};
_local1++;
};
return (null);
}
public function setupEnemyKings(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7){
var _local8:b2Body;
var _local9:b2BodyDef;
var _local10:b2PolygonDef;
var _local11:b2CircleDef;
var _local12:*;
var _local13:Number;
var _local14:Number;
var _local15:*;
var _local16:Number;
var _local17:Number;
var _local18:b2Shape;
var _local19:*;
_local13 = _arg6;
_local14 = _arg7;
_local9 = new b2BodyDef();
_local9.position.x = Useful.bxConvertToMetres(_local13, BxScalingFactor);
_local9.position.y = Useful.bxConvertToMetres(_local14, BxScalingFactor);
if (rt.levelNumber < 3){
_local15 = new GameKingBad1(this, null, null, _arg1, rt.inGameEnemyMc, BAD_FLAG);
rt.badKingMc = _local15;
} else {
if (rt.levelNumber < 5){
_local15 = new GameKingBad2(this, null, null, _arg1, rt.inGameEnemyMc, BAD_FLAG);
rt.badKingMc = _local15;
} else {
if (rt.levelNumber < 7){
_local15 = new GameKingBad3(this, null, null, _arg1, rt.inGameEnemyMc, BAD_FLAG);
rt.badKingMc = _local15;
} else {
if (rt.levelNumber < 9){
_local15 = new GameKingBad4(this, null, null, _arg1, rt.inGameEnemyMc, BAD_FLAG);
rt.badKingMc = _local15;
} else {
_local15 = new GameKingBad5(this, null, null, _arg1, rt.inGameEnemyMc, BAD_FLAG);
rt.badKingMc = _local15;
};
};
};
};
_local16 = (Useful.bxConvertToMetres(22, BxScalingFactor) / 2);
_local17 = (Useful.bxConvertToMetres(24, BxScalingFactor) / 2);
_local10 = new b2PolygonDef();
_local10.SetAsBox(_local16, _local17);
_local10.density = _arg2;
_local10.friction = _arg3;
_local10.restitution = _arg4;
_local9.userData = _local15;
_local15.myShapeDef = _local10;
_local8 = m_world.CreateBody(_local9);
_local8.CreateShape(_local10);
rt.inGameEnemyMc.addChild(_local9.userData);
_local15.myBodyDef = _local8;
_local18 = _local8.GetShapeList();
_local15.filterData = _local18.GetFilterData();
if (_arg5 == "grab"){
_local19 = _local18.GetFilterData();
_local19.categoryBits = 0;
_local18.SetFilterData(_local19);
m_world.Refilter(_local18);
};
_local8.SetMassFromShapes();
if (_arg5 == "grab"){
rt.on_mouse_down();
};
return (_local15);
}
function getScaledPosX():Number{
var _local1:Number;
var _local2:*;
var _local3:*;
var _local4:*;
_local1 = (rt.stage.mouseX - rt.spritesMc.x);
if (rt.inGameZoomMc.scaleX < 1){
if (rt.inGameZoomMc.scaleX < 0.7){
_local4 = 3;
};
_local2 = (rt.stage.mouseX - 350);
_local3 = (1 - rt.inGameZoomMc.scaleX);
_local3 = (_local3 * 1.5);
_local3 = (_local3 * _local2);
_local1 = (_local1 + _local3);
};
return (_local1);
}
function getScaledPosY():Number{
var _local1:Number;
var _local2:*;
var _local3:*;
var _local4:*;
_local1 = rt.stage.mouseY;
if (rt.inGameZoomMc.scaleY < 1){
if (rt.inGameZoomMc.scaleY < 0.7){
_local4 = 3;
};
_local2 = (rt.stage.mouseY - 270);
_local3 = (1 - rt.inGameZoomMc.scaleY);
_local3 = (_local3 * 1.5);
_local3 = (_local3 * _local2);
_local1 = (_local1 + _local3);
};
return (_local1);
}
}
}//package classesAS3
Section 88
//GameCannonBall (classesAS3.GameCannonBall)
package classesAS3 {
import flash.display.*;
public class GameCannonBall extends MovieClip {
public var myType:String;
public var goodBad:Boolean;
public var myObject:Object;
public var mySmoke;
public var collisionWith:MovieClip;
public var noRotation:Boolean;
public var myShapeDef:Object;
public var myParent:Object;
public var rt:Object;
public var energy:Number;
public var filterData:Object;
public var myBodyDef:Object;
public var buildingBit:Boolean;// = false
public function GameCannonBall(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6){
buildingBit = false;
super();
rt = _arg1;
myBodyDef = _arg2;
myShapeDef = _arg3;
myType = _arg4;
myParent = _arg5;
mySmoke = null;
goodBad = _arg6;
energy = 100;
noRotation = false;
}
function destroyMe(){
if (rt.bodyGrabbed == myBodyDef){
rt.bodyGrabbed = null;
};
rt.m_world.DestroyBody(myBodyDef);
myBodyDef = null;
removeMe();
}
public function removeMe(){
var _local1:Number;
var _local2:*;
if (myParent != null){
_local1 = -1;
_local2 = 0;
while (_local2 < rt.rt.bouldersArray.length) {
if (this == rt.rt.bouldersArray[_local2]){
_local1 = _local2;
};
_local2++;
};
if (_local1 != -1){
rt.rt.bouldersArray.splice(_local1, 1);
myParent.removeChild(this);
this.stop();
};
};
}
public function checkOffScreen(){
if (this.x > 1700){
destroyMe();
} else {
if (this.x < -90){
destroyMe();
};
};
if (this.y > 800){
destroyMe();
};
}
function checkForFrozen(_arg1){
var _local2:int;
_local2 = 0;
while (_local2 < rt.rt.frozenArray.length) {
if (rt.rt.frozenArray[_local2].mC == _arg1){
return (true);
};
_local2++;
};
return (false);
}
public function decreaseEnergy(_arg1):Boolean{
if (energy > 0){
energy = (energy - _arg1);
if (energy <= 0){
rt.rt.Sounds.playSoundFx("mainGunMissileHitFx", 1, 0, 1);
rt.rt.explosionsArray.push(new GameExplosion(rt.rt, this.x, this.y, 1, rt.rt.Useful, 7, 1, 10, true, false, false, 8, 0));
rt.rt.explosionsArray.push(new GameExplosion(rt.rt, this.x, this.y, 2, rt.rt.Useful, 7, 1, 20, true, false, false, 8, 3));
removeMe();
return (true);
};
return (false);
};
return (true);
}
public function setupPuffSmoke(){
if (mySmoke == null){
mySmoke = new GameHitFloorSmoke(rt.rt, myParent, this);
mySmoke.x = this.x;
mySmoke.y = this.y;
myParent.addChild(mySmoke);
};
}
public function mainLoop(){
if (collisionWith != null){
if (collisionWith.myObject == null){
if (collisionWith.goodBad == true){
if (collisionWith.myType == "kingBad1"){
if (checkForFrozen(collisionWith)){
rt.rt.decreaseBadKingEnergy(25, collisionWith);
} else {
rt.rt.decreaseBadKingEnergy(15, collisionWith);
};
} else {
if (checkForFrozen(collisionWith)){
collisionWith.myDelay = 1;
collisionWith.decreaseEnergy(45);
} else {
if (collisionWith.myType == "blockEnemy"){
collisionWith.myDelay = 1;
collisionWith.decreaseEnergy(15);
} else {
collisionWith.myDelay = 1;
collisionWith.decreaseEnergy(35);
};
};
};
};
} else {
if (collisionWith.goodBad == true){
if (checkForFrozen(collisionWith)){
collisionWith.myObject.myDamageDelay = 1;
collisionWith.myObject.decreaseEnergy(45);
} else {
collisionWith.myObject.myDamageDelay = 1;
collisionWith.myObject.decreaseEnergy(25);
};
};
};
decreaseEnergy(100);
collisionWith = null;
} else {
if (this.x < 80){
if (this.y > 260){
destroyMe();
};
} else {
if (this.y < -100){
destroyMe();
};
};
};
}
}
}//package classesAS3
Section 89
//GameCatapultBase (classesAS3.GameCatapultBase)
package classesAS3 {
import flash.display.*;
public class GameCatapultBase extends MovieClip {
public var myType:String;
public var goodBad:Boolean;
public var noRotation:Boolean;// = false
public var myShapeDef:Object;
public var rt:Object;
public var myBodyDef:Object;
public var buildingBit:Boolean;// = false
public function GameCatapultBase(_arg1, _arg2, _arg3, _arg4){
noRotation = false;
buildingBit = false;
super();
rt = _arg1;
myBodyDef = _arg2;
myShapeDef = _arg3;
myType = _arg4;
goodBad = false;
}
}
}//package classesAS3
Section 90
//GameCatapultCup (classesAS3.GameCatapultCup)
package classesAS3 {
import flash.display.*;
public class GameCatapultCup extends MovieClip {
public var myType:String;
public var goodBad:Boolean;
public var noRotation:Boolean;// = false
public var myShapeDef:Object;
public var rt:Object;
public var myBodyDef:Object;
public var buildingBit:Boolean;// = false
public function GameCatapultCup(_arg1, _arg2, _arg3, _arg4){
noRotation = false;
buildingBit = false;
super();
rt = _arg1;
myBodyDef = _arg2;
myShapeDef = _arg3;
myType = _arg4;
goodBad = false;
}
}
}//package classesAS3
Section 91
//GameCatapultRod (classesAS3.GameCatapultRod)
package classesAS3 {
import flash.display.*;
public class GameCatapultRod extends MovieClip {
public var myType:String;
public var goodBad:Boolean;
public var noRotation:Boolean;// = false
public var myShapeDef:Object;
public var rt:Object;
public var setMc1:MovieClip;
public var myBodyDef:Object;
public var buildingBit:Boolean;// = false
public function GameCatapultRod(_arg1, _arg2, _arg3, _arg4){
noRotation = false;
buildingBit = false;
super();
rt = _arg1;
myBodyDef = _arg2;
myShapeDef = _arg3;
myType = _arg4;
goodBad = false;
}
}
}//package classesAS3
Section 92
//GameEnergyBar (classesAS3.GameEnergyBar)
package classesAS3 {
import flash.display.*;
public class GameEnergyBar extends MovieClip {
public var bar:energyBar;
var enemy:Object;
public function GameEnergyBar(_arg1){
addFrameScript(22, frame23);
enemy = _arg1;
}
function frame23(){
this.enemy.energyBarOn = 0;
MovieClip(this.parent).removeChild(this);
stop();
}
}
}//package classesAS3
Section 93
//GameExplosion (classesAS3.GameExplosion)
package classesAS3 {
import classesAS3.*;
class GameExplosion {
var rt:Object;
var xPos:Number;// = 0
var xVel:Number;// = 0
var artillary:Number;
var explodeFrame:Number;
var Count:Number;
var myDamage:Number;
var numberOfParticles:Number;
var mType:Number;
var Useful:GameUseful;
var yPos:Number;// = 0
var gravity:Number;
var speed:Number;
var explodeDistance:Number;
var yVel:Number;// = 0
var fullRange:Boolean;
var numberOfLoops:Number;
var mC:Object;
var arrayIndex:Number;
var xOrigin:Number;// = 0
var yOrigin:Number;// = 0
function GameExplosion(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8, _arg9, _arg10, _arg11, _arg12, _arg13){
xOrigin = 0;
yOrigin = 0;
xPos = 0;
yPos = 0;
xVel = 0;
yVel = 0;
super();
rt = _arg1;
Useful = _arg5;
myDamage = _arg13;
fullRange = _arg11;
numberOfParticles = _arg6;
numberOfLoops = _arg7;
explodeDistance = _arg8;
gravity = _arg9;
artillary = _arg10;
speed = _arg12;
xOrigin = _arg2;
yOrigin = _arg3;
xPos = 0;
yPos = 0;
Count = 0;
mType = _arg4;
}
function remove(){
var _local1:Number;
var _local2:*;
_local1 = 0;
_local2 = 0;
while (_local2 < rt.explosionsArray.length) {
if (this == rt.explosionsArray[_local2]){
_local1 = _local2;
};
_local2++;
};
rt.explosionsArray.splice(_local1, 1);
delete ??getglobalscope
[this];
}
function mainLoop(){
var _local1:int;
var _local2:Number;
var _local3:Object;
var _local4:GameParticle;
_local1 = 0;
while (_local1 < numberOfParticles) {
if (fullRange == false){
_local2 = Useful.RandomNumber(1, 180);
_local2 = (_local2 + 180);
if (_local2 > 359){
_local2 = (_local2 - 359);
};
} else {
_local2 = Useful.RandomNumber(1, 360);
};
_local3 = Useful.getVectorFromAngle(_local2);
_local4 = new GameParticle(rt, Useful, xOrigin, yOrigin, mType, _local3.vx, _local3.vy, ((_local3.vx * explodeDistance) + xOrigin), ((_local3.vy * explodeDistance) + yOrigin), artillary, gravity, explodeDistance, speed, myDamage);
rt.inGameExplosionsMc.addChild(_local4);
rt.particlesArray.push(_local4);
_local4.rotation = _local2;
_local1++;
};
Count++;
if (Count > numberOfLoops){
remove();
};
}
}
}//package classesAS3
Section 94
//GameExplosionAnim (classesAS3.GameExplosionAnim)
package classesAS3 {
import flash.display.*;
public class GameExplosionAnim extends MovieClip {
public var myParent:Object;
public var rt:Object;
public var myIndex:Number;
public function GameExplosionAnim(){
addFrameScript(5, frame6);
}
public function removeMe(){
}
function frame6(){
this.removeMe();
stop();
}
}
}//package classesAS3
Section 95
//GameFloor (classesAS3.GameFloor)
package classesAS3 {
import flash.display.*;
public class GameFloor extends MovieClip {
public var myType:String;
public var goodBad:Boolean;
public var noRotation:Boolean;// = false
public var myShapeDef:Object;
public var myParent:Object;
public var rt:Object;
public var energy:Number;
public var filterData:Object;
public var myBodyDef:Object;
public var buildingBit:Boolean;// = false
public function GameFloor(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7){
noRotation = false;
buildingBit = false;
super();
rt = _arg1;
myBodyDef = _arg2;
myShapeDef = _arg3;
myType = _arg4;
myParent = _arg5;
goodBad = _arg7;
energy = _arg6;
}
public function removeMe(){
myParent.removeChild(this);
}
}
}//package classesAS3
Section 96
//GameGame (classesAS3.GameGame)
package classesAS3 {
import flash.display.*;
import Box2D.Common.Math.*;
import flash.events.*;
import Box2D.Collision.Shapes.*;
import fl.motion.*;
import flash.geom.*;
import flash.filters.*;
public class GameGame extends MovieClip {
var left:Number;
var inGameFloorMc:Sprite;
var scaleLarge:Number;
var StartTimer:Number;
var badGuysArray:Array;
var selectionArray:Array;
var zoomSpeed:Number;
public var cWordsMc:catapultWords;
var bf:BlurFilter;
var letterIndex:Number;
var sec:Number;
var playerMc:MovieClip;
var inGameColourMc:Sprite;
var bf2:BlurFilter;
var levelTime:Number;
var movieWidth:Number;
var movieHeight:Number;
var inGamePickupsMc:Sprite;
var shift:Matrix;
var inGameEnemyMc:Sprite;
var baseGunType:String;
var spritesMc:Sprite;
var moneyMax:Number;
var filterAlienDelay:Number;
var inGameMissilesMc:Sprite;
var moneyDelay:Number;
var levelWidth:Number;
var oldScore:Number;
var wallCost:Number;
var clickloc:Point;
var zombiesLeft:Array;
var money:Number;
var levelWidthBlocks:Number;
var gameOverMsgMc:GameOverMsgAnim;
var pauseSwitch:Boolean;
var levelChatStart:Array;
var levelsRuler:Array;
var oldUpgrade2:Boolean;
var oldUpgrade3:Boolean;
var inGameCliffMc:Sprite;
var oldUpgrade5:Boolean;
var oldUpgrade6:Boolean;
var oldUpgrade1:Boolean;
var minutes:Number;
var filterDelay:Number;
var catapultClicked:Boolean;
var oldUpgrade4:Boolean;
var letterDelay:Number;
var lives:Number;
var inGameScoreMc:Sprite;
var groundArray:Array;
var explosionsArray:Array;
var planeMc:GamePlane;
var energyAlien:Number;
var freezeDelay:Number;
var itemsToBuyMc:Sprite;
var boulderBought:Boolean;
var catapultAreaMc:catapultBtnMc;
var cmf:ColorMatrixFilter;
var upgradeCost1:Number;
var upgradeCost2:Number;
var upgradeCost3:Number;
var upgradeCost5:Number;
var upgradeCost6:Number;
var timeBonus:Number;
var top:Number;
var oldMouseY:Number;
var currentPickup:String;
public var Box2d:GameBox2d;
var oldMouseX:Number;
var upgradeCost4:Number;
var Sounds:GameSounds;
var levelCompleteMsg:GameLevelComplete;
var inGameGoodGuysMc:Sprite;
var maxScrollSpeed:Number;
var bmd:BitmapData;
var currentPhrase:String;
var upgrade1:Boolean;
var upgrade2:Boolean;
var gameExplosions:GameMultipleExplosion;
var soundsSwitch:Boolean;// = true
var upgrade5:Boolean;
var upgrade6:Boolean;
var inGameCWords:Sprite;
var upgrade3:Boolean;
var upgrade4:Boolean;
var upgradeMc2:GameUpgrade2;
var upgradeMc3:GameUpgrade3;
var upgradeMc4:GameUpgrade4;
var upgradeMc6:GameUpgrade6;
var scrollScreen:String;
var mineDamage:Number;
var upgradeMc5:GameUpgrade5;
var upgradeMc1:GameUpgrade;
var musicSwitch:Boolean;// = true
var marchingAntsMc:Sprite;
var baseType:String;
var bouldersArray:Array;
var tilesArray:Array;
var releaseloc:Point;
var levelHeight:Number;
var scaleSmall:Number;
var levelsToRun:Array;
var enemyCastles:Array;
var fulltime:Number;
var panelItemsData:Array;
var backSkyMc:backgroundSkyMc;
var MAX_BADGUYS:Number;// = 18
var startGameMsgMc:GameStartMsg;
var badGuysLevels:Array;
var waveDelay:Number;
var spring:Number;
var zombiesLeftC:Number;
var minDisplay:String;
var clockDelay:Number;
var right:Number;
var zoomScreen:String;// = ""
var flagMc:halfWayFlag;
var bottom:Number;
var pauseMc:MovieClip;
var blockSize:Number;
var zombiePartsArray:Array;
var numPhysObjects:Number;
var levelChatEnd:Array;
var inGameActionMc:Sprite;
public var rt:Object;
var levelsLocation:Array;
var missilesArray:Array;
public var scrollvx:Number;
var presentationMc:Sprite;
var inGameZoomMc:Sprite;
var badGuyData1:Array;
var inGameCatapultBtnMc:Sprite;
var badGuyData5:Array;
var badGuyData6:Array;
var badGuyData7:Array;
var badGuyData8:Array;
var badGuyData3:Array;
var badGuyData4:Array;
public var cannonMove:String;// = ""
var badGuyData9:Array;
var badGuyData2:Array;
var cDial:catapultDial;
var goodGuysArray:Array;
var itemsArray:Array;
var energy:Number;
var catapultCatchMc:catapultCatch;
public var statsMc:GameWeaponsPanel;
public var score:Number;
var inGameExplosionsMc:Sprite;
var selectionBoxMc:selectionBox;
var antsbmp:antsMc;
var inGameMc:Sprite;
var goodKingMc:GameKingGood;
var Useful:GameUseful;
var inGameCatapultCatchMc:Sprite;
var mineCost:Number;
var floorMc:GameFloor;
var marquee_mc:MovieClip;
var oldMoney:Number;
var backMcWidth:Number;
var backMc2:backgroundP;
var wave;
var inGameBuildingsMc:Sprite;
var Player:GamePlayer;
var currentMoneyDelay:Number;
var friction:Number;
var bestScore:Number;
var scrollxPos:Number;
var movedOverHalf:Boolean;
var pickupsArray:Array;
var backgroundLevelMc:Sprite;
var levelHeightBlocks:Number;
var secDisplay:String;
public var levelStart:Number;
var levelMax:Number;
var catapultItem:Object;
var springLength:Number;
var glowFilter:GlowFilter;
var delayToWave;
var waveDelayD:Number;
var oldEnergy:Number;
var inGameGraphicsMc:Sprite;
public var frozenArray:Array;
var numberOfStartItems:Number;
var particlesArray:Array;
var itemsCost:Array;
var enemyArray:Array;
var catapultFired:Boolean;
var whosChattingIndex:Number;
var inGameFlagMc:Sprite;
var inGameBackgroundMc:Sprite;
public var destroyedArray:Array;
var cliffMc:goodCliff;
var catapultMc:GameCatapultRod;
var inGameBackgroundMc2:Sprite;
var currentTimeBonus:Number;
var timerStartY:Number;
var pickupType:String;
var inGameStatsMc:Sprite;
var inGameMsgsMc:Sprite;
var pickupAdded:Boolean;
var timerStartY2:Number;
var blockSizeY:Number;
public var levelNumber:Number;
var badKingMc:Object;
public var maxLevels:Number;
var tentMc:tent;
public static const SOLDIER_STATE_DEFEND:int = 1;
public static const SOLDIER_STATE_RETREAT:int = 3;
public static const SOLDIER_E_MOVE:int = 5;
public static const SOLDIER_STATE_CRYSTAL:int = 2;
public static const BAD_FLAG:Boolean = true;
public static const SOLDIER_E_STAND:int = 0;
public static const GOOD_FLAG:Boolean = false;
public static const SOLDIER_STATE_ATTACK:int = 0;
public static const SOLDIER_STATE_MOVE:int = 5;
public static const SOLDIER_E_BUILD:int = 2;
public static const STATE_SYSTEM_END_MSG:int = 12;
public static const SOLDIER_STATE_FALLING:int = 4;
public function GameGame(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8, _arg9){
var _local10:Array;
var _local11:Array;
var _local12:Array;
var _local13:Array;
var _local14:Array;
var _local15:Array;
var _local16:Array;
var _local17:Array;
var _local18:Array;
var _local19:Array;
var _local20:Array;
var _local21:Array;
var _local22:Array;
var _local23:Array;
var _local24:Array;
var _local25:Array;
var _local26:Array;
var _local27:Array;
var _local28:Array;
var _local29:Array;
var _local30:Array;
var _local31:Array;
var _local32:Array;
var _local33:Array;
var _local34:Array;
var _local35:Array;
var _local36:Array;
var _local37:Array;
var _local38:Array;
var _local39:Array;
var _local40:Array;
var _local41:Array;
var _local42:Array;
var _local43:Array;
var _local44:Array;
var _local45:Array;
var _local46:Array;
var _local47:Array;
var _local48:Array;
var _local49:Array;
var _local50:Array;
var _local51:String;
var _local52:String;
var _local53:String;
var _local54:String;
var _local55:String;
var _local56:String;
var _local57:String;
var _local58:String;
var _local59:String;
var _local60:String;
var _local61:String;
var _local62:String;
var _local63:String;
var _local64:String;
var _local65:String;
var _local66:String;
var _local67:String;
var _local68:String;
var _local69:String;
var _local70:String;
var _local71:String;
var _local72:String;
var _local73:String;
var _local74:String;
var _local75:String;
var _local76:String;
var _local77:String;
var _local78:String;
var _local79:String;
var _local80:String;
var _local81:String;
var _local82:String;
var _local83:String;
var _local84:String;
var _local85:String;
var _local86:String;
var _local87:String;
var _local88:String;
var _local89:String;
var _local90:String;
var _local91:String;
var _local92:String;
var _local93:String;
var _local94:String;
var _local95:String;
var _local96:String;
var _local97:String;
var _local98:String;
var _local99:String;
var _local100:String;
var _local101:String;
var _local102:String;
var _local103:String;
var _local104:String;
var _local105:String;
var _local106:String;
var _local107:Array;
var _local108:Array;
var _local109:Array;
var _local110:Array;
var _local111:Array;
var _local112:Array;
var _local113:Array;
var _local114:Array;
var _local115:Array;
var _local116:Array;
var _local117:Array;
var _local118:Array;
var _local119:Array;
var _local120:Array;
var _local121:Array;
var _local122:Array;
var _local123:Array;
var _local124:Array;
var _local125:Array;
var _local126:Array;
var _local127:Array;
var _local128:Array;
var _local129:Array;
var _local130:Array;
var _local131:Array;
var _local132:Array;
var _local133:Array;
var _local134:Array;
soundsSwitch = true;
musicSwitch = true;
zoomScreen = "";
cannonMove = "";
MAX_BADGUYS = 18;
super();
rt = _arg1;
Useful = _arg7;
Box2d = new GameBox2d(this, Useful, _arg9);
upgrade1 = false;
upgrade2 = false;
upgrade3 = false;
zoomSpeed = 0;
scaleSmall = (72 / 100);
scaleLarge = (100 / 100);
movieWidth = _arg2;
movieHeight = _arg3;
backMcWidth = 1240;
maxLevels = _arg8;
mineDamage = 20;
blockSize = 100;
blockSizeY = 30;
Sounds = new GameSounds(this);
levelWidthBlocks = _arg4;
levelHeightBlocks = _arg5;
levelWidth = (levelWidthBlocks * blockSize);
levelHeight = (levelHeightBlocks * blockSize);
inGameMc = new Sprite();
addChild(inGameMc);
presentationMc = new Sprite();
addChild(presentationMc);
inGameActionMc = new Sprite();
inGameMc.addChild(inGameActionMc);
inGameStatsMc = new Sprite();
inGameMc.addChild(inGameStatsMc);
inGameZoomMc = new Sprite();
inGameActionMc.addChild(inGameZoomMc);
inGameGraphicsMc = new Sprite();
inGameZoomMc.addChild(inGameGraphicsMc);
inGameMsgsMc = new Sprite();
inGameMc.addChild(inGameMsgsMc);
inGameBackgroundMc = new Sprite();
inGameGraphicsMc.addChild(inGameBackgroundMc);
inGameBackgroundMc2 = new Sprite();
inGameGraphicsMc.addChild(inGameBackgroundMc2);
spritesMc = new Sprite();
inGameGraphicsMc.addChild(spritesMc);
backgroundLevelMc = new Sprite();
spritesMc.addChild(backgroundLevelMc);
inGameCliffMc = new Sprite();
spritesMc.addChild(inGameCliffMc);
inGameCatapultCatchMc = new Sprite();
spritesMc.addChild(inGameCatapultCatchMc);
inGameFloorMc = new Sprite();
spritesMc.addChild(inGameFloorMc);
inGameBuildingsMc = new Sprite();
spritesMc.addChild(inGameBuildingsMc);
inGameFlagMc = new Sprite();
spritesMc.addChild(inGameFlagMc);
playerMc = new MovieClip();
spritesMc.addChild(playerMc);
inGameEnemyMc = new Sprite();
spritesMc.addChild(inGameEnemyMc);
inGameGoodGuysMc = new Sprite();
spritesMc.addChild(inGameGoodGuysMc);
inGameCatapultBtnMc = new Sprite();
spritesMc.addChild(inGameCatapultBtnMc);
inGameColourMc = new Sprite();
spritesMc.addChild(inGameColourMc);
inGamePickupsMc = new Sprite();
inGameColourMc.addChild(inGamePickupsMc);
inGameMissilesMc = new Sprite();
inGameColourMc.addChild(inGameMissilesMc);
inGameExplosionsMc = new Sprite();
inGameColourMc.addChild(inGameExplosionsMc);
inGameScoreMc = new Sprite();
inGameColourMc.addChild(inGameScoreMc);
inGameCWords = new Sprite();
inGameColourMc.addChild(inGameCWords);
bf = new BlurFilter(2, 2, BitmapFilterQuality.LOW);
bf2 = new BlurFilter(5, 5, BitmapFilterQuality.LOW);
cmf = new ColorMatrixFilter([1.3, 0, 0, 0, 2, 0, 2, 0, 0, 0, 0, 0, 14, 20, 0, 0, 0, 0, 1, 0]);
missilesArray = new Array();
enemyArray = new Array();
goodGuysArray = new Array();
missilesArray = new Array();
badGuysArray = new Array();
tilesArray = new Array();
explosionsArray = new Array();
particlesArray = new Array();
pickupsArray = new Array();
groundArray = new Array();
itemsArray = new Array();
selectionArray = new Array();
zombiePartsArray = new Array();
frozenArray = new Array();
upgradeCost1 = 60;
upgradeCost2 = 70;
upgradeCost3 = 80;
panelItemsData = new Array("swordsman", 10, "10 Gold. Click to buy. Swordsman. Stout of heart but not to bright!", "knight", 25, "25 Gold. Click to buy. Knight. Well trained and fearsome in battle, fully armoured!", "archer", 30, "30 Gold. Drag onto game screen to buy. Archers don't move but fire deadly arrows!", "crossbowman", 35, "35 Gold. Click to buy. Knight on horse. Fast and deadly!", "wizard", 55, "55 Gold. Drag onto game screen to buy.Wizard. Fires freeze magic at enemy!", "Super Knight", 65, "65 Gold. Click to buy. Super knight! Fearsome in battle!", "Wooden block", 15, "15 Gold. Drag onto screen to buy. Basic wooden building block, can be used to build walls", "Wooden plank", 20, "20 Gold. Drag onto game screen to buy. Wooden plank, can be used as a floor, roof or slope.", "Stone Block", 25, "25 Gold. Drag onto game screen to buy. Stone block, builds strong walls and defenses.", "heal potion", 10, "10 Gold. Heal potion, adds 10 health to any soldiers or fortifications", "Explode potion", 40, "40 Gold. Throw at enemy. Explodes to cause fearsome damage on your enemy!", "Freeze potion", 40, "40 Gold. A magical potion that once dropped near the enemy causes them to cease their attack!", "restore", 1, "Drop on your soldiers to restore them to health! becareful not to drop on your enemies! for it will bestow the same benefits!");
itemsCost = new Array(10, 10, 10, 10, 10, 10, 10, 10, 10, 10);
badGuyData1 = new Array("badKnight2", 405, 0.5, 0, "position", 1380, 350, 1, 1, 10, 1);
badGuyData2 = new Array("badKnight3", 405, 0.5, 0, "position", 1380, 350, 1, 1, 13, 5);
badGuyData3 = new Array("badArcher1", 405, 0.5, 0, "position", 1380, 350, 1, 1, 15, 6);
badGuyData4 = new Array("badKnight1", 405, 0.5, 0, "position", 1380, 350, 1, 3, 17, 10);
badGuyData5 = new Array("viking1", 405, 0.5, 0, "position", 1380, 350, 1, 3, 17, 15);
badGuyData6 = new Array("ram", 405, 0.5, 0, "position", 1380, 350, 1, 3, 18, 15);
badGuyData7 = new Array("badArcher2", 405, 0.5, 0, "position", 1380, 350, 1, 1, 16, 7);
badGuyData8 = new Array("bird", 405, 0.5, 0, "position", 1380, 150, 1, 5, 20, 15);
badGuyData9 = new Array("dragon", 405, 0.5, 0, "position", 1380, 150, 1, 5, 20, 25);
_local10 = new Array(badGuyData1, badGuyData8);
_local11 = new Array(badGuyData1, badGuyData1, badGuyData1);
_local12 = new Array(badGuyData1, badGuyData2);
_local13 = new Array(badGuyData2, badGuyData2, badGuyData8, badGuyData1, badGuyData8);
_local14 = new Array(badGuyData2, badGuyData2, badGuyData2);
_local15 = new Array(badGuyData5, badGuyData9);
_local16 = new Array(badGuyData6, badGuyData2, badGuyData2, badGuyData2);
_local17 = new Array(badGuyData1, badGuyData2);
_local18 = new Array(badGuyData4);
_local19 = new Array(badGuyData4, badGuyData4);
_local20 = new Array(badGuyData2, badGuyData6, badGuyData2);
_local21 = new Array(badGuyData5);
_local22 = new Array(badGuyData9);
_local23 = new Array(_local10);
_local24 = new Array(_local11);
_local25 = new Array(_local11, _local12);
_local26 = new Array(_local12, _local13);
_local27 = new Array(_local14, _local13);
_local28 = new Array(_local14, _local14, _local15);
_local29 = new Array(_local13, _local16, _local11);
_local30 = new Array(_local16, _local17, _local18, _local11);
_local31 = new Array(_local11, _local16, _local13);
_local32 = new Array(_local12, _local18, _local19, _local22);
_local33 = new Array(_local11, _local20);
_local34 = new Array(_local11, _local19, _local19);
_local35 = new Array(_local11, _local21, _local15);
_local36 = new Array(_local12, _local12, _local21, _local21);
badGuysLevels = new Array(_local23, _local24, _local25, _local26, _local27, _local28, _local29, _local30, _local31, _local32, _local33, _local34, _local35, _local36);
_local37 = new Array(new Array(0, 0, 0, 0, 4, 3), new Array(0, 0, 0, 0, 1, 1), new Array(0, 0, 0, 0, 1, 1), new Array(0, 0, 0, 0, 1, 1), new Array(0, 0, 0, 0, 1, 1), new Array(0, 0, 0, 0, 3, 1));
_local38 = new Array(new Array(0, 0, 4, 3, 4, 3), new Array(0, 0, 2, 1, 0, 0), new Array(1, 1, 0, 0, 1, 1), new Array(1, 1, 0, 0, 1, 1), new Array(1, 1, 0, 0, 1, 1), new Array(1, 1, 0, 0, 1, 1));
_local39 = new Array(new Array(4, 3, 0, 0, 4, 3, 0, 0, 4, 3), new Array(1, 1, 0, 0, 1, 1, 0, 0, 1, 1), new Array(1, 1, 0, 0, 1, 1, 0, 0, 1, 1), new Array(3, 1, 0, 0, 3, 1, 0, 0, 3, 1));
_local40 = new Array(new Array(0, 0, 0, 0, 4, 3), new Array(0, 0, 0, 0, 3, 1), new Array(0, 0, 0, 0, 3, 1, 4, 3, 4, 3, 0, 0, 4, 3), new Array(0, 0, 0, 0, 3, 1, 0, 0, 2, 1, 0, 0, 0, 0, 2, 1), new Array(0, 0, 0, 0, 3, 1, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1), new Array(0, 0, 0, 0, 3, 1, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1));
_local41 = new Array(new Array(0, 0, 0, 0, 4, 7), new Array(0, 0, 0, 0, 1, 1), new Array(0, 0, 0, 0, 1, 1, 4, 3, 0, 0, 4, 3, 0, 0, 4, 3), new Array(0, 0, 0, 0, 1, 1, 0, 0, 2, 1, 0, 0, 0, 0, 2, 1), new Array(0, 0, 0, 0, 3, 1, 0, 0, 3, 1, 0, 0, 3, 1, 0, 0, 3, 1), new Array(0, 0, 0, 0, 3, 1, 0, 0, 3, 1, 0, 0, 3, 1, 0, 0, 3, 1));
_local42 = new Array(new Array(0, 0, 0, 0, 4, 7), new Array(0, 0, 0, 0, 1, 1), new Array(0, 0, 0, 0, 1, 1, 4, 7, 0, 0, 4, 7, 0, 0, 4, 7), new Array(1, 1, 0, 0, 1, 1, 0, 0, 2, 1, 0, 0, 0, 0, 2, 1), new Array(1, 1, 0, 0, 3, 1, 0, 0, 3, 1, 0, 0, 3, 1, 0, 0, 3, 1), new Array(1, 1, 0, 0, 3, 1, 0, 0, 3, 1, 0, 0, 3, 1, 0, 0, 3, 1));
_local43 = new Array(new Array(0, 0, 0, 0, 4, 7), new Array(0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 7, 0, 0, 0, 0, 4, 7), new Array(0, 0, 0, 0, 3, 1, 4, 3, 0, 0, 4, 3, 0, 0, 4, 3, 3, 1, 0, 0, 0, 0, 3, 1), new Array(0, 0, 0, 0, 3, 1, 0, 0, 2, 1, 0, 0, 0, 0, 2, 1, 0, 0, 0, 0, 0, 2, 1), new Array(3, 1, 0, 0, 3, 1, 3, 1, 0, 0, 3, 1, 3, 1, 0, 0, 3, 1, 0, 0, 0, 0, 3, 1), new Array(3, 1, 0, 0, 3, 1, 3, 1, 0, 0, 3, 1, 3, 1, 0, 0, 3, 1, 0, 0, 0, 0, 3, 1));
_local44 = new Array(new Array(0, 0, 0, 0, 4, 3), new Array(0, 0, 0, 0, 3, 1, 3, 1), new Array(0, 0, 0, 0, 3, 1, 3, 1), new Array(0, 0, 0, 0, 3, 1, 3, 1), new Array(0, 0, 0, 0, 3, 1, 3, 1), new Array(0, 0, 0, 0, 3, 1, 3, 1), new Array(0, 0, 0, 0, 3, 1, 3, 1));
_local45 = new Array(new Array(4, 7, 0, 0, 4, 7, 4, 3, 0, 0, 0, 0, 4, 3, 0, 0, 0, 0, 4, 3, 0, 0, 0, 0, 4, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), new Array(3, 1, 0, 0, 3, 1, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 0, 0), new Array(3, 1, 0, 0, 3, 1, 0, 0, 0, 0, 2, 1, 0, 0, 0, 0, 2, 1, 0, 0, 0, 0, 2, 1, 0, 0, 0, 0, 2, 1, 0, 0, 0, 0, 0, 0), new Array(3, 1, 0, 0, 3, 1, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 0, 0), new Array(3, 1, 0, 0, 3, 1, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 0, 0), new Array(3, 1, 0, 0, 3, 1, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 3, 1));
_local46 = new Array(new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0), new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0), new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0), new Array(0, 0, 0, 0, 3, 1, 4, 3, 4, 3, 3, 1), new Array(0, 0, 0, 0, 3, 1, 3, 1, 3, 1, 3, 1), new Array(0, 0, 0, 0, 3, 1, 3, 1, 3, 1, 3, 1), new Array(0, 0, 0, 0, 3, 1, 3, 1, 3, 1, 3, 1));
_local47 = new Array(new Array(0, 0, 0, 0, 4, 7), new Array(0, 0, 0, 0, 1, 1), new Array(0, 0, 0, 0, 1, 1, 4, 3, 0, 0, 4, 3, 0, 0, 4, 3, 0, 0, 4, 3, 0, 0, 4, 3, 0, 0, 4, 3), new Array(0, 0, 0, 0, 1, 1, 0, 0, 2, 1, 0, 0, 0, 0, 2, 1, 0, 0, 0, 0, 2, 1, 0, 0, 0, 0, 2, 1), new Array(0, 0, 0, 0, 3, 1, 0, 0, 3, 1, 0, 0, 3, 1, 0, 0, 3, 1, 0, 0, 3, 1, 0, 0, 3, 1, 0, 0, 3, 1), new Array(0, 0, 0, 0, 3, 1, 0, 0, 3, 1, 0, 0, 3, 1, 0, 0, 3, 1, 0, 0, 3, 1, 0, 0, 3, 1, 0, 0, 3, 1));
_local48 = new Array(new Array(0, 0, 0, 0, 4, 7), new Array(0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 7, 0, 0, 0, 0, 4, 7), new Array(0, 0, 0, 0, 3, 1, 4, 3, 0, 0, 4, 3, 0, 0, 4, 3, 3, 1, 0, 0, 0, 0, 3, 1, 0, 0, 4, 7), new Array(0, 0, 0, 0, 3, 1, 0, 0, 2, 1, 0, 0, 0, 0, 2, 1, 0, 0, 0, 0, 2, 1, 0, 0, 0, 0, 2, 1), new Array(0, 0, 0, 0, 3, 1, 3, 1, 0, 0, 3, 1, 3, 1, 0, 0, 3, 1, 3, 1, 0, 0, 3, 1, 0, 0, 3, 1), new Array(0, 0, 0, 0, 3, 1, 3, 1, 0, 0, 3, 1, 3, 1, 0, 0, 3, 1, 3, 1, 0, 0, 3, 1, 0, 0, 3, 1));
_local49 = new Array(new Array(0, 0, 0, 0, 4, 3), new Array(0, 0, 0, 0, 3, 1), new Array(0, 0, 0, 0, 3, 1), new Array(0, 0, 0, 0, 3, 1), new Array(0, 0, 0, 0, 3, 1), new Array(0, 0, 0, 0, 3, 1, 3, 1));
_local50 = new Array(new Array(4, 3, 0, 0, 4, 3, 0, 0, 4, 3), new Array(3, 1, 0, 0, 0, 0), new Array(3, 1, 0, 0, 0, 0), new Array(3, 1, 0, 0, 3, 1, 0, 0, 3, 1, 0, 0, 3, 1), new Array(3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1), new Array(3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1));
enemyCastles = new Array(_local41, _local42, _local43, _local44, _local45, _local46, _local47, _local48, _local49, _local50);
_local51 = "I am Arthur! Stand aside! You are not wanted here! ";
_local52 = "We meet again! this will be the last time! ";
_local53 = "Run away, but I will find you! ";
_local54 = "You may have beaten me today, but I will be back! ";
_local55 = "Your day has come! You cannot run any further! ";
_local56 = "This is your final battle Arthur! ";
_local57 = "You are defeated! ";
_local58 = "Arrgggg! ";
_local59 = "Hear me! You cannot unite this country only I can! ";
_local60 = "I will be King and rule this land! ";
_local61 = "You are defeated, why battle on? ";
_local62 = "This land is mine!!! ";
_local63 = "Even your fortress will fall! ";
_local64 = "I will crush you! ";
_local65 = "You are defeated! ";
_local66 = "Arrgggg! ";
_local67 = "Two have already fallen to me, you will be next! ";
_local68 = "You are strong, but not strong enough! ";
_local69 = "stand and fight! ";
_local70 = "I retreat for now! ";
_local71 = "I will chase you to your final destination! ";
_local72 = "You will not survive the battle! ";
_local73 = "You are defeated! ";
_local74 = "Arrgggg! ";
_local75 = "Today, your kingdom will be mine! ";
_local76 = "You attack will fail against my fortress! ";
_local77 = "Your walls have fallen! ";
_local78 = "Arrrgggg ";
_local79 = "Rhodri! You will be deated! ";
_local80 = "Ha! I don't scare easily! ";
_local81 = "You are defeated! ";
_local82 = "Arrgggg! ";
_local83 = "I am Arthur! You will not succeed! ";
_local84 = "This is my domain, and will remain so! ";
_local85 = "Do you give in! ";
_local86 = "Never! ";
_local87 = "It is your last day Morgan! ";
_local88 = "Your weapons are nothing to me! ";
_local89 = "You are defeated! ";
_local90 = "Arrgggg! ";
_local91 = "I will be your king! ";
_local92 = "You have come far, but will go no further! ";
_local93 = "Submit to my will and you will be spared! ";
_local94 = "You win today, but you will not defeat me. ";
_local95 = "Stand with me or I will stand on thee! ";
_local96 = "Many have fallen, but the day will be mine! ";
_local97 = "You are defeated! ";
_local98 = "Arrgggg! ";
_local99 = "I am Arthur! Vikings will never rule here! ";
_local100 = "Haha! you will beg for mercy when we are done! ";
_local101 = "Run viking! ";
_local102 = "You cannot withstand us boy!! ";
_local103 = "On this day all will be mine! ";
_local104 = "Oden will strike you! ";
_local105 = "I have fought my final battle! ";
_local106 = "Arrgggg! ";
levelsLocation = new Array("Cornwall", "Wessex", "Sussex", "Kent", "Anglia", "Mercia", "Luitcoyt", "Wales", "Elmet", "Lindsey");
levelsRuler = new Array("Egbert", "Egbert", "Caldron the Creepy", "Caldron the Creepy", "Anders the Smart", "Anders the Smart", "Rhodri the Great", "Rhodri the Great", "Morgan le Fay", "Morgan le Fay");
_local107 = new Array(_local51, _local52);
_local108 = new Array(_local53, _local54);
_local109 = new Array(_local55, _local56);
_local110 = new Array(_local57, _local58);
_local111 = new Array(_local59, _local60);
_local112 = new Array(_local61, _local62);
_local113 = new Array(_local63, _local64);
_local114 = new Array(_local65, _local66);
_local115 = new Array(_local67, _local68);
_local116 = new Array(_local69, _local70);
_local117 = new Array(_local71, _local72);
_local118 = new Array(_local73, _local74);
_local119 = new Array(_local75, _local76);
_local120 = new Array(_local77, _local78);
_local121 = new Array(_local79, _local80);
_local122 = new Array(_local81, _local82);
_local123 = new Array(_local83, _local84);
_local124 = new Array(_local85, _local86);
_local125 = new Array(_local87, _local88);
_local126 = new Array(_local89, _local90);
_local127 = new Array(_local91, _local92);
_local128 = new Array(_local93, _local94);
_local129 = new Array(_local95, _local96);
_local130 = new Array(_local97, _local98);
_local131 = new Array(_local99, _local100);
_local132 = new Array(_local101, _local102);
_local133 = new Array(_local103, _local104);
_local134 = new Array(_local105, _local106);
levelChatStart = new Array(_local107, _local109, _local111, _local113, _local115, _local117, _local119, _local121, _local123, _local125, _local127, _local129, _local131, _local133);
levelChatEnd = new Array(_local108, _local110, _local112, _local114, _local116, _local118, _local120, _local122, _local124, _local126, _local128, _local130, _local132, _local134);
levelsToRun = new Array(1, 3, 5, 7, 9, 23);
letterIndex = 0;
whosChattingIndex = 0;
letterDelay = 10;
glowFilter = new GlowFilter(6750054, 1, 8, 8, 3, 1);
boulderBought = false;
scrollvx = 0;
score = 0;
bestScore = 0;
lives = _arg6;
energy = 100;
money = 0;
energyAlien = 100;
currentMoneyDelay = 40;
moneyDelay = currentMoneyDelay;
moneyMax = 100;
spring = 0.01;
friction = 0.8;
springLength = 10;
left = -20;
right = (movieWidth - 20);
top = 0;
bottom = movieHeight;
levelStart = 1;
levelNumber = levelStart;
levelMax = 10;
wave = 0;
delayToWave = 100;
maxScrollSpeed = 24;
scrollxPos = 0;
secDisplay = "00";
minDisplay = "00";
StartTimer = 1;
clockDelay = 10;
minutes = StartTimer;
sec = 0;
fulltime = 0;
numberOfStartItems = 3;
pauseSwitch = false;
antsbmp = new antsMc(0, 0);
shift = new Matrix();
clickloc = new Point(-10, -10);
releaseloc = new Point(-10, -10);
filterDelay = 1;
filterAlienDelay = 1;
scrollScreen = "";
mineCost = 10;
wallCost = 20;
}
function increaseMoney(_arg1:Number){
money = (money + _arg1);
if (money > 10000){
money = 10000;
};
setMoney();
checkForAfford();
}
public function setupGame(){
newArrays();
cannonMove = "";
Box2d.setupBox2d();
setupCatapultDial();
catapultClicked = false;
catapultFired = false;
catapultItem = null;
oldEnergy = energy;
oldScore = score;
oldUpgrade1 = upgrade1;
oldUpgrade2 = upgrade2;
oldUpgrade3 = upgrade3;
oldUpgrade4 = upgrade4;
oldUpgrade5 = upgrade5;
oldUpgrade6 = upgrade6;
movedOverHalf = true;
levelTime = 0;
waveDelayD = 1;
energy = 100;
wave = 0;
freezeDelay = 2;
waveDelay = (1020 - (levelNumber * 70));
delayToWave = 100;
money = (9 + levelNumber);
moneyDelay = currentMoneyDelay;
moneyMax = (100 + ((levelNumber - 1) * 20));
setupPanel();
setupBackground();
soundFxBtn2();
musicBtn2();
setScore();
setLevel();
setMoney();
setupStartGameMsg();
checkForAfford();
rt.stage.focus = rt;
}
function endLevelStuff(){
oldUpgrade1 = false;
oldUpgrade2 = false;
oldUpgrade3 = false;
upgrade1 = oldUpgrade1;
upgrade2 = oldUpgrade2;
upgrade3 = oldUpgrade3;
rt.gameState = 6;
killAllExplosions();
levelNumber++;
inGameMsgsMc.removeChild(levelCompleteMsg);
levelCompleteMsg = null;
inGameBackgroundMc.removeChild(backSkyMc);
backSkyMc.stop();
backSkyMc = null;
spritesMc.x = 0;
newLevelStuff();
destroyEverything();
rt.setupMapScreen();
}
function setupBadSoldier(_arg1, _arg2, _arg3){
var _local4:String;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:*;
_local4 = _arg1[0];
_local5 = _arg1[1];
_local6 = _arg1[2];
_local7 = _arg1[3];
_local8 = _arg2;
_local9 = _arg3;
_local10 = _arg1[8];
_local11 = _arg1[9];
_local12 = _arg1[10];
_local13 = Box2d.setupGrabbedItem(_local4, _local5, _local6, _local7, "position", _local8, _local9, 1);
badGuysArray.push(new GameBadGuy(_local4, this, _local13.x, _local13.y, _local13, Useful, _local10, _local11, _local12));
}
function runWave(){
var _local1:Array;
var _local2:Number;
if (movedOverHalf == true){
if (badGuysArray.length < MAX_BADGUYS){
delayToWave--;
if (delayToWave == 0){
setupWave(wave);
wave++;
_local1 = badGuysLevels[(levelNumber - 1)];
if (wave >= _local1.length){
wave = 0;
};
waveDelayD--;
if (waveDelayD == 0){
waveDelayD = 1;
_local2 = (levelNumber * 3);
if (_local2 > 20){
_local2 = 20;
};
waveDelay = (waveDelay - _local2);
if (waveDelay < 50){
waveDelay = 50;
};
};
delayToWave = waveDelay;
};
};
};
}
function setLevel(){
statsMc.levelTxt.text = String(levelNumber);
}
public function selectionBoxOff(){
if (selectionBoxMc != null){
selectionBoxMc.myParent.removeChild(selectionBoxMc);
selectionBoxMc = null;
Box2d.bodyGrabbed = null;
};
}
function soundFxBtn(){
if (statsMc.soundFxMc.currentFrame == 1){
statsMc.soundFxMc.gotoAndStop("off");
soundsSwitch = false;
} else {
statsMc.soundFxMc.gotoAndStop("on");
soundsSwitch = true;
};
}
function checkForAfford(){
var _local1:*;
_local1 = 0;
while (_local1 < 9) {
if (panelItemsData[((_local1 * 3) + 1)] > money){
if (itemsArray[_local1].currentFrame != 2){
itemsArray[_local1].gotoAndStop("notBuy");
};
} else {
if (itemsArray[_local1].currentFrame != 1){
itemsArray[_local1].gotoAndStop(1);
};
};
_local1++;
};
if (upgrade1 == false){
if (upgradeMc1.back.currentFrame == 1){
if (upgradeCost1 > money){
upgradeMc1.gotoAndStop("notAfford");
} else {
upgradeMc1.gotoAndStop(1);
};
};
};
if (upgrade2 == false){
if (upgradeMc2.back.currentFrame == 1){
if (upgradeCost2 > money){
upgradeMc2.gotoAndStop("notAfford");
} else {
upgradeMc2.gotoAndStop(1);
};
};
};
if (upgrade3 == false){
if (upgradeMc3.back.currentFrame == 1){
if (upgradeCost3 > money){
upgradeMc3.gotoAndStop("notAfford");
} else {
upgradeMc3.gotoAndStop(1);
};
};
};
}
function setupSoldier(_arg1, _arg2, _arg3){
var _local4:*;
_local4 = _arg1.myType;
if (_local4 == "knight"){
goodGuysArray.push(new GameGoodGuy(this, _arg2, _arg3, _arg1, Useful, 200, 1, 5));
} else {
if (_local4 == "knight2"){
goodGuysArray.push(new GameGoodGuy(this, _arg2, _arg3, _arg1, Useful, 200, 1, 7));
} else {
if (_local4 == "archer"){
goodGuysArray.push(new GameGoodGuy(this, _arg2, _arg3, _arg1, Useful, 200, 0, 3));
} else {
if (_local4 == "wizard"){
goodGuysArray.push(new GameGoodGuy(this, _arg2, _arg3, _arg1, Useful, 200, 0, 4));
} else {
if (_local4 == "knight3"){
goodGuysArray.push(new GameGoodGuy(this, _arg2, _arg3, _arg1, Useful, 200, 2, 8));
} else {
if (_local4 == "knight4"){
goodGuysArray.push(new GameGoodGuy(this, _arg2, _arg3, _arg1, Useful, 200, 1, 10));
};
};
};
};
};
};
}
function doMoneyIncrease(){
moneyDelay--;
if (moneyDelay == 0){
if (upgrade3 == true){
moneyDelay = 30;
} else {
moneyDelay = currentMoneyDelay;
};
money++;
if (money > moneyMax){
money = moneyMax;
};
};
setMoney();
checkForAfford();
}
function runStartChat(){
var _local1:Array;
var _local2:String;
var _local3:Number;
Box2d.runBox2d();
letterDelay--;
if (letterDelay == 0){
letterDelay = 2;
_local1 = levelChatStart[(levelNumber - 1)];
_local2 = _local1[whosChattingIndex];
_local3 = int((whosChattingIndex / 2));
_local3 = (_local3 * 2);
currentPhrase = _local2.slice(0, letterIndex);
if (whosChattingIndex == _local3){
statsMc.leftSpeech.gotoAndStop(2);
statsMc.kingGoodHead.expressions.gotoAndStop("talking");
statsMc.rightSpeech.gotoAndStop(1);
statsMc.kingBadHead.expressions.gotoAndStop("static");
statsMc.rightSpeech.txt.text = "";
statsMc.leftSpeech.txt.text = currentPhrase;
} else {
statsMc.leftSpeech.gotoAndStop(1);
statsMc.kingGoodHead.expressions.gotoAndStop("static");
statsMc.kingBadHead.expressions.gotoAndStop("talking");
statsMc.rightSpeech.gotoAndStop(2);
statsMc.leftSpeech.txt.text = "";
statsMc.rightSpeech.txt.text = currentPhrase;
};
letterIndex++;
if (letterIndex == _local2.length){
letterIndex = 0;
letterDelay = 10;
whosChattingIndex++;
if (whosChattingIndex == _local1.length){
statsMc.leftSpeech.gotoAndStop(1);
statsMc.rightSpeech.gotoAndStop(1);
statsMc.rightSpeech.txt.text = "";
statsMc.kingBadHead.expressions.gotoAndStop("static");
finishSetup();
};
};
};
}
function decreaseScore(_arg1){
score = int((score - _arg1));
if (score >= 0){
setScore();
} else {
score = 0;
setScore();
};
}
function resetKingBad(){
var _local1:Boolean;
var _local2:int;
var _local3:b2Vec2;
var _local4:Number;
_local1 = false;
whosChattingIndex = 0;
_local2 = 0;
while (_local2 < levelsToRun.length) {
if (levelNumber == levelsToRun[_local2]){
_local1 = true;
break;
};
_local2++;
};
if (_local1 == false){
_local4 = badKingMc.myBodyDef.GetAngle();
_local3 = new b2Vec2();
_local3.x = (Useful.bxConvertToMetres(1500, Box2d.BxScalingFactor) / 2);
_local3.y = (Useful.bxConvertToMetres(240, Box2d.BxScalingFactor) / 2);
badKingMc.myBodyDef.SetXForm(_local3, _local4);
} else {
setupKingBad();
};
_local3 = badKingMc.myBodyDef.GetLinearVelocity();
_local3.x = 0;
_local3.y = 0;
badKingMc.myBodyDef.WakeUp();
badKingMc.myBodyDef.SetLinearVelocity(_local3);
}
public function cannonUp(){
cDial.needle.rotation++;
}
function setCannonRange(){
var _local1:Number;
_local1 = cDial.needle.rotation;
if (_local1 > 600){
_local1 = 600;
};
}
function decreaseEnergy(_arg1:Number){
var _local2:*;
statsMc.timer.maskMc.x = (statsMc.timer.maskMc.x - (_arg1 / 8));
_local2 = new GameRisingScore(rt, inGameScoreMc, _arg1);
inGameScoreMc.addChild(_local2);
if (Player != null){
_local2.x = Player.mC.x;
_local2.y = Player.mC.y;
};
if (statsMc.timer.maskMc.x < -(statsMc.timer.maskMc.width)){
return (true);
};
return (false);
}
function musicBtn2(){
if (musicSwitch == false){
statsMc.musicMc.gotoAndStop("off");
} else {
statsMc.musicMc.gotoAndStop("on");
};
}
function scrollBackRight(){
scrollxPos = (scrollxPos + scrollvx);
if (scrollxPos > 0){
scrollxPos = 0;
scrollvx = 0;
spritesMc.x = 0;
} else {
spritesMc.x = (spritesMc.x + scrollvx);
inGameBackgroundMc2.x = (inGameBackgroundMc2.x + (scrollvx / 2));
inGameBackgroundMc.x = (inGameBackgroundMc.x + (scrollvx / 4));
};
}
function killAllGoodGuys(){
var _local1:Number;
var _local2:int;
var _local3:*;
_local1 = inGameGoodGuysMc.numChildren;
_local2 = 0;
while (_local2 < _local1) {
_local3 = inGameGoodGuysMc.getChildAt(0);
if (_local3.myType != "catapultBase"){
if (_local3.myType != "catapultRod"){
if (_local3.myType != "catapultCup"){
if (_local3.myType != "kingGood"){
if (_local3.myObject == null){
if (_local3.myParent != null){
_local3.destroyMe();
};
};
};
};
};
};
_local2++;
};
}
function setMoney(){
statsMc.money.text = ((String(money) + "/") + moneyMax);
}
function increaseScore(_arg1){
score = int((score + _arg1));
if (score > 0){
setScore();
};
}
function setEnergy(){
if (filterDelay > 1){
filterDelay--;
if (filterDelay == 1){
Player.mC.filters = [];
};
};
}
function setupZoomBtns(){
if (inGameZoomMc.scaleX > 0.95){
statsMc.zoom1.gotoAndStop("on");
statsMc.zoom2.gotoAndStop("off");
statsMc.zoom3.gotoAndStop("off");
statsMc.zoom4.gotoAndStop("off");
} else {
if (inGameZoomMc.scaleX > 0.85){
statsMc.zoom1.gotoAndStop("off");
statsMc.zoom2.gotoAndStop("on");
statsMc.zoom3.gotoAndStop("off");
statsMc.zoom4.gotoAndStop("off");
} else {
if (inGameZoomMc.scaleX > 0.75){
statsMc.zoom1.gotoAndStop("off");
statsMc.zoom2.gotoAndStop("off");
statsMc.zoom3.gotoAndStop("on");
statsMc.zoom4.gotoAndStop("off");
} else {
statsMc.zoom1.gotoAndStop("off");
statsMc.zoom2.gotoAndStop("off");
statsMc.zoom3.gotoAndStop("off");
statsMc.zoom4.gotoAndStop("on");
};
};
};
}
function finishSetup(){
rt.finishSetup();
}
public function setupPanel():void{
statsMc = new GameWeaponsPanel(this);
inGameStatsMc.addChild(statsMc);
timerStartY = statsMc.timer.maskMc.x;
timerStartY2 = statsMc.timer2.maskMc.x;
statsMc.y = (movieHeight - 77);
statsMc.msg.text = "Welcome Arthur to your quest for power!";
statsMc.timer.maskMc.x = timerStartY;
statsMc.timer2.maskMc.x = timerStartY2;
statsMc.kingBadHead.gotoAndStop(levelNumber);
statsMc.rightNamesTxt.text = levelsRuler[(levelNumber - 1)];
setupPanelItems();
setupZoomBtns();
}
function checkForGameOver(){
if (energy == 0){
gameOver("game_over");
};
}
function killAllExplosions(){
var _local1:*;
_local1 = (explosionsArray.length - 1);
while (_local1 >= 0) {
explosionsArray[_local1].remove();
_local1--;
};
_local1 = (particlesArray.length - 1);
while (_local1 >= 0) {
particlesArray[_local1].remove();
_local1--;
};
}
function setLives(){
var _local1:MovieClip;
_local1 = inGameStatsMc["ingamestatsmc"];
_local1 = _local1["wg"];
_local1 = _local1["stats"];
_local1.lives.text = lives;
}
function checkPanel(){
var _local1:*;
_local1 = 0;
while (_local1 < itemsArray.length) {
if (itemsArray[_local1].hitTestPoint(stage.mouseX, stage.mouseY, true)){
statsMc.msg.text = panelItemsData[((_local1 * 3) + 2)];
};
_local1++;
};
if (upgradeMc1.hitTestPoint(stage.mouseX, stage.mouseY, true)){
statsMc.msg.text = "60 Gold. Click to buy. Upgrade Cannon!";
} else {
if (upgradeMc2.hitTestPoint(stage.mouseX, stage.mouseY, true)){
statsMc.msg.text = "70 Gold. Click to buy. Magical shield for all your troops for limited time";
} else {
if (upgradeMc3.hitTestPoint(stage.mouseX, stage.mouseY, true)){
statsMc.msg.text = "80 Gold. Click to buy. Speed up the rate your gold increases for the duration of the level";
} else {
if (statsMc.quitBtn.hitTestPoint(stage.mouseX, stage.mouseY, true)){
statsMc.msg.text = "Click to Quit game";
} else {
if (statsMc.musicBtn.hitTestPoint(stage.mouseX, stage.mouseY, true)){
statsMc.msg.text = "Click to turn music on/off";
} else {
if (statsMc.soundFxBtn.hitTestPoint(stage.mouseX, stage.mouseY, true)){
statsMc.msg.text = "Click to turn sound effects on/off";
} else {
if (statsMc.pausePanelBtn.hitTestPoint(stage.mouseX, stage.mouseY, true)){
statsMc.msg.text = "Click to pause/unpause game";
};
};
};
};
};
};
};
}
function musicBtn(){
if (statsMc.musicMc.currentFrame == 1){
statsMc.musicMc.gotoAndStop("off");
rt.titleMusicChannel.stop();
musicSwitch = false;
} else {
statsMc.musicMc.gotoAndStop("on");
musicSwitch = true;
rt.titleMusicChannel = rt.titleMusic.play(0, 10000);
Sounds.setVolume(rt.titleMusicChannel, 0.1);
};
}
public function setupGoodGuy(_arg1):void{
var _local2:*;
var _local3:*;
if (_arg1.myObject == null){
_local2 = (stage.mouseX - spritesMc.x);
_local3 = 100;
setupSoldier(_arg1, _local2, _local3);
};
}
function removeCatapultDial(){
inGamePickupsMc.removeChild(cDial);
cDial = null;
catapultClicked = false;
catapultFired = true;
boulderBought = false;
catapultItem = null;
Sounds.playSoundFx("throwFx", 1, 0, 1);
}
public function on_mouse_down(){
var _local1:Boolean;
var _local2:Number;
var _local3:b2MassData;
var _local4:b2Vec2;
_local1 = false;
if (Box2d.bodyGrabbed == null){
Box2d.bodyGrabbed = Box2d.GetBodyAtMouse();
if (Box2d.bodyGrabbed){
if (Box2d.bodyGrabbed.m_userData.goodBad == false){
if (Box2d.bodyGrabbed.m_userData.myType != "knight4"){
if (Box2d.bodyGrabbed.m_userData.myType != "knight3"){
if (Box2d.bodyGrabbed.m_userData.myType != "knight"){
if (Box2d.bodyGrabbed.m_userData.myType != "knight2"){
if (Box2d.bodyGrabbed.m_userData.myType != "cannonBall"){
if (Box2d.bodyGrabbed.m_userData.myType != "boulder"){
if (Box2d.bodyGrabbed.m_userData.myType != "kingGood"){
if (Box2d.bodyGrabbed.m_userData.myType != "catapultRod"){
setupSelectionBox(Box2d.bodyGrabbed.m_userData);
Box2d.bodyGrabbed.m_userData.myParent.setChildIndex(Box2d.bodyGrabbed.m_userData, (Box2d.bodyGrabbed.m_userData.myParent.numChildren - 1));
_local2 = Box2d.bodyGrabbed.GetMass();
_local3 = new b2MassData();
_local3.mass = _local2;
Box2d.bodyGrabbed.SetMass(_local3);
_local4 = new b2Vec2();
_local4 = Box2d.bodyGrabbed.GetPosition();
Box2d.bodyGrabbed.SetXForm(_local4, 0);
Box2d.setupMouseJoint();
} else {
Box2d.bodyGrabbed = null;
};
} else {
Box2d.bodyGrabbed = null;
};
} else {
Box2d.bodyGrabbed = null;
};
} else {
Box2d.bodyGrabbed = null;
};
} else {
Box2d.bodyGrabbed = null;
};
} else {
Box2d.bodyGrabbed = null;
};
} else {
Box2d.bodyGrabbed = null;
};
} else {
Box2d.bodyGrabbed = null;
};
} else {
Box2d.bodyGrabbed = null;
};
};
};
}
function pauseOn(){
pauseSwitch = true;
}
public function destroyEverything(){
var _local1:Number;
var _local2:int;
goodGuysArray.splice(0);
badGuysArray.splice(0);
bouldersArray.splice(0);
explosionsArray.splice(0);
particlesArray.splice(0);
missilesArray.splice(0);
newArrays();
catapultClicked = false;
catapultFired = false;
boulderBought = false;
catapultItem = null;
_local1 = inGameBuildingsMc.numChildren;
_local2 = 0;
while (_local2 < _local1) {
inGameBuildingsMc.removeChildAt(0);
_local2++;
};
_local1 = inGameEnemyMc.numChildren;
_local2 = 0;
while (_local2 < _local1) {
inGameEnemyMc.removeChildAt(0);
_local2++;
};
_local1 = inGameGoodGuysMc.numChildren;
_local2 = 0;
while (_local2 < _local1) {
inGameGoodGuysMc.removeChildAt(0);
_local2++;
};
_local1 = inGameMissilesMc.numChildren;
_local2 = 0;
while (_local2 < _local1) {
inGameMissilesMc.removeChildAt(0);
_local2++;
};
_local1 = inGameExplosionsMc.numChildren;
_local2 = 0;
while (_local2 < _local1) {
inGameExplosionsMc.removeChildAt(0);
_local2++;
};
floorMc.stop();
inGameFloorMc.removeChild(floorMc);
floorMc.stop();
floorMc = null;
cliffMc.stop();
inGameCliffMc.removeChild(cliffMc);
cliffMc.stop();
cliffMc = null;
catapultCatchMc = null;
inGameCliffMc.removeChild(tentMc);
tentMc.stop();
tentMc = null;
if (cDial != null){
inGamePickupsMc.removeChild(cDial);
};
goodKingMc = null;
badKingMc = null;
inGameStatsMc.removeChild(statsMc);
statsMc = null;
Box2d.destroyEverything();
}
function setupStartGameMsg(){
var _local1:String;
var _local2:String;
startGameMsgMc = new GameStartMsg(this);
inGameMsgsMc.addChild(startGameMsgMc);
_local1 = ((String(levelNumber) + ": ") + String(levelsLocation[(levelNumber - 1)]));
_local2 = String(levelsRuler[(levelNumber - 1)]);
startGameMsgMc.textBox.titleTxt.text = ("Level " + _local1);
startGameMsgMc.textBox.rulerTxt.text = ("Ruler: " + _local2);
startGameMsgMc.x = 140;
startGameMsgMc.y = 150;
}
function freezeMc(_arg1, _arg2, _arg3){
var _local4:Color;
_local4 = new Color();
_local4.setTint(_arg2, _arg3);
_arg1.transform.colorTransform = _local4;
}
function killAllMissiles(){
var _local1:*;
_local1 = (missilesArray.length - 1);
while (_local1 >= 0) {
missilesArray[_local1].remove();
_local1--;
};
}
function setupPanelItems(){
var _local1:Number;
var _local2:Number;
var _local3:*;
var _local4:*;
var _local5:*;
var _local6:*;
var _local7:*;
itemsToBuyMc = new Sprite();
statsMc.addChild(itemsToBuyMc);
itemsToBuyMc.x = 8;
itemsToBuyMc.y = 13;
itemsArray = new Array();
_local1 = 0;
_local2 = 0;
_local3 = 0;
while (_local3 < 9) {
_local7 = new GamePanelBuyMc(this);
itemsToBuyMc.addChild(_local7);
if (panelItemsData[((_local3 * 3) + 1)] > money){
_local7.gotoAndStop("notBuy");
};
itemsCost[_local3] = panelItemsData[((_local3 * 3) + 1)];
_local7.itemsMc.gotoAndStop((_local3 + 1));
if (_local3 == 6){
_local1 = 9;
};
_local7.x = (_local3 * 40);
_local7.x = (_local7.x + _local1);
_local7.x = (_local7.x + _local2);
itemsArray.push(_local7);
_local3++;
};
_local4 = 405;
_local5 = 31;
_local6 = 41;
upgradeMc1 = new GameUpgrade(this);
statsMc.addChild(upgradeMc1);
upgradeMc1.x = _local4;
upgradeMc1.y = _local5;
_local4 = (_local4 + _local6);
if (upgrade1 == true){
upgradeMc1.gotoAndStop(3);
upgradeMc1.back.gotoAndStop(3);
};
upgradeMc2 = new GameUpgrade2(this);
statsMc.addChild(upgradeMc2);
upgradeMc2.x = _local4;
upgradeMc2.y = _local5;
_local4 = (_local4 + _local6);
if (upgrade2 == true){
upgradeMc2.gotoAndStop(3);
upgradeMc2.back.gotoAndStop(3);
};
upgradeMc3 = new GameUpgrade3(this);
statsMc.addChild(upgradeMc3);
upgradeMc3.x = _local4;
upgradeMc3.y = _local5;
_local4 = (_local4 + _local6);
if (upgrade3 == true){
upgradeMc3.gotoAndStop(3);
upgradeMc3.back.gotoAndStop(3);
};
}
function newLevelStuff(){
wave = 0;
}
function setupKingGood(){
Box2d.setupGrabbedItem("kingGood", 405, 0.5, 0, "position", 150, 350, 1);
}
public function restartLevel(){
if (gameOverMsgMc != null){
inGameMsgsMc.removeChild(gameOverMsgMc);
};
gameOverMsgMc = null;
oldUpgrade1 = false;
oldUpgrade2 = false;
oldUpgrade3 = false;
upgrade1 = oldUpgrade1;
upgrade2 = oldUpgrade2;
upgrade3 = oldUpgrade3;
money = oldMoney;
energy = oldEnergy;
score = oldScore;
rt.gameState = 6;
if (levelCompleteMsg != null){
inGameMsgsMc.removeChild(levelCompleteMsg);
levelCompleteMsg = null;
};
inGameBackgroundMc.removeChild(backSkyMc);
backSkyMc.stop();
backSkyMc = null;
spritesMc.x = 0;
newLevelStuff();
destroyEverything();
rt.setupMapScreen();
}
function setupCatapultDial(){
var _local1:Number;
_local1 = 30;
catapultClicked = true;
cDial = new catapultDial();
cDial.x = 20;
cDial.y = 290;
cDial.needle.rotation = 40;
inGamePickupsMc.addChild(cDial);
}
function decreaseMoney(_arg1:Number){
money = (money - _arg1);
if (money < 0){
money = 0;
};
setMoney();
}
public function on_mouse_up(){
var _local1:Boolean;
var _local2:*;
var _local3:b2Vec2;
scrollScreen = "";
if (Box2d.mouseJoint){
if (Box2d.bodyGrabbed.m_userData.x < flagMc.x){
_local1 = false;
if (Box2d.bodyGrabbed.m_userData.myType == "archer"){
if (Box2d.bodyGrabbed.m_userData.x < 130){
_local1 = true;
};
if (Box2d.bodyGrabbed.m_userData.y > 460){
_local1 = true;
};
};
if (Box2d.bodyGrabbed.m_userData.myType == "wizard"){
if (Box2d.bodyGrabbed.m_userData.x < 130){
_local1 = true;
};
if (Box2d.bodyGrabbed.m_userData.y > 460){
_local1 = true;
};
} else {
if (Box2d.bodyGrabbed.m_userData.myType == "block"){
if (Box2d.bodyGrabbed.m_userData.x < 130){
_local1 = true;
};
if (Box2d.bodyGrabbed.m_userData.y > 460){
_local1 = true;
};
} else {
if (Box2d.bodyGrabbed.m_userData.myType == "wood"){
if (Box2d.bodyGrabbed.m_userData.x < 130){
_local1 = true;
};
if (Box2d.bodyGrabbed.m_userData.y > 460){
_local1 = true;
};
} else {
if (Box2d.bodyGrabbed.m_userData.myType == "woodBlock"){
if (Box2d.bodyGrabbed.m_userData.x < 130){
_local1 = true;
};
if (Box2d.bodyGrabbed.m_userData.y > 460){
_local1 = true;
};
};
};
};
};
if (_local1 == false){
Box2d.m_world.DestroyJoint(Box2d.mouseJoint);
Box2d.mouseJoint = null;
Box2d.bodyGrabbed.SetMassFromShapes();
_local2 = Box2d.bodyGrabbed.m_shapeList;
_local2.SetFilterData(Box2d.bodyGrabbed.m_userData.filterData);
if (Box2d.bodyGrabbed.m_userData.myType == "knight"){
setupGoodGuy(Box2d.bodyGrabbed.m_userData);
} else {
if (Box2d.bodyGrabbed.m_userData.myType == "knight2"){
setupGoodGuy(Box2d.bodyGrabbed.m_userData);
} else {
if (Box2d.bodyGrabbed.m_userData.myType == "archer"){
setupGoodGuy(Box2d.bodyGrabbed.m_userData);
} else {
if (Box2d.bodyGrabbed.m_userData.myType == "wizard"){
setupGoodGuy(Box2d.bodyGrabbed.m_userData);
} else {
if (Box2d.bodyGrabbed.m_userData.myType == "knight3"){
setupGoodGuy(Box2d.bodyGrabbed.m_userData);
} else {
if (Box2d.bodyGrabbed.m_userData.myType == "knight4"){
setupGoodGuy(Box2d.bodyGrabbed.m_userData);
} else {
if (Box2d.bodyGrabbed.m_userData.myType == "kingGood"){
setupPlayer(Box2d.bodyGrabbed.m_userData);
};
};
};
};
};
};
};
_local3 = Box2d.bodyGrabbed.m_userData.myBodyDef.GetLinearVelocity();
_local3.x = 0;
Box2d.bodyGrabbed.m_userData.myBodyDef.SetLinearVelocity(_local3);
Box2d.bodyGrabbed = null;
Box2d.m_world.Refilter(_local2);
};
};
};
}
public function fireCannon(){
var _local1:*;
var _local2:Number;
var _local3:Object;
var _local4:*;
var _local5:b2Vec2;
var _local6:*;
var _local7:Number;
var _local8:b2Vec2;
_local1 = money;
_local2 = 2;
if (upgrade1 == false){
_local1 = (_local1 - _local2);
} else {
_local2 = 4;
_local1 = (_local1 - _local2);
};
if (_local1 >= 0){
decreaseMoney(_local2);
checkForAfford();
catapultItem = null;
boulderBought = true;
_local3 = Useful.localToGlobalXY(cDial.needle.endMc);
_local3.newX = (_local3.newX - spritesMc.x);
_local4 = new GameRisingMoney(this, inGameScoreMc, (("- " + _local2) + " Gold"));
inGameScoreMc.addChild(_local4);
_local4.x = _local3.newX;
_local4.y = (_local3.newY - 10);
if (upgrade1 == false){
Box2d.setupGrabbedItem("boulder", 805, 0.5, 0, "position", _local3.newX, _local3.newY, 1);
Sounds.playSoundFx("explosionFx", 1, 0, 1);
} else {
Box2d.setupGrabbedItem("cannonBall", 805, 0.5, 0, "position", _local3.newX, _local3.newY, 1);
Sounds.playSoundFx("mainGunMissileHitFx", 1, 0, 1);
};
if (catapultItem != null){
_local5 = new b2Vec2();
_local5 = catapultItem.myBodyDef.GetPosition();
_local6 = Useful.getVectorFromAngle((cDial.needle.rotation - 90));
_local7 = (90 - cDial.needle.rotation);
_local7 = (_local7 / 100);
_local7 = (_local7 + 0.7);
_local7 = (_local7 * 5000);
_local8 = new b2Vec2();
_local8.x = (_local6.vx * _local7);
_local8.y = (_local6.vy * _local7);
catapultItem.myBodyDef.ApplyImpulse(_local8, _local5);
};
};
}
function killAllBuildingBits(){
var _local1:Number;
var _local2:int;
var _local3:*;
_local1 = inGameBuildingsMc.numChildren;
_local2 = 0;
while (_local2 < _local1) {
_local3 = inGameBuildingsMc.getChildAt(0);
if (_local3.myObject == null){
if (_local3.myParent != null){
_local3.destroyMe();
};
};
_local2++;
};
}
public function quitGame(){
Sounds.playSoundFx("bellFx", 1, 0, 1);
destroyEverything();
rt.gameState = 1;
levelNumber = 1;
inGameFlagMc.removeChild(flagMc);
if (gameOverMsgMc != null){
inGameMsgsMc.removeChild(gameOverMsgMc);
};
gameOverMsgMc = null;
upgrade1 = false;
upgrade2 = false;
upgrade3 = false;
inGameBackgroundMc.removeChild(backSkyMc);
backSkyMc.stop();
backSkyMc = null;
inGameBackgroundMc2.removeChild(backMc2);
backMc2.stop();
backMc2 = null;
Player = null;
energy = 100;
(energyAlien == 100);
money = 0;
score = 0;
currentMoneyDelay = 40;
moneyDelay = currentMoneyDelay;
moneyMax = 100;
spritesMc.x = 0;
whosChattingIndex = 0;
letterIndex = 0;
rt.setupTitleScreen();
}
function decreaseBadKingEnergy(_arg1:Number, _arg2):Boolean{
var _local3:Number;
var _local4:Boolean;
var _local5:int;
_local3 = 10;
_local3 = (_local3 + (levelNumber * 2));
statsMc.timer2.maskMc.x = (statsMc.timer2.maskMc.x - (_arg1 / _local3));
if (statsMc.timer2.maskMc.x < -(statsMc.timer2.maskMc.width)){
_local4 = false;
whosChattingIndex = 0;
_local5 = 0;
while (_local5 < levelsToRun.length) {
if (levelNumber == levelsToRun[_local5]){
_local4 = true;
break;
};
_local5++;
};
if (_local4 == false){
_arg2.gotoAndStop("die");
gameOver("level_complete");
} else {
_arg2.gotoAndStop("run");
rt.gameState = STATE_SYSTEM_END_MSG;
Sounds.stopAllMySounds();
badKingMc.myBodyDef.WakeUp();
};
return (true);
};
return (false);
}
function setFlag(){
var _local1:Number;
_local1 = levelNumber;
flagMc.flag1.flag2.flag3a.flag4a.gotoAndStop(_local1);
flagMc.flag1.flag2.flag3a.flag4b.gotoAndStop(_local1);
flagMc.flag1.flag2.flag3a.flag4c.gotoAndStop(_local1);
flagMc.flag1.flag2.flag3a.flag4d.gotoAndStop(_local1);
flagMc.flag1.flag2.flag3b.flag4a.gotoAndStop(_local1);
flagMc.flag1.flag2.flag3b.flag4b.gotoAndStop(_local1);
flagMc.flag1.flag2.flag3b.flag4c.gotoAndStop(_local1);
flagMc.flag1.flag2.flag3b.flag4d.gotoAndStop(_local1);
}
function doFrozen(){
var _local1:*;
freezeDelay--;
if (freezeDelay == 0){
freezeDelay = 2;
_local1 = 0;
while (_local1 < frozenArray.length) {
freezeMc(frozenArray[_local1].mC, frozenArray[_local1].colourValue, frozenArray[_local1].colourMult);
if (frozenArray[_local1].defrost == false){
frozenArray[_local1].colourMult = (frozenArray[_local1].colourMult + 0.1);
if (frozenArray[_local1].colourMult >= 0.8){
frozenArray[_local1].colourMult = 0.93;
if (frozenArray[_local1].toDefrost == 0){
frozenArray[_local1].toDefrost = 50;
} else {
frozenArray[_local1].toDefrost--;
if (frozenArray[_local1].toDefrost == 0){
frozenArray[_local1].defrost = true;
};
};
};
} else {
frozenArray[_local1].colourMult = (frozenArray[_local1].colourMult - 0.1);
if (frozenArray[_local1].colourMult < 0){
frozenArray[_local1].colourMult = 0;
if (frozenArray[_local1].mC.myObject != null){
frozenArray[_local1].mC.myObject.frozen = false;
};
frozenArray.splice(_local1, 1);
};
};
_local1++;
};
};
}
function setupWave(_arg1){
var _local2:Array;
var _local3:Array;
var _local4:*;
var _local5:Array;
var _local6:String;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:*;
var _local14:Number;
var _local15:Number;
var _local16:MovieClip;
_local2 = badGuysLevels[(levelNumber - 1)];
_local3 = _local2[_arg1];
_local4 = 0;
while (_local4 < _local3.length) {
_local5 = _local3[_local4];
_local6 = _local5[0];
_local7 = _local5[1];
_local8 = _local5[2];
_local9 = _local5[3];
_local10 = _local5[5];
_local11 = _local5[6];
_local12 = _local5[8];
_local13 = (levelNumber / 100);
if (_local13 > 1){
_local13 = 1;
};
_local13 = (_local13 + (_arg1 / (30 - levelNumber)));
if (_local13 > 2){
_local13 = 2;
};
_local12 = (_local12 + _local13);
_local14 = _local5[9];
_local15 = _local5[10];
if (_local6 != "bird"){
if (_local6 != "dragon"){
_local16 = Box2d.setupGrabbedItem(_local6, _local7, _local8, _local9, "position", _local10, _local11, 1);
badGuysArray.push(new GameBadGuy(_local6, this, _local16.x, _local16.y, _local16, Useful, _local12, _local14, _local15));
} else {
_local16 = new GameDragon();
inGameEnemyMc.addChild(_local16);
badGuysArray.push(new GameBadGuy(_local6, this, _local10, _local11, _local16, Useful, _local12, _local14, _local15));
_local16.myObject = badGuysArray[(badGuysArray.length - 1)];
};
} else {
_local16 = new GameBird();
inGameEnemyMc.addChild(_local16);
badGuysArray.push(new GameBadGuy(_local6, this, _local10, _local11, _local16, Useful, _local12, _local14, _local15));
_local16.myObject = badGuysArray[(badGuysArray.length - 1)];
};
_local4++;
};
}
function newArrays(){
missilesArray = new Array();
enemyArray = new Array();
goodGuysArray = new Array();
missilesArray = new Array();
badGuysArray = new Array();
tilesArray = new Array();
explosionsArray = new Array();
particlesArray = new Array();
pickupsArray = new Array();
zombiePartsArray = new Array();
frozenArray = new Array();
bouldersArray = new Array();
destroyedArray = new Array();
groundArray = new Array();
itemsArray = new Array();
selectionArray = new Array();
}
function setupUpgrade3(){
upgrade3 = true;
upgradeMc3.gotoAndStop(3);
Sounds.playSoundFx("magicFx", 1, 0, 1);
}
function soundFxBtn2(){
if (soundsSwitch == false){
statsMc.soundFxMc.gotoAndStop("off");
} else {
statsMc.soundFxMc.gotoAndStop("on");
};
}
function setScore(){
if (score > 999999){
score = 999999;
};
if (score < 10){
statsMc.score.text = ("00000" + String(score));
} else {
if (score < 100){
statsMc.score.text = ("0000" + String(score));
} else {
if (score < 1000){
statsMc.score.text = ("000" + String(score));
} else {
if (score < 10000){
statsMc.score.text = ("00" + String(score));
} else {
if (score < 100000){
statsMc.score.text = ("0" + String(score));
} else {
statsMc.score.text = String(score);
};
};
};
};
};
}
function setupUpgrade2(){
var _local1:int;
upgradeMc2.gotoAndStop(3);
Sounds.playSoundFx("magicFx", 1, 0, 1);
_local1 = 0;
while (_local1 < goodGuysArray.length) {
goodGuysArray[_local1].filterDelay = 300;
goodGuysArray[_local1].mC.filters = [glowFilter];
_local1++;
};
}
public function cannonDown(){
cDial.needle.rotation--;
}
function killAllBadGuys(){
var _local1:Number;
var _local2:int;
var _local3:*;
_local1 = inGameEnemyMc.numChildren;
_local2 = 0;
while (_local2 < _local1) {
_local3 = inGameEnemyMc.getChildAt(0);
if (_local3.myType != "kingBad1"){
if (_local3.myObject == null){
if (_local3.myParent != null){
_local3.destroyMe();
};
};
};
_local2++;
};
}
function setupUpgrade1(){
upgradeMc1.gotoAndStop(3);
upgrade1 = true;
Sounds.playSoundFx("magicFx", 1, 0, 1);
}
public function gameComplete(){
Sounds.stopAllMySounds();
if (levelCompleteMsg != null){
inGameMsgsMc.removeChild(levelCompleteMsg);
levelCompleteMsg = null;
};
rt.gameState = 5;
gameOverMsgMc = new GameOverMsgAnim(this);
inGameMsgsMc.addChild(gameOverMsgMc);
gameOverMsgMc.m.gotoAndPlay("gameOver");
gameOverMsgMc.play();
gameOverMsgMc.x = (movieWidth / 2);
gameOverMsgMc.y = (movieHeight / 2);
}
function resetKingGood(){
var _local1:Number;
var _local2:b2Vec2;
_local1 = goodKingMc.myBodyDef.GetAngle();
_local2 = new b2Vec2();
_local2.x = (Useful.bxConvertToMetres(270, Box2d.BxScalingFactor) / 2);
_local2.y = (Useful.bxConvertToMetres(240, Box2d.BxScalingFactor) / 2);
goodKingMc.myBodyDef.SetXForm(_local2, _local1);
_local2 = badKingMc.myBodyDef.GetLinearVelocity();
_local2.x = 0;
_local2.y = 0;
badKingMc.myBodyDef.WakeUp();
badKingMc.myBodyDef.SetLinearVelocity(_local2);
}
function endGame(){
decreaseBadKingEnergy(100, badKingMc);
}
function increaseEnergy(_arg1:Number){
energy = (energy + _arg1);
if (energy > 10000){
energy = 10000;
};
setEnergy();
}
function scrollBackLeft(){
scrollxPos = (scrollxPos + scrollvx);
if (scrollxPos < -((backMcWidth - movieWidth))){
scrollxPos = -((backMcWidth - movieWidth));
scrollvx = 0;
spritesMc.x = -((backMcWidth - movieWidth));
} else {
spritesMc.x = (spritesMc.x + scrollvx);
inGameBackgroundMc2.x = (inGameBackgroundMc2.x + (scrollvx / 2));
inGameBackgroundMc.x = (inGameBackgroundMc.x + (scrollvx / 4));
};
}
function checkForPanelClick(){
var _local1:*;
var _local2:Number;
if (statsMc.quitBtn.hitTestPoint(stage.mouseX, stage.mouseY, true)){
gameOver("game_over");
} else {
if (statsMc.musicBtn.hitTestPoint(stage.mouseX, stage.mouseY, true)){
musicBtn();
} else {
if (statsMc.soundFxBtn.hitTestPoint(stage.mouseX, stage.mouseY, true)){
soundFxBtn();
} else {
if (statsMc.pausePanelBtn.hitTestPoint(stage.mouseX, stage.mouseY, true)){
rt.pauseGame();
};
};
};
};
if (statsMc.currentFrame == 1){
_local1 = 0;
while (_local1 < itemsArray.length) {
if (itemsArray[_local1].hitTestPoint(stage.mouseX, stage.mouseY, true)){
_local2 = (money - itemsCost[_local1]);
if (_local2 >= 0){
if (goodGuysArray.length < 60){
filterDelay = 1;
if (_local1 == 6){
decreaseMoney(itemsCost[_local1]);
Box2d.setupGrabbedItem("woodBlock", 10405, 0.5, 0, "grab", 0, 0, 1);
} else {
if (_local1 == 7){
decreaseMoney(itemsCost[_local1]);
Box2d.setupGrabbedItem("wood", 1405, 0.5, 0, "grab", 0, 0, 1);
} else {
if (_local1 == 8){
decreaseMoney(itemsCost[_local1]);
Box2d.setupGrabbedItem("block", 10405, 0.5, 0, "grab", 0, 0, 1);
} else {
if (_local1 == 0){
Sounds.playSoundFx("newSoldierFx", 0.5, 0, 1);
decreaseMoney(itemsCost[_local1]);
Box2d.setupGrabbedItem("knight", 405, 0.5, 0, "position", 120, 370, 1);
} else {
if (_local1 == 1){
Sounds.playSoundFx("newSoldierFx", 0.5, 0, 1);
decreaseMoney(itemsCost[_local1]);
Box2d.setupGrabbedItem("knight2", 405, 0.5, 0, "position", 120, 370, 1);
} else {
if (_local1 == 4){
Sounds.playSoundFx("newSoldierFx", 0.5, 0, 1);
decreaseMoney(itemsCost[_local1]);
Box2d.setupGrabbedItem("wizard", 405, 0.5, 0, "grab", 0, 0, 1);
} else {
if (_local1 == 5){
Sounds.playSoundFx("newSoldierFx", 0.5, 0, 1);
decreaseMoney(itemsCost[_local1]);
Box2d.setupGrabbedItem("knight4", 405, 0.5, 0, "position", 120, 370, 1);
} else {
if (_local1 == 2){
Sounds.playSoundFx("newSoldierFx", 0.5, 0, 1);
decreaseMoney(itemsCost[_local1]);
Box2d.setupGrabbedItem("archer", 405, 0.5, 0, "grab", 0, 0, 1);
} else {
if (_local1 == 3){
Sounds.playSoundFx("newSoldierFx", 0.5, 0, 1);
decreaseMoney(itemsCost[_local1]);
Box2d.setupGrabbedItem("knight3", 405, 0.5, 0, "position", 120, 370, 1);
} else {
if (_local1 == 7){
if (catapultCatchMc.hitTestObject(catapultMc.setMc1)){
boulderBought = true;
decreaseMoney(itemsCost[_local1]);
Box2d.setupGrabbedItem("potion3", 805, 0.5, 0, "position", 48, 200, 1);
};
} else {
if (_local1 == 8){
if (catapultCatchMc.hitTestObject(catapultMc.setMc1)){
boulderBought = true;
decreaseMoney(itemsCost[_local1]);
Box2d.setupGrabbedItem("potion1", 805, 0.5, 0, "position", 48, 200, 1);
};
} else {
if (_local1 == 9){
if (catapultCatchMc.hitTestObject(catapultMc.setMc1)){
boulderBought = true;
decreaseMoney(itemsCost[_local1]);
Box2d.setupGrabbedItem("potion2", 805, 0.5, 0, "position", 48, 200, 1);
};
};
};
};
};
};
};
};
};
};
};
};
};
checkForAfford();
};
};
};
_local1++;
};
if (upgradeMc1.back.hitTestPoint(stage.mouseX, stage.mouseY, true)){
if (upgrade1 == false){
if (upgradeMc1.back.currentFrame == 1){
_local2 = (money - upgradeCost1);
if (_local2 >= 0){
decreaseMoney(upgradeCost1);
setupUpgrade1();
};
};
};
} else {
if (upgradeMc2.back.hitTestPoint(stage.mouseX, stage.mouseY, true)){
if (upgrade2 == false){
if (upgradeMc2.back.currentFrame == 1){
_local2 = (money - upgradeCost2);
if (_local2 >= 0){
decreaseMoney(upgradeCost2);
setupUpgrade2();
};
};
};
} else {
if (upgradeMc3.back.hitTestPoint(stage.mouseX, stage.mouseY, true)){
if (upgrade3 == false){
if (upgradeMc3.back.currentFrame == 1){
_local2 = (money - upgradeCost3);
if (_local2 >= 0){
decreaseMoney(upgradeCost3);
setupUpgrade3();
};
};
};
};
};
};
};
}
public function runEndMsgs(){
var _local1:Array;
var _local2:String;
var _local3:Number;
letterDelay--;
if (letterDelay == 0){
letterDelay = 2;
_local1 = levelChatEnd[(levelNumber - 1)];
_local2 = _local1[whosChattingIndex];
_local3 = int((whosChattingIndex / 2));
_local3 = (_local3 * 2);
currentPhrase = _local2.slice(0, letterIndex);
if (whosChattingIndex == _local3){
statsMc.leftSpeech.gotoAndStop(2);
statsMc.kingGoodHead.expressions.gotoAndStop("talking");
statsMc.rightSpeech.gotoAndStop(1);
statsMc.kingBadHead.expressions.gotoAndStop("static");
statsMc.rightSpeech.txt.text = "";
statsMc.leftSpeech.txt.text = currentPhrase;
} else {
statsMc.leftSpeech.gotoAndStop(1);
statsMc.kingGoodHead.expressions.gotoAndStop("static");
statsMc.kingBadHead.expressions.gotoAndStop("talking");
statsMc.rightSpeech.gotoAndStop(2);
statsMc.leftSpeech.txt.text = "";
statsMc.rightSpeech.txt.text = currentPhrase;
};
letterIndex++;
if (letterIndex == _local2.length){
letterIndex = 0;
letterDelay = 10;
whosChattingIndex++;
if (whosChattingIndex == _local1.length){
statsMc.leftSpeech.gotoAndStop(1);
statsMc.rightSpeech.gotoAndStop(1);
statsMc.rightSpeech.txt.text = "";
whosChattingIndex = 0;
letterIndex = 0;
statsMc.kingBadHead.expressions.gotoAndStop("static");
gameOver("level_complete");
};
};
};
Sounds.mainLoop();
Box2d.runBox2d();
if (badKingMc != null){
badKingMc.mainLoop();
};
}
function setupBackground(){
if (levelNumber == levelStart){
flagMc = new halfWayFlag();
inGameFlagMc.addChild(flagMc);
flagMc.x = 560;
flagMc.y = 300;
};
setFlag();
backSkyMc = new backgroundSkyMc();
backSkyMc.cacheAsBitmap = true;
backSkyMc.filters = [bf2];
inGameBackgroundMc.addChild(backSkyMc);
if (levelNumber == levelStart){
backMc2 = new backgroundP();
backMc2.cacheAsBitmap = true;
inGameBackgroundMc2.addChild(backMc2);
inGameBackgroundMc2.filters = [bf];
};
backSkyMc.gotoAndStop(levelNumber);
backMc2.gotoAndStop(levelNumber);
spritesMc.x = 0;
backSkyMc.x = 0;
inGameBackgroundMc.x = 0;
inGameBackgroundMc2.x = 0;
inGameBackgroundMc2.y = 200;
scrollxPos = spritesMc.x;
}
function toBeDestroyed(){
var _local1:*;
_local1 = (destroyedArray.length - 1);
while (_local1 >= 0) {
if (destroyedArray[_local1].energy <= 0){
Box2d.m_world.DestroyBody(destroyedArray[_local1].myBodyDef);
destroyedArray.splice(_local1, 1);
} else {
destroyedArray.splice(_local1, 1);
};
_local1--;
};
}
function pauseOff(){
pauseSwitch = false;
rt.gameState = "play";
}
public function gameOverLoop(){
}
function setupPlayer(_arg1){
Player = new GamePlayer(_arg1, this, Useful);
}
function setupKingBad(){
Box2d.setupEnemyKings("kingBad1", 10405, 0.5, 0, "position", 1150, 240);
}
public function setupSelectionBox(_arg1){
var _local2:*;
if (selectionBoxMc == null){
_local2 = new selectionBox();
_local2.myParent = _arg1;
_arg1.addChild(_local2);
selectionBoxMc = _local2;
} else {
selectionBoxMc.myParent.removeChild(selectionBoxMc);
selectionBoxMc.myParent = _arg1;
_arg1.addChild(selectionBoxMc);
};
}
function setupEnemyCastle(){
var _local1:*;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:*;
var _local7:*;
var _local8:Number;
var _local9:Number;
_local1 = enemyCastles[(levelNumber - 1)];
_local2 = 375;
_local3 = 32;
_local4 = 0;
_local5 = 600;
_local6 = (_local1.length - 1);
while (_local6 >= 0) {
_local7 = 0;
while (_local7 < (_local1[_local6].length / 2)) {
_local8 = _local1[_local6][(_local7 * 2)];
_local9 = _local1[_local6][((_local7 * 2) + 1)];
if (_local8 == 1){
Box2d.setupGrabbedItem("woodBlockEnemy", 10405, 0.5, 0, "position", ((_local7 * 28) + _local5), (_local2 - (_local4 * _local3)), _local9);
} else {
if (_local8 == 2){
Box2d.setupGrabbedItem("woodBad", 10405, 0.5, 0, "position", ((_local7 * 28) + _local5), (_local2 - (_local4 * _local3)), _local9);
} else {
if (_local8 == 3){
Box2d.setupGrabbedItem("blockEnemy", 10405, 0.5, 0, "position", ((_local7 * 28) + _local5), (_local2 - (_local4 * _local3)), _local9);
} else {
if (_local9 == 1){
setupBadSoldier(badGuyData1, ((_local7 * 28) + _local5), (_local2 - (_local4 * _local3)));
} else {
if (_local9 == 2){
setupBadSoldier(badGuyData2, ((_local7 * 28) + _local5), (_local2 - (_local4 * _local3)));
} else {
if (_local9 == 3){
setupBadSoldier(badGuyData3, ((_local7 * 28) + _local5), (_local2 - (_local4 * _local3)));
} else {
if (_local9 == 4){
setupBadSoldier(badGuyData4, ((_local7 * 28) + _local5), (_local2 - (_local4 * _local3)));
} else {
if (_local9 == 5){
setupBadSoldier(badGuyData5, ((_local7 * 28) + _local5), (_local2 - (_local4 * _local3)));
} else {
if (_local9 == 7){
setupBadSoldier(badGuyData7, ((_local7 * 28) + _local5), (_local2 - (_local4 * _local3)));
};
};
};
};
};
};
};
};
};
_local7++;
};
_local4++;
_local6--;
};
}
public function mainLoop(){
var _local1:int;
var _local2:*;
var _local3:Number;
var _local4:Number;
var _local5:Number;
Box2d.runBox2d();
toBeDestroyed();
doMoneyIncrease();
checkPanel();
Sounds.mainLoop();
_local1 = 0;
while (_local1 < bouldersArray.length) {
bouldersArray[_local1].mainLoop();
_local1++;
};
if (badKingMc != null){
badKingMc.mainLoop();
};
if (goodKingMc != null){
goodKingMc.mainLoop();
};
_local1 = 0;
while (_local1 < badGuysArray.length) {
badGuysArray[_local1].mainLoop();
_local1++;
};
_local1 = 0;
while (_local1 < goodGuysArray.length) {
goodGuysArray[_local1].mainLoop();
_local1++;
};
_local1 = 0;
while (_local1 < missilesArray.length) {
missilesArray[_local1].mainLoop();
_local1++;
};
if (frozenArray.length > 0){
doFrozen();
};
_local1 = (missilesArray.length - 1);
while (_local1 >= 0) {
if (missilesArray[_local1].dead == true){
missilesArray.splice(_local1, 1);
};
_local1--;
};
_local1 = 0;
while (_local1 < explosionsArray.length) {
explosionsArray[_local1].mainLoop();
_local1++;
};
_local2 = 0;
while (_local2 < particlesArray.length) {
particlesArray[_local2].mainLoop();
_local2++;
};
runWave();
levelTime++;
setScore();
if (cannonMove == "up"){
cannonUp();
} else {
if (cannonMove == "down"){
cannonDown();
};
};
if (zoomScreen == "in"){
inGameGraphicsMc.x = -(350);
inGameGraphicsMc.y = -270;
inGameZoomMc.x = 350;
inGameZoomMc.y = 270;
_local3 = zoomSpeed;
_local4 = (inGameZoomMc.scaleX + _local3);
if (_local4 > scaleLarge){
_local3 = (_local4 - scaleLarge);
_local3 = (zoomSpeed - _local3);
};
inGameZoomMc.scaleX = (inGameZoomMc.scaleY = (inGameZoomMc.scaleY + _local3));
zoomSpeed = 0.1;
zoomScreen = "";
setupZoomBtns();
} else {
if (zoomScreen == "out"){
inGameGraphicsMc.x = -(350);
inGameGraphicsMc.y = -270;
inGameZoomMc.x = 350;
inGameZoomMc.y = 270;
_local3 = zoomSpeed;
_local4 = (inGameZoomMc.scaleX - _local3);
if (_local4 < scaleSmall){
_local3 = (scaleSmall - _local4);
_local3 = (zoomSpeed - _local3);
};
inGameZoomMc.scaleX = (inGameZoomMc.scaleY = (inGameZoomMc.scaleY - _local3));
zoomSpeed = 0.1;
zoomScreen = "";
setupZoomBtns();
} else {
if (zoomScreen == "allIn"){
inGameGraphicsMc.x = -(350);
inGameGraphicsMc.y = -270;
inGameZoomMc.x = 350;
inGameZoomMc.y = 270;
inGameZoomMc.scaleX = (inGameZoomMc.scaleY = scaleLarge);
zoomScreen = "";
setupZoomBtns();
} else {
if (zoomScreen == "allOut"){
inGameGraphicsMc.x = -(350);
inGameGraphicsMc.y = -270;
inGameZoomMc.x = 350;
inGameZoomMc.y = 270;
inGameZoomMc.scaleX = (inGameZoomMc.scaleY = scaleSmall);
zoomScreen = "";
setupZoomBtns();
} else {
zoomSpeed = 0.1;
};
};
};
};
if (scrollScreen == "left"){
scrollvx = (scrollvx - 8);
_local5 = -(maxScrollSpeed);
if (scrollvx < _local5){
scrollvx = _local5;
};
scrollBackLeft();
} else {
if (scrollScreen == "right"){
scrollvx = (scrollvx + 8);
if (scrollvx > maxScrollSpeed){
scrollvx = maxScrollSpeed;
};
scrollBackRight();
} else {
if (rt.keyPressDown == false){
if (scrollvx > 0){
scrollvx = (scrollvx - 2);
if (scrollvx < 1){
scrollvx = 0;
} else {
scrollBackRight();
};
} else {
if (scrollvx < 0){
scrollvx = (scrollvx + 2);
if (scrollvx > -1){
scrollvx = 0;
} else {
scrollBackLeft();
};
};
};
};
};
};
}
public function gameOver(_arg1){
Sounds.stopAllMySounds();
selectionBoxOff();
if (_arg1 == "game_over"){
rt.gameState = 5;
Sounds.playSoundFx("gameOverFx", 1, 0, 1);
increaseScore(money);
gameOverMsgMc = new GameOverMsgAnim(this);
inGameMsgsMc.addChild(gameOverMsgMc);
gameOverMsgMc.play();
gameOverMsgMc.x = (movieWidth / 2);
gameOverMsgMc.y = (movieHeight / 2);
} else {
Sounds.playSoundFx("levelCompleteFx", 1, 0, 1);
increaseScore(money);
rt.gameState = 5;
levelCompleteMsg = new GameLevelComplete(this);
inGameMsgsMc.addChild(levelCompleteMsg);
levelCompleteMsg.x = (movieWidth / 2);
levelCompleteMsg.y = ((movieHeight / 2) - 60);
};
}
}
}//package classesAS3
Section 97
//GameGoodGuy (classesAS3.GameGoodGuy)
package classesAS3 {
import flash.display.*;
import Box2D.Common.Math.*;
import flash.media.*;
import Box2D.Collision.Shapes.*;
import flash.filters.*;
public class GameGoodGuy {
var xVel:Number;// = 0
var myDamageDelay:Number;
var hitVel;
var yPos:Number;// = 0
var inToGround:Number;
var myOldAnimationState:Number;
var numberOfMissiles;// = 0
public var soldierState:int;
var myDamage:Number;
var range:Number;
var energyMc:MovieClip;
var rt:Object;
var myScore:Number;
var speed:Number;// = 0
var gravity:Number;
var delayToMove:Number;
var myName:String;
var projectileMc:Object;
var speedOld:Number;
var energyBarMc:GameEnergyBar;
var dead:Boolean;
var glowFilter:GlowFilter;
var yVel:Number;// = 0
var distanceArray:Array;
var knightPower:Boolean;
var myParent:Object;
var mC:Object;
var animMc:Object;
var energy:Number;// = 0
var myFireDelay:Number;
var energyBarOn:Number;
var Useful:GameUseful;
var energyStart:Number;// = 0
var xPos:Number;// = 0
var headHitBlock:Object;
var xOrigin:Number;// = 0
var missileName:String;
var delayToFireMissile:Number;// = 1
var targetX:Number;
var targetY:Number;
public var myCurrentSound:SoundChannel;
var filterDelay:Number;
var myRange:Number;
var xDir:Number;
var collisionCheck:Number;
var yOrigin:Number;// = 0
public static const SOLDIER_STATE_DEFEND:int = 1;
public static const SOLDIER_STATE_FALLING:int = 4;
public static const SOLDIER_E_MOVE:int = 5;
public static const SOLDIER_STATE_RETREAT:int = 3;
public static const SOLDIER_E_STAND:int = 0;
public static const SOLDIER_STATE_ATTACK:int = 0;
public static const SOLDIER_E_BUILD:int = 2;
public static const SOLDIER_STATE_MOVE:int = 5;
public static const SOLDIER_STATE_FIGHTING:int = 2;
public function GameGoodGuy(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8){
var _local9:Number;
xOrigin = 0;
yOrigin = 0;
xPos = 0;
yPos = 0;
xVel = 0;
yVel = 0;
speed = 0;
energyStart = 0;
energy = 0;
delayToFireMissile = 1;
numberOfMissiles = 0;
super();
mC = _arg4;
animMc = _arg4.soldier;
mC.myObject = this;
rt = _arg1;
myDamage = _arg8;
if (mC.myType == "archer"){
myFireDelay = 30;
} else {
myFireDelay = 100;
};
Useful = _arg5;
_local9 = Useful.RandomNumber(1, 10);
_local9 = (_local9 - 10);
myRange = _arg6;
dead = false;
inToGround = 0;
xOrigin = _arg2;
yOrigin = _arg3;
xPos = 0;
yPos = 0;
xVel = 0;
yVel = 0;
myParent = mC.myParent;
hitVel = 0;
energyBarOn = 0;
gravity = 0.1;
_local9 = Useful.RandomNumber(1, 10);
_local9 = (_local9 / 50);
speed = (_arg7 + _local9);
speedOld = (_arg7 + _local9);
xDir = 1;
mC.scaleX = -1;
distanceArray = new Array();
glowFilter = new GlowFilter(0xFFFFFF, 1, 3, 3, 3, 1);
numberOfMissiles = 0;
energyStart = 100;
energy = energyStart;
myDamageDelay = 8;
soldierState = SOLDIER_STATE_ATTACK;
filterDelay = 1;
knightPower = false;
if (mC.myType == "knight2"){
knightPower = true;
mC.myType = "knight";
} else {
if (mC.myType == "knight3"){
knightPower = true;
mC.myType = "knight";
} else {
if (mC.myType == "knight4"){
knightPower = true;
mC.myType = "knight";
};
};
};
myName = mC.myType;
collisionCheck = 0;
delayToMove = 5;
targetX = mC.x;
}
function applyGravity(){
yVel = (yVel + gravity);
}
function updatePosition(){
var _local1:b2Vec2;
if (mC.myBodyDef.IsSleeping()){
mC.myBodyDef.WakeUp();
};
xVel = (xDir * speed);
_local1 = mC.myBodyDef.GetLinearVelocity();
_local1.x = xVel;
mC.myBodyDef.SetLinearVelocity(_local1);
}
function findEnemy(){
var _local1:Object;
var _local2:int;
var _local3:Object;
var _local4:MovieClip;
var _local5:Number;
var _local6:Number;
var _local7:Number;
distanceArray = new Array();
_local1 = new Object();
_local2 = 0;
while (_local2 < rt.inGameEnemyMc.numChildren) {
_local3 = new Object();
_local4 = rt.inGameEnemyMc.getChildAt(_local2);
if (rt.inGameEnemyMc.getChildAt(_local2).myType != "kingBad1"){
if (rt.inGameEnemyMc.getChildAt(_local2).myType != "smoke"){
if (rt.inGameEnemyMc.getChildAt(_local2).buildingBit == false){
_local3.distSprite = rt.inGameEnemyMc.getChildAt(_local2);
if (mC.myType != "archer"){
if (mC.myType != "wizard"){
_local5 = (mC.y - _local3.distSprite.y);
if (_local5 < 0){
_local5 = ((_local5 - _local5) - _local5);
};
if (_local5 < 20){
_local3.dist = Useful.getDistance(mC.x, mC.y, _local3.distSprite.x, _local3.distSprite.y);
distanceArray.push(_local3);
};
} else {
_local3.dist = Useful.getDistance(mC.x, mC.y, _local3.distSprite.x, _local3.distSprite.y);
distanceArray.push(_local3);
};
} else {
_local3.dist = Useful.getDistance(mC.x, mC.y, _local3.distSprite.x, _local3.distSprite.y);
distanceArray.push(_local3);
};
};
};
} else {
_local1.distSprite = rt.inGameEnemyMc.getChildAt(_local2);
_local1.dist = Useful.getDistance(mC.x, mC.y, _local1.distSprite.x, _local1.distSprite.y);
};
_local2++;
};
distanceArray.sortOn("dist", Array.NUMERIC);
if (_local1.dist < 70){
distanceArray.splice(0, 0, _local1);
} else {
if (distanceArray.length > 0){
_local6 = (375 - mC.y);
_local6 = int((_local6 / 5));
_local7 = (myRange + _local6);
if (distanceArray[0].dist > _local7){
if (mC.myType != "archer"){
distanceArray.splice(0, 0, _local1);
};
} else {
distanceArray.push(_local1);
};
} else {
if (mC.myType != "archer"){
distanceArray.splice(0, 0, _local1);
};
};
};
}
function checkForFire(){
var _local1:*;
var _local2:Object;
var _local3:Object;
delayToFireMissile--;
if (delayToFireMissile == 0){
_local1 = myFireDelay;
delayToFireMissile = _local1;
animMc.gotoAndStop("attack");
_local2 = distanceArray[0].distSprite;
if (_local2.x > mC.x){
xDir = 1;
mC.scaleX = -1;
} else {
xDir = -1;
mC.scaleX = 1;
};
if (mC.myType == "wizard"){
projectileMc = new GameIceBolt();
} else {
projectileMc = new GameArrow();
};
rt.inGameMissilesMc.addChild(projectileMc);
_local3 = Useful.pointTowards(_local2.x, _local2.y, mC.x, mC.y);
rt.missilesArray.push(new GameMissile(projectileMc, rt, mC.x, mC.y, "", Useful, _local3, 16, this, myDamage));
};
}
function remove(){
var _local1:int;
var _local2:Number;
var _local3:*;
if (myCurrentSound != null){
myCurrentSound.stop();
};
_local1 = 0;
while (_local1 < mC.myParent.numChildren) {
if (mC.myParent.getChildAt(_local1) == mC){
mC.myParent.removeChild(mC);
mC.stop();
};
_local1++;
};
_local2 = 0;
_local3 = 0;
while (_local3 < rt.goodGuysArray.length) {
if (this == rt.goodGuysArray[_local3]){
_local2 = _local3;
};
_local3++;
};
rt.goodGuysArray.splice(_local2, 1);
}
function decreaseEnergy(_arg1){
var _local2:Number;
myDamageDelay--;
if (myDamageDelay == 0){
myDamageDelay = 8;
if (energy > 0){
if (filterDelay > 1){
_arg1 = int((_arg1 / 2));
};
if (knightPower == true){
_arg1 = (_arg1 - 3);
if (_arg1 < 1){
_arg1 = 1;
};
};
energy = (energy - _arg1);
if (energyBarOn == 0){
energyBarOn = 1;
energyBarMc = new GameEnergyBar(this);
mC.addChild(energyBarMc);
};
energyBarMc.x = 0;
energyBarMc.y = -35;
_local2 = (energy / 10);
energyBarMc.bar.bar.y = int((10 - _local2));
if (energy <= 0){
inToGround = 0;
dead = true;
if (myCurrentSound != null){
myCurrentSound.stop();
};
myCurrentSound = rt.Sounds.playSoundFx("die_v1_Fx", 1, 0, 1);
animMc.gotoAndStop("die");
rt.Box2d.m_world.DestroyBody(mC.myBodyDef);
return (true);
};
updatePosition();
};
};
return (false);
}
function mainLoop(){
var _local1:Number;
var _local2:b2Vec2;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:b2Shape;
if (dead == false){
if (filterDelay > 1){
filterDelay--;
if (filterDelay == 1){
mC.filters = [];
rt.upgrade2 = false;
};
};
_local1 = 1;
if (knightPower == true){
_local1 = 2;
};
if (mC.myType == "archer"){
if (rt.Box2d.bodyGrabbed != mC.myBodyDef){
if (rt.inGameEnemyMc.numChildren > 0){
findEnemy();
if (distanceArray.length > 0){
_local3 = (375 - mC.y);
_local3 = int((_local3 / 5));
_local4 = (myRange + _local3);
if (distanceArray[0].dist < _local4){
_local5 = 0;
if (distanceArray[0].distSprite.y < mC.y){
_local5 = (mC.y - distanceArray[0].distSprite.y);
} else {
_local5 = (distanceArray[0].distSprite.y - mC.y);
};
if (_local5 < 20){
if (mC.x > distanceArray[0].distSprite.x){
xDir = -1;
mC.scaleX = 1;
} else {
xDir = 1;
mC.scaleX = -1;
};
};
checkForFire();
};
};
};
};
_local2 = mC.myBodyDef.GetLinearVelocity();
_local2.x = 0;
mC.myBodyDef.SetLinearVelocity(_local2);
} else {
if (mC.myType == "wizard"){
if (rt.Box2d.bodyGrabbed != mC.myBodyDef){
if (rt.inGameEnemyMc.numChildren > 0){
findEnemy();
if (distanceArray.length > 0){
_local3 = (375 - mC.y);
_local3 = int((_local3 / 5));
_local4 = (myRange + _local3);
if (distanceArray[0].dist < _local4){
_local5 = 0;
if (distanceArray[0].distSprite.y < mC.y){
_local5 = (mC.y - distanceArray[0].distSprite.y);
} else {
_local5 = (distanceArray[0].distSprite.y - mC.y);
};
if (_local5 < 20){
if (mC.x > distanceArray[0].distSprite.x){
xDir = -1;
mC.scaleX = 1;
} else {
xDir = 1;
mC.scaleX = -1;
};
};
checkForFire();
};
};
};
};
_local2 = mC.myBodyDef.GetLinearVelocity();
_local2.x = 0;
mC.myBodyDef.SetLinearVelocity(_local2);
} else {
if (rt.Box2d.bodyGrabbed != mC.myBodyDef){
if (mC.collisionWithW != null){
if (mC.collisionWithW.myType == "woodBad"){
if (mC.collisionWithW.energy > 0){
if (soldierState != SOLDIER_STATE_FIGHTING){
animMc.gotoAndStop("attack");
soldierState = SOLDIER_STATE_FIGHTING;
};
if (mC.collisionWithW.decreaseEnergy((_local1 + 4))){
soldierState = SOLDIER_STATE_ATTACK;
mC.collisionWithW = null;
};
} else {
soldierState = SOLDIER_STATE_ATTACK;
mC.collisionWithW = null;
};
};
};
if (mC.collisionWith != null){
_local1 = 1;
if (knightPower == true){
_local1 = 2;
};
if (mC.collisionWith.collisionWith == null){
mC.collisionWith.collisionWith = mC;
};
if (mC.collisionWith.myType == "blockEnemy"){
if (mC.collisionWith.energy > 0){
_local6 = (mC.y - mC.collisionWith.y);
if (_local6 > 10){
if (headHitBlock != mC.collisionWith){
mC.collisionWith.decreaseEnergy(100);
collisionCheck = 10;
decreaseEnergy(10);
};
};
if (soldierState != SOLDIER_STATE_FIGHTING){
animMc.gotoAndStop("attack");
soldierState = SOLDIER_STATE_FIGHTING;
};
if (mC.collisionWith.decreaseEnergy((_local1 / 2))){
soldierState = SOLDIER_STATE_ATTACK;
mC.collisionWith = null;
};
} else {
soldierState = SOLDIER_STATE_ATTACK;
mC.collisionWith = null;
};
} else {
if (mC.collisionWith.myType == "block"){
_local6 = (mC.collisionWith.y - mC.y);
if (_local6 > 10){
soldierState = SOLDIER_STATE_ATTACK;
mC.collisionWith = null;
};
if (_local6 < -10){
mC.collisionWith.decreaseEnergy(100);
} else {
soldierState = SOLDIER_STATE_DEFEND;
};
} else {
if (mC.collisionWith.myType == "woodBlockEnemy"){
if (mC.collisionWith.energy > 0){
if (soldierState != SOLDIER_STATE_FIGHTING){
animMc.gotoAndStop("attack");
soldierState = SOLDIER_STATE_FIGHTING;
};
if (mC.collisionWith.decreaseEnergy((_local1 + 4))){
soldierState = SOLDIER_STATE_ATTACK;
mC.collisionWith = null;
};
} else {
soldierState = SOLDIER_STATE_ATTACK;
mC.collisionWith = null;
};
};
};
};
if (soldierState == SOLDIER_STATE_FIGHTING){
if (mC.x > mC.collisionWith.x){
xDir = -1;
mC.scaleX = 1;
} else {
xDir = 1;
mC.scaleX = -1;
};
};
};
if (mC.collisionWithS != null){
if (mC.collisionWithS.currentFrame != 5){
if (mC.collisionWithS.collisionWithS == null){
mC.collisionWithS.collisionWithS = mC;
};
_local1 = 1;
if (knightPower == true){
_local1 = 2;
};
_local7 = Useful.getDistance(mC.x, mC.y, mC.collisionWithS.x, mC.collisionWithS.y);
if (_local7 > 40){
soldierState = SOLDIER_STATE_ATTACK;
} else {
if (mC.collisionWithS.myType == "badKnight1"){
if (soldierState != SOLDIER_STATE_FIGHTING){
myCurrentSound = rt.Sounds.playSoundFx("swordFightFx", 1, 0, 10);
animMc.gotoAndStop("attack");
soldierState = SOLDIER_STATE_FIGHTING;
};
if (mC.collisionWithS.myObject.decreaseEnergy(_local1)){
soldierState = SOLDIER_STATE_ATTACK;
if (myCurrentSound != null){
myCurrentSound.stop();
};
mC.collisionWithS = null;
};
} else {
if (mC.collisionWithS.myType == "badKnight2"){
if (soldierState != SOLDIER_STATE_FIGHTING){
myCurrentSound = rt.Sounds.playSoundFx("swordFightFx", 1, 0, 10);
animMc.gotoAndStop("attack");
soldierState = SOLDIER_STATE_FIGHTING;
};
if (mC.collisionWithS.myObject.decreaseEnergy((_local1 + 0.5))){
if (myCurrentSound != null){
myCurrentSound.stop();
};
soldierState = SOLDIER_STATE_ATTACK;
mC.collisionWithS = null;
};
} else {
if (mC.collisionWithS.myType == "badKnight3"){
if (soldierState != SOLDIER_STATE_FIGHTING){
myCurrentSound = rt.Sounds.playSoundFx("swordFightFx", 1, 0, 10);
animMc.gotoAndStop("attack");
soldierState = SOLDIER_STATE_FIGHTING;
};
if (mC.collisionWithS.myObject.decreaseEnergy((_local1 + 0.5))){
if (myCurrentSound != null){
myCurrentSound.stop();
};
soldierState = SOLDIER_STATE_ATTACK;
mC.collisionWithS = null;
};
} else {
if (mC.collisionWithS.myType == "viking1"){
if (soldierState != SOLDIER_STATE_FIGHTING){
myCurrentSound = rt.Sounds.playSoundFx("swordFightFx", 1, 0, 10);
animMc.gotoAndStop("attack");
soldierState = SOLDIER_STATE_FIGHTING;
};
if (mC.collisionWithS.myObject.decreaseEnergy((_local1 + 0.5))){
if (myCurrentSound != null){
myCurrentSound.stop();
};
soldierState = SOLDIER_STATE_ATTACK;
mC.collisionWithS = null;
};
} else {
if (mC.collisionWithS.myType == "ram"){
if (soldierState != SOLDIER_STATE_FIGHTING){
myCurrentSound = rt.Sounds.playSoundFx("swordFightFx", 1, 0, 10);
animMc.gotoAndStop("attack");
soldierState = SOLDIER_STATE_FIGHTING;
};
if (mC.collisionWithS.myObject.decreaseEnergy((_local1 + 0.5))){
if (myCurrentSound != null){
myCurrentSound.stop();
};
soldierState = SOLDIER_STATE_ATTACK;
mC.collisionWithS = null;
};
} else {
if (mC.collisionWithS.myType == "badArcher1"){
if (soldierState != SOLDIER_STATE_FIGHTING){
myCurrentSound = rt.Sounds.playSoundFx("swordFightFx", 1, 0, 10);
animMc.gotoAndStop("attack");
soldierState = SOLDIER_STATE_FIGHTING;
};
if (mC.collisionWithS.myObject.decreaseEnergy((_local1 + 0.5))){
if (myCurrentSound != null){
myCurrentSound.stop();
};
soldierState = SOLDIER_STATE_ATTACK;
mC.collisionWithS = null;
};
} else {
if (mC.collisionWithS.myType == "badArcher2"){
if (soldierState != SOLDIER_STATE_FIGHTING){
myCurrentSound = rt.Sounds.playSoundFx("swordFightFx", 1, 0, 10);
animMc.gotoAndStop("attack");
soldierState = SOLDIER_STATE_FIGHTING;
};
if (mC.collisionWithS.myObject.decreaseEnergy((_local1 + 0.5))){
if (myCurrentSound != null){
myCurrentSound.stop();
};
soldierState = SOLDIER_STATE_ATTACK;
mC.collisionWithS = null;
};
} else {
if (mC.collisionWithS.myType == "kingBad1"){
if (soldierState != SOLDIER_STATE_FIGHTING){
myCurrentSound = rt.Sounds.playSoundFx("swordFightFx", 1, 0, 10);
animMc.gotoAndStop("attack");
soldierState = SOLDIER_STATE_FIGHTING;
};
if (mC.collisionWithS.soldierState != SOLDIER_STATE_FIGHTING){
mC.collisionWithS.gotoAndStop("attack");
mC.collisionWithS.soldierState = SOLDIER_STATE_FIGHTING;
};
if (rt.decreaseBadKingEnergy((_local1 + 3), mC.collisionWithS)){
if (myCurrentSound != null){
myCurrentSound.stop();
};
soldierState = SOLDIER_STATE_DEFEND;
mC.collisionWithS = null;
};
};
};
};
};
};
};
};
};
};
} else {
if (myCurrentSound != null){
myCurrentSound.stop();
};
mC.collisionWithS = null;
soldierState = SOLDIER_STATE_ATTACK;
};
if (soldierState == SOLDIER_STATE_FIGHTING){
if (mC.x > mC.collisionWithS.x){
xDir = -1;
mC.scaleX = 1;
} else {
xDir = 1;
mC.scaleX = -1;
};
};
};
if (soldierState == SOLDIER_STATE_ATTACK){
if (myCurrentSound != null){
myCurrentSound.stop();
myCurrentSound = null;
};
if (rt.inGameEnemyMc.numChildren > 0){
findEnemy();
if (distanceArray.length > 0){
_local4 = myRange;
if (mC.x > distanceArray[0].distSprite.x){
xDir = -1;
mC.scaleX = 1;
} else {
xDir = 1;
mC.scaleX = -1;
};
if (animMc.currentFrame != 2){
animMc.gotoAndStop("run");
speed = speedOld;
};
};
updatePosition();
};
};
if (soldierState == SOLDIER_STATE_DEFEND){
speed = 0;
if (animMc.currentFrame != 1){
animMc.gotoAndStop(1);
};
if (mC.collisionWith != null){
if (mC.collisionWith.myType == "block"){
if (mC.collisionWith.currentFrame != 2){
_local7 = Useful.getDistance(mC.x, mC.y, mC.collisionWith.x, mC.collisionWith.y);
if (_local7 > 40){
soldierState = SOLDIER_STATE_ATTACK;
mC.collisionWith = null;
_local8 = mC.myBodyDef.GetShapeList();
rt.m_world.Refilter(_local8);
mC.myBodyDef.WakeUp();
};
} else {
soldierState = SOLDIER_STATE_ATTACK;
mC.collisionWith = null;
_local8 = mC.myBodyDef.GetShapeList();
rt.m_world.Refilter(_local8);
mC.myBodyDef.WakeUp();
};
};
};
};
} else {
if (animMc.currentFrame != 6){
animMc.gotoAndStop("pickedUp");
};
};
};
};
//unresolved jump
};
}
}
}//package classesAS3
Section 98
//GameHitFloorSmoke (classesAS3.GameHitFloorSmoke)
package classesAS3 {
import flash.display.*;
public class GameHitFloorSmoke extends MovieClip {
public var myType:String;
public var myObject:Object;
public var myShapeDef:Object;
public var myParent:Object;
public var rt:Object;
public var energy:Number;
public var filterData:Object;
public var myBodyDef:Object;
public function GameHitFloorSmoke(_arg1, _arg2, _arg3){
addFrameScript(5, frame6);
myObject = _arg3;
rt = _arg1;
myParent = _arg2;
myType = "smoke";
}
public function removeMe(){
if (myObject != null){
myObject.mySmoke = null;
if (this.parent != null){
myParent.removeChild(this);
};
};
}
function frame6(){
this.removeMe();
}
}
}//package classesAS3
Section 99
//GameIntroAnim (classesAS3.GameIntroAnim)
package classesAS3 {
import flash.display.*;
import flash.events.*;
import flash.net.*;
public class GameIntroAnim extends MovieClip {
var rt:Object;
public var link_btn3:SimpleButton;
public function GameIntroAnim(_arg1){
addFrameScript(0, frame1, 121, frame122);
rt = _arg1;
this.play();
}
public function gotoArc3(_arg1:MouseEvent):void{
navigateToURL(new URLRequest("http://www.arcadebomb.com"), "_blank");
}
function frame1(){
link_btn3.addEventListener(MouseEvent.MOUSE_DOWN, gotoArc3, false);
}
function frame122(){
this.rt.introFinished();
stop();
}
}
}//package classesAS3
Section 100
//GameKingBad1 (classesAS3.GameKingBad1)
package classesAS3 {
import flash.display.*;
import Box2D.Common.Math.*;
import Box2D.Collision.Shapes.*;
public class GameKingBad1 extends MovieClip {
public var myType:String;
public var goodBad:Boolean;
public var myObject:Object;
public var mySmoke;
public var collisionWith:MovieClip;
var soldierState:Number;
public var collisionWithS:MovieClip;
public var noRotation:Boolean;
public var myShapeDef:Object;
public var myParent:Object;
public var rt:Object;
public var energy:Number;
public var filterData:Object;
public var myBodyDef:Object;
public var buildingBit:Boolean;// = false
public static const SOLDIER_STATE_DEFEND:int = 1;
public static const SOLDIER_STATE_ATTACK:int = 0;
public static const SOLDIER_STATE_FIGHTING:int = 2;
public function GameKingBad1(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6){
buildingBit = false;
super();
addFrameScript(0, frame1);
rt = _arg1;
myBodyDef = _arg2;
myShapeDef = _arg3;
myType = _arg4;
myParent = _arg5;
mySmoke = null;
goodBad = _arg6;
energy = 100;
noRotation = true;
}
function destroyMe(){
rt.m_world.DestroyBody(myBodyDef);
myBodyDef = null;
removeMe();
}
public function removeMe(){
if (myParent != null){
myParent.removeChild(this);
this.stop();
} else {
if (this.parent != null){
this.parent.removeChild(this);
this.stop();
};
};
}
function frame1(){
stop();
}
public function checkOffScreen(){
if (this.x > 1700){
destroyMe();
} else {
if (this.x < -50){
destroyMe();
};
};
if (this.y > 800){
destroyMe();
};
}
public function decreaseEnergy(_arg1){
rt.rt.decreaseBadKingEnergy(_arg1, this);
}
public function setupPuffSmoke(){
if (mySmoke == null){
mySmoke = new GameHitFloorSmoke(rt, myParent, this);
mySmoke.x = this.x;
mySmoke.y = this.y;
myParent.addChild(mySmoke);
};
}
public function mainLoop(){
var _local1:b2Vec2;
var _local2:Number;
if (rt.rt.rt.gameState == 12){
collisionWithS = null;
if (this.x > 1420){
} else {
scaleX = -1;
_local1 = myBodyDef.GetLinearVelocity();
_local1.x = 4;
myBodyDef.SetLinearVelocity(_local1);
};
} else {
if (collisionWithS != null){
if (collisionWithS.currentFrame != 5){
_local2 = rt.Useful.getDistance(x, y, collisionWithS.x, collisionWithS.y);
if (_local2 > 40){
gotoAndStop("stand");
} else {
if (collisionWithS.myType == "knight"){
if (soldierState != SOLDIER_STATE_FIGHTING){
gotoAndStop("attack");
soldierState = SOLDIER_STATE_FIGHTING;
};
if (collisionWithS.myObject.decreaseEnergy(5)){
soldierState = SOLDIER_STATE_ATTACK;
collisionWithS = null;
gotoAndStop("stand");
};
};
if (collisionWithS != null){
if (x > collisionWithS.x){
scaleX = 1;
} else {
scaleX = -1;
};
if (collisionWithS.myObject != null){
if (collisionWithS.myObject.energy <= 0){
collisionWithS = null;
soldierState = SOLDIER_STATE_DEFEND;
gotoAndStop("stand");
};
};
};
};
} else {
collisionWithS = null;
soldierState = SOLDIER_STATE_DEFEND;
gotoAndStop("stand");
};
} else {
soldierState = SOLDIER_STATE_DEFEND;
gotoAndStop("stand");
};
};
}
}
}//package classesAS3
Section 101
//GameKingBad2 (classesAS3.GameKingBad2)
package classesAS3 {
import flash.display.*;
import Box2D.Common.Math.*;
import Box2D.Collision.Shapes.*;
public class GameKingBad2 extends MovieClip {
public var myType:String;
public var goodBad:Boolean;
public var myObject:Object;
public var mySmoke;
public var collisionWith:MovieClip;
var soldierState:Number;
public var collisionWithS:MovieClip;
public var noRotation:Boolean;
public var myShapeDef:Object;
public var myParent:Object;
public var rt:Object;
public var energy:Number;
public var filterData:Object;
public var myBodyDef:Object;
public var buildingBit:Boolean;// = false
public static const SOLDIER_STATE_DEFEND:int = 1;
public static const SOLDIER_STATE_ATTACK:int = 0;
public static const SOLDIER_STATE_FIGHTING:int = 2;
public function GameKingBad2(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6){
buildingBit = false;
super();
addFrameScript(0, frame1);
rt = _arg1;
myBodyDef = _arg2;
myShapeDef = _arg3;
myType = _arg4;
myParent = _arg5;
mySmoke = null;
goodBad = _arg6;
energy = 100;
noRotation = true;
}
function destroyMe(){
rt.m_world.DestroyBody(myBodyDef);
removeMe();
}
public function removeMe(){
myParent.removeChild(this);
this.stop();
}
function frame1(){
stop();
}
public function checkOffScreen(){
if (this.x > 1700){
destroyMe();
} else {
if (this.x < -50){
destroyMe();
};
};
if (this.y > 800){
destroyMe();
};
}
public function decreaseEnergy(_arg1){
rt.rt.decreaseBadKingEnergy(_arg1, this);
}
public function setupPuffSmoke(){
if (mySmoke == null){
mySmoke = new GameHitFloorSmoke(rt, myParent, this);
mySmoke.x = this.x;
mySmoke.y = this.y;
myParent.addChild(mySmoke);
};
}
public function mainLoop(){
var _local1:b2Vec2;
var _local2:Number;
if (rt.rt.rt.gameState == 12){
collisionWithS = null;
if (this.x > 1420){
} else {
scaleX = -1;
_local1 = myBodyDef.GetLinearVelocity();
_local1.x = 4;
myBodyDef.SetLinearVelocity(_local1);
};
} else {
if (collisionWithS != null){
if (collisionWithS.currentFrame != 5){
_local2 = rt.Useful.getDistance(x, y, collisionWithS.x, collisionWithS.y);
if (_local2 > 40){
gotoAndStop("stand");
} else {
if (collisionWithS.myType == "knight"){
if (soldierState != SOLDIER_STATE_FIGHTING){
gotoAndStop("attack");
soldierState = SOLDIER_STATE_FIGHTING;
};
if (collisionWithS.myObject.decreaseEnergy(5)){
soldierState = SOLDIER_STATE_ATTACK;
collisionWithS = null;
gotoAndStop("stand");
};
};
if (collisionWithS != null){
if (x > collisionWithS.x){
scaleX = 1;
} else {
scaleX = -1;
};
};
};
} else {
collisionWithS = null;
soldierState = SOLDIER_STATE_ATTACK;
};
};
};
}
}
}//package classesAS3
Section 102
//GameKingBad3 (classesAS3.GameKingBad3)
package classesAS3 {
import flash.display.*;
import Box2D.Common.Math.*;
import Box2D.Collision.Shapes.*;
public class GameKingBad3 extends MovieClip {
public var myType:String;
public var goodBad:Boolean;
public var myObject:Object;
public var mySmoke;
public var collisionWith:MovieClip;
var soldierState:Number;
public var collisionWithS:MovieClip;
public var noRotation:Boolean;
public var myShapeDef:Object;
public var myParent:Object;
public var rt:Object;
public var energy:Number;
public var filterData:Object;
public var myBodyDef:Object;
public var buildingBit:Boolean;// = false
public static const SOLDIER_STATE_DEFEND:int = 1;
public static const SOLDIER_STATE_ATTACK:int = 0;
public static const SOLDIER_STATE_FIGHTING:int = 2;
public function GameKingBad3(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6){
buildingBit = false;
super();
addFrameScript(0, frame1);
rt = _arg1;
myBodyDef = _arg2;
myShapeDef = _arg3;
myType = _arg4;
myParent = _arg5;
mySmoke = null;
goodBad = _arg6;
energy = 100;
noRotation = true;
}
function destroyMe(){
rt.m_world.DestroyBody(myBodyDef);
removeMe();
}
public function removeMe(){
myParent.removeChild(this);
this.stop();
}
function frame1(){
stop();
}
public function checkOffScreen(){
if (this.x > 1700){
destroyMe();
} else {
if (this.x < -50){
destroyMe();
};
};
if (this.y > 800){
destroyMe();
};
}
public function decreaseEnergy(_arg1){
rt.rt.decreaseBadKingEnergy(_arg1, this);
}
public function setupPuffSmoke(){
if (mySmoke == null){
mySmoke = new GameHitFloorSmoke(rt, myParent, this);
mySmoke.x = this.x;
mySmoke.y = this.y;
myParent.addChild(mySmoke);
};
}
public function mainLoop(){
var _local1:b2Vec2;
var _local2:Number;
if (rt.rt.rt.gameState == 12){
collisionWithS = null;
if (this.x > 1420){
} else {
scaleX = -1;
_local1 = myBodyDef.GetLinearVelocity();
_local1.x = 4;
myBodyDef.SetLinearVelocity(_local1);
};
} else {
if (collisionWithS != null){
if (collisionWithS.currentFrame != 5){
_local2 = rt.Useful.getDistance(x, y, collisionWithS.x, collisionWithS.y);
if (_local2 > 40){
gotoAndStop("stand");
} else {
if (collisionWithS.myType == "knight"){
if (soldierState != SOLDIER_STATE_FIGHTING){
gotoAndStop("attack");
soldierState = SOLDIER_STATE_FIGHTING;
};
if (collisionWithS.myObject.decreaseEnergy(5)){
soldierState = SOLDIER_STATE_ATTACK;
collisionWithS = null;
gotoAndStop("stand");
};
};
if (collisionWithS != null){
if (x > collisionWithS.x){
scaleX = 1;
} else {
scaleX = -1;
};
};
};
} else {
collisionWithS = null;
soldierState = SOLDIER_STATE_ATTACK;
};
};
};
}
}
}//package classesAS3
Section 103
//GameKingBad4 (classesAS3.GameKingBad4)
package classesAS3 {
import flash.display.*;
import Box2D.Common.Math.*;
import Box2D.Collision.Shapes.*;
public class GameKingBad4 extends MovieClip {
public var myType:String;
public var goodBad:Boolean;
public var myObject:Object;
public var mySmoke;
public var collisionWith:MovieClip;
var soldierState:Number;
public var collisionWithS:MovieClip;
public var noRotation:Boolean;
public var myShapeDef:Object;
public var myParent:Object;
public var rt:Object;
public var energy:Number;
public var filterData:Object;
public var myBodyDef:Object;
public var buildingBit:Boolean;// = false
public static const SOLDIER_STATE_DEFEND:int = 1;
public static const SOLDIER_STATE_ATTACK:int = 0;
public static const SOLDIER_STATE_FIGHTING:int = 2;
public function GameKingBad4(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6){
buildingBit = false;
super();
addFrameScript(0, frame1);
rt = _arg1;
myBodyDef = _arg2;
myShapeDef = _arg3;
myType = _arg4;
myParent = _arg5;
mySmoke = null;
goodBad = _arg6;
energy = 100;
noRotation = true;
}
function destroyMe(){
rt.m_world.DestroyBody(myBodyDef);
removeMe();
}
public function removeMe(){
myParent.removeChild(this);
this.stop();
}
function frame1(){
stop();
}
public function checkOffScreen(){
if (this.x > 1700){
destroyMe();
} else {
if (this.x < -50){
destroyMe();
};
};
if (this.y > 800){
destroyMe();
};
}
public function decreaseEnergy(_arg1){
rt.rt.decreaseBadKingEnergy(_arg1, this);
}
public function setupPuffSmoke(){
if (mySmoke == null){
mySmoke = new GameHitFloorSmoke(rt, myParent, this);
mySmoke.x = this.x;
mySmoke.y = this.y;
myParent.addChild(mySmoke);
};
}
public function mainLoop(){
var _local1:b2Vec2;
var _local2:Number;
if (rt.rt.rt.gameState == 12){
collisionWithS = null;
if (this.x > 1420){
} else {
scaleX = -1;
_local1 = myBodyDef.GetLinearVelocity();
_local1.x = 4;
myBodyDef.SetLinearVelocity(_local1);
};
} else {
if (collisionWithS != null){
if (collisionWithS.currentFrame != 5){
_local2 = rt.Useful.getDistance(x, y, collisionWithS.x, collisionWithS.y);
if (_local2 > 40){
gotoAndStop("stand");
} else {
if (collisionWithS.myType == "knight"){
if (soldierState != SOLDIER_STATE_FIGHTING){
gotoAndStop("attack");
soldierState = SOLDIER_STATE_FIGHTING;
};
if (collisionWithS.myObject.decreaseEnergy(5)){
soldierState = SOLDIER_STATE_ATTACK;
collisionWithS = null;
gotoAndStop("stand");
};
};
if (collisionWithS != null){
if (x > collisionWithS.x){
scaleX = 1;
} else {
scaleX = -1;
};
};
};
} else {
collisionWithS = null;
soldierState = SOLDIER_STATE_ATTACK;
};
};
};
}
}
}//package classesAS3
Section 104
//GameKingBad5 (classesAS3.GameKingBad5)
package classesAS3 {
import flash.display.*;
import Box2D.Common.Math.*;
import Box2D.Collision.Shapes.*;
public class GameKingBad5 extends MovieClip {
public var myType:String;
public var goodBad:Boolean;
public var myObject:Object;
public var mySmoke;
public var collisionWith:MovieClip;
var soldierState:Number;
public var collisionWithS:MovieClip;
public var noRotation:Boolean;
public var myShapeDef:Object;
public var myParent:Object;
public var rt:Object;
public var energy:Number;
public var filterData:Object;
public var myBodyDef:Object;
public var buildingBit:Boolean;// = false
public static const SOLDIER_STATE_DEFEND:int = 1;
public static const SOLDIER_STATE_ATTACK:int = 0;
public static const SOLDIER_STATE_FIGHTING:int = 2;
public function GameKingBad5(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6){
buildingBit = false;
super();
addFrameScript(0, frame1);
rt = _arg1;
myBodyDef = _arg2;
myShapeDef = _arg3;
myType = _arg4;
myParent = _arg5;
mySmoke = null;
goodBad = _arg6;
energy = 100;
noRotation = true;
}
function destroyMe(){
rt.m_world.DestroyBody(myBodyDef);
removeMe();
}
public function removeMe(){
myParent.removeChild(this);
this.stop();
}
function frame1(){
stop();
}
public function checkOffScreen(){
if (this.x > 1700){
destroyMe();
} else {
if (this.x < -50){
destroyMe();
};
};
if (this.y > 800){
destroyMe();
};
}
public function decreaseEnergy(_arg1){
rt.rt.decreaseBadKingEnergy(_arg1, this);
}
public function setupPuffSmoke(){
if (mySmoke == null){
mySmoke = new GameHitFloorSmoke(rt, myParent, this);
mySmoke.x = this.x;
mySmoke.y = this.y;
myParent.addChild(mySmoke);
};
}
public function mainLoop(){
var _local1:b2Vec2;
var _local2:Number;
if (rt.rt.rt.gameState == 12){
collisionWithS = null;
if (this.x > 1420){
} else {
scaleX = -1;
_local1 = myBodyDef.GetLinearVelocity();
_local1.x = 4;
myBodyDef.SetLinearVelocity(_local1);
};
} else {
if (collisionWithS != null){
if (collisionWithS.currentFrame != 5){
_local2 = rt.Useful.getDistance(x, y, collisionWithS.x, collisionWithS.y);
if (_local2 > 40){
gotoAndStop("stand");
} else {
if (collisionWithS.myType == "knight"){
if (soldierState != SOLDIER_STATE_FIGHTING){
gotoAndStop("attack");
soldierState = SOLDIER_STATE_FIGHTING;
};
if (collisionWithS.myObject.decreaseEnergy(5)){
soldierState = SOLDIER_STATE_ATTACK;
collisionWithS = null;
gotoAndStop("stand");
};
};
if (collisionWithS != null){
if (x > collisionWithS.x){
scaleX = 1;
} else {
scaleX = -1;
};
};
};
} else {
collisionWithS = null;
soldierState = SOLDIER_STATE_ATTACK;
};
};
};
}
}
}//package classesAS3
Section 105
//GameKingBad6 (classesAS3.GameKingBad6)
package classesAS3 {
import flash.display.*;
import Box2D.Common.Math.*;
import Box2D.Collision.Shapes.*;
public class GameKingBad6 extends MovieClip {
public var myType:String;
public var goodBad:Boolean;
public var myObject:Object;
public var mySmoke;
public var collisionWith:MovieClip;
var soldierState:Number;
public var collisionWithS:MovieClip;
public var noRotation:Boolean;
public var myShapeDef:Object;
public var myParent:Object;
public var rt:Object;
public var energy:Number;
public var filterData:Object;
public var myBodyDef:Object;
public var buildingBit:Boolean;// = false
public static const SOLDIER_STATE_DEFEND:int = 1;
public static const SOLDIER_STATE_ATTACK:int = 0;
public static const SOLDIER_STATE_FIGHTING:int = 2;
public function GameKingBad6(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6){
buildingBit = false;
super();
addFrameScript(0, frame1);
rt = _arg1;
myBodyDef = _arg2;
myShapeDef = _arg3;
myType = _arg4;
myParent = _arg5;
mySmoke = null;
goodBad = _arg6;
energy = 100;
noRotation = true;
}
function destroyMe(){
rt.m_world.DestroyBody(myBodyDef);
removeMe();
}
public function removeMe(){
myParent.removeChild(this);
this.stop();
}
function frame1(){
stop();
}
public function checkOffScreen(){
if (this.x > 1700){
destroyMe();
} else {
if (this.x < -50){
destroyMe();
};
};
if (this.y > 800){
destroyMe();
};
}
public function decreaseEnergy(_arg1){
rt.rt.decreaseBadKingEnergy(_arg1, this);
}
public function setupPuffSmoke(){
if (mySmoke == null){
mySmoke = new GameHitFloorSmoke(rt, myParent, this);
mySmoke.x = this.x;
mySmoke.y = this.y;
myParent.addChild(mySmoke);
};
}
public function mainLoop(){
var _local1:b2Vec2;
var _local2:Number;
if (rt.rt.rt.gameState == 12){
collisionWithS = null;
if (this.x > 1420){
} else {
scaleX = -1;
_local1 = myBodyDef.GetLinearVelocity();
_local1.x = 4;
myBodyDef.SetLinearVelocity(_local1);
};
} else {
if (collisionWithS != null){
if (collisionWithS.currentFrame != 5){
_local2 = rt.Useful.getDistance(x, y, collisionWithS.x, collisionWithS.y);
if (_local2 > 40){
gotoAndStop("stand");
} else {
if (collisionWithS.myType == "knight"){
if (soldierState != SOLDIER_STATE_FIGHTING){
gotoAndStop("attack");
soldierState = SOLDIER_STATE_FIGHTING;
};
if (collisionWithS.myObject.decreaseEnergy(5)){
soldierState = SOLDIER_STATE_ATTACK;
collisionWithS = null;
gotoAndStop("stand");
};
};
if (collisionWithS != null){
if (x > collisionWithS.x){
scaleX = 1;
} else {
scaleX = -1;
};
};
};
} else {
collisionWithS = null;
soldierState = SOLDIER_STATE_ATTACK;
};
};
};
}
}
}//package classesAS3
Section 106
//GameKingBad7 (classesAS3.GameKingBad7)
package classesAS3 {
import flash.display.*;
import Box2D.Common.Math.*;
import Box2D.Collision.Shapes.*;
public class GameKingBad7 extends MovieClip {
public var myType:String;
public var goodBad:Boolean;
public var myObject:Object;
public var mySmoke;
public var collisionWith:MovieClip;
var soldierState:Number;
public var collisionWithS:MovieClip;
public var noRotation:Boolean;
public var myShapeDef:Object;
public var myParent:Object;
public var rt:Object;
public var energy:Number;
public var filterData:Object;
public var myBodyDef:Object;
public var buildingBit:Boolean;// = false
public static const SOLDIER_STATE_DEFEND:int = 1;
public static const SOLDIER_STATE_ATTACK:int = 0;
public static const SOLDIER_STATE_FIGHTING:int = 2;
public function GameKingBad7(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6){
buildingBit = false;
super();
addFrameScript(0, frame1);
rt = _arg1;
myBodyDef = _arg2;
myShapeDef = _arg3;
myType = _arg4;
myParent = _arg5;
mySmoke = null;
goodBad = _arg6;
energy = 100;
noRotation = true;
}
function destroyMe(){
rt.m_world.DestroyBody(myBodyDef);
removeMe();
}
public function removeMe(){
myParent.removeChild(this);
this.stop();
}
function frame1(){
stop();
}
public function checkOffScreen(){
if (this.x > 1700){
destroyMe();
} else {
if (this.x < -50){
destroyMe();
};
};
if (this.y > 800){
destroyMe();
};
}
public function decreaseEnergy(_arg1){
rt.rt.decreaseBadKingEnergy(_arg1, this);
}
public function setupPuffSmoke(){
if (mySmoke == null){
mySmoke = new GameHitFloorSmoke(rt, myParent, this);
mySmoke.x = this.x;
mySmoke.y = this.y;
myParent.addChild(mySmoke);
};
}
public function mainLoop(){
var _local1:b2Vec2;
var _local2:Number;
if (rt.rt.rt.gameState == 12){
collisionWithS = null;
if (this.x > 1420){
} else {
scaleX = -1;
_local1 = myBodyDef.GetLinearVelocity();
_local1.x = 4;
myBodyDef.SetLinearVelocity(_local1);
};
} else {
if (collisionWithS != null){
if (collisionWithS.currentFrame != 5){
_local2 = rt.Useful.getDistance(x, y, collisionWithS.x, collisionWithS.y);
if (_local2 > 40){
gotoAndStop("stand");
} else {
if (collisionWithS.myType == "knight"){
if (soldierState != SOLDIER_STATE_FIGHTING){
gotoAndStop("attack");
soldierState = SOLDIER_STATE_FIGHTING;
};
if (collisionWithS.myObject.decreaseEnergy(5)){
soldierState = SOLDIER_STATE_ATTACK;
collisionWithS = null;
gotoAndStop("stand");
};
};
if (collisionWithS != null){
if (x > collisionWithS.x){
scaleX = 1;
} else {
scaleX = -1;
};
};
};
} else {
collisionWithS = null;
soldierState = SOLDIER_STATE_ATTACK;
};
};
};
}
}
}//package classesAS3
Section 107
//GameKingGood (classesAS3.GameKingGood)
package classesAS3 {
import flash.display.*;
public class GameKingGood extends MovieClip {
public var myType:String;
public var goodBad:Boolean;
public var myObject:Object;
public var mySmoke;
public var collisionWith:MovieClip;
var soldierState:Number;
public var collisionWithS:MovieClip;
public var noRotation:Boolean;
public var myShapeDef:Object;
public var myParent:Object;
public var rt:Object;
public var energy:Number;
public var filterData:Object;
public var myBodyDef:Object;
public var buildingBit:Boolean;// = false
public static const SOLDIER_STATE_DEFEND:int = 1;
public static const SOLDIER_STATE_ATTACK:int = 0;
public static const SOLDIER_STATE_FIGHTING:int = 2;
public function GameKingGood(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6){
buildingBit = false;
super();
addFrameScript(0, frame1);
rt = _arg1;
myBodyDef = _arg2;
myShapeDef = _arg3;
myType = _arg4;
myParent = _arg5;
mySmoke = null;
goodBad = _arg6;
energy = 100;
noRotation = true;
}
function destroyMe(){
if (rt.bodyGrabbed == myBodyDef){
rt.bodyGrabbed = null;
};
rt.m_world.DestroyBody(myBodyDef);
removeMe();
}
public function removeMe(){
myParent.removeChild(this);
this.stop();
}
function frame1(){
stop();
}
public function checkOffScreen(){
if (this.x > 1700){
destroyMe();
} else {
if (this.x < -50){
destroyMe();
};
};
if (this.y > 800){
destroyMe();
};
}
public function setupPuffSmoke(){
if (mySmoke == null){
mySmoke = new GameHitFloorSmoke(rt.rt, myParent, this);
mySmoke.x = this.x;
mySmoke.y = this.y;
myParent.addChild(mySmoke);
};
}
public function mainLoop(){
var _local1:Number;
if (collisionWithS != null){
if (collisionWithS.currentFrame != 5){
_local1 = rt.Useful.getDistance(x, y, collisionWithS.x, collisionWithS.y);
if (_local1 > 40){
gotoAndStop("stand");
} else {
if (soldierState != SOLDIER_STATE_FIGHTING){
gotoAndStop("attack");
soldierState = SOLDIER_STATE_FIGHTING;
};
if (collisionWithS.myObject.decreaseEnergy(8)){
soldierState = SOLDIER_STATE_ATTACK;
collisionWithS = null;
gotoAndStop("stand");
};
if (collisionWithS != null){
if (x > collisionWithS.x){
scaleX = 1;
} else {
scaleX = -1;
};
};
};
} else {
collisionWithS = null;
soldierState = SOLDIER_STATE_ATTACK;
};
};
}
}
}//package classesAS3
Section 108
//GameKnight1 (classesAS3.GameKnight1)
package classesAS3 {
import flash.display.*;
public class GameKnight1 extends MovieClip {
public var myType:String;
public var goodBad:Boolean;
public var myObject:Object;
public var mySmoke;
public var collisionWith:MovieClip;
public var collisionWithS:MovieClip;
public var collisionWithW:MovieClip;
public var noRotation:Boolean;
public var myShapeDef:Object;
public var myParent:Object;
public var rt:Object;
public var soldier:MovieClip;
public var energy:Number;
public var filterData:Object;
public var myBodyDef:Object;
public var buildingBit:Boolean;// = false
public function GameKnight1(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6){
buildingBit = false;
super();
rt = _arg1;
myBodyDef = _arg2;
myShapeDef = _arg3;
myType = _arg4;
myParent = _arg5;
mySmoke = null;
goodBad = _arg6;
energy = 70;
noRotation = true;
}
function destroyMe(){
if (rt.bodyGrabbed == myBodyDef){
rt.bodyGrabbed = null;
};
rt.m_world.DestroyBody(myBodyDef);
removeMe();
}
public function removeMe(){
myObject.remove();
this.stop();
}
public function checkOffScreen(){
if (this.x > 1700){
destroyMe();
} else {
if (this.x < -50){
destroyMe();
};
};
if (this.y > 800){
destroyMe();
};
}
public function setupPuffSmoke(){
if (mySmoke == null){
mySmoke = new GameHitFloorSmoke(rt, myParent, this);
mySmoke.x = this.x;
mySmoke.y = this.y;
myParent.addChild(mySmoke);
};
}
}
}//package classesAS3
Section 109
//GameKnight2 (classesAS3.GameKnight2)
package classesAS3 {
import flash.display.*;
public class GameKnight2 extends MovieClip {
public var myType:String;
public var goodBad:Boolean;
public var myObject:Object;
public var mySmoke;
public var collisionWith:MovieClip;
public var collisionWithS:MovieClip;
public var collisionWithW:MovieClip;
public var noRotation:Boolean;
public var myShapeDef:Object;
public var myParent:Object;
public var rt:Object;
public var soldier:MovieClip;
public var energy:Number;
public var filterData:Object;
public var myBodyDef:Object;
public var buildingBit:Boolean;// = false
public function GameKnight2(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6){
buildingBit = false;
super();
rt = _arg1;
myBodyDef = _arg2;
myShapeDef = _arg3;
myType = _arg4;
myParent = _arg5;
mySmoke = null;
goodBad = _arg6;
energy = 100;
noRotation = true;
}
function destroyMe(){
if (rt.bodyGrabbed == myBodyDef){
rt.bodyGrabbed = null;
};
rt.m_world.DestroyBody(myBodyDef);
removeMe();
}
public function removeMe(){
myObject.remove();
this.stop();
}
public function checkOffScreen(){
if (this.x > 1700){
destroyMe();
} else {
if (this.x < -50){
destroyMe();
};
};
if (this.y > 800){
destroyMe();
};
}
public function setupPuffSmoke(){
if (mySmoke == null){
mySmoke = new GameHitFloorSmoke(rt, myParent, this);
mySmoke.x = this.x;
mySmoke.y = this.y;
myParent.addChild(mySmoke);
};
}
}
}//package classesAS3
Section 110
//GameKnight3 (classesAS3.GameKnight3)
package classesAS3 {
import flash.display.*;
public class GameKnight3 extends MovieClip {
public var myType:String;
public var goodBad:Boolean;
public var myObject:Object;
public var mySmoke;
public var collisionWith:MovieClip;
public var collisionWithS:MovieClip;
public var collisionWithW:MovieClip;
public var noRotation:Boolean;
public var myShapeDef:Object;
public var myParent:Object;
public var rt:Object;
public var soldier:MovieClip;
public var energy:Number;
public var filterData:Object;
public var myBodyDef:Object;
public var buildingBit:Boolean;// = false
public function GameKnight3(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6){
buildingBit = false;
super();
rt = _arg1;
myBodyDef = _arg2;
myShapeDef = _arg3;
myType = _arg4;
myParent = _arg5;
mySmoke = null;
goodBad = _arg6;
energy = 100;
noRotation = true;
}
function destroyMe(){
if (rt.bodyGrabbed == myBodyDef){
rt.bodyGrabbed = null;
};
rt.m_world.DestroyBody(myBodyDef);
removeMe();
}
public function removeMe(){
myObject.remove();
this.stop();
}
public function checkOffScreen(){
if (this.x > 1700){
destroyMe();
} else {
if (this.x < -50){
destroyMe();
};
};
if (this.y > 800){
destroyMe();
};
}
public function setupPuffSmoke(){
if (mySmoke == null){
mySmoke = new GameHitFloorSmoke(rt, myParent, this);
mySmoke.x = this.x;
mySmoke.y = this.y;
myParent.addChild(mySmoke);
};
}
}
}//package classesAS3
Section 111
//GameKnight4 (classesAS3.GameKnight4)
package classesAS3 {
import flash.display.*;
public class GameKnight4 extends MovieClip {
public var myType:String;
public var goodBad:Boolean;
public var myObject:Object;
public var mySmoke;
public var collisionWith:MovieClip;
public var collisionWithS:MovieClip;
public var collisionWithW:MovieClip;
public var noRotation:Boolean;
public var myShapeDef:Object;
public var myParent:Object;
public var rt:Object;
public var soldier:MovieClip;
public var energy:Number;
public var filterData:Object;
public var myBodyDef:Object;
public var buildingBit:Boolean;// = false
public function GameKnight4(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6){
buildingBit = false;
super();
rt = _arg1;
myBodyDef = _arg2;
myShapeDef = _arg3;
myType = _arg4;
myParent = _arg5;
mySmoke = null;
goodBad = _arg6;
energy = 100;
noRotation = true;
}
function destroyMe(){
if (rt.bodyGrabbed == myBodyDef){
rt.bodyGrabbed = null;
};
rt.m_world.DestroyBody(myBodyDef);
removeMe();
}
public function removeMe(){
myObject.remove();
this.stop();
}
public function checkOffScreen(){
if (this.x > 1700){
destroyMe();
} else {
if (this.x < -50){
destroyMe();
};
};
if (this.y > 800){
destroyMe();
};
}
public function setupPuffSmoke(){
if (mySmoke == null){
mySmoke = new GameHitFloorSmoke(rt, myParent, this);
mySmoke.x = this.x;
mySmoke.y = this.y;
myParent.addChild(mySmoke);
};
}
}
}//package classesAS3
Section 112
//GameLevelComplete (classesAS3.GameLevelComplete)
package classesAS3 {
import flash.display.*;
public class GameLevelComplete extends MovieClip {
public var rt:Object;
public var msg:MovieClip;
public var howWellDone:Number;
public var levelNumber:Number;
public function GameLevelComplete(_arg1){
addFrameScript(0, frame1, 14, frame15, 30, frame31, 118, frame119, 128, frame129);
rt = _arg1;
howWellDone = 1;
this.play();
}
function frame15(){
msg.scoreBonus.text = String(this.rt.money);
if (this.rt.levelTime < 3000){
msg.timeBonus.text = String((1000 * (this.rt.levelNumber / 10)));
} else {
if (this.rt.levelTime < 4500){
msg.timeBonus.text = String((800 * (this.rt.levelNumber / 10)));
} else {
if (this.rt.levelTime < 5500){
msg.timeBonus.text = String((600 * (this.rt.levelNumber / 10)));
} else {
if (this.rt.levelTime < 7000){
msg.timeBonus.text = String((400 * (this.rt.levelNumber / 10)));
} else {
if (this.rt.levelTime < 8000){
msg.timeBonus.text = String((200 * (this.rt.levelNumber / 10)));
} else {
if (this.rt.levelTime < 10000){
msg.timeBonus.text = String((100 * (this.rt.levelNumber / 10)));
} else {
msg.timeBonus.text = "0";
};
};
};
};
};
};
this.rt.score = (this.rt.score + Number(msg.timeBonus.text));
msg.totalScore.text = String(this.rt.score);
levelNumber = this.rt.levelNumber;
if (levelNumber < 10){
levelNumber++;
};
this.rt.rt.Cookie.saveGameCookie(this.rt.score, levelNumber);
if (this.rt.levelNumber == this.rt.levelMax){
msg.titleMc.gotoAndStop("gameComplete");
};
}
function frame1(){
play();
}
function frame31(){
}
function frame119(){
if (this.rt.levelNumber == this.rt.levelMax){
stop();
msg.gotoAndStop(2);
} else {
play();
};
}
function frame129(){
if (this.rt.levelNumber == this.rt.levelMax){
this.rt.gameComplete();
} else {
this.rt.endLevelStuff();
};
stop();
}
}
}//package classesAS3
Section 113
//GameLoop (classesAS3.GameLoop)
package classesAS3 {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.net.*;
import flash.text.*;
import flash.utils.*;
import flash.system.*;
import flash.ui.*;
import mochi.as3.*;
public dynamic class GameLoop extends MovieClip {
public var gperc2:Number;// = 0
public var pauseScreen:pauseMc;
public var mouseNumberDown:Number;
public var cookieData:Object;
public var mapScreen2:GameMapScreen;
var fadeOutArray:Array;
public var gskip:Number;// = 0
public var mochiId:String;// = "51e699f268133cf2"
public var MindJolt_Site:Boolean;// = false
public var introAnim:GameIntroAnim;
public var box2dDone:Boolean;// = false
public var Cookie:as3_shared_objects;
public var titleMusic:SoundMusic1;
public var percentLoaded:int;
public var Useful:GameUseful;
public var domain:String;
var FPS:TextField;
public var titleScreen:GameTitleScreen;
public var GameMain:GameGame;
public var loaderStarted:Boolean;// = false
public var loadingBox:LoadingBox;
public var titleStarted:Boolean;// = false
public var mochiScoreId:String;// = "dc04996c7964cc2d"
var Memory:TextField;
public var Kongregate_Site:Boolean;// = false
public var mouseDownClicked:Boolean;// = false
public var mochiOn:Boolean;// = false
public var mainBtnsSetup;
public var ArcadeBomb_Site:Boolean;// = false
public var titleMusicChannel:SoundChannel;
public var allowed_site:String;// = "arcadebomb.com"
var Instructions:TextField;
public var gperc:Number;// = 0
public var gameState:int;// = 2
public var policyLoaded:Boolean;// = false
var currentTime:int;// = 0
public var keyPressDown:Boolean;// = false
public static const STATE_SYSTEM_PLAY:int = 3;
public static const STATE_SYSTEM_INTRO:int = 9;
public static const STATE_SYSTEM_PAUSE:int = 4;
public static const STATE_SYSTEM_LOADER:int = 0;
public static const STATE_SYSTEM_SETUP_GAME:int = 8;
public static const STATE_SYSTEM_CHAT:int = 10;
public static const STATE_SYSTEM_END_MSG:int = 12;
public static const STATE_SYSTEM_MOCHI:int = 2;
public static const STATE_SYSTEM_NEW_LEVEL:int = 7;
public static const STATE_SYSTEM_GAME_COMPLETE:int = 6;
public static const STATE_SYSTEM_START_MSG:int = 11;
public static const STATE_SYSTEM_TITLE:int = 1;
public static const STATE_SYSTEM_GAME_OVER:int = 5;
public function GameLoop():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
policyLoaded = false;
mochiOn = false;
mochiId = "51e699f268133cf2";
mochiScoreId = "dc04996c7964cc2d";
gameState = STATE_SYSTEM_MOCHI;
loaderStarted = false;
titleStarted = false;
gperc = 0;
gperc2 = 0;
gskip = 0;
currentTime = 0;
FPS = new TextField();
Instructions = new TextField();
Memory = new TextField();
allowed_site = "arcadebomb.com";
MindJolt_Site = false;
Kongregate_Site = false;
ArcadeBomb_Site = false;
keyPressDown = false;
mouseDownClicked = false;
box2dDone = false;
super();
addFrameScript(0, frame1, 2, frame3);
MochiBot.track(this, "1ac8439f");
mouseNumberDown = 0;
mainBtnsSetup = false;
fadeOutArray = new Array();
Useful = new GameUseful(root);
Cookie = new as3_shared_objects();
_local1 = 700;
_local2 = 500;
_local3 = 200;
_local4 = 500;
_local5 = 3;
_local6 = 10;
_local7 = 30;
GameMain = new GameGame(root, _local1, _local2, _local3, _local4, _local5, Useful, _local6, _local7);
addChild(GameMain);
addEventListener(Event.ENTER_FRAME, runGame, false, 0, true);
stage.addEventListener(KeyboardEvent.KEY_UP, keyListener);
stage.addEventListener(KeyboardEvent.KEY_DOWN, keyListenerDown);
}
public function doTitleScreenStuff(){
if (titleMusicChannel == null){
if (GameMain.musicSwitch == true){
titleMusicChannel = titleMusic.play(0, 10000);
};
};
titleScreen.playBtn.addEventListener(MouseEvent.MOUSE_UP, doMapScreen);
titleScreen.loadGameBtn.addEventListener(MouseEvent.MOUSE_UP, doMapScreenOld);
mainBtnsSetup = true;
titleScreen.instructionsBtn.addEventListener(MouseEvent.MOUSE_UP, doInstScreen);
titleScreen.controlsBtn.addEventListener(MouseEvent.MOUSE_UP, doControlsScreen);
titleScreen.musicBtn.addEventListener(MouseEvent.MOUSE_UP, doSoundBtn);
}
public function setupTitleScreen(){
titleScreen = new GameTitleScreen(this);
titleScreen.x = 0;
addChild(titleScreen);
titleScreen.playBtn.addEventListener(MouseEvent.MOUSE_UP, doMapScreen);
titleScreen.loadGameBtn.addEventListener(MouseEvent.MOUSE_UP, doMapScreenOld);
if (GameMain.musicSwitch == false){
titleMusic = new SoundMusic1();
titleMusicChannel = null;
} else {
if (titleMusic == null){
titleMusic = new SoundMusic1();
titleMusicChannel = null;
};
};
if (titleMusicChannel != null){
GameMain.Sounds.setVolume(titleMusicChannel, 1);
};
}
public function doControlsScreen(_arg1:MouseEvent):void{
titleScreen.gotoAndStop("controls");
}
public function doScoresBtns(){
fadeOutArray.push(titleMusicChannel);
if (GameMain.musicSwitch == true){
fadeOutArray.push(titleMusicChannel);
GameMain.Sounds.playSoundFx("mapScreenFx", 1, 0, 1);
};
titleScreen.backBtn.addEventListener(MouseEvent.MOUSE_UP, doLastScoreScreen);
}
public function showLeaderboard(_arg1){
}
public function doMapScreenOld(_arg1:MouseEvent):void{
cookieData = Cookie.loadOldGame();
if (cookieData.visits == -1){
GameMain.levelNumber = 1;
GameMain.levelStart = 1;
GameMain.score = 0;
} else {
GameMain.levelNumber = cookieData.levelNumber;
GameMain.levelStart = cookieData.levelNumber;
GameMain.score = cookieData.score;
};
removeChild(titleScreen);
setupMapScreen();
}
public function mouseMoveHandler(_arg1:Event):void{
}
public function keyListener(_arg1:KeyboardEvent):void{
keyPressDown = false;
GameMain.scrollScreen = "";
GameMain.zoomScreen = "";
if (_arg1.keyCode == 80){
if (gameState != STATE_SYSTEM_PAUSE){
if (gameState == STATE_SYSTEM_PLAY){
gameState = STATE_SYSTEM_PAUSE;
pauseScreen = new pauseMc();
addChild(pauseScreen);
};
} else {
gameState = STATE_SYSTEM_PLAY;
removeChild(this.pauseScreen);
};
};
if (_arg1.keyCode == 67){
if (gameState == STATE_SYSTEM_PLAY){
};
};
if (_arg1.keyCode == 90){
if (gameState == STATE_SYSTEM_PLAY){
};
} else {
if (_arg1.keyCode == 69){
if (gameState == STATE_SYSTEM_PLAY){
};
} else {
if (_arg1.keyCode == 82){
if (gameState == STATE_SYSTEM_PLAY){
};
} else {
if (_arg1.keyCode == 78){
if (gameState == STATE_SYSTEM_PLAY){
};
} else {
if (_arg1.keyCode == 77){
if (gameState == STATE_SYSTEM_PLAY){
};
} else {
if (_arg1.keyCode == Keyboard.UP){
keyPressDown = true;
GameMain.cannonMove = "";
} else {
if (_arg1.keyCode == Keyboard.DOWN){
keyPressDown = true;
GameMain.cannonMove = "";
};
};
};
};
};
};
};
}
public function doInstrBtns(){
fadeOutArray.push(titleMusicChannel);
if (GameMain.musicSwitch == true){
fadeOutArray.push(titleMusicChannel);
GameMain.Sounds.playSoundFx("mapScreenFx", 1, 0, 1);
};
titleScreen.backBtn.addEventListener(MouseEvent.MOUSE_UP, doLastInstScreen);
}
function frame1(){
stop();
}
function frame3(){
stop();
}
public function doMainScreen(_arg1:MouseEvent):void{
titleScreen.gotoAndStop("mainScreen");
}
public function doPlay():void{
GameMain.mainLoop();
}
public function doSoundBtn(_arg1:MouseEvent):void{
if (titleScreen.musicMc.currentFrame == 1){
titleScreen.musicMc.gotoAndStop("off");
GameMain.musicSwitch = false;
titleMusicChannel.stop();
} else {
titleScreen.musicMc.gotoAndStop("on");
GameMain.musicSwitch = true;
titleMusicChannel = titleMusic.play(0, 10000);
};
}
function doBackBtn2(_arg1:MouseEvent):void{
titleScreen.gotoAndStop("mainScreen");
}
public function mouseLeftClick(_arg1:Event):void{
if (gameState == STATE_SYSTEM_PLAY){
if (this.mouseY < 400){
GameMain.on_mouse_down();
} else {
if (mouseDownClicked == false){
mouseDownClicked = true;
GameMain.checkForPanelClick();
};
};
};
}
public function doMapScreen(_arg1:MouseEvent):void{
cookieData = Cookie.newGame();
removeChild(titleScreen);
setupMapScreen();
}
public function loadingComplete(){
this.loaderInfo.removeEventListener(Event.ENTER_FRAME, loadingUpdater, false);
removeChild(loadingBox);
loadingBox = null;
this.loaderInfo.removeEventListener(Event.INIT, loadingComplete);
this.loaderInfo.removeEventListener(ProgressEvent.PROGRESS, loadingProgress);
finishPreload();
}
public function doSetup(_arg1:MouseEvent):void{
removeChild(mapScreen2);
if (GameMain.musicSwitch == true){
GameMain.Sounds.setupFadeOut();
titleMusicChannel = titleMusic.play(0, 10000);
GameMain.Sounds.setVolume(titleMusicChannel, 0.1);
};
GameMain.setupGame();
gameState = STATE_SYSTEM_START_MSG;
}
public function showHUD():void{
FPS.text = "FPS";
FPS.textColor = 0xFFFFFF;
Memory.text = "mem";
Memory.x = 200;
stage.addChild(FPS);
stage.addChild(Memory);
}
public function openURL(_arg1:String){
var _local2:String;
var _local3:URLRequest;
_local2 = _arg1;
_local3 = new URLRequest(_local2);
navigateToURL(_local3, "_blank");
}
public function startChat(){
gameState = STATE_SYSTEM_CHAT;
}
function doLastContScreen(_arg1:MouseEvent):void{
fadeOutArray.push(GameMain.Sounds.currentChannel);
if (GameMain.musicSwitch == true){
titleMusicChannel = titleMusic.play(0, 10000);
GameMain.Sounds.setVolume(titleMusicChannel, 1);
};
titleScreen.gotoAndStop("mainScreen");
}
public function doContrBtns(){
fadeOutArray.push(titleMusicChannel);
if (GameMain.musicSwitch == true){
fadeOutArray.push(titleMusicChannel);
GameMain.Sounds.playSoundFx("mapScreenFx", 1, 0, 1);
};
titleScreen.backBtn.addEventListener(MouseEvent.MOUSE_UP, doLastContScreen);
}
public function introFinished(){
removeChild(introAnim);
gameState = STATE_SYSTEM_TITLE;
}
function setupMapScreen(){
mapScreen2 = new GameMapScreen(this);
mapScreen2.x = 0;
addChild(mapScreen2);
fadeOutArray.push(titleMusicChannel);
if (GameMain.musicSwitch == true){
GameMain.Sounds.playSoundFx("mapScreenFx", 1, 0, 1);
};
}
function doNextInstScreen(_arg1:MouseEvent):void{
if (titleScreen.currentFrame < 4){
titleScreen.nextFrame();
} else {
titleScreen.gotoAndStop("mainScreen");
};
}
public function FadeOut(_arg1){
var _local2:SoundTransform;
var _local3:Number;
var _local4:*;
_local2 = _arg1.soundTransform;
_local3 = _local2.volume;
_local3 = (_local3 - 0.1);
GameMain.Sounds.setVolume(_arg1, _local3);
if (_local3 <= 0){
_arg1.stop();
_local4 = 0;
while (_local4 < fadeOutArray.length) {
if (fadeOutArray[_local4] == _arg1){
fadeOutArray.splice(_local4, 1);
};
_local4++;
};
};
}
function doNextContScreen(_arg1:MouseEvent):void{
if (titleScreen.currentFrame < 7){
titleScreen.nextFrame();
} else {
titleScreen.gotoAndStop("mainScreen");
};
}
function doLastInstScreen(_arg1:MouseEvent):void{
fadeOutArray.push(GameMain.Sounds.currentChannel);
if (GameMain.musicSwitch == true){
titleMusicChannel = titleMusic.play(0, 10000);
GameMain.Sounds.setVolume(titleMusicChannel, 1);
};
titleScreen.gotoAndStop("mainScreen");
}
function pauseGame(){
if (gameState != 4){
if (gameState == 3){
gameState = 4;
pauseScreen = new pauseMc();
addChild(pauseScreen);
};
} else {
gameState = 3;
removeChild(pauseScreen);
};
}
public function runGame(_arg1:Event):void{
var _local2:*;
switch (gameState){
case STATE_SYSTEM_INTRO:
break;
case STATE_SYSTEM_MOCHI:
doMochi();
break;
case STATE_SYSTEM_LOADER:
doLoadScreen();
break;
case STATE_SYSTEM_TITLE:
doTitleScreen();
break;
case STATE_SYSTEM_PLAY:
doPlay();
break;
case STATE_SYSTEM_GAME_OVER:
GameMain.gameOverLoop();
break;
case STATE_SYSTEM_GAME_COMPLETE:
GameMain.Sounds.mainLoop();
_local2 = 0;
while (_local2 < fadeOutArray.length) {
FadeOut(fadeOutArray[_local2]);
_local2++;
};
break;
case STATE_SYSTEM_NEW_LEVEL:
GameMain.gameOver("level_complete");
break;
case STATE_SYSTEM_CHAT:
GameMain.runStartChat();
break;
case STATE_SYSTEM_START_MSG:
GameMain.Sounds.mainLoop();
GameMain.Box2d.runBox2d();
break;
case STATE_SYSTEM_END_MSG:
GameMain.runEndMsgs();
break;
case STATE_SYSTEM_PAUSE:
break;
};
}
public function doInstScreen(_arg1:MouseEvent):void{
titleScreen.gotoAndStop("instructions");
}
function doLastScoreScreen(_arg1:MouseEvent):void{
titleScreen.gotoAndStop("mainScreen");
}
public function doMapScreenStuff(){
mapScreen2.playBtn.addEventListener(MouseEvent.MOUSE_UP, doSetup);
if (GameMain.levelNumber > 1){
mapScreen2.youarehereMc.gotoAndStop(GameMain.levelNumber);
mapScreen2.mapFlags.gotoAndStop(GameMain.levelNumber);
} else {
mapScreen2.youarehereMc.gotoAndStop(1);
mapScreen2.mapFlags.gotoAndStop(1);
};
}
public function updateHUD():void{
var _local1:Number;
_local1 = (1 / ((getTimer() - currentTime) / 1000));
currentTime = getTimer();
FPS.text = ("FPS: " + Math.round(_local1).toString());
Memory.text = (("Mem :" + (Math.round(((System.totalMemory / 0x100000) * 10)) / 10).toString()) + " MB");
}
public function doTitleScreen():void{
var _local1:*;
if (((!(titleStarted)) && ((currentFrame == 3)))){
setupTitleScreen();
titleStarted = true;
};
if (GameMain.musicSwitch == true){
_local1 = 0;
while (_local1 < fadeOutArray.length) {
FadeOut(fadeOutArray[_local1]);
_local1++;
};
};
}
public function keyListenerDown(_arg1:KeyboardEvent):void{
if (gameState == STATE_SYSTEM_PLAY){
if (_arg1.keyCode == Keyboard.SPACE){
GameMain.fireCannon();
} else {
if (_arg1.keyCode == 187){
keyPressDown = true;
GameMain.zoomScreen = "in";
} else {
if (_arg1.keyCode == 189){
keyPressDown = true;
GameMain.zoomScreen = "out";
} else {
if (_arg1.keyCode == 57){
keyPressDown = true;
GameMain.zoomScreen = "allIn";
} else {
if (_arg1.keyCode == 48){
keyPressDown = true;
GameMain.zoomScreen = "allOut";
} else {
if (_arg1.keyCode == 65){
keyPressDown = true;
GameMain.scrollScreen = "right";
} else {
if (_arg1.keyCode == 68){
keyPressDown = true;
GameMain.scrollScreen = "left";
} else {
if (_arg1.keyCode == 83){
keyPressDown = true;
GameMain.scrollScreen = "left";
} else {
if (_arg1.keyCode == Keyboard.RIGHT){
keyPressDown = true;
GameMain.scrollScreen = "left";
} else {
if (_arg1.keyCode == Keyboard.LEFT){
keyPressDown = true;
GameMain.scrollScreen = "right";
} else {
if (_arg1.keyCode == Keyboard.UP){
keyPressDown = true;
GameMain.cannonMove = "down";
} else {
if (_arg1.keyCode == Keyboard.DOWN){
keyPressDown = true;
GameMain.cannonMove = "up";
};
};
};
};
};
};
};
};
};
};
};
};
};
}
public function loadingProgress(_arg1:Event):void{
percentLoaded = ((this.loaderInfo.bytesLoaded / this.loaderInfo.bytesTotal) * 100);
gperc2 = int(percentLoaded);
}
public function finishSetup(){
gameState = STATE_SYSTEM_PLAY;
stage.addEventListener(MouseEvent.MOUSE_DOWN, mouseLeftClick);
stage.addEventListener(MouseEvent.MOUSE_UP, mouseLeftUpClick);
}
public function adFinished(){
mochiOn = false;
gameState = STATE_SYSTEM_LOADER;
}
public function mouseLeftUpClick(_arg1:Event):void{
mouseDownClicked = false;
if (gameState == STATE_SYSTEM_PLAY){
GameMain.on_mouse_up();
} else {
mouseNumberDown++;
if (mouseNumberDown > 1){
mouseNumberDown = 0;
if (gameState == 4){
pauseGame();
};
};
};
}
public function doMainScreen2(_arg1:MouseEvent):void{
removeChild(mapScreen2);
addChild(titleScreen);
titleScreen.gotoAndStop("mainScreen");
titleScreen.playBtn.addEventListener(MouseEvent.MOUSE_UP, doMapScreen);
}
public function doLoadScreen():void{
if (!loaderStarted){
if (this.loaderInfo.bytesLoaded == this.loaderInfo.bytesTotal){
finishPreload();
} else {
loadingBox = new LoadingBox();
loadingBox.addEventListener(Event.ENTER_FRAME, loadingUpdater);
loaderStarted = true;
loadingBox.x = 350;
loadingBox.y = 250;
addChild(loadingBox);
};
};
}
public function checkDomain(){
domain = this.root.loaderInfo.url.split("/")[2];
if (domain.indexOf(allowed_site) == (domain.length - allowed_site.length)){
ArcadeBomb_Site = true;
} else {
ArcadeBomb_Site = false;
};
}
public function loadingUpdater(_arg1:Event):void{
percentLoaded = ((this.loaderInfo.bytesLoaded / this.loaderInfo.bytesTotal) * 100);
gperc2 = int(percentLoaded);
if (gskip < 2){
gskip++;
return;
};
gskip = 0;
gperc = (gperc + 1);
if (gperc < gperc2){
gperc++;
loadingBox.loaderbar.gotoAndStop(gperc);
};
if (gperc >= 100){
loadingComplete();
};
loadingBox.update(percentLoaded);
}
public function doMochi():void{
if (!mochiOn){
MochiAd.showPreGameAd({clip:root, id:mochiId, res:"700x500", ad_finished:this.adFinished});
mochiOn = true;
};
}
public function finishPreload():void{
this.play();
gameState = STATE_SYSTEM_INTRO;
introAnim = new GameIntroAnim(this);
addChild(introAnim);
introAnim.x = 350;
introAnim.y = 238;
}
}
var _local1:* = Security.allowDomain("*");
return (_local1);
}//package classesAS3
Section 114
//GameMapScreen (classesAS3.GameMapScreen)
package classesAS3 {
import flash.display.*;
import flash.events.*;
import flash.net.*;
import flash.text.*;
public class GameMapScreen extends MovieClip {
public var backBtn:SimpleButton;
public var levelNumberTxt:TextField;
public var btn3:SimpleButton;
public var btn7:SimpleButton;
public var btn2:SimpleButton;
public var btn4:SimpleButton;
public var btn8:SimpleButton;
public var btn6:SimpleButton;
public var map:MovieClip;
public var btn1:SimpleButton;
public var btn5:SimpleButton;
public var btn9:SimpleButton;
public var link_btn2:SimpleButton;
public var btn10:SimpleButton;
public var placeNames:MovieClip;
public var playBtn:SimpleButton;
public var mapFlags:MovieClip;
public var youarehereMc:MovieClip;
var levelsDefenses:Array;
var levelsRuler:Array;
var rt:Object;
public function GameMapScreen(_arg1){
addFrameScript(22, frame23, 31, frame32);
this.mapFlags.gotoAndStop(1);
rt = _arg1;
btn1.addEventListener(MouseEvent.MOUSE_OVER, displayName1);
btn2.addEventListener(MouseEvent.MOUSE_OVER, displayName2);
btn3.addEventListener(MouseEvent.MOUSE_OVER, displayName3);
btn4.addEventListener(MouseEvent.MOUSE_OVER, displayName4);
btn5.addEventListener(MouseEvent.MOUSE_OVER, displayName5);
btn6.addEventListener(MouseEvent.MOUSE_OVER, displayName6);
btn7.addEventListener(MouseEvent.MOUSE_OVER, displayName7);
btn8.addEventListener(MouseEvent.MOUSE_OVER, displayName8);
btn9.addEventListener(MouseEvent.MOUSE_OVER, displayName9);
btn10.addEventListener(MouseEvent.MOUSE_OVER, displayName10);
btn1.addEventListener(MouseEvent.MOUSE_OUT, displayCurrentName);
btn2.addEventListener(MouseEvent.MOUSE_OUT, displayCurrentName);
btn3.addEventListener(MouseEvent.MOUSE_OUT, displayCurrentName);
btn4.addEventListener(MouseEvent.MOUSE_OUT, displayCurrentName);
btn5.addEventListener(MouseEvent.MOUSE_OUT, displayCurrentName);
btn6.addEventListener(MouseEvent.MOUSE_OUT, displayCurrentName);
btn7.addEventListener(MouseEvent.MOUSE_OUT, displayCurrentName);
btn8.addEventListener(MouseEvent.MOUSE_OUT, displayCurrentName);
btn9.addEventListener(MouseEvent.MOUSE_OUT, displayCurrentName);
btn10.addEventListener(MouseEvent.MOUSE_OUT, displayCurrentName);
levelsRuler = new Array("Egbert", "Egbert", "Caldron the Creepy", "Caldron the Creepy", "Anders the Smart", "Anders the Smart", "Rhodri the Great", "Rhodri the Great", "Morgan le Fay", "Morgan le Fay");
levelsDefenses = new Array("Low defenses", "Wooden Towers", "Low defenses", "Fort", "medium defenses", "Fort", "Fort", "Stone Tower", "Strong defenses", "Stone defenses", "Strong defenses", "Castle", "Vikings!", "Viking Hordes!");
}
public function gotoArc2(_arg1:MouseEvent):void{
navigateToURL(new URLRequest("http://www.arcadebomb.com"), "_blank");
}
function displayName10(_arg1:MouseEvent):void{
if (rt.GameMain.levelNumber > 10){
placeNames.rulerTxt.text = "Arthur rules this land!";
placeNames.defenseTxt.text = "Strong defenses";
placeNames.kingBadHead.gotoAndStop("arthur");
} else {
placeNames.rulerTxt.text = levelsRuler[9];
placeNames.defenseTxt.text = levelsDefenses[9];
placeNames.kingBadHead.gotoAndStop(10);
levelNumberTxt.text = "Level 10";
};
}
function displayName14(_arg1:MouseEvent):void{
if (rt.GameMain.levelNumber > 14){
placeNames.rulerTxt.text = "Arthur rules this land!";
placeNames.defenseTxt.text = "Strong defenses";
placeNames.kingBadHead.gotoAndStop("arthur");
} else {
placeNames.rulerTxt.text = levelsRuler[13];
placeNames.defenseTxt.text = levelsDefenses[13];
placeNames.kingBadHead.gotoAndStop(14);
levelNumberTxt.text = "Level 14";
};
}
function displayName3(_arg1:MouseEvent):void{
if (rt.GameMain.levelNumber > 3){
placeNames.rulerTxt.text = "Arthur rules this land!";
placeNames.defenseTxt.text = "Strong defenses";
placeNames.kingBadHead.gotoAndStop("arthur");
} else {
placeNames.rulerTxt.text = levelsRuler[2];
placeNames.defenseTxt.text = levelsDefenses[2];
placeNames.kingBadHead.gotoAndStop(3);
levelNumberTxt.text = "Level 3";
};
}
function displayName7(_arg1:MouseEvent):void{
if (rt.GameMain.levelNumber > 7){
placeNames.rulerTxt.text = "Arthur rules this land!";
placeNames.defenseTxt.text = "Strong defenses";
placeNames.kingBadHead.gotoAndStop("arthur");
} else {
placeNames.rulerTxt.text = levelsRuler[6];
placeNames.defenseTxt.text = levelsDefenses[6];
placeNames.kingBadHead.gotoAndStop(7);
levelNumberTxt.text = "Level 7";
};
}
function displayName6(_arg1:MouseEvent):void{
if (rt.GameMain.levelNumber > 6){
placeNames.rulerTxt.text = "Arthur rules this land!";
placeNames.defenseTxt.text = "Strong defenses";
placeNames.kingBadHead.gotoAndStop("arthur");
} else {
placeNames.rulerTxt.text = levelsRuler[5];
placeNames.defenseTxt.text = levelsDefenses[5];
placeNames.kingBadHead.gotoAndStop(6);
levelNumberTxt.text = "Level 6";
};
}
function displayName5(_arg1:MouseEvent):void{
if (rt.GameMain.levelNumber > 5){
placeNames.rulerTxt.text = "Arthur rules this land!";
placeNames.defenseTxt.text = "Strong defenses";
placeNames.kingBadHead.gotoAndStop("arthur");
} else {
placeNames.rulerTxt.text = levelsRuler[4];
placeNames.defenseTxt.text = levelsDefenses[4];
placeNames.kingBadHead.gotoAndStop(5);
levelNumberTxt.text = "Level 5";
};
}
function displayName1(_arg1:MouseEvent):void{
if (rt.GameMain.levelNumber > 1){
placeNames.rulerTxt.text = "Arthur rules this land!";
placeNames.defenseTxt.text = "Strong defenses";
placeNames.kingBadHead.gotoAndStop("arthur");
} else {
placeNames.rulerTxt.text = levelsRuler[0];
placeNames.defenseTxt.text = levelsDefenses[0];
placeNames.kingBadHead.gotoAndStop(1);
};
levelNumberTxt.text = "Level 1";
}
function displayName4(_arg1:MouseEvent):void{
if (rt.GameMain.levelNumber > 4){
placeNames.rulerTxt.text = "Arthur rules this land!";
placeNames.defenseTxt.text = "Strong defenses";
placeNames.kingBadHead.gotoAndStop("arthur");
} else {
placeNames.rulerTxt.text = levelsRuler[3];
placeNames.defenseTxt.text = levelsDefenses[3];
placeNames.kingBadHead.gotoAndStop(4);
levelNumberTxt.text = "Level 4";
};
}
function displayName8(_arg1:MouseEvent):void{
if (rt.GameMain.levelNumber > 8){
placeNames.rulerTxt.text = "Arthur rules this land!";
placeNames.defenseTxt.text = "Strong defenses";
placeNames.kingBadHead.gotoAndStop("arthur");
} else {
placeNames.rulerTxt.text = levelsRuler[7];
placeNames.defenseTxt.text = levelsDefenses[7];
placeNames.kingBadHead.gotoAndStop(8);
levelNumberTxt.text = "Level 8";
};
}
function displayCurrentName(_arg1:MouseEvent):void{
placeNames.rulerTxt.text = levelsRuler[(rt.GameMain.levelNumber - 1)];
placeNames.defenseTxt.text = levelsDefenses[(rt.GameMain.levelNumber - 1)];
placeNames.kingBadHead.gotoAndStop(rt.GameMain.levelNumber);
levelNumberTxt.text = ("Level " + String(rt.GameMain.levelNumber));
}
function displayName9(_arg1:MouseEvent):void{
if (rt.GameMain.levelNumber > 9){
placeNames.rulerTxt.text = "Arthur rules this land!";
placeNames.defenseTxt.text = "Strong defenses";
placeNames.kingBadHead.gotoAndStop("arthur");
} else {
placeNames.rulerTxt.text = levelsRuler[8];
placeNames.defenseTxt.text = levelsDefenses[8];
placeNames.kingBadHead.gotoAndStop(9);
levelNumberTxt.text = "Level 9";
};
}
function displayName11(_arg1:MouseEvent):void{
if (rt.GameMain.levelNumber > 11){
placeNames.rulerTxt.text = "Arthur rules this land!";
placeNames.defenseTxt.text = "Strong defenses";
placeNames.kingBadHead.gotoAndStop("arthur");
} else {
placeNames.rulerTxt.text = levelsRuler[10];
placeNames.defenseTxt.text = levelsDefenses[10];
placeNames.kingBadHead.gotoAndStop(11);
levelNumberTxt.text = "Level 11";
};
}
function frame23(){
placeNames.rulerTxt.text = this.levelsRuler[(this.rt.GameMain.levelNumber - 1)];
placeNames.defenseTxt.text = this.levelsDefenses[(this.rt.GameMain.levelNumber - 1)];
placeNames.kingBadHead.gotoAndStop(this.rt.GameMain.levelNumber);
}
function displayName12(_arg1:MouseEvent):void{
if (rt.GameMain.levelNumber > 12){
placeNames.rulerTxt.text = "Arthur rules this land!";
placeNames.defenseTxt.text = "Strong defenses";
placeNames.kingBadHead.gotoAndStop("arthur");
} else {
placeNames.rulerTxt.text = levelsRuler[11];
placeNames.defenseTxt.text = levelsDefenses[11];
placeNames.kingBadHead.gotoAndStop(12);
levelNumberTxt.text = "Level 12";
};
}
function frame32(){
rt.doMapScreenStuff();
link_btn2.addEventListener(MouseEvent.MOUSE_DOWN, gotoArc2, false);
stop();
}
function displayName13(_arg1:MouseEvent):void{
if (rt.GameMain.levelNumber > 13){
placeNames.rulerTxt.text = "Arthur rules this land!";
placeNames.defenseTxt.text = "Strong defenses";
placeNames.kingBadHead.gotoAndStop("arthur");
} else {
placeNames.rulerTxt.text = levelsRuler[12];
placeNames.defenseTxt.text = levelsDefenses[12];
placeNames.kingBadHead.gotoAndStop(13);
levelNumberTxt.text = "Level 13";
};
}
function displayName2(_arg1:MouseEvent):void{
if (rt.GameMain.levelNumber > 2){
placeNames.rulerTxt.text = "Arthur rules this land!";
placeNames.defenseTxt.text = "Strong defenses";
placeNames.kingBadHead.gotoAndStop("arthur");
} else {
placeNames.rulerTxt.text = levelsRuler[1];
placeNames.defenseTxt.text = levelsDefenses[1];
placeNames.kingBadHead.gotoAndStop(2);
levelNumberTxt.text = "Level 2";
};
}
}
}//package classesAS3
Section 115
//GameMissile (classesAS3.GameMissile)
package classesAS3 {
import classesAS3.*;
class GameMissile {
var rt:Object;
var xPos:Number;// = 0
var xVel:Number;// = 0
var myDamage:Number;
var mType:String;
var yPos:Number;// = 0
var trailDelay:Number;
var speed:Number;
var Useful:GameUseful;
var yVel:Number;// = 0
var dead:Boolean;
var myParent:Object;
var mC:Object;
var arrayIndex:Number;
var velocities:Object;
var xOrigin:Number;// = 0
var yOrigin:Number;// = 0
function GameMissile(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8, _arg9, _arg10){
xOrigin = 0;
yOrigin = 0;
xPos = 0;
yPos = 0;
xVel = 0;
yVel = 0;
super();
rt = _arg2;
Useful = _arg6;
myParent = _arg9;
myDamage = _arg10;
xOrigin = _arg3;
yOrigin = _arg4;
xPos = 0;
yPos = 0;
xVel = 0;
yVel = 0;
speed = _arg8;
dead = false;
mC = _arg1;
mType = _arg5;
trailDelay = 2;
updatePosition();
velocities = new Object();
velocities.gravity = _arg7.gravity;
xVel = (_arg7.vx * speed);
yVel = (_arg7.vy * speed);
}
function applyGravity(){
yVel = (yVel + velocities.gravity);
}
function mainLoop(){
if (dead == true){
remove();
} else {
checkForOffStage();
collisionDetection();
updatePosition();
};
}
function checkForOffStage(){
if (mC.x < 0){
remove();
};
if (mC.y < -1000){
remove();
};
if (mC.x > 1700){
remove();
};
}
function updatePosition(){
var _local1:*;
var _local2:*;
var _local3:Number;
var _local4:Number;
var _local5:Number;
xPos = (xPos + xVel);
yPos = (yPos + yVel);
_local1 = mC.x;
_local2 = mC.y;
mC.x = (xOrigin + xPos);
mC.y = (yOrigin + yPos);
_local3 = (mC.x - _local1);
_local4 = (mC.y - _local2);
_local5 = Math.atan2(_local4, _local3);
mC.rotation = ((_local5 * 180) / Math.PI);
}
function remove(){
var _local1:Number;
var _local2:*;
if (dead == false){
_local1 = -1;
_local2 = 0;
while (_local2 < rt.missilesArray.length) {
if (this == rt.missilesArray[_local2]){
_local1 = _local2;
};
_local2++;
};
if (_local1 >= 0){
if (mC != null){
if (mC.parent != null){
rt.inGameMissilesMc.removeChild(mC);
};
};
};
dead = true;
};
}
function mCDeath(){
}
function collisionDetection(){
var _local1:int;
var _local2:*;
var _local3:*;
if (myParent.mC.goodBad == false){
_local1 = 0;
while (_local1 < rt.inGameEnemyMc.numChildren) {
if (mC.hitTestObject(rt.inGameEnemyMc.getChildAt(_local1))){
if (rt.inGameEnemyMc.getChildAt(_local1).myObject != null){
rt.inGameEnemyMc.getChildAt(_local1).myObject.myDamageDelay = 1;
rt.inGameEnemyMc.getChildAt(_local1).myObject.decreaseEnergy(myDamage);
} else {
if (rt.inGameEnemyMc.getChildAt(_local1).myType == "blockEnemy"){
rt.inGameEnemyMc.getChildAt(_local1).decreaseEnergy((myDamage / 2));
} else {
rt.inGameEnemyMc.getChildAt(_local1).decreaseEnergy(myDamage);
};
};
if (myParent.mC.myType == "wizard"){
rt.explosionsArray.push(new GameExplosion(rt, mC.x, mC.y, 3, rt.Useful, 14, 2, 20, true, false, false, 8, 0));
};
rt.Sounds.playSoundFx("hitEnemyFx", 1, 0, 1);
remove();
dead = true;
};
_local1++;
};
} else {
_local1 = 0;
while (_local1 < rt.inGameGoodGuysMc.numChildren) {
if (rt.inGameGoodGuysMc.getChildAt(_local1) != rt.Box2d.bodyGrabbed){
if (rt.inGameGoodGuysMc.getChildAt(_local1).myType != "catapultRod"){
_local2 = rt.inGameGoodGuysMc.getChildAt(_local1);
if (mC.hitTestObject(rt.inGameGoodGuysMc.getChildAt(_local1))){
if (rt.inGameGoodGuysMc.getChildAt(_local1).myType == "floor"){
rt.Sounds.playSoundFx("hitEnemyFx", 1, 0, 1);
remove();
dead = true;
} else {
if (rt.inGameGoodGuysMc.getChildAt(_local1).myObject != null){
if (rt.inGameGoodGuysMc.getChildAt(_local1).myType == "kingGood"){
rt.decreaseEnergy(int((myDamage / 4)));
} else {
rt.inGameGoodGuysMc.getChildAt(_local1).myObject.myDamageDelay = 1;
rt.inGameGoodGuysMc.getChildAt(_local1).myObject.decreaseEnergy(myDamage);
};
} else {
if (rt.inGameGoodGuysMc.getChildAt(_local1).myType == "kingGood"){
rt.decreaseEnergy(int((myDamage / 4)));
} else {
rt.inGameGoodGuysMc.getChildAt(_local1).decreaseEnergy(myDamage);
};
};
rt.Sounds.playSoundFx("hitEnemyFx", 1, 0, 1);
remove();
dead = true;
};
};
};
};
_local1++;
};
_local1 = 0;
while (_local1 < rt.inGameBuildingsMc.numChildren) {
_local3 = rt.inGameBuildingsMc.getChildAt(_local1);
if (_local3 != RangeError){
if (_local1 < rt.inGameBuildingsMc.numChildren){
if (rt.inGameBuildingsMc.getChildAt(_local1) != rt.Box2d.bodyGrabbed){
if (mC.hitTestObject(rt.inGameBuildingsMc.getChildAt(_local1))){
if (rt.inGameBuildingsMc.getChildAt(_local1).myObject == null){
if (rt.inGameBuildingsMc.getChildAt(_local1).myType == "block"){
rt.inGameBuildingsMc.getChildAt(_local1).decreaseEnergy((myDamage / 2));
} else {
rt.inGameBuildingsMc.getChildAt(_local1).decreaseEnergy(myDamage);
};
rt.Sounds.playSoundFx("hitEnemyFx", 1, 0, 1);
remove();
dead = true;
};
};
};
};
};
_local1++;
};
};
}
function doTrail(){
var _local1:*;
trailDelay--;
if (trailDelay == 0){
trailDelay = 2;
_local1 = new GameRocketSmoke(rt.inGameExplosionsMc);
rt.inGameExplosionsMc.addChild(_local1);
_local1.x = mC.x;
_local1.y = mC.y;
};
}
}
}//package classesAS3
Section 116
//GameMultipleExplosion (classesAS3.GameMultipleExplosion)
package classesAS3 {
import flash.display.*;
public class GameMultipleExplosion extends MovieClip {
public var yPos:Number;
public var numberOfExplosions:Number;
public var areaWidth:Number;
var delayToExplosion:Number;
var mType:Number;
public var rt:Object;
var Useful:GameUseful;
public var xPos:Number;
public function GameMultipleExplosion(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8){
rt = _arg1;
mType = _arg8;
numberOfExplosions = _arg3;
xPos = _arg4;
yPos = _arg5;
areaWidth = _arg6;
Useful = _arg2;
delayToExplosion = _arg7;
}
function mainLoop(){
var _local1:Number;
var _local2:Number;
delayToExplosion--;
if (delayToExplosion == 0){
delayToExplosion = Useful.RandomNumber(1, 8);
_local1 = (xPos + Useful.RandomNumber(1, areaWidth));
_local2 = (rt.alienBaseMc.y + Useful.RandomNumber(1, areaWidth));
rt.explosionsArray.push(new GameExplosion(rt, _local1, _local2, mType, Useful, 8, 5, 76, false, false, true, 8, 0));
};
}
}
}//package classesAS3
Section 117
//GameOverMsgAnim (classesAS3.GameOverMsgAnim)
package classesAS3 {
import flash.display.*;
import flash.events.*;
import com.adobe.crypto.*;
import flash.net.*;
import flash.text.*;
import flash.system.*;
public class GameOverMsgAnim extends MovieClip {
public var m:MovieClip;
public var rt:Object;
public function GameOverMsgAnim(_arg1){
addFrameScript(9, frame10, 22, frame23);
rt = _arg1;
this.play();
}
function frame10(){
stop();
}
function frame23(){
stop();
}
public function buttonPressed(_arg1, _arg2){
var _local3:URLVariables;
var _local4:URLRequest;
var _local5:URLLoader;
if (rt.rt.policyLoaded == false){
rt.rt.policyLoaded = true;
Security.loadPolicyFile("http://hiscore.arcadebomb.com/crossdomain.xml");
};
_local3 = new URLVariables();
_local3.n = _arg1;
_local3.s = _arg2;
_local3.t = new Date().getTime();
_local3.k = Math.floor((Math.random() * 100));
_local3.m = MD5.hash(("" + ((_arg2 + _local3.k) * 6061)));
_local4 = new URLRequest("http://hiscore.arcadebomb.com/questpower2_submit.php");
_local4.method = "POST";
_local4.data = _local3;
_local5 = new URLLoader();
_local5.load(_local4);
_local5.addEventListener(Event.COMPLETE, goodjob);
}
function goodjob(_arg1:Event):void{
}
}
}//package classesAS3
Section 118
//GamePanelBuyMc (classesAS3.GamePanelBuyMc)
package classesAS3 {
import flash.display.*;
public class GamePanelBuyMc extends MovieClip {
var buildFinished:Boolean;
public var itemsMc:panelItems;
public var rt:Object;
public var back:panelManBack;
public function GamePanelBuyMc(_arg1){
addFrameScript(0, frame1);
rt = _arg1;
buildFinished = false;
}
function frame1(){
stop();
}
}
}//package classesAS3
Section 119
//GameParticle (classesAS3.GameParticle)
package classesAS3 {
import flash.display.*;
public class GameParticle extends MovieClip {
var bounces:Number;
var yPos:Number;// = 0
var xVel:Number;// = 0
var myDamage:Number;
var gravity:Boolean;
var mType:Number;
var speed:Number;
var yVel:Number;// = 0
var mC:Object;
var rt:Object;
var dead:Boolean;
var artillary:Boolean;
var Useful:GameUseful;
var xOrigin:Number;// = 0
var xPos:Number;// = 0
var gravityValue:Number;
var endX:Number;
var endY:Number;
var arrayIndex:Number;
var explodeDistance:Number;
var yOrigin:Number;// = 0
public function GameParticle(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8, _arg9, _arg10, _arg11, _arg12, _arg13, _arg14){
xOrigin = 0;
yOrigin = 0;
xPos = 0;
yPos = 0;
xVel = 0;
yVel = 0;
super();
rt = _arg1;
Useful = _arg2;
artillary = _arg10;
gravity = _arg11;
myDamage = _arg14;
explodeDistance = _arg12;
xOrigin = _arg3;
yOrigin = _arg4;
gravityValue = 0;
endX = _arg8;
endY = _arg9;
xPos = 0;
yPos = 0;
bounces = 0;
dead = false;
xVel = (_arg6 * _arg13);
yVel = (_arg7 * _arg13);
mC = this;
mType = _arg5;
mC.gotoAndStop(mType);
updatePosition();
}
function updatePosition(){
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
xPos = (xPos + xVel);
yPos = (yPos + yVel);
_local1 = x;
_local2 = y;
x = (xOrigin + xPos);
y = (yOrigin + yPos);
_local3 = (x - _local1);
_local4 = (y - _local2);
_local5 = Math.atan2(_local4, _local3);
rotation = ((_local5 * 180) / Math.PI);
}
function mainLoop(){
var _local1:Number;
if (dead == false){
_local1 = Useful.getDistance(x, y, endX, endY);
if (artillary == true){
if (_local1 > (explodeDistance / 2)){
scaleX = (scaleX + 40);
scaleY = scaleX;
} else {
scaleX = (scaleX - 35);
scaleY = scaleX;
};
};
if (gravity == true){
gravityValue = (gravityValue + 0.2);
yVel = (yVel + gravityValue);
};
if (_local1 > (explodeDistance + 10)){
if (this.parent != null){
remove();
};
};
collisionDetection();
updatePosition();
};
}
function checkForOffStage(){
if (mC.x < 0){
remove();
};
if (mC.y < 0){
remove();
};
if (mC.x > 1700){
remove();
};
}
function collisionDetection(){
var _local1:Boolean;
var _local2:int;
var _local3:Object;
var _local4:Boolean;
var _local5:int;
_local1 = false;
_local2 = 0;
while (_local2 < rt.inGameEnemyMc.numChildren) {
if (mC.hitTestObject(rt.inGameEnemyMc.getChildAt(_local2))){
if (rt.inGameEnemyMc.getChildAt(_local2).myObject != null){
if (this.currentFrame == 3){
_local3 = new Object();
_local3.mC = rt.inGameEnemyMc.getChildAt(_local2);
_local3.colourValue = 14540287;
_local3.colourMult = 0;
_local3.toDefrost = 0;
_local3.defrost = false;
_local4 = false;
_local5 = 0;
while (_local5 < rt.frozenArray.length) {
if (rt.frozenArray[_local5].mC == rt.inGameEnemyMc.getChildAt(_local2)){
_local4 = true;
break;
};
_local5++;
};
if (_local4 == false){
rt.frozenArray.push(_local3);
};
rt.inGameEnemyMc.getChildAt(_local2).myObject.frozen = true;
} else {
rt.inGameEnemyMc.getChildAt(_local2).myObject.myDamageDelay = 1;
rt.inGameEnemyMc.getChildAt(_local2).myObject.decreaseEnergy(myDamage);
};
} else {
if (this.currentFrame == 3){
_local3 = new Object();
_local3.mC = rt.inGameEnemyMc.getChildAt(_local2);
_local3.colourValue = 5592575;
_local3.colourMult = 0;
_local3.toDefrost = 0;
_local3.defrost = false;
_local5 = 0;
while (_local5 < rt.frozenArray.length) {
if (rt.frozenArray[_local5].mC == rt.inGameEnemyMc.getChildAt(_local2)){
_local4 = true;
break;
};
_local5++;
};
if (_local4 == false){
rt.frozenArray.push(_local3);
};
} else {
rt.inGameEnemyMc.getChildAt(_local2).decreaseEnergy(myDamage);
};
};
_local1 = true;
};
_local2++;
};
if (_local1 == true){
remove();
};
}
function mCDeath(){
}
function remove(){
var _local1:Number;
var _local2:*;
_local1 = -1;
_local2 = 0;
while (_local2 < rt.particlesArray.length) {
if (this == rt.particlesArray[_local2]){
_local1 = _local2;
};
_local2++;
};
if (this.parent != null){
this.parent.removeChild(this);
};
if (_local1 != -1){
rt.particlesArray.splice(_local1, 1);
};
this.stop();
delete ??getglobalscope
[this];
}
}
}//package classesAS3
Section 120
//GamePlane (classesAS3.GamePlane)
package classesAS3 {
import flash.display.*;
public class GamePlane extends MovieClip {
public var soldierStart:Number;
public var xVel:Number;
public var soldierType:Array;
public var myObject:Object;
public var soldierDone:Number;
public var myParent:Object;
public var rt:Object;
public function GamePlane(_arg1, _arg2){
myParent = _arg1;
rt = _arg2;
xVel = 0;
soldierDone = 0;
soldierType = new Array();
}
function updatePosition(){
this.x = (this.x + xVel);
}
function dropNow(){
rt.setupSoldier(soldierType[0], this.x, this.y);
soldierType.shift();
if (this.x < 200){
soldierStart = rt.Useful.RandomNumber(((this.x / 2) + 100), this.x);
} else {
soldierStart = rt.Useful.RandomNumber(((this.x / 2) + 100), 200);
};
}
public function mainLoop(){
updatePosition();
if (this.x < -100){
myParent.removeChild(this);
rt.planeMc = null;
this.stop();
};
if (soldierType.length > 0){
if (this.x < soldierStart){
rt.setupSoldier(soldierType[0], this.x, this.y);
soldierType.shift();
if (this.x < 200){
soldierStart = rt.Useful.RandomNumber(((this.x / 2) + 130), this.x);
} else {
soldierStart = rt.Useful.RandomNumber(((this.x / 2) + 130), 200);
};
};
};
}
}
}//package classesAS3
Section 121
//GamePlank (classesAS3.GamePlank)
package classesAS3 {
import flash.display.*;
public class GamePlank extends MovieClip {
public var myType:String;
public var goodBad:Boolean;
public var myObject:Object;
public var mySmoke;
public var collisionWith:MovieClip;
var myDelay:Number;// = 5
public var noRotation:Boolean;
public var myShapeDef:Object;
public var myParent:Object;
public var rt:Object;
public var energy:Number;
public var filterData:Object;
public var myBodyDef:Object;
public var buildingBit:Boolean;// = true
public function GamePlank(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6){
buildingBit = true;
myDelay = 5;
super();
addFrameScript(0, frame1, 6, frame7);
rt = _arg1;
myBodyDef = _arg2;
myShapeDef = _arg3;
myType = _arg4;
myParent = _arg5;
mySmoke = null;
goodBad = _arg6;
energy = 100;
noRotation = false;
}
function destroyMe(){
if (rt.bodyGrabbed == myBodyDef){
rt.bodyGrabbed = null;
};
rt.m_world.DestroyBody(myBodyDef);
removeMe();
}
public function removeMe(){
myParent.removeChild(this);
}
function frame7(){
this.removeMe();
}
function frame1(){
stop();
}
public function checkOffScreen(){
if (this.x > 1700){
destroyMe();
} else {
if (this.x < -250){
destroyMe();
};
};
if (this.y > 800){
destroyMe();
};
}
public function decreaseEnergy(_arg1):Boolean{
var _local2:Number;
myDelay--;
if (myDelay == 0){
myDelay = 5;
if (energy > 0){
energy = (energy - _arg1);
if (energy <= 0){
rt.m_world.DestroyBody(myBodyDef);
this.gotoAndPlay("blockBreak");
return (true);
};
_local2 = int(((100 - energy) / 25));
this.gotoAndStop((_local2 + 1));
return (false);
};
};
return (false);
}
public function setupPuffSmoke(){
if (mySmoke == null){
mySmoke = new GameHitFloorSmoke(rt, myParent, this);
mySmoke.x = this.x;
mySmoke.y = this.y;
myParent.addChild(mySmoke);
};
}
}
}//package classesAS3
Section 122
//GamePlayer (classesAS3.GamePlayer)
package classesAS3 {
import flash.display.*;
public class GamePlayer {
var playerdown:Number;// = 0
var xVel:Number;// = 0
var moveplayerup:Number;// = 0
var multidirectional:Number;// = 0
var yPos:Number;// = 0
var santaspeed:Number;// = 2
var yVelOld:Number;// = 0
var rotateGunDown:Boolean;
var jumpTime:Number;
var numberOfMissiles:Number;
var jump:Number;// = 0
var mouseButton:Number;
var playerup:Number;// = 0
var myinstance:Object;
var rt:Object;
var Oldplayerup:Number;// = 0
var keypress:Number;
var Oldplayerdown:Number;// = 0
var shotStrength:Number;
var rotateGunUp:Boolean;
var yVel:Number;// = 0
var playerleft:Number;// = 0
var levelDir:Number;
var n:Number;
var s:Number;// = 0
var Oldplayerright:Number;// = 0
var mC:MovieClip;
var scrollSpeed:Number;
var shotsLimit:Number;
var vectorData:Object;
var gunFired:Boolean;
var dy:Number;// = 0
var dx:Number;// = 0
var missileDistFromGun:Number;
var Oldplayerleft:Number;// = 0
var shotsFired:Number;
var xOrigin:Number;// = 0
var xPos:Number;// = 0
var Useful:GameUseful;
var mygraphic:Object;
var angle:Number;// = 0
var playerright:Number;// = 0
var gunRotation:Number;
var xVelOld:Number;// = 0
var energyLevel:Boolean;
var fireDelay:Number;
var turret:turretMc;
var yOrigin:Number;// = 0
public function GamePlayer(_arg1, _arg2, _arg3){
xOrigin = 0;
yOrigin = 0;
xPos = 0;
yPos = 0;
s = 0;
playerleft = 0;
playerright = 0;
jump = 0;
moveplayerup = 0;
playerdown = 0;
playerup = 0;
Oldplayerup = 0;
Oldplayerdown = 0;
Oldplayerright = 0;
Oldplayerleft = 0;
xVel = 0;
yVel = 0;
xVelOld = 0;
yVelOld = 0;
santaspeed = 2;
multidirectional = 0;
dx = 0;
dy = 0;
angle = 0;
super();
mC = _arg1;
rt = _arg2;
Useful = _arg3;
missileDistFromGun = 40;
xOrigin = mC.x;
yOrigin = mC.y;
dx = 0;
dy = 0;
angle = 0;
shotsFired = 0;
shotsLimit = 2;
gunFired = false;
xPos = 0;
yPos = 0;
xVel = 0;
yVel = 0;
xVelOld = 0;
numberOfMissiles = 0;
yVelOld = 0;
scrollSpeed = 10;
keypress = 0;
jump = 0;
jumpTime = 10;
mouseButton = 0;
shotStrength = 6;
gunRotation = 180;
rotateGunUp = false;
rotateGunDown = false;
vectorData = new Object();
energyLevel = false;
levelDir = 1;
fireDelay = 0;
updatePosition();
}
function updatePosition(){
}
function decreaseEnergy(_arg1){
}
function mainLoop(){
}
}
}//package classesAS3
Section 123
//GamePotion1 (classesAS3.GamePotion1)
package classesAS3 {
import flash.display.*;
public class GamePotion1 extends MovieClip {
public var myType:String;
public var goodBad:Boolean;
public var myObject:Object;
public var mySmoke;
public var collisionWith:MovieClip;
public var noRotation:Boolean;
public var myShapeDef:Object;
public var myParent:Object;
public var rt:Object;
public var energy:Number;
public var filterData:Object;
public var myBodyDef:Object;
public var buildingBit:Boolean;// = false
public function GamePotion1(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6){
buildingBit = false;
super();
rt = _arg1;
myBodyDef = _arg2;
myShapeDef = _arg3;
myType = _arg4;
myParent = _arg5;
mySmoke = null;
goodBad = _arg6;
energy = 100;
noRotation = false;
}
function destroyMe(){
if (rt.bodyGrabbed == myBodyDef){
rt.bodyGrabbed = null;
};
rt.m_world.DestroyBody(myBodyDef);
removeMe();
}
public function removeMe(){
var _local1:Number;
var _local2:*;
if (myParent != null){
_local1 = -1;
_local2 = 0;
while (_local2 < rt.bouldersArray.length) {
if (this == rt.bouldersArray[_local2]){
_local1 = _local2;
};
_local2++;
};
if (_local1 != -1){
rt.bouldersArray.splice(_local1, 1);
myParent.removeChild(this);
this.stop();
};
};
}
public function checkOffScreen(){
if (this.x > 1700){
destroyMe();
} else {
if (this.x < -50){
destroyMe();
};
};
if (this.y > 800){
destroyMe();
};
}
public function decreaseEnergy(_arg1):Boolean{
if (energy > 0){
energy = (energy - _arg1);
if (energy <= 0){
rt.Sounds.playSoundFx("mainGunMissileHitFx", 1, 0, 1);
rt.explosionsArray.push(new GameExplosion(rt, this.x, this.y, 1, rt.Useful, 7, 1, 10, true, false, false, 8, 0));
rt.explosionsArray.push(new GameExplosion(rt, this.x, this.y, 2, rt.Useful, 7, 1, 20, true, false, false, 8, 20));
rt.m_world.DestroyBody(myBodyDef);
removeMe();
return (true);
};
return (false);
};
return (true);
}
public function setupPuffSmoke(){
if (mySmoke == null){
mySmoke = new GameHitFloorSmoke(rt, myParent, this);
mySmoke.x = this.x;
mySmoke.y = this.y;
myParent.addChild(mySmoke);
};
}
public function mainLoop(){
if (collisionWith != null){
if (collisionWith.myObject == null){
if (collisionWith.goodBad == true){
if (collisionWith.myType == "kingBad1"){
rt.decreaseBadKingEnergy(30, collisionWith);
} else {
collisionWith.myDelay = 1;
collisionWith.decreaseEnergy(50);
};
};
} else {
if (collisionWith.goodBad == true){
collisionWith.myObject.myDamageDelay = 1;
collisionWith.myObject.decreaseEnergy(100);
};
};
decreaseEnergy(100);
collisionWith = null;
};
}
}
}//package classesAS3
Section 124
//GamePotion2 (classesAS3.GamePotion2)
package classesAS3 {
import flash.display.*;
public class GamePotion2 extends MovieClip {
public var myType:String;
public var goodBad:Boolean;
public var myObject:Object;
public var mySmoke;
public var collisionWith:MovieClip;
public var noRotation:Boolean;
public var myShapeDef:Object;
public var myParent:Object;
public var rt:Object;
public var energy:Number;
public var filterData:Object;
public var myBodyDef:Object;
public var buildingBit:Boolean;// = false
public function GamePotion2(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6){
buildingBit = false;
super();
rt = _arg1;
myBodyDef = _arg2;
myShapeDef = _arg3;
myType = _arg4;
myParent = _arg5;
mySmoke = null;
goodBad = _arg6;
energy = 100;
noRotation = false;
}
function destroyMe(){
if (rt.bodyGrabbed == myBodyDef){
rt.bodyGrabbed = null;
};
rt.m_world.DestroyBody(myBodyDef);
removeMe();
}
public function removeMe(){
var _local1:Number;
var _local2:*;
if (myParent != null){
_local1 = -1;
_local2 = 0;
while (_local2 < rt.bouldersArray.length) {
if (this == rt.bouldersArray[_local2]){
_local1 = _local2;
};
_local2++;
};
if (_local1 != -1){
rt.bouldersArray.splice(_local1, 1);
myParent.removeChild(this);
this.stop();
};
};
}
public function checkOffScreen(){
if (this.x > 1700){
destroyMe();
} else {
if (this.x < -50){
destroyMe();
};
};
if (this.y > 800){
destroyMe();
};
}
public function decreaseEnergy(_arg1):Boolean{
if (energy > 0){
energy = (energy - _arg1);
if (energy <= 0){
rt.m_world.DestroyBody(myBodyDef);
rt.explosionsArray.push(new GameExplosion(rt, this.x, this.y, 3, rt.Useful, 14, 2, 20, true, false, false, 8, 0));
removeMe();
return (true);
};
return (false);
};
return (true);
}
public function setupPuffSmoke(){
if (mySmoke == null){
mySmoke = new GameHitFloorSmoke(rt, myParent, this);
mySmoke.x = this.x;
mySmoke.y = this.y;
myParent.addChild(mySmoke);
};
}
public function mainLoop(){
if (collisionWith != null){
decreaseEnergy(100);
collisionWith = null;
};
}
}
}//package classesAS3
Section 125
//GamePotion3 (classesAS3.GamePotion3)
package classesAS3 {
import flash.display.*;
public class GamePotion3 extends MovieClip {
public var myType:String;
public var goodBad:Boolean;
public var myObject:Object;
public var mySmoke;
public var collisionWith:MovieClip;
public var noRotation:Boolean;
public var myShapeDef:Object;
public var myParent:Object;
public var rt:Object;
public var energy:Number;
public var filterData:Object;
public var myBodyDef:Object;
public var buildingBit:Boolean;// = false
public function GamePotion3(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6){
buildingBit = false;
super();
rt = _arg1;
myBodyDef = _arg2;
myShapeDef = _arg3;
myType = _arg4;
myParent = _arg5;
mySmoke = null;
goodBad = _arg6;
energy = 100;
noRotation = false;
}
function destroyMe(){
if (rt.bodyGrabbed == myBodyDef){
rt.bodyGrabbed = null;
};
rt.m_world.DestroyBody(myBodyDef);
removeMe();
}
public function removeMe(){
var _local1:Number;
var _local2:*;
if (myParent != null){
_local1 = -1;
_local2 = 0;
while (_local2 < rt.bouldersArray.length) {
if (this == rt.bouldersArray[_local2]){
_local1 = _local2;
};
_local2++;
};
if (_local1 != -1){
rt.bouldersArray.splice(_local1, 1);
myParent.removeChild(this);
this.stop();
};
};
}
public function checkOffScreen(){
if (this.x > 1700){
destroyMe();
} else {
if (this.x < -50){
destroyMe();
};
};
if (this.y > 800){
destroyMe();
};
}
public function decreaseEnergy(_arg1):Boolean{
var _local2:*;
if (energy > 0){
energy = (energy - _arg1);
if (energy <= 0){
rt.m_world.DestroyBody(myBodyDef);
if (collisionWith != null){
if (collisionWith.myObject == null){
_local2 = new GameRisingScore(rt, rt.inGameScoreMc, 20);
rt.inGameScoreMc.addChild(_local2);
_local2.x = collisionWith.x;
_local2.y = (collisionWith.y - 10);
collisionWith.energy = (collisionWith.energy + 30);
if (collisionWith.energy > 100){
collisionWith.energy = 100;
};
} else {
_local2 = new GameRisingScore(rt, rt.inGameScoreMc, 20);
rt.inGameScoreMc.addChild(_local2);
_local2.x = collisionWith.x;
_local2.y = (collisionWith.y - 10);
collisionWith.myObject.energy = (collisionWith.myObject.energy + 20);
if (collisionWith.myObject.energy > 100){
collisionWith.myObject.energy = 100;
};
};
};
removeMe();
return (true);
} else {
return (false);
};
};
return (true);
}
public function setupPuffSmoke(){
if (mySmoke == null){
mySmoke = new GameHitFloorSmoke(rt, myParent, this);
mySmoke.x = this.x;
mySmoke.y = this.y;
myParent.addChild(mySmoke);
};
}
public function mainLoop(){
if (collisionWith != null){
decreaseEnergy(100);
collisionWith = null;
};
}
}
}//package classesAS3
Section 126
//GameRam1 (classesAS3.GameRam1)
package classesAS3 {
import flash.display.*;
public class GameRam1 extends MovieClip {
public var myType:String;
public var goodBad:Boolean;
public var myObject:Object;
public var mySmoke;
public var collisionWith:MovieClip;
public var collisionWithS:MovieClip;
public var noRotation:Boolean;
public var myShapeDef:Object;
public var myParent:Object;
public var rt:Object;
public var energy:Number;
public var filterData:Object;
public var myBodyDef:Object;
public var buildingBit:Boolean;// = false
public function GameRam1(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6){
buildingBit = false;
super();
addFrameScript(0, frame1);
rt = _arg1;
myBodyDef = _arg2;
myShapeDef = _arg3;
myType = _arg4;
myParent = _arg5;
mySmoke = null;
goodBad = _arg6;
energy = 100;
noRotation = true;
}
function destroyMe(){
rt.m_world.DestroyBody(myBodyDef);
removeMe();
}
public function removeMe(){
myObject.remove();
this.stop();
}
function frame1(){
stop();
}
public function checkOffScreen(){
if (this.x > 1700){
destroyMe();
} else {
if (this.x < -50){
destroyMe();
};
};
if (this.y > 800){
destroyMe();
};
}
public function decreaseEnergy(_arg1){
myObject.decreaseEnergy(_arg1);
}
public function setupPuffSmoke(){
if (mySmoke == null){
mySmoke = new GameHitFloorSmoke(rt, myParent, this);
mySmoke.x = this.x;
mySmoke.y = this.y;
myParent.addChild(mySmoke);
};
}
}
}//package classesAS3
Section 127
//GameRisingMoney (classesAS3.GameRisingMoney)
package classesAS3 {
import flash.display.*;
public class GameRisingMoney extends MovieClip {
public var inGameScoreMc:Sprite;
public var txt:risingMoneyTxt;
public var scoreNumber:Number;
public var rt:Object;
public function GameRisingMoney(_arg1, _arg2, _arg3){
addFrameScript(22, frame23);
rt = _arg1;
inGameScoreMc = _arg2;
scoreNumber = _arg3;
txt.moneyTxt.text = String(_arg3);
}
function frame23(){
this.inGameScoreMc.removeChild(this);
stop();
}
}
}//package classesAS3
Section 128
//GameRisingScore (classesAS3.GameRisingScore)
package classesAS3 {
import flash.display.*;
public class GameRisingScore extends MovieClip {
public var inGameScoreMc:Sprite;
public var txt:MovieClip;
public var scoreNumber:Number;
public var rt:Object;
public function GameRisingScore(_arg1, _arg2, _arg3){
addFrameScript(15, frame16);
rt = _arg1;
inGameScoreMc = _arg2;
scoreNumber = _arg3;
txt.scoreTxt.text = ("+" + String(scoreNumber));
}
function frame16(){
this.inGameScoreMc.removeChild(this);
stop();
}
}
}//package classesAS3
Section 129
//GameRocketSmoke (classesAS3.GameRocketSmoke)
package classesAS3 {
import flash.display.*;
public class GameRocketSmoke extends MovieClip {
public var rt:Sprite;
public function GameRocketSmoke(_arg1){
addFrameScript(7, frame8);
rt = _arg1;
}
function removeMe(){
rt.removeChild(this);
this.stop();
}
function frame8(){
this.removeMe();
stop();
}
}
}//package classesAS3
Section 130
//GameSounds (classesAS3.GameSounds)
package classesAS3 {
import flash.media.*;
import flash.utils.*;
public class GameSounds {
var rt:Object;
var currentChannel:SoundChannel;
var soundsArray:Array;
var fadeOutArray:Array;
public function GameSounds(_arg1){
rt = _arg1;
fadeOutArray = new Array();
soundsArray = new Array();
}
public function playSoundFx(_arg1:String, _arg2:Number, _arg3:Number, _arg4:Number):SoundChannel{
var _local5:Class;
var _local6:*;
if (rt.soundsSwitch == true){
_local5 = Class(getDefinitionByName(_arg1));
_local6 = new (_local5);
currentChannel = _local6.play(_arg3, _arg4);
setVolume(currentChannel, _arg2);
return (currentChannel);
};
return (null);
}
public function FadeOut(_arg1){
var _local2:SoundTransform;
var _local3:Number;
var _local4:*;
_local2 = _arg1.soundTransform;
_local3 = _local2.volume;
_local3 = (_local3 - 0.1);
setVolume(_arg1, _local3);
if (_local3 <= 0){
_local4 = 0;
while (_local4 < fadeOutArray.length) {
if (fadeOutArray[_local4] == _arg1){
fadeOutArray.splice(_local4, 1);
};
_local4++;
};
};
}
public function setupFadeOut(){
fadeOutArray.push(currentChannel);
}
public function setVolume(_arg1:SoundChannel, _arg2:Number):void{
var _local3:SoundTransform;
_local3 = _arg1.soundTransform;
_local3.volume = _arg2;
_arg1.soundTransform = _local3;
}
public function mainLoop(){
var _local1:*;
_local1 = 0;
while (_local1 < fadeOutArray.length) {
FadeOut(fadeOutArray[_local1]);
_local1++;
};
}
public function stopAllMySounds(){
SoundMixer.stopAll();
}
}
}//package classesAS3
Section 131
//GameStartMsg (classesAS3.GameStartMsg)
package classesAS3 {
import flash.display.*;
import flash.events.*;
public class GameStartMsg extends MovieClip {
public var textBox:startGameMsg;
public var rt:Object;
public var startBtn:startGameButton;
public function GameStartMsg(_arg1){
addFrameScript(909, frame910);
rt = _arg1;
startBtn.addEventListener(MouseEvent.MOUSE_UP, finishStuff);
}
function finishStuff(_arg1:MouseEvent):void{
this.gotoAndStop("startGame");
}
public function removeMe(){
rt.rt.startChat();
rt.inGameMsgsMc.removeChild(this);
stop();
}
function frame910(){
this.removeMe();
stop();
}
}
}//package classesAS3
Section 132
//GameTitleScreen (classesAS3.GameTitleScreen)
package classesAS3 {
import flash.display.*;
import flash.events.*;
import flash.net.*;
import flash.text.*;
import flash.system.*;
public class GameTitleScreen extends MovieClip {
public var score1:TextField;
public var name11:TextField;
public var backBtn:SimpleButton;
public var name20:TextField;
public var name21:TextField;
public var name22:TextField;
public var name24:TextField;
public var name26:TextField;
public var name23:TextField;
public var name27:TextField;
public var name25:TextField;
public var anim:MovieClip;
public var name29:TextField;
public var score2:TextField;
public var name30:TextField;
public var name28:TextField;
public var name19:TextField;
public var score10:TextField;
public var score11:TextField;
public var score12:TextField;
public var score13:TextField;
public var score14:TextField;
public var score15:TextField;
public var score16:TextField;
public var score17:TextField;
public var name10:TextField;
public var score18:TextField;
public var score19:TextField;
public var vid:MovieClip;
public var score22:TextField;
public var score20:TextField;
public var score21:TextField;
public var score29:TextField;
public var score24:TextField;
public var score26:TextField;
public var score28:TextField;
public var pos4:TextField;
public var pos5:TextField;
public var pos7:TextField;
public var pos9:TextField;
public var pos6:TextField;
public var pos8:TextField;
public var score25:TextField;
public var score30:TextField;
public var txt:MovieClip;
public var score23:TextField;
public var pos2:TextField;
public var instructionsBtn:SimpleButton;
public var score27:TextField;
public var pos3:TextField;
public var pos1:TextField;
public var link_btn:SimpleButton;
public var musicMc:MovieClip;
var rt:Object;
public var moreGamesBtn:SimpleButton;
public var playBtn:PlayGameBtn;
public var highScoresBtn:SimpleButton;
public var addThisBtn:SimpleButton;
public var name1:TextField;
public var name3:TextField;
public var name4:TextField;
public var name6:TextField;
public var name8:TextField;
public var name2:TextField;
public var fgmBtn:MovieClip;
public var name7:TextField;
public var name9:TextField;
public var name5:TextField;
public var loadGameBtn:SimpleButton;
public var vidBtns:MovieClip;
public var pos10:TextField;
public var pos12:TextField;
public var pos13:TextField;
public var pos14:TextField;
public var pos15:TextField;
public var pos16:TextField;
public var pos17:TextField;
public var pos11:TextField;
public var pos19:TextField;
public var pos18:TextField;
public var pos20:TextField;
public var pos23:TextField;
public var pos25:TextField;
public var pos26:TextField;
public var pos27:TextField;
public var pos21:TextField;
public var pos22:TextField;
public var pos24:TextField;
public var pos28:TextField;
public var pos29:TextField;
public var pos30:TextField;
public var controlsBtn:SimpleButton;
public var score3:TextField;
public var score5:TextField;
public var score6:TextField;
public var score7:TextField;
public var score8:TextField;
public var score4:TextField;
public var name12:TextField;
public var name13:TextField;
public var name14:TextField;
public var name15:TextField;
public var name16:TextField;
public var name17:TextField;
public var name18:TextField;
public var musicBtn:SimpleButton;
public var score9:TextField;
public function GameTitleScreen(_arg1){
addFrameScript(0, frame1, 1, frame2, 5, frame6, 8, frame9);
rt = _arg1;
}
public function gotoArc(_arg1:MouseEvent):void{
navigateToURL(new URLRequest("http://www.arcadebomb.com"), "_blank");
}
function frame1(){
link_btn.addEventListener(MouseEvent.MOUSE_DOWN, gotoArc, false);
addThisBtn.addEventListener(MouseEvent.MOUSE_DOWN, gotoArcD, false);
moreGamesBtn.addEventListener(MouseEvent.MOUSE_DOWN, gotoArc, false);
highScoresBtn.addEventListener(MouseEvent.MOUSE_DOWN, doHighScores, false);
fgmBtn.addEventListener(MouseEvent.MOUSE_DOWN, gotoFGM, false);
rt.doTitleScreenStuff();
anim.play();
stop();
}
public function gotoArcD(_arg1:MouseEvent):void{
navigateToURL(new URLRequest("http://www.arcadebomb.com/free_website_games.html"), "_blank");
}
function frame9(){
anim.gotoAndStop(1);
rt.doContrBtns();
this.getScores();
}
function frame2(){
anim.gotoAndStop(1);
rt.doInstrBtns();
}
function frame6(){
anim.gotoAndStop(1);
rt.doContrBtns();
}
public function getScores(){
var request:URLRequest;
var loader:URLLoader;
var handleComplete:Function;
var onIOError:Function;
handleComplete = function (_arg1:Event):void{
var _local2:URLLoader;
_local2 = URLLoader(_arg1.target);
if (_local2.data.name1 != null){
name1.text = _local2.data.name1;
score1.text = _local2.data.score1;
};
if (_local2.data.name2 != null){
name2.text = _local2.data.name2;
score2.text = _local2.data.score2;
};
if (_local2.data.name3 != null){
name3.text = _local2.data.name3;
score3.text = _local2.data.score3;
};
if (_local2.data.name4 != null){
name4.text = _local2.data.name4;
score4.text = _local2.data.score4;
};
if (_local2.data.name5 != null){
name5.text = _local2.data.name5;
score5.text = _local2.data.score5;
};
if (_local2.data.name6 != null){
name6.text = _local2.data.name6;
score6.text = _local2.data.score6;
};
if (_local2.data.name7 != null){
name7.text = _local2.data.name7;
score7.text = _local2.data.score7;
};
if (_local2.data.name8 != null){
name8.text = _local2.data.name8;
score8.text = _local2.data.score8;
};
if (_local2.data.name9 != null){
name9.text = _local2.data.name9;
score9.text = _local2.data.score9;
};
if (_local2.data.name10 != null){
name10.text = _local2.data.name10;
score10.text = _local2.data.score10;
};
if (_local2.data.name11 != null){
name11.text = _local2.data.name11;
score11.text = _local2.data.score11;
};
if (_local2.data.name12 != null){
name12.text = _local2.data.name12;
score12.text = _local2.data.score12;
};
if (_local2.data.name13 != null){
name13.text = _local2.data.name13;
score13.text = _local2.data.score13;
};
if (_local2.data.name14 != null){
name14.text = _local2.data.name14;
score14.text = _local2.data.score14;
};
if (_local2.data.name15 != null){
name15.text = _local2.data.name15;
score15.text = _local2.data.score15;
};
if (_local2.data.name16 != null){
name16.text = _local2.data.name16;
score16.text = _local2.data.score16;
};
if (_local2.data.name17 != null){
name17.text = _local2.data.name17;
score17.text = _local2.data.score17;
};
if (_local2.data.name18 != null){
name18.text = _local2.data.name18;
score18.text = _local2.data.score18;
};
if (_local2.data.name19 != null){
name19.text = _local2.data.name19;
score19.text = _local2.data.score9;
};
if (_local2.data.name20 != null){
name20.text = _local2.data.name20;
score20.text = _local2.data.score20;
};
if (_local2.data.name21 != null){
name21.text = _local2.data.name21;
score21.text = _local2.data.score21;
};
if (_local2.data.name22 != null){
name22.text = _local2.data.name22;
score22.text = _local2.data.score22;
};
if (_local2.data.name23 != null){
name23.text = _local2.data.name23;
score23.text = _local2.data.score23;
};
if (_local2.data.name24 != null){
name24.text = _local2.data.name24;
score24.text = _local2.data.score24;
};
if (_local2.data.name25 != null){
name25.text = _local2.data.name25;
score25.text = _local2.data.score25;
};
if (_local2.data.name26 != null){
name26.text = _local2.data.name26;
score26.text = _local2.data.score26;
};
if (_local2.data.name27 != null){
name27.text = _local2.data.name27;
score27.text = _local2.data.score27;
};
if (_local2.data.name28 != null){
name28.text = _local2.data.name28;
score28.text = _local2.data.score28;
};
if (_local2.data.name29 != null){
name29.text = _local2.data.name29;
score29.text = _local2.data.score29;
};
if (_local2.data.name30 != null){
name30.text = _local2.data.name30;
score30.text = _local2.data.score30;
};
};
onIOError = function (_arg1:IOErrorEvent):void{
};
if (rt.policyLoaded == false){
rt.policyLoaded = true;
Security.loadPolicyFile("http://hiscore.arcadebomb.com/crossdomain.xml");
};
request = new URLRequest("http://hiscore.arcadebomb.com/questpower2_get.php");
loader = new URLLoader();
loader.dataFormat = URLLoaderDataFormat.VARIABLES;
request.method = URLRequestMethod.POST;
loader.addEventListener(Event.COMPLETE, handleComplete);
loader.addEventListener(IOErrorEvent.IO_ERROR, onIOError);
loader.load(request);
}
public function doHighScores(_arg1:MouseEvent):void{
gotoAndStop("highscores");
}
public function gotoFGM(_arg1:MouseEvent):void{
navigateToURL(new URLRequest("http://www.flashgamemaker.com"), "_blank");
}
}
}//package classesAS3
Section 133
//GameUpgrade (classesAS3.GameUpgrade)
package classesAS3 {
import flash.display.*;
public class GameUpgrade extends MovieClip {
var buildFinished:Boolean;
public var rt:Object;
public var upgradeBtn:SimpleButton;
public var back:MovieClip;
public function GameUpgrade(_arg1){
addFrameScript(0, frame1);
this.stop();
rt = _arg1;
buildFinished = false;
}
function frame1(){
back.gotoAndStop(1);
stop();
}
public function setupUpgrade(){
rt.setupUpgrade1();
}
}
}//package classesAS3
Section 134
//GameUpgrade10 (classesAS3.GameUpgrade10)
package classesAS3 {
import flash.display.*;
public class GameUpgrade10 extends MovieClip {
var buildFinished:Boolean;
public var rt:Object;
public var upgradeBtn:SimpleButton;
public var back:MovieClip;
public function GameUpgrade10(_arg1){
this.stop();
rt = _arg1;
buildFinished = false;
}
public function setupUpgrade(){
rt.setupUpgrade10();
}
}
}//package classesAS3
Section 135
//GameUpgrade2 (classesAS3.GameUpgrade2)
package classesAS3 {
import flash.display.*;
public class GameUpgrade2 extends MovieClip {
var buildFinished:Boolean;
public var rt:Object;
public var upgradeBtn:SimpleButton;
public var back:MovieClip;
public function GameUpgrade2(_arg1){
addFrameScript(0, frame1);
this.stop();
rt = _arg1;
buildFinished = false;
}
function frame1(){
stop();
}
public function setupUpgrade(){
rt.setupUpgrade2();
}
}
}//package classesAS3
Section 136
//GameUpgrade3 (classesAS3.GameUpgrade3)
package classesAS3 {
import flash.display.*;
public class GameUpgrade3 extends MovieClip {
var buildFinished:Boolean;
public var rt:Object;
public var upgradeBtn:SimpleButton;
public var back:MovieClip;
public function GameUpgrade3(_arg1){
this.stop();
rt = _arg1;
buildFinished = false;
}
public function setupUpgrade(){
rt.setupUpgrade3();
}
}
}//package classesAS3
Section 137
//GameUpgrade4 (classesAS3.GameUpgrade4)
package classesAS3 {
import flash.display.*;
public class GameUpgrade4 extends MovieClip {
var buildFinished:Boolean;
public var rt:Object;
public var upgradeBtn:SimpleButton;
public var back:MovieClip;
public function GameUpgrade4(_arg1){
addFrameScript(0, frame1);
this.stop();
rt = _arg1;
buildFinished = false;
}
function frame1(){
stop();
}
public function setupUpgrade(){
rt.setupUpgrade4();
}
}
}//package classesAS3
Section 138
//GameUpgrade5 (classesAS3.GameUpgrade5)
package classesAS3 {
import flash.display.*;
public class GameUpgrade5 extends MovieClip {
var buildFinished:Boolean;
public var rt:Object;
public var upgradeBtn:SimpleButton;
public var back:MovieClip;
public function GameUpgrade5(_arg1){
addFrameScript(0, frame1);
this.stop();
rt = _arg1;
buildFinished = false;
}
function frame1(){
stop();
}
public function setupUpgrade(){
rt.setupUpgrade5();
}
}
}//package classesAS3
Section 139
//GameUpgrade6 (classesAS3.GameUpgrade6)
package classesAS3 {
import flash.display.*;
public class GameUpgrade6 extends MovieClip {
var buildFinished:Boolean;
public var rt:Object;
public var upgradeBtn:SimpleButton;
public var back:MovieClip;
public function GameUpgrade6(_arg1){
addFrameScript(0, frame1);
this.stop();
rt = _arg1;
buildFinished = false;
}
function frame1(){
stop();
}
public function setupUpgrade(){
rt.setupUpgrade6();
}
}
}//package classesAS3
Section 140
//GameUpgrade7 (classesAS3.GameUpgrade7)
package classesAS3 {
import flash.display.*;
public class GameUpgrade7 extends MovieClip {
var buildFinished:Boolean;
public var rt:Object;
public var upgradeBtn:SimpleButton;
public var back:MovieClip;
public function GameUpgrade7(_arg1){
this.stop();
rt = _arg1;
buildFinished = false;
}
public function setupUpgrade(){
rt.setupUpgrade7();
}
}
}//package classesAS3
Section 141
//GameUpgrade8 (classesAS3.GameUpgrade8)
package classesAS3 {
import flash.display.*;
public class GameUpgrade8 extends MovieClip {
var buildFinished:Boolean;
public var rt:Object;
public var upgradeBtn:SimpleButton;
public var back:MovieClip;
public function GameUpgrade8(_arg1){
this.stop();
rt = _arg1;
buildFinished = false;
}
public function setupUpgrade(){
rt.setupUpgrade8();
}
}
}//package classesAS3
Section 142
//GameUpgrade9 (classesAS3.GameUpgrade9)
package classesAS3 {
import flash.display.*;
public class GameUpgrade9 extends MovieClip {
var buildFinished:Boolean;
public var rt:Object;
public var upgradeBtn:SimpleButton;
public var back:MovieClip;
public function GameUpgrade9(_arg1){
this.stop();
rt = _arg1;
buildFinished = false;
}
public function setupUpgrade(){
rt.setupUpgrade9();
}
}
}//package classesAS3
Section 143
//GameUseful (classesAS3.GameUseful)
package classesAS3 {
import flash.display.*;
public class GameUseful {
public var rt:Object;
public function GameUseful(_arg1){
rt = _arg1;
}
function addThrust(_arg1, _arg2){
var _local3:Object;
_local3 = new Object();
_local3.xVel = (Math.cos(radian(_arg1)) * _arg2);
_local3.yVel = (Math.sin(radian(_arg1)) * _arg2);
return (_local3);
}
function rotateXY(_arg1, _arg2, _arg3, _arg4){
var _local5:Number;
var _local6:Object;
_local5 = ((Math.PI * _arg4) / 180);
_local6 = new Object();
_local6.xPos = (_arg1 + (Math.cos(_local5) * _arg3));
_local6.yPos = (_arg2 + (Math.sin(_local5) * _arg3));
return (_local6);
}
public function getDistanceQ(_arg1, _arg2, _arg3, _arg4){
var _local5:Number;
_local5 = (_arg3 - _arg1);
_local5 = Math.abs(_local5);
return (_local5);
}
function localToGlobalXY2(_arg1:MovieClip):Object{
var _local2:Object;
var _local3:*;
var _local4:*;
var _local5:*;
var _local6:*;
_local2 = new Object();
_local2.newX = 0;
_local2.newY = 0;
_local3 = _arg1;
while (_local3 != rt.parent) {
_local4 = (_local2.newX * (_local3.scaleX / 1));
_local5 = (_local2.newY * (_local3.scaleY / 1));
_local6 = (_local3.rotation * (Math.PI / 180));
_local2.newX = ((_local4 * Math.cos(_local6)) - (_local5 * Math.sin(_local6)));
_local2.newY = ((_local4 * Math.sin(_local6)) + (_local5 * Math.cos(_local6)));
_local2.newX = (_local2.newX + _local3.x);
_local2.newY = (_local2.newY + _local3.y);
_local3 = _local3.parent;
};
return (_local2);
}
function localToGlobalXY(_arg1:MovieClip):Object{
var _local2:Object;
var _local3:*;
var _local4:*;
var _local5:*;
var _local6:*;
_local2 = new Object();
_local2.newX = 0;
_local2.newY = 0;
_local3 = _arg1;
while (_local3 != rt.parent) {
_local4 = _local2.newX;
_local5 = _local2.newY;
_local6 = (_local3.rotation * (Math.PI / 180));
_local2.newX = ((_local4 * Math.cos(_local6)) - (_local5 * Math.sin(_local6)));
_local2.newY = ((_local4 * Math.sin(_local6)) + (_local5 * Math.cos(_local6)));
_local2.newX = (_local2.newX + _local3.x);
_local2.newY = (_local2.newY + _local3.y);
_local3 = _local3.parent;
};
return (_local2);
}
public function getDistance(_arg1, _arg2, _arg3, _arg4){
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
_local5 = _arg1;
_local6 = _arg2;
_local7 = _arg3;
_local8 = _arg4;
_local7 = (_local5 - _local7);
_local8 = (_local6 - _local8);
return (Math.sqrt(((_local7 * _local7) + (_local8 * _local8))));
}
public function RandomNumber(_arg1, _arg2):Number{
return ((Math.floor((Math.random() * ((1 + _arg2) - _arg1))) + _arg1));
}
function countMcs(_arg1):Array{
var _local2:Array;
var _local3:*;
_local2 = new Array();
_local3 = 0;
for (_local3 in _arg1) {
if (typeof(_arg1[_local3]) == "movieclip"){
_local2.push(_arg1[_local3]);
};
};
return (_local2);
}
public function orientateToGround(_arg1, _arg2){
var _local3:Number;
var _local4:Number;
var _local5:*;
var _local6:*;
var _local7:Number;
var _local8:Number;
var _local9:Object;
_local3 = (_arg2.x - (_arg2.width / 2));
_local4 = (_arg2.x + (_arg2.width / 2));
_local5 = int(_local3);
_local6 = (_arg2.y + _arg1.spritesMc.y);
_local7 = _arg1.groundArray[_local5];
_local5 = int(_local4);
_local8 = _arg1.groundArray[_local5];
_local9 = pointTowards(_local3, _local7, _local4, _local8);
return ((_local9.spriteRotation - 180));
}
function radian(_arg1){
return (((_arg1 * Math.PI) / 180));
}
function capVectorSpeed(_arg1, _arg2, _arg3):Object{
var _local4:Object;
var _local5:*;
_local4 = new Object();
_local5 = Math.sqrt(((_arg1 * _arg1) + (_arg2 * _arg2)));
if (_local5 > _arg3){
_arg1 = (_arg1 * (_arg3 / _local5));
_arg2 = (_arg2 * (_arg3 / _local5));
};
_local4.vx = _arg1;
_local4.vy = _arg2;
return (_local4);
}
function argbtohex(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number){
return (((((_arg1 << 24) | (_arg2 << 16)) | (_arg3 << 8)) | _arg4));
}
function getVectorFromAngle(_arg1):Object{
var _local2:Object;
var _local3:Number;
_local2 = new Object();
_local3 = ((_arg1 * Math.PI) / 180);
_local2.vx = Math.cos(_local3);
_local2.vy = Math.sin(_local3);
return (_local2);
}
public function getArcVelocity(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number):Object{
var _local7:Object;
var _local8:*;
var _local9:*;
var _local10:*;
var _local11:*;
_local7 = new Object();
_local8 = (_arg5 - _arg3);
_local9 = (_arg6 - _arg4);
_local10 = Math.sqrt(((_local8 * _local8) + (_local9 * _local9)));
_local11 = Math.ceil((_local10 / _arg2));
_local7.gravity = _arg1;
_local7.steps = _local11;
_local7.xStep = (_local8 / _local11);
_local7.yStep = (_local9 / _local11);
if (_arg1 > 0){
_local7.yStep = (_local7.yStep - ((_local11 * _arg1) / 2));
};
return (_local7);
}
function pointTowards(_arg1, _arg2, _arg3, _arg4):Object{
var _local5:Object;
var _local6:*;
var _local7:*;
_local5 = new Object();
_local6 = (_arg1 - _arg3);
_local7 = (_arg2 - _arg4);
_local5.spriteAngle = Math.atan2(_local7, _local6);
_local5.spriteRotation = ((_local5.spriteAngle * 180) / Math.PI);
_local5.vx = Math.cos(_local5.spriteAngle);
_local5.vy = Math.sin(_local5.spriteAngle);
return (_local5);
}
function bxConvertToMetres(_arg1:Number, _arg2:Number){
return ((_arg1 / _arg2));
}
function checkForLOS(_arg1, _arg2, _arg3, _arg4, _arg5){
var _local6:Number;
var _local7:Object;
var _local8:Number;
var _local9:*;
_local6 = int(getDistance(_arg1, _arg2, _arg3, _arg4));
_local7 = pointTowards(_arg1, _arg2, _arg3, _arg4);
_local9 = 0;
while (_local9 < _local6) {
_local8 = rt.GameMain.groundArray[int(_arg1)];
if (int(_arg2) > _local8){
return (true);
};
_arg1 = (_arg1 - _local7.vx);
_arg2 = (_arg2 - _local7.vy);
_local9++;
};
return (false);
}
}
}//package classesAS3
Section 144
//GameWall (classesAS3.GameWall)
package classesAS3 {
import flash.display.*;
public class GameWall extends MovieClip {
public var mySoldier:Object;
public var rt:Object;
public var energy:Number;
public function GameWall(_arg1, _arg2, _arg3){
addFrameScript(39, frame40);
rt = _arg1;
energy = _arg2;
mySoldier = _arg3;
}
function frame40(){
this.mySoldier.soldierState = 5;
stop();
}
}
}//package classesAS3
Section 145
//GameWeaponsPanel (classesAS3.GameWeaponsPanel)
package classesAS3 {
import flash.display.*;
import flash.events.*;
import flash.text.*;
public class GameWeaponsPanel extends MovieClip {
public var musicBtn:SimpleButton;
public var leftScrollBtn:SimpleButton;
public var zb1:SimpleButton;
public var zb3:SimpleButton;
public var rightSpeech:MovieClip;
public var zb2:SimpleButton;
public var zb4:SimpleButton;
public var rightNamesTxt:TextField;
public var timer:MovieClip;
public var kingGoodHead:MovieClip;
public var levelTxt:TextField;
public var soundFxBtn:SimpleButton;
public var rt:Object;
public var msg:TextField;
public var score:TextField;
public var rightScrollBtn:SimpleButton;
public var quitBtn:SimpleButton;
public var musicMc:MovieClip;
public var soundFxMc:MovieClip;
public var timer2:MovieClip;
public var zoom4:MovieClip;
public var zoom1:MovieClip;
public var leftSpeech:leftSpeedBubble;
public var pausePanelBtn:SimpleButton;
public var money:TextField;
public var zoom2:MovieClip;
public var zoom3:MovieClip;
public var kingBadHead:MovieClip;
public function GameWeaponsPanel(_arg1){
addFrameScript(0, frame1);
rt = _arg1;
}
public function doZoom3(_arg1:MouseEvent):void{
rt.inGameGraphicsMc.x = -(350);
rt.inGameGraphicsMc.y = -270;
rt.inGameZoomMc.x = 350;
rt.inGameZoomMc.y = 270;
rt.inGameZoomMc.scaleX = (rt.inGameZoomMc.scaleY = 0.8);
rt.setupZoomBtns();
}
public function doZoom4(_arg1:MouseEvent):void{
rt.inGameGraphicsMc.x = -(350);
rt.inGameGraphicsMc.y = -270;
rt.inGameZoomMc.x = 350;
rt.inGameZoomMc.y = 270;
rt.inGameZoomMc.scaleX = (rt.inGameZoomMc.scaleY = 0.7);
rt.setupZoomBtns();
}
public function doZoom1(_arg1:MouseEvent):void{
rt.inGameGraphicsMc.x = -(350);
rt.inGameGraphicsMc.y = -270;
rt.inGameZoomMc.x = 350;
rt.inGameZoomMc.y = 270;
rt.inGameZoomMc.scaleX = (rt.inGameZoomMc.scaleY = 1);
rt.setupZoomBtns();
}
public function doZoom2(_arg1:MouseEvent):void{
rt.inGameGraphicsMc.x = -(350);
rt.inGameGraphicsMc.y = -270;
rt.inGameZoomMc.x = 350;
rt.inGameZoomMc.y = 270;
rt.inGameZoomMc.scaleX = (rt.inGameZoomMc.scaleY = 0.9);
rt.setupZoomBtns();
}
public function doLeft(_arg1:MouseEvent):void{
rt.scrollScreen = "left";
}
public function doRight(_arg1:MouseEvent):void{
rt.scrollScreen = "right";
}
function frame1(){
zb1.addEventListener(MouseEvent.MOUSE_UP, doZoom1);
zb2.addEventListener(MouseEvent.MOUSE_UP, doZoom2);
zb3.addEventListener(MouseEvent.MOUSE_UP, doZoom3);
zb4.addEventListener(MouseEvent.MOUSE_UP, doZoom4);
stop();
leftScrollBtn.addEventListener(MouseEvent.MOUSE_DOWN, doLeft);
rightScrollBtn.addEventListener(MouseEvent.MOUSE_DOWN, doRight);
}
}
}//package classesAS3
Section 146
//GameViking1 (classesAS3.GameViking1)
package classesAS3 {
import flash.display.*;
public class GameViking1 extends MovieClip {
public var myType:String;
public var goodBad:Boolean;
public var myObject:Object;
public var mySmoke;
public var collisionWith:MovieClip;
public var collisionWithS:MovieClip;
public var noRotation:Boolean;
public var myShapeDef:Object;
public var myParent:Object;
public var rt:Object;
public var energy:Number;
public var filterData:Object;
public var myBodyDef:Object;
public var buildingBit:Boolean;// = false
public function GameViking1(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6){
buildingBit = false;
super();
addFrameScript(0, frame1);
rt = _arg1;
myBodyDef = _arg2;
myShapeDef = _arg3;
myType = _arg4;
myParent = _arg5;
mySmoke = null;
goodBad = _arg6;
energy = 100;
noRotation = true;
}
function destroyMe(){
rt.m_world.DestroyBody(myBodyDef);
removeMe();
}
public function removeMe(){
myObject.remove();
this.stop();
}
function frame1(){
stop();
}
public function checkOffScreen(){
if (this.x > 1700){
destroyMe();
} else {
if (this.x < -50){
destroyMe();
};
};
if (this.y > 800){
destroyMe();
};
}
public function decreaseEnergy(_arg1){
myObject.decreaseEnergy(_arg1);
}
public function setupPuffSmoke(){
if (mySmoke == null){
mySmoke = new GameHitFloorSmoke(rt, myParent, this);
mySmoke.x = this.x;
mySmoke.y = this.y;
myParent.addChild(mySmoke);
};
}
}
}//package classesAS3
Section 147
//GameWizard1 (classesAS3.GameWizard1)
package classesAS3 {
import flash.display.*;
public class GameWizard1 extends MovieClip {
public var myType:String;
public var goodBad:Boolean;
public var myObject:Object;
public var mySmoke;
public var collisionWith:MovieClip;
public var collisionWithS:MovieClip;
public var collisionWithW:MovieClip;
public var noRotation:Boolean;
public var myShapeDef:Object;
public var myParent:Object;
public var rt:Object;
public var soldier:MovieClip;
public var energy:Number;
public var filterData:Object;
public var myBodyDef:Object;
public var buildingBit:Boolean;// = false
public function GameWizard1(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6){
buildingBit = false;
super();
rt = _arg1;
myBodyDef = _arg2;
myShapeDef = _arg3;
myType = _arg4;
myParent = _arg5;
mySmoke = null;
goodBad = _arg6;
energy = 100;
noRotation = true;
}
function destroyMe(){
if (rt.bodyGrabbed == myBodyDef){
rt.bodyGrabbed = null;
};
rt.m_world.DestroyBody(myBodyDef);
removeMe();
}
public function removeMe(){
myParent.removeChild(this);
}
public function checkOffScreen(){
if (this.x > 1700){
destroyMe();
} else {
if (this.x < -250){
destroyMe();
};
};
if (this.y > 800){
destroyMe();
};
}
public function setupPuffSmoke(){
if (mySmoke == null){
mySmoke = new GameHitFloorSmoke(rt, myParent, this);
mySmoke.x = this.x;
mySmoke.y = this.y;
myParent.addChild(mySmoke);
};
}
}
}//package classesAS3
Section 148
//GameWoodBlock (classesAS3.GameWoodBlock)
package classesAS3 {
import flash.display.*;
public class GameWoodBlock extends MovieClip {
public var myType:String;
public var goodBad:Boolean;
public var myObject:Object;
public var mySmoke;
public var collisionWith:MovieClip;
var myDelay:Number;// = 5
public var noRotation:Boolean;
public var myShapeDef:Object;
public var myParent:Object;
public var rt:Object;
public var energy:Number;
public var block:MovieClip;
public var filterData:Object;
public var myBodyDef:Object;
public var buildingBit:Boolean;// = true
public function GameWoodBlock(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7){
buildingBit = true;
myDelay = 5;
super();
this.gotoAndStop(1);
rt = _arg1;
myBodyDef = _arg2;
myShapeDef = _arg3;
myType = _arg4;
myParent = _arg5;
mySmoke = null;
goodBad = _arg7;
noRotation = false;
energy = _arg6;
}
function destroyMe(){
if (rt.bodyGrabbed == myBodyDef){
rt.bodyGrabbed = null;
};
rt.m_world.DestroyBody(myBodyDef);
removeMe();
}
public function removeMe(){
myParent.removeChild(this);
}
public function checkOffScreen(){
if (this.x > 1700){
destroyMe();
} else {
if (this.x < -250){
destroyMe();
};
};
if (this.y > 800){
destroyMe();
};
}
public function decreaseEnergy(_arg1):Boolean{
var _local2:Number;
myDelay--;
if (myDelay == 0){
myDelay = 25;
if (energy > 0){
energy = (energy - _arg1);
if (energy <= 0){
rt.m_world.DestroyBody(myBodyDef);
block.gotoAndPlay("blockBreak");
return (true);
};
_local2 = int(((100 - energy) / 25));
block.gotoAndStop((_local2 + 1));
return (false);
};
};
return (false);
}
public function setupPuffSmoke(){
if (mySmoke == null){
mySmoke = new GameHitFloorSmoke(rt, myParent, this);
mySmoke.x = this.x;
mySmoke.y = this.y;
myParent.addChild(mySmoke);
};
}
}
}//package classesAS3
Section 149
//GameWoodBlockEn (classesAS3.GameWoodBlockEn)
package classesAS3 {
import flash.display.*;
public class GameWoodBlockEn extends MovieClip {
public var myType:String;
public var goodBad:Boolean;
public var myObject:Object;
public var mySmoke;
public var collisionWith:MovieClip;
var myDelay:Number;// = 5
public var noRotation:Boolean;
public var myShapeDef:Object;
public var myParent:Object;
public var rt:Object;
public var energy:Number;
public var block:MovieClip;
public var filterData:Object;
public var myBodyDef:Object;
public var buildingBit:Boolean;// = true
public function GameWoodBlockEn(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7){
buildingBit = true;
myDelay = 5;
super();
this.gotoAndStop(1);
rt = _arg1;
myBodyDef = _arg2;
myShapeDef = _arg3;
myType = _arg4;
myParent = _arg5;
mySmoke = null;
goodBad = _arg7;
noRotation = false;
energy = _arg6;
}
function destroyMe(){
if (rt.bodyGrabbed == myBodyDef){
rt.bodyGrabbed = null;
};
rt.m_world.DestroyBody(myBodyDef);
removeMe();
}
public function removeMe(){
myParent.removeChild(this);
}
public function checkOffScreen(){
if (this.x > 1700){
destroyMe();
} else {
if (this.x < -50){
destroyMe();
};
};
if (this.y > 800){
destroyMe();
};
}
public function decreaseEnergy(_arg1):Boolean{
var _local2:Number;
myDelay--;
if (myDelay == 0){
myDelay = 5;
if (energy > 0){
energy = (energy - _arg1);
if (energy <= 0){
rt.m_world.DestroyBody(myBodyDef);
block.gotoAndPlay("blockBreak");
return (true);
};
_local2 = int(((100 - energy) / 25));
block.gotoAndStop((_local2 + 1));
return (false);
};
};
return (false);
}
public function setupPuffSmoke(){
if (mySmoke == null){
mySmoke = new GameHitFloorSmoke(rt, myParent, this);
mySmoke.x = this.x;
mySmoke.y = this.y;
myParent.addChild(mySmoke);
};
}
}
}//package classesAS3
Section 150
//GameZombie (classesAS3.GameZombie)
package classesAS3 {
import flash.display.*;
public class GameZombie extends MovieClip {
public var myObject:Object;
public var myParent:Object;
public var rt:Object;
public function GameZombie(_arg1, _arg2){
myParent = _arg1;
rt = _arg2;
}
}
}//package classesAS3
Section 151
//MD5 (com.adobe.crypto.MD5)
package com.adobe.crypto {
import com.adobe.utils.*;
public class MD5 {
private static function ff(_arg1:int, _arg2:int, _arg3:int, _arg4:int, _arg5:int, _arg6:int, _arg7:int):int{
return (transform(f, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7));
}
private static function createBlocks(_arg1:String):Array{
var _local2:Array;
var _local3:int;
var _local4:int;
var _local5:int;
_local2 = new Array();
_local3 = (_arg1.length * 8);
_local4 = 0xFF;
_local5 = 0;
while (_local5 < _local3) {
_local2[(_local5 >> 5)] = (_local2[(_local5 >> 5)] | ((_arg1.charCodeAt((_local5 / 8)) & _local4) << (_local5 % 32)));
_local5 = (_local5 + 8);
};
_local2[(_local3 >> 5)] = (_local2[(_local3 >> 5)] | (128 << (_local3 % 32)));
_local2[((((_local3 + 64) >>> 9) << 4) + 14)] = _local3;
return (_local2);
}
private static function ii(_arg1:int, _arg2:int, _arg3:int, _arg4:int, _arg5:int, _arg6:int, _arg7:int):int{
return (transform(i, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7));
}
private static function f(_arg1:int, _arg2:int, _arg3:int):int{
return (((_arg1 & _arg2) | (~(_arg1) & _arg3)));
}
private static function g(_arg1:int, _arg2:int, _arg3:int):int{
return (((_arg1 & _arg3) | (_arg2 & ~(_arg3))));
}
private static function h(_arg1:int, _arg2:int, _arg3:int):int{
return (((_arg1 ^ _arg2) ^ _arg3));
}
private static function i(_arg1:int, _arg2:int, _arg3:int):int{
return ((_arg2 ^ (_arg1 | ~(_arg3))));
}
private static function transform(_arg1:Function, _arg2:int, _arg3:int, _arg4:int, _arg5:int, _arg6:int, _arg7:int, _arg8:int):int{
var _local9:int;
_local9 = (((_arg2 + int(_arg1(_arg3, _arg4, _arg5))) + _arg6) + _arg8);
return ((IntUtil.rol(_local9, _arg7) + _arg3));
}
private static function hh(_arg1:int, _arg2:int, _arg3:int, _arg4:int, _arg5:int, _arg6:int, _arg7:int):int{
return (transform(h, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7));
}
public static function hash(_arg1:String):String{
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:int;
var _local8:int;
var _local9:int;
var _local10:Array;
var _local11:int;
var _local12:int;
_local2 = 1732584193;
_local3 = -271733879;
_local4 = -1732584194;
_local5 = 271733878;
_local10 = createBlocks(_arg1);
_local11 = _local10.length;
_local12 = 0;
while (_local12 < _local11) {
_local6 = _local2;
_local7 = _local3;
_local8 = _local4;
_local9 = _local5;
_local2 = ff(_local2, _local3, _local4, _local5, _local10[(_local12 + 0)], 7, -680876936);
_local5 = ff(_local5, _local2, _local3, _local4, _local10[(_local12 + 1)], 12, -389564586);
_local4 = ff(_local4, _local5, _local2, _local3, _local10[(_local12 + 2)], 17, 606105819);
_local3 = ff(_local3, _local4, _local5, _local2, _local10[(_local12 + 3)], 22, -1044525330);
_local2 = ff(_local2, _local3, _local4, _local5, _local10[(_local12 + 4)], 7, -176418897);
_local5 = ff(_local5, _local2, _local3, _local4, _local10[(_local12 + 5)], 12, 1200080426);
_local4 = ff(_local4, _local5, _local2, _local3, _local10[(_local12 + 6)], 17, -1473231341);
_local3 = ff(_local3, _local4, _local5, _local2, _local10[(_local12 + 7)], 22, -45705983);
_local2 = ff(_local2, _local3, _local4, _local5, _local10[(_local12 + 8)], 7, 1770035416);
_local5 = ff(_local5, _local2, _local3, _local4, _local10[(_local12 + 9)], 12, -1958414417);
_local4 = ff(_local4, _local5, _local2, _local3, _local10[(_local12 + 10)], 17, -42063);
_local3 = ff(_local3, _local4, _local5, _local2, _local10[(_local12 + 11)], 22, -1990404162);
_local2 = ff(_local2, _local3, _local4, _local5, _local10[(_local12 + 12)], 7, 1804603682);
_local5 = ff(_local5, _local2, _local3, _local4, _local10[(_local12 + 13)], 12, -40341101);
_local4 = ff(_local4, _local5, _local2, _local3, _local10[(_local12 + 14)], 17, -1502002290);
_local3 = ff(_local3, _local4, _local5, _local2, _local10[(_local12 + 15)], 22, 1236535329);
_local2 = gg(_local2, _local3, _local4, _local5, _local10[(_local12 + 1)], 5, -165796510);
_local5 = gg(_local5, _local2, _local3, _local4, _local10[(_local12 + 6)], 9, -1069501632);
_local4 = gg(_local4, _local5, _local2, _local3, _local10[(_local12 + 11)], 14, 643717713);
_local3 = gg(_local3, _local4, _local5, _local2, _local10[(_local12 + 0)], 20, -373897302);
_local2 = gg(_local2, _local3, _local4, _local5, _local10[(_local12 + 5)], 5, -701558691);
_local5 = gg(_local5, _local2, _local3, _local4, _local10[(_local12 + 10)], 9, 38016083);
_local4 = gg(_local4, _local5, _local2, _local3, _local10[(_local12 + 15)], 14, -660478335);
_local3 = gg(_local3, _local4, _local5, _local2, _local10[(_local12 + 4)], 20, -405537848);
_local2 = gg(_local2, _local3, _local4, _local5, _local10[(_local12 + 9)], 5, 568446438);
_local5 = gg(_local5, _local2, _local3, _local4, _local10[(_local12 + 14)], 9, -1019803690);
_local4 = gg(_local4, _local5, _local2, _local3, _local10[(_local12 + 3)], 14, -187363961);
_local3 = gg(_local3, _local4, _local5, _local2, _local10[(_local12 + 8)], 20, 1163531501);
_local2 = gg(_local2, _local3, _local4, _local5, _local10[(_local12 + 13)], 5, -1444681467);
_local5 = gg(_local5, _local2, _local3, _local4, _local10[(_local12 + 2)], 9, -51403784);
_local4 = gg(_local4, _local5, _local2, _local3, _local10[(_local12 + 7)], 14, 1735328473);
_local3 = gg(_local3, _local4, _local5, _local2, _local10[(_local12 + 12)], 20, -1926607734);
_local2 = hh(_local2, _local3, _local4, _local5, _local10[(_local12 + 5)], 4, -378558);
_local5 = hh(_local5, _local2, _local3, _local4, _local10[(_local12 + 8)], 11, -2022574463);
_local4 = hh(_local4, _local5, _local2, _local3, _local10[(_local12 + 11)], 16, 1839030562);
_local3 = hh(_local3, _local4, _local5, _local2, _local10[(_local12 + 14)], 23, -35309556);
_local2 = hh(_local2, _local3, _local4, _local5, _local10[(_local12 + 1)], 4, -1530992060);
_local5 = hh(_local5, _local2, _local3, _local4, _local10[(_local12 + 4)], 11, 1272893353);
_local4 = hh(_local4, _local5, _local2, _local3, _local10[(_local12 + 7)], 16, -155497632);
_local3 = hh(_local3, _local4, _local5, _local2, _local10[(_local12 + 10)], 23, -1094730640);
_local2 = hh(_local2, _local3, _local4, _local5, _local10[(_local12 + 13)], 4, 681279174);
_local5 = hh(_local5, _local2, _local3, _local4, _local10[(_local12 + 0)], 11, -358537222);
_local4 = hh(_local4, _local5, _local2, _local3, _local10[(_local12 + 3)], 16, -722521979);
_local3 = hh(_local3, _local4, _local5, _local2, _local10[(_local12 + 6)], 23, 76029189);
_local2 = hh(_local2, _local3, _local4, _local5, _local10[(_local12 + 9)], 4, -640364487);
_local5 = hh(_local5, _local2, _local3, _local4, _local10[(_local12 + 12)], 11, -421815835);
_local4 = hh(_local4, _local5, _local2, _local3, _local10[(_local12 + 15)], 16, 530742520);
_local3 = hh(_local3, _local4, _local5, _local2, _local10[(_local12 + 2)], 23, -995338651);
_local2 = ii(_local2, _local3, _local4, _local5, _local10[(_local12 + 0)], 6, -198630844);
_local5 = ii(_local5, _local2, _local3, _local4, _local10[(_local12 + 7)], 10, 1126891415);
_local4 = ii(_local4, _local5, _local2, _local3, _local10[(_local12 + 14)], 15, -1416354905);
_local3 = ii(_local3, _local4, _local5, _local2, _local10[(_local12 + 5)], 21, -57434055);
_local2 = ii(_local2, _local3, _local4, _local5, _local10[(_local12 + 12)], 6, 1700485571);
_local5 = ii(_local5, _local2, _local3, _local4, _local10[(_local12 + 3)], 10, -1894986606);
_local4 = ii(_local4, _local5, _local2, _local3, _local10[(_local12 + 10)], 15, -1051523);
_local3 = ii(_local3, _local4, _local5, _local2, _local10[(_local12 + 1)], 21, -2054922799);
_local2 = ii(_local2, _local3, _local4, _local5, _local10[(_local12 + 8)], 6, 1873313359);
_local5 = ii(_local5, _local2, _local3, _local4, _local10[(_local12 + 15)], 10, -30611744);
_local4 = ii(_local4, _local5, _local2, _local3, _local10[(_local12 + 6)], 15, -1560198380);
_local3 = ii(_local3, _local4, _local5, _local2, _local10[(_local12 + 13)], 21, 1309151649);
_local2 = ii(_local2, _local3, _local4, _local5, _local10[(_local12 + 4)], 6, -145523070);
_local5 = ii(_local5, _local2, _local3, _local4, _local10[(_local12 + 11)], 10, -1120210379);
_local4 = ii(_local4, _local5, _local2, _local3, _local10[(_local12 + 2)], 15, 718787259);
_local3 = ii(_local3, _local4, _local5, _local2, _local10[(_local12 + 9)], 21, -343485551);
_local2 = (_local2 + _local6);
_local3 = (_local3 + _local7);
_local4 = (_local4 + _local8);
_local5 = (_local5 + _local9);
_local12 = (_local12 + 16);
};
return ((((IntUtil.toHex(_local2) + IntUtil.toHex(_local3)) + IntUtil.toHex(_local4)) + IntUtil.toHex(_local5)));
}
private static function gg(_arg1:int, _arg2:int, _arg3:int, _arg4:int, _arg5:int, _arg6:int, _arg7:int):int{
return (transform(g, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7));
}
}
}//package com.adobe.crypto
Section 152
//IntUtil (com.adobe.utils.IntUtil)
package com.adobe.utils {
public class IntUtil {
private static var hexChars:String = "0123456789abcdef";
public static function toHex(_arg1:int, _arg2:Boolean=false):String{
var _local3:String;
var _local4:int;
var _local5:int;
_local3 = "";
if (_arg2){
_local4 = 0;
while (_local4 < 4) {
_local3 = (_local3 + (hexChars.charAt(((_arg1 >> (((3 - _local4) * 8) + 4)) & 15)) + hexChars.charAt(((_arg1 >> ((3 - _local4) * 8)) & 15))));
_local4++;
};
} else {
_local5 = 0;
while (_local5 < 4) {
_local3 = (_local3 + (hexChars.charAt(((_arg1 >> ((_local5 * 8) + 4)) & 15)) + hexChars.charAt(((_arg1 >> (_local5 * 8)) & 15))));
_local5++;
};
};
return (_local3);
}
public static function ror(_arg1:int, _arg2:int):uint{
var _local3:int;
_local3 = (32 - _arg2);
return (((_arg1 << _local3) | (_arg1 >>> (32 - _local3))));
}
public static function rol(_arg1:int, _arg2:int):int{
return (((_arg1 << _arg2) | (_arg1 >>> (32 - _arg2))));
}
}
}//package com.adobe.utils
Section 153
//Color (fl.motion.Color)
package fl.motion {
import flash.display.*;
import flash.geom.*;
public class Color extends ColorTransform {
private var _tintMultiplier:Number;// = 0
private var _tintColor:Number;// = 0
public function Color(_arg1:Number=1, _arg2:Number=1, _arg3:Number=1, _arg4:Number=1, _arg5:Number=0, _arg6:Number=0, _arg7:Number=0, _arg8:Number=0){
_tintColor = 0;
_tintMultiplier = 0;
super(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8);
}
public function setTint(_arg1:uint, _arg2:Number):void{
var _local3:uint;
var _local4:uint;
var _local5:uint;
this._tintColor = _arg1;
this._tintMultiplier = _arg2;
this.redMultiplier = (this.greenMultiplier = (this.blueMultiplier = (1 - _arg2)));
_local3 = ((_arg1 >> 16) & 0xFF);
_local4 = ((_arg1 >> 8) & 0xFF);
_local5 = (_arg1 & 0xFF);
this.redOffset = Math.round((_local3 * _arg2));
this.greenOffset = Math.round((_local4 * _arg2));
this.blueOffset = Math.round((_local5 * _arg2));
}
public function set tintColor(_arg1:uint):void{
this.setTint(_arg1, this.tintMultiplier);
}
public function get brightness():Number{
return ((this.redOffset) ? (1 - this.redMultiplier) : (this.redMultiplier - 1));
}
private function deriveTintColor():uint{
var _local1:Number;
var _local2:uint;
var _local3:uint;
var _local4:uint;
var _local5:uint;
_local1 = (1 / this.tintMultiplier);
_local2 = Math.round((this.redOffset * _local1));
_local3 = Math.round((this.greenOffset * _local1));
_local4 = Math.round((this.blueOffset * _local1));
_local5 = (((_local2 << 16) | (_local3 << 8)) | _local4);
return (_local5);
}
public function get tintMultiplier():Number{
return (this._tintMultiplier);
}
public function get tintColor():uint{
return (this._tintColor);
}
public function set brightness(_arg1:Number):void{
var _local2:Number;
var _local3:Number;
if (_arg1 > 1){
_arg1 = 1;
} else {
if (_arg1 < -1){
_arg1 = -1;
};
};
_local2 = (1 - Math.abs(_arg1));
_local3 = 0;
if (_arg1 > 0){
_local3 = (_arg1 * 0xFF);
};
this.redMultiplier = (this.greenMultiplier = (this.blueMultiplier = _local2));
this.redOffset = (this.greenOffset = (this.blueOffset = _local3));
}
public function set tintMultiplier(_arg1:Number):void{
this.setTint(this.tintColor, _arg1);
}
private function parseXML(_arg1:XML=null):Color{
var _local2:XML;
var _local3:XML;
var _local4:String;
var _local5:uint;
if (!_arg1){
return (this);
};
_local2 = _arg1.elements()[0];
if (!_local2){
return (this);
};
for each (_local3 in _local2.attributes()) {
_local4 = _local3.localName();
if (_local4 == "tintColor"){
_local5 = (Number(_local3.toString()) as uint);
this.tintColor = _local5;
} else {
this[_local4] = Number(_local3.toString());
};
};
return (this);
}
public static function interpolateColor(_arg1:uint, _arg2:uint, _arg3:Number):uint{
var _local4:Number;
var _local5:uint;
var _local6:uint;
var _local7:uint;
var _local8:uint;
var _local9:uint;
var _local10:uint;
var _local11:uint;
var _local12:uint;
var _local13:uint;
var _local14:uint;
var _local15:uint;
var _local16:uint;
var _local17:uint;
_local4 = (1 - _arg3);
_local5 = ((_arg1 >> 24) & 0xFF);
_local6 = ((_arg1 >> 16) & 0xFF);
_local7 = ((_arg1 >> 8) & 0xFF);
_local8 = (_arg1 & 0xFF);
_local9 = ((_arg2 >> 24) & 0xFF);
_local10 = ((_arg2 >> 16) & 0xFF);
_local11 = ((_arg2 >> 8) & 0xFF);
_local12 = (_arg2 & 0xFF);
_local13 = ((_local5 * _local4) + (_local9 * _arg3));
_local14 = ((_local6 * _local4) + (_local10 * _arg3));
_local15 = ((_local7 * _local4) + (_local11 * _arg3));
_local16 = ((_local8 * _local4) + (_local12 * _arg3));
_local17 = ((((_local13 << 24) | (_local14 << 16)) | (_local15 << 8)) | _local16);
return (_local17);
}
public static function interpolateTransform(_arg1:ColorTransform, _arg2:ColorTransform, _arg3:Number):ColorTransform{
var _local4:Number;
var _local5:ColorTransform;
_local4 = (1 - _arg3);
_local5 = new ColorTransform(((_arg1.redMultiplier * _local4) + (_arg2.redMultiplier * _arg3)), ((_arg1.greenMultiplier * _local4) + (_arg2.greenMultiplier * _arg3)), ((_arg1.blueMultiplier * _local4) + (_arg2.blueMultiplier * _arg3)), ((_arg1.alphaMultiplier * _local4) + (_arg2.alphaMultiplier * _arg3)), ((_arg1.redOffset * _local4) + (_arg2.redOffset * _arg3)), ((_arg1.greenOffset * _local4) + (_arg2.greenOffset * _arg3)), ((_arg1.blueOffset * _local4) + (_arg2.blueOffset * _arg3)), ((_arg1.alphaOffset * _local4) + (_arg2.alphaOffset * _arg3)));
return (_local5);
}
public static function fromXML(_arg1:XML):Color{
return (Color(new (Color).parseXML(_arg1)));
}
}
}//package fl.motion
Section 154
//alt_intro_holder_369 (QFP2_AB_v31_fla.alt_intro_holder_369)
package QFP2_AB_v31_fla {
import flash.display.*;
public dynamic class alt_intro_holder_369 extends MovieClip {
public function alt_intro_holder_369(){
addFrameScript(114, frame115);
}
function frame115(){
stop();
}
}
}//package QFP2_AB_v31_fla
Section 155
//archerDie1_92 (QFP2_AB_v31_fla.archerDie1_92)
package QFP2_AB_v31_fla {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.geom.*;
import flash.filters.*;
import flash.net.*;
import flash.text.*;
import flash.utils.*;
import flash.system.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.ui.*;
import flash.xml.*;
public dynamic class archerDie1_92 extends MovieClip {
public function archerDie1_92(){
addFrameScript(19, frame20);
}
function frame20(){
MovieClip(this.parent.parent).removeMe();
stop();
}
}
}//package QFP2_AB_v31_fla
Section 156
//assetHolder_1 (QFP2_AB_v31_fla.assetHolder_1)
package QFP2_AB_v31_fla {
import flash.display.*;
public dynamic class assetHolder_1 extends MovieClip {
public function assetHolder_1(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package QFP2_AB_v31_fla
Section 157
//badArcherAttack1_168 (QFP2_AB_v31_fla.badArcherAttack1_168)
package QFP2_AB_v31_fla {
import flash.display.*;
public dynamic class badArcherAttack1_168 extends MovieClip {
public function badArcherAttack1_168(){
addFrameScript(9, frame10);
}
function frame10(){
stop();
}
}
}//package QFP2_AB_v31_fla
Section 158
//badArcherDie1_169 (QFP2_AB_v31_fla.badArcherDie1_169)
package QFP2_AB_v31_fla {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.geom.*;
import flash.filters.*;
import flash.net.*;
import flash.text.*;
import flash.utils.*;
import flash.system.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.ui.*;
import flash.xml.*;
public dynamic class badArcherDie1_169 extends MovieClip {
public function badArcherDie1_169(){
addFrameScript(20, frame21);
}
function frame21(){
MovieClip(this.parent).removeMe();
stop();
}
}
}//package QFP2_AB_v31_fla
Section 159
//badArcherSide1_166 (QFP2_AB_v31_fla.badArcherSide1_166)
package QFP2_AB_v31_fla {
import flash.display.*;
public dynamic class badArcherSide1_166 extends MovieClip {
public function badArcherSide1_166(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package QFP2_AB_v31_fla
Section 160
//badKing1Expressions_530 (QFP2_AB_v31_fla.badKing1Expressions_530)
package QFP2_AB_v31_fla {
import flash.display.*;
public dynamic class badKing1Expressions_530 extends MovieClip {
public function badKing1Expressions_530(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package QFP2_AB_v31_fla
Section 161
//badKing1PanelBack_410 (QFP2_AB_v31_fla.badKing1PanelBack_410)
package QFP2_AB_v31_fla {
import flash.display.*;
public dynamic class badKing1PanelBack_410 extends MovieClip {
public function badKing1PanelBack_410(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package QFP2_AB_v31_fla
Section 162
//badKing1PanelBack_529 (QFP2_AB_v31_fla.badKing1PanelBack_529)
package QFP2_AB_v31_fla {
import flash.display.*;
public dynamic class badKing1PanelBack_529 extends MovieClip {
public var expressions:MovieClip;
public function badKing1PanelBack_529(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package QFP2_AB_v31_fla
Section 163
//badKing2Expressions_533 (QFP2_AB_v31_fla.badKing2Expressions_533)
package QFP2_AB_v31_fla {
import flash.display.*;
public dynamic class badKing2Expressions_533 extends MovieClip {
public function badKing2Expressions_533(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package QFP2_AB_v31_fla
Section 164
//badKing4Expressions_539 (QFP2_AB_v31_fla.badKing4Expressions_539)
package QFP2_AB_v31_fla {
import flash.display.*;
public dynamic class badKing4Expressions_539 extends MovieClip {
public function badKing4Expressions_539(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package QFP2_AB_v31_fla
Section 165
//badKing6Expressions_542 (QFP2_AB_v31_fla.badKing6Expressions_542)
package QFP2_AB_v31_fla {
import flash.display.*;
public dynamic class badKing6Expressions_542 extends MovieClip {
public function badKing6Expressions_542(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package QFP2_AB_v31_fla
Section 166
//badKingDie1_147 (QFP2_AB_v31_fla.badKingDie1_147)
package QFP2_AB_v31_fla {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.geom.*;
import flash.filters.*;
import flash.net.*;
import flash.text.*;
import flash.utils.*;
import flash.system.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.ui.*;
import flash.xml.*;
public dynamic class badKingDie1_147 extends MovieClip {
public function badKingDie1_147(){
addFrameScript(19, frame20);
}
function frame20(){
MovieClip(this.parent).removeMe();
stop();
}
}
}//package QFP2_AB_v31_fla
Section 167
//badKingDie2_228 (QFP2_AB_v31_fla.badKingDie2_228)
package QFP2_AB_v31_fla {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.geom.*;
import flash.filters.*;
import flash.net.*;
import flash.text.*;
import flash.utils.*;
import flash.system.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.ui.*;
import flash.xml.*;
public dynamic class badKingDie2_228 extends MovieClip {
public function badKingDie2_228(){
addFrameScript(19, frame20);
}
function frame20(){
MovieClip(this.parent).removeMe();
stop();
}
}
}//package QFP2_AB_v31_fla
Section 168
//badKingDie3_239 (QFP2_AB_v31_fla.badKingDie3_239)
package QFP2_AB_v31_fla {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.geom.*;
import flash.filters.*;
import flash.net.*;
import flash.text.*;
import flash.utils.*;
import flash.system.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.ui.*;
import flash.xml.*;
public dynamic class badKingDie3_239 extends MovieClip {
public function badKingDie3_239(){
addFrameScript(19, frame20);
}
function frame20(){
MovieClip(this.parent).removeMe();
stop();
}
}
}//package QFP2_AB_v31_fla
Section 169
//badKingDie4_251 (QFP2_AB_v31_fla.badKingDie4_251)
package QFP2_AB_v31_fla {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.geom.*;
import flash.filters.*;
import flash.net.*;
import flash.text.*;
import flash.utils.*;
import flash.system.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.ui.*;
import flash.xml.*;
public dynamic class badKingDie4_251 extends MovieClip {
public function badKingDie4_251(){
addFrameScript(19, frame20);
}
function frame20(){
MovieClip(this.parent).removeMe();
stop();
}
}
}//package QFP2_AB_v31_fla
Section 170
//badKingDie5_264 (QFP2_AB_v31_fla.badKingDie5_264)
package QFP2_AB_v31_fla {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.geom.*;
import flash.filters.*;
import flash.net.*;
import flash.text.*;
import flash.utils.*;
import flash.system.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.ui.*;
import flash.xml.*;
public dynamic class badKingDie5_264 extends MovieClip {
public function badKingDie5_264(){
addFrameScript(19, frame20);
}
function frame20(){
MovieClip(this.parent).removeMe();
stop();
}
}
}//package QFP2_AB_v31_fla
Section 171
//badKingDie6_269 (QFP2_AB_v31_fla.badKingDie6_269)
package QFP2_AB_v31_fla {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.geom.*;
import flash.filters.*;
import flash.net.*;
import flash.text.*;
import flash.utils.*;
import flash.system.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.ui.*;
import flash.xml.*;
public dynamic class badKingDie6_269 extends MovieClip {
public function badKingDie6_269(){
addFrameScript(12, frame13);
}
function frame13(){
MovieClip(this.parent).removeMe();
stop();
}
}
}//package QFP2_AB_v31_fla
Section 172
//badKingDie7_275 (QFP2_AB_v31_fla.badKingDie7_275)
package QFP2_AB_v31_fla {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.geom.*;
import flash.filters.*;
import flash.net.*;
import flash.text.*;
import flash.utils.*;
import flash.system.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.ui.*;
import flash.xml.*;
public dynamic class badKingDie7_275 extends MovieClip {
public function badKingDie7_275(){
addFrameScript(13, frame14);
}
function frame14(){
MovieClip(this.parent).removeMe();
stop();
}
}
}//package QFP2_AB_v31_fla
Section 173
//badKnightDie2_124 (QFP2_AB_v31_fla.badKnightDie2_124)
package QFP2_AB_v31_fla {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.geom.*;
import flash.filters.*;
import flash.net.*;
import flash.text.*;
import flash.utils.*;
import flash.system.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.ui.*;
import flash.xml.*;
public dynamic class badKnightDie2_124 extends MovieClip {
public function badKnightDie2_124(){
addFrameScript(20, frame21);
}
function frame21(){
MovieClip(this.parent).removeMe();
stop();
}
}
}//package QFP2_AB_v31_fla
Section 174
//badKnightDie3_178 (QFP2_AB_v31_fla.badKnightDie3_178)
package QFP2_AB_v31_fla {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.geom.*;
import flash.filters.*;
import flash.net.*;
import flash.text.*;
import flash.utils.*;
import flash.system.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.ui.*;
import flash.xml.*;
public dynamic class badKnightDie3_178 extends MovieClip {
public function badKnightDie3_178(){
addFrameScript(21, frame22);
}
function frame22(){
MovieClip(this.parent).removeMe();
stop();
}
}
}//package QFP2_AB_v31_fla
Section 175
//badKnightDie3b_158 (QFP2_AB_v31_fla.badKnightDie3b_158)
package QFP2_AB_v31_fla {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.geom.*;
import flash.filters.*;
import flash.net.*;
import flash.text.*;
import flash.utils.*;
import flash.system.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.ui.*;
import flash.xml.*;
public dynamic class badKnightDie3b_158 extends MovieClip {
public function badKnightDie3b_158(){
addFrameScript(20, frame21);
}
function frame21(){
MovieClip(this.parent).removeMe();
stop();
}
}
}//package QFP2_AB_v31_fla
Section 176
//basicFlag_397 (QFP2_AB_v31_fla.basicFlag_397)
package QFP2_AB_v31_fla {
import flash.display.*;
public dynamic class basicFlag_397 extends MovieClip {
public function basicFlag_397(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package QFP2_AB_v31_fla
Section 177
//basicFlag2_396 (QFP2_AB_v31_fla.basicFlag2_396)
package QFP2_AB_v31_fla {
import flash.display.*;
public dynamic class basicFlag2_396 extends MovieClip {
public var flag4b:MovieClip;
public var flag4c:MovieClip;
public var flag4d:MovieClip;
public var flag4a:MovieClip;
}
}//package QFP2_AB_v31_fla
Section 178
//basicFlag3_395 (QFP2_AB_v31_fla.basicFlag3_395)
package QFP2_AB_v31_fla {
import flash.display.*;
public dynamic class basicFlag3_395 extends MovieClip {
public var flag3a:MovieClip;
public var flag3b:MovieClip;
}
}//package QFP2_AB_v31_fla
Section 179
//bird_die_328 (QFP2_AB_v31_fla.bird_die_328)
package QFP2_AB_v31_fla {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.geom.*;
import flash.filters.*;
import flash.net.*;
import flash.text.*;
import flash.utils.*;
import flash.system.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.ui.*;
import flash.xml.*;
public dynamic class bird_die_328 extends MovieClip {
public function bird_die_328(){
addFrameScript(19, frame20);
}
function frame20(){
MovieClip(this.parent).myObject.remove();
stop();
}
}
}//package QFP2_AB_v31_fla
Section 180
//bird_fly_322 (QFP2_AB_v31_fla.bird_fly_322)
package QFP2_AB_v31_fla {
import flash.display.*;
public dynamic class bird_fly_322 extends MovieClip {
public var rock:GameRock;
}
}//package QFP2_AB_v31_fla
Section 181
//bottomPanelKingsPicBack_525 (QFP2_AB_v31_fla.bottomPanelKingsPicBack_525)
package QFP2_AB_v31_fla {
import flash.display.*;
public dynamic class bottomPanelKingsPicBack_525 extends MovieClip {
public var expressions:MovieClip;
}
}//package QFP2_AB_v31_fla
Section 182
//castleBlock_38 (QFP2_AB_v31_fla.castleBlock_38)
package QFP2_AB_v31_fla {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.geom.*;
import flash.filters.*;
import flash.net.*;
import flash.text.*;
import flash.utils.*;
import flash.system.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.ui.*;
import flash.xml.*;
public dynamic class castleBlock_38 extends MovieClip {
public function castleBlock_38(){
addFrameScript(0, frame1, 7, frame8);
}
function frame1(){
stop();
}
function frame8(){
MovieClip(this.parent).removeMe();
}
}
}//package QFP2_AB_v31_fla
Section 183
//catapultNeedle_348 (QFP2_AB_v31_fla.catapultNeedle_348)
package QFP2_AB_v31_fla {
import flash.display.*;
public dynamic class catapultNeedle_348 extends MovieClip {
public var endMc:MovieClip;
}
}//package QFP2_AB_v31_fla
Section 184
//clockAnim_355 (QFP2_AB_v31_fla.clockAnim_355)
package QFP2_AB_v31_fla {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.geom.*;
import flash.filters.*;
import flash.net.*;
import flash.text.*;
import flash.utils.*;
import flash.system.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.ui.*;
import flash.xml.*;
public dynamic class clockAnim_355 extends MovieClip {
public function clockAnim_355(){
addFrameScript(44, frame45);
}
function frame45(){
MovieClip(this.parent.parent).rt.setupGoodGuy(this);
if (MovieClip(this.parent).numberOrdered.text != 0){
gotoAndPlay(1);
} else {
MovieClip(this.parent).gotoAndStop(1);
};
}
}
}//package QFP2_AB_v31_fla
Section 185
//clockAnim2_357 (QFP2_AB_v31_fla.clockAnim2_357)
package QFP2_AB_v31_fla {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.geom.*;
import flash.filters.*;
import flash.net.*;
import flash.text.*;
import flash.utils.*;
import flash.system.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.ui.*;
import flash.xml.*;
public dynamic class clockAnim2_357 extends MovieClip {
public function clockAnim2_357(){
addFrameScript(17, frame18);
}
function frame18(){
MovieClip(this.parent.parent).rt.setupGoodGuy(this);
if (MovieClip(this.parent).numberOrdered.text != 0){
gotoAndPlay(1);
} else {
MovieClip(this.parent).gotoAndStop(1);
};
}
}
}//package QFP2_AB_v31_fla
Section 186
//crossbowManAttack1_106 (QFP2_AB_v31_fla.crossbowManAttack1_106)
package QFP2_AB_v31_fla {
import flash.display.*;
public dynamic class crossbowManAttack1_106 extends MovieClip {
public function crossbowManAttack1_106(){
addFrameScript(10, frame11);
}
function frame11(){
stop();
}
}
}//package QFP2_AB_v31_fla
Section 187
//crossbowManDie1_110 (QFP2_AB_v31_fla.crossbowManDie1_110)
package QFP2_AB_v31_fla {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.geom.*;
import flash.filters.*;
import flash.net.*;
import flash.text.*;
import flash.utils.*;
import flash.system.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.ui.*;
import flash.xml.*;
public dynamic class crossbowManDie1_110 extends MovieClip {
public function crossbowManDie1_110(){
addFrameScript(20, frame21);
}
function frame21(){
MovieClip(this.parent).removeMe();
stop();
}
}
}//package QFP2_AB_v31_fla
Section 188
//dragon_die_337 (QFP2_AB_v31_fla.dragon_die_337)
package QFP2_AB_v31_fla {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.geom.*;
import flash.filters.*;
import flash.net.*;
import flash.text.*;
import flash.utils.*;
import flash.system.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.ui.*;
import flash.xml.*;
public dynamic class dragon_die_337 extends MovieClip {
public function dragon_die_337(){
addFrameScript(19, frame20);
}
function frame20(){
MovieClip(this.parent).myObject.remove();
stop();
}
}
}//package QFP2_AB_v31_fla
Section 189
//Endtitle_577 (QFP2_AB_v31_fla.Endtitle_577)
package QFP2_AB_v31_fla {
import flash.display.*;
public dynamic class Endtitle_577 extends MovieClip {
public function Endtitle_577(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package QFP2_AB_v31_fla
Section 190
//enemyBlock_205 (QFP2_AB_v31_fla.enemyBlock_205)
package QFP2_AB_v31_fla {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.geom.*;
import flash.filters.*;
import flash.net.*;
import flash.text.*;
import flash.utils.*;
import flash.system.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.ui.*;
import flash.xml.*;
public dynamic class enemyBlock_205 extends MovieClip {
public function enemyBlock_205(){
addFrameScript(0, frame1, 7, frame8);
}
function frame1(){
stop();
}
function frame8(){
MovieClip(this.parent).removeMe();
}
}
}//package QFP2_AB_v31_fla
Section 191
//EnglandMap2_398 (QFP2_AB_v31_fla.EnglandMap2_398)
package QFP2_AB_v31_fla {
import flash.display.*;
public dynamic class EnglandMap2_398 extends MovieClip {
public function EnglandMap2_398(){
addFrameScript(23, frame24);
}
function frame24(){
stop();
}
}
}//package QFP2_AB_v31_fla
Section 192
//explodeBullet_623 (QFP2_AB_v31_fla.explodeBullet_623)
package QFP2_AB_v31_fla {
import flash.display.*;
public dynamic class explodeBullet_623 extends MovieClip {
public function explodeBullet_623(){
addFrameScript(4, frame5);
}
function frame5(){
}
}
}//package QFP2_AB_v31_fla
Section 193
//frontScreenAnim_586 (QFP2_AB_v31_fla.frontScreenAnim_586)
package QFP2_AB_v31_fla {
import flash.display.*;
public dynamic class frontScreenAnim_586 extends MovieClip {
public var soldier:MovieClip;
public var bird:MovieClip;
}
}//package QFP2_AB_v31_fla
Section 194
//gameCompleteAnim_563 (QFP2_AB_v31_fla.gameCompleteAnim_563)
package QFP2_AB_v31_fla {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.geom.*;
import flash.filters.*;
import flash.net.*;
import flash.text.*;
import flash.utils.*;
import flash.system.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.ui.*;
import flash.xml.*;
public dynamic class gameCompleteAnim_563 extends MovieClip {
public function gameCompleteAnim_563(){
addFrameScript(241, frame242);
}
function frame242(){
MovieClip(parent.parent).rt.gameComplete();
stop();
}
}
}//package QFP2_AB_v31_fla
Section 195
//gameoverFilter_578 (QFP2_AB_v31_fla.gameoverFilter_578)
package QFP2_AB_v31_fla {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.geom.*;
import flash.filters.*;
import flash.net.*;
import flash.text.*;
import flash.utils.*;
import flash.system.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.ui.*;
import flash.xml.*;
public dynamic class gameoverFilter_578 extends MovieClip {
public var submitBtn:SimpleButton;
public var moreGamesBtn:SimpleButton;
public var score:TextField;
public var quitBtn:SimpleButton;
public var nameTxt:TextField;
public function gameoverFilter_578(){
addFrameScript(0, frame1, 1, frame2);
}
public function doRestart(_arg1:MouseEvent):void{
MovieClip(this.parent.parent).rt.restartLevel();
}
public function doViewScores(_arg1:MouseEvent):void{
}
public function doMoreGames(_arg1:MouseEvent):void{
navigateToURL(new URLRequest("http://www.arcadebomb.com"), "_blank");
}
function frame1(){
score.text = MovieClip(this.parent.parent).rt.score;
submitBtn.addEventListener(MouseEvent.MOUSE_UP, doSubmit);
moreGamesBtn.addEventListener(MouseEvent.MOUSE_UP, doMoreGames);
quitBtn.addEventListener(MouseEvent.MOUSE_UP, doQuit);
stop();
}
public function doSubmit(_arg1:MouseEvent):void{
if (nameTxt.text != ""){
MovieClip(this.parent.parent).buttonPressed(nameTxt.text, MovieClip(this.parent.parent).rt.score);
gotoAndStop(2);
};
}
function frame2(){
score.text = MovieClip(this.parent.parent).rt.score;
moreGamesBtn.addEventListener(MouseEvent.MOUSE_UP, doMoreGames);
quitBtn.addEventListener(MouseEvent.MOUSE_UP, doQuit);
stop();
}
public function doQuit(_arg1:MouseEvent):void{
MovieClip(this.parent.parent).rt.quitGame();
}
}
}//package QFP2_AB_v31_fla
Section 196
//gameOverMsg_568 (QFP2_AB_v31_fla.gameOverMsg_568)
package QFP2_AB_v31_fla {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.geom.*;
import flash.filters.*;
import flash.net.*;
import flash.text.*;
import flash.utils.*;
import flash.system.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.ui.*;
import flash.xml.*;
public dynamic class gameOverMsg_568 extends MovieClip {
public var endTitle:MovieClip;
public var msg:MovieClip;
public function gameOverMsg_568(){
addFrameScript(0, frame1, 9, frame10, 13, frame14);
}
function frame10(){
if (MovieClip(this.parent).rt.levelNumber >= MovieClip(this.parent).rt.maxLevels){
endTitle.gotoAndStop(2);
};
if (MovieClip(this.parent).rt.rt.mindJolt == true){
msg.gotoAndStop(3);
};
}
function frame14(){
stop();
}
function frame1(){
stop();
}
}
}//package QFP2_AB_v31_fla
Section 197
//gameSolderWizard_305 (QFP2_AB_v31_fla.gameSolderWizard_305)
package QFP2_AB_v31_fla {
import flash.display.*;
public dynamic class gameSolderWizard_305 extends MovieClip {
public function gameSolderWizard_305(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package QFP2_AB_v31_fla
Section 198
//gameSoldier1_50 (QFP2_AB_v31_fla.gameSoldier1_50)
package QFP2_AB_v31_fla {
import flash.display.*;
public dynamic class gameSoldier1_50 extends MovieClip {
public function gameSoldier1_50(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package QFP2_AB_v31_fla
Section 199
//gameSoldier2_65 (QFP2_AB_v31_fla.gameSoldier2_65)
package QFP2_AB_v31_fla {
import flash.display.*;
public dynamic class gameSoldier2_65 extends MovieClip {
public function gameSoldier2_65(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package QFP2_AB_v31_fla
Section 200
//gameSoldier3_81 (QFP2_AB_v31_fla.gameSoldier3_81)
package QFP2_AB_v31_fla {
import flash.display.*;
public dynamic class gameSoldier3_81 extends MovieClip {
public var archer:MovieClip;
public function gameSoldier3_81(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package QFP2_AB_v31_fla
Section 201
//GameSoldier5_277 (QFP2_AB_v31_fla.GameSoldier5_277)
package QFP2_AB_v31_fla {
import flash.display.*;
public dynamic class GameSoldier5_277 extends MovieClip {
public function GameSoldier5_277(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package QFP2_AB_v31_fla
Section 202
//goodKingDie_134 (QFP2_AB_v31_fla.goodKingDie_134)
package QFP2_AB_v31_fla {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.geom.*;
import flash.filters.*;
import flash.net.*;
import flash.text.*;
import flash.utils.*;
import flash.system.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.ui.*;
import flash.xml.*;
public dynamic class goodKingDie_134 extends MovieClip {
public function goodKingDie_134(){
addFrameScript(19, frame20);
}
function frame20(){
MovieClip(this.parent).rt.rt.gameOver("game_over");
stop();
}
}
}//package QFP2_AB_v31_fla
Section 203
//goodKingExpressions_526 (QFP2_AB_v31_fla.goodKingExpressions_526)
package QFP2_AB_v31_fla {
import flash.display.*;
public dynamic class goodKingExpressions_526 extends MovieClip {
public function goodKingExpressions_526(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package QFP2_AB_v31_fla
Section 204
//halfWayFlag_393 (QFP2_AB_v31_fla.halfWayFlag_393)
package QFP2_AB_v31_fla {
import flash.display.*;
public dynamic class halfWayFlag_393 extends MovieClip {
public var flag2:MovieClip;
}
}//package QFP2_AB_v31_fla
Section 205
//instructionsBtns_630 (QFP2_AB_v31_fla.instructionsBtns_630)
package QFP2_AB_v31_fla {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.geom.*;
import flash.filters.*;
import flash.net.*;
import flash.text.*;
import flash.utils.*;
import flash.system.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.ui.*;
import flash.xml.*;
public dynamic class instructionsBtns_630 extends MovieClip {
public var backBtn:SimpleButton;
public var nextBtn:SimpleButton;
public var endBtn:SimpleButton;
public var startBtn:SimpleButton;
public function instructionsBtns_630(){
addFrameScript(0, frame1);
}
function frame1(){
startBtn.addEventListener(MouseEvent.MOUSE_DOWN, gotoStart, false);
endBtn.addEventListener(MouseEvent.MOUSE_DOWN, gotoEnd, false);
backBtn.addEventListener(MouseEvent.MOUSE_DOWN, gotoBack, false);
nextBtn.addEventListener(MouseEvent.MOUSE_DOWN, gotoNext, false);
}
public function gotoEnd(_arg1:MouseEvent):void{
MovieClip(parent).vid.gotoAndStop(MovieClip(parent).vid.totalFrames);
MovieClip(parent).txt.gotoAndStop(MovieClip(parent).txt.totalFrames);
}
public function gotoStart(_arg1:MouseEvent):void{
MovieClip(parent).vid.gotoAndStop(1);
MovieClip(parent).txt.gotoAndStop(1);
}
public function gotoBack(_arg1:MouseEvent):void{
if (MovieClip(parent).vid.currentFrame == 1){
MovieClip(parent).vid.gotoAndStop(MovieClip(parent).vid.totalFrames);
} else {
MovieClip(parent).vid.gotoAndStop((MovieClip(parent).vid.currentFrame - 1));
};
if (MovieClip(parent).txt.currentFrame == 1){
MovieClip(parent).txt.gotoAndStop(MovieClip(parent).txt.totalFrames);
} else {
MovieClip(parent).txt.gotoAndStop((MovieClip(parent).txt.currentFrame - 1));
};
}
public function gotoNext(_arg1:MouseEvent):void{
if (MovieClip(parent).vid.currentFrame == MovieClip(parent).vid.totalFrames){
MovieClip(parent).vid.gotoAndStop(1);
} else {
MovieClip(parent).vid.gotoAndStop((MovieClip(parent).vid.currentFrame + 1));
};
if (MovieClip(parent).txt.currentFrame == MovieClip(parent).txt.totalFrames){
MovieClip(parent).txt.gotoAndStop(1);
} else {
MovieClip(parent).txt.gotoAndStop((MovieClip(parent).txt.currentFrame + 1));
};
}
}
}//package QFP2_AB_v31_fla
Section 206
//instructionsTxtScreens_629 (QFP2_AB_v31_fla.instructionsTxtScreens_629)
package QFP2_AB_v31_fla {
import flash.display.*;
public dynamic class instructionsTxtScreens_629 extends MovieClip {
public function instructionsTxtScreens_629(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package QFP2_AB_v31_fla
Section 207
//instructionsVidPanel_637 (QFP2_AB_v31_fla.instructionsVidPanel_637)
package QFP2_AB_v31_fla {
import flash.display.*;
public dynamic class instructionsVidPanel_637 extends MovieClip {
public var soldier:MovieClip;
public function instructionsVidPanel_637(){
addFrameScript(0, frame1);
}
function frame1(){
gotoAndStop(1);
}
}
}//package QFP2_AB_v31_fla
Section 208
//king3Expressions_536 (QFP2_AB_v31_fla.king3Expressions_536)
package QFP2_AB_v31_fla {
import flash.display.*;
public dynamic class king3Expressions_536 extends MovieClip {
public function king3Expressions_536(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package QFP2_AB_v31_fla
Section 209
//knight4_310 (QFP2_AB_v31_fla.knight4_310)
package QFP2_AB_v31_fla {
import flash.display.*;
public dynamic class knight4_310 extends MovieClip {
public function knight4_310(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package QFP2_AB_v31_fla
Section 210
//knightDie1_62 (QFP2_AB_v31_fla.knightDie1_62)
package QFP2_AB_v31_fla {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.geom.*;
import flash.filters.*;
import flash.net.*;
import flash.text.*;
import flash.utils.*;
import flash.system.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.ui.*;
import flash.xml.*;
public dynamic class knightDie1_62 extends MovieClip {
public function knightDie1_62(){
addFrameScript(19, frame20);
}
function frame20(){
MovieClip(this.parent.parent).removeMe();
stop();
}
}
}//package QFP2_AB_v31_fla
Section 211
//knightDie2_79 (QFP2_AB_v31_fla.knightDie2_79)
package QFP2_AB_v31_fla {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.geom.*;
import flash.filters.*;
import flash.net.*;
import flash.text.*;
import flash.utils.*;
import flash.system.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.ui.*;
import flash.xml.*;
public dynamic class knightDie2_79 extends MovieClip {
public function knightDie2_79(){
addFrameScript(19, frame20);
}
function frame20(){
MovieClip(this.parent.parent).removeMe();
stop();
}
}
}//package QFP2_AB_v31_fla
Section 212
//knightDie4_296 (QFP2_AB_v31_fla.knightDie4_296)
package QFP2_AB_v31_fla {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.geom.*;
import flash.filters.*;
import flash.net.*;
import flash.text.*;
import flash.utils.*;
import flash.system.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.ui.*;
import flash.xml.*;
public dynamic class knightDie4_296 extends MovieClip {
public function knightDie4_296(){
addFrameScript(12, frame13);
}
function frame13(){
MovieClip(this.parent.parent).removeMe();
stop();
}
}
}//package QFP2_AB_v31_fla
Section 213
//knightDie5_320 (QFP2_AB_v31_fla.knightDie5_320)
package QFP2_AB_v31_fla {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.geom.*;
import flash.filters.*;
import flash.net.*;
import flash.text.*;
import flash.utils.*;
import flash.system.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.ui.*;
import flash.xml.*;
public dynamic class knightDie5_320 extends MovieClip {
public function knightDie5_320(){
addFrameScript(19, frame20);
}
function frame20(){
MovieClip(this.parent.parent).removeMe();
stop();
}
}
}//package QFP2_AB_v31_fla
Section 214
//levelCompleteMsg_561 (QFP2_AB_v31_fla.levelCompleteMsg_561)
package QFP2_AB_v31_fla {
import flash.display.*;
import flash.text.*;
public dynamic class levelCompleteMsg_561 extends MovieClip {
public var titleMc:levelCompleteMsgs;
public var timeBonus:TextField;
public var scoreBonus:TextField;
public var totalScore:TextField;
public function levelCompleteMsg_561(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package QFP2_AB_v31_fla
Section 215
//manStoneHitBack_477 (QFP2_AB_v31_fla.manStoneHitBack_477)
package QFP2_AB_v31_fla {
import flash.display.*;
public dynamic class manStoneHitBack_477 extends MovieClip {
public function manStoneHitBack_477(){
addFrameScript(9, frame10);
}
function frame10(){
MovieClip(this.parent).gotoAndStop("walk");
}
}
}//package QFP2_AB_v31_fla
Section 216
//mapScreenFlags_391 (QFP2_AB_v31_fla.mapScreenFlags_391)
package QFP2_AB_v31_fla {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.geom.*;
import flash.filters.*;
import flash.net.*;
import flash.text.*;
import flash.utils.*;
import flash.system.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.ui.*;
import flash.xml.*;
public dynamic class mapScreenFlags_391 extends MovieClip {
public var flagMc:halfWayFlag;
public var flagNumber:Number;
public function mapScreenFlags_391(){
addFrameScript(0, frame1);
}
function frame1(){
flagNumber = 15;
flagMc.flag1.flag2.flag3a.flag4a.gotoAndStop(flagNumber);
flagMc.flag1.flag2.flag3a.flag4b.gotoAndStop(flagNumber);
flagMc.flag1.flag2.flag3a.flag4c.gotoAndStop(flagNumber);
flagMc.flag1.flag2.flag3a.flag4d.gotoAndStop(flagNumber);
flagMc.flag1.flag2.flag3b.flag4a.gotoAndStop(flagNumber);
flagMc.flag1.flag2.flag3b.flag4b.gotoAndStop(flagNumber);
flagMc.flag1.flag2.flag3b.flag4c.gotoAndStop(flagNumber);
flagMc.flag1.flag2.flag3b.flag4d.gotoAndStop(flagNumber);
}
}
}//package QFP2_AB_v31_fla
Section 217
//mapScreenFlags2_390 (QFP2_AB_v31_fla.mapScreenFlags2_390)
package QFP2_AB_v31_fla {
import flash.display.*;
public dynamic class mapScreenFlags2_390 extends MovieClip {
public function mapScreenFlags2_390(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package QFP2_AB_v31_fla
Section 218
//mapScreenScene_407 (QFP2_AB_v31_fla.mapScreenScene_407)
package QFP2_AB_v31_fla {
import flash.display.*;
import flash.text.*;
public dynamic class mapScreenScene_407 extends MovieClip {
public var defenseTxt:TextField;
public var rulerTxt:TextField;
public var kingBadHead:MovieClip;
}
}//package QFP2_AB_v31_fla
Section 219
//merlinAnim_575 (QFP2_AB_v31_fla.merlinAnim_575)
package QFP2_AB_v31_fla {
import flash.display.*;
public dynamic class merlinAnim_575 extends MovieClip {
public function merlinAnim_575(){
addFrameScript(160, frame161);
}
function frame161(){
MovieClip(parent.parent).play();
stop();
}
}
}//package QFP2_AB_v31_fla
Section 220
//musicBtn2_513 (QFP2_AB_v31_fla.musicBtn2_513)
package QFP2_AB_v31_fla {
import flash.display.*;
public dynamic class musicBtn2_513 extends MovieClip {
public function musicBtn2_513(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package QFP2_AB_v31_fla
Section 221
//musicBtnMc_614 (QFP2_AB_v31_fla.musicBtnMc_614)
package QFP2_AB_v31_fla {
import flash.display.*;
public dynamic class musicBtnMc_614 extends MovieClip {
public function musicBtnMc_614(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package QFP2_AB_v31_fla
Section 222
//QFP_Title_Anim_604 (QFP2_AB_v31_fla.QFP_Title_Anim_604)
package QFP2_AB_v31_fla {
import flash.display.*;
public dynamic class QFP_Title_Anim_604 extends MovieClip {
public function QFP_Title_Anim_604(){
addFrameScript(770, frame771);
}
function frame771(){
stop();
}
}
}//package QFP2_AB_v31_fla
Section 223
//ramDie1_36 (QFP2_AB_v31_fla.ramDie1_36)
package QFP2_AB_v31_fla {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.geom.*;
import flash.filters.*;
import flash.net.*;
import flash.text.*;
import flash.utils.*;
import flash.system.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.ui.*;
import flash.xml.*;
public dynamic class ramDie1_36 extends MovieClip {
public function ramDie1_36(){
addFrameScript(20, frame21);
}
function frame21(){
MovieClip(this.parent).removeMe();
stop();
}
}
}//package QFP2_AB_v31_fla
Section 224
//righgSpeechBubble_551 (QFP2_AB_v31_fla.righgSpeechBubble_551)
package QFP2_AB_v31_fla {
import flash.display.*;
import flash.text.*;
public dynamic class righgSpeechBubble_551 extends MovieClip {
public var txt:TextField;
public function righgSpeechBubble_551(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package QFP2_AB_v31_fla
Section 225
//risingScoreTxt_489 (QFP2_AB_v31_fla.risingScoreTxt_489)
package QFP2_AB_v31_fla {
import flash.display.*;
import flash.text.*;
public dynamic class risingScoreTxt_489 extends MovieClip {
public var scoreTxt:TextField;
}
}//package QFP2_AB_v31_fla
Section 226
//soldierDeath_466 (QFP2_AB_v31_fla.soldierDeath_466)
package QFP2_AB_v31_fla {
import flash.display.*;
public dynamic class soldierDeath_466 extends MovieClip {
public function soldierDeath_466(){
addFrameScript(12, frame13);
}
function frame13(){
stop();
}
}
}//package QFP2_AB_v31_fla
Section 227
//soldierHit_465 (QFP2_AB_v31_fla.soldierHit_465)
package QFP2_AB_v31_fla {
import flash.display.*;
public dynamic class soldierHit_465 extends MovieClip {
public function soldierHit_465(){
addFrameScript(8, frame9);
}
function frame9(){
MovieClip(this.parent).gotoAndStop("gunStand");
}
}
}//package QFP2_AB_v31_fla
Section 228
//soundFxBtn2_511 (QFP2_AB_v31_fla.soundFxBtn2_511)
package QFP2_AB_v31_fla {
import flash.display.*;
public dynamic class soundFxBtn2_511 extends MovieClip {
public function soundFxBtn2_511(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package QFP2_AB_v31_fla
Section 229
//sparker_randomizer_625 (QFP2_AB_v31_fla.sparker_randomizer_625)
package QFP2_AB_v31_fla {
import flash.display.*;
public dynamic class sparker_randomizer_625 extends MovieClip {
public function sparker_randomizer_625(){
addFrameScript(54, frame55);
}
function frame55(){
stop();
}
}
}//package QFP2_AB_v31_fla
Section 230
//splarkler_particle_627 (QFP2_AB_v31_fla.splarkler_particle_627)
package QFP2_AB_v31_fla {
import flash.display.*;
public dynamic class splarkler_particle_627 extends MovieClip {
public function splarkler_particle_627(){
addFrameScript(27, frame28);
}
function frame28(){
stop();
}
}
}//package QFP2_AB_v31_fla
Section 231
//timerAnimMc_553 (QFP2_AB_v31_fla.timerAnimMc_553)
package QFP2_AB_v31_fla {
import flash.display.*;
public dynamic class timerAnimMc_553 extends MovieClip {
public var timer:MovieClip;
public var numberOfBubbles:Number;
public var delay:Number;
public var maskMc:MovieClip;
public var bubbleCounter:Number;
public function timerAnimMc_553(){
addFrameScript(0, frame1);
}
function frame1(){
numberOfBubbles = 10;
bubbleCounter = 0;
delay = 10;
}
}
}//package QFP2_AB_v31_fla
Section 232
//upgradeBack_652 (QFP2_AB_v31_fla.upgradeBack_652)
package QFP2_AB_v31_fla {
import flash.display.*;
public dynamic class upgradeBack_652 extends MovieClip {
public function upgradeBack_652(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package QFP2_AB_v31_fla
Section 233
//upgradeClock_653 (QFP2_AB_v31_fla.upgradeClock_653)
package QFP2_AB_v31_fla {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.geom.*;
import flash.filters.*;
import flash.net.*;
import flash.text.*;
import flash.utils.*;
import flash.system.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.ui.*;
import flash.xml.*;
public dynamic class upgradeClock_653 extends MovieClip {
public function upgradeClock_653(){
addFrameScript(35, frame36);
}
function frame36(){
MovieClip(this.parent.parent).setupUpgrade();
MovieClip(this.parent).gotoAndStop(3);
}
}
}//package QFP2_AB_v31_fla
Section 234
//weapons_470 (QFP2_AB_v31_fla.weapons_470)
package QFP2_AB_v31_fla {
import flash.display.*;
public dynamic class weapons_470 extends MovieClip {
public function weapons_470(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package QFP2_AB_v31_fla
Section 235
//vikingDie1_195 (QFP2_AB_v31_fla.vikingDie1_195)
package QFP2_AB_v31_fla {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.geom.*;
import flash.filters.*;
import flash.net.*;
import flash.text.*;
import flash.utils.*;
import flash.system.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.ui.*;
import flash.xml.*;
public dynamic class vikingDie1_195 extends MovieClip {
public function vikingDie1_195(){
addFrameScript(20, frame21);
}
function frame21(){
MovieClip(this.parent).removeMe();
stop();
}
}
}//package QFP2_AB_v31_fla
Section 236
//wizardDie_308 (QFP2_AB_v31_fla.wizardDie_308)
package QFP2_AB_v31_fla {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.geom.*;
import flash.filters.*;
import flash.net.*;
import flash.text.*;
import flash.utils.*;
import flash.system.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.ui.*;
import flash.xml.*;
public dynamic class wizardDie_308 extends MovieClip {
public function wizardDie_308(){
addFrameScript(19, frame20);
}
function frame20(){
MovieClip(this.parent.parent).removeMe();
stop();
}
}
}//package QFP2_AB_v31_fla
Section 237
//wizardSide_306 (QFP2_AB_v31_fla.wizardSide_306)
package QFP2_AB_v31_fla {
import flash.display.*;
public dynamic class wizardSide_306 extends MovieClip {
public function wizardSide_306(){
addFrameScript(9, frame10);
}
function frame10(){
stop();
}
}
}//package QFP2_AB_v31_fla
Section 238
//woodBlockEnemy_218 (QFP2_AB_v31_fla.woodBlockEnemy_218)
package QFP2_AB_v31_fla {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.geom.*;
import flash.filters.*;
import flash.net.*;
import flash.text.*;
import flash.utils.*;
import flash.system.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.ui.*;
import flash.xml.*;
public dynamic class woodBlockEnemy_218 extends MovieClip {
public function woodBlockEnemy_218(){
addFrameScript(0, frame1, 7, frame8);
}
function frame1(){
stop();
}
function frame8(){
MovieClip(this.parent).removeMe();
}
}
}//package QFP2_AB_v31_fla
Section 239
//woodenBlock2_209 (QFP2_AB_v31_fla.woodenBlock2_209)
package QFP2_AB_v31_fla {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.geom.*;
import flash.filters.*;
import flash.net.*;
import flash.text.*;
import flash.utils.*;
import flash.system.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.ui.*;
import flash.xml.*;
public dynamic class woodenBlock2_209 extends MovieClip {
public function woodenBlock2_209(){
addFrameScript(0, frame1, 7, frame8);
}
function frame1(){
stop();
}
function frame8(){
MovieClip(this.parent).removeMe();
}
}
}//package QFP2_AB_v31_fla
Section 240
//yuoarehereAnim_420 (QFP2_AB_v31_fla.yuoarehereAnim_420)
package QFP2_AB_v31_fla {
import flash.display.*;
public dynamic class yuoarehereAnim_420 extends MovieClip {
public var youarehere:youarehereMc;
public function yuoarehereAnim_420(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package QFP2_AB_v31_fla
Section 241
//zoom1_545 (QFP2_AB_v31_fla.zoom1_545)
package QFP2_AB_v31_fla {
import flash.display.*;
public dynamic class zoom1_545 extends MovieClip {
public function zoom1_545(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package QFP2_AB_v31_fla
Section 242
//zoom2_547 (QFP2_AB_v31_fla.zoom2_547)
package QFP2_AB_v31_fla {
import flash.display.*;
public dynamic class zoom2_547 extends MovieClip {
public function zoom2_547(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package QFP2_AB_v31_fla
Section 243
//zoom3_548 (QFP2_AB_v31_fla.zoom3_548)
package QFP2_AB_v31_fla {
import flash.display.*;
public dynamic class zoom3_548 extends MovieClip {
public function zoom3_548(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package QFP2_AB_v31_fla
Section 244
//zoom4_549 (QFP2_AB_v31_fla.zoom4_549)
package QFP2_AB_v31_fla {
import flash.display.*;
public dynamic class zoom4_549 extends MovieClip {
public function zoom4_549(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package QFP2_AB_v31_fla
Section 245
//antsMc (antsMc)
package {
import flash.display.*;
public dynamic class antsMc extends BitmapData {
public function antsMc(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 246
//backgroundP (backgroundP)
package {
import flash.display.*;
public dynamic class backgroundP extends MovieClip {
public function backgroundP(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 247
//backgroundSkyMc (backgroundSkyMc)
package {
import flash.display.*;
public dynamic class backgroundSkyMc extends MovieClip {
public function backgroundSkyMc(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 248
//BadGuyRun (BadGuyRun)
package {
import flash.display.*;
public dynamic class BadGuyRun extends MovieClip {
public var w:MovieClip;
}
}//package
Section 249
//batFx (batFx)
package {
import flash.media.*;
public dynamic class batFx extends Sound {
}
}//package
Section 250
//bellFx (bellFx)
package {
import flash.media.*;
public dynamic class bellFx extends Sound {
}
}//package
Section 251
//boulderHitFx (boulderHitFx)
package {
import flash.media.*;
public dynamic class boulderHitFx extends Sound {
}
}//package
Section 252
//bullet (bullet)
package {
import flash.display.*;
public dynamic class bullet extends MovieClip {
}
}//package
Section 253
//catapultBtnMc (catapultBtnMc)
package {
import flash.display.*;
public dynamic class catapultBtnMc extends MovieClip {
}
}//package
Section 254
//catapultCatch (catapultCatch)
package {
import flash.display.*;
public dynamic class catapultCatch extends MovieClip {
}
}//package
Section 255
//catapultDial (catapultDial)
package {
import flash.display.*;
public dynamic class catapultDial extends MovieClip {
public var needle:MovieClip;
}
}//package
Section 256
//catapultWords (catapultWords)
package {
import flash.display.*;
import flash.text.*;
public dynamic class catapultWords extends MovieClip {
public var rangeTxt:TextField;
public function catapultWords(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 257
//clickBtnFx (clickBtnFx)
package {
import flash.media.*;
public dynamic class clickBtnFx extends Sound {
}
}//package
Section 258
//death1 (death1)
package {
import flash.display.*;
public dynamic class death1 extends MovieClip {
public function death1(){
addFrameScript(12, frame13);
}
function frame13(){
stop();
}
}
}//package
Section 259
//die_v1_Fx (die_v1_Fx)
package {
import flash.media.*;
public dynamic class die_v1_Fx extends Sound {
}
}//package
Section 260
//enemyBomb (enemyBomb)
package {
import flash.display.*;
public dynamic class enemyBomb extends MovieClip {
}
}//package
Section 261
//enemyBullet (enemyBullet)
package {
import flash.display.*;
public dynamic class enemyBullet extends MovieClip {
}
}//package
Section 262
//enemyPhoton (enemyPhoton)
package {
import flash.display.*;
public dynamic class enemyPhoton extends MovieClip {
}
}//package
Section 263
//enemyShell (enemyShell)
package {
import flash.display.*;
public dynamic class enemyShell extends MovieClip {
}
}//package
Section 264
//energyBar (energyBar)
package {
import flash.display.*;
public dynamic class energyBar extends MovieClip {
public var bar:MovieClip;
}
}//package
Section 265
//evilWizardMissle (evilWizardMissle)
package {
import flash.display.*;
public dynamic class evilWizardMissle extends MovieClip {
}
}//package
Section 266
//explosion (explosion)
package {
import flash.display.*;
public dynamic class explosion extends MovieClip {
}
}//package
Section 267
//explosionFx (explosionFx)
package {
import flash.media.*;
public dynamic class explosionFx extends Sound {
}
}//package
Section 268
//fireMissileFx (fireMissileFx)
package {
import flash.media.*;
public dynamic class fireMissileFx extends Sound {
}
}//package
Section 269
//GameArrow (GameArrow)
package {
import flash.display.*;
public dynamic class GameArrow extends MovieClip {
}
}//package
Section 270
//GameBird (GameBird)
package {
import flash.display.*;
public dynamic class GameBird extends MovieClip {
public var bird:MovieClip;
public function GameBird(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 271
//GameDragon (GameDragon)
package {
import flash.display.*;
public dynamic class GameDragon extends MovieClip {
public function GameDragon(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 272
//GameFireBall (GameFireBall)
package {
import flash.display.*;
public dynamic class GameFireBall extends MovieClip {
}
}//package
Section 273
//GameIceBolt (GameIceBolt)
package {
import flash.display.*;
public dynamic class GameIceBolt extends MovieClip {
}
}//package
Section 274
//gameOverFx (gameOverFx)
package {
import flash.media.*;
public dynamic class gameOverFx extends Sound {
}
}//package
Section 275
//GameRock (GameRock)
package {
import flash.display.*;
public dynamic class GameRock extends MovieClip {
}
}//package
Section 276
//getReadyMsg (getReadyMsg)
package {
import flash.display.*;
import flash.text.*;
public dynamic class getReadyMsg extends MovieClip {
public var levelText:TextField;
}
}//package
Section 277
//getReadyMsgAnim (getReadyMsgAnim)
package {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.geom.*;
import flash.filters.*;
import flash.net.*;
import flash.text.*;
import flash.utils.*;
import flash.system.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.ui.*;
import flash.xml.*;
public dynamic class getReadyMsgAnim extends MovieClip {
public var msg:getReadyMsg;
public function getReadyMsgAnim(){
addFrameScript(10, frame11, 73, frame74);
}
function frame74(){
MovieClip(parent).rt.gameState = "play";
MovieClip(parent).removeChild(this);
stop();
}
function frame11(){
msg.levelText.text = ("Level " + MovieClip(parent).rt.levelNumber);
}
}
}//package
Section 278
//goodCliff (goodCliff)
package {
import flash.display.*;
public dynamic class goodCliff extends MovieClip {
}
}//package
Section 279
//grenadeMc (grenadeMc)
package {
import flash.display.*;
public dynamic class grenadeMc extends MovieClip {
}
}//package
Section 280
//gunEnergy (gunEnergy)
package {
import flash.display.*;
public dynamic class gunEnergy extends MovieClip {
}
}//package
Section 281
//gunEnergyLevel (gunEnergyLevel)
package {
import flash.display.*;
public dynamic class gunEnergyLevel extends MovieClip {
public var energyLevelMc:gunEnergy;
public function gunEnergyLevel(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 282
//halfWayFlag (halfWayFlag)
package {
import flash.display.*;
public dynamic class halfWayFlag extends MovieClip {
public var flag1:MovieClip;
}
}//package
Section 283
//heavyGunnerGun (heavyGunnerGun)
package {
import flash.display.*;
public dynamic class heavyGunnerGun extends MovieClip {
}
}//package
Section 284
//heavyGunnerWalk (heavyGunnerWalk)
package {
import flash.display.*;
public dynamic class heavyGunnerWalk extends MovieClip {
}
}//package
Section 285
//hitEnemyFx (hitEnemyFx)
package {
import flash.media.*;
public dynamic class hitEnemyFx extends Sound {
}
}//package
Section 286
//knight2 (knight2)
package {
import flash.display.*;
public dynamic class knight2 extends MovieClip {
}
}//package
Section 287
//knightPickedUp (knightPickedUp)
package {
import flash.display.*;
public dynamic class knightPickedUp extends MovieClip {
}
}//package
Section 288
//leftSpeedBubble (leftSpeedBubble)
package {
import flash.display.*;
import flash.text.*;
public dynamic class leftSpeedBubble extends MovieClip {
public var txt:TextField;
public function leftSpeedBubble(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 289
//levelCompleteFx (levelCompleteFx)
package {
import flash.media.*;
public dynamic class levelCompleteFx extends Sound {
}
}//package
Section 290
//levelCompleteMsgs (levelCompleteMsgs)
package {
import flash.display.*;
public dynamic class levelCompleteMsgs extends MovieClip {
public function levelCompleteMsgs(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 291
//LoadingBox (LoadingBox)
package {
import flash.display.*;
public class LoadingBox extends MovieClip {
public var loaderbar:MovieClip;
public function LoadingBox(){
addFrameScript(0, frame1);
}
function frame1(){
}
public function update(_arg1:int):void{
}
}
}//package
Section 292
//magicFx (magicFx)
package {
import flash.media.*;
public dynamic class magicFx extends Sound {
}
}//package
Section 293
//mainGunBullet (mainGunBullet)
package {
import flash.display.*;
public dynamic class mainGunBullet extends MovieClip {
public function mainGunBullet(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 294
//mainGunMissileHitFx (mainGunMissileHitFx)
package {
import flash.media.*;
public dynamic class mainGunMissileHitFx extends Sound {
}
}//package
Section 295
//mainGunSound (mainGunSound)
package {
import flash.media.*;
public dynamic class mainGunSound extends Sound {
}
}//package
Section 296
//man (man)
package {
import flash.display.*;
public dynamic class man extends MovieClip {
public var selectionMc:manSelectionSquare;
}
}//package
Section 297
//manGunStand (manGunStand)
package {
import flash.display.*;
public dynamic class manGunStand extends MovieClip {
public var w:MovieClip;
}
}//package
Section 298
//manSelectionSquare (manSelectionSquare)
package {
import flash.display.*;
public dynamic class manSelectionSquare extends MovieClip {
public function manSelectionSquare(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 299
//mapScreenFx (mapScreenFx)
package {
import flash.media.*;
public dynamic class mapScreenFx extends Sound {
}
}//package
Section 300
//marineEngineer (marineEngineer)
package {
import flash.display.*;
public dynamic class marineEngineer extends MovieClip {
}
}//package
Section 301
//mcTest (mcTest)
package {
import flash.display.*;
public dynamic class mcTest extends MovieClip {
}
}//package
Section 302
//mine (mine)
package {
import flash.display.*;
public dynamic class mine extends MovieClip {
}
}//package
Section 303
//moanFx (moanFx)
package {
import flash.media.*;
public dynamic class moanFx extends Sound {
}
}//package
Section 304
//MochiAd (MochiAd)
package {
import flash.display.*;
import flash.events.*;
import flash.net.*;
import flash.utils.*;
import flash.system.*;
public class MochiAd {
public static function getVersion():String{
return ("2.7");
}
public static function showClickAwayAd(_arg1:Object):void{
var DEFAULTS:Object;
var clip:Object;
var ad_timeout:Number;
var mc:MovieClip;
var wh:Array;
var w:Number;
var h:Number;
var chk:MovieClip;
var sendHostProgress:Boolean;
var options = _arg1;
DEFAULTS = {ad_timeout:2000, regpt:"o", method:"showClickAwayAd", res:"300x250", no_bg:true, ad_started:function ():void{
}, ad_finished:function ():void{
}, ad_loaded:function (_arg1:Number, _arg2:Number):void{
}, ad_failed:function ():void{
}, ad_skipped:function ():void{
}};
options = MochiAd._parseOptions(options, DEFAULTS);
clip = options.clip;
ad_timeout = options.ad_timeout;
delete options.ad_timeout;
if (!MochiAd.load(options)){
options.ad_failed();
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
MochiAd._cleanup(mc);
options.ad_finished();
};
wh = MochiAd._getRes(options, clip);
w = wh[0];
h = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
mc.unloadAd = function ():void{
MochiAd.unload(clip);
};
mc.adLoaded = options.ad_loaded;
mc.adSkipped = options.ad_skipped;
mc.rpc = function (_arg1:Number, _arg2:Object):void{
MochiAd.rpc(clip, _arg1, _arg2);
};
sendHostProgress = false;
mc.regContLC = function (_arg1:String):void{
mc._containerLCName = _arg1;
};
chk["onEnterFrame"] = function ():void{
var _local1:Object;
var _local2:Number;
var _local3:Boolean;
var _local4:Number;
if (!this.parent){
delete this.onEnterFrame;
return;
};
_local1 = this.parent._mochiad_ctr;
_local2 = (getTimer() - this.started);
_local3 = false;
if (!chk.showing){
_local4 = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal;
if (_local4 > 0){
chk.showing = true;
_local3 = true;
chk.started = getTimer();
} else {
if (_local2 > chk.ad_timeout){
options.ad_failed();
_local3 = true;
};
};
};
if (this.root == null){
_local3 = true;
};
if (_local3){
delete this.onEnterFrame;
};
};
doOnEnterFrame(chk);
}
public static function _isNetworkAvailable():Boolean{
return (!((Security.sandboxType == "localWithFile")));
}
public static function _allowDomains(_arg1:String):String{
var _local2:String;
_local2 = _arg1.split("/")[2].split(":")[0];
Security.allowDomain("*");
Security.allowDomain(_local2);
Security.allowInsecureDomain("*");
Security.allowInsecureDomain(_local2);
return (_local2);
}
public static function unload(_arg1:Object):Boolean{
if (((_arg1.clip) && (_arg1.clip._mochiad))){
_arg1 = _arg1.clip;
};
if (_arg1.origFrameRate != undefined){
_arg1.stage.frameRate = _arg1.origFrameRate;
};
if (!_arg1._mochiad){
return (false);
};
if (_arg1._mochiad._containerLCName != undefined){
_arg1._mochiad.lc.send(_arg1._mochiad._containerLCName, "notify", {id:"unload"});
};
if (_arg1._mochiad.onUnload){
_arg1._mochiad.onUnload();
};
delete _arg1._mochiad_loaded;
delete _arg1._mochiad;
return (true);
}
public static function showInterLevelAd(_arg1:Object):void{
var DEFAULTS:Object;
var clip:Object;
var ad_msec:Number;
var ad_timeout:Number;
var fadeout_time:Number;
var mc:MovieClip;
var wh:Array;
var w:Number;
var h:Number;
var chk:MovieClip;
var options = _arg1;
DEFAULTS = {ad_timeout:2000, fadeout_time:250, regpt:"o", method:"showTimedAd", ad_started:function ():void{
if ((this.clip is MovieClip)){
this.clip.stop();
} else {
throw (new Error("MochiAd.showInterLevelAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_finished:function ():void{
if ((this.clip is MovieClip)){
this.clip.play();
} else {
throw (new Error("MochiAd.showInterLevelAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_loaded:function (_arg1:Number, _arg2:Number):void{
}, ad_failed:function ():void{
}, ad_skipped:function ():void{
}};
options = MochiAd._parseOptions(options, DEFAULTS);
clip = options.clip;
ad_msec = 11000;
ad_timeout = options.ad_timeout;
delete options.ad_timeout;
fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!MochiAd.load(options)){
options.ad_failed();
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
MochiAd._cleanup(mc);
options.ad_finished();
};
wh = MochiAd._getRes(options, clip);
w = wh[0];
h = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.ad_msec = ad_msec;
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function ():void{
var _local1:Number;
if (!this.parent){
delete this.onEnterFrame;
delete this.fadeFunction;
return;
};
_local1 = (100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time)));
if (_local1 > 0){
this.parent.alpha = (_local1 * 0.01);
} else {
MochiAd.unload(clip);
delete this["onEnterFrame"];
};
};
mc.unloadAd = function ():void{
MochiAd.unload(clip);
};
mc.adLoaded = options.ad_loaded;
mc.adSkipped = options.ad_skipped;
mc.adjustProgress = function (_arg1:Number):void{
var _local2:Object;
_local2 = mc._mochiad_wait;
_local2.server_control = true;
_local2.showing = true;
_local2.started = getTimer();
_local2.ad_msec = (_arg1 - 250);
};
mc.rpc = function (_arg1:Number, _arg2:Object):void{
MochiAd.rpc(clip, _arg1, _arg2);
};
chk["onEnterFrame"] = function ():void{
var _local1:Object;
var _local2:Number;
var _local3:Boolean;
var _local4:Number;
if (!this.parent){
delete this.onEnterFrame;
delete this.fadeFunction;
return;
};
_local1 = this.parent._mochiad_ctr;
_local2 = (getTimer() - this.started);
_local3 = false;
if (!chk.showing){
_local4 = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal;
if (_local4 > 0){
chk.showing = true;
chk.started = getTimer();
MochiAd.adShowing(clip);
} else {
if (_local2 > chk.ad_timeout){
options.ad_failed();
_local3 = true;
};
};
};
if (_local2 > chk.ad_msec){
_local3 = true;
};
if (_local3){
if (this.server_control){
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = this.fadeFunction;
};
};
};
doOnEnterFrame(chk);
}
public static function _parseOptions(_arg1:Object, _arg2:Object):Object{
var _local3:Object;
var _local4:String;
var _local5:Array;
var _local6:Number;
var _local7:Array;
_local3 = {};
for (_local4 in _arg2) {
_local3[_local4] = _arg2[_local4];
};
if (_arg1){
for (_local4 in _arg1) {
_local3[_local4] = _arg1[_local4];
};
};
if (_local3.clip == undefined){
throw (new Error("MochiAd is missing the 'clip' parameter. This should be a MovieClip, Sprite or an instance of a class that extends MovieClip or Sprite."));
};
_arg1 = _local3.clip.loaderInfo.parameters.mochiad_options;
if (_arg1){
_local5 = _arg1.split("&");
_local6 = 0;
while (_local6 < _local5.length) {
_local7 = _local5[_local6].split("=");
_local3[unescape(_local7[0])] = unescape(_local7[1]);
_local6++;
};
};
if (_local3.id == "test"){
};
return (_local3);
}
public static function _cleanup(_arg1:Object):void{
var idx:Number;
var k:String;
var lc:LocalConnection;
var f:Function;
var mc = _arg1;
if (("lc" in mc)){
lc = mc.lc;
f = function ():void{
try {
lc.client = null;
lc.close();
} catch(e:Error) {
};
};
setTimeout(f, 0);
};
idx = DisplayObjectContainer(mc).numChildren;
while (idx > 0) {
idx = (idx - 1);
DisplayObjectContainer(mc).removeChildAt(idx);
};
for (k in mc) {
delete mc[k];
};
}
public static function load(_arg1:Object):MovieClip{
var DEFAULTS:Object;
var clip:Object;
var depth:Number;
var mc:MovieClip;
var wh:Array;
var lv:URLVariables;
var k:String;
var server:String;
var hostname:String;
var lc:LocalConnection;
var name:String;
var loader:Loader;
var g:Function;
var req:URLRequest;
var v:Object;
var options = _arg1;
DEFAULTS = {server:"http://x.mochiads.com/srv/1/", method:"load", depth:10333, id:"_UNKNOWN_"};
options = MochiAd._parseOptions(options, DEFAULTS);
options.swfv = 9;
options.mav = MochiAd.getVersion();
clip = options.clip;
if (!MochiAd._isNetworkAvailable()){
return (null);
};
try {
if (clip._mochiad_loaded){
return (null);
};
} catch(e:Error) {
throw (new Error("MochiAd requires a clip that is an instance of a dynamic class. If your class extends Sprite or MovieClip, you must make it dynamic."));
};
depth = options.depth;
delete options.depth;
mc = createEmptyMovieClip(clip, "_mochiad", depth);
wh = MochiAd._getRes(options, clip);
options.res = ((wh[0] + "x") + wh[1]);
options.server = (options.server + options.id);
delete options.id;
clip._mochiad_loaded = true;
if (clip.loaderInfo.loaderURL.indexOf("http") == 0){
options.as3_swf = clip.loaderInfo.loaderURL;
};
lv = new URLVariables();
for (k in options) {
v = options[k];
if (!(v is Function)){
lv[k] = v;
};
};
server = lv.server;
delete lv.server;
hostname = _allowDomains(server);
lc = new LocalConnection();
lc.client = mc;
name = ["", Math.floor(new Date().getTime()), Math.floor((Math.random() * 999999))].join("_");
lc.allowDomain("*", "localhost");
lc.allowInsecureDomain("*", "localhost");
lc.connect(name);
mc.lc = lc;
mc.lcName = name;
lv.lc = name;
lv.st = getTimer();
loader = new Loader();
g = function (_arg1:Object):void{
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
MochiAd.unload(clip);
};
loader.contentLoaderInfo.addEventListener(Event.UNLOAD, g);
req = new URLRequest(((server + ".swf?cacheBust=") + new Date().getTime()));
req.contentType = "application/x-www-form-urlencoded";
req.method = URLRequestMethod.POST;
req.data = lv;
loader.load(req);
mc.addChild(loader);
mc._mochiad_ctr = loader;
return (mc);
}
public static function runMethod(_arg1:Object, _arg2:String, _arg3:Array):Object{
var _local4:Array;
var _local5:Number;
_local4 = _arg2.split(".");
_local5 = 0;
while (_local5 < (_local4.length - 1)) {
if ((((_arg1[_local4[_local5]] == undefined)) || ((_arg1[_local4[_local5]] == null)))){
return (undefined);
};
_arg1 = _arg1[_local4[_local5]];
_local5++;
};
if (typeof(_arg1[_local4[_local5]]) == "function"){
return (_arg1[_local4[_local5]].apply(_arg1, _arg3));
};
return (undefined);
}
public static function createEmptyMovieClip(_arg1:Object, _arg2:String, _arg3:Number):MovieClip{
var _local4:MovieClip;
_local4 = new MovieClip();
if (((false) && (_arg3))){
_arg1.addChildAt(_local4, _arg3);
} else {
_arg1.addChild(_local4);
};
_arg1[_arg2] = _local4;
_local4["_name"] = _arg2;
return (_local4);
}
public static function _getRes(_arg1:Object, _arg2:Object):Array{
var _local3:Object;
var _local4:Number;
var _local5:Number;
var _local6:Array;
_local3 = _arg2.getBounds(_arg2.root);
_local4 = 0;
_local5 = 0;
if (typeof(_arg1.res) != "undefined"){
_local6 = _arg1.res.split("x");
_local4 = parseFloat(_local6[0]);
_local5 = parseFloat(_local6[1]);
} else {
_local4 = (_local3.xMax - _local3.xMin);
_local5 = (_local3.yMax - _local3.yMin);
};
if ((((_local4 == 0)) || ((_local5 == 0)))){
_local4 = _arg2.stage.stageWidth;
_local5 = _arg2.stage.stageHeight;
};
return ([_local4, _local5]);
}
public static function adShowing(_arg1:Object):void{
_arg1.origFrameRate = _arg1.stage.frameRate;
_arg1.stage.frameRate = 30;
}
public static function getValue(_arg1:Object, _arg2:String):Object{
var _local3:Array;
var _local4:Number;
_local3 = _arg2.split(".");
_local4 = 0;
while (_local4 < (_local3.length - 1)) {
if ((((_arg1[_local3[_local4]] == undefined)) || ((_arg1[_local3[_local4]] == null)))){
return (undefined);
};
_arg1 = _arg1[_local3[_local4]];
_local4++;
};
return (_arg1[_local3[_local4]]);
}
public static function rpc(_arg1:Object, _arg2:Number, _arg3:Object):void{
var _local4:Object;
var _local5:Object;
switch (_arg3.id){
case "setValue":
MochiAd.setValue(_arg1, _arg3.objectName, _arg3.value);
break;
case "getValue":
_local4 = MochiAd.getValue(_arg1, _arg3.objectName);
_arg1._mochiad.lc.send(_arg1._mochiad._containerLCName, "rpcResult", _arg2, _local4);
break;
case "runMethod":
_local5 = MochiAd.runMethod(_arg1, _arg3.method, _arg3.args);
_arg1._mochiad.lc.send(_arg1._mochiad._containerLCName, "rpcResult", _arg2, _local5);
break;
};
}
public static function setValue(_arg1:Object, _arg2:String, _arg3:Object):void{
var _local4:Array;
var _local5:Number;
_local4 = _arg2.split(".");
_local5 = 0;
while (_local5 < (_local4.length - 1)) {
if ((((_arg1[_local4[_local5]] == undefined)) || ((_arg1[_local4[_local5]] == null)))){
return;
};
_arg1 = _arg1[_local4[_local5]];
_local5++;
};
_arg1[_local4[_local5]] = _arg3;
}
public static function showPreGameAd(_arg1:Object):void{
var DEFAULTS:Object;
var clip:Object;
var ad_msec:Number;
var ad_timeout:Number;
var fadeout_time:Number;
var mc:MovieClip;
var wh:Array;
var w:Number;
var h:Number;
var chk:MovieClip;
var bar:MovieClip;
var bar_color:Number;
var bar_background:Number;
var bar_outline:Number;
var backing_mc:MovieClip;
var backing:Object;
var inside_mc:MovieClip;
var inside:Object;
var outline_mc:MovieClip;
var outline:Object;
var complete:Boolean;
var unloaded:Boolean;
var f:Function;
var sendHostProgress:Boolean;
var fn:Function;
var r:MovieClip;
var options = _arg1;
DEFAULTS = {ad_timeout:3000, fadeout_time:250, regpt:"o", method:"showPreloaderAd", color:0xFF8A00, background:16777161, outline:13994812, no_progress_bar:false, ad_started:function ():void{
if ((this.clip is MovieClip)){
this.clip.stop();
} else {
throw (new Error("MochiAd.showPreGameAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_finished:function ():void{
if ((this.clip is MovieClip)){
this.clip.play();
} else {
throw (new Error("MochiAd.showPreGameAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_loaded:function (_arg1:Number, _arg2:Number):void{
}, ad_failed:function ():void{
}, ad_skipped:function ():void{
}, ad_progress:function (_arg1:Number):void{
}};
options = MochiAd._parseOptions(options, DEFAULTS);
if ("c862232051e0a94e1c3609b3916ddb17".substr(0) == "dfeada81ac97cde83665f81c12da7def"){
options.ad_started();
fn = function ():void{
options.ad_finished();
};
setTimeout(fn, 100);
return;
};
clip = options.clip;
ad_msec = 11000;
ad_timeout = options.ad_timeout;
delete options.ad_timeout;
fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!MochiAd.load(options)){
options.ad_failed();
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
var fn:Function;
MochiAd._cleanup(mc);
fn = function ():void{
options.ad_finished();
};
setTimeout(fn, 100);
};
wh = MochiAd._getRes(options, clip);
w = wh[0];
h = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.x = (w * -0.5);
chk.y = (h * -0.5);
bar = createEmptyMovieClip(chk, "_mochiad_bar", 4);
if (options.no_progress_bar){
bar.visible = false;
delete options.no_progress_bar;
} else {
bar.x = 10;
bar.y = (h - 20);
};
bar_color = options.color;
delete options.color;
bar_background = options.background;
delete options.background;
bar_outline = options.outline;
delete options.outline;
backing_mc = createEmptyMovieClip(bar, "_outline", 1);
backing = backing_mc.graphics;
backing.beginFill(bar_background);
backing.moveTo(0, 0);
backing.lineTo((w - 20), 0);
backing.lineTo((w - 20), 10);
backing.lineTo(0, 10);
backing.lineTo(0, 0);
backing.endFill();
inside_mc = createEmptyMovieClip(bar, "_inside", 2);
inside = inside_mc.graphics;
inside.beginFill(bar_color);
inside.moveTo(0, 0);
inside.lineTo((w - 20), 0);
inside.lineTo((w - 20), 10);
inside.lineTo(0, 10);
inside.lineTo(0, 0);
inside.endFill();
inside_mc.scaleX = 0;
outline_mc = createEmptyMovieClip(bar, "_outline", 3);
outline = outline_mc.graphics;
outline.lineStyle(0, bar_outline, 100);
outline.moveTo(0, 0);
outline.lineTo((w - 20), 0);
outline.lineTo((w - 20), 10);
outline.lineTo(0, 10);
outline.lineTo(0, 0);
chk.ad_msec = ad_msec;
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
chk.last_pcnt = 0;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function ():void{
var _local1:Number;
_local1 = (100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time)));
if (_local1 > 0){
this.parent.alpha = (_local1 * 0.01);
} else {
MochiAd.unload(clip);
delete this["onEnterFrame"];
};
};
complete = false;
unloaded = false;
f = function (_arg1:Event):void{
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
complete = true;
if (unloaded){
MochiAd.unload(clip);
};
};
clip.loaderInfo.addEventListener(Event.COMPLETE, f);
if ((clip.root is MovieClip)){
r = (clip.root as MovieClip);
if (r.framesLoaded >= r.totalFrames){
complete = true;
};
};
mc.unloadAd = function ():void{
unloaded = true;
if (complete){
MochiAd.unload(clip);
};
};
mc.adLoaded = options.ad_loaded;
mc.adSkipped = options.ad_skipped;
mc.adjustProgress = function (_arg1:Number):void{
var _local2:Object;
_local2 = mc._mochiad_wait;
_local2.server_control = true;
_local2.showing = true;
_local2.started = getTimer();
_local2.ad_msec = _arg1;
};
mc.rpc = function (_arg1:Number, _arg2:Object):void{
MochiAd.rpc(clip, _arg1, _arg2);
};
mc.rpcTestFn = function (_arg1:String):Object{
return (_arg1);
};
mc.regContLC = function (_arg1:String):void{
mc._containerLCName = _arg1;
};
sendHostProgress = false;
mc.sendHostLoadProgress = function (_arg1:String):void{
sendHostProgress = true;
};
chk["onEnterFrame"] = function ():void{
var _local1:Object;
var _local2:Object;
var _local3:Number;
var _local4:Boolean;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Object;
var _local10:Number;
var _local11:Number;
if (((!(this.parent)) || (!(this.parent.parent)))){
delete this["onEnterFrame"];
return;
};
_local1 = this.parent.parent.root;
_local2 = this.parent._mochiad_ctr;
_local3 = (getTimer() - this.started);
_local4 = false;
_local5 = _local1.loaderInfo.bytesTotal;
_local6 = _local1.loaderInfo.bytesLoaded;
if (complete){
_local6 = Math.max(1, _local6);
_local5 = _local6;
};
_local7 = ((100 * _local6) / _local5);
_local8 = ((100 * _local3) / chk.ad_msec);
_local9 = this._mochiad_bar._inside;
_local10 = Math.min(100, Math.min(((_local7) || (0)), _local8));
_local10 = Math.max(this.last_pcnt, _local10);
this.last_pcnt = _local10;
_local9.scaleX = (_local10 * 0.01);
options.ad_progress(_local10);
if (sendHostProgress){
clip._mochiad.lc.send(clip._mochiad._containerLCName, "notify", {id:"hostLoadPcnt", pcnt:_local7});
if (_local7 == 100){
sendHostProgress = false;
};
};
if (!chk.showing){
_local11 = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal;
if (_local11 > 0){
chk.showing = true;
chk.started = getTimer();
MochiAd.adShowing(clip);
} else {
if ((((_local3 > chk.ad_timeout)) && ((_local7 == 100)))){
options.ad_failed();
_local4 = true;
};
};
};
if (_local3 > chk.ad_msec){
_local4 = true;
};
if (((complete) && (_local4))){
if (this.server_control){
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = chk.fadeFunction;
};
};
};
doOnEnterFrame(chk);
}
public static function showPreloaderAd(_arg1:Object):void{
MochiAd.showPreGameAd(_arg1);
}
public static function showTimedAd(_arg1:Object):void{
MochiAd.showInterLevelAd(_arg1);
}
public static function doOnEnterFrame(_arg1:MovieClip):void{
var f:Function;
var mc = _arg1;
f = function (_arg1:Object):void{
if (((("onEnterFrame" in mc)) && (mc.onEnterFrame))){
mc.onEnterFrame();
} else {
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
};
};
mc.addEventListener(Event.ENTER_FRAME, f);
}
}
}//package
Section 305
//MochiBot (MochiBot)
package {
import flash.display.*;
import flash.net.*;
import flash.system.*;
public dynamic class MochiBot extends Sprite {
public static function track(_arg1:Sprite, _arg2:String):MochiBot{
var _local3:MochiBot;
var _local4:String;
var _local5:URLVariables;
var _local6:String;
var _local7:URLRequest;
var _local8:Loader;
if (Security.sandboxType == "localWithFile"){
return (null);
};
_local3 = new (MochiBot);
_arg1.addChild(_local3);
Security.allowDomain("*");
Security.allowInsecureDomain("*");
_local4 = "http://core.mochibot.com/my/core.swf";
_local5 = new URLVariables();
_local5["sb"] = Security.sandboxType;
_local5["v"] = Capabilities.version;
_local5["swfid"] = _arg2;
_local5["mv"] = "8";
_local5["fv"] = "9";
_local6 = _local3.root.loaderInfo.loaderURL;
if (_local6.indexOf("http") == 0){
_local5["url"] = _local6;
} else {
_local5["url"] = "local";
};
_local7 = new URLRequest(_local4);
_local7.contentType = "application/x-www-form-urlencoded";
_local7.method = URLRequestMethod.POST;
_local7.data = _local5;
_local8 = new Loader();
_local3.addChild(_local8);
_local8.load(_local7);
return (_local3);
}
}
}//package
Section 306
//newSoldierFx (newSoldierFx)
package {
import flash.media.*;
public dynamic class newSoldierFx extends Sound {
}
}//package
Section 307
//panelItems (panelItems)
package {
import flash.display.*;
public dynamic class panelItems extends MovieClip {
public function panelItems(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 308
//panelManBack (panelManBack)
package {
import flash.display.*;
public dynamic class panelManBack extends MovieClip {
public var clock:MovieClip;
public function panelManBack(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 309
//pauseMc (pauseMc)
package {
import flash.display.*;
public dynamic class pauseMc extends MovieClip {
}
}//package
Section 310
//Photon (Photon)
package {
import flash.display.*;
public dynamic class Photon extends MovieClip {
}
}//package
Section 311
//PlayGameBtn (PlayGameBtn)
package {
import flash.display.*;
public dynamic class PlayGameBtn extends SimpleButton {
}
}//package
Section 312
//projectiles (projectiles)
package {
import flash.display.*;
public dynamic class projectiles extends MovieClip {
}
}//package
Section 313
//risingMoneyTxt (risingMoneyTxt)
package {
import flash.display.*;
import flash.text.*;
public dynamic class risingMoneyTxt extends MovieClip {
public var moneyTxt:TextField;
}
}//package
Section 314
//rocket (rocket)
package {
import flash.display.*;
public dynamic class rocket extends MovieClip {
}
}//package
Section 315
//rocketLauncher (rocketLauncher)
package {
import flash.display.*;
public dynamic class rocketLauncher extends MovieClip {
public var selectionMc:manSelectionSquare;
}
}//package
Section 316
//rocketLauncherShoot (rocketLauncherShoot)
package {
import flash.display.*;
public dynamic class rocketLauncherShoot extends MovieClip {
public function rocketLauncherShoot(){
addFrameScript(4, frame5);
}
function frame5(){
MovieClip(this.parent).gotoAndStop("gunStand");
}
}
}//package
Section 317
//rocketStand (rocketStand)
package {
import flash.display.*;
public dynamic class rocketStand extends MovieClip {
}
}//package
Section 318
//selectionBox (selectionBox)
package {
import flash.display.*;
public dynamic class selectionBox extends MovieClip {
}
}//package
Section 319
//SoundMusic1 (SoundMusic1)
package {
import flash.media.*;
public dynamic class SoundMusic1 extends Sound {
}
}//package
Section 320
//startGameButton (startGameButton)
package {
import flash.display.*;
public dynamic class startGameButton extends SimpleButton {
}
}//package
Section 321
//startGameMsg (startGameMsg)
package {
import flash.display.*;
import flash.text.*;
public dynamic class startGameMsg extends MovieClip {
public var rulerTxt:TextField;
public var titleTxt:TextField;
}
}//package
Section 322
//startScreenInstr (startScreenInstr)
package {
import flash.display.*;
public dynamic class startScreenInstr extends MovieClip {
}
}//package
Section 323
//swordFightFx (swordFightFx)
package {
import flash.media.*;
public dynamic class swordFightFx extends Sound {
}
}//package
Section 324
//tent (tent)
package {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.geom.*;
import flash.filters.*;
import flash.net.*;
import flash.text.*;
import flash.utils.*;
import flash.system.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.ui.*;
import flash.xml.*;
public dynamic class tent extends MovieClip {
public var flagMc:halfWayFlag;
public var flagNumber:String;
public function tent(){
addFrameScript(0, frame1);
}
function frame1(){
flagNumber = "arthur";
flagMc.flag1.flag2.flag3a.flag4a.gotoAndStop(flagNumber);
flagMc.flag1.flag2.flag3a.flag4b.gotoAndStop(flagNumber);
flagMc.flag1.flag2.flag3a.flag4c.gotoAndStop(flagNumber);
flagMc.flag1.flag2.flag3a.flag4d.gotoAndStop(flagNumber);
flagMc.flag1.flag2.flag3b.flag4a.gotoAndStop(flagNumber);
flagMc.flag1.flag2.flag3b.flag4b.gotoAndStop(flagNumber);
flagMc.flag1.flag2.flag3b.flag4c.gotoAndStop(flagNumber);
flagMc.flag1.flag2.flag3b.flag4d.gotoAndStop(flagNumber);
}
}
}//package
Section 325
//throwFx (throwFx)
package {
import flash.media.*;
public dynamic class throwFx extends Sound {
}
}//package
Section 326
//turretMc (turretMc)
package {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.geom.*;
import flash.filters.*;
import flash.net.*;
import flash.text.*;
import flash.utils.*;
import flash.system.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.ui.*;
import flash.xml.*;
public dynamic class turretMc extends MovieClip {
public var firePoint:MovieClip;
public function turretMc(){
addFrameScript(0, frame1, 1, frame2);
}
function frame1(){
stop();
}
function frame2(){
MovieClip(this.parent).body.play();
}
}
}//package
Section 327
//woodBlock (woodBlock)
package {
import flash.display.*;
public dynamic class woodBlock extends MovieClip {
}
}//package
Section 328
//youarehereMc (youarehereMc)
package {
import flash.display.*;
public dynamic class youarehereMc extends MovieClip {
}
}//package