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);
}
public function GetCentroid():b2Vec2{
return (m_centroid);
}
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);
}
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 id:String;// = "unidentified"
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_friction:Number;
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){
id = "unidentified";
super();
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 id:String;// = "unidentified"
public var isSensor:Boolean;// = false
public var density:Number;// = 0
public var type:int;
public var restitution:Number;// = 0
public var userData;// = null
public var filter:b2FilterData;
public var friction:Number;// = 0.2
public function b2ShapeDef(){
id = "unidentified";
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.Collision.Shapes.*;
import Box2D.Common.Math.*;
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.Collision.Shapes.*;
import Box2D.Common.Math.*;
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.Collision.Shapes.*;
import Box2D.Common.Math.*;
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.Collision.Shapes.*;
import Box2D.Common.Math.*;
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 degreesToRadians(_arg1:Number):Number{
return (((_arg1 / 180) * Math.PI));
}
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 radiansToDegrees(_arg1:Number):Number{
return (((_arg1 / Math.PI) * 180));
}
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 vectorTransform(_arg1:Number, _arg2:b2Vec2):b2Vec2{
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:b2Vec2;
_local3 = b2Math.degreesToRadians(_arg1);
_local4 = ((_arg2.x * Math.cos(_local3)) - (_arg2.y * Math.sin(_local3)));
_local5 = ((_arg2.x * Math.sin(_local3)) + (_arg2.y * Math.cos(_local3)));
_local6 = new (b2Vec2);
_local6.x = _local4;
_local6.y = _local5;
return (_local6);
}
public static function vectorToRotation(_arg1:b2Vec2, _arg2:b2Vec2):Number{
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
_local3 = _arg1.Length();
_local4 = _arg2.Length();
_local5 = _arg1.Normalize();
_local6 = _arg2.Normalize();
_local7 = b2Math.b2Dot(_arg1, _arg2);
_local8 = (_local3 * _local4);
_local9 = Math.acos((_local7 / _local8));
_local10 = b2Math.radiansToDegrees(_local9);
return (_local10);
}
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.Collision.Shapes.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
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, this);
};
} 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, this);
};
};
} 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, this);
};
};
}
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.Collision.Shapes.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
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.Collision.Shapes.*;
import Box2D.Common.Math.*;
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.Collision.Shapes.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
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, this);
};
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, this);
};
_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, this);
};
_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.Collision.Shapes.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
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, this);
};
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, this);
};
_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, this);
};
_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.Collision.Shapes.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.Joints.*;
import Box2D.Dynamics.Contacts.*;
public class b2Body {
public var m_xf:b2XForm;
public var m_contactList:b2ContactEdge;
public var m_angularVelocity:Number;
public var m_invI:Number;
public var bodyState:String;// = "Unidentified"
public var id:String;// = "Unidentified"
public var m_shapeCount:int;
public var m_torque:Number;
public var legShot:Boolean;// = false
public var touchedSolid:Boolean;// = false
public var m_flags:uint;
public var m_linearVelocity:b2Vec2;
public var m_world:b2World;
public var type:int;// = 0
public var bulletType:String;// = "Unidentified"
public var touchedBarricade:Boolean;// = false
public var damage:Number;
public var pointCollision:b2Vec2;
public var m_next:b2Body;
public var shouldJump:Boolean;// = false
public var m_shapeList:b2Shape;
public var touchedChar:Boolean;// = false
public var m_force:b2Vec2;
public var m_sweep:b2Sweep;
public var m_mass:Number;
public var gotShot:Boolean;// = false
public var m_userData;
public var m_invMass:Number;
public var bodyShot:Boolean;// = false
public var faceRight:Boolean;// = false
public var m_prev:b2Body;
public var impulseApplied:b2Vec2;
public var m_linearDamping:Number;
public var m_type:int;
public var m_angularDamping:Number;
public var touchedTheGround:Boolean;// = false
public var normal:b2Vec2;
public var m_sleepTime:Number;
public var m_jointList:b2JointEdge;
public var m_I:Number;
public var headShot:Boolean;// = false
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;
id = "Unidentified";
type = 0;
normal = new b2Vec2(0, 1);
touchedSolid = false;
touchedTheGround = false;
bodyState = "Unidentified";
gotShot = false;
headShot = false;
bodyShot = false;
legShot = false;
shouldJump = false;
touchedBarricade = false;
faceRight = false;
touchedChar = false;
bulletType = "Unidentified";
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 SetLinearVelocity(_arg1:b2Vec2):void{
m_linearVelocity.SetV(_arg1);
}
public function IsSleeping():Boolean{
return (((m_flags & e_sleepFlag) == e_sleepFlag));
}
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 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 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 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 GetAngle():Number{
return (m_sweep.a);
}
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 SetAngularVelocity(_arg1:Number):void{
m_angularVelocity = _arg1;
}
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 GetNext():b2Body{
return (m_next);
}
public function GetMass():Number{
return (m_mass);
}
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 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 GetWorldCenter():b2Vec2{
return (m_sweep.c);
}
public function GetUserData(){
return (m_userData);
}
public function SetUserData(_arg1):void{
m_userData = _arg1;
}
public function WakeUp():void{
m_flags = (m_flags & ~(e_sleepFlag));
m_sleepTime = 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 GetPosition():b2Vec2{
return (m_xf.position);
}
public function GetLocalVector(_arg1:b2Vec2):b2Vec2{
return (b2Math.b2MulTMV(m_xf.R, _arg1));
}
public function GetLocalCenter():b2Vec2{
return (m_sweep.localCenter);
}
public function IsFrozen():Boolean{
return (((m_flags & e_frozenFlag) == e_frozenFlag));
}
public function IsDynamic():Boolean{
return ((m_type == e_dynamicType));
}
public function GetInertia():Number{
return (m_I);
}
public function GetJointList():b2JointEdge{
return (m_jointList);
}
public function GetLocalPoint(_arg1:b2Vec2):b2Vec2{
return (b2Math.b2MulXT(m_xf, _arg1));
}
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 GetAngularVelocity():Number{
return (m_angularVelocity);
}
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 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.id = _arg1.id;
_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 IsBullet():Boolean{
return (((m_flags & e_bulletFlag) == e_bulletFlag));
}
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 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 ApplyTorque(_arg1:Number):void{
if (IsSleeping()){
WakeUp();
};
m_torque = (m_torque + _arg1);
}
public function AllowSleeping(_arg1:Boolean):void{
if (_arg1){
m_flags = (m_flags | e_allowSleepFlag);
} else {
m_flags = (m_flags & ~(e_allowSleepFlag));
WakeUp();
};
}
public function GetWorld():b2World{
return (m_world);
}
public function GetLinearVelocity():b2Vec2{
return (m_linearVelocity);
}
}
}//package Box2D.Dynamics
Section 65
//b2BodyDef (Box2D.Dynamics.b2BodyDef)
package Box2D.Dynamics {
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
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.Collision.Shapes.*;
public class b2ContactFilter {
public static var b2_defaultFilter:b2ContactFilter = new (b2ContactFilter);
;
public function ShouldCollide(_arg1:b2Shape, _arg2:b2Shape):Boolean{
var _local3:b2FilterData;
var _local4:b2FilterData;
var _local5:Boolean;
_local3 = _arg1.GetFilterData();
_local4 = _arg2.GetFilterData();
if ((((_local3.groupIndex == _local4.groupIndex)) && (!((_local3.groupIndex == 0))))){
return ((_local3.groupIndex > 0));
};
_local5 = ((!(((_local3.maskBits & _local4.categoryBits) == 0))) && (!(((_local3.categoryBits & _local4.maskBits) == 0))));
return (_local5);
}
}
}//package Box2D.Dynamics
Section 68
//b2ContactListener (Box2D.Dynamics.b2ContactListener)
package Box2D.Dynamics {
import Box2D.Collision.*;
import Box2D.Dynamics.Contacts.*;
public class b2ContactListener {
public function Add(_arg1:b2ContactPoint, _arg2:b2Contact):void{
}
public function Remove(_arg1:b2ContactPoint, _arg2:b2Contact):void{
}
public function Persist(_arg1:b2ContactPoint, _arg2:b2Contact):void{
}
public function Result(_arg1:b2ContactResult, _arg2:b2Contact):void{
}
}
}//package Box2D.Dynamics
Section 69
//b2ContactManager (Box2D.Dynamics.b2ContactManager)
package Box2D.Dynamics {
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
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_shape2;
_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, _arg1);
_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 Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
import Box2D.Collision.*;
import Box2D.Common.*;
import Box2D.Dynamics.Contacts.*;
import flash.display.*;
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, _local5);
_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.Collision.Shapes.*;
import Box2D.Common.Math.*;
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
//ammoTypeSign_67 (Days2Die_fla.ammoTypeSign_67)
package Days2Die_fla {
import flash.display.*;
public dynamic class ammoTypeSign_67 extends MovieClip {
public function ammoTypeSign_67(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package Days2Die_fla
Section 76
//bloodSign_92 (Days2Die_fla.bloodSign_92)
package Days2Die_fla {
import flash.display.*;
public dynamic class bloodSign_92 extends MovieClip {
public var redBlood:MovieClip;
}
}//package Days2Die_fla
Section 77
//buldozerButton_254 (Days2Die_fla.buldozerButton_254)
package Days2Die_fla {
import flash.display.*;
public dynamic class buldozerButton_254 extends MovieClip {
public function buldozerButton_254(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package Days2Die_fla
Section 78
//buttonSound_104 (Days2Die_fla.buttonSound_104)
package Days2Die_fla {
import flash.display.*;
public dynamic class buttonSound_104 extends MovieClip {
public function buttonSound_104(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package Days2Die_fla
Section 79
//chooserBox_74 (Days2Die_fla.chooserBox_74)
package Days2Die_fla {
import flash.display.*;
import flash.text.*;
public dynamic class chooserBox_74 extends MovieClip {
public var nextButton:SimpleButton;
public var prevButton:SimpleButton;
public var pageNumber:TextField;
}
}//package Days2Die_fla
Section 80
//chooserBoxcopy_253 (Days2Die_fla.chooserBoxcopy_253)
package Days2Die_fla {
import flash.display.*;
public dynamic class chooserBoxcopy_253 extends MovieClip {
public var nextButton:SimpleButton;
public var prevButton:SimpleButton;
}
}//package Days2Die_fla
Section 81
//days2dieintro_12 (Days2Die_fla.days2dieintro_12)
package Days2Die_fla {
import flash.display.*;
public dynamic class days2dieintro_12 extends MovieClip {
public var endOfAnimation:Boolean;
public function days2dieintro_12(){
addFrameScript(0, frame1, 418, frame419);
}
function frame1(){
endOfAnimation = false;
}
function frame419(){
endOfAnimation = true;
stop();
}
}
}//package Days2Die_fla
Section 82
//equipBox_64 (Days2Die_fla.equipBox_64)
package Days2Die_fla {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.media.*;
import flash.utils.*;
import flash.text.*;
import flash.net.*;
import flash.system.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.printing.*;
import flash.ui.*;
import flash.xml.*;
public dynamic class equipBox_64 extends MovieClip {
public var ammo9mmText:TextField;
public var ammo556:MovieClip;
public var ammo9mm:MovieClip;
public var slotType0:TextField;
public var ammo12gaugeText:TextField;
public var ammo357Text:TextField;
public var ammo556Text:TextField;
public var explosiveWeapon:MovieClip;
public var ammo357:MovieClip;
public var ammo762Text:TextField;
public var switchButton:SimpleButton;
public var ammo762:MovieClip;
public var meleeWeapon:MovieClip;
public var ammo45Text:TextField;
public var primaryWeapon:MovieClip;
public var ammo45:MovieClip;
public var secondaryWeapon:MovieClip;
public var slotType1:TextField;
public var slotType2:TextField;
public var slotType3:TextField;
public var ammo12gauge:MovieClip;
public function equipBox_64(){
addFrameScript(0, frame1);
}
function frame1(){
ammo12gauge.gotoAndStop("ammo12gauge");
ammo357.gotoAndStop("ammo357");
ammo45.gotoAndStop("ammo45");
ammo9mm.gotoAndStop("ammo9mm");
ammo762.gotoAndStop("ammo762");
ammo556.gotoAndStop("ammo556");
primaryWeapon.num.text = "1";
secondaryWeapon.num.text = "2";
meleeWeapon.num.text = "3";
explosiveWeapon.num.text = "4";
slotType0.text = "PRIMARY";
slotType1.text = "SECONDARY";
slotType2.text = "MELEE";
slotType3.text = "EXPLOSIVE";
}
}
}//package Days2Die_fla
Section 83
//explanationBox_72 (Days2Die_fla.explanationBox_72)
package Days2Die_fla {
import flash.display.*;
import flash.text.*;
public dynamic class explanationBox_72 extends MovieClip {
public var priceText:TextField;
public var priceLabel:TextField;
public var damageText:TextField;
public var ownedLabel:TextField;
public var ammoType:MovieClip;
public var ownedText:TextField;
public var rpsText:TextField;
public var weaponName:TextField;
public var weaponPic:MovieClip;
}
}//package Days2Die_fla
Section 84
//expSign_113 (Days2Die_fla.expSign_113)
package Days2Die_fla {
import flash.display.*;
public dynamic class expSign_113 extends MovieClip {
public var expBar:MovieClip;
}
}//package Days2Die_fla
Section 85
//gameOverMenu_124 (Days2Die_fla.gameOverMenu_124)
package Days2Die_fla {
import flash.events.*;
import flash.display.*;
import flash.text.*;
import flash.net.*;
public dynamic class gameOverMenu_124 extends MovieClip {
public var retryButton:SimpleButton;
public var sponsor:SimpleButton;
public var submitButton:SimpleButton;
public var scoreText:TextField;
public function gameOverMenu_124(){
addFrameScript(0, frame1);
}
function frame1(){
sponsor.addEventListener(MouseEvent.CLICK, onSponsorLogoClicked);
}
public function onSponsorLogoClicked(_arg1:MouseEvent){
var _local2:URLRequest;
_local2 = new URLRequest("http://www.coolbuddy.com/?cid=161");
navigateToURL(_local2, "_blank");
}
}
}//package Days2Die_fla
Section 86
//gamePerkMenu_130 (Days2Die_fla.gamePerkMenu_130)
package Days2Die_fla {
import flash.display.*;
import flash.text.*;
public dynamic class gamePerkMenu_130 extends MovieClip {
public var next:SimpleButton;
public var info:TextField;
}
}//package Days2Die_fla
Section 87
//gameScoreMenu_123 (Days2Die_fla.gameScoreMenu_123)
package Days2Die_fla {
import flash.events.*;
import flash.display.*;
import flash.text.*;
import flash.net.*;
public dynamic class gameScoreMenu_123 extends MovieClip {
public var nextButton:SimpleButton;
public var sponsor:SimpleButton;
public var killText:TextField;
public var adSpace:MovieClip;
public var advanceText:TextField;
public var locationName:TextField;
public var scoreText:TextField;
public var dayText:TextField;
public function gameScoreMenu_123(){
addFrameScript(0, frame1);
}
function frame1(){
sponsor.addEventListener(MouseEvent.CLICK, onSponsorLogoClicked);
}
public function onSponsorLogoClicked(_arg1:MouseEvent){
var _local2:URLRequest;
_local2 = new URLRequest("http://www.coolbuddy.com/?cid=161");
navigateToURL(_local2, "_blank");
}
}
}//package Days2Die_fla
Section 88
//infoBarricade_250 (Days2Die_fla.infoBarricade_250)
package Days2Die_fla {
import flash.display.*;
import flash.text.*;
public dynamic class infoBarricade_250 extends MovieClip {
public var durability:TextField;
public var infoMenu:MovieClip;
public var price:TextField;
public function infoBarricade_250(){
addFrameScript(0, frame1, 11, frame12, 20, frame21);
}
function frame12(){
stop();
}
function frame1(){
stop();
}
function frame21(){
stop();
}
}
}//package Days2Die_fla
Section 89
//infoBox_133 (Days2Die_fla.infoBox_133)
package Days2Die_fla {
import flash.display.*;
import flash.text.*;
public dynamic class infoBox_133 extends MovieClip {
public var infoBox:TextField;
}
}//package Days2Die_fla
Section 90
//insideInfoBarricade_251 (Days2Die_fla.insideInfoBarricade_251)
package Days2Die_fla {
import flash.display.*;
import flash.text.*;
public dynamic class insideInfoBarricade_251 extends MovieClip {
public var durability:TextField;
public var price:TextField;
}
}//package Days2Die_fla
Section 91
//Ladder_320 (Days2Die_fla.Ladder_320)
package Days2Die_fla {
import flash.display.*;
public dynamic class Ladder_320 extends MovieClip {
public var center:MovieClip;
}
}//package Days2Die_fla
Section 92
//loadingText_381 (Days2Die_fla.loadingText_381)
package Days2Die_fla {
import flash.display.*;
public dynamic class loadingText_381 extends MovieClip {
public var playBtn:SimpleButton;
public function loadingText_381(){
addFrameScript(0, frame1, 1, frame2);
}
function frame1(){
stop();
playBtn.visible = false;
}
function frame2(){
stop();
playBtn.visible = true;
}
}
}//package Days2Die_fla
Section 93
//mainBody_84 (Days2Die_fla.mainBody_84)
package Days2Die_fla {
import flash.display.*;
public dynamic class mainBody_84 extends MovieClip {
public function mainBody_84(){
addFrameScript(0, frame1, 1, frame2, 2, frame3, 3, frame4, 4, frame5, 5, frame6);
}
function frame3(){
stop();
}
function frame6(){
stop();
}
function frame1(){
stop();
}
function frame4(){
stop();
}
function frame5(){
stop();
}
function frame2(){
stop();
}
}
}//package Days2Die_fla
Section 94
//maincharBody_83 (Days2Die_fla.maincharBody_83)
package Days2Die_fla {
import flash.display.*;
public dynamic class maincharBody_83 extends MovieClip {
public var torso:MovieClip;
public var animationDone:Boolean;
public function maincharBody_83(){
addFrameScript(0, frame1, 23, frame24, 24, frame25, 64, frame65, 65, frame66, 84, frame85, 85, frame86, 108, frame109);
}
function frame65(){
animationDone = true;
}
function frame86(){
animationDone = false;
}
function frame85(){
animationDone = true;
}
function frame1(){
animationDone = false;
}
function frame109(){
animationDone = true;
stop();
}
function frame25(){
animationDone = false;
}
function frame24(){
animationDone = true;
gotoAndPlay("idle");
}
function frame66(){
animationDone = false;
}
}
}//package Days2Die_fla
Section 95
//maincharHead_85 (Days2Die_fla.maincharHead_85)
package Days2Die_fla {
import flash.display.*;
public dynamic class maincharHead_85 extends MovieClip {
public var animationDone:Boolean;
public var head:mainHead;
public function maincharHead_85(){
addFrameScript(0, frame1, 23, frame24, 24, frame25, 64, frame65, 65, frame66, 84, frame85, 85, frame86, 108, frame109);
}
function frame65(){
animationDone = true;
}
function frame86(){
animationDone = false;
head.eye.gotoAndStop(21);
}
function frame85(){
animationDone = true;
}
function frame1(){
animationDone = false;
head.eye.play();
}
function frame109(){
animationDone = true;
stop();
}
function frame25(){
animationDone = false;
}
function frame24(){
animationDone = true;
gotoAndPlay("idle");
}
function frame66(){
animationDone = false;
}
}
}//package Days2Die_fla
Section 96
//maincharLegs_82 (Days2Die_fla.maincharLegs_82)
package Days2Die_fla {
import flash.display.*;
public dynamic class maincharLegs_82 extends MovieClip {
public var animationDone:Boolean;
public function maincharLegs_82(){
addFrameScript(0, frame1, 23, frame24, 24, frame25, 64, frame65, 65, frame66, 84, frame85, 85, frame86, 108, frame109);
}
function frame65(){
animationDone = true;
}
function frame86(){
animationDone = false;
}
function frame85(){
animationDone = true;
}
function frame1(){
animationDone = false;
}
function frame109(){
animationDone = true;
stop();
}
function frame25(){
animationDone = false;
}
function frame24(){
animationDone = true;
gotoAndPlay("idle");
}
function frame66(){
animationDone = false;
}
}
}//package Days2Die_fla
Section 97
//mapWorld_385 (Days2Die_fla.mapWorld_385)
package Days2Die_fla {
import flash.display.*;
public dynamic class mapWorld_385 extends MovieClip {
public var place0:MovieClip;
public var place2:MovieClip;
public var place4:MovieClip;
public var place5:MovieClip;
public var place1:MovieClip;
public var place3:MovieClip;
}
}//package Days2Die_fla
Section 98
//meleeWeapon_65 (Days2Die_fla.meleeWeapon_65)
package Days2Die_fla {
import flash.display.*;
import flash.text.*;
public dynamic class meleeWeapon_65 extends MovieClip {
public var num:TextField;
}
}//package Days2Die_fla
Section 99
//mercHireBox_281 (Days2Die_fla.mercHireBox_281)
package Days2Die_fla {
import flash.display.*;
import flash.text.*;
public dynamic class mercHireBox_281 extends MovieClip {
public var mercPic:mainHead;
public var salaryText:TextField;
public var speedText:TextField;
public var priceText:TextField;
public var mercName:TextField;
public var accText:TextField;
public var healthText:TextField;
public var weaponPic:MovieClip;
}
}//package Days2Die_fla
Section 100
//primWeapon_66 (Days2Die_fla.primWeapon_66)
package Days2Die_fla {
import flash.display.*;
import flash.text.*;
public dynamic class primWeapon_66 extends MovieClip {
public var num:TextField;
}
}//package Days2Die_fla
Section 101
//ResultScreen_119 (Days2Die_fla.ResultScreen_119)
package Days2Die_fla {
import flash.display.*;
public dynamic class ResultScreen_119 extends MovieClip {
public var gameScoreMenu:MovieClip;
public var backToMainMenuButton:SimpleButton;
public var gameOverMenu:MovieClip;
public function ResultScreen_119(){
addFrameScript(0, frame1, 1, frame2, 9, frame10);
}
function frame10(){
stop();
}
function frame1(){
stop();
gameOverMenu.visible = true;
backToMainMenuButton.visible = true;
}
function frame2(){
gameOverMenu.visible = false;
backToMainMenuButton.visible = false;
}
}
}//package Days2Die_fla
Section 102
//sc2ly2_180 (Days2Die_fla.sc2ly2_180)
package Days2Die_fla {
import flash.display.*;
public dynamic class sc2ly2_180 extends MovieClip {
public function sc2ly2_180(){
addFrameScript(39, frame40);
}
function frame40(){
stop();
}
}
}//package Days2Die_fla
Section 103
//sc2ly4_183 (Days2Die_fla.sc2ly4_183)
package Days2Die_fla {
import flash.display.*;
public dynamic class sc2ly4_183 extends MovieClip {
public function sc2ly4_183(){
addFrameScript(39, frame40);
}
function frame40(){
stop();
}
}
}//package Days2Die_fla
Section 104
//sc2ly5_186 (Days2Die_fla.sc2ly5_186)
package Days2Die_fla {
import flash.display.*;
public dynamic class sc2ly5_186 extends MovieClip {
public function sc2ly5_186(){
addFrameScript(44, frame45);
}
function frame45(){
stop();
}
}
}//package Days2Die_fla
Section 105
//sc3ly3_193 (Days2Die_fla.sc3ly3_193)
package Days2Die_fla {
import flash.display.*;
public dynamic class sc3ly3_193 extends MovieClip {
public function sc3ly3_193(){
addFrameScript(39, frame40);
}
function frame40(){
stop();
}
}
}//package Days2Die_fla
Section 106
//sc3ly4_192 (Days2Die_fla.sc3ly4_192)
package Days2Die_fla {
import flash.display.*;
public dynamic class sc3ly4_192 extends MovieClip {
public function sc3ly4_192(){
addFrameScript(39, frame40);
}
function frame40(){
stop();
}
}
}//package Days2Die_fla
Section 107
//shopWarning_284 (Days2Die_fla.shopWarning_284)
package Days2Die_fla {
import flash.display.*;
import flash.text.*;
public dynamic class shopWarning_284 extends MovieClip {
public var message:TextField;
public var closeButton:SimpleButton;
}
}//package Days2Die_fla
Section 108
//signAd_100 (Days2Die_fla.signAd_100)
package Days2Die_fla {
import flash.display.*;
public dynamic class signAd_100 extends MovieClip {
public var adSpace:MovieClip;
}
}//package Days2Die_fla
Section 109
//signBaloon_94 (Days2Die_fla.signBaloon_94)
package Days2Die_fla {
import flash.display.*;
public dynamic class signBaloon_94 extends MovieClip {
public function signBaloon_94(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package Days2Die_fla
Section 110
//signBullets_118 (Days2Die_fla.signBullets_118)
package Days2Die_fla {
import flash.display.*;
public dynamic class signBullets_118 extends MovieClip {
public var ammoType:MovieClip;
public function signBullets_118(){
addFrameScript(0, frame1, 1, frame2, 2, frame3, 3, frame4, 4, frame5, 5, frame6, 6, frame7, 7, frame8, 8, frame9, 9, frame10, 10, frame11, 11, frame12, 12, frame13, 13, frame14, 14, frame15, 15, frame16, 16, frame17, 17, frame18);
}
function frame10(){
stop();
ammoType.gotoAndStop("ammo762");
}
function frame14(){
stop();
ammoType.gotoAndStop("other");
}
function frame18(){
stop();
ammoType.gotoAndStop("other");
}
function frame12(){
stop();
ammoType.gotoAndStop("ammo762");
}
function frame3(){
stop();
ammoType.gotoAndStop("ammo9mm");
}
function frame6(){
stop();
ammoType.gotoAndStop("ammo9mm");
}
function frame7(){
stop();
ammoType.gotoAndStop("ammo9mm");
}
function frame1(){
ammoType.gotoAndStop("ammo12gauge");
}
function frame13(){
stop();
ammoType.gotoAndStop("other");
}
function frame17(){
stop();
ammoType.gotoAndStop("other");
}
function frame4(){
stop();
ammoType.gotoAndStop("ammo9mm");
}
function frame5(){
stop();
ammoType.gotoAndStop("ammo357");
}
function frame9(){
stop();
ammoType.gotoAndStop("ammo9mm");
}
function frame16(){
stop();
ammoType.gotoAndStop("other");
}
function frame8(){
stop();
ammoType.gotoAndStop("ammo45");
}
function frame2(){
stop();
ammoType.gotoAndStop("ammo45");
}
function frame15(){
stop();
ammoType.gotoAndStop("other");
}
function frame11(){
stop();
ammoType.gotoAndStop("ammo556");
}
}
}//package Days2Die_fla
Section 111
//upperBar_134 (Days2Die_fla.upperBar_134)
package Days2Die_fla {
import flash.display.*;
public dynamic class upperBar_134 extends MovieClip {
public var pauseButton:SimpleButton;
}
}//package Days2Die_fla
Section 112
//weaponOptions_73 (Days2Die_fla.weaponOptions_73)
package Days2Die_fla {
import flash.display.*;
public dynamic class weaponOptions_73 extends MovieClip {
public var holder0:MovieClip;
public var holder1:MovieClip;
public var holder2:MovieClip;
public var holder5:MovieClip;
public var holder3:MovieClip;
public var holder4:MovieClip;
}
}//package Days2Die_fla
Section 113
//weaponShop_275 (Days2Die_fla.weaponShop_275)
package Days2Die_fla {
import flash.display.*;
public dynamic class weaponShop_275 extends MovieClip {
public var holder0:MovieClip;
public var holder1:MovieClip;
public var holder2:MovieClip;
public var holder5:MovieClip;
public var holder7:MovieClip;
public var holder9:MovieClip;
public var holder3:MovieClip;
public var holder4:MovieClip;
public var holder6:MovieClip;
public var holder8:MovieClip;
}
}//package Days2Die_fla
Section 114
//zombieBodies_160 (Days2Die_fla.zombieBodies_160)
package Days2Die_fla {
import flash.display.*;
public dynamic class zombieBodies_160 extends MovieClip {
public function zombieBodies_160(){
addFrameScript(0, frame1, 1, frame2, 2, frame3, 3, frame4, 4, frame5);
}
function frame3(){
stop();
}
function frame1(){
stop();
}
function frame4(){
stop();
}
function frame5(){
stop();
}
function frame2(){
stop();
}
}
}//package Days2Die_fla
Section 115
//zombieBody02_161 (Days2Die_fla.zombieBody02_161)
package Days2Die_fla {
import flash.display.*;
public dynamic class zombieBody02_161 extends MovieClip {
public function zombieBody02_161(){
addFrameScript(0, frame1, 7, frame8, 13, frame14, 20, frame21);
}
function frame14(){
stop();
}
function frame1(){
stop();
}
function frame21(){
stop();
}
function frame8(){
stop();
}
}
}//package Days2Die_fla
Section 116
//zombieBody03_162 (Days2Die_fla.zombieBody03_162)
package Days2Die_fla {
import flash.display.*;
public dynamic class zombieBody03_162 extends MovieClip {
public function zombieBody03_162(){
addFrameScript(0, frame1, 7, frame8, 13, frame14, 20, frame21);
}
function frame14(){
stop();
}
function frame1(){
stop();
}
function frame21(){
stop();
}
function frame8(){
stop();
}
}
}//package Days2Die_fla
Section 117
//zombieBody04_163 (Days2Die_fla.zombieBody04_163)
package Days2Die_fla {
import flash.display.*;
public dynamic class zombieBody04_163 extends MovieClip {
public function zombieBody04_163(){
addFrameScript(0, frame1, 7, frame8, 13, frame14, 20, frame21);
}
function frame14(){
stop();
}
function frame1(){
stop();
}
function frame21(){
stop();
}
function frame8(){
stop();
}
}
}//package Days2Die_fla
Section 118
//zombieBody05_164 (Days2Die_fla.zombieBody05_164)
package Days2Die_fla {
import flash.display.*;
public dynamic class zombieBody05_164 extends MovieClip {
public function zombieBody05_164(){
addFrameScript(0, frame1, 7, frame8, 13, frame14, 20, frame21);
}
function frame14(){
stop();
}
function frame1(){
stop();
}
function frame21(){
stop();
}
function frame8(){
stop();
}
}
}//package Days2Die_fla
Section 119
//zombieHead01_156 (Days2Die_fla.zombieHead01_156)
package Days2Die_fla {
import flash.display.*;
public dynamic class zombieHead01_156 extends MovieClip {
public function zombieHead01_156(){
addFrameScript(0, frame1, 1, frame2, 6, frame7, 11, frame12, 12, frame13);
}
function frame12(){
stop();
}
function frame7(){
stop();
}
function frame1(){
stop();
}
function frame13(){
stop();
}
function frame2(){
stop();
}
}
}//package Days2Die_fla
Section 120
//zombieHead02_167 (Days2Die_fla.zombieHead02_167)
package Days2Die_fla {
import flash.display.*;
public dynamic class zombieHead02_167 extends MovieClip {
public function zombieHead02_167(){
addFrameScript(0, frame1, 1, frame2, 6, frame7, 11, frame12, 12, frame13);
}
function frame12(){
stop();
}
function frame7(){
stop();
}
function frame1(){
stop();
}
function frame13(){
stop();
}
function frame2(){
stop();
}
}
}//package Days2Die_fla
Section 121
//zombieHead03_168 (Days2Die_fla.zombieHead03_168)
package Days2Die_fla {
import flash.display.*;
public dynamic class zombieHead03_168 extends MovieClip {
public function zombieHead03_168(){
addFrameScript(0, frame1, 1, frame2, 6, frame7, 11, frame12, 12, frame13);
}
function frame12(){
stop();
}
function frame7(){
stop();
}
function frame1(){
stop();
}
function frame13(){
stop();
}
function frame2(){
stop();
}
}
}//package Days2Die_fla
Section 122
//zombieHead04_169 (Days2Die_fla.zombieHead04_169)
package Days2Die_fla {
import flash.display.*;
public dynamic class zombieHead04_169 extends MovieClip {
public function zombieHead04_169(){
addFrameScript(0, frame1, 1, frame2, 6, frame7, 11, frame12, 12, frame13);
}
function frame12(){
stop();
}
function frame7(){
stop();
}
function frame1(){
stop();
}
function frame13(){
stop();
}
function frame2(){
stop();
}
}
}//package Days2Die_fla
Section 123
//zombieHead05_170 (Days2Die_fla.zombieHead05_170)
package Days2Die_fla {
import flash.display.*;
public dynamic class zombieHead05_170 extends MovieClip {
public function zombieHead05_170(){
addFrameScript(0, frame1, 1, frame2, 6, frame7, 11, frame12, 12, frame13);
}
function frame12(){
stop();
}
function frame7(){
stop();
}
function frame1(){
stop();
}
function frame13(){
stop();
}
function frame2(){
stop();
}
}
}//package Days2Die_fla
Section 124
//zombieHeads_166 (Days2Die_fla.zombieHeads_166)
package Days2Die_fla {
import flash.display.*;
public dynamic class zombieHeads_166 extends MovieClip {
public var head:MovieClip;
public function zombieHeads_166(){
addFrameScript(0, frame1, 1, frame2, 2, frame3, 3, frame4, 4, frame5);
}
function frame3(){
stop();
}
function frame1(){
stop();
}
function frame4(){
stop();
}
function frame5(){
stop();
}
function frame2(){
stop();
}
}
}//package Days2Die_fla
Section 125
//zombieLegs01_158 (Days2Die_fla.zombieLegs01_158)
package Days2Die_fla {
import flash.display.*;
public dynamic class zombieLegs01_158 extends MovieClip {
public var animationDone:Boolean;
public var attackingDone:Boolean;
public function zombieLegs01_158(){
addFrameScript(0, frame1, 23, frame24, 24, frame25, 56, frame57, 57, frame58, 76, frame77, 77, frame78, 85, frame86, 86, frame87, 107, frame108);
}
function frame77(){
animationDone = true;
}
function frame78(){
animationDone = false;
attackingDone = false;
}
function frame86(){
animationDone = true;
attackingDone = true;
stop();
}
function frame87(){
animationDone = false;
}
function frame1(){
animationDone = false;
attackingDone = false;
}
function frame25(){
animationDone = false;
}
function frame24(){
animationDone = true;
gotoAndPlay("idle");
}
function frame108(){
animationDone = true;
stop();
}
function frame57(){
animationDone = true;
}
function frame58(){
animationDone = false;
}
}
}//package Days2Die_fla
Section 126
//zombieMainBody_159 (Days2Die_fla.zombieMainBody_159)
package Days2Die_fla {
import flash.display.*;
public dynamic class zombieMainBody_159 extends MovieClip {
public var torso:MovieClip;
public var animationDone:Boolean;
public var attackingDone:Boolean;
public function zombieMainBody_159(){
addFrameScript(0, frame1, 23, frame24, 24, frame25, 56, frame57, 57, frame58, 76, frame77, 77, frame78, 85, frame86, 86, frame87, 107, frame108);
}
function frame77(){
animationDone = true;
}
function frame78(){
animationDone = false;
attackingDone = false;
}
function frame86(){
animationDone = true;
attackingDone = true;
stop();
}
function frame87(){
animationDone = false;
}
function frame1(){
animationDone = false;
attackingDone = false;
}
function frame25(){
animationDone = false;
}
function frame24(){
animationDone = true;
gotoAndPlay("idle");
}
function frame108(){
animationDone = true;
stop();
}
function frame57(){
animationDone = true;
}
function frame58(){
animationDone = false;
}
}
}//package Days2Die_fla
Section 127
//zombieMainHead_165 (Days2Die_fla.zombieMainHead_165)
package Days2Die_fla {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.media.*;
import flash.utils.*;
import flash.text.*;
import flash.net.*;
import flash.system.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.printing.*;
import flash.ui.*;
import flash.xml.*;
public dynamic class zombieMainHead_165 extends MovieClip {
public var animationDone:Boolean;
public var attackingDone:Boolean;
public var head:MovieClip;
public function zombieMainHead_165(){
addFrameScript(0, frame1, 23, frame24, 24, frame25, 56, frame57, 57, frame58, 76, frame77, 77, frame78, 85, frame86, 86, frame87, 107, frame108);
}
function frame77(){
animationDone = true;
}
function frame78(){
animationDone = false;
attackingDone = false;
head.head.gotoAndStop("attack");
}
function frame86(){
animationDone = true;
attackingDone = true;
stop();
}
function frame87(){
animationDone = false;
}
function frame1(){
animationDone = false;
attackingDone = false;
head.head.gotoAndStop("idle");
}
function frame25(){
animationDone = false;
head.head.gotoAndStop("attack");
}
function frame24(){
animationDone = true;
gotoAndPlay("idle");
}
function frame108(){
animationDone = true;
stop();
}
function frame58(){
animationDone = false;
head.head.gotoAndStop("attack");
}
function frame57(){
animationDone = true;
}
}
}//package Days2Die_fla
Section 128
//KeyPoll (input.KeyPoll)
package input {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
public class KeyPoll {
private var states:ByteArray;
private var dispObj:DisplayObject;
public function KeyPoll(_arg1:DisplayObject){
states = new ByteArray();
states.writeUnsignedInt(0);
states.writeUnsignedInt(0);
states.writeUnsignedInt(0);
states.writeUnsignedInt(0);
states.writeUnsignedInt(0);
states.writeUnsignedInt(0);
states.writeUnsignedInt(0);
states.writeUnsignedInt(0);
dispObj = _arg1;
dispObj.addEventListener(KeyboardEvent.KEY_DOWN, keyDownListener, false, 0, true);
dispObj.addEventListener(KeyboardEvent.KEY_UP, keyUpListener, false, 1, true);
dispObj.addEventListener(Event.ACTIVATE, activateListener, false, 0, true);
dispObj.addEventListener(Event.DEACTIVATE, deactivateListener, false, 0, true);
}
public function isUp(_arg1:uint):Boolean{
return (((states[(_arg1 >>> 3)] & (1 << (_arg1 & 7))) == 0));
}
private function activateListener(_arg1:Event):void{
var _local2:int;
_local2 = 0;
while (_local2 < 32) {
states[_local2] = 0;
_local2++;
};
}
private function deactivateListener(_arg1:Event=null):void{
var _local2:int;
_local2 = 0;
while (_local2 < 32) {
states[_local2] = 0;
_local2++;
};
}
public function isDown(_arg1:uint):Boolean{
return (!(((states[(_arg1 >>> 3)] & (1 << (_arg1 & 7))) == 0)));
}
public function destroy():void{
if (dispObj){
dispObj.removeEventListener(KeyboardEvent.KEY_DOWN, keyDownListener);
dispObj.removeEventListener(KeyboardEvent.KEY_UP, keyUpListener);
dispObj.removeEventListener(Event.ACTIVATE, activateListener);
dispObj.removeEventListener(Event.DEACTIVATE, deactivateListener);
};
}
private function keyDownListener(_arg1:KeyboardEvent):void{
states[(_arg1.keyCode >>> 3)] = (states[(_arg1.keyCode >>> 3)] | (1 << (_arg1.keyCode & 7)));
}
private function keyUpListener(_arg1:KeyboardEvent):void{
states[(_arg1.keyCode >>> 3)] = (states[(_arg1.keyCode >>> 3)] & ~((1 << (_arg1.keyCode & 7))));
}
}
}//package input
Section 129
//MochiAd (mochi.as3.MochiAd)
package mochi.as3 {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.net.*;
import flash.system.*;
public class MochiAd {
public static function getVersion():String{
return ("3.0 as3");
}
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{
trace("[MochiAd] Couldn't load an ad, make sure your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, 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];
if (Security.sandboxType == "application"){
return (_local2);
};
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{
trace("[MochiAd] Couldn't load an ad, make sure your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, 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"){
trace("[MochiAd] WARNING: Using the MochiAds test identifier, make sure to use the code from your dashboard, not this example!");
};
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;
} else {
trace("[MochiAd] NOTE: Security Sandbox Violation errors below are normal");
};
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.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, function (_arg1:IOErrorEvent):void{
trace("[MochiAds] Blocked URL");
});
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;
default:
trace(("[mochiads rpc] unknown rpc id: " + _arg3.id));
};
}
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{
trace("[MochiAd] Couldn't load an ad, make sure your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, 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{
trace(("[MOCHIAD rpcTestFn] " + _arg1));
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{
trace("[MochiAd] DEPRECATED: showPreloaderAd was renamed to showPreGameAd in 2.0");
MochiAd.showPreGameAd(_arg1);
}
public static function showTimedAd(_arg1:Object):void{
trace("[MochiAd] DEPRECATED: showTimedAd was renamed to showInterLevelAd in 2.0");
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 mochi.as3
Section 130
//MochiDigits (mochi.as3.MochiDigits)
package mochi.as3 {
public final class MochiDigits {
private var Sibling:MochiDigits;
private var Fragment:Number;
private var Encoder:Number;
public function MochiDigits(_arg1:Number=0, _arg2:uint=0):void{
Encoder = 0;
setValue(_arg1, _arg2);
}
public function set value(_arg1:Number):void{
setValue(_arg1);
}
public function reencode():void{
var _local1:uint;
_local1 = int((2147483647 * Math.random()));
Fragment = (Fragment ^ (_local1 ^ Encoder));
Encoder = _local1;
}
public function toString():String{
var _local1:String;
_local1 = String.fromCharCode((Fragment ^ Encoder));
if (Sibling != null){
_local1 = (_local1 + Sibling.toString());
};
return (_local1);
}
public function get value():Number{
return (Number(this.toString()));
}
public function setValue(_arg1:Number=0, _arg2:uint=0):void{
var _local3:String;
_local3 = _arg1.toString();
var _temp1 = _arg2;
_arg2 = (_arg2 + 1);
Fragment = (_local3.charCodeAt(_temp1) ^ Encoder);
if (_arg2 < _local3.length){
Sibling = new MochiDigits(_arg1, _arg2);
} else {
Sibling = null;
};
reencode();
}
public function addValue(_arg1:Number):void{
value = (value + _arg1);
}
}
}//package mochi.as3
Section 131
//MochiScores (mochi.as3.MochiScores)
package mochi.as3 {
import flash.display.*;
import flash.text.*;
public class MochiScores {
private static var boardID:String;
public static var onErrorHandler:Object;
public static var onCloseHandler:Object;
public static function showLeaderboard(_arg1:Object=null):void{
var n:Number;
var options = _arg1;
if (options != null){
if (options.clip != null){
if ((options.clip is Sprite)){
MochiServices.setContainer(options.clip);
};
delete options.clip;
} else {
MochiServices.setContainer();
};
MochiServices.stayOnTop();
if (options.name != null){
if ((options.name is TextField)){
if (options.name.text.length > 0){
options.name = options.name.text;
};
};
};
if (options.score != null){
if ((options.score is TextField)){
if (options.score.text.length > 0){
options.score = options.score.text;
};
} else {
if ((options.score is MochiDigits)){
options.score = options.score.value;
};
};
n = Number(options.score);
if (isNaN(n)){
trace((("ERROR: Submitted score '" + options.score) + "' will be rejected, score is 'Not a Number'"));
} else {
if ((((n == Number.NEGATIVE_INFINITY)) || ((n == Number.POSITIVE_INFINITY)))){
trace((("ERROR: Submitted score '" + options.score) + "' will be rejected, score is an infinite"));
} else {
if (Math.floor(n) != n){
trace((("WARNING: Submitted score '" + options.score) + "' will be truncated"));
};
options.score = n;
};
};
};
if (options.onDisplay != null){
options.onDisplay();
} else {
if (MochiServices.clip != null){
if ((MochiServices.clip is MovieClip)){
MochiServices.clip.stop();
} else {
trace("Warning: Container is not a MovieClip, cannot call default onDisplay.");
};
};
};
} else {
options = {};
if ((MochiServices.clip is MovieClip)){
MochiServices.clip.stop();
} else {
trace("Warning: Container is not a MovieClip, cannot call default onDisplay.");
};
};
if (options.onClose != null){
onCloseHandler = options.onClose;
} else {
onCloseHandler = function ():void{
if ((MochiServices.clip is MovieClip)){
MochiServices.clip.play();
} else {
trace("Warning: Container is not a MovieClip, cannot call default onClose.");
};
};
};
if (options.onError != null){
onErrorHandler = options.onError;
} else {
onErrorHandler = null;
};
if (options.boardID == null){
if (MochiScores.boardID != null){
options.boardID = MochiScores.boardID;
};
};
trace("[MochiScores] NOTE: Security Sandbox Violation errors below are normal");
MochiServices.send("scores_showLeaderboard", {options:options}, null, onClose);
}
public static function closeLeaderboard():void{
MochiServices.send("scores_closeLeaderboard");
}
public static function getPlayerInfo(_arg1:Object, _arg2:Object=null):void{
MochiServices.send("scores_getPlayerInfo", null, _arg1, _arg2);
}
public static function requestList(_arg1:Object, _arg2:Object=null):void{
MochiServices.send("scores_requestList", null, _arg1, _arg2);
}
public static function scoresArrayToObjects(_arg1:Object):Object{
var _local2:Object;
var _local3:Number;
var _local4:Number;
var _local5:Object;
var _local6:Object;
var _local7:String;
var _local8:String;
_local2 = {};
for (_local7 in _arg1) {
if (typeof(_arg1[_local7]) == "object"){
if (((!((_arg1[_local7].cols == null))) && (!((_arg1[_local7].rows == null))))){
_local2[_local7] = [];
_local5 = _arg1[_local7];
_local4 = 0;
while (_local4 < _local5.rows.length) {
_local6 = {};
_local3 = 0;
while (_local3 < _local5.cols.length) {
_local6[_local5.cols[_local3]] = _local5.rows[_local4][_local3];
_local3++;
};
_local2[_local7].push(_local6);
_local4++;
};
} else {
_local2[_local7] = {};
for (_local8 in _arg1[_local7]) {
_local2[_local7][_local8] = _arg1[_local7][_local8];
};
};
} else {
_local2[_local7] = _arg1[_local7];
};
};
return (_local2);
}
public static function submit(_arg1:Number, _arg2:String, _arg3:Object=null, _arg4:Object=null):void{
_arg1 = Number(_arg1);
if (isNaN(_arg1)){
trace((("ERROR: Submitted score '" + String(_arg1)) + "' will be rejected, score is 'Not a Number'"));
} else {
if ((((_arg1 == Number.NEGATIVE_INFINITY)) || ((_arg1 == Number.POSITIVE_INFINITY)))){
trace((("ERROR: Submitted score '" + String(_arg1)) + "' will be rejected, score is an infinite"));
} else {
if (Math.floor(_arg1) != _arg1){
trace((("WARNING: Submitted score '" + String(_arg1)) + "' will be truncated"));
};
_arg1 = Number(_arg1);
};
};
MochiServices.send("scores_submit", {score:_arg1, name:_arg2}, _arg3, _arg4);
}
public static function onClose(_arg1:Object=null):void{
if (_arg1 != null){
if (_arg1.error != null){
if (_arg1.error == true){
if (onErrorHandler != null){
if (_arg1.errorCode == null){
_arg1.errorCode = "IOError";
};
onErrorHandler(_arg1.errorCode);
MochiServices.doClose();
return;
};
};
};
};
onCloseHandler();
MochiServices.doClose();
}
public static function setBoardID(_arg1:String):void{
MochiScores.boardID = _arg1;
MochiServices.send("scores_setBoardID", {boardID:_arg1});
}
}
}//package mochi.as3
Section 132
//MochiServices (mochi.as3.MochiServices)
package mochi.as3 {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.utils.*;
import flash.net.*;
import flash.system.*;
public class MochiServices {
private static var _container:Object;
private static var _connected:Boolean = false;
private static var _swfVersion:String;
public static var netupAttempted:Boolean = false;
private static var _sendChannel:LocalConnection;
private static var _clip:MovieClip;
private static var _loader:Loader;
private static var _id:String;
private static var _listenChannel:LocalConnection;
public static var widget:Boolean = false;
private static var _timer:Timer;
private static var _sendChannelName:String;
private static var _connecting:Boolean = false;
public static var onError:Object;
private static var _listenChannelName:String = "__ms_";
private static var _servicesURL:String = "http://www.mochiads.com/static/lib/services/services.swf";
public static var netup:Boolean = true;
public static function isNetworkAvailable():Boolean{
return (!((Security.sandboxType == "localWithFile")));
}
public static function get connected():Boolean{
return (_connected);
}
private static function flush(_arg1:Boolean):void{
var _local2:Object;
var _local3:Object;
if (_clip != null){
if (_clip._queue != null){
while (_clip._queue.length > 0) {
_local2 = _clip._queue.shift();
_local3 = null;
if (_local2 != null){
if (_local2.callbackID != null){
_local3 = _clip._callbacks[_local2.callbackID];
};
delete _clip._callbacks[_local2.callbackID];
if (((_arg1) && (!((_local3 == null))))){
handleError(_local2.args, _local3.callbackObject, _local3.callbackMethod);
};
};
};
};
};
}
public static function send(_arg1:String, _arg2:Object=null, _arg3:Object=null, _arg4:Object=null):void{
if (_connected){
_sendChannel.send(_sendChannelName, "onReceive", {methodName:_arg1, args:_arg2, callbackID:_clip._nextcallbackID});
} else {
if ((((_clip == null)) || (!(_connecting)))){
onError("NotConnected");
handleError(_arg2, _arg3, _arg4);
flush(true);
return;
};
_clip._queue.push({methodName:_arg1, args:_arg2, callbackID:_clip._nextcallbackID});
};
if (_clip != null){
if (((!((_clip._callbacks == null))) && (!((_clip._nextcallbackID == null))))){
_clip._callbacks[_clip._nextcallbackID] = {callbackObject:_arg3, callbackMethod:_arg4};
_clip._nextcallbackID++;
};
};
}
private static function init(_arg1:String, _arg2:Object):void{
_id = _arg1;
if (_arg2 != null){
_container = _arg2;
loadCommunicator(_arg1, _container);
};
}
public static function get childClip():Object{
return (_clip);
}
private static function clickMovie(_arg1:String, _arg2:Function):MovieClip{
var _local3:Array;
var _local4:int;
var _local5:Array;
var _local6:Array;
var _local7:MovieClip;
var _local8:LocalConnection;
var _local9:String;
var _local10:ByteArray;
var _local11:ByteArray;
var _local12:uint;
var _local13:uint;
var _local14:Loader;
_local3 = [150, 21, 0, 7, 1, 0, 0, 0, 0, 98, 116, 110, 0, 7, 2, 0, 0, 0, 0, 116, 104, 105, 115, 0, 28, 150, 22, 0, 0, 99, 114, 101, 97, 116, 101, 69, 109, 112, 116, 121, 77, 111, 118, 105, 101, 67, 108, 105, 112, 0, 82, 135, 1, 0, 0, 23, 150, 13, 0, 4, 0, 0, 111, 110, 82, 101, 108, 101, 97, 115, 101, 0, 142, 8, 0, 0, 0, 0, 2, 42, 0, 114, 0, 150, 17, 0, 0, 32, 0, 7, 1, 0, 0, 0, 8, 0, 0, 115, 112, 108, 105, 116, 0, 82, 135, 1, 0, 1, 23, 150, 7, 0, 4, 1, 7, 0, 0, 0, 0, 78, 150, 8, 0, 0, 95, 98, 108, 97, 110, 107, 0, 154, 1, 0, 0, 150, 7, 0, 0, 99, 108, 105, 99, 107, 0, 150, 7, 0, 4, 1, 7, 1, 0, 0, 0, 78, 150, 27, 0, 7, 2, 0, 0, 0, 7, 0, 0, 0, 0, 0, 76, 111, 99, 97, 108, 67, 111, 110, 110, 101, 99, 116, 105, 111, 110, 0, 64, 150, 6, 0, 0, 115, 101, 110, 100, 0, 82, 79, 150, 15, 0, 4, 0, 0, 95, 97, 108, 112, 104, 97, 0, 7, 0, 0, 0, 0, 79, 150, 23, 0, 7, 0xFF, 0, 0xFF, 0, 7, 1, 0, 0, 0, 4, 0, 0, 98, 101, 103, 105, 110, 70, 105, 108, 108, 0, 82, 23, 150, 25, 0, 7, 0, 0, 0, 0, 7, 0, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 109, 111, 118, 101, 84, 111, 0, 82, 23, 150, 25, 0, 7, 100, 0, 0, 0, 7, 0, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 108, 105, 110, 101, 84, 111, 0, 82, 23, 150, 25, 0, 7, 100, 0, 0, 0, 7, 100, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 108, 105, 110, 101, 84, 111, 0, 82, 23, 150, 25, 0, 7, 0, 0, 0, 0, 7, 100, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 108, 105, 110, 101, 84, 111, 0, 82, 23, 150, 25, 0, 7, 0, 0, 0, 0, 7, 0, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 108, 105, 110, 101, 84, 111, 0, 82, 23, 150, 16, 0, 7, 0, 0, 0, 0, 4, 0, 0, 101, 110, 100, 70, 105, 108, 108, 0, 82, 23];
_local5 = [104, 0, 31, 64, 0, 7, 208, 0, 0, 12, 1, 0, 67, 2, 0xFF, 0xFF, 0xFF, 63, 3];
_local6 = [0, 64, 0, 0, 0];
_local7 = new MovieClip();
_local8 = new LocalConnection();
_local9 = ((("_click_" + Math.floor((Math.random() * 999999))) + "_") + Math.floor(new Date().getTime()));
_local8 = new LocalConnection();
_local7.lc = _local8;
_local7.click = _arg2;
_local8.client = _local7;
_local8.connect(_local9);
_local10 = new ByteArray();
_local11 = new ByteArray();
_local11.endian = Endian.LITTLE_ENDIAN;
_local11.writeShort(1);
_local11.writeUTFBytes(((_arg1 + " ") + _local9));
_local11.writeByte(0);
_local12 = ((_local3.length + _local11.length) + 4);
_local13 = (_local12 + 35);
_local10.endian = Endian.LITTLE_ENDIAN;
_local10.writeUTFBytes("FWS");
_local10.writeByte(8);
_local10.writeUnsignedInt(_local13);
for each (_local4 in _local5) {
_local10.writeByte(_local4);
};
_local10.writeUnsignedInt(_local12);
_local10.writeByte(136);
_local10.writeShort(_local11.length);
_local10.writeBytes(_local11);
for each (_local4 in _local3) {
_local10.writeByte(_local4);
};
for each (_local4 in _local6) {
_local10.writeByte(_local4);
};
_local14 = new Loader();
_local14.loadBytes(_local10);
_local7.addChild(_local14);
return (_local7);
}
public static function stayOnTop():void{
_container.addEventListener(Event.ENTER_FRAME, MochiServices.bringToTop, false, 0, true);
if (_clip != null){
_clip.visible = true;
};
}
public static function addLinkEvent(_arg1:String, _arg2:String, _arg3:DisplayObjectContainer, _arg4:Function=null):void{
var vars:Object;
var avm1Click:DisplayObject;
var s:String;
var i:Number;
var x:String;
var req:URLRequest;
var loader:Loader;
var setURL:Function;
var err:Function;
var complete:Function;
var url = _arg1;
var burl = _arg2;
var btn = _arg3;
var onClick = _arg4;
vars = new Object();
vars["mav"] = getVersion();
vars["swfv"] = "9";
vars["swfurl"] = btn.loaderInfo.loaderURL;
vars["fv"] = Capabilities.version;
vars["os"] = Capabilities.os;
vars["lang"] = Capabilities.language;
vars["scres"] = ((Capabilities.screenResolutionX + "x") + Capabilities.screenResolutionY);
s = "?";
i = 0;
for (x in vars) {
if (i != 0){
s = (s + "&");
};
i = (i + 1);
s = (((s + x) + "=") + escape(vars[x]));
};
req = new URLRequest("http://x.mochiads.com/linkping.swf");
loader = new Loader();
setURL = function (_arg1:String):void{
var _local2:Rectangle;
if (avm1Click){
btn.removeChild(avm1Click);
};
avm1Click = clickMovie(_arg1, onClick);
_local2 = btn.getBounds(btn);
btn.addChild(avm1Click);
avm1Click.x = _local2.x;
avm1Click.y = _local2.y;
avm1Click.scaleX = (0.01 * _local2.width);
avm1Click.scaleY = (0.01 * _local2.height);
};
err = function (_arg1:Object):void{
netup = false;
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
setURL(burl);
};
complete = function (_arg1:Object):void{
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
};
if (netup){
setURL((url + s));
} else {
setURL(burl);
};
if (!((netupAttempted) || (_connected))){
netupAttempted = true;
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, err);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, complete);
loader.load(req);
};
}
public static function disconnect():void{
if (((_connected) || (_connecting))){
if (_clip != null){
if (_clip.parent != null){
if ((_clip.parent is Sprite)){
Sprite(_clip.parent).removeChild(_clip);
_clip = null;
};
};
};
_connecting = (_connected = false);
flush(true);
try {
_listenChannel.close();
} catch(error:Error) {
};
};
if (_timer != null){
try {
_timer.stop();
} catch(error:Error) {
};
};
}
public static function allowDomains(_arg1:String):String{
var _local2:String;
if (Security.sandboxType != "application"){
Security.allowDomain("*");
Security.allowInsecureDomain("*");
};
if (_arg1.indexOf("http://") != -1){
_local2 = _arg1.split("/")[2].split(":")[0];
if (Security.sandboxType != "application"){
Security.allowDomain(_local2);
Security.allowInsecureDomain(_local2);
};
};
return (_local2);
}
public static function getVersion():String{
return ("3.0");
}
public static function doClose():void{
_container.removeEventListener(Event.ENTER_FRAME, MochiServices.bringToTop);
if (_clip.parent != null){
Sprite(_clip.parent).removeChild(_clip);
};
}
private static function onStatus(_arg1:StatusEvent):void{
switch (_arg1.level){
case "error":
_connected = false;
_listenChannel.connect(_listenChannelName);
break;
};
}
public static function get id():String{
return (_id);
}
private static function urlOptions(_arg1:Object):Object{
var _local2:Object;
var _local3:String;
var _local4:Array;
var _local5:Number;
var _local6:Array;
_local2 = {};
_local3 = _arg1.loaderInfo.parameters.mochiad_options;
if (_local3){
_local4 = _local3.split("&");
_local5 = 0;
while (_local5 < _local4.length) {
_local6 = _local4[_local5].split("=");
_local2[unescape(_local6[0])] = unescape(_local6[1]);
_local5++;
};
};
return (_local2);
}
public static function setContainer(_arg1:Object=null, _arg2:Boolean=true):void{
if (_arg1 != null){
if ((_arg1 is Sprite)){
_container = _arg1;
};
};
if (_arg2){
if ((_container is Sprite)){
Sprite(_container).addChild(_clip);
};
};
}
private static function handleError(_arg1:Object, _arg2:Object, _arg3:Object):void{
var args = _arg1;
var callbackObject = _arg2;
var callbackMethod = _arg3;
if (args != null){
if (args.onError != null){
args.onError.apply(null, ["NotConnected"]);
};
if (((!((args.options == null))) && (!((args.options.onError == null))))){
args.options.onError.apply(null, ["NotConnected"]);
};
};
if (callbackMethod != null){
args = {};
args.error = true;
args.errorCode = "NotConnected";
if (((!((callbackObject == null))) && ((callbackMethod is String)))){
try {
var _local5 = callbackObject;
_local5[callbackMethod](args);
} catch(error:Error) {
};
} else {
if (callbackMethod != null){
try {
callbackMethod.apply(args);
} catch(error:Error) {
};
};
};
};
}
private static function initComChannels():void{
if (!_connected){
_sendChannel.addEventListener(StatusEvent.STATUS, MochiServices.onStatus);
_sendChannel.send(_sendChannelName, "onReceive", {methodName:"handshakeDone"});
_sendChannel.send(_sendChannelName, "onReceive", {methodName:"registerGame", id:_id, clip:_container, version:getVersion(), parentURL:_container.loaderInfo.loaderURL});
_listenChannel.addEventListener(StatusEvent.STATUS, MochiServices.onStatus);
_clip.onReceive = function (_arg1:Object):void{
var cb:String;
var cblst:Object;
var method:*;
var methodName:String;
var obj:Object;
var pkg = _arg1;
cb = pkg.callbackID;
cblst = this.client._callbacks[cb];
if (!cblst){
return;
};
method = cblst.callbackMethod;
methodName = "";
obj = cblst.callbackObject;
if (((obj) && ((typeof(method) == "string")))){
methodName = method;
if (obj[method] != null){
method = obj[method];
} else {
trace((("Error: Method " + method) + " does not exist."));
};
};
if (method != undefined){
try {
method.apply(obj, pkg.args);
} catch(error:Error) {
trace(((("Error invoking callback method '" + methodName) + "': ") + error.toString()));
};
} else {
if (obj != null){
try {
obj(pkg.args);
} catch(error:Error) {
trace(("Error invoking method on object: " + error.toString()));
};
};
};
delete this.client._callbacks[cb];
};
_clip.onError = function ():void{
MochiServices.onError("IOError");
};
trace("connected!");
_connecting = false;
_connected = true;
while (_clip._queue.length > 0) {
_sendChannel.send(_sendChannelName, "onReceive", _clip._queue.shift());
};
};
}
private static function listen():void{
_listenChannel = new LocalConnection();
_listenChannel.client = _clip;
_clip.handshake = function (_arg1:Object):void{
MochiServices.comChannelName = _arg1.newChannel;
};
_listenChannel.allowDomain("*", "localhost");
_listenChannel.allowInsecureDomain("*", "localhost");
_listenChannel.connect(_listenChannelName);
trace("Waiting for MochiAds services to connect...");
}
public static function set comChannelName(_arg1:String):void{
if (_arg1 != null){
if (_arg1.length > 3){
_sendChannelName = (_arg1 + "_fromgame");
initComChannels();
};
};
}
private static function loadCommunicator(_arg1:String, _arg2:Object):MovieClip{
var clipname:String;
var f:Function;
var req:URLRequest;
var vars:URLVariables;
var id = _arg1;
var clip = _arg2;
clipname = ("_mochiservices_com_" + id);
if (_clip != null){
return (_clip);
};
if (!MochiServices.isNetworkAvailable()){
return (null);
};
if (urlOptions(clip).servicesURL != undefined){
_servicesURL = urlOptions(clip).servicesURL;
};
MochiServices.allowDomains(_servicesURL);
_clip = createEmptyMovieClip(clip, clipname, 10336, false);
_loader = new Loader();
f = function (_arg1:Object):void{
_clip._mochiad_ctr_failed = true;
trace("MochiServices could not load.");
MochiServices.disconnect();
MochiServices.onError("IOError");
};
_listenChannelName = (_listenChannelName + ((Math.floor(new Date().getTime()) + "_") + Math.floor((Math.random() * 99999))));
_loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, f);
req = new URLRequest(_servicesURL);
vars = new URLVariables();
vars.listenLC = _listenChannelName;
vars.mochiad_options = clip.loaderInfo.parameters.mochiad_options;
if (widget){
vars.widget = true;
};
req.data = vars;
listen();
_loader.load(req);
_clip.addChild(_loader);
_clip._mochiservices_com = _loader;
_sendChannel = new LocalConnection();
_clip._queue = [];
_clip._nextcallbackID = 0;
_clip._callbacks = {};
_timer = new Timer(10000, 1);
_timer.addEventListener(TimerEvent.TIMER, connectWait);
_timer.start();
return (_clip);
}
public static function get clip():Object{
return (_container);
}
public static function bringToTop(_arg1:Event):void{
var e = _arg1;
if (MochiServices.clip != null){
if (MochiServices.childClip != null){
try {
if (MochiServices.clip.numChildren > 1){
MochiServices.clip.setChildIndex(MochiServices.childClip, (MochiServices.clip.numChildren - 1));
};
} catch(errorObject:Error) {
trace("Warning: Depth sort error.");
_container.removeEventListener(Event.ENTER_FRAME, MochiServices.bringToTop);
};
};
};
}
public static function connect(_arg1:String, _arg2:Object, _arg3:Object=null):void{
var id = _arg1;
var clip = _arg2;
var onError = _arg3;
if ((clip is DisplayObject)){
if (((!(_connected)) && ((_clip == null)))){
trace("MochiServices Connecting...");
_connecting = true;
init(id, clip);
};
} else {
trace("Error, MochiServices requires a Sprite, Movieclip or instance of the stage.");
};
if (onError != null){
MochiServices.onError = onError;
} else {
if (MochiServices.onError == null){
MochiServices.onError = function (_arg1:String):void{
trace(_arg1);
};
};
};
}
public static function createEmptyMovieClip(_arg1:Object, _arg2:String, _arg3:Number, _arg4:Boolean=true):MovieClip{
var mc:MovieClip;
var parent = _arg1;
var name = _arg2;
var depth = _arg3;
var doAdd = _arg4;
mc = new MovieClip();
if (doAdd){
if (((false) && (depth))){
parent.addChildAt(mc, depth);
} else {
parent.addChild(mc);
};
};
try {
parent[name] = mc;
} catch(e:Error) {
throw (new Error("MochiServices requires a clip that is an instance of a dynamic class. If your class extends Sprite or MovieClip, you must make it dynamic."));
};
mc["_name"] = name;
return (mc);
}
public static function connectWait(_arg1:TimerEvent):void{
if (!_connected){
_clip._mochiad_ctr_failed = true;
trace("MochiServices could not load. (timeout)");
MochiServices.disconnect();
MochiServices.onError("IOError");
};
}
}
}//package mochi.as3
Section 133
//ConcurrentModificationException (org.idmedia.as3commons.lang.ConcurrentModificationException)
package org.idmedia.as3commons.lang {
public class ConcurrentModificationException extends Exception {
public function ConcurrentModificationException(_arg1:String=""){
super(_arg1);
}
}
}//package org.idmedia.as3commons.lang
Section 134
//Exception (org.idmedia.as3commons.lang.Exception)
package org.idmedia.as3commons.lang {
public class Exception extends Throwable {
public function Exception(_arg1:String){
super(_arg1);
}
}
}//package org.idmedia.as3commons.lang
Section 135
//IllegalStateException (org.idmedia.as3commons.lang.IllegalStateException)
package org.idmedia.as3commons.lang {
public class IllegalStateException extends Exception {
public function IllegalStateException(_arg1:String=""){
super(_arg1);
}
}
}//package org.idmedia.as3commons.lang
Section 136
//IndexOutOfBoundsException (org.idmedia.as3commons.lang.IndexOutOfBoundsException)
package org.idmedia.as3commons.lang {
public class IndexOutOfBoundsException extends Exception {
public function IndexOutOfBoundsException(_arg1:String=""){
super(_arg1);
}
}
}//package org.idmedia.as3commons.lang
Section 137
//NoSuchElementException (org.idmedia.as3commons.lang.NoSuchElementException)
package org.idmedia.as3commons.lang {
public class NoSuchElementException extends Exception {
public function NoSuchElementException(_arg1:String=""){
super(_arg1);
}
}
}//package org.idmedia.as3commons.lang
Section 138
//NullPointerException (org.idmedia.as3commons.lang.NullPointerException)
package org.idmedia.as3commons.lang {
public class NullPointerException extends Exception {
public function NullPointerException(_arg1:String=""){
super(_arg1);
}
}
}//package org.idmedia.as3commons.lang
Section 139
//Throwable (org.idmedia.as3commons.lang.Throwable)
package org.idmedia.as3commons.lang {
import flash.utils.*;
public class Throwable extends Error {
public function Throwable(_arg1:String){
super(_arg1);
}
public function getName():String{
return (getQualifiedClassName(this));
}
public function getMessage():String{
return (message);
}
}
}//package org.idmedia.as3commons.lang
Section 140
//UnsupportedOperationException (org.idmedia.as3commons.lang.UnsupportedOperationException)
package org.idmedia.as3commons.lang {
public class UnsupportedOperationException extends Exception {
public function UnsupportedOperationException(_arg1:String=""){
super(_arg1);
}
}
}//package org.idmedia.as3commons.lang
Section 141
//AbstractCollection (org.idmedia.as3commons.util.AbstractCollection)
package org.idmedia.as3commons.util {
import org.idmedia.as3commons.lang.*;
public class AbstractCollection implements Collection {
public function addAll(_arg1:Collection):Boolean{
var _local2:Boolean;
var _local3:Iterator;
_local2 = false;
_local3 = _arg1.iterator();
while (_local3.hasNext()) {
if (add(_local3.next())){
_local2 = true;
};
};
return (_local2);
}
public function containsAll(_arg1:Collection):Boolean{
var _local2:Iterator;
_local2 = _arg1.iterator();
while (_local2.hasNext()) {
if (!contains(_local2.next())){
return (false);
};
};
return (true);
}
public function isEmpty():Boolean{
return ((size() == 0));
}
public function remove(_arg1=null):Boolean{
var _local2:Iterator;
_local2 = iterator();
while (_local2.hasNext()) {
if (_local2.next() == _arg1){
_local2.remove();
return (true);
};
};
return (false);
}
public function size():int{
return (0);
}
public function clear():void{
var _local1:Iterator;
_local1 = iterator();
while (_local1.hasNext()) {
_local1.next();
_local1.remove();
};
}
public function add(_arg1):Boolean{
throw (new UnsupportedOperationException());
}
public function toArray():Array{
var _local1:Array;
var _local2:Iterator;
_local1 = new Array();
_local2 = iterator();
while (_local2.hasNext()) {
_local1.push(_local2.next());
};
return (_local1);
}
public function contains(_arg1):Boolean{
return ((toArray().indexOf(_arg1) > -1));
}
public function iterator():Iterator{
return (null);
}
public function equals(_arg1):Boolean{
return ((_arg1 === this));
}
}
}//package org.idmedia.as3commons.util
Section 142
//AbstractList (org.idmedia.as3commons.util.AbstractList)
package org.idmedia.as3commons.util {
import org.idmedia.as3commons.lang.*;
public class AbstractList extends AbstractCollection implements List {
private var modCount:int;// = 0
public function AbstractList(){
modCount = 0;
super();
}
override public function addAll(_arg1:Collection):Boolean{
throw (new UnsupportedOperationException());
}
override public function clear():void{
removeRange(0, size());
}
public function get(_arg1:int){
return (null);
}
public function indexOf(_arg1=null):int{
return (toArray().indexOf(_arg1));
}
private function removeRange(_arg1:int, _arg2:int):void{
var _local3:ListIterator;
var _local4:int;
var _local5:int;
_local3 = indexedListIterator(_arg1);
_local4 = 0;
_local5 = (_arg2 - _arg1);
while (_local4 < _local5) {
_local3.next();
_local3.remove();
_local4++;
};
}
override public function add(_arg1):Boolean{
return (addAt(size(), _arg1));
}
public function removeAtTo(_arg1:int, _arg2:int):Boolean{
throw (new UnsupportedOperationException());
}
public function listIterator():ListIterator{
return (new ListIteratorImpl(this));
}
override public function iterator():Iterator{
return (new ListIteratorImpl(this));
}
public function removeAt(_arg1:int):Boolean{
throw (new UnsupportedOperationException());
}
public function removeAtAndReturn(_arg1:int){
throw (new UnsupportedOperationException());
}
public function addAt(_arg1:int, _arg2):Boolean{
throw (new UnsupportedOperationException());
}
public function setAt(_arg1:int, _arg2):Boolean{
throw (new UnsupportedOperationException());
}
public function indexedListIterator(_arg1:uint):ListIterator{
var _local2:ListIterator;
if ((((_arg1 < 0)) || ((_arg1 > size())))){
throw (new IndexOutOfBoundsException(("Index: " + _arg1)));
};
_local2 = listIterator();
_local2.setIndex(_arg1);
return (_local2);
}
}
}//package org.idmedia.as3commons.util
import org.idmedia.as3commons.lang.*;
class ListIteratorImpl extends IteratorImpl implements ListIterator {
private function ListIteratorImpl(_arg1:List){
super(_arg1);
}
public function setIndex(_arg1:int):void{
if ((((_arg1 < 0)) || ((_arg1 >= list.size())))){
throw (new IndexOutOfBoundsException(("Index: " + _arg1)));
};
cursor = _arg1;
}
public function add(_arg1):void{
var object = _arg1;
try {
list.addAt(cursor++, object);
lastRet = -1;
} catch(e:IndexOutOfBoundsException) {
throw (new ConcurrentModificationException());
};
}
public function previousIndex():int{
return ((cursor - 1));
}
public function nextIndex():int{
return (cursor);
}
public function setValue(_arg1):void{
var object = _arg1;
if (lastRet == -1){
throw (new IllegalStateException());
};
try {
list.setAt(lastRet, object);
} catch(e:IndexOutOfBoundsException) {
throw (new ConcurrentModificationException());
};
}
public function hasPrevious():Boolean{
return (!((cursor == 0)));
}
public function previous(){
var i:int;
var previousValue:*;
try {
i = (cursor - 1);
previousValue = list.get(i);
lastRet = (cursor = i);
return (previousValue);
} catch(e:IndexOutOfBoundsException) {
throw (new NoSuchElementException());
};
}
}
class IteratorImpl implements Iterator {
protected var lastRet:int;// = -1
protected var cursor:int;// = 0
protected var list:List;
private function IteratorImpl(_arg1:List){
cursor = 0;
lastRet = -1;
super();
this.list = _arg1;
}
public function next(){
var nextValue:*;
try {
nextValue = list.get(cursor);
lastRet = cursor;
cursor++;
return (nextValue);
} catch(e:IndexOutOfBoundsException) {
throw (new NoSuchElementException());
};
}
public function remove():void{
if (lastRet == -1){
throw (new IllegalStateException());
};
try {
list.removeAt(lastRet);
if (lastRet < cursor){
cursor--;
};
lastRet = -1;
} catch(e:IndexOutOfBoundsException) {
throw (new ConcurrentModificationException(e.getMessage()));
};
}
public function hasNext():Boolean{
return ((cursor < list.size()));
}
}
Section 143
//ArrayList (org.idmedia.as3commons.util.ArrayList)
package org.idmedia.as3commons.util {
import org.idmedia.as3commons.lang.*;
public class ArrayList extends AbstractList implements List {
private var elementData:Array;
private var elementSize:int;
public function ArrayList(_arg1:Collection=null){
elementData = new Array();
elementSize = 0;
if (_arg1 != null){
elementData = elementData.concat(_arg1.toArray());
elementSize = elementData.length;
};
}
override public function addAll(_arg1:Collection):Boolean{
var _local2:Array;
var _local3:int;
if (_arg1 == null){
throw (new NullPointerException());
};
_local2 = _arg1.toArray();
_local3 = (elementSize + _local2.length);
elementData = elementData.concat(_local2);
elementSize = elementData.length;
return ((elementSize === _local3));
}
override public function isEmpty():Boolean{
return ((elementSize == 0));
}
override public function size():int{
return (((elementSize) || (0)));
}
override public function clear():void{
elementData = new Array();
elementSize = 0;
}
private function rangeCheck(_arg1:int):void{
if ((((_arg1 >= elementSize)) || ((_arg1 < 0)))){
throw (new IndexOutOfBoundsException((((("Index: " + _arg1) + ", ") + "Size: ") + elementSize)));
};
}
public function removeAtToAndReturn(_arg1:int, _arg2:int){
var _local3:*;
rangeCheck(_arg1);
_local3 = get(_arg1);
removeAtTo(_arg1, _arg2);
return (_local3);
}
override public function get(_arg1:int){
rangeCheck(_arg1);
return (elementData[_arg1]);
}
override public function toArray():Array{
return ([].concat(elementData));
}
override public function add(_arg1):Boolean{
var _local2 = elementSize++;
elementData[_local2] = _arg1;
return (true);
}
override public function removeAtAndReturn(_arg1:int){
return (removeAtToAndReturn(_arg1, 1));
}
override public function removeAt(_arg1:int):Boolean{
return (removeAtTo(_arg1, 1));
}
override public function removeAtTo(_arg1:int, _arg2:int):Boolean{
rangeCheck(_arg1);
elementData.splice(_arg1, _arg2);
elementSize = elementData.length;
return (true);
}
override public function addAt(_arg1:int, _arg2):Boolean{
var _local3:Array;
var _local4:Array;
rangeCheck(_arg1);
_local3 = elementData.slice(0, _arg1);
_local4 = elementData.slice(_arg1);
elementData = _local3.concat(_arg2).concat(_local4);
elementSize = elementData.length;
return (true);
}
override public function setAt(_arg1:int, _arg2):Boolean{
rangeCheck(_arg1);
elementData[_arg1] = _arg2;
return (true);
}
}
}//package org.idmedia.as3commons.util
Section 144
//Collection (org.idmedia.as3commons.util.Collection)
package org.idmedia.as3commons.util {
public interface Collection {
function addAll(_arg1:Collection):Boolean;
function add(_arg1):Boolean;
function containsAll(_arg1:Collection):Boolean;
function isEmpty():Boolean;
function remove(_arg1=null):Boolean;
function clear():void;
function iterator():Iterator;
function size():int;
function toArray():Array;
function contains(_arg1):Boolean;
}
}//package org.idmedia.as3commons.util
Section 145
//Iterator (org.idmedia.as3commons.util.Iterator)
package org.idmedia.as3commons.util {
public interface Iterator {
function next();
function remove():void;
function hasNext():Boolean;
}
}//package org.idmedia.as3commons.util
Section 146
//List (org.idmedia.as3commons.util.List)
package org.idmedia.as3commons.util {
public interface List extends Collection {
function indexOf(_arg1=null):int;
function listIterator():ListIterator;
function removeAtAndReturn(_arg1:int);
function addAt(_arg1:int, _arg2):Boolean;
function setAt(_arg1:int, _arg2):Boolean;
function get(_arg1:int);
function removeAt(_arg1:int):Boolean;
function removeAtTo(_arg1:int, _arg2:int):Boolean;
function indexedListIterator(_arg1:uint):ListIterator;
}
}//package org.idmedia.as3commons.util
Section 147
//ListIterator (org.idmedia.as3commons.util.ListIterator)
package org.idmedia.as3commons.util {
public interface ListIterator extends Iterator {
function add(_arg1):void;
function setValue(_arg1):void;
function setIndex(_arg1:int):void;
function hasPrevious():Boolean;
function previous();
function previousIndex():int;
function nextIndex():int;
}
}//package org.idmedia.as3commons.util
Section 148
//Ammo (p_ammo.Ammo)
package p_ammo {
public class Ammo {
public var amount:int;
public var id:String;
public function Ammo(_arg1:int){
this.amount = _arg1;
}
}
}//package p_ammo
Section 149
//Ammo12Gauge (p_ammo.Ammo12Gauge)
package p_ammo {
public class Ammo12Gauge extends Ammo {
public function Ammo12Gauge(_arg1:int){
super(_arg1);
id = AmmoType.AMMO_12_GAUGE;
}
}
}//package p_ammo
Section 150
//Ammo357 (p_ammo.Ammo357)
package p_ammo {
public class Ammo357 extends Ammo {
public function Ammo357(_arg1:int){
super(_arg1);
id = AmmoType.AMMO_357;
}
}
}//package p_ammo
Section 151
//Ammo45 (p_ammo.Ammo45)
package p_ammo {
public class Ammo45 extends Ammo {
public function Ammo45(_arg1:int){
super(_arg1);
id = AmmoType.AMMO_45;
}
}
}//package p_ammo
Section 152
//Ammo556 (p_ammo.Ammo556)
package p_ammo {
public class Ammo556 extends Ammo {
public function Ammo556(_arg1:int){
super(_arg1);
id = AmmoType.AMMO_556;
}
}
}//package p_ammo
Section 153
//Ammo762 (p_ammo.Ammo762)
package p_ammo {
public class Ammo762 extends Ammo {
public function Ammo762(_arg1:int){
super(_arg1);
id = AmmoType.AMMO_762;
}
}
}//package p_ammo
Section 154
//Ammo9mm (p_ammo.Ammo9mm)
package p_ammo {
public class Ammo9mm extends Ammo {
public function Ammo9mm(_arg1:int){
super(_arg1);
id = AmmoType.AMMO_9MM;
}
}
}//package p_ammo
Section 155
//AmmoType (p_ammo.AmmoType)
package p_ammo {
public class AmmoType {
public static var AMMO_762:String = "7.62";
public static var AMMO_556:String = "5.56";
public static var AMMO_9MM:String = "9mm";
public static var AMMO_357:String = ".357";
public static var AMMO_12_GAUGE:String = "12 Gauge";
public static var AMMO_45:String = ".45";
}
}//package p_ammo
Section 156
//Barricade (p_barricade.Barricade)
package p_barricade {
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import flash.events.*;
import p_char.*;
import p_singleton.*;
import flash.display.*;
import flash.utils.*;
public class Barricade extends MovieClip {
public var friction:Number;
public var bodyType:int;
public var active:Boolean;
public var bodyDef:b2BodyDef;
public var position:b2Vec2;
public var deathTimer:Timer;
public var health:Number;
public var polygonDef:b2PolygonDef;
public var deathTime:int;
public var direction:b2Vec2;
public var restitution:Number;
public var body:b2Body;
public var localPrice:int;
public var screenPosition:b2Vec2;
public var angle:Number;
public var maxHealth:Number;
public var density:Number;
public static var price:int = 200;
public function Barricade(){
angle = 0;
density = 1;
friction = 0.5;
restitution = 0;
bodyType = BodyType.BARRICADE;
health = 20;
position = new b2Vec2();
screenPosition = new b2Vec2();
deathTime = 1;
active = true;
}
public function destroy():void{
if (body){
World.getSingleton().physicWorld.DestroyBody(body);
body = null;
deathTimer.start();
};
if (World.getSingleton().barricades.contains(this)){
World.getSingleton().barricades.remove(this);
};
}
public function animateDeath(_arg1:TimerEvent):void{
if (deathTime <= 0){
deathTimer.stop();
deathTimer.removeEventListener(TimerEvent.TIMER, animateDeath);
if (this.parent){
if (this.parent.contains(this)){
this.parent.removeChild(this);
World.getSingleton().setFocusToStage();
};
};
} else {
deathTime--;
};
}
public function initTimer():void{
deathTimer = new Timer(100);
deathTimer.addEventListener(TimerEvent.TIMER, animateDeath);
}
public function initRigidBody():void{
var _local1:b2World;
var _local2:Number;
_local1 = World.getSingleton().physicWorld;
if (_local1){
_local2 = rotation;
rotation = 0;
polygonDef = new b2PolygonDef();
polygonDef.SetAsBox((this.width / (2 * 30)), (this.height / (2 * 30)));
polygonDef.filter.groupIndex = BodyType.PLAYER;
rotation = _local2;
polygonDef.density = density;
polygonDef.friction = friction;
polygonDef.restitution = restitution;
bodyDef = new b2BodyDef();
bodyDef.userData = this;
bodyDef.position.Set((x / World.physScale), (y / World.physScale));
bodyDef.angle = b2Math.degreesToRadians(rotation);
body = _local1.CreateBody(bodyDef);
body.CreateShape(polygonDef);
body.SetMassFromShapes();
body.type = bodyType;
};
}
public function calculateDamage():void{
if (body.gotShot){
body.gotShot = false;
body.m_linearDamping = 0;
body.ApplyImpulse(body.impulseApplied, body.pointCollision);
health = (health - body.damage);
};
if (health <= 0){
destroy();
} else {
if (health <= (maxHealth * 0.25)){
gotoAndStop(4);
} else {
if (health <= (maxHealth * 0.5)){
gotoAndStop(3);
} else {
if (health <= (maxHealth * 0.75)){
gotoAndStop(2);
} else {
if (health <= maxHealth){
gotoAndStop(1);
};
};
};
};
};
}
public function update():void{
this.x = position.x;
this.y = position.y;
this.rotation = angle;
calculateDamage();
}
}
}//package p_barricade
Section 157
//TestBox (p_barricade.TestBox)
package p_barricade {
public class TestBox extends Barricade {
}
}//package p_barricade
Section 158
//TestTriangle (p_barricade.TestTriangle)
package p_barricade {
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import p_singleton.*;
public class TestTriangle extends Barricade {
override public function initRigidBody():void{
var _local1:b2World;
var _local2:Number;
_local1 = World.getSingleton().physicWorld;
if (_local1){
_local2 = rotation;
rotation = 0;
polygonDef = new b2PolygonDef();
polygonDef.vertexCount = 3;
polygonDef.vertices[0] = new b2Vec2((width / (2 * 30)), (height / (2 * 30)));
polygonDef.vertices[1] = new b2Vec2((-(width) / (2 * 30)), (height / (2 * 30)));
polygonDef.vertices[2] = new b2Vec2((-(width) / (2 * 30)), (-(height) / (2 * 30)));
rotation = _local2;
polygonDef.density = density;
polygonDef.friction = friction;
polygonDef.restitution = restitution;
polygonDef.filter.groupIndex = bodyType;
bodyDef = new b2BodyDef();
bodyDef.userData = this;
bodyDef.position.Set((x / World.physScale), (y / World.physScale));
bodyDef.angle = b2Math.degreesToRadians(rotation);
body = _local1.CreateBody(bodyDef);
body.CreateShape(polygonDef);
body.SetMassFromShapes();
body.type = bodyType;
};
}
}
}//package p_barricade
Section 159
//TestTriangle2 (p_barricade.TestTriangle2)
package p_barricade {
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import p_singleton.*;
public class TestTriangle2 extends Barricade {
override public function initRigidBody():void{
var _local1:b2World;
var _local2:Number;
_local1 = World.getSingleton().physicWorld;
if (_local1){
_local2 = rotation;
rotation = 0;
polygonDef = new b2PolygonDef();
polygonDef.vertexCount = 3;
polygonDef.vertices[0] = new b2Vec2((width / (2 * 30)), (height / (2 * 30)));
polygonDef.vertices[1] = new b2Vec2((-(width) / (2 * 30)), (height / (2 * 30)));
polygonDef.vertices[2] = new b2Vec2(0, (-(height) / (2 * 30)));
rotation = _local2;
polygonDef.density = density;
polygonDef.friction = friction;
polygonDef.restitution = restitution;
polygonDef.filter.groupIndex = bodyType;
bodyDef = new b2BodyDef();
bodyDef.userData = this;
bodyDef.position.Set((x / World.physScale), (y / World.physScale));
bodyDef.angle = b2Math.degreesToRadians(rotation);
body = _local1.CreateBody(bodyDef);
body.CreateShape(polygonDef);
body.SetMassFromShapes();
body.type = bodyType;
};
}
}
}//package p_barricade
Section 160
//Billboard (p_billboard.Billboard)
package p_billboard {
import Box2D.Common.Math.*;
import flash.events.*;
import p_singleton.*;
import flash.display.*;
import flash.utils.*;
import flash.text.*;
public class Billboard {
public var timer:Timer;
public var lifeTime:Number;
public var speed:int;
public var contents:TextField;
public var image:MovieClip;
public var counter:Number;
public var direction:b2Vec2;
public function Billboard(_arg1:String, _arg2:int, _arg3:int, _arg4:int=20){
image = new billboard_text();
MovieClip(image).content.text = _arg1;
this.lifeTime = _arg4;
image.x = _arg2;
image.y = _arg3;
timer = new Timer(100);
timer.addEventListener(TimerEvent.TIMER, reduceAlpha);
counter = _arg4;
World.getSingleton().sceneRoot.addChild(image);
timer.start();
speed = 5;
direction = new b2Vec2();
direction.x = (Math.random() - Math.random());
direction.y = (Math.random() - Math.random());
}
public function reduceAlpha(_arg1:TimerEvent):void{
counter--;
image.alpha = (counter / lifeTime);
image.x = (image.x + (speed * direction.x));
image.y = (image.y + (speed * direction.y));
if (image.alpha <= 0){
World.getSingleton().sceneRoot.removeChild(image);
timer.stop();
World.getSingleton().setFocusToStage();
timer.removeEventListener(TimerEvent.TIMER, reduceAlpha);
};
}
}
}//package p_billboard
Section 161
//BloodOnScreen (p_billboard.BloodOnScreen)
package p_billboard {
import Box2D.Common.Math.*;
import flash.events.*;
import p_singleton.*;
import flash.display.*;
import flash.utils.*;
import flash.text.*;
public class BloodOnScreen {
public var timer:Timer;
public var lifeTime:Number;
public var speed:int;
public var contents:TextField;
public var image:MovieClip;
public var counter:Number;
public var direction:b2Vec2;
public function BloodOnScreen(_arg1:int=20){
image = new bloodScreen();
this.lifeTime = _arg1;
timer = new Timer(100);
timer.addEventListener(TimerEvent.TIMER, reduceAlpha);
counter = _arg1;
World.getSingleton().menuRoot.addChild(image);
timer.start();
}
public function reduceAlpha(_arg1:TimerEvent):void{
counter--;
image.alpha = (counter / lifeTime);
if (image.alpha <= 0){
World.getSingleton().menuRoot.removeChild(image);
timer.stop();
World.getSingleton().setFocusToStage();
timer.removeEventListener(TimerEvent.TIMER, reduceAlpha);
};
}
}
}//package p_billboard
Section 162
//MiddleBillboard (p_billboard.MiddleBillboard)
package p_billboard {
import Box2D.Common.Math.*;
import flash.events.*;
import p_singleton.*;
import flash.display.*;
import flash.utils.*;
import flash.text.*;
public class MiddleBillboard {
public var timer:Timer;
public var lifeTime:Number;
public var speed:int;
public var contents:TextField;
public var image:MovieClip;
public var counter:Number;
public var direction:b2Vec2;
public function MiddleBillboard(_arg1:String, _arg2:int=20){
image = new middleBillboard();
MovieClip(image).content.text = _arg1;
this.lifeTime = _arg2;
timer = new Timer(100);
timer.addEventListener(TimerEvent.TIMER, reduceAlpha);
counter = _arg2;
World.getSingleton().menuRoot.addChild(image);
timer.start();
}
public function reduceAlpha(_arg1:TimerEvent):void{
counter--;
image.alpha = (counter / lifeTime);
if (image.alpha <= 0){
World.getSingleton().menuRoot.removeChild(image);
timer.stop();
World.getSingleton().setFocusToStage();
timer.removeEventListener(TimerEvent.TIMER, reduceAlpha);
};
}
}
}//package p_billboard
Section 163
//Blood (p_blood.Blood)
package p_blood {
import flash.events.*;
import flash.utils.*;
import p_entity.*;
public class Blood extends Entity {
public var lifeTimer:Timer;
public var numOfBloodType:int;
public var lifeTime:int;
public function Blood(){
lifeTimer = new Timer(50);
lifeTimer.addEventListener(TimerEvent.TIMER, die);
}
public function die(_arg1:TimerEvent):void{
if (lifeTime > 0){
lifeTime--;
} else {
if (image){
if (image.parent){
image.parent.removeChild(image);
lifeTimer.stop();
lifeTimer.removeEventListener(TimerEvent.TIMER, die);
};
};
};
}
}
}//package p_blood
Section 164
//BloodFloor (p_blood.BloodFloor)
package p_blood {
import flash.events.*;
import p_singleton.*;
import flash.utils.*;
public class BloodFloor extends Blood {
public function BloodFloor(){
var _local1:int;
var _local2:Class;
super();
lifeTime = 20;
numOfBloodType = 3;
_local1 = (Math.round(((Math.random() * 10) + 1)) % numOfBloodType);
_local2 = (getDefinitionByName(("blood_floor" + _local1)) as Class);
image = new (_local2);
lifeTimer.start();
World.getSingleton().bloods.add(this);
}
override public function die(_arg1:TimerEvent):void{
if (lifeTime > 0){
lifeTime--;
} else {
if (image){
if (image.parent){
image.parent.removeChild(image);
lifeTimer.stop();
lifeTimer.removeEventListener(TimerEvent.TIMER, die);
World.getSingleton().bloods.remove(this);
};
};
};
}
private function typedClass():void{
var _local1:blood_floor0;
var _local2:blood_floor1;
var _local3:blood_floor2;
}
}
}//package p_blood
Section 165
//BloodShoot (p_blood.BloodShoot)
package p_blood {
import flash.events.*;
import flash.utils.*;
public class BloodShoot extends Blood {
public function BloodShoot(){
var _local1:int;
var _local2:Class;
super();
lifeTimer.addEventListener(TimerEvent.TIMER, die);
lifeTime = 1;
numOfBloodType = 3;
_local1 = (Math.round(((Math.random() * 10) + 1)) % numOfBloodType);
_local2 = (getDefinitionByName(("blood_shoot" + _local1)) as Class);
image = new (_local2);
lifeTimer.start();
}
private function typedClass():void{
var _local1:blood_shoot0;
var _local2:blood_shoot1;
var _local3:blood_shoot2;
}
}
}//package p_blood
Section 166
//Bullet (p_bullet.Bullet)
package p_bullet {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import flash.events.*;
import p_singleton.*;
import flash.media.*;
import flash.utils.*;
import p_entity.*;
public class Bullet extends Entity {
public var bodyDef:b2BodyDef;
public var soundHitBody:Sound;
public var speed:Number;
public var bulletType:String;
public var radius:int;
public var body:b2Body;
public var lifeTimeTimer:Timer;
public var density:Number;
public var soundHitWall:Sound;
public var damage:Number;
public var lifeTime:Number;
public var restitution:Number;
public var friction:Number;
public var bodyType:int;
public function Bullet(){
lifeTimeTimer = new Timer(100);
lifeTimeTimer.addEventListener(TimerEvent.TIMER, reduceLifeTime);
lifeTimeTimer.start();
}
public function die():void{
if (lifeTime <= 0){
World.getSingleton().physicWorld.DestroyBody(body);
body = null;
if (image){
if (World.getSingleton().level.playerGround.contains(image)){
World.getSingleton().level.playerGround.removeChild(image);
World.getSingleton().setFocusToStage();
};
};
if (World.getSingleton().playerBullets.contains(this)){
World.getSingleton().playerBullets.remove(this);
} else {
World.getSingleton().enemyBullets.remove(this);
};
};
}
override public function update():void{
position.x = (body.GetPosition().x * World.physScale);
position.y = (body.GetPosition().y * World.physScale);
angle = b2Math.radiansToDegrees(body.GetAngle());
super.update();
}
public function reduceLifeTime(_arg1:TimerEvent):void{
lifeTime--;
if (lifeTime <= 0){
lifeTimeTimer.stop();
lifeTimeTimer.removeEventListener(TimerEvent.TIMER, reduceLifeTime);
};
}
public function away():void{
body.damage = damage;
body.ApplyImpulse(new b2Vec2((speed * direction.x), (speed * direction.y)), body.GetPosition());
}
}
}//package p_bullet
Section 167
//BulletType (p_bullet.BulletType)
package p_bullet {
public class BulletType {
public static var MAGS:String = "Mags";
public static var KNIFE:String = "knife";
public static var M4:String = "M4";
public static var SHELL:String = "Shell";
public static var MAGNUM:String = "Magnum";
public static var WALTHER_P99:String = "Walther P99";
public static var STEYR_TMP:String = "Steyr TMP";
public static var GRENADE:String = "Grenade";
}
}//package p_bullet
Section 168
//ChainSawBullet (p_bullet.ChainSawBullet)
package p_bullet {
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import flash.events.*;
import p_singleton.*;
import p_particle.*;
public class ChainSawBullet extends Bullet {
public var polygonDef:b2PolygonDef;
public function ChainSawBullet(){
density = 1;
friction = 1;
restitution = 0;
lifeTime = 1;
image = new chainsawBullet();
image.alpha = 0;
World.getSingleton().level.playerGround.addChild(image);
bulletType = BulletType.KNIFE;
soundHitWall = new hitWallSound2();
soundHitBody = new knifeHit();
}
override public function die():void{
super.die();
if ((((lifeTime > 0)) && (((body.touchedSolid) || (body.touchedChar))))){
World.getSingleton().physicWorld.DestroyBody(body);
body = null;
if (image){
if (World.getSingleton().level.playerGround.contains(image)){
World.getSingleton().level.playerGround.removeChild(image);
World.getSingleton().setFocusToStage();
};
};
if (World.getSingleton().playerBullets.contains(this)){
World.getSingleton().playerBullets.remove(this);
} else {
World.getSingleton().enemyBullets.remove(this);
};
};
}
override public function initRigidBody():void{
var _local1:b2World;
_local1 = World.getSingleton().physicWorld;
if (_local1){
polygonDef = new b2PolygonDef();
polygonDef.SetAsBox((image.width / (2 * 30)), (image.height / (2 * 30)));
polygonDef.density = density;
polygonDef.friction = friction;
polygonDef.restitution = restitution;
polygonDef.filter.groupIndex = bodyType;
bodyDef = new b2BodyDef();
bodyDef.userData = image;
bodyDef.position.Set((position.x / World.physScale), (position.y / World.physScale));
bodyDef.angle = b2Math.degreesToRadians(angle);
body = _local1.CreateBody(bodyDef);
body.CreateShape(polygonDef);
body.SetMassFromShapes();
body.type = bodyType;
body.bulletType = bulletType;
};
}
override public function update():void{
var _local1:int;
var _local2:Particle;
super.update();
if (body.touchedSolid){
_local1 = 0;
while (_local1 < 10) {
_local2 = new StarParticle();
_local2.position = position.Copy();
_local2.screenPosition = position.Copy();
_local1++;
};
lifeTimeTimer.stop();
lifeTimeTimer.removeEventListener(TimerEvent.TIMER, reduceLifeTime);
} else {
if (body.touchedChar){
body.GetLinearVelocity().x = 0;
body.GetLinearVelocity().y = 0;
_local1 = 0;
while (_local1 < 10) {
_local2 = new BloodParticle();
_local2.position = position.Copy();
_local2.screenPosition = position.Copy();
_local1++;
};
lifeTimeTimer.stop();
lifeTimeTimer.removeEventListener(TimerEvent.TIMER, reduceLifeTime);
if (!World.getSingleton().muted){
soundHitBody.play();
};
};
};
die();
}
}
}//package p_bullet
Section 169
//DynamiteBullet (p_bullet.DynamiteBullet)
package p_bullet {
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import flash.events.*;
import p_singleton.*;
import flash.media.*;
import p_effect.*;
import p_particle.*;
public class DynamiteBullet extends Bullet {
public var explosionSound:Sound;
public var powerImpulse:Number;
public var polygonDef:b2PolygonDef;
public function DynamiteBullet(){
density = 1;
friction = 1;
restitution = 0.5;
lifeTime = 20;
image = new dynamiteBullet();
World.getSingleton().level.playerGround.addChild(image);
powerImpulse = 300;
bulletType = BulletType.GRENADE;
explosionSound = new explodeSound();
}
override public function die():void{
var _local1:Explosion;
var _local2:int;
var _local3:int;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Particle;
var _local12:int;
if ((((((lifeTime <= 0)) && (body.touchedTheGround))) || ((lifeTime <= -5)))){
_local1 = new Explosion(20, position);
if (!World.getSingleton().muted){
explosionSound.play();
};
World.getSingleton().shakeScreen();
if (lifeTime <= -5){
_local1.image.crack.alpha = 0;
};
_local2 = 0;
while (_local2 < 50) {
_local11 = new ExplosionParticle();
_local11.position = position.Copy();
_local11.screenPosition = screenPosition.Copy();
_local2++;
};
lifeTimeTimer.stop();
lifeTimeTimer.removeEventListener(TimerEvent.TIMER, reduceLifeTime);
World.getSingleton().physicWorld.DestroyBody(body);
body = null;
if (image){
if (World.getSingleton().level.playerGround.contains(image)){
World.getSingleton().level.playerGround.removeChild(image);
World.getSingleton().setFocusToStage();
};
};
if (World.getSingleton().playerBullets.contains(this)){
World.getSingleton().playerBullets.remove(this);
} else {
World.getSingleton().enemyBullets.remove(this);
};
_local3 = (World.getSingleton().enemies.size() - 1);
while (_local3 >= 0) {
_local4 = (World.getSingleton().enemies.get(_local3).position.x - position.x);
_local5 = (World.getSingleton().enemies.get(_local3).position.y - position.y);
_local6 = ((_local4 >= 0)) ? 1 : -1;
_local7 = ((_local5 >= 0)) ? 1 : -1;
_local8 = (_local4 * _local4);
_local9 = (_local5 * _local5);
_local10 = Math.sqrt((_local8 + _local9));
if (_local10 < radius){
World.getSingleton().enemies.get(_local3).body.impulseApplied = new b2Vec2((powerImpulse * _local6), (powerImpulse * _local7));
World.getSingleton().enemies.get(_local3).body.pointCollision = position.Copy();
World.getSingleton().enemies.get(_local3).body.damage = damage;
World.getSingleton().enemies.get(_local3).body.gotShot = true;
_local12 = ((Math.floor((Math.random() * 10)) + 1) % 3);
if (_local12 == 0){
World.getSingleton().enemies.get(_local3).body.bodyShot = true;
} else {
if (_local12 == 1){
World.getSingleton().enemies.get(_local3).body.headShot = true;
} else {
World.getSingleton().enemies.get(_local3).body.legShot = true;
};
};
};
_local3--;
};
};
}
override public function initRigidBody():void{
var _local1:b2World;
_local1 = World.getSingleton().physicWorld;
if (_local1){
polygonDef = new b2PolygonDef();
polygonDef.SetAsBox((image.width / (2 * 30)), (image.height / (2 * 30)));
polygonDef.filter.groupIndex = bodyType;
polygonDef.density = density;
polygonDef.friction = friction;
polygonDef.restitution = restitution;
bodyDef = new b2BodyDef();
bodyDef.userData = image;
bodyDef.position.Set((position.x / World.physScale), (position.y / World.physScale));
bodyDef.angle = b2Math.degreesToRadians(angle);
body = _local1.CreateBody(bodyDef);
body.CreateShape(polygonDef);
body.SetMassFromShapes();
body.type = bodyType;
body.bulletType = bulletType;
};
}
override public function update():void{
var _local1:int;
super.update();
die();
}
override public function away():void{
body.damage = damage;
body.ApplyImpulse(new b2Vec2((speed * direction.x), (speed * direction.y)), body.GetPosition());
body.ApplyTorque((speed * direction.x));
}
override public function reduceLifeTime(_arg1:TimerEvent):void{
lifeTime--;
}
}
}//package p_bullet
Section 170
//GrenadeBullet (p_bullet.GrenadeBullet)
package p_bullet {
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import flash.events.*;
import p_singleton.*;
import flash.media.*;
import p_effect.*;
import p_particle.*;
public class GrenadeBullet extends Bullet {
public var explosionSound:Sound;
public var circleDef:b2CircleDef;
public var powerImpulse:Number;
public function GrenadeBullet(){
density = 1;
friction = 1;
restitution = 0.5;
lifeTime = 10;
image = new grenadeBullet();
World.getSingleton().level.playerGround.addChild(image);
powerImpulse = 300;
bulletType = BulletType.GRENADE;
explosionSound = new explodeSound();
}
override public function die():void{
var _local1:Explosion;
var _local2:int;
var _local3:int;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Particle;
var _local12:int;
if ((((((lifeTime <= 0)) && (body.touchedTheGround))) || ((lifeTime <= -5)))){
_local1 = new Explosion(20, position);
if (!World.getSingleton().muted){
explosionSound.play();
};
World.getSingleton().shakeScreen();
if (lifeTime <= -5){
_local1.image.crack.alpha = 0;
};
_local2 = 0;
while (_local2 < 50) {
_local11 = new ExplosionParticle();
_local11.position = position.Copy();
_local11.screenPosition = screenPosition.Copy();
_local2++;
};
lifeTimeTimer.stop();
lifeTimeTimer.removeEventListener(TimerEvent.TIMER, reduceLifeTime);
World.getSingleton().physicWorld.DestroyBody(body);
body = null;
if (image){
if (World.getSingleton().level.playerGround.contains(image)){
World.getSingleton().level.playerGround.removeChild(image);
World.getSingleton().setFocusToStage();
};
};
if (World.getSingleton().playerBullets.contains(this)){
World.getSingleton().playerBullets.remove(this);
} else {
World.getSingleton().enemyBullets.remove(this);
};
_local3 = (World.getSingleton().enemies.size() - 1);
while (_local3 >= 0) {
_local4 = (World.getSingleton().enemies.get(_local3).position.x - position.x);
_local5 = (World.getSingleton().enemies.get(_local3).position.y - position.y);
_local6 = ((_local4 >= 0)) ? 1 : -1;
_local7 = ((_local5 >= 0)) ? 1 : -1;
_local8 = (_local4 * _local4);
_local9 = (_local5 * _local5);
_local10 = Math.sqrt((_local8 + _local9));
if (_local10 < radius){
World.getSingleton().enemies.get(_local3).body.impulseApplied = new b2Vec2((powerImpulse * _local6), (powerImpulse * _local7));
World.getSingleton().enemies.get(_local3).body.pointCollision = position.Copy();
World.getSingleton().enemies.get(_local3).body.damage = damage;
World.getSingleton().enemies.get(_local3).body.gotShot = true;
_local12 = ((Math.floor((Math.random() * 10)) + 1) % 3);
if (_local12 == 0){
World.getSingleton().enemies.get(_local3).body.bodyShot = true;
} else {
if (_local12 == 1){
World.getSingleton().enemies.get(_local3).body.headShot = true;
} else {
World.getSingleton().enemies.get(_local3).body.legShot = true;
};
};
};
_local3--;
};
};
}
override public function initRigidBody():void{
var _local1:b2World;
_local1 = World.getSingleton().physicWorld;
if (_local1){
circleDef = new b2CircleDef();
circleDef.radius = (image.width / (2 * 30));
circleDef.density = density;
circleDef.friction = friction;
circleDef.restitution = restitution;
circleDef.filter.groupIndex = bodyType;
bodyDef = new b2BodyDef();
bodyDef.userData = image;
bodyDef.position.Set((position.x / World.physScale), (position.y / World.physScale));
bodyDef.angle = b2Math.degreesToRadians(angle);
body = _local1.CreateBody(bodyDef);
body.CreateShape(circleDef);
body.SetMassFromShapes();
body.type = bodyType;
body.bulletType = bulletType;
};
}
override public function update():void{
var _local1:int;
super.update();
die();
}
override public function away():void{
body.damage = damage;
body.ApplyImpulse(new b2Vec2((speed * direction.x), (speed * direction.y)), body.GetPosition());
body.ApplyTorque((speed * direction.x));
}
override public function reduceLifeTime(_arg1:TimerEvent):void{
lifeTime--;
}
}
}//package p_bullet
Section 171
//GrenadeSafety (p_bullet.GrenadeSafety)
package p_bullet {
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import p_char.*;
import p_singleton.*;
public class GrenadeSafety extends Shell {
public var polygonDef1:b2PolygonDef;
public var polygonDef2:b2PolygonDef;
public function GrenadeSafety(){
density = 1;
friction = 1;
restitution = 0.3;
lifeTime = 3;
image = new grenadeSafety();
bodyType = BodyType.SHELL;
World.getSingleton().level.playerGround.addChild(image);
bulletType = BulletType.SHELL;
}
override public function die():void{
if (lifeTime <= 0){
World.getSingleton().physicWorld.DestroyBody(body);
body = null;
if (image){
if (World.getSingleton().level.playerGround.contains(image)){
World.getSingleton().level.playerGround.removeChild(image);
World.getSingleton().setFocusToStage();
};
};
if (World.getSingleton().shells.contains(this)){
World.getSingleton().shells.remove(this);
};
};
}
override public function initRigidBody():void{
var _local1:b2World;
_local1 = World.getSingleton().physicWorld;
if (_local1){
polygonDef = new b2PolygonDef();
polygonDef.SetAsOrientedBox((image.body0.width / (2 * 30)), (image.body0.height / (2 * 30)), new b2Vec2((image.body0.x / (2 * 30)), (image.body0.y / (2 * 30))));
polygonDef.density = density;
polygonDef.friction = friction;
polygonDef.restitution = restitution;
polygonDef.filter.groupIndex = bodyType;
polygonDef1 = new b2PolygonDef();
polygonDef1.SetAsOrientedBox((image.body1.width / (2 * 30)), (image.body1.height / (2 * 30)), new b2Vec2((image.body1.x / (2 * 30)), (image.body1.y / (2 * 30))));
polygonDef1.density = density;
polygonDef1.friction = friction;
polygonDef1.restitution = restitution;
polygonDef1.filter.groupIndex = bodyType;
polygonDef2 = new b2PolygonDef();
polygonDef2.SetAsOrientedBox((image.body2.width / (2 * 30)), (image.body2.height / (2 * 30)), new b2Vec2((image.body2.x / (2 * 30)), (image.body2.y / (2 * 30))));
polygonDef2.density = density;
polygonDef2.friction = friction;
polygonDef2.restitution = restitution;
polygonDef2.filter.groupIndex = bodyType;
bodyDef = new b2BodyDef();
bodyDef.userData = image;
bodyDef.position.Set((position.x / World.physScale), (position.y / World.physScale));
bodyDef.angle = b2Math.degreesToRadians(angle);
body = _local1.CreateBody(bodyDef);
body.CreateShape(polygonDef);
body.CreateShape(polygonDef1);
body.CreateShape(polygonDef2);
body.SetMassFromShapes();
body.type = bodyType;
body.bulletType = bulletType;
};
}
}
}//package p_bullet
Section 172
//HandGunBullet (p_bullet.HandGunBullet)
package p_bullet {
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import flash.events.*;
import p_singleton.*;
import p_particle.*;
public class HandGunBullet extends Bullet {
public var polygonDef:b2PolygonDef;
public function HandGunBullet(){
density = 1;
friction = 1;
restitution = 0;
lifeTime = 2;
image = new handGunBullet();
image.cacheAsBitmap = true;
World.getSingleton().level.backGround.addChild(image);
bulletType = BulletType.WALTHER_P99;
soundHitWall = new hitWallSound();
soundHitBody = new handGunHitBody();
}
override public function die():void{
if (lifeTime <= 0){
World.getSingleton().physicWorld.DestroyBody(body);
body = null;
if (image){
if (World.getSingleton().level.backGround.contains(image)){
World.getSingleton().level.backGround.removeChild(image);
World.getSingleton().setFocusToStage();
};
};
if (World.getSingleton().playerBullets.contains(this)){
World.getSingleton().playerBullets.remove(this);
} else {
World.getSingleton().enemyBullets.remove(this);
};
};
if ((((lifeTime > 0)) && (((body.touchedSolid) || (body.touchedChar))))){
World.getSingleton().physicWorld.DestroyBody(body);
body = null;
if (image){
if (World.getSingleton().level.backGround.contains(image)){
World.getSingleton().level.backGround.removeChild(image);
World.getSingleton().setFocusToStage();
};
};
if (World.getSingleton().playerBullets.contains(this)){
World.getSingleton().playerBullets.remove(this);
} else {
World.getSingleton().enemyBullets.remove(this);
};
};
}
override public function initRigidBody():void{
var _local1:b2World;
_local1 = World.getSingleton().physicWorld;
if (_local1){
polygonDef = new b2PolygonDef();
polygonDef.SetAsBox((image.body.width / (2 * 30)), (image.body.height / (2 * 30)));
polygonDef.density = density;
polygonDef.friction = friction;
polygonDef.restitution = restitution;
polygonDef.filter.groupIndex = bodyType;
bodyDef = new b2BodyDef();
bodyDef.userData = image;
bodyDef.position.Set((position.x / World.physScale), (position.y / World.physScale));
bodyDef.angle = b2Math.degreesToRadians(angle);
body = _local1.CreateBody(bodyDef);
body.CreateShape(polygonDef);
body.SetMassFromShapes();
body.type = bodyType;
body.bulletType = bulletType;
};
}
override public function update():void{
var _local1:int;
var _local2:Particle;
super.update();
if (body.touchedSolid){
_local1 = 0;
while (_local1 < 10) {
_local2 = new StarParticle();
_local2.position = position.Copy();
_local2.screenPosition = screenPosition.Copy();
_local1++;
};
lifeTimeTimer.stop();
lifeTimeTimer.removeEventListener(TimerEvent.TIMER, reduceLifeTime);
if (!World.getSingleton().muted){
soundHitWall.play();
};
} else {
if (body.touchedChar){
body.GetLinearVelocity().x = 0;
body.GetLinearVelocity().y = 0;
_local1 = 0;
while (_local1 < 10) {
_local2 = new BloodParticle();
_local2.position = position.Copy();
_local2.screenPosition = screenPosition.Copy();
_local1++;
};
lifeTimeTimer.stop();
lifeTimeTimer.removeEventListener(TimerEvent.TIMER, reduceLifeTime);
if (!World.getSingleton().muted){
soundHitBody.play();
};
};
};
die();
}
}
}//package p_bullet
Section 173
//HandGunShell (p_bullet.HandGunShell)
package p_bullet {
import p_char.*;
import p_singleton.*;
public class HandGunShell extends Shell {
public function HandGunShell(){
density = 1;
friction = 1;
restitution = 0;
lifeTime = 10;
image = new shell01();
bodyType = BodyType.SHELL;
World.getSingleton().level.playerGround.addChild(image);
bulletType = BulletType.SHELL;
}
}
}//package p_bullet
Section 174
//KnifeBullet (p_bullet.KnifeBullet)
package p_bullet {
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import flash.events.*;
import p_singleton.*;
import p_particle.*;
public class KnifeBullet extends Bullet {
public var polygonDef:b2PolygonDef;
public function KnifeBullet(){
density = 1;
friction = 1;
restitution = 0;
lifeTime = 1;
image = new knifeBullet();
image.alpha = 0;
World.getSingleton().level.playerGround.addChild(image);
bulletType = BulletType.KNIFE;
soundHitWall = new hitWallSound3();
soundHitBody = new knifeHit();
}
override public function die():void{
super.die();
if ((((lifeTime > 0)) && (((body.touchedSolid) || (body.touchedChar))))){
World.getSingleton().physicWorld.DestroyBody(body);
body = null;
if (image){
if (World.getSingleton().level.playerGround.contains(image)){
World.getSingleton().level.playerGround.removeChild(image);
World.getSingleton().setFocusToStage();
};
};
if (World.getSingleton().playerBullets.contains(this)){
World.getSingleton().playerBullets.remove(this);
} else {
World.getSingleton().enemyBullets.remove(this);
};
};
}
override public function initRigidBody():void{
var _local1:b2World;
_local1 = World.getSingleton().physicWorld;
if (_local1){
polygonDef = new b2PolygonDef();
polygonDef.SetAsBox((image.width / (2 * 30)), (image.height / (2 * 30)));
polygonDef.density = density;
polygonDef.friction = friction;
polygonDef.restitution = restitution;
polygonDef.filter.groupIndex = bodyType;
bodyDef = new b2BodyDef();
bodyDef.userData = image;
bodyDef.position.Set((position.x / World.physScale), (position.y / World.physScale));
bodyDef.angle = b2Math.degreesToRadians(angle);
body = _local1.CreateBody(bodyDef);
body.CreateShape(polygonDef);
body.SetMassFromShapes();
body.type = bodyType;
body.bulletType = bulletType;
};
}
override public function update():void{
var _local1:int;
var _local2:Particle;
super.update();
if (body.touchedSolid){
_local1 = 0;
while (_local1 < 10) {
_local2 = new StarParticle();
_local2.position = position.Copy();
_local2.screenPosition = position.Copy();
_local1++;
};
lifeTimeTimer.stop();
lifeTimeTimer.removeEventListener(TimerEvent.TIMER, reduceLifeTime);
if (!World.getSingleton().muted){
soundHitWall.play();
};
} else {
if (body.touchedChar){
body.GetLinearVelocity().x = 0;
body.GetLinearVelocity().y = 0;
_local1 = 0;
while (_local1 < 10) {
_local2 = new BloodParticle();
_local2.position = position.Copy();
_local2.screenPosition = position.Copy();
_local1++;
};
lifeTimeTimer.stop();
lifeTimeTimer.removeEventListener(TimerEvent.TIMER, reduceLifeTime);
if (!World.getSingleton().muted){
soundHitBody.play();
};
};
};
die();
}
}
}//package p_bullet
Section 175
//Mags (p_bullet.Mags)
package p_bullet {
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import p_char.*;
import p_singleton.*;
public class Mags extends Bullet {
public var polygonDef:b2PolygonDef;
public function Mags(){
density = 1;
friction = 1;
restitution = 0;
lifeTime = 50;
bodyType = BodyType.MAGZ;
bulletType = BulletType.MAGS;
}
override public function die():void{
if (lifeTime <= 0){
World.getSingleton().physicWorld.DestroyBody(body);
body = null;
if (image){
if (World.getSingleton().level.playerGround.contains(image)){
World.getSingleton().level.playerGround.removeChild(image);
World.getSingleton().setFocusToStage();
};
};
if (World.getSingleton().mags.contains(this)){
World.getSingleton().mags.remove(this);
};
};
}
override public function initRigidBody():void{
var _local1:b2World;
_local1 = World.getSingleton().physicWorld;
if (_local1){
polygonDef = new b2PolygonDef();
polygonDef.SetAsBox((image.width / (2 * 30)), (image.height / (2 * 30)));
polygonDef.density = density;
polygonDef.friction = friction;
polygonDef.restitution = restitution;
polygonDef.filter.groupIndex = bodyType;
bodyDef = new b2BodyDef();
bodyDef.userData = image;
bodyDef.position.Set((position.x / World.physScale), (position.y / World.physScale));
bodyDef.angle = b2Math.degreesToRadians(angle);
body = _local1.CreateBody(bodyDef);
body.CreateShape(polygonDef);
body.SetMassFromShapes();
body.type = bodyType;
body.bulletType = bulletType;
};
}
override public function update():void{
super.update();
die();
}
}
}//package p_bullet
Section 176
//MagsAK (p_bullet.MagsAK)
package p_bullet {
import p_char.*;
import p_singleton.*;
public class MagsAK extends Mags {
public function MagsAK(){
density = 1;
friction = 1;
restitution = 0;
image = new magAK();
image.width = (image.width * 0.75);
image.height = (image.height * 0.75);
bodyType = BodyType.MAGZ;
World.getSingleton().level.playerGround.addChild(image);
}
}
}//package p_bullet
Section 177
//MagsM4 (p_bullet.MagsM4)
package p_bullet {
import p_char.*;
import p_singleton.*;
public class MagsM4 extends Mags {
public function MagsM4(){
density = 1;
friction = 1;
restitution = 0;
image = new magM4();
bodyType = BodyType.MAGZ;
World.getSingleton().level.playerGround.addChild(image);
}
}
}//package p_bullet
Section 178
//MagsMP5 (p_bullet.MagsMP5)
package p_bullet {
import p_char.*;
import p_singleton.*;
public class MagsMP5 extends Mags {
public function MagsMP5(){
density = 1;
friction = 1;
restitution = 0;
image = new magMP5();
image.width = (image.width * 0.75);
image.height = (image.height * 0.75);
bodyType = BodyType.MAGZ;
World.getSingleton().level.playerGround.addChild(image);
}
}
}//package p_bullet
Section 179
//MagsSteyrTMP (p_bullet.MagsSteyrTMP)
package p_bullet {
import p_char.*;
import p_singleton.*;
public class MagsSteyrTMP extends Mags {
public function MagsSteyrTMP(){
density = 1;
friction = 1;
restitution = 0;
image = new magSMG();
bodyType = BodyType.MAGZ;
World.getSingleton().level.playerGround.addChild(image);
}
}
}//package p_bullet
Section 180
//MagsUMP (p_bullet.MagsUMP)
package p_bullet {
import p_char.*;
import p_singleton.*;
public class MagsUMP extends Mags {
public function MagsUMP(){
density = 1;
friction = 1;
restitution = 0;
image = new magUMP();
image.width = (image.width * 0.75);
image.height = (image.height * 0.75);
bodyType = BodyType.MAGZ;
World.getSingleton().level.playerGround.addChild(image);
}
}
}//package p_bullet
Section 181
//MagsWaltherP99 (p_bullet.MagsWaltherP99)
package p_bullet {
import p_char.*;
import p_singleton.*;
public class MagsWaltherP99 extends Mags {
public function MagsWaltherP99(){
density = 1;
friction = 1;
restitution = 0;
image = new magPistol();
bodyType = BodyType.MAGZ;
World.getSingleton().level.playerGround.addChild(image);
}
}
}//package p_bullet
Section 182
//Shell (p_bullet.Shell)
package p_bullet {
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import p_singleton.*;
public class Shell extends Bullet {
public var polygonDef:b2PolygonDef;
override public function die():void{
if (lifeTime <= 0){
World.getSingleton().physicWorld.DestroyBody(body);
body = null;
if (image){
if (World.getSingleton().level.playerGround.contains(image)){
World.getSingleton().level.playerGround.removeChild(image);
World.getSingleton().setFocusToStage();
};
};
if (World.getSingleton().shells.contains(this)){
World.getSingleton().shells.remove(this);
};
};
}
override public function initRigidBody():void{
var _local1:b2World;
_local1 = World.getSingleton().physicWorld;
if (_local1){
polygonDef = new b2PolygonDef();
polygonDef.SetAsBox((image.width / (2 * 30)), (image.height / (2 * 30)));
polygonDef.density = density;
polygonDef.friction = friction;
polygonDef.restitution = restitution;
polygonDef.filter.groupIndex = bodyType;
bodyDef = new b2BodyDef();
bodyDef.userData = image;
bodyDef.position.Set((position.x / World.physScale), (position.y / World.physScale));
bodyDef.angle = b2Math.degreesToRadians(angle);
body = _local1.CreateBody(bodyDef);
body.CreateShape(polygonDef);
body.SetMassFromShapes();
body.type = bodyType;
body.bulletType = bulletType;
};
}
override public function update():void{
super.update();
die();
}
}
}//package p_bullet
Section 183
//ShotGunShell (p_bullet.ShotGunShell)
package p_bullet {
import p_char.*;
import p_singleton.*;
public class ShotGunShell extends Shell {
public function ShotGunShell(){
density = 1;
friction = 1;
restitution = 0;
lifeTime = 20;
image = new shell02();
bodyType = BodyType.SHELL;
World.getSingleton().level.playerGround.addChild(image);
bulletType = BulletType.SHELL;
}
}
}//package p_bullet
Section 184
//ZombieBullet (p_bullet.ZombieBullet)
package p_bullet {
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import flash.events.*;
import p_singleton.*;
import p_particle.*;
public class ZombieBullet extends Bullet {
public var polygonDef:b2PolygonDef;
public function ZombieBullet(){
density = 1;
friction = 1;
restitution = 0;
lifeTime = 1;
this.image = new zombieBullet1();
image.alpha = 0;
speed = 100;
damage = 10;
World.getSingleton().level.playerGround.addChild(image);
bulletType = BulletType.KNIFE;
soundHitWall = new hitWallSound3();
soundHitBody = new knifeHit();
}
override public function die():void{
super.die();
if ((((lifeTime > 0)) && (((body.touchedSolid) || (body.touchedChar))))){
World.getSingleton().physicWorld.DestroyBody(body);
body = null;
if (image){
if (World.getSingleton().level.playerGround.contains(image)){
World.getSingleton().level.playerGround.removeChild(image);
World.getSingleton().setFocusToStage();
};
};
if (World.getSingleton().playerBullets.contains(this)){
World.getSingleton().playerBullets.remove(this);
} else {
World.getSingleton().enemyBullets.remove(this);
};
};
}
override public function initRigidBody():void{
var _local1:b2World;
_local1 = World.getSingleton().physicWorld;
if (_local1){
polygonDef = new b2PolygonDef();
polygonDef.SetAsBox((image.width / (2 * 30)), (image.height / (2 * 30)));
polygonDef.density = density;
polygonDef.friction = friction;
polygonDef.restitution = restitution;
polygonDef.filter.groupIndex = bodyType;
bodyDef = new b2BodyDef();
bodyDef.position.Set((position.x / World.physScale), (position.y / World.physScale));
bodyDef.angle = b2Math.degreesToRadians(angle);
body = _local1.CreateBody(bodyDef);
body.CreateShape(polygonDef);
body.SetMassFromShapes();
body.type = bodyType;
body.m_angularDamping = 10000;
body.m_linearDamping = 10000;
body.bulletType = bulletType;
};
}
override public function update():void{
var _local1:int;
var _local2:Particle;
super.update();
if (body.touchedSolid){
_local1 = 0;
while (_local1 < 10) {
_local2 = new StarParticle();
_local2.position = position.Copy();
_local2.screenPosition = screenPosition.Copy();
_local1++;
};
lifeTimeTimer.stop();
lifeTimeTimer.removeEventListener(TimerEvent.TIMER, reduceLifeTime);
if (!World.getSingleton().muted){
soundHitWall.play();
};
} else {
if (body.touchedChar){
body.GetLinearVelocity().x = 0;
body.GetLinearVelocity().y = 0;
_local1 = 0;
while (_local1 < 10) {
_local2 = new BloodParticle();
_local2.position = position.Copy();
_local2.screenPosition = screenPosition.Copy();
_local1++;
};
lifeTimeTimer.stop();
lifeTimeTimer.removeEventListener(TimerEvent.TIMER, reduceLifeTime);
if (!World.getSingleton().muted){
soundHitBody.play();
};
};
};
die();
}
}
}//package p_bullet
Section 185
//Andrew (p_char.p_nonplayable.Andrew)
package p_char.p_nonplayable {
import flash.events.*;
import p_weapon.*;
import p_singleton.*;
import p_state.p_npcFriendState.*;
import flash.media.*;
public class Andrew extends NPCFriend {
public function Andrew(){
jumpPower = 10;
speed = 8;
runSpeed = (speed * 1.5);
density = 1;
friction = 1;
restitution = 0;
accuracy = 15;
maxHealth = 100;
health = 50;
image = new femaleChar();
image.head.head.gotoAndStop("Andrew");
image.torso.torso.gotoAndStop("male01");
Name = "Andrew";
price = 17000;
salary = 700;
initialWalkFrame = 25;
walkFrame = 40;
walkAnimationSpeed = 150;
initialRunFrame = 66;
runFrame = 19;
runAnimationSpeed = 400;
currentWeapon = new SteyrTMP();
currentWeapon.position = position;
image.weaponHolderb.addChild(currentWeapon.image);
image.weaponHolderf.addChild(currentWeapon.image2);
distanceLimit = 700;
charDistanceLimit = 100;
point = (1000 + ((Math.random() * 10) + 1));
initTimer();
initState(new StateNPCFriendIdle(this));
run = false;
}
override public function animateDeath(_arg1:TimerEvent):void{
super.animateDeath(_arg1);
}
override public function calculateDamage():void{
var _local1:Sound;
if (body.gotShot){
_local1 = new hurtGuy1();
if (!World.getSingleton().muted){
_local1.play();
};
};
super.calculateDamage();
}
override public function die():void{
var _local1:Sound;
super.die();
if (health <= 0){
_local1 = new dieSound1();
if (!World.getSingleton().muted){
_local1.play();
};
};
}
}
}//package p_char.p_nonplayable
Section 186
//Bill (p_char.p_nonplayable.Bill)
package p_char.p_nonplayable {
import flash.events.*;
import p_weapon.*;
import p_singleton.*;
import p_state.p_npcFriendState.*;
import flash.media.*;
public class Bill extends NPCFriend {
public function Bill(){
jumpPower = 10;
speed = 6;
runSpeed = (speed * 1.5);
density = 1;
friction = 1;
restitution = 0;
accuracy = 15;
maxHealth = 50;
health = 50;
image = new femaleChar();
image.head.head.gotoAndStop("Bill");
image.torso.torso.gotoAndStop("male02");
Name = "Bill";
price = 25000;
salary = 1100;
initialWalkFrame = 25;
walkFrame = 40;
walkAnimationSpeed = 150;
initialRunFrame = 66;
runFrame = 19;
runAnimationSpeed = 400;
currentWeapon = new M4();
currentWeapon.position = position;
image.weaponHolderb.addChild(currentWeapon.image);
image.weaponHolderf.addChild(currentWeapon.image2);
distanceLimit = 700;
charDistanceLimit = 100;
point = (1000 + ((Math.random() * 10) + 1));
initTimer();
initState(new StateNPCFriendIdle(this));
run = false;
}
override public function animateDeath(_arg1:TimerEvent):void{
super.animateDeath(_arg1);
}
override public function calculateDamage():void{
var _local1:Sound;
if (body.gotShot){
_local1 = new hurtGuy1();
if (!World.getSingleton().muted){
_local1.play();
};
};
super.calculateDamage();
}
override public function die():void{
var _local1:Sound;
super.die();
if (health <= 0){
_local1 = new dieSound1();
if (!World.getSingleton().muted){
_local1.play();
};
};
}
}
}//package p_char.p_nonplayable
Section 187
//Darmin (p_char.p_nonplayable.Darmin)
package p_char.p_nonplayable {
import flash.events.*;
import p_weapon.*;
import p_singleton.*;
import p_state.p_npcFriendState.*;
import flash.media.*;
public class Darmin extends NPCFriend {
public function Darmin(){
jumpPower = 10;
speed = 7;
runSpeed = (speed * 1.5);
density = 1;
friction = 1;
restitution = 0;
accuracy = 15;
maxHealth = 50;
health = 50;
image = new femaleChar();
image.head.head.gotoAndStop("Darmin");
Name = "Darmin";
image.torso.torso.gotoAndStop("male03");
price = 25000;
salary = 5000;
initialWalkFrame = 25;
walkFrame = 40;
walkAnimationSpeed = 150;
initialRunFrame = 66;
runFrame = 19;
runAnimationSpeed = 400;
currentWeapon = new Dynamite();
ExplosiveWeapon(currentWeapon).ammo = 1;
ExplosiveWeapon(currentWeapon).reloadAmmo = 2;
currentWeapon.position = position;
ExplosiveWeapon(currentWeapon).setDelaySpeed(5000);
image.weaponHolderb.addChild(currentWeapon.image);
image.weaponHolderf.addChild(currentWeapon.image2);
distanceLimit = 600;
charDistanceLimit = 100;
point = (1000 + ((Math.random() * 10) + 1));
initTimer();
initState(new StateNPCFriendIdle(this));
run = false;
}
override public function animateDeath(_arg1:TimerEvent):void{
super.animateDeath(_arg1);
}
override public function calculateDamage():void{
var _local1:Sound;
if (body.gotShot){
_local1 = new hurtGuy2();
if (!World.getSingleton().muted){
_local1.play();
};
};
super.calculateDamage();
}
override public function die():void{
var _local1:Sound;
super.die();
if (health <= 0){
_local1 = new dieSound2();
if (!World.getSingleton().muted){
_local1.play();
};
};
}
}
}//package p_char.p_nonplayable
Section 188
//Francis (p_char.p_nonplayable.Francis)
package p_char.p_nonplayable {
import flash.events.*;
import p_weapon.*;
import p_singleton.*;
import p_state.p_npcFriendState.*;
import flash.media.*;
public class Francis extends NPCFriend {
public function Francis(){
jumpPower = 10;
speed = 9;
runSpeed = (speed * 1.5);
density = 1;
friction = 1;
restitution = 0;
accuracy = 15;
maxHealth = 75;
health = 75;
image = new femaleChar();
image.head.head.gotoAndStop("Francis");
image.torso.torso.gotoAndStop("male01");
Name = "Francis";
price = 15000;
salary = 500;
initialWalkFrame = 25;
walkFrame = 40;
walkAnimationSpeed = 150;
initialRunFrame = 66;
runFrame = 19;
runAnimationSpeed = 400;
currentWeapon = new MPU();
currentWeapon.position = position;
image.weaponHolderb.addChild(currentWeapon.image);
image.weaponHolderf.addChild(currentWeapon.image2);
distanceLimit = 700;
charDistanceLimit = 100;
point = (1000 + ((Math.random() * 10) + 1));
initTimer();
initState(new StateNPCFriendIdle(this));
run = false;
}
override public function animateDeath(_arg1:TimerEvent):void{
super.animateDeath(_arg1);
}
override public function calculateDamage():void{
var _local1:Sound;
if (body.gotShot){
_local1 = new hurtGuy1();
if (!World.getSingleton().muted){
_local1.play();
};
};
super.calculateDamage();
}
override public function die():void{
var _local1:Sound;
super.die();
if (health <= 0){
_local1 = new dieSound1();
if (!World.getSingleton().muted){
_local1.play();
};
};
}
}
}//package p_char.p_nonplayable
Section 189
//Ivy (p_char.p_nonplayable.Ivy)
package p_char.p_nonplayable {
import flash.events.*;
import p_weapon.*;
import p_singleton.*;
import p_state.p_npcFriendState.*;
import flash.media.*;
public class Ivy extends NPCFriend {
public function Ivy(){
jumpPower = 10;
speed = 8.5;
runSpeed = (speed * 1.5);
density = 1;
friction = 1;
restitution = 0;
accuracy = 15;
maxHealth = 100;
health = 100;
image = new femaleChar();
image.head.head.gotoAndStop("Ivy");
image.torso.torso.gotoAndStop("female02");
Name = "Ivy";
price = 5500;
salary = 200;
initialWalkFrame = 25;
walkFrame = 40;
walkAnimationSpeed = 150;
initialRunFrame = 66;
runFrame = 19;
runAnimationSpeed = 400;
currentWeapon = new Beretta();
currentWeapon.position = position;
image.weaponHolderb.addChild(currentWeapon.image);
image.weaponHolderf.addChild(currentWeapon.image2);
distanceLimit = 700;
charDistanceLimit = 100;
point = (1000 + ((Math.random() * 10) + 1));
initTimer();
initState(new StateNPCFriendIdle(this));
run = false;
}
override public function animateDeath(_arg1:TimerEvent):void{
super.animateDeath(_arg1);
}
override public function calculateDamage():void{
var _local1:Sound;
if (body.gotShot){
_local1 = new hurtGirl1();
if (!World.getSingleton().muted){
_local1.play();
};
};
super.calculateDamage();
}
override public function die():void{
var _local1:Sound;
super.die();
if (health <= 0){
_local1 = new dieGirl2();
if (!World.getSingleton().muted){
_local1.play();
};
};
}
}
}//package p_char.p_nonplayable
Section 190
//Kris (p_char.p_nonplayable.Kris)
package p_char.p_nonplayable {
import flash.events.*;
import p_weapon.*;
import p_singleton.*;
import p_state.p_npcFriendState.*;
import flash.media.*;
public class Kris extends NPCFriend {
public function Kris(){
jumpPower = 10;
speed = 11;
runSpeed = (speed * 1.5);
density = 1;
friction = 1;
restitution = 0;
accuracy = 15;
maxHealth = 50;
health = 50;
image = new femaleChar();
image.head.head.gotoAndStop("Kris");
image.torso.torso.gotoAndStop("male02");
Name = "Kris";
price = 17500;
salary = 750;
initialWalkFrame = 25;
walkFrame = 40;
walkAnimationSpeed = 150;
initialRunFrame = 66;
runFrame = 19;
runAnimationSpeed = 400;
currentWeapon = new SM5();
currentWeapon.position = position;
image.weaponHolderb.addChild(currentWeapon.image);
image.weaponHolderf.addChild(currentWeapon.image2);
distanceLimit = 700;
charDistanceLimit = 100;
point = (1000 + ((Math.random() * 10) + 1));
initTimer();
initState(new StateNPCFriendIdle(this));
run = false;
}
override public function animateDeath(_arg1:TimerEvent):void{
super.animateDeath(_arg1);
}
override public function calculateDamage():void{
var _local1:Sound;
if (body.gotShot){
_local1 = new hurtGuy1();
if (!World.getSingleton().muted){
_local1.play();
};
};
super.calculateDamage();
}
override public function die():void{
var _local1:Sound;
super.die();
if (health <= 0){
_local1 = new dieSound1();
if (!World.getSingleton().muted){
_local1.play();
};
};
}
}
}//package p_char.p_nonplayable
Section 191
//Louis (p_char.p_nonplayable.Louis)
package p_char.p_nonplayable {
import flash.events.*;
import p_weapon.*;
import p_singleton.*;
import p_state.p_npcFriendState.*;
import flash.media.*;
public class Louis extends NPCFriend {
public function Louis(){
jumpPower = 10;
speed = 9.5;
runSpeed = (speed * 1.5);
density = 1;
friction = 1;
restitution = 0;
accuracy = 15;
maxHealth = 50;
health = 50;
image = new femaleChar();
image.head.head.gotoAndStop("Louis");
image.torso.torso.gotoAndStop("male03");
Name = "Louis";
price = 7500;
salary = 200;
initialWalkFrame = 25;
walkFrame = 40;
walkAnimationSpeed = 150;
initialRunFrame = 66;
runFrame = 19;
runAnimationSpeed = 400;
currentWeapon = new Deagle();
currentWeapon.position = position;
image.weaponHolderb.addChild(currentWeapon.image);
image.weaponHolderf.addChild(currentWeapon.image2);
distanceLimit = 700;
charDistanceLimit = 100;
point = (1000 + ((Math.random() * 10) + 1));
initTimer();
initState(new StateNPCFriendIdle(this));
run = false;
}
override public function animateDeath(_arg1:TimerEvent):void{
super.animateDeath(_arg1);
}
override public function calculateDamage():void{
var _local1:Sound;
if (body.gotShot){
_local1 = new hurtGuy2();
if (!World.getSingleton().muted){
_local1.play();
};
};
super.calculateDamage();
}
override public function die():void{
var _local1:Sound;
super.die();
if (health <= 0){
_local1 = new dieSound2();
if (!World.getSingleton().muted){
_local1.play();
};
};
}
}
}//package p_char.p_nonplayable
Section 192
//Melisa (p_char.p_nonplayable.Melisa)
package p_char.p_nonplayable {
import flash.events.*;
import p_weapon.*;
import p_singleton.*;
import p_state.p_npcFriendState.*;
import flash.media.*;
public class Melisa extends NPCFriend {
public function Melisa(){
jumpPower = 10;
speed = 9.2;
runSpeed = (speed * 1.5);
density = 1;
friction = 1;
restitution = 0;
accuracy = 15;
maxHealth = 50;
health = 50;
image = new femaleChar();
image.head.head.gotoAndStop("Melisa");
image.torso.torso.gotoAndStop("female03");
Name = "Melisa";
price = 12500;
salary = 650;
initialWalkFrame = 25;
walkFrame = 40;
walkAnimationSpeed = 150;
initialRunFrame = 66;
runFrame = 19;
runAnimationSpeed = 400;
currentWeapon = new SteyrTMP();
currentWeapon.position = position;
image.weaponHolderb.addChild(currentWeapon.image);
image.weaponHolderf.addChild(currentWeapon.image2);
distanceLimit = 700;
charDistanceLimit = 100;
point = (1000 + ((Math.random() * 10) + 1));
initTimer();
initState(new StateNPCFriendIdle(this));
run = false;
}
override public function animateDeath(_arg1:TimerEvent):void{
super.animateDeath(_arg1);
}
override public function calculateDamage():void{
var _local1:Sound;
if (body.gotShot){
_local1 = new hurtGirl2();
if (!World.getSingleton().muted){
_local1.play();
};
};
super.calculateDamage();
}
override public function die():void{
var _local1:Sound;
super.die();
if (health <= 0){
_local1 = new dieGirl();
if (!World.getSingleton().muted){
_local1.play();
};
};
}
}
}//package p_char.p_nonplayable
Section 193
//NonPlayableCharacter (p_char.p_nonplayable.NonPlayableCharacter)
package p_char.p_nonplayable {
import Box2D.Common.Math.*;
import flash.events.*;
import p_char.*;
import p_singleton.*;
import flash.display.*;
import flash.geom.*;
import p_state.p_enemyState.*;
import p_gamelevel.*;
import p_item.*;
import flash.media.*;
import p_billboard.*;
import p_blood.*;
import p_gibs.*;
public class NonPlayableCharacter extends Character {
public var rangeIsReached:Boolean;
public var billBoard:Billboard;
public var sound:Sound;
public var isMovingLeft:Boolean;
public var previousLantai:Number;
public var nearestDistance:Number;
public var level:GameLevel;
public var arrived:Boolean;
public var soundChannel:SoundChannel;
public var run:Boolean;
public var point:int;
public var state:StateEnemy;
public var ladderDestination:int;
public var nearestTarget:Character;
public var soundTransform:SoundTransform;
public var itemDrop:ItemPickUp;
public var distanceLimit:Number;
public var killPoint:int;
public var isMovingDown:Boolean;
public var isMovingRight:Boolean;
public var isMovingUp:Boolean;
public function NonPlayableCharacter(){
bodyType = BodyType.ENEMY;
health = 10;
position = new b2Vec2(1, 0);
direction = new b2Vec2(1, 0);
speed = 2;
level = World.getSingleton().level;
isMovingUp = false;
isMovingDown = false;
arrived = false;
previousLantai = -1;
lantai = -1;
distanceLimit = 150;
rangeIsReached = false;
isMovingRight = true;
isMovingLeft = false;
run = false;
itemDrop = new ItemPickUp();
deathTime = 20;
soundTransform = new SoundTransform();
}
override public function animateWalkForward():void{
bodyPartsGotoAndStop((initialWalkFrame + walkCounter));
walkCounter++;
if (walkCounter > walkFrame){
walkCounter = 0;
};
}
override public function animateDeath(_arg1:TimerEvent):void{
if (deathTime <= 0){
deathTimer.stop();
deathTimer.removeEventListener(TimerEvent.TIMER, animateDeath);
if (image){
if (World.getSingleton().level.enemyGround.contains(image)){
World.getSingleton().level.enemyGround.removeChild(image);
World.getSingleton().setFocusToStage();
};
};
} else {
deathTime--;
};
}
override public function animateWalkBackward():void{
var _local1:int;
_local1 = (walkFrame + initialWalkFrame);
bodyPartsGotoAndStop((_local1 - walkCounter));
walkCounter++;
if (walkCounter > walkFrame){
walkCounter = 0;
};
}
override public function moveUp():void{
var _local1:b2Vec2;
if (ableToMoveUp){
_local1 = body.GetPosition();
_local1.x = (MovieClip(level.middleGround)[("ladder" + onTheLadderUp)].x / World.physScale);
_local1.y = (_local1.y - (speed / World.physScale));
body.SetXForm(_local1, 0);
characterState = CharacterState.CLIMB;
body.m_angularDamping = 10000;
body.m_linearDamping = 10000;
runTimer.stop();
moveForward = true;
if (!walkTimer.running){
walkTimer.start();
image.head.gotoAndStop("walk");
};
};
}
override public function setIdle():void{
if (walkTimer.running){
walkTimer.stop();
walkCounter = 0;
};
if (runTimer.running){
runTimer.stop();
runCounter = 0;
};
if (characterState != CharacterState.IDLE){
bodyPartsGotoAndPlay("idle");
};
characterState = CharacterState.IDLE;
}
public function bodyPartsGotoAndStop(_arg1:int):void{
image.head.gotoAndStop(_arg1);
image.torso.gotoAndStop(_arg1);
image.leg.gotoAndStop(_arg1);
image.weaponHolderf.getChildAt(0).gotoAndStop(_arg1);
image.weaponHolderb.getChildAt(0).gotoAndStop(_arg1);
}
override public function moveDown():void{
var _local1:b2Vec2;
if (ableToMoveDown){
_local1 = body.GetPosition();
_local1.x = (MovieClip(level.middleGround)[("ladder" + onTheLadderDown)].x / World.physScale);
_local1.y = (_local1.y + (speed / World.physScale));
body.SetXForm(_local1, 0);
characterState = CharacterState.CLIMB;
body.m_angularDamping = 10000;
body.m_linearDamping = 10000;
runTimer.stop();
moveForward = true;
if (!walkTimer.running){
walkTimer.start();
image.head.gotoAndStop("walk");
};
};
}
override public function calculateDamage():void{
var _local1:Sound;
var _local2:int;
var _local3:Point;
var _local4:b2Vec2;
var _local5:int;
var _local6:int;
var _local7:int;
if (body.gotShot){
body.gotShot = false;
body.m_linearDamping = 0;
if (!body.impulseApplied){
body.impulseApplied = new b2Vec2();
};
if (!body.pointCollision){
body.pointCollision = new b2Vec2();
};
body.ApplyImpulse(body.impulseApplied, body.pointCollision);
body.impulseApplied.Multiply(0.75);
_local2 = (Math.floor((Math.random() * 10)) % 3);
if (_local2 == 0){
_local1 = new gotShot1();
} else {
if (_local2 == 1){
_local1 = new gotShot2();
} else {
_local1 = new gotShot3();
};
};
if (image){
if (body.touchedTheGround){
blood = new BloodFloor();
if (World.getSingleton().bloods.size() > 10){
World.getSingleton().bloods.get(0).lifeTime = 0;
};
World.getSingleton().level.backGround.addChild(blood.image);
_local3 = new Point(image.shadow.x, image.shadow.y);
_local3 = image.localToGlobal(_local3);
_local4 = position.Copy();
_local4.Subtract(screenPosition);
blood.position.x = (_local4.x + _local3.x);
blood.position.y = (_local4.y + _local3.y);
blood.image.x = blood.position.x;
blood.image.y = blood.position.y;
if (faceState == FaceState.FACE_LEFT){
blood.image.scaleX = (blood.image.scaleX * -1);
};
};
blood = new BloodShoot();
World.getSingleton().level.playerGround.addChild(blood.image);
blood.image.x = (body.pointCollision.x * 30);
blood.image.y = (body.pointCollision.y * 30);
if (World.getSingleton().playedCharacter){
if (World.getSingleton().playedCharacter.position.x < position.x){
blood.image.scaleX = (blood.image.scaleX * -1);
};
};
};
if (body.headShot){
body.headShot = false;
health = (health - (body.damage * 2));
if (health <= 0){
if (!World.getSingleton().muted){
_local1.play();
};
image.head.gotoAndPlay("death01");
image.head.head.head.gotoAndPlay("headshot1");
image.torso.gotoAndPlay("death01");
image.leg.gotoAndPlay("death01");
image.weaponHolderf.getChildAt(0).gotoAndPlay("death01");
image.weaponHolderb.getChildAt(0).gotoAndPlay("death01");
gibs = new GibsBrain();
gibs.position.x = position.x;
gibs.position.y = position.y;
gibs.initRigidBody();
gibs.body.ApplyImpulse(body.impulseApplied, gibs.body.GetWorldCenter());
World.getSingleton().level.backGround.addChild(gibs.image);
_local5 = 0;
_local6 = 2;
while (_local5 < _local6) {
gibs = new GibsBone();
gibs.position.x = position.x;
gibs.position.y = position.y;
gibs.initRigidBody();
gibs.body.ApplyImpulse(body.impulseApplied, gibs.body.GetWorldCenter());
World.getSingleton().level.backGround.addChild(gibs.image);
gibs = new GibsMeat();
gibs.position.x = position.x;
gibs.position.y = position.y;
gibs.initRigidBody();
gibs.body.ApplyImpulse(body.impulseApplied, gibs.body.GetWorldCenter());
World.getSingleton().level.backGround.addChild(gibs.image);
_local5++;
};
_local7 = ((Math.random() * 10) % 2);
if (_local7 == 1){
if (image.head){
image.head.alpha = 0;
};
};
};
} else {
if (body.bodyShot){
body.bodyShot = false;
health = (health - body.damage);
if (health <= 0){
if (!World.getSingleton().muted){
_local1.play();
};
image.head.gotoAndPlay("death01");
image.torso.torso.gotoAndPlay("bodyshot0");
image.torso.gotoAndPlay("death01");
image.leg.gotoAndPlay("death01");
image.weaponHolderf.getChildAt(0).gotoAndPlay("death01");
image.weaponHolderb.getChildAt(0).gotoAndPlay("death01");
_local5 = 0;
_local6 = 3;
while (_local5 < _local6) {
gibs = new GibsMeat();
gibs.position.x = position.x;
gibs.position.y = position.y;
gibs.initRigidBody();
gibs.body.ApplyImpulse(body.impulseApplied, gibs.body.GetWorldCenter());
World.getSingleton().level.backGround.addChild(gibs.image);
_local5++;
};
if (image.head){
gibs = new GibsHead();
gibs.position.x = position.x;
gibs.position.y = position.y;
gibs.image = image.head.head.head;
gibs.image.gotoAndPlay("headshot1");
gibs.image.width = image.head.width;
gibs.image.height = image.head.height;
World.getSingleton().level.backGround.addChild(gibs.image);
gibs.initRigidBody();
gibs.body.ApplyImpulse(body.impulseApplied, gibs.body.GetWorldCenter());
};
};
} else {
if (body.legShot){
body.legShot = false;
health = (health - (body.damage * 0.5));
if (health <= 0){
if (!World.getSingleton().muted){
_local1.play();
};
image.head.gotoAndPlay("death01");
image.torso.torso.gotoAndPlay("bodyshot1");
image.torso.gotoAndPlay("death01");
image.leg.gotoAndPlay("death01");
image.weaponHolderf.getChildAt(0).gotoAndPlay("death01");
image.weaponHolderb.getChildAt(0).gotoAndPlay("death01");
_local5 = 0;
_local6 = 2;
while (_local5 < _local6) {
gibs = new GibsMeat();
gibs.position.x = position.x;
gibs.position.y = position.y;
gibs.initRigidBody();
gibs.body.ApplyImpulse(body.impulseApplied, gibs.body.GetWorldCenter());
World.getSingleton().level.backGround.addChild(gibs.image);
gibs = new GibsBone();
gibs.position.x = position.x;
gibs.position.y = position.y;
gibs.initRigidBody();
gibs.body.ApplyImpulse(body.impulseApplied, gibs.body.GetWorldCenter());
World.getSingleton().level.backGround.addChild(gibs.image);
_local5++;
};
if (image){
image.alpha = 0;
};
};
};
};
};
};
}
override public function animateRunForward():void{
bodyPartsGotoAndStop((initialRunFrame + runCounter));
runCounter++;
if (runCounter > runFrame){
runCounter = 0;
};
}
override public function die():void{
var _local1:Number;
super.die();
if (health <= 0){
if (soundChannel){
soundChannel.stop();
};
if (World.getSingleton().level){
_local1 = World.getSingleton().level.getLevelRandomItemNumber();
if (_local1 != -1){
itemDrop = itemDrop.getItem(_local1);
itemDrop.position = position.Copy();
itemDrop.screenPosition = screenPosition.Copy();
itemDrop.initRigidBody();
World.getSingleton().itemPickUps.add(itemDrop);
};
};
if (image){
image.bloodSign.alpha = 0;
};
walkTimer.stop();
runTimer.stop();
if (currentWeapon){
currentWeapon.timerOff();
};
billBoard = new Billboard(("" + point), position.x, position.y);
if (World.getSingleton().playedCharacter){
World.getSingleton().kills = (World.getSingleton().kills + killPoint);
World.getSingleton().score = (World.getSingleton().score + point);
World.getSingleton().money = (World.getSingleton().money + point);
if (World.getSingleton().level){
World.getSingleton().level.enemyKilled++;
};
};
World.getSingleton().physicWorld.DestroyBody(body);
body = null;
World.getSingleton().enemies.remove(this);
deathTimer.start();
};
}
public function initState(_arg1:StateEnemy):void{
this.state = _arg1;
}
public function bodyPartsGotoAndPlay(_arg1:String):void{
image.head.gotoAndPlay(_arg1);
image.torso.gotoAndPlay(_arg1);
image.weaponHolderf.getChildAt(0).gotoAndPlay(_arg1);
image.weaponHolderb.getChildAt(0).gotoAndPlay(_arg1);
}
override public function update():void{
var _local1:Number;
var _local2:Number;
state = state.update();
super.update();
if (image){
_local1 = (health / maxHealth);
image.bloodSign.redBlood.width = (100 * _local1);
};
if (soundChannel){
_local2 = screenPosition.x;
_local2 = (_local2 - World.getSingleton().gameWidth);
soundTransform.pan = ((_local2 < 0)) ? -1 : 1;
_local2 = Math.abs(_local2);
_local2 = (_local2 * 0.001);
soundTransform.volume = (1 - _local2);
if (soundTransform.volume < 0){
soundTransform.volume = 0;
};
soundChannel.soundTransform = soundTransform;
};
}
public function getRandomSound():Sound{
var _local1:int;
_local1 = (Math.floor((Math.random() * 10)) % 9);
if (_local1 == 0){
return (new zombieSound1());
};
if (_local1 == 1){
return (new zombieSound2());
};
if (_local1 == 2){
return (new zombieSound3());
};
if (_local1 == 3){
return (new zombieSound4());
};
if (_local1 == 4){
return (new zombieSound5());
};
if (_local1 == 5){
return (new zombieSound6());
};
if (_local1 == 6){
return (new zombieSound7());
};
if (_local1 == 7){
return (new zombieSound8());
};
if (_local1 == 8){
return (new zombieSound9());
};
return (new zombieSound1());
}
override public function animateRunBackward():void{
var _local1:int;
_local1 = (walkFrame + initialRunFrame);
bodyPartsGotoAndStop((_local1 - runCounter));
runCounter++;
if (runCounter > runFrame){
runCounter = 0;
};
}
}
}//package p_char.p_nonplayable
Section 194
//NPCFriend (p_char.p_nonplayable.NPCFriend)
package p_char.p_nonplayable {
import Box2D.Common.Math.*;
import flash.events.*;
import p_char.*;
import p_singleton.*;
import flash.display.*;
import org.idmedia.as3commons.util.*;
import p_state.p_npcFriendState.*;
import p_gamelevel.*;
import p_item.*;
import p_ammo.*;
import p_billboard.*;
import p_gibs.*;
public class NPCFriend extends Character {
public var isMovingLeft:Boolean;
public var playerOwned:Boolean;// = false
public var arrived:Boolean;
public var nearestDistance:Number;
public var run:Boolean;
public var state:StateNPCFriend;
public var ladderDestination:int;
public var itemDrop:ItemPickUp;
public var Name:String;
public var distanceLimit:Number;
public var ammo:Ammo;
public var isMovingDown:Boolean;
public var isMovingUp:Boolean;
public var isMovingRight:Boolean;
public var charDistanceLimit:Number;
public var billBoard:Billboard;
public var previousLantai:Number;
public var price:int;
public var charToFollow:Character;
public var level:GameLevel;
public var nearestTarget:Character;
public var point:int;
public var follow:Boolean;
public var enemyRangeIsReached:Boolean;
public var salaryPaid:Boolean;// = true
public var salary:int;
public function NPCFriend(){
salaryPaid = true;
playerOwned = false;
super();
jumpPower = 10;
bodyType = BodyType.PLAYER;
health = 10;
position = new b2Vec2(1, 0);
direction = new b2Vec2(1, 0);
speed = 2;
level = World.getSingleton().level;
isMovingUp = false;
isMovingDown = false;
arrived = false;
previousLantai = -1;
distanceLimit = 400;
charDistanceLimit = 50;
enemyRangeIsReached = false;
isMovingRight = true;
isMovingLeft = false;
ammoInventory = new ArrayList();
ammo = new Ammo12Gauge(1000);
ammoInventory.add(ammo);
ammo = new Ammo357(2000);
ammoInventory.add(ammo);
ammo = new Ammo45(3000);
ammoInventory.add(ammo);
ammo = new Ammo556(4000);
ammoInventory.add(ammo);
ammo = new Ammo762(5000);
ammoInventory.add(ammo);
ammo = new Ammo9mm(6000);
ammoInventory.add(ammo);
run = false;
follow = true;
itemDrop = new ItemPickUp();
if (World.getSingleton().players.size() > 0){
charToFollow = World.getSingleton().playedCharacter;
};
deathTime = 20;
}
override public function animateDeath(_arg1:TimerEvent):void{
if (deathTime <= 0){
deathTimer.stop();
deathTimer.removeEventListener(TimerEvent.TIMER, animateDeath);
if (image){
if (World.getSingleton().level.enemyGround.contains(image)){
World.getSingleton().level.enemyGround.removeChild(image);
World.getSingleton().setFocusToStage();
};
};
deathTime = 100;
image.head.visible = true;
} else {
deathTime--;
};
}
override public function moveDown():void{
var _local1:b2Vec2;
if (ableToMoveDown){
_local1 = body.GetPosition();
_local1.x = (MovieClip(World.getSingleton().level.middleGround)[("ladder" + onTheLadderDown)].x / World.physScale);
_local1.y = (_local1.y + (speed / World.physScale));
body.SetXForm(_local1, 0);
characterState = CharacterState.CLIMB;
body.m_angularDamping = 10000;
body.m_linearDamping = 10000;
runTimer.stop();
moveForward = true;
if (!walkTimer.running){
walkTimer.start();
};
};
}
override public function moveUp():void{
var _local1:b2Vec2;
if (ableToMoveUp){
_local1 = body.GetPosition();
_local1.x = (MovieClip(World.getSingleton().level.middleGround)[("ladder" + onTheLadderUp)].x / World.physScale);
_local1.y = (_local1.y - (speed / World.physScale));
body.SetXForm(_local1, 0);
characterState = CharacterState.CLIMB;
body.m_angularDamping = 10000;
body.m_linearDamping = 10000;
runTimer.stop();
moveForward = true;
if (!walkTimer.running){
walkTimer.start();
};
};
}
override public function animateWalkBackward():void{
var _local1:int;
_local1 = (walkFrame + initialWalkFrame);
bodyPartsGotoAndStop((_local1 - walkCounter));
walkCounter++;
if (walkCounter > walkFrame){
walkCounter = 0;
};
}
public function bodyPartsGotoAndStop(_arg1:int):void{
image.torso.gotoAndStop(_arg1);
image.leg.gotoAndStop(_arg1);
}
override public function calculateDamage():void{
if (body.gotShot){
body.gotShot = false;
body.m_linearDamping = 0;
if (body.headShot){
body.headShot = false;
health = (health - (body.damage * 2));
};
if (body.bodyShot){
body.bodyShot = false;
health = (health - body.damage);
};
if (body.legShot){
body.legShot = false;
health = (health - (body.damage * 0.5));
};
};
}
override public function die():void{
var _local1:int;
var _local2:int;
var _local3:Number;
super.die();
if (health <= 0){
walkTimer.stop();
runTimer.stop();
if (currentWeapon){
currentWeapon.timerOff();
};
image.head.rotation = 0;
image.head.gotoAndPlay("death");
image.torso.gotoAndPlay("death");
image.leg.gotoAndPlay("death");
image.weaponHolderb.alpha = 0;
image.weaponHolderf.alpha = 0;
if (!body.impulseApplied){
body.impulseApplied = new b2Vec2(0, 0);
};
gibs = new GibsBrain();
gibs.position.x = position.x;
gibs.position.y = position.y;
gibs.initRigidBody();
gibs.body.ApplyImpulse(body.impulseApplied, gibs.body.GetWorldCenter());
World.getSingleton().level.backGround.addChild(gibs.image);
_local1 = 0;
_local2 = 4;
while (_local1 < _local2) {
gibs = new GibsBone();
gibs.position.x = position.x;
gibs.position.y = position.y;
gibs.initRigidBody();
gibs.body.ApplyImpulse(body.impulseApplied, gibs.body.GetWorldCenter());
World.getSingleton().level.backGround.addChild(gibs.image);
gibs = new GibsMeat();
gibs.position.x = position.x;
gibs.position.y = position.y;
gibs.initRigidBody();
gibs.body.ApplyImpulse(body.impulseApplied, gibs.body.GetWorldCenter());
World.getSingleton().level.backGround.addChild(gibs.image);
_local1++;
};
if (World.getSingleton().level){
_local3 = World.getSingleton().level.getLevelRandomItemNumber();
if (_local3 != -1){
itemDrop = itemDrop.getItem(_local3);
itemDrop.position = position.Copy();
itemDrop.screenPosition = screenPosition.Copy();
itemDrop.initRigidBody();
World.getSingleton().itemPickUps.add(itemDrop);
};
};
if (image){
image.bloodSign.alpha = 0;
};
walkTimer.stop();
runTimer.stop();
if (currentWeapon){
currentWeapon.timerOff();
currentWeapon.initTimer();
};
World.getSingleton().physicWorld.DestroyBody(body);
body = null;
salaryPaid = true;
playerOwned = false;
World.getSingleton().npcs.remove(this);
deathTimer.start();
health = maxHealth;
};
}
override public function update():void{
var _local1:Number;
state = state.update();
super.update();
if (image){
_local1 = (health / maxHealth);
image.bloodSign.redBlood.width = (100 * _local1);
};
}
override public function animateWalkForward():void{
bodyPartsGotoAndStop((initialWalkFrame + walkCounter));
walkCounter++;
if (walkCounter > walkFrame){
walkCounter = 0;
};
}
override public function setIdle():void{
if (walkTimer.running){
walkTimer.stop();
walkCounter = 0;
};
if (runTimer.running){
runTimer.stop();
runCounter = 0;
};
if (characterState != CharacterState.IDLE){
bodyPartsGotoAndPlay("idle");
};
characterState = CharacterState.IDLE;
}
public function initState(_arg1:StateNPCFriend):void{
this.state = _arg1;
}
override public function animateRunForward():void{
bodyPartsGotoAndStop((initialRunFrame + runCounter));
runCounter++;
if (runCounter > runFrame){
runCounter = 0;
};
}
public function bodyPartsGotoAndPlay(_arg1:String):void{
image.head.gotoAndPlay(_arg1);
image.torso.gotoAndPlay(_arg1);
}
public function goThroughWithPlayer():void{
if (World.getSingleton().playedCharacter){
position.x = World.getSingleton().playedCharacter.position.x;
position.y = World.getSingleton().playedCharacter.position.y;
if (body){
body.SetXForm(new b2Vec2((position.x / World.physScale), (position.y / World.physScale)), body.GetAngle());
};
};
}
override public function animateRunBackward():void{
var _local1:int;
_local1 = (walkFrame + initialRunFrame);
bodyPartsGotoAndStop((_local1 - runCounter));
runCounter++;
if (runCounter > runFrame){
runCounter = 0;
};
}
}
}//package p_char.p_nonplayable
Section 195
//NPCFriendTest (p_char.p_nonplayable.NPCFriendTest)
package p_char.p_nonplayable {
import flash.events.*;
import p_weapon.*;
import p_singleton.*;
import p_state.p_npcFriendState.*;
public class NPCFriendTest extends NPCFriend {
public function NPCFriendTest(){
jumpPower = 10;
speed = 10;
runSpeed = (speed * 1.5);
density = 1;
friction = 1;
restitution = 0;
accuracy = 15;
maxHealth = 50;
health = 50;
deathTime = 5;
image = new femaleChar();
Name = "Lisa";
price = 1000;
initialWalkFrame = 25;
walkFrame = 40;
walkAnimationSpeed = 200;
initialRunFrame = 66;
runFrame = 19;
runAnimationSpeed = 400;
currentWeapon = new WaltherP99();
currentWeapon.position = position;
image.weaponHolderb.addChild(currentWeapon.image);
image.weaponHolderf.addChild(currentWeapon.image2);
distanceLimit = 800;
charDistanceLimit = 100;
point = (1000 + ((Math.random() * 10) + 1));
initTimer();
initState(new StateNPCFriendIdle(this));
run = false;
}
override public function animateDeath(_arg1:TimerEvent):void{
super.animateDeath(_arg1);
World.getSingleton().mercInventory.add(new NPCFriendTest());
}
}
}//package p_char.p_nonplayable
Section 196
//Wendy (p_char.p_nonplayable.Wendy)
package p_char.p_nonplayable {
import flash.events.*;
import p_weapon.*;
import p_singleton.*;
import p_state.p_npcFriendState.*;
import flash.media.*;
public class Wendy extends NPCFriend {
public function Wendy(){
jumpPower = 10;
speed = 10;
runSpeed = (speed * 1.5);
density = 1;
friction = 1;
restitution = 0;
accuracy = 15;
maxHealth = 50;
health = 50;
image = new femaleChar();
image.head.head.gotoAndStop("Wendy");
image.torso.torso.gotoAndStop("female02");
Name = "Wendy";
price = 20000;
salary = 1000;
initialWalkFrame = 25;
walkFrame = 40;
walkAnimationSpeed = 150;
initialRunFrame = 66;
runFrame = 19;
runAnimationSpeed = 400;
currentWeapon = new AK();
currentWeapon.position = position;
image.weaponHolderb.addChild(currentWeapon.image);
image.weaponHolderf.addChild(currentWeapon.image2);
distanceLimit = 700;
charDistanceLimit = 100;
point = (1000 + ((Math.random() * 10) + 1));
initTimer();
initState(new StateNPCFriendIdle(this));
run = false;
}
override public function animateDeath(_arg1:TimerEvent):void{
super.animateDeath(_arg1);
}
override public function calculateDamage():void{
var _local1:Sound;
if (body.gotShot){
_local1 = new hurtGirl2();
if (!World.getSingleton().muted){
_local1.play();
};
};
super.calculateDamage();
}
override public function die():void{
var _local1:Sound;
super.die();
if (health <= 0){
_local1 = new dieGirl2();
if (!World.getSingleton().muted){
_local1.play();
};
};
}
}
}//package p_char.p_nonplayable
Section 197
//Zombie01 (p_char.p_nonplayable.Zombie01)
package p_char.p_nonplayable {
import p_weapon.*;
import p_singleton.*;
import p_state.p_enemyState.*;
public class Zombie01 extends NonPlayableCharacter {
public function Zombie01(){
var _local1:int;
super();
maxHealth = 100;
health = 100;
jumpPower = 5;
speed = 4;
runSpeed = (speed * 1.5);
density = 1;
friction = 1;
restitution = 0;
image = new zombieNormal01Image();
image.head.head.gotoAndStop("head01");
image.torso.torso.gotoAndStop("body01");
World.getSingleton().level.enemyGround.addChild(image);
initialWalkFrame = 25;
walkFrame = 32;
walkAnimationSpeed = 400;
initialRunFrame = 58;
runFrame = 19;
runAnimationSpeed = 300;
distanceLimit = 60;
point = (20 + ((Math.random() * 10) + 1));
killPoint = 1;
currentWeapon = new Zombie01Weapon();
currentWeapon.position = position;
image.weaponHolderb.addChild(currentWeapon.image);
image.weaponHolderf.addChild(currentWeapon.image2);
initTimer();
_local1 = (Math.floor((Math.random() * 10)) % 2);
if (_local1 == 0){
run = false;
} else {
run = true;
};
initState(new StateEnemyIdle(this));
sound = getRandomSound();
if (!World.getSingleton().muted){
soundChannel = sound.play(0, 9999);
};
}
override public function attack(_arg1:Boolean):void{
super.attack(_arg1);
if (walkTimer.running){
walkTimer.stop();
};
if (runTimer.running){
runTimer.stop();
};
}
}
}//package p_char.p_nonplayable
Section 198
//Zombie02 (p_char.p_nonplayable.Zombie02)
package p_char.p_nonplayable {
import p_weapon.*;
import p_singleton.*;
import p_state.p_enemyState.*;
public class Zombie02 extends NonPlayableCharacter {
public function Zombie02(){
var _local1:int;
super();
maxHealth = 100;
health = 100;
jumpPower = 5;
speed = 4;
runSpeed = (speed * 1.5);
density = 1;
friction = 1;
restitution = 0;
image = new zombieNormal01Image();
image.head.head.gotoAndStop("head02");
image.torso.torso.gotoAndStop("body02");
World.getSingleton().level.enemyGround.addChild(image);
initialWalkFrame = 25;
walkFrame = 32;
walkAnimationSpeed = 400;
initialRunFrame = 58;
runFrame = 19;
runAnimationSpeed = 300;
distanceLimit = 60;
point = (20 + ((Math.random() * 10) + 1));
killPoint = 1;
currentWeapon = new Zombie02Weapon();
currentWeapon.position = position;
image.weaponHolderb.addChild(currentWeapon.image);
image.weaponHolderf.addChild(currentWeapon.image2);
initTimer();
_local1 = (Math.floor((Math.random() * 10)) % 2);
if (_local1 == 0){
run = false;
} else {
run = true;
};
initState(new StateEnemyIdle(this));
sound = getRandomSound();
if (!World.getSingleton().muted){
soundChannel = sound.play(0, 9999);
};
}
override public function attack(_arg1:Boolean):void{
super.attack(_arg1);
if (walkTimer.running){
walkTimer.stop();
};
if (runTimer.running){
runTimer.stop();
};
}
}
}//package p_char.p_nonplayable
Section 199
//Zombie03 (p_char.p_nonplayable.Zombie03)
package p_char.p_nonplayable {
import p_weapon.*;
import p_singleton.*;
import p_state.p_enemyState.*;
public class Zombie03 extends NonPlayableCharacter {
public function Zombie03(){
var _local1:int;
super();
maxHealth = 100;
health = 100;
jumpPower = 5;
speed = 4;
runSpeed = (speed * 1.5);
density = 1;
friction = 1;
restitution = 0;
image = new zombieNormal01Image();
image.head.head.gotoAndStop("head03");
image.torso.torso.gotoAndStop("body03");
World.getSingleton().level.enemyGround.addChild(image);
initialWalkFrame = 25;
walkFrame = 32;
walkAnimationSpeed = 400;
initialRunFrame = 58;
runFrame = 19;
runAnimationSpeed = 300;
distanceLimit = 60;
point = (20 + ((Math.random() * 10) + 1));
killPoint = 1;
currentWeapon = new Zombie01Weapon();
currentWeapon.position = position;
image.weaponHolderb.addChild(currentWeapon.image);
image.weaponHolderf.addChild(currentWeapon.image2);
initTimer();
_local1 = (Math.floor((Math.random() * 10)) % 2);
if (_local1 == 0){
run = false;
} else {
run = true;
};
initState(new StateEnemyIdle(this));
sound = getRandomSound();
if (!World.getSingleton().muted){
soundChannel = sound.play(0, 9999);
};
}
override public function attack(_arg1:Boolean):void{
super.attack(_arg1);
if (walkTimer.running){
walkTimer.stop();
};
if (runTimer.running){
runTimer.stop();
};
}
}
}//package p_char.p_nonplayable
Section 200
//Zombie04 (p_char.p_nonplayable.Zombie04)
package p_char.p_nonplayable {
import p_weapon.*;
import p_singleton.*;
import p_state.p_enemyState.*;
public class Zombie04 extends NonPlayableCharacter {
public function Zombie04(){
var _local1:int;
super();
maxHealth = 100;
health = 100;
jumpPower = 5;
speed = 4;
runSpeed = (speed * 1.5);
density = 1;
friction = 1;
restitution = 0;
image = new zombieNormal01Image();
image.head.head.gotoAndStop("head04");
image.torso.torso.gotoAndStop("body04");
World.getSingleton().level.enemyGround.addChild(image);
initialWalkFrame = 25;
walkFrame = 32;
walkAnimationSpeed = 400;
initialRunFrame = 58;
runFrame = 19;
runAnimationSpeed = 300;
distanceLimit = 60;
point = (20 + ((Math.random() * 10) + 1));
killPoint = 1;
currentWeapon = new Zombie01Weapon();
currentWeapon.position = position;
image.weaponHolderb.addChild(currentWeapon.image);
image.weaponHolderf.addChild(currentWeapon.image2);
initTimer();
_local1 = (Math.floor((Math.random() * 10)) % 2);
if (_local1 == 0){
run = false;
} else {
run = true;
};
initState(new StateEnemyIdle(this));
sound = getRandomSound();
if (!World.getSingleton().muted){
soundChannel = sound.play(0, 9999);
};
}
override public function attack(_arg1:Boolean):void{
super.attack(_arg1);
if (walkTimer.running){
walkTimer.stop();
};
if (runTimer.running){
runTimer.stop();
};
}
}
}//package p_char.p_nonplayable
Section 201
//Zombie05 (p_char.p_nonplayable.Zombie05)
package p_char.p_nonplayable {
import p_weapon.*;
import p_singleton.*;
import p_state.p_enemyState.*;
public class Zombie05 extends NonPlayableCharacter {
public function Zombie05(){
var _local1:int;
super();
maxHealth = 100;
health = 100;
jumpPower = 5;
speed = 4;
runSpeed = (speed * 1.5);
density = 1;
friction = 1;
restitution = 0;
image = new zombieNormal01Image();
image.head.head.gotoAndStop("head05");
image.torso.torso.gotoAndStop("body04");
World.getSingleton().level.enemyGround.addChild(image);
initialWalkFrame = 25;
walkFrame = 32;
walkAnimationSpeed = 400;
initialRunFrame = 58;
runFrame = 19;
runAnimationSpeed = 300;
distanceLimit = 60;
point = (20 + ((Math.random() * 10) + 1));
killPoint = 1;
currentWeapon = new Zombie01Weapon();
currentWeapon.position = position;
image.weaponHolderb.addChild(currentWeapon.image);
image.weaponHolderf.addChild(currentWeapon.image2);
initTimer();
_local1 = (Math.floor((Math.random() * 10)) % 2);
if (_local1 == 0){
run = false;
} else {
run = true;
};
initState(new StateEnemyIdle(this));
sound = getRandomSound();
if (!World.getSingleton().muted){
soundChannel = sound.play(0, 9999);
};
}
override public function attack(_arg1:Boolean):void{
super.attack(_arg1);
if (walkTimer.running){
walkTimer.stop();
};
if (runTimer.running){
runTimer.stop();
};
}
}
}//package p_char.p_nonplayable
Section 202
//Zombie06 (p_char.p_nonplayable.Zombie06)
package p_char.p_nonplayable {
import p_weapon.*;
import p_singleton.*;
import p_state.p_enemyState.*;
public class Zombie06 extends NonPlayableCharacter {
public function Zombie06(){
var _local1:int;
super();
maxHealth = 400;
health = 400;
jumpPower = 5;
speed = 2;
runSpeed = (speed * 1.5);
density = 1;
friction = 1;
restitution = 0;
image = new zombieNormal02Image();
image.head.head.gotoAndStop("head01");
image.torso.torso.gotoAndStop("body05");
World.getSingleton().level.enemyGround.addChild(image);
initialWalkFrame = 25;
walkFrame = 32;
walkAnimationSpeed = 400;
initialRunFrame = 58;
runFrame = 19;
runAnimationSpeed = 300;
distanceLimit = 60;
point = (55 + ((Math.random() * 10) + 1));
killPoint = 1;
currentWeapon = new Zombie03Weapon();
currentWeapon.position = position;
image.weaponHolderb.addChild(currentWeapon.image);
image.weaponHolderf.addChild(currentWeapon.image2);
initTimer();
_local1 = (Math.floor((Math.random() * 10)) % 2);
if (_local1 == 0){
run = false;
} else {
run = true;
};
initState(new StateEnemyIdle(this));
sound = getRandomSound();
if (!World.getSingleton().muted){
soundChannel = sound.play(0, 9999);
};
}
override public function attack(_arg1:Boolean):void{
super.attack(_arg1);
if (walkTimer.running){
walkTimer.stop();
};
if (runTimer.running){
runTimer.stop();
};
}
}
}//package p_char.p_nonplayable
Section 203
//Zombie07 (p_char.p_nonplayable.Zombie07)
package p_char.p_nonplayable {
import p_weapon.*;
import p_singleton.*;
import p_state.p_enemyState.*;
public class Zombie07 extends NonPlayableCharacter {
public function Zombie07(){
var _local1:int;
super();
maxHealth = 330;
health = 330;
jumpPower = 5;
speed = 2;
runSpeed = (speed * 1.5);
density = 1;
friction = 1;
restitution = 0;
image = new zombieNormal02Image();
image.head.head.gotoAndStop("head02");
image.torso.torso.gotoAndStop("body05");
World.getSingleton().level.enemyGround.addChild(image);
initialWalkFrame = 25;
walkFrame = 32;
walkAnimationSpeed = 400;
initialRunFrame = 58;
runFrame = 19;
runAnimationSpeed = 300;
distanceLimit = 60;
point = (55 + ((Math.random() * 10) + 1));
killPoint = 1;
currentWeapon = new Zombie03Weapon();
currentWeapon.position = position;
image.weaponHolderb.addChild(currentWeapon.image);
image.weaponHolderf.addChild(currentWeapon.image2);
initTimer();
_local1 = (Math.floor((Math.random() * 10)) % 2);
if (_local1 == 0){
run = false;
} else {
run = true;
};
initState(new StateEnemyIdle(this));
sound = getRandomSound();
if (!World.getSingleton().muted){
soundChannel = sound.play(0, 9999);
};
}
override public function attack(_arg1:Boolean):void{
super.attack(_arg1);
if (walkTimer.running){
walkTimer.stop();
};
if (runTimer.running){
runTimer.stop();
};
}
}
}//package p_char.p_nonplayable
Section 204
//Zombie08 (p_char.p_nonplayable.Zombie08)
package p_char.p_nonplayable {
import p_weapon.*;
import p_singleton.*;
import p_state.p_enemyState.*;
public class Zombie08 extends NonPlayableCharacter {
public function Zombie08(){
var _local1:int;
super();
maxHealth = 100;
health = 100;
jumpPower = 5;
speed = 3;
runSpeed = (speed * 1.5);
density = 1;
friction = 1;
restitution = 0;
image = new zombieNormal02Image();
image.head.head.gotoAndStop("head03");
image.torso.torso.gotoAndStop("body05");
World.getSingleton().level.enemyGround.addChild(image);
initialWalkFrame = 25;
walkFrame = 32;
walkAnimationSpeed = 400;
initialRunFrame = 58;
runFrame = 19;
runAnimationSpeed = 300;
distanceLimit = 60;
point = (55 + ((Math.random() * 10) + 1));
killPoint = 1;
currentWeapon = new Zombie03Weapon();
currentWeapon.position = position;
image.weaponHolderb.addChild(currentWeapon.image);
image.weaponHolderf.addChild(currentWeapon.image2);
initTimer();
_local1 = (Math.floor((Math.random() * 10)) % 2);
if (_local1 == 0){
run = false;
} else {
run = true;
};
initState(new StateEnemyIdle(this));
sound = getRandomSound();
if (!World.getSingleton().muted){
soundChannel = sound.play(0, 9999);
};
}
override public function attack(_arg1:Boolean):void{
super.attack(_arg1);
if (walkTimer.running){
walkTimer.stop();
};
if (runTimer.running){
runTimer.stop();
};
}
}
}//package p_char.p_nonplayable
Section 205
//Zombie09 (p_char.p_nonplayable.Zombie09)
package p_char.p_nonplayable {
import p_weapon.*;
import p_singleton.*;
import p_state.p_enemyState.*;
public class Zombie09 extends NonPlayableCharacter {
public function Zombie09(){
var _local1:int;
super();
maxHealth = 320;
health = 320;
jumpPower = 5;
speed = 3;
runSpeed = (speed * 1.5);
density = 1;
friction = 1;
restitution = 0;
image = new zombieNormal02Image();
image.head.head.gotoAndStop("head04");
image.torso.torso.gotoAndStop("body05");
World.getSingleton().level.enemyGround.addChild(image);
initialWalkFrame = 25;
walkFrame = 32;
walkAnimationSpeed = 400;
initialRunFrame = 58;
runFrame = 19;
runAnimationSpeed = 300;
distanceLimit = 60;
point = (55 + ((Math.random() * 10) + 1));
killPoint = 1;
currentWeapon = new Zombie03Weapon();
currentWeapon.position = position;
image.weaponHolderb.addChild(currentWeapon.image);
image.weaponHolderf.addChild(currentWeapon.image2);
initTimer();
_local1 = (Math.floor((Math.random() * 10)) % 2);
if (_local1 == 0){
run = false;
} else {
run = true;
};
initState(new StateEnemyIdle(this));
sound = getRandomSound();
if (!World.getSingleton().muted){
soundChannel = sound.play(0, 9999);
};
}
override public function attack(_arg1:Boolean):void{
super.attack(_arg1);
if (walkTimer.running){
walkTimer.stop();
};
if (runTimer.running){
runTimer.stop();
};
}
}
}//package p_char.p_nonplayable
Section 206
//Zombie10 (p_char.p_nonplayable.Zombie10)
package p_char.p_nonplayable {
import p_weapon.*;
import p_singleton.*;
import p_state.p_enemyState.*;
public class Zombie10 extends NonPlayableCharacter {
public function Zombie10(){
var _local1:int;
super();
maxHealth = 300;
health = 300;
jumpPower = 5;
speed = 3;
runSpeed = (speed * 1.5);
density = 1;
friction = 1;
restitution = 0;
image = new zombieNormal02Image();
image.head.head.gotoAndStop("head05");
image.torso.torso.gotoAndStop("body05");
World.getSingleton().level.enemyGround.addChild(image);
initialWalkFrame = 25;
walkFrame = 32;
walkAnimationSpeed = 400;
initialRunFrame = 58;
runFrame = 19;
runAnimationSpeed = 300;
distanceLimit = 60;
point = (55 + ((Math.random() * 10) + 1));
killPoint = 1;
currentWeapon = new Zombie03Weapon();
currentWeapon.position = position;
image.weaponHolderb.addChild(currentWeapon.image);
image.weaponHolderf.addChild(currentWeapon.image2);
initTimer();
_local1 = (Math.floor((Math.random() * 10)) % 2);
if (_local1 == 0){
run = false;
} else {
run = true;
};
initState(new StateEnemyIdle(this));
sound = getRandomSound();
if (!World.getSingleton().muted){
soundChannel = sound.play(0, 9999);
};
}
override public function attack(_arg1:Boolean):void{
super.attack(_arg1);
if (walkTimer.running){
walkTimer.stop();
};
if (runTimer.running){
runTimer.stop();
};
}
}
}//package p_char.p_nonplayable
Section 207
//ZombieCrawler01 (p_char.p_nonplayable.ZombieCrawler01)
package p_char.p_nonplayable {
import Box2D.Common.Math.*;
import p_weapon.*;
import p_char.*;
import p_singleton.*;
import flash.display.*;
import flash.geom.*;
import p_state.p_enemyState.*;
import flash.media.*;
import p_blood.*;
import p_gibs.*;
public class ZombieCrawler01 extends NonPlayableCharacter {
public function ZombieCrawler01(){
var _local1:int;
var _local2:String;
var _local3:int;
var _local4:String;
var _local5:int;
super();
maxHealth = 50;
health = 30;
jumpPower = 5;
speed = 1;
runSpeed = (speed * 1.2);
density = 1;
friction = 1;
restitution = 0;
image = new zombieCrawl01();
_local1 = (Math.floor((Math.random() * 10)) % 5);
_local1++;
_local2 = ("head0" + _local1);
image.head.gotoAndStop(_local2);
_local3 = (Math.floor((Math.random() * 10)) % 4);
_local3++;
_local4 = ("body0" + _local3);
image.torso.torso.gotoAndStop(_local4);
World.getSingleton().level.enemyGround.addChild(image);
initialWalkFrame = 25;
walkFrame = 32;
walkAnimationSpeed = 400;
initialRunFrame = 58;
runFrame = 19;
runAnimationSpeed = 300;
distanceLimit = 60;
point = (30 + ((Math.random() * 10) + 1));
killPoint = 1;
if (_local3 == 5){
currentWeapon = new Zombie03Weapon();
} else {
currentWeapon = new Zombie04Weapon();
};
currentWeapon.position = position;
image.weaponHolderf.addChild(currentWeapon.image);
image.weaponHolderb.addChild(currentWeapon.image2);
initTimer();
_local5 = (Math.floor((Math.random() * 10)) % 2);
if (_local5 == 0){
run = false;
} else {
run = true;
};
initState(new StateEnemyIdle(this));
sound = getRandomSound();
if (!World.getSingleton().muted){
soundChannel = sound.play(0, 9999);
};
}
override public function animateWalkForward():void{
if (currentWeapon){
currentWeapon.image.gotoAndStop((initialWalkFrame + walkCounter));
currentWeapon.image2.gotoAndStop((initialWalkFrame + walkCounter));
};
walkCounter++;
if (walkCounter > walkFrame){
walkCounter = 0;
};
}
override public function runLeft():void{
var _local1:b2Vec2;
if (ableToMoveLeft){
if (faceState == FaceState.FACE_RIGHT){
moveForward = false;
moveBackward = true;
} else {
if (faceState == FaceState.FACE_LEFT){
moveForward = true;
moveBackward = false;
};
};
body.SetLinearVelocity(new b2Vec2(-(runSpeed), body.GetLinearVelocity().y));
walkTimer.stop();
if (characterState != CharacterState.RUN){
if (!runTimer.running){
runTimer.start();
};
};
if (body.m_linearDamping > 0){
_local1 = body.GetPosition().Copy();
_local1.x = (_local1.x - (runSpeed / 30));
body.SetXForm(_local1, body.GetAngle());
};
characterState = CharacterState.RUN;
};
}
override public function animateWalkBackward():void{
var _local1:int;
_local1 = (walkFrame + initialWalkFrame);
if (currentWeapon){
currentWeapon.image.gotoAndStop((_local1 - walkCounter));
currentWeapon.image2.gotoAndStop((_local1 - walkCounter));
};
walkCounter++;
if (walkCounter > walkFrame){
walkCounter = 0;
};
}
override public function attack(_arg1:Boolean):void{
super.attack(_arg1);
if (walkTimer.running){
walkTimer.stop();
};
if (runTimer.running){
runTimer.stop();
};
}
override public function runRight():void{
var _local1:b2Vec2;
if (ableToMoveRight){
if (faceState == FaceState.FACE_RIGHT){
moveForward = true;
moveBackward = false;
} else {
if (faceState == FaceState.FACE_LEFT){
moveForward = false;
moveBackward = true;
};
};
body.SetLinearVelocity(new b2Vec2(runSpeed, body.GetLinearVelocity().y));
walkTimer.stop();
if (characterState != CharacterState.RUN){
if (!runTimer.running){
runTimer.start();
};
};
if (body.m_linearDamping > 0){
_local1 = body.GetPosition().Copy();
_local1.x = (_local1.x + (runSpeed / 30));
body.SetXForm(_local1, body.GetAngle());
};
characterState = CharacterState.RUN;
};
}
override public function moveUp():void{
var _local1:b2Vec2;
if (ableToMoveUp){
_local1 = body.GetPosition();
_local1.x = (MovieClip(level.middleGround)[("ladder" + onTheLadderUp)].x / World.physScale);
_local1.y = (_local1.y - (speed / World.physScale));
body.SetXForm(_local1, 0);
characterState = CharacterState.CLIMB;
body.m_angularDamping = 10000;
body.m_linearDamping = 10000;
runTimer.stop();
moveForward = true;
if (!walkTimer.running){
walkTimer.start();
};
};
}
override public function setIdle():void{
if (walkTimer.running){
walkTimer.stop();
walkCounter = 0;
};
if (runTimer.running){
runTimer.stop();
runCounter = 0;
};
if (characterState != CharacterState.IDLE){
if (currentWeapon){
currentWeapon.image.gotoAndPlay("idle");
};
};
characterState = CharacterState.IDLE;
}
override public function moveDown():void{
var _local1:b2Vec2;
if (ableToMoveDown){
_local1 = body.GetPosition();
_local1.x = (MovieClip(level.middleGround)[("ladder" + onTheLadderDown)].x / World.physScale);
_local1.y = (_local1.y + (speed / World.physScale));
body.SetXForm(_local1, 0);
characterState = CharacterState.CLIMB;
body.m_angularDamping = 10000;
body.m_linearDamping = 10000;
runTimer.stop();
moveForward = true;
if (!walkTimer.running){
walkTimer.start();
};
};
}
override public function animateRunBackward():void{
var _local1:int;
_local1 = (walkFrame + initialRunFrame);
if (currentWeapon){
currentWeapon.image.gotoAndStop((_local1 - runCounter));
currentWeapon.image2.gotoAndStop((_local1 - runCounter));
};
runCounter++;
if (runCounter > runFrame){
runCounter = 0;
};
}
override public function walkLeft():void{
var _local1:b2Vec2;
if (ableToMoveLeft){
if (faceState == FaceState.FACE_RIGHT){
moveForward = false;
moveBackward = true;
} else {
if (faceState == FaceState.FACE_LEFT){
moveForward = true;
moveBackward = false;
};
};
body.SetLinearVelocity(new b2Vec2(-(speed), body.GetLinearVelocity().y));
runTimer.stop();
if (characterState != CharacterState.WALK){
if (!walkTimer.running){
walkTimer.start();
};
};
if (body.m_linearDamping > 0){
_local1 = body.GetPosition().Copy();
_local1.x = (_local1.x - (speed / 30));
body.SetXForm(_local1, body.GetAngle());
};
characterState = CharacterState.WALK;
};
}
override public function calculateDamage():void{
var _local1:Sound;
var _local2:int;
var _local3:Point;
var _local4:b2Vec2;
var _local5:int;
var _local6:int;
var _local7:int;
if (body.gotShot){
body.gotShot = false;
body.m_linearDamping = 0;
body.ApplyImpulse(body.impulseApplied, body.pointCollision);
body.impulseApplied.Multiply(0.75);
_local2 = (Math.floor((Math.random() * 10)) % 3);
if (_local2 == 0){
_local1 = new gotShot1();
} else {
if (_local2 == 1){
_local1 = new gotShot2();
} else {
_local1 = new gotShot3();
};
};
if (image){
if (body.touchedTheGround){
blood = new BloodFloor();
if (World.getSingleton().bloods.size() > 10){
World.getSingleton().bloods.get(0).lifeTime = 0;
};
World.getSingleton().level.backGround.addChild(blood.image);
_local3 = new Point(image.shadow.x, image.shadow.y);
_local3 = image.localToGlobal(_local3);
_local4 = position.Copy();
_local4.Subtract(screenPosition);
blood.position.x = (_local4.x + _local3.x);
blood.position.y = (_local4.y + _local3.y);
blood.image.x = blood.position.x;
blood.image.y = blood.position.y;
if (faceState == FaceState.FACE_LEFT){
blood.image.scaleX = (blood.image.scaleX * -1);
};
};
blood = new BloodShoot();
World.getSingleton().level.playerGround.addChild(blood.image);
blood.image.x = (body.pointCollision.x * 30);
blood.image.y = (body.pointCollision.y * 30);
if (World.getSingleton().playedCharacter){
if (World.getSingleton().playedCharacter.position.x < position.x){
blood.image.scaleX = (blood.image.scaleX * -1);
};
};
};
if (body.headShot){
body.headShot = false;
health = (health - (body.damage * 2));
if (health <= 0){
_local1.play();
image.head.head.gotoAndPlay("headshot1");
image.weaponHolderf.getChildAt(0).gotoAndPlay("death01");
image.weaponHolderb.getChildAt(0).gotoAndPlay("death01");
gibs = new GibsBrain();
gibs.position.x = position.x;
gibs.position.y = position.y;
gibs.initRigidBody();
gibs.body.ApplyImpulse(body.impulseApplied, gibs.body.GetWorldCenter());
World.getSingleton().level.backGround.addChild(gibs.image);
_local5 = 0;
_local6 = 2;
while (_local5 < _local6) {
gibs = new GibsBone();
gibs.position.x = position.x;
gibs.position.y = position.y;
gibs.initRigidBody();
gibs.body.ApplyImpulse(body.impulseApplied, gibs.body.GetWorldCenter());
World.getSingleton().level.backGround.addChild(gibs.image);
gibs = new GibsMeat();
gibs.position.x = position.x;
gibs.position.y = position.y;
gibs.initRigidBody();
gibs.body.ApplyImpulse(body.impulseApplied, gibs.body.GetWorldCenter());
World.getSingleton().level.backGround.addChild(gibs.image);
_local5++;
};
_local7 = ((Math.random() * 10) % 2);
if (_local7 == 1){
if (image.head){
image.head.alpha = 0;
};
};
};
} else {
if (body.bodyShot){
body.bodyShot = false;
health = (health - body.damage);
if (health <= 0){
_local1.play();
image.torso.torso.gotoAndPlay("bodyshot0");
image.weaponHolderf.getChildAt(0).gotoAndPlay("death01");
image.weaponHolderb.getChildAt(0).gotoAndPlay("death01");
_local5 = 0;
_local6 = 3;
while (_local5 < _local6) {
gibs = new GibsMeat();
gibs.position.x = position.x;
gibs.position.y = position.y;
gibs.initRigidBody();
gibs.body.ApplyImpulse(body.impulseApplied, gibs.body.GetWorldCenter());
World.getSingleton().level.backGround.addChild(gibs.image);
_local5++;
};
if (image.head){
gibs = new GibsHead();
gibs.position.x = position.x;
gibs.position.y = position.y;
gibs.image = image.head.head;
gibs.image.gotoAndPlay("headshot1");
gibs.image.width = 71;
gibs.image.height = 78;
World.getSingleton().level.backGround.addChild(gibs.image);
gibs.initRigidBody();
gibs.body.ApplyImpulse(body.impulseApplied, gibs.body.GetWorldCenter());
};
};
} else {
if (body.legShot){
body.legShot = false;
health = (health - (body.damage * 0.5));
if (health <= 0){
_local1.play();
image.torso.torso.gotoAndPlay("bodyshot1");
image.weaponHolderf.getChildAt(0).gotoAndPlay("death01");
image.weaponHolderb.getChildAt(0).gotoAndPlay("death01");
_local5 = 0;
_local6 = 2;
while (_local5 < _local6) {
gibs = new GibsMeat();
gibs.position.x = position.x;
gibs.position.y = position.y;
gibs.initRigidBody();
gibs.body.ApplyImpulse(body.impulseApplied, gibs.body.GetWorldCenter());
World.getSingleton().level.backGround.addChild(gibs.image);
gibs = new GibsBone();
gibs.position.x = position.x;
gibs.position.y = position.y;
gibs.initRigidBody();
gibs.body.ApplyImpulse(body.impulseApplied, gibs.body.GetWorldCenter());
World.getSingleton().level.backGround.addChild(gibs.image);
_local5++;
};
if (image){
image.alpha = 0;
};
};
};
};
};
};
}
override public function animateRunForward():void{
if (currentWeapon){
currentWeapon.image.gotoAndStop((initialRunFrame + runCounter));
currentWeapon.image2.gotoAndStop((initialRunFrame + runCounter));
};
runCounter++;
if (runCounter > runFrame){
runCounter = 0;
};
}
override public function walkRight():void{
var _local1:b2Vec2;
if (ableToMoveRight){
if (faceState == FaceState.FACE_RIGHT){
moveForward = true;
moveBackward = false;
} else {
if (faceState == FaceState.FACE_LEFT){
moveForward = false;
moveBackward = true;
};
};
body.SetLinearVelocity(new b2Vec2(speed, body.GetLinearVelocity().y));
runTimer.stop();
if (characterState != CharacterState.WALK){
if (!walkTimer.running){
walkTimer.start();
};
};
if (body.m_linearDamping > 0){
_local1 = body.GetPosition().Copy();
_local1.x = (_local1.x + (speed / 30));
body.SetXForm(_local1, body.GetAngle());
};
characterState = CharacterState.WALK;
};
}
}
}//package p_char.p_nonplayable
Section 208
//ZombieNormal01 (p_char.p_nonplayable.ZombieNormal01)
package p_char.p_nonplayable {
import p_weapon.*;
import p_singleton.*;
import p_state.p_enemyState.*;
public class ZombieNormal01 extends NonPlayableCharacter {
public function ZombieNormal01(){
maxHealth = 100;
health = 100;
jumpPower = 5;
speed = 4;
runSpeed = (speed * 1.5);
density = 1;
friction = 1;
restitution = 0;
image = new zombieNormal01Image();
World.getSingleton().level.enemyGround.addChild(image);
initialWalkFrame = 25;
walkFrame = 32;
walkAnimationSpeed = 400;
initialRunFrame = 58;
runFrame = 19;
runAnimationSpeed = 300;
distanceLimit = 100;
point = (60 + ((Math.random() * 10) + 1));
killPoint = 1;
currentWeapon = new Zombie01Weapon();
currentWeapon.position = position;
image.weaponHolderb.addChild(currentWeapon.image);
image.weaponHolderf.addChild(currentWeapon.image2);
initTimer();
run = false;
initState(new StateEnemyIdle(this));
}
override public function attack(_arg1:Boolean):void{
super.attack(_arg1);
if (walkTimer.running){
walkTimer.stop();
};
if (runTimer.running){
runTimer.stop();
};
}
}
}//package p_char.p_nonplayable
Section 209
//FemaleChar (p_char.p_playable.FemaleChar)
package p_char.p_playable {
import p_singleton.*;
import flash.media.*;
public class FemaleChar extends PlayableCharacter {
public function FemaleChar(){
jumpPower = 10;
speed = 10;
runSpeed = (speed * 1.5);
density = 1;
friction = 1;
restitution = 0;
accuracy = 15;
maxHealth = 100;
health = 100;
image = new femaleChar();
initialWalkFrame = 25;
walkFrame = 40;
walkAnimationSpeed = 200;
initialRunFrame = 66;
runFrame = 19;
runAnimationSpeed = 400;
rangeWeaponInventory.add(World.getSingleton().rangeWeaponInventory.get(0));
currentWeapon = rangeWeaponInventory.get(0);
currentWeapon.position = position;
checkCurrentWeaponAmmo();
image.weaponHolderb.addChild(currentWeapon.image);
image.weaponHolderf.addChild(currentWeapon.image2);
meleeWeaponInventory.add(World.getSingleton().meleeWeaponInventory.get(0));
primaryWeapon = rangeWeaponInventory.get(0);
meleeWeapon = meleeWeaponInventory.get(0);
primaryWeapon.playerOwned = true;
meleeWeapon.playerOwned = true;
initTimer();
changeWeapon(currentWeapon);
}
override public function calculateDamage():void{
var _local1:Sound;
var _local2:int;
if (body.gotShot){
_local2 = (Math.floor((Math.random() * 10)) % 2);
if (_local2 == 0){
_local1 = new hurtGirl1();
} else {
_local1 = new hurtGirl2();
};
if (!World.getSingleton().muted){
_local1.play();
};
};
super.calculateDamage();
}
override public function die():void{
var _local1:Sound;
super.die();
if (health <= 0){
_local1 = new dieGirl();
if (!World.getSingleton().muted){
_local1.play();
};
};
}
}
}//package p_char.p_playable
Section 210
//PlayableCharacter (p_char.p_playable.PlayableCharacter)
package p_char.p_playable {
import Box2D.Common.Math.*;
import flash.events.*;
import p_weapon.*;
import p_char.*;
import p_singleton.*;
import flash.display.*;
import org.idmedia.as3commons.util.*;
import p_ammo.*;
public class PlayableCharacter extends Character {
public var lastKillLimit:int;// = 0
public var exp:Number;
public var perkBag:ArrayList;
public var perks:ArrayList;
public var explosiveWeapon:ExplosiveWeapon;
public var level:int;
public var itemInventory:ArrayList;
public var currentWeaponNumber:int;
public var meleeWeapon:MeleeWeapon;
public var secondaryWeapon:RangeWeapon;
public var primaryWeapon:RangeWeapon;
public var ammo:Ammo;
public var destinationDoor:String;
public function PlayableCharacter(){
lastKillLimit = 0;
super();
bodyType = BodyType.PLAYER;
health = 100;
position = new b2Vec2(1, 0);
direction = new b2Vec2(1, 0);
rangeWeaponInventory = new ArrayList();
meleeWeaponInventory = new ArrayList();
explosiveWeaponInventory = new ArrayList();
speed = 5;
score = 0;
deathTime = 50;
destinationDoor = "none";
itemInventory = new ArrayList();
ammoInventory = new ArrayList();
ammo = new Ammo12Gauge(90);
ammoInventory.add(ammo);
ammo = new Ammo357(90);
ammoInventory.add(ammo);
ammo = new Ammo45(90);
ammoInventory.add(ammo);
ammo = new Ammo556(90);
ammoInventory.add(ammo);
ammo = new Ammo762(90);
ammoInventory.add(ammo);
ammo = new Ammo9mm(300);
ammoInventory.add(ammo);
perkBag = new ArrayList();
perks = new ArrayList();
level = 1;
exp = 0;
lastKillLimit = 0;
}
override public function animateWalkForward():void{
bodyPartsGotoAndStop((initialWalkFrame + walkCounter));
walkCounter++;
if (walkCounter > walkFrame){
walkCounter = 0;
};
}
override public function animateDeath(_arg1:TimerEvent):void{
if (deathTime <= 0){
deathTimer.stop();
if (image){
if (World.getSingleton().level.playerGround.contains(image)){
World.getSingleton().level.playerGround.removeChild(image);
World.getSingleton().setFocusToStage();
};
};
} else {
deathTime--;
};
}
public function goThroughDoor():void{
if (destinationDoor != "none"){
position.x = (MovieClip(World.getSingleton().level.middleGround)[("" + destinationDoor)].x + World.getSingleton().level.middleGround.x);
position.y = (MovieClip(World.getSingleton().level.middleGround)[("" + destinationDoor)].y + World.getSingleton().level.middleGround.y);
if (body){
body.SetXForm(new b2Vec2((position.x / World.physScale), (position.y / World.physScale)), body.GetAngle());
};
};
}
override public function animateWalkBackward():void{
var _local1:int;
_local1 = (walkFrame + initialWalkFrame);
bodyPartsGotoAndStop((_local1 - walkCounter));
walkCounter++;
if (walkCounter > walkFrame){
walkCounter = 0;
};
}
override public function setIdle():void{
if (walkTimer.running){
walkTimer.stop();
walkCounter = 0;
};
if (runTimer.running){
runTimer.stop();
runCounter = 0;
};
if (characterState != CharacterState.IDLE){
if (health > 0){
bodyPartsGotoAndPlay("idle");
};
};
characterState = CharacterState.IDLE;
}
public function bodyPartsGotoAndStop(_arg1:int):void{
image.torso.gotoAndStop(_arg1);
image.leg.gotoAndStop(_arg1);
}
public function revive():void{
score = 0;
health = maxHealth;
image.weaponHolderb.alpha = 1;
image.weaponHolderf.alpha = 1;
image.weaponHolderb.rotation = 0;
image.weaponHolderf.rotation = 0;
reset();
setIdle();
bodyPartsGotoAndPlay("idle");
image.leg.gotoAndStop("idle");
initTimer();
if (currentWeapon){
currentWeapon.initTimer();
if (currentWeapon.weaponType == WeaponType.MELEE){
changeWeapon(meleeWeapon);
} else {
if (currentWeapon.weaponType == WeaponType.RANGE){
if (primaryWeapon){
changeWeapon(primaryWeapon);
} else {
if (secondaryWeapon){
changeWeapon(secondaryWeapon);
} else {
changeWeapon(meleeWeapon);
};
};
} else {
if (currentWeapon.weaponType == WeaponType.EXPLOSIVE){
if (explosiveWeapon){
changeWeapon(explosiveWeapon);
} else {
changeWeapon(meleeWeapon);
};
};
};
};
currentWeapon.image.gotoAndStop(1);
currentWeapon.image2.gotoAndStop(1);
};
World.getSingleton().players.add(this);
}
override public function animateRunForward():void{
bodyPartsGotoAndStop((initialRunFrame + runCounter));
runCounter++;
if (runCounter > runFrame){
runCounter = 0;
};
}
override public function die():void{
super.die();
if (health <= 0){
walkTimer.stop();
runTimer.stop();
if (currentWeapon){
currentWeapon.timerOff();
};
image.head.rotation = 0;
image.head.gotoAndPlay("death");
image.torso.gotoAndPlay("death");
image.leg.gotoAndPlay("death");
image.weaponHolderb.alpha = 0;
image.weaponHolderf.alpha = 0;
World.getSingleton().physicWorld.DestroyBody(body);
body = null;
World.getSingleton().players.remove(this);
World.getSingleton().playedCharacter = null;
};
}
public function bodyPartsGotoAndPlay(_arg1:String):void{
image.head.gotoAndPlay(_arg1);
image.torso.gotoAndPlay(_arg1);
}
override public function update():void{
super.update();
if (currentWeapon.weaponType == WeaponType.EXPLOSIVE){
if ((((ExplosiveWeapon(currentWeapon).reloadAmmo <= 0)) && ((ExplosiveWeapon(currentWeapon).ammo <= 0)))){
explosiveWeaponInventory.remove(currentWeapon);
changeWeapon(meleeWeapon);
explosiveWeapon = null;
};
};
}
public function copyTo(_arg1:PlayableCharacter):void{
var _local2:int;
var _local3:int;
_arg1.health = this.health;
_arg1.maxHealth = this.maxHealth;
_arg1.score = this.score;
_arg1.accuracy = this.accuracy;
_arg1.speed = this.speed;
_local2 = 0;
_local3 = this.ammoInventory.size();
while (_local2 < _local3) {
_arg1.ammoInventory.get(_local2).amount = this.ammoInventory.get(_local2).amount;
_local2++;
};
_arg1.rangeWeaponInventory.clear();
_arg1.meleeWeaponInventory.clear();
_arg1.explosiveWeaponInventory.clear();
_arg1.perkBag.clear();
_arg1.perks.clear();
_arg1.itemInventory.clear();
_arg1.primaryWeapon = null;
_arg1.secondaryWeapon = null;
_arg1.meleeWeapon = null;
_arg1.explosiveWeapon = null;
_local2 = 0;
_local3 = this.rangeWeaponInventory.size();
while (_local2 < _local3) {
_arg1.rangeWeaponInventory.add(this.rangeWeaponInventory.get(_local2));
_arg1.rangeWeaponInventory.get(_local2).ammo = _arg1.rangeWeaponInventory.get(_local2).maxAmmo;
_local2++;
};
_local2 = 0;
_local3 = this.meleeWeaponInventory.size();
while (_local2 < _local3) {
_arg1.meleeWeaponInventory.add(this.meleeWeaponInventory.get(_local2));
_local2++;
};
_local2 = 0;
_local3 = this.explosiveWeaponInventory.size();
while (_local2 < _local3) {
_arg1.explosiveWeaponInventory.add(this.explosiveWeaponInventory.get(_local2));
_arg1.explosiveWeaponInventory.get(_local2).reloadAmmo = this.explosiveWeaponInventory.get(_local2).reloadAmmo;
_arg1.explosiveWeaponInventory.get(_local2).ammo = _arg1.explosiveWeaponInventory.get(_local2).maxAmmo;
_local2++;
};
if (this.primaryWeapon){
_arg1.primaryWeapon = this.primaryWeapon;
};
if (this.secondaryWeapon){
_arg1.secondaryWeapon = this.secondaryWeapon;
};
if (this.meleeWeapon){
_arg1.meleeWeapon = this.meleeWeapon;
};
if (this.explosiveWeapon){
_arg1.explosiveWeapon = this.explosiveWeapon;
};
}
override public function animateRunBackward():void{
var _local1:int;
_local1 = (runFrame + initialRunFrame);
bodyPartsGotoAndStop((_local1 - runCounter));
runCounter++;
if (runCounter > runFrame){
runCounter = 0;
};
}
}
}//package p_char.p_playable
Section 211
//BodyType (p_char.BodyType)
package p_char {
public class BodyType {
public static var MAGZ:int = 9;
public static var BARRICADE:int = 11;
public static var WALL:int = 6;
public static var ITEM_PICK_UP:int = 5;
public static var ITEM:int = 10;
public static var SHELL:int = 8;
public static var PLAYER_BULLET:int = 1;
public static var PLAYER:int = 3;
public static var ENEMY:int = 4;
public static var PLAYERLIMIT:int = 13;
public static var FLOOR:int = 7;
public static var GIBS:int = 12;
public static var ENEMY_BULLET:int = 2;
}
}//package p_char
Section 212
//Character (p_char.Character)
package p_char {
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import flash.events.*;
import p_weapon.*;
import p_singleton.*;
import org.idmedia.as3commons.util.*;
import flash.geom.*;
import flash.utils.*;
import p_entity.*;
import p_billboard.*;
import p_blood.*;
import p_gibs.*;
import p_particle.*;
public class Character extends Entity {
public var blood:Blood;
public var bodyDef:b2BodyDef;
public var headDef:b2PolygonDef;
public var walkTimer:Timer;
public var ableToMoveLeft:Boolean;
public var torsoDef:b2PolygonDef;
public var initialRunFrame:int;
public var legDef:b2CircleDef;
public var ableToAttack:Boolean;
public var ableToMoveUp:Boolean;
public var active:Boolean;// = true
public var deathTimer:Timer;
public var walkFrame:int;
public var faceState:String;
public var ammoInventory:ArrayList;
public var onTheGround:Boolean;
public var initialWalkFrame:int;
public var ableToJump:Boolean;
public var speed:Number;
public var walkAnimationSpeed:Number;
public var health:int;
public var deathTime:Number;// = 200
public var lantai:int;
public var restitution:Number;
public var jumpPower:Number;
public var runTimer:Timer;
public var runSpeed:Number;
public var meleeWeaponInventory:ArrayList;
public var onTheLadderUp:int;
public var score:int;
public var runAnimationSpeed:Number;
public var onTheLadderDown:int;
public var body:b2Body;
public var rangeWeaponInventory:ArrayList;
public var ableToMoveDown:Boolean;
public var runFrame:int;
public var floorDetectorDef:b2CircleDef;
public var moveForward:Boolean;
public var gibs:Gibs;
public var touchedTheCeiling:Boolean;
public var ableToMoveRight:Boolean;
public var moveBackward:Boolean;
public var maxHealth:int;
public var stageNumber:int;
public var density:Number;
public var characterState:String;
public var runCounter:int;
public var walkCounter:int;
public var currentWeapon:Weapon;
public var accuracy:int;
public var friction:Number;
public var explosiveWeaponInventory:ArrayList;
public var bodyType:int;
public function Character(){
active = true;
deathTime = 200;
super();
faceState = FaceState.FACE_RIGHT;
characterState = CharacterState.IDLE;
onTheGround = false;
reset();
lantai = -1;
onTheLadderUp = -1;
onTheLadderDown = -1;
accuracy = 0;
walkCounter = 0;
moveForward = false;
moveBackward = false;
walkAnimationSpeed = 1000;
runCounter = 0;
runAnimationSpeed = 1000;
deathTimer = new Timer(100);
deathTimer.addEventListener(TimerEvent.TIMER, animateDeath);
}
public function animateRun(_arg1:TimerEvent):void{
var _local2:int;
var _local3:Particle;
var _local4:Point;
var _local5:b2Vec2;
if (image){
if ((runCounter % 9) == 0){
_local2 = 0;
while (_local2 < 1) {
_local3 = new SmokeParticle();
_local3.position = position.Copy();
_local3.screenPosition = screenPosition.Copy();
_local4 = new Point(image.smokeOut.x, image.smokeOut.y);
_local4 = image.localToGlobal(_local4);
_local5 = position.Copy();
_local5.Subtract(screenPosition);
_local3.position.x = (_local5.x + _local4.x);
_local3.position.y = (_local5.y + _local4.y);
_local3.screenPosition.x = _local4.x;
_local3.screenPosition.y = _local4.y;
_local2++;
};
};
};
if (moveForward){
animateRunForward();
} else {
if (moveBackward){
animateRunBackward();
};
};
if (body){
if (body.normal){
};
};
}
public function setSpeed(_arg1:Number, _arg2:Number):void{
if (walkTimer.running){
walkTimer.stop();
};
this.speed = _arg1;
this.walkAnimationSpeed = _arg2;
walkTimer.removeEventListener(TimerEvent.TIMER, animateWalk);
initTimer();
}
public function animateWalkForward():void{
image.head.gotoAndStop((initialWalkFrame + walkCounter));
image.torso.gotoAndStop((initialWalkFrame + walkCounter));
image.leg.gotoAndStop((initialWalkFrame + walkCounter));
walkCounter++;
if (walkCounter > walkFrame){
walkCounter = 0;
};
}
public function setRunSpeed(_arg1:Number, _arg2:Number):void{
if (runTimer.running){
runTimer.stop();
};
this.runSpeed = _arg1;
this.runAnimationSpeed = _arg2;
runTimer.removeEventListener(TimerEvent.TIMER, animateRun);
initTimer();
}
public function animateDeath(_arg1:TimerEvent):void{
if (deathTime <= 0){
deathTimer.stop();
if (image){
if (World.getSingleton().level.playerGround.contains(image)){
World.getSingleton().level.playerGround.removeChild(image);
World.getSingleton().setFocusToStage();
};
};
} else {
deathTime--;
};
}
public function climbing():Boolean{
if (characterState == CharacterState.CLIMB){
if (((!(ableToMoveUp)) && (!(ableToMoveDown)))){
characterState = CharacterState.FALL;
body.m_linearDamping = 0;
return (true);
};
};
return (false);
}
public function runLeft():void{
var _local1:b2Vec2;
if (ableToMoveLeft){
if (faceState == FaceState.FACE_RIGHT){
moveForward = false;
moveBackward = true;
} else {
if (faceState == FaceState.FACE_LEFT){
moveForward = true;
moveBackward = false;
};
};
body.SetLinearVelocity(new b2Vec2(-(runSpeed), body.GetLinearVelocity().y));
walkTimer.stop();
if (characterState != CharacterState.RUN){
if (!runTimer.running){
runTimer.start();
image.head.gotoAndStop("run");
};
};
if (body.m_linearDamping > 0){
_local1 = body.GetPosition().Copy();
_local1.x = (_local1.x - (runSpeed / 30));
body.SetXForm(_local1, body.GetAngle());
};
characterState = CharacterState.RUN;
};
}
public function initTimer():void{
walkTimer = new Timer((walkAnimationSpeed / walkFrame));
walkTimer.addEventListener(TimerEvent.TIMER, animateWalk);
runTimer = new Timer((runAnimationSpeed / runFrame));
runTimer.addEventListener(TimerEvent.TIMER, animateRun);
}
public function checkCurrentWeaponAmmo():void{
var _local1:int;
var _local2:int;
if (currentWeapon.weaponType == WeaponType.RANGE){
_local1 = 0;
_local2 = ammoInventory.size();
while (_local1 < _local2) {
if (RangeWeapon(currentWeapon).ammoType.id == ammoInventory.get(_local1).id){
RangeWeapon(currentWeapon).ammoType = ammoInventory.get(_local1);
};
_local1++;
};
};
}
override public function initRigidBody():void{
var _local1:b2World;
_local1 = World.getSingleton().physicWorld;
if (_local1){
headDef = new b2PolygonDef();
headDef.SetAsOrientedBox((image.kepala.width / (2 * 30)), (image.kepala.height / (2 * 30)), new b2Vec2((image.kepala.x / (1 * 30)), (image.kepala.y / (1 * 30))));
headDef.density = density;
headDef.friction = 0;
headDef.restitution = restitution;
headDef.filter.groupIndex = bodyType;
headDef.id = "head";
torsoDef = new b2PolygonDef();
torsoDef.SetAsOrientedBox((image.badan.width / (2 * 30)), (image.badan.height / (2 * 30)), new b2Vec2((image.badan.x / (1 * 30)), (image.badan.y / (1 * 30))));
torsoDef.density = density;
torsoDef.friction = 0;
torsoDef.restitution = restitution;
torsoDef.filter.groupIndex = bodyType;
torsoDef.id = "body";
legDef = new b2CircleDef();
legDef.radius = (image.kaki.width / (2 * 30));
legDef.localPosition.Set((image.kaki.x / (1 * 30)), (image.kaki.y / (1 * 30)));
legDef.friction = 0;
legDef.restitution = restitution;
legDef.density = density;
legDef.filter.groupIndex = bodyType;
legDef.id = "leg";
floorDetectorDef = new b2CircleDef();
floorDetectorDef.radius = (image.floorDetector.width / (2 * 30));
floorDetectorDef.localPosition.Set((image.floorDetector.x / (1 * 30)), (image.floorDetector.y / (1 * 30)));
floorDetectorDef.density = density;
floorDetectorDef.friction = friction;
floorDetectorDef.restitution = restitution;
floorDetectorDef.filter.groupIndex = bodyType;
floorDetectorDef.id = "floorDetector";
bodyDef = new b2BodyDef();
bodyDef.fixedRotation = true;
bodyDef.userData = image;
bodyDef.position.Set((position.x / World.physScale), (position.y / World.physScale));
body = _local1.CreateBody(bodyDef);
body.CreateShape(headDef);
body.CreateShape(torsoDef);
body.CreateShape(legDef);
body.CreateShape(floorDetectorDef);
body.SetMassFromShapes();
body.AllowSleeping(false);
body.m_angularDamping = 10000;
body.m_linearDamping = 0;
body.type = bodyType;
};
}
public function aim(_arg1:Number, _arg2:Number):void{
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
if (currentWeapon){
if (currentWeapon.image){
_local3 = (_arg1 - currentWeapon.screenPosition.x);
_local4 = (_arg2 - currentWeapon.screenPosition.y);
_local5 = b2Math.radiansToDegrees(Math.atan2(_local4, _local3));
_local6 = currentWeapon.image.rotation;
if ((((_local5 > 90)) || ((_local5 < -90)))){
if (faceState == FaceState.FACE_RIGHT){
turnFace();
};
} else {
if (faceState == FaceState.FACE_LEFT){
turnFace();
};
};
currentWeapon.direction = b2Vec2.vectorTransform(_local5, new b2Vec2(1, 0));
currentWeapon.angle = _local5;
if (faceState == FaceState.FACE_LEFT){
if (_local5 > 0){
_local5 = (180 - _local5);
} else {
if (_local5 < 0){
_local5 = (-180 - _local5);
};
};
};
if ((((_local5 < 30)) && ((_local5 > -30)))){
image.head.rotation = _local5;
};
currentWeapon.image.rotation = _local5;
currentWeapon.image2.rotation = _local5;
currentWeapon.faceState = faceState;
};
};
}
public function animateWalk(_arg1:TimerEvent):void{
if (moveForward){
animateWalkForward();
} else {
if (moveBackward){
animateWalkBackward();
};
};
}
public function animateWalkBackward():void{
var _local1:int;
_local1 = (walkFrame + initialWalkFrame);
image.head.gotoAndStop((_local1 - walkCounter));
image.torso.gotoAndStop((_local1 - walkCounter));
image.leg.gotoAndStop((_local1 - walkCounter));
walkCounter++;
if (walkCounter > walkFrame){
walkCounter = 0;
};
}
public function attack(_arg1:Boolean):void{
if (ableToAttack){
if (currentWeapon){
characterState = CharacterState.ATTACK;
if (currentWeapon.weaponType == WeaponType.RANGE){
RangeWeapon(currentWeapon).attack(_arg1);
} else {
if (currentWeapon.weaponType == WeaponType.MELEE){
MeleeWeapon(currentWeapon).attack(_arg1);
} else {
if (currentWeapon.weaponType == WeaponType.EXPLOSIVE){
ExplosiveWeapon(currentWeapon).attack(_arg1);
};
};
};
};
};
}
public function runRight():void{
var _local1:b2Vec2;
if (ableToMoveRight){
if (faceState == FaceState.FACE_RIGHT){
moveForward = true;
moveBackward = false;
} else {
if (faceState == FaceState.FACE_LEFT){
moveForward = false;
moveBackward = true;
};
};
body.SetLinearVelocity(new b2Vec2(runSpeed, body.GetLinearVelocity().y));
walkTimer.stop();
if (characterState != CharacterState.RUN){
if (!runTimer.running){
runTimer.start();
image.head.gotoAndStop("run");
};
};
if (body.m_linearDamping > 0){
_local1 = body.GetPosition().Copy();
_local1.x = (_local1.x + (runSpeed / 30));
body.SetXForm(_local1, body.GetAngle());
};
characterState = CharacterState.RUN;
};
}
public function moveUp():void{
var _local1:b2Vec2;
if (ableToMoveUp){
_local1 = body.GetPosition();
_local1.y = (_local1.y - (speed / World.physScale));
body.SetXForm(_local1, 0);
characterState = CharacterState.CLIMB;
body.m_angularDamping = 10000;
body.m_linearDamping = 10000;
runTimer.stop();
moveForward = true;
if (!walkTimer.running){
walkTimer.start();
image.head.gotoAndStop("walk");
};
};
}
public function setIdle():void{
if (walkTimer.running){
walkTimer.stop();
walkCounter = 0;
};
if (runTimer.running){
runTimer.stop();
runCounter = 0;
};
if (characterState != CharacterState.IDLE){
image.head.gotoAndPlay("idle");
image.torso.gotoAndPlay("idle");
};
characterState = CharacterState.IDLE;
}
public function moveDown():void{
var _local1:b2Vec2;
if (ableToMoveDown){
_local1 = body.GetPosition();
_local1.y = (_local1.y + (speed / World.physScale));
body.SetXForm(_local1, 0);
characterState = CharacterState.CLIMB;
body.m_angularDamping = 10000;
body.m_linearDamping = 10000;
runTimer.stop();
moveForward = true;
if (!walkTimer.running){
walkTimer.start();
image.head.gotoAndStop("walk");
};
};
}
public function reset():void{
ableToAttack = true;
ableToJump = true;
ableToMoveRight = true;
ableToMoveLeft = true;
ableToMoveUp = false;
ableToMoveDown = false;
touchedTheCeiling = false;
}
public function checkShadow():void{
if (image){
if (image.shadow){
if (body){
if (body.touchedTheGround){
image.shadow.visible = true;
} else {
image.shadow.visible = false;
};
};
};
};
}
public function jump():void{
if (ableToJump){
if (this.onTheGround){
body.GetLinearVelocity().y = (body.GetLinearVelocity().y - jumpPower);
characterState = CharacterState.JUMP;
body.m_angularDamping = 10000;
body.m_linearDamping = 0;
walkTimer.stop();
runTimer.stop();
};
};
}
public function walkLeft():void{
var _local1:b2Vec2;
if (ableToMoveLeft){
if (faceState == FaceState.FACE_RIGHT){
moveForward = false;
moveBackward = true;
} else {
if (faceState == FaceState.FACE_LEFT){
moveForward = true;
moveBackward = false;
};
};
body.SetLinearVelocity(new b2Vec2(-(speed), body.GetLinearVelocity().y));
runTimer.stop();
if (characterState != CharacterState.WALK){
if (!walkTimer.running){
walkTimer.start();
image.head.gotoAndStop("walk");
};
};
if (body.m_linearDamping > 0){
_local1 = body.GetPosition().Copy();
_local1.x = (_local1.x - (speed / 30));
body.SetXForm(_local1, body.GetAngle());
};
characterState = CharacterState.WALK;
};
}
public function deactivate():void{
active = false;
if (body){
body.PutToSleep();
};
}
public function calculateDamage():void{
var _local1:BloodOnScreen;
if (body.gotShot){
body.gotShot = false;
body.m_linearDamping = 0;
_local1 = new BloodOnScreen(5);
if (body.headShot){
body.headShot = false;
health = (health - (body.damage * 2));
};
if (body.bodyShot){
body.bodyShot = false;
health = (health - body.damage);
};
if (body.legShot){
body.legShot = false;
health = (health - (body.damage * 0.5));
};
};
}
public function animateRunForward():void{
image.head.gotoAndStop((initialRunFrame + runCounter));
image.torso.gotoAndStop((initialRunFrame + runCounter));
image.leg.gotoAndStop((initialRunFrame + runCounter));
runCounter++;
if (runCounter > runFrame){
runCounter = 0;
};
}
public function die():void{
if (health <= 0){
ableToAttack = false;
ableToJump = false;
ableToMoveRight = false;
ableToMoveLeft = false;
ableToMoveUp = false;
ableToMoveDown = false;
walkTimer.removeEventListener(TimerEvent.TIMER, animateWalk);
runTimer.removeEventListener(TimerEvent.TIMER, animateRun);
};
}
public function turnFace():void{
if (image){
image.scaleX = (image.scaleX * -1);
};
if (faceState == FaceState.FACE_LEFT){
faceState = FaceState.FACE_RIGHT;
direction.x = 1;
} else {
faceState = FaceState.FACE_LEFT;
direction.x = -1;
};
}
public function reload():void{
if (currentWeapon){
if (currentWeapon.weaponType == WeaponType.RANGE){
RangeWeapon(currentWeapon).reload();
} else {
if (currentWeapon.weaponType == WeaponType.EXPLOSIVE){
ExplosiveWeapon(currentWeapon).reload();
};
};
};
}
public function activate():void{
active = true;
if (body){
body.WakeUp();
};
}
public function falling():Boolean{
if (onTheGround){
return (false);
};
if (((!(onTheGround)) && (!((characterState == CharacterState.CLIMB))))){
body.m_linearDamping = 0;
return (true);
};
return (false);
}
override public function update():void{
onTheGround = body.touchedTheGround;
position.x = (body.GetPosition().x * World.physScale);
position.y = (body.GetPosition().y * World.physScale);
angle = b2Math.radiansToDegrees(body.GetAngle());
body.bodyState = characterState;
super.update();
if (characterState != CharacterState.DIE){
body.SetXForm(body.GetPosition(), 0);
};
calculateDamage();
die();
if (currentWeapon){
currentWeapon.update();
};
checkShadow();
}
public function walkRight():void{
var _local1:b2Vec2;
if (ableToMoveRight){
if (faceState == FaceState.FACE_RIGHT){
moveForward = true;
moveBackward = false;
} else {
if (faceState == FaceState.FACE_LEFT){
moveForward = false;
moveBackward = true;
};
};
body.SetLinearVelocity(new b2Vec2(speed, body.GetLinearVelocity().y));
runTimer.stop();
if (characterState != CharacterState.WALK){
if (!walkTimer.running){
walkTimer.start();
image.head.gotoAndStop("walk");
};
};
if (body.m_linearDamping > 0){
_local1 = body.GetPosition().Copy();
_local1.x = (_local1.x + (speed / 30));
body.SetXForm(_local1, body.GetAngle());
};
characterState = CharacterState.WALK;
};
}
public function changeWeapon(_arg1:Weapon):void{
if (currentWeapon){
if (currentWeapon.weaponType == WeaponType.RANGE){
if (RangeWeapon(currentWeapon).reloading){
return;
};
} else {
if (currentWeapon.weaponType == WeaponType.MELEE){
if (MeleeWeapon(currentWeapon).attacking){
return;
};
} else {
if (currentWeapon.weaponType == WeaponType.EXPLOSIVE){
if (((ExplosiveWeapon(currentWeapon).throwing) || (ExplosiveWeapon(currentWeapon).reloading))){
return;
};
};
};
};
image.weaponHolderb.removeChild(currentWeapon.image);
image.weaponHolderf.removeChild(currentWeapon.image2);
currentWeapon = _arg1;
currentWeapon.position = position;
currentWeapon.screenPosition = screenPosition;
image.weaponHolderb.addChild(currentWeapon.image);
image.weaponHolderf.addChild(currentWeapon.image2);
if (currentWeapon.weaponType == WeaponType.EXPLOSIVE){
ExplosiveWeapon(currentWeapon).checkWhichIdle();
} else {
if (currentWeapon.weaponType == WeaponType.RANGE){
checkCurrentWeaponAmmo();
};
};
};
}
public function animateRunBackward():void{
var _local1:int;
_local1 = (runFrame + initialRunFrame);
image.head.gotoAndStop((_local1 - runCounter));
image.torso.gotoAndStop((_local1 - runCounter));
image.leg.gotoAndStop((_local1 - runCounter));
runCounter++;
if (runCounter > runFrame){
runCounter = 0;
};
}
}
}//package p_char
Section 213
//CharacterState (p_char.CharacterState)
package p_char {
public class CharacterState {
public static var DIE:String = "die";
public static var WALK:String = "walk";
public static var RUN:String = "run";
public static var JUMP:String = "jump";
public static var ATTACK:String = "attack";
public static var IDLE:String = "idle";
public static var CLIMB:String = "climb";
public static var FALL:String = "fall";
}
}//package p_char
Section 214
//FaceState (p_char.FaceState)
package p_char {
public class FaceState {
public static var FACE_LEFT:String = "faceLeft";
public static var FACE_RIGHT:String = "faceRight";
}
}//package p_char
Section 215
//BuldozerPointer (p_crosshair.BuldozerPointer)
package p_crosshair {
import p_singleton.*;
public class BuldozerPointer extends MousePointer {
public function BuldozerPointer(){
image = new buldozerCursor();
type = MousePointerType.BULDOZER;
World.getSingleton().menuRoot.addChild(image);
addListener();
World.getSingleton().mousePointer = this;
}
}
}//package p_crosshair
Section 216
//Crosshair (p_crosshair.Crosshair)
package p_crosshair {
import p_singleton.*;
public class Crosshair extends MousePointer {
public function Crosshair(){
image = new crosshair();
type = MousePointerType.CROSS;
World.getSingleton().menuRoot.addChild(image);
addListener();
World.getSingleton().mousePointer = this;
}
}
}//package p_crosshair
Section 217
//HandCrosshair (p_crosshair.HandCrosshair)
package p_crosshair {
import p_singleton.*;
public class HandCrosshair extends MousePointer {
public function HandCrosshair(){
image = new handSign();
type = MousePointerType.HAND;
World.getSingleton().menuRoot.addChild(image);
addListener();
World.getSingleton().mousePointer = this;
}
}
}//package p_crosshair
Section 218
//MousePointer (p_crosshair.MousePointer)
package p_crosshair {
import flash.events.*;
import p_singleton.*;
import flash.display.*;
public class MousePointer {
public var type:String;
public var image:MovieClip;
public function addListener():void{
if (!image.hasEventListener(Event.ENTER_FRAME)){
image.addEventListener(Event.ENTER_FRAME, movePointer);
};
}
public function removeListener():void{
if (image.hasEventListener(Event.ENTER_FRAME)){
image.removeEventListener(Event.ENTER_FRAME, movePointer);
};
}
public function destroy():void{
World.getSingleton().menuRoot.removeChild(image);
removeListener();
}
public function movePointer(_arg1:Event):void{
if (image.stage){
image.x = image.stage.mouseX;
image.y = image.stage.mouseY;
};
}
}
}//package p_crosshair
Section 219
//MousePointerType (p_crosshair.MousePointerType)
package p_crosshair {
public class MousePointerType {
public static var CROSS:String = "cross";
public static var BULDOZER:String = "buldozer";
public static var TALK:String = "talk";
public static var HAND:String = "hand";
}
}//package p_crosshair
Section 220
//TalkCrosshair (p_crosshair.TalkCrosshair)
package p_crosshair {
import flash.events.*;
import p_singleton.*;
import p_char.p_nonplayable.*;
import flash.media.*;
public class TalkCrosshair extends MousePointer {
public var npc:NPCFriend;
public var clicked:Boolean;// = false
public function TalkCrosshair(){
clicked = false;
super();
image = new talkSymbol();
type = MousePointerType.TALK;
image.stay.visible = false;
image.follow.visible = false;
World.getSingleton().menuRoot.addChild(image);
addListener();
}
public function addClickListener():void{
image.stay.visible = true;
image.follow.visible = true;
if (!image.stay.hasEventListener(MouseEvent.CLICK)){
image.stay.addEventListener(MouseEvent.CLICK, setNpcStay);
};
if (!image.follow.hasEventListener(MouseEvent.CLICK)){
image.follow.addEventListener(MouseEvent.CLICK, setNpcFollow);
};
}
public function setNpcStay(_arg1:MouseEvent):void{
var _local2:Sound;
if (npc){
npc.follow = false;
npc.setIdle();
};
removeClickListener();
addListener();
clicked = false;
_local2 = new waitSound();
if (!World.getSingleton().muted){
_local2.play();
};
}
override public function addListener():void{
super.addListener();
image.stay.visible = false;
image.follow.visible = false;
}
public function setNpcFollow(_arg1:MouseEvent):void{
var _local2:Sound;
if (npc){
npc.follow = true;
};
removeClickListener();
addListener();
clicked = false;
_local2 = new followSound();
if (!World.getSingleton().muted){
_local2.play();
};
}
public function removeClickListener():void{
image.stay.visible = false;
image.follow.visible = false;
if (image.stay.hasEventListener(MouseEvent.CLICK)){
image.stay.removeEventListener(MouseEvent.CLICK, setNpcStay);
};
if (image.follow.hasEventListener(MouseEvent.CLICK)){
image.follow.removeEventListener(MouseEvent.CLICK, setNpcFollow);
};
}
}
}//package p_crosshair
Section 221
//Explosion (p_effect.Explosion)
package p_effect {
import Box2D.Common.Math.*;
public class Explosion extends VisualEffect {
public function Explosion(_arg1:int, _arg2:b2Vec2){
image = new explosion();
super(_arg1, _arg2);
}
}
}//package p_effect
Section 222
//VisualEffect (p_effect.VisualEffect)
package p_effect {
import Box2D.Common.Math.*;
import flash.events.*;
import p_singleton.*;
import flash.display.*;
import flash.utils.*;
public class VisualEffect {
public var timer:Timer;
public var position:b2Vec2;
public var lifeTime:int;
public var image:MovieClip;
public function VisualEffect(_arg1:int, _arg2:b2Vec2){
World.getSingleton().level.backGround.addChild(image);
this.lifeTime = _arg1;
this.position = _arg2.Copy();
image.x = _arg2.x;
image.y = _arg2.y;
timer = new Timer(100);
timer.addEventListener(TimerEvent.TIMER, checkLifeTime);
timer.start();
}
public function checkLifeTime(_arg1:TimerEvent):void{
lifeTime--;
if (lifeTime <= 0){
if (World.getSingleton().level.backGround.contains(image)){
World.getSingleton().level.backGround.removeChild(image);
};
timer.stop();
timer.removeEventListener(TimerEvent.TIMER, checkLifeTime);
};
}
}
}//package p_effect
Section 223
//Entity (p_entity.Entity)
package p_entity {
import Box2D.Common.Math.*;
import p_singleton.*;
import flash.display.*;
public class Entity {
public var position:b2Vec2;
protected var _sceneRoot:Sprite;
public var angle:Number;
public var screenPosition:b2Vec2;
public var image:MovieClip;
public var direction:b2Vec2;
public function Entity(){
_sceneRoot = World.getSingleton().sceneRoot;
super();
position = new b2Vec2();
screenPosition = new b2Vec2();
}
public function update():void{
if (image){
image.x = position.x;
image.y = position.y;
image.rotation = angle;
};
}
public function initRigidBody():void{
}
}
}//package p_entity
Section 224
//Floor (p_gamelevel.Floor)
package p_gamelevel {
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import p_char.*;
import p_singleton.*;
import flash.display.*;
public class Floor extends MovieClip {
public var friction:Number;
public var bodyDef:b2BodyDef;
public var restitution:Number;
public var polygonDef:b2PolygonDef;
public var body:b2Body;
public var density:Number;
public function Floor(){
density = 0;
friction = 1;
restitution = 0;
initRigidBody();
}
public function initRigidBody():void{
var _local1:b2World;
var _local2:Number;
_local1 = World.getSingleton().physicWorld;
if (_local1){
_local2 = rotation;
rotation = 0;
polygonDef = new b2PolygonDef();
polygonDef.SetAsBox((width / (2 * 30)), (height / (2 * 30)));
polygonDef.density = density;
polygonDef.friction = friction;
polygonDef.restitution = restitution;
polygonDef.filter.groupIndex = BodyType.FLOOR;
rotation = _local2;
bodyDef = new b2BodyDef();
bodyDef.userData = this;
bodyDef.position.Set((x / World.physScale), (y / World.physScale));
bodyDef.angle = b2Math.degreesToRadians(rotation);
body = _local1.CreateBody(bodyDef);
body.CreateShape(polygonDef);
body.SetMassFromShapes();
body.type = BodyType.FLOOR;
};
}
}
}//package p_gamelevel
Section 225
//GameLevel (p_gamelevel.GameLevel)
package p_gamelevel {
import Box2D.Dynamics.*;
import p_char.*;
import p_singleton.*;
import flash.display.*;
import org.idmedia.as3commons.util.*;
import flash.utils.*;
public class GameLevel {
public var arrayOfEnemyClass:ArrayList;
public var numOfStage:int;
public var size:int;
public var numOfTutorial:int;
public var enemyNeedToBeKilled:int;
public var enemySpawnerDelay:Number;// = 2000
public var backGround2:Ground;
public var enemyKilled:int;
public var enemyGround:Sprite;
public var numOfDoor:int;
public var backGround:Ground;
public var playerGround:Sprite;
public var arrayOfFriendClass:ArrayList;
public var arrayOfStage:ArrayList;
public var numOfSign:NumOfSign;
public var bodyList:ArrayList;
public var foreGround:Ground;
public var maxBarricade:int;
public var numOfFriend:int;
public var middleGround:MovieClip;
public function GameLevel(){
var _local1:int;
var _local2:Object;
var _local3:String;
enemySpawnerDelay = 2000;
super();
playerGround = new Sprite();
enemyGround = new Sprite();
bodyList = new ArrayList();
size = middleGround.numChildren;
_local1 = 0;
while (_local1 < size) {
_local2 = middleGround.getChildAt(_local1);
_local3 = getQualifiedClassName(middleGround.getChildAt(_local1));
if (_local3 != "flash.display::Shape"){
if (_local2.body){
bodyList.add(_local2.body);
};
};
_local1++;
};
}
public function findLadderDown(_arg1:int, _arg2:int):int{
return (-1);
}
public function getTutorialContent(_arg1:int):String{
return ("None");
}
public function findNearestLadderDown(_arg1:Character, _arg2:int, _arg3:int):int{
return (-1);
}
public function findLadderUp(_arg1:int, _arg2:int):int{
return (-1);
}
public function getFriendClass(_arg1:int):String{
return ("None");
}
public function update():void{
}
public function detachChild():void{
if (playerGround){
World.getSingleton().sceneRoot.removeChild(playerGround);
};
if (enemyGround){
World.getSingleton().sceneRoot.removeChild(enemyGround);
};
if (backGround2){
World.getSingleton().sceneRoot.removeChild(backGround2);
};
if (backGround){
World.getSingleton().sceneRoot.removeChild(backGround);
};
if (middleGround){
World.getSingleton().sceneRoot.removeChild(middleGround);
};
if (foreGround){
World.getSingleton().sceneRoot.removeChild(foreGround);
};
}
public function getLevelRandomItemNumber():Number{
return (-1);
}
public function attachChild():void{
if (backGround2){
World.getSingleton().sceneRoot.addChild(backGround2);
};
if (backGround){
World.getSingleton().sceneRoot.addChild(backGround);
};
if (middleGround){
World.getSingleton().sceneRoot.addChild(middleGround);
middleGround.visible = false;
};
World.getSingleton().sceneRoot.addChild(enemyGround);
World.getSingleton().sceneRoot.addChild(playerGround);
if (foreGround){
World.getSingleton().sceneRoot.addChild(foreGround);
};
}
public function destroyBodies():void{
var _local1:int;
var _local2:int;
var _local3:b2Body;
_local1 = 0;
_local2 = bodyList.size();
_local1 = (_local2 - 1);
while (_local1 >= 0) {
World.getSingleton().physicWorld.DestroyBody(bodyList.get(_local1));
_local3 = bodyList.get(_local1);
_local3 = null;
bodyList.removeAt(_local1);
_local1--;
};
}
public function findNearestLadderUp(_arg1:Character, _arg2:int, _arg3:int):int{
return (-1);
}
public function findNearestLadder(_arg1:Character, _arg2:int, _arg3:int):int{
var _local4:int;
var _local5:Number;
var _local6:Number;
var _local7:int;
if (middleGround){
_local4 = _arg2;
_local5 = 100000;
while (_local4 < (_arg2 + _arg3)) {
_local6 = (_arg1.position.x - middleGround[("ladder" + _local4)].x);
_local6 = Math.abs(_local6);
if (_local6 < _local5){
_local5 = _local6;
_local7 = _local4;
};
_local4++;
};
return (_local7);
};
return (-1);
}
public function getEnemyClass():String{
return ("None");
}
public function findSpawnPoint(_arg1:int):int{
if (arrayOfStage.get(_arg1).numOfEnemySpawnPoint <= 0){
return (-1);
};
return ((((Math.floor((Math.random() * 10)) + 1) % arrayOfStage.get(_arg1).numOfEnemySpawnPoint) + arrayOfStage.get(_arg1).initialEnemySpawnPoint));
}
}
}//package p_gamelevel
Section 226
//Ground (p_gamelevel.Ground)
package p_gamelevel {
import flash.display.*;
public class Ground extends MovieClip {
public var speed:int;// = 1
public var stageSign0:MovieClip;
public var tutor0:MovieClip;
public var tutor1:MovieClip;
public var stageSign1:MovieClip;
public var tutor4:MovieClip;
public var tutor2:MovieClip;
public var tutor3:MovieClip;
public function Ground(){
speed = 1;
super();
}
}
}//package p_gamelevel
Section 227
//Level1 (p_gamelevel.Level1)
package p_gamelevel {
import p_singleton.*;
import org.idmedia.as3commons.util.*;
public class Level1 extends GameLevel {
public function Level1(){
var _local1:int;
enemyKilled = 0;
enemyNeedToBeKilled = 0;
middleGround = new middleGroundLevel1();
backGround = Ground(new backGroundLevel1());
foreGround = Ground(new foreGroundLevel1());
arrayOfStage = new ArrayList();
arrayOfEnemyClass = new ArrayList();
arrayOfEnemyClass.add("p_char.p_nonplayable::Zombie01");
arrayOfEnemyClass.add("p_char.p_nonplayable::Zombie02");
arrayOfEnemyClass.add("p_char.p_nonplayable::Zombie03");
arrayOfEnemyClass.add("p_char.p_nonplayable::Zombie04");
arrayOfEnemyClass.add("p_char.p_nonplayable::Zombie05");
if (World.getSingleton().waveCounter >= 4){
arrayOfEnemyClass.add("p_char.p_nonplayable::ZombieCrawler01");
};
if (World.getSingleton().waveCounter >= 8){
arrayOfEnemyClass.add("p_char.p_nonplayable::Zombie06");
arrayOfEnemyClass.add("p_char.p_nonplayable::Zombie07");
arrayOfEnemyClass.add("p_char.p_nonplayable::Zombie08");
arrayOfEnemyClass.add("p_char.p_nonplayable::Zombie09");
arrayOfEnemyClass.add("p_char.p_nonplayable::Zombie10");
};
arrayOfFriendClass = new ArrayList();
arrayOfFriendClass.add("p_char.p_nonplayable::NPCFriendTest");
numOfStage = 1;
numOfFriend = 1;
maxBarricade = 2;
_local1 = 0;
while (_local1 < numOfStage) {
foreGround[("stageSign" + _local1)].alpha = 1;
_local1++;
};
numOfDoor = 0;
numOfTutorial = 5;
numOfSign = new NumOfSign();
numOfSign.numOfFloor = 2;
numOfSign.numOfWall = 2;
numOfSign.numOfLadder = 0;
numOfSign.numOfEnemySpawnPoint = 2;
numOfSign.numOfLantaiSign = 1;
numOfSign.numOfEnemies = 500;
numOfSign.numOfNPC = 0;
numOfSign.initialFloor = 0;
numOfSign.initialWall = 0;
numOfSign.initialLadder = 0;
numOfSign.initialEnemySpawnPoint = 0;
numOfSign.initialLantaiSign = 0;
numOfSign.initialEnemies = 0;
numOfSign.initialNPC = 0;
numOfSign.enemyCounter = 0;
arrayOfStage.add(numOfSign);
enemyNeedToBeKilled = (enemyNeedToBeKilled + numOfSign.numOfEnemies);
numOfSign = new NumOfSign();
numOfSign.numOfFloor = 1;
numOfSign.numOfWall = 2;
numOfSign.numOfLadder = 0;
numOfSign.numOfEnemySpawnPoint = 0;
numOfSign.numOfLantaiSign = 1;
numOfSign.numOfEnemies = 0;
numOfSign.numOfNPC = 0;
numOfSign.initialFloor = 1;
numOfSign.initialWall = 2;
numOfSign.initialLadder = 0;
numOfSign.initialEnemySpawnPoint = 0;
numOfSign.initialLantaiSign = 1;
numOfSign.initialEnemies = 0;
numOfSign.initialNPC = 0;
numOfSign.enemyCounter = 0;
arrayOfStage.add(numOfSign);
enemyNeedToBeKilled = (enemyNeedToBeKilled + numOfSign.numOfEnemies);
super();
enemySpawnerDelay = 1000;
}
override public function getTutorialContent(_arg1:int):String{
if (_arg1 == 0){
return ("click on the START button to start level");
};
if (_arg1 == 1){
return ("press A, D or Left, Right arrow to move around\nSPACE to jump");
};
if (_arg1 == 2){
return ("press I to open inventory");
};
if (_arg1 == 3){
return ("buy & place barricades to help you survive");
};
if (_arg1 == 4){
return ("Press 1 2 3 4 to change weapon");
};
return ("None");
}
override public function findLadderUp(_arg1:int, _arg2:int):int{
return (-1);
}
override public function getFriendClass(_arg1:int):String{
if ((((_arg1 < numOfFriend)) && ((_arg1 < arrayOfFriendClass.size())))){
return (arrayOfFriendClass.get(_arg1));
};
return ("None");
}
override public function getLevelRandomItemNumber():Number{
var _local1:int;
_local1 = 0;
_local1 = ((Math.floor((Math.random() * 100)) + 10) % 10);
if (_local1 == 1){
return (0);
};
return (-1);
}
override public function getEnemyClass():String{
var _local1:int;
_local1 = 0;
_local1 = ((Math.floor((Math.random() * 10)) + 1) % arrayOfEnemyClass.size());
return (arrayOfEnemyClass.get(_local1));
}
override public function findLadderDown(_arg1:int, _arg2:int):int{
return (-1);
}
}
}//package p_gamelevel
Section 228
//Level2 (p_gamelevel.Level2)
package p_gamelevel {
import p_char.*;
import p_singleton.*;
import org.idmedia.as3commons.util.*;
public class Level2 extends GameLevel {
public function Level2(){
var _local1:int;
enemyKilled = 0;
enemyNeedToBeKilled = 0;
middleGround = new middleGroundLevel2();
backGround = Ground(new backGroundLevel2());
foreGround = Ground(new foreGroundLevel2());
arrayOfStage = new ArrayList();
arrayOfEnemyClass = new ArrayList();
arrayOfEnemyClass.add("p_char.p_nonplayable::Zombie01");
arrayOfEnemyClass.add("p_char.p_nonplayable::Zombie02");
arrayOfEnemyClass.add("p_char.p_nonplayable::Zombie03");
arrayOfEnemyClass.add("p_char.p_nonplayable::Zombie04");
arrayOfEnemyClass.add("p_char.p_nonplayable::Zombie05");
if (World.getSingleton().waveCounter >= 4){
arrayOfEnemyClass.add("p_char.p_nonplayable::ZombieCrawler01");
};
if (World.getSingleton().waveCounter >= 8){
arrayOfEnemyClass.add("p_char.p_nonplayable::Zombie06");
arrayOfEnemyClass.add("p_char.p_nonplayable::Zombie07");
arrayOfEnemyClass.add("p_char.p_nonplayable::Zombie08");
arrayOfEnemyClass.add("p_char.p_nonplayable::Zombie09");
arrayOfEnemyClass.add("p_char.p_nonplayable::Zombie10");
};
arrayOfFriendClass = new ArrayList();
arrayOfFriendClass.add("p_char.p_nonplayable::NPCFriendTest");
numOfStage = 1;
numOfFriend = 1;
maxBarricade = 2;
_local1 = 0;
while (_local1 < numOfStage) {
foreGround[("stageSign" + _local1)].alpha = 1;
_local1++;
};
numOfDoor = 0;
numOfTutorial = 5;
numOfSign = new NumOfSign();
numOfSign.numOfFloor = 3;
numOfSign.numOfWall = 4;
numOfSign.numOfLadder = 1;
numOfSign.numOfEnemySpawnPoint = 3;
numOfSign.numOfLantaiSign = 2;
numOfSign.numOfEnemies = 50;
numOfSign.numOfNPC = 0;
numOfSign.initialFloor = 0;
numOfSign.initialWall = 0;
numOfSign.initialLadder = 0;
numOfSign.initialEnemySpawnPoint = 0;
numOfSign.initialLantaiSign = 0;
numOfSign.initialEnemies = 0;
numOfSign.initialNPC = 0;
numOfSign.enemyCounter = 0;
arrayOfStage.add(numOfSign);
enemyNeedToBeKilled = (enemyNeedToBeKilled + numOfSign.numOfEnemies);
super();
enemySpawnerDelay = 1000;
}
override public function getTutorialContent(_arg1:int):String{
if (_arg1 == 0){
return ("set up your barricade before starting the day");
};
if (_arg1 == 1){
return ("click & drag barricades to move them around");
};
if (_arg1 == 2){
return ("press W, S or Up, Down arrow to climb up and down stairs");
};
if (_arg1 == 3){
return ("do not forget to buy ammo");
};
if (_arg1 == 4){
return ("when you ran out of ammo\npress '3' to use melee weapon");
};
return ("None");
}
override public function findNearestLadderDown(_arg1:Character, _arg2:int, _arg3:int):int{
var _local4:int;
if (_arg3 == 1){
_local4 = findNearestLadder(_arg1, 0, 1);
return (_local4);
};
return (-1);
}
override public function findLadderUp(_arg1:int, _arg2:int):int{
var _local3:int;
if (_arg2 == 0){
_local3 = ((Math.floor((Math.random() * 10)) + 1) % 1);
return (_local3);
};
return (-1);
}
override public function getFriendClass(_arg1:int):String{
if ((((_arg1 < numOfFriend)) && ((_arg1 < arrayOfFriendClass.size())))){
return (arrayOfFriendClass.get(_arg1));
};
return ("None");
}
override public function getLevelRandomItemNumber():Number{
var _local1:int;
_local1 = 0;
_local1 = ((Math.floor((Math.random() * 100)) + 10) % 10);
if (_local1 == 1){
return (0);
};
return (-1);
}
override public function findNearestLadderUp(_arg1:Character, _arg2:int, _arg3:int):int{
var _local4:int;
if (_arg3 == 0){
_local4 = findNearestLadder(_arg1, 0, 1);
return (_local4);
};
return (-1);
}
override public function getEnemyClass():String{
var _local1:int;
_local1 = 0;
_local1 = ((Math.floor((Math.random() * 10)) + 1) % arrayOfEnemyClass.size());
return (arrayOfEnemyClass.get(_local1));
}
override public function findLadderDown(_arg1:int, _arg2:int):int{
var _local3:int;
if (_arg2 == 1){
_local3 = ((Math.floor((Math.random() * 10)) + 1) % 1);
return (_local3);
};
return (-1);
}
}
}//package p_gamelevel
Section 229
//Level3 (p_gamelevel.Level3)
package p_gamelevel {
import p_char.*;
import p_singleton.*;
import org.idmedia.as3commons.util.*;
public class Level3 extends GameLevel {
public function Level3(){
var _local1:int;
enemyKilled = 0;
enemyNeedToBeKilled = 0;
middleGround = new middleGroundLevel3();
backGround = Ground(new backGroundLevel3());
foreGround = Ground(new foreGroundLevel3());
arrayOfStage = new ArrayList();
arrayOfEnemyClass = new ArrayList();
arrayOfEnemyClass.add("p_char.p_nonplayable::Zombie01");
arrayOfEnemyClass.add("p_char.p_nonplayable::Zombie02");
arrayOfEnemyClass.add("p_char.p_nonplayable::Zombie03");
arrayOfEnemyClass.add("p_char.p_nonplayable::Zombie04");
arrayOfEnemyClass.add("p_char.p_nonplayable::Zombie05");
if (World.getSingleton().waveCounter >= 4){
arrayOfEnemyClass.add("p_char.p_nonplayable::ZombieCrawler01");
};
if (World.getSingleton().waveCounter >= 8){
arrayOfEnemyClass.add("p_char.p_nonplayable::Zombie06");
arrayOfEnemyClass.add("p_char.p_nonplayable::Zombie07");
arrayOfEnemyClass.add("p_char.p_nonplayable::Zombie08");
arrayOfEnemyClass.add("p_char.p_nonplayable::Zombie09");
arrayOfEnemyClass.add("p_char.p_nonplayable::Zombie10");
};
arrayOfFriendClass = new ArrayList();
arrayOfFriendClass.add("p_char.p_nonplayable::NPCFriendTest");
numOfStage = 1;
numOfFriend = 1;
maxBarricade = 2;
_local1 = 0;
while (_local1 < numOfStage) {
foreGround[("stageSign" + _local1)].alpha = 1;
_local1++;
};
numOfDoor = 0;
numOfTutorial = 0;
numOfSign = new NumOfSign();
numOfSign.numOfFloor = 8;
numOfSign.numOfWall = 5;
numOfSign.numOfLadder = 5;
numOfSign.numOfEnemySpawnPoint = 6;
numOfSign.numOfLantaiSign = 4;
numOfSign.numOfEnemies = 50;
numOfSign.numOfNPC = 0;
numOfSign.initialFloor = 0;
numOfSign.initialWall = 0;
numOfSign.initialLadder = 0;
numOfSign.initialEnemySpawnPoint = 0;
numOfSign.initialLantaiSign = 0;
numOfSign.initialEnemies = 0;
numOfSign.initialNPC = 0;
numOfSign.enemyCounter = 0;
arrayOfStage.add(numOfSign);
enemyNeedToBeKilled = (enemyNeedToBeKilled + numOfSign.numOfEnemies);
super();
enemySpawnerDelay = 1000;
}
override public function getTutorialContent(_arg1:int):String{
if (_arg1 == 0){
return ("Open the door by pressing 'E' button");
};
if (_arg1 == 1){
return ("Move around by pressing \"W,A,S,D\" or arrow keys\n Aim and attack by using the mouse");
};
if (_arg1 == 2){
return ("Open up the inventory by using 'I' button\n You can drag and drop the weapon to change the equipped weapon");
};
if (_arg1 == 3){
return ("Press 'Q' to enter 'barricade builder' mode\n You can activate the box above you by clicking and dragging it\n Hint: use the box to slow down the enemies");
};
if (_arg1 == 4){
return (("Press '1' to change to primary weapon\nPress '2' to change to secondary weapon\n" + "Press '3' to change to melee weapon\nPress '4' to change to explosive weapon"));
};
return ("None");
}
override public function findNearestLadderDown(_arg1:Character, _arg2:int, _arg3:int):int{
var _local4:int;
if (_arg3 == 1){
_local4 = findNearestLadder(_arg1, 0, 1);
return (_local4);
};
if (_arg3 == 2){
_local4 = findNearestLadder(_arg1, 1, 2);
return (_local4);
};
if (_arg3 == 3){
_local4 = findNearestLadder(_arg1, 3, 2);
return (_local4);
};
return (-1);
}
override public function findLadderUp(_arg1:int, _arg2:int):int{
var _local3:int;
if (_arg2 == 0){
_local3 = ((Math.floor((Math.random() * 10)) + 1) % 1);
return (_local3);
};
if (_arg2 == 1){
_local3 = ((Math.floor((Math.random() * 10)) + 1) % 2);
return ((_local3 + 1));
};
if (_arg2 == 2){
_local3 = ((Math.floor((Math.random() * 10)) + 1) % 2);
return ((_local3 + 3));
};
return (-1);
}
override public function getFriendClass(_arg1:int):String{
if ((((_arg1 < numOfFriend)) && ((_arg1 < arrayOfFriendClass.size())))){
return (arrayOfFriendClass.get(_arg1));
};
return ("None");
}
override public function getLevelRandomItemNumber():Number{
var _local1:int;
_local1 = 0;
_local1 = ((Math.floor((Math.random() * 100)) + 10) % 10);
if (_local1 == 1){
return (0);
};
return (-1);
}
override public function findNearestLadderUp(_arg1:Character, _arg2:int, _arg3:int):int{
var _local4:int;
if (_arg3 == 0){
_local4 = findNearestLadder(_arg1, 0, 1);
return (_local4);
};
if (_arg3 == 1){
_local4 = findNearestLadder(_arg1, 1, 2);
return (_local4);
};
if (_arg3 == 2){
_local4 = findNearestLadder(_arg1, 3, 2);
return (_local4);
};
return (-1);
}
override public function getEnemyClass():String{
var _local1:int;
_local1 = 0;
_local1 = ((Math.floor((Math.random() * 10)) + 1) % arrayOfEnemyClass.size());
return (arrayOfEnemyClass.get(_local1));
}
override public function findLadderDown(_arg1:int, _arg2:int):int{
var _local3:int;
if (_arg2 == 1){
_local3 = ((Math.floor((Math.random() * 10)) + 1) % 1);
return (_local3);
};
if (_arg2 == 2){
_local3 = ((Math.floor((Math.random() * 10)) + 1) % 2);
return ((_local3 + 1));
};
if (_arg2 == 3){
_local3 = ((Math.floor((Math.random() * 10)) + 1) % 2);
return ((_local3 + 3));
};
return (-1);
}
}
}//package p_gamelevel
Section 230
//Level4 (p_gamelevel.Level4)
package p_gamelevel {
import p_char.*;
import p_singleton.*;
import org.idmedia.as3commons.util.*;
public class Level4 extends GameLevel {
public function Level4(){
var _local1:int;
enemyKilled = 0;
enemyNeedToBeKilled = 0;
middleGround = new middleGroundLevel4();
backGround = Ground(new backGroundLevel4());
foreGround = Ground(new foreGroundLevel4());
arrayOfStage = new ArrayList();
arrayOfEnemyClass = new ArrayList();
arrayOfEnemyClass.add("p_char.p_nonplayable::Zombie01");
arrayOfEnemyClass.add("p_char.p_nonplayable::Zombie02");
arrayOfEnemyClass.add("p_char.p_nonplayable::Zombie03");
arrayOfEnemyClass.add("p_char.p_nonplayable::Zombie04");
arrayOfEnemyClass.add("p_char.p_nonplayable::Zombie05");
if (World.getSingleton().waveCounter >= 4){
arrayOfEnemyClass.add("p_char.p_nonplayable::ZombieCrawler01");
};
if (World.getSingleton().waveCounter >= 8){
arrayOfEnemyClass.add("p_char.p_nonplayable::Zombie06");
arrayOfEnemyClass.add("p_char.p_nonplayable::Zombie07");
arrayOfEnemyClass.add("p_char.p_nonplayable::Zombie08");
arrayOfEnemyClass.add("p_char.p_nonplayable::Zombie09");
arrayOfEnemyClass.add("p_char.p_nonplayable::Zombie10");
};
arrayOfFriendClass = new ArrayList();
arrayOfFriendClass.add("p_char.p_nonplayable::NPCFriendTest");
numOfStage = 1;
numOfFriend = 1;
maxBarricade = 2;
_local1 = 0;
while (_local1 < numOfStage) {
foreGround[("stageSign" + _local1)].alpha = 1;
_local1++;
};
numOfDoor = 0;
numOfTutorial = 0;
numOfSign = new NumOfSign();
numOfSign.numOfFloor = 6;
numOfSign.numOfWall = 6;
numOfSign.numOfLadder = 3;
numOfSign.numOfEnemySpawnPoint = 5;
numOfSign.numOfLantaiSign = 3;
numOfSign.numOfEnemies = 50;
numOfSign.numOfNPC = 0;
numOfSign.initialFloor = 0;
numOfSign.initialWall = 0;
numOfSign.initialLadder = 0;
numOfSign.initialEnemySpawnPoint = 0;
numOfSign.initialLantaiSign = 0;
numOfSign.initialEnemies = 0;
numOfSign.initialNPC = 0;
numOfSign.enemyCounter = 0;
arrayOfStage.add(numOfSign);
enemyNeedToBeKilled = (enemyNeedToBeKilled + numOfSign.numOfEnemies);
super();
enemySpawnerDelay = 1000;
}
override public function getTutorialContent(_arg1:int):String{
if (_arg1 == 0){
return ("Open the door by pressing 'E' button");
};
if (_arg1 == 1){
return ("Move around by pressing \"W,A,S,D\" or arrow keys\n Aim and attack by using the mouse");
};
if (_arg1 == 2){
return ("Open up the inventory by using 'I' button\n You can drag and drop the weapon to change the equipped weapon");
};
if (_arg1 == 3){
return ("Press 'Q' to enter 'barricade builder' mode\n You can activate the box above you by clicking and dragging it\n Hint: use the box to slow down the enemies");
};
if (_arg1 == 4){
return (("Press '1' to change to primary weapon\nPress '2' to change to secondary weapon\n" + "Press '3' to change to melee weapon\nPress '4' to change to explosive weapon"));
};
return ("None");
}
override public function findNearestLadderDown(_arg1:Character, _arg2:int, _arg3:int):int{
var _local4:int;
if (_arg3 == 1){
_local4 = findNearestLadder(_arg1, 0, 1);
return (_local4);
};
if (_arg3 == 2){
_local4 = findNearestLadder(_arg1, 1, 2);
return (_local4);
};
return (-1);
}
override public function findLadderUp(_arg1:int, _arg2:int):int{
var _local3:int;
if (_arg2 == 0){
_local3 = ((Math.floor((Math.random() * 10)) + 1) % 1);
return (_local3);
};
if (_arg2 == 1){
_local3 = ((Math.floor((Math.random() * 10)) + 1) % 2);
return ((_local3 + 1));
};
return (-1);
}
override public function getFriendClass(_arg1:int):String{
if ((((_arg1 < numOfFriend)) && ((_arg1 < arrayOfFriendClass.size())))){
return (arrayOfFriendClass.get(_arg1));
};
return ("None");
}
override public function getLevelRandomItemNumber():Number{
var _local1:int;
_local1 = 0;
_local1 = ((Math.floor((Math.random() * 100)) + 10) % 10);
if (_local1 == 1){
return (0);
};
return (-1);
}
override public function findNearestLadderUp(_arg1:Character, _arg2:int, _arg3:int):int{
var _local4:int;
if (_arg3 == 0){
_local4 = findNearestLadder(_arg1, 0, 1);
return (_local4);
};
if (_arg3 == 1){
_local4 = findNearestLadder(_arg1, 1, 2);
return (_local4);
};
return (-1);
}
override public function getEnemyClass():String{
var _local1:int;
_local1 = 0;
_local1 = ((Math.floor((Math.random() * 10)) + 1) % arrayOfEnemyClass.size());
return (arrayOfEnemyClass.get(_local1));
}
override public function findLadderDown(_arg1:int, _arg2:int):int{
var _local3:int;
if (_arg2 == 1){
_local3 = ((Math.floor((Math.random() * 10)) + 1) % 1);
return (_local3);
};
if (_arg2 == 2){
_local3 = ((Math.floor((Math.random() * 10)) + 1) % 2);
return ((_local3 + 1));
};
return (-1);
}
}
}//package p_gamelevel
Section 231
//Level5 (p_gamelevel.Level5)
package p_gamelevel {
import p_char.*;
import p_singleton.*;
import org.idmedia.as3commons.util.*;
public class Level5 extends GameLevel {
public function Level5(){
var _local1:int;
enemyKilled = 0;
enemyNeedToBeKilled = 0;
middleGround = new middleGroundLevel5();
backGround = Ground(new backGroundLevel5());
foreGround = Ground(new foreGroundLevel5());
arrayOfStage = new ArrayList();
arrayOfEnemyClass = new ArrayList();
arrayOfEnemyClass.add("p_char.p_nonplayable::Zombie01");
arrayOfEnemyClass.add("p_char.p_nonplayable::Zombie02");
arrayOfEnemyClass.add("p_char.p_nonplayable::Zombie03");
arrayOfEnemyClass.add("p_char.p_nonplayable::Zombie04");
arrayOfEnemyClass.add("p_char.p_nonplayable::Zombie05");
if (World.getSingleton().waveCounter >= 4){
arrayOfEnemyClass.add("p_char.p_nonplayable::ZombieCrawler01");
};
if (World.getSingleton().waveCounter >= 8){
arrayOfEnemyClass.add("p_char.p_nonplayable::Zombie06");
arrayOfEnemyClass.add("p_char.p_nonplayable::Zombie07");
arrayOfEnemyClass.add("p_char.p_nonplayable::Zombie08");
arrayOfEnemyClass.add("p_char.p_nonplayable::Zombie09");
arrayOfEnemyClass.add("p_char.p_nonplayable::Zombie10");
};
arrayOfFriendClass = new ArrayList();
arrayOfFriendClass.add("p_char.p_nonplayable::NPCFriendTest");
numOfStage = 1;
numOfFriend = 1;
maxBarricade = 2;
_local1 = 0;
while (_local1 < numOfStage) {
foreGround[("stageSign" + _local1)].alpha = 1;
_local1++;
};
numOfDoor = 0;
numOfTutorial = 0;
numOfSign = new NumOfSign();
numOfSign.numOfFloor = 5;
numOfSign.numOfWall = 6;
numOfSign.numOfLadder = 3;
numOfSign.numOfEnemySpawnPoint = 5;
numOfSign.numOfLantaiSign = 3;
numOfSign.numOfEnemies = 50;
numOfSign.numOfNPC = 0;
numOfSign.initialFloor = 0;
numOfSign.initialWall = 0;
numOfSign.initialLadder = 0;
numOfSign.initialEnemySpawnPoint = 0;
numOfSign.initialLantaiSign = 0;
numOfSign.initialEnemies = 0;
numOfSign.initialNPC = 0;
numOfSign.enemyCounter = 0;
arrayOfStage.add(numOfSign);
enemyNeedToBeKilled = (enemyNeedToBeKilled + numOfSign.numOfEnemies);
super();
enemySpawnerDelay = 1000;
}
override public function getTutorialContent(_arg1:int):String{
if (_arg1 == 0){
return ("Open the door by pressing 'E' button");
};
if (_arg1 == 1){
return ("Move around by pressing \"W,A,S,D\" or arrow keys\n Aim and attack by using the mouse");
};
if (_arg1 == 2){
return ("Open up the inventory by using 'I' button\n You can drag and drop the weapon to change the equipped weapon");
};
if (_arg1 == 3){
return ("Press 'Q' to enter 'barricade builder' mode\n You can activate the box above you by clicking and dragging it\n Hint: use the box to slow down the enemies");
};
if (_arg1 == 4){
return (("Press '1' to change to primary weapon\nPress '2' to change to secondary weapon\n" + "Press '3' to change to melee weapon\nPress '4' to change to explosive weapon"));
};
return ("None");
}
override public function findNearestLadderDown(_arg1:Character, _arg2:int, _arg3:int):int{
var _local4:int;
if (_arg3 == 1){
_local4 = findNearestLadder(_arg1, 0, 2);
return (_local4);
};
if (_arg3 == 2){
_local4 = findNearestLadder(_arg1, 2, 1);
return (_local4);
};
return (-1);
}
override public function findLadderUp(_arg1:int, _arg2:int):int{
var _local3:int;
if (_arg2 == 0){
_local3 = ((Math.floor((Math.random() * 10)) + 1) % 2);
return (_local3);
};
if (_arg2 == 1){
_local3 = ((Math.floor((Math.random() * 10)) + 1) % 1);
return ((_local3 + 2));
};
return (-1);
}
override public function getFriendClass(_arg1:int):String{
if ((((_arg1 < numOfFriend)) && ((_arg1 < arrayOfFriendClass.size())))){
return (arrayOfFriendClass.get(_arg1));
};
return ("None");
}
override public function getLevelRandomItemNumber():Number{
var _local1:int;
_local1 = 0;
_local1 = ((Math.floor((Math.random() * 100)) + 10) % 10);
if (_local1 == 1){
return (0);
};
return (-1);
}
override public function findNearestLadderUp(_arg1:Character, _arg2:int, _arg3:int):int{
var _local4:int;
if (_arg3 == 0){
_local4 = findNearestLadder(_arg1, 0, 2);
return (_local4);
};
if (_arg3 == 1){
_local4 = findNearestLadder(_arg1, 2, 1);
return (_local4);
};
return (-1);
}
override public function getEnemyClass():String{
var _local1:int;
_local1 = 0;
_local1 = ((Math.floor((Math.random() * 10)) + 1) % arrayOfEnemyClass.size());
return (arrayOfEnemyClass.get(_local1));
}
override public function findLadderDown(_arg1:int, _arg2:int):int{
var _local3:int;
if (_arg2 == 1){
_local3 = ((Math.floor((Math.random() * 10)) + 1) % 2);
return (_local3);
};
if (_arg2 == 2){
_local3 = ((Math.floor((Math.random() * 10)) + 1) % 1);
return ((_local3 + 2));
};
return (-1);
}
}
}//package p_gamelevel
Section 232
//NumOfSign (p_gamelevel.NumOfSign)
package p_gamelevel {
public class NumOfSign {
public var numOfEnemySpawnPoint:int;
public var initialEnemies:int;
public var initialLadder:int;
public var enemyCounter:int;
public var numOfFloor:int;
public var initialEnemySpawnPoint:int;
public var numOfLantaiSign:int;
public var numOfNPC:int;
public var numOfWall:int;
public var initialFloor:int;
public var numOfEnemies:int;
public var initialLantaiSign:int;
public var initialWall:int;
public var initialNPC:int;
public var numOfLadder:int;
}
}//package p_gamelevel
Section 233
//PlayerLimit (p_gamelevel.PlayerLimit)
package p_gamelevel {
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import p_char.*;
import p_singleton.*;
import flash.display.*;
public class PlayerLimit extends MovieClip {
public var friction:Number;
public var bodyDef:b2BodyDef;
public var restitution:Number;
public var polygonDef:b2PolygonDef;
public var body:b2Body;
public var density:Number;
public function PlayerLimit(){
density = 0;
friction = 0;
restitution = 0;
initRigidBody();
}
public function initRigidBody():void{
var _local1:b2World;
var _local2:Number;
_local1 = World.getSingleton().physicWorld;
if (_local1){
_local2 = rotation;
rotation = 0;
polygonDef = new b2PolygonDef();
polygonDef.SetAsBox((width / (2 * 30)), (height / (2 * 30)));
polygonDef.density = density;
polygonDef.friction = friction;
polygonDef.restitution = restitution;
polygonDef.filter.groupIndex = BodyType.PLAYERLIMIT;
rotation = _local2;
bodyDef = new b2BodyDef();
bodyDef.userData = this;
bodyDef.position.Set((x / World.physScale), (y / World.physScale));
bodyDef.angle = b2Math.degreesToRadians(rotation);
body = _local1.CreateBody(bodyDef);
body.CreateShape(polygonDef);
body.SetMassFromShapes();
body.type = BodyType.PLAYERLIMIT;
};
}
}
}//package p_gamelevel
Section 234
//BarricadeState (p_gameManager.BarricadeState)
package p_gameManager {
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.Joints.*;
import Box2D.Dynamics.*;
import flash.events.*;
import p_char.*;
import p_singleton.*;
import flash.display.*;
import p_char.p_playable.*;
import p_char.p_nonplayable.*;
import p_levelManager.*;
import flash.media.*;
import p_menuBar.*;
import p_crosshair.*;
import p_util.*;
import input.*;
import p_barricade.*;
import flash.ui.*;
public class BarricadeState extends GameManager {
public var bottomMenu:MenuBar;
public var crossHair:Crosshair;
public var barricadeShop:BarricadeShop;
public var handCrossHair:HandCrosshair;
public var backToMainMenu:Boolean;
public var weaponInventory:WeaponInventory;
public var keyPoll:KeyPoll;
public var talkCrosshair:TalkCrosshair;
public var player:PlayableCharacter;
public var mouseJoint:b2MouseJoint;
public var npcFriend:NPCFriend;
public var escPressed:Boolean;
public var inventoryMode:Boolean;
public var buldozerSound:Sound;
public var iPressed:Boolean;
public var buldozerMode:Boolean;// = false
public var mousePressed:Boolean;
public var buldozerHair:BuldozerPointer;
public function BarricadeState(_arg1:MovieClip){
buldozerMode = false;
iPressed = false;
escPressed = false;
inventoryMode = false;
backToMainMenu = false;
super(_arg1);
World.getSingleton().waveTime = World.getSingleton().waveTimeEach;
World.getSingleton().setFocusToStage();
init();
buldozerSound = new SellSound();
}
public function setBackToMainMenu2(_arg1:MouseEvent):void{
weaponInventory.destroy();
handCrossHair.destroy();
talkCrosshair.destroy();
buldozerHair.destroy();
Mouse.show();
World.getSingleton().removeEventListener(WorldEvent.ON_INIT, onInit);
World.getSingleton().removeEventListener(WorldEvent.ON_UPDATE, onUpdate);
this.stage.removeEventListener(MouseEvent.MOUSE_DOWN, onMouseDown);
this.stage.removeEventListener(MouseEvent.MOUSE_UP, onMouseUp);
this.stage.removeEventListener(MouseEvent.MOUSE_WHEEL, onMouseWheel);
World.getSingleton().menuBar.image.infoBox.visible = false;
barricadeShop.image.buldozerButton.removeEventListener(MouseEvent.CLICK, modeBuldozer);
barricadeShop.image.visible = true;
World.getSingleton().menuBar.image.optionScreen.visible = false;
World.getSingleton().menuBar.image.optionScreen.backToMainMenuButton.removeEventListener(MouseEvent.CLICK, setBackToMainMenu2);
World.getSingleton().menuBar.image.optionScreen.closeBtn.removeEventListener(MouseEvent.CLICK, closeOptionScreen);
World.getSingleton().menuBar.image.optionScreen.lowButton.removeEventListener(MouseEvent.CLICK, setLowQuality);
World.getSingleton().menuBar.image.optionScreen.mediumButton.removeEventListener(MouseEvent.CLICK, setMediumQuality);
World.getSingleton().menuBar.image.optionScreen.highButton.removeEventListener(MouseEvent.CLICK, setHighQuality);
if (World.getSingleton().playedCharacter){
if (World.getSingleton().playedCharacter.body){
World.getSingleton().physicWorld.DestroyBody(World.getSingleton().playedCharacter.body);
World.getSingleton().playedCharacter.body = null;
};
World.getSingleton().players.remove(World.getSingleton().playedCharacter);
World.getSingleton().playedCharacter = null;
};
setBackToMainMenu(_arg1);
}
public function initPlayer():void{
if (World.getSingleton().playedCharacter == null){
player = new FemaleChar();
player.initRigidBody();
World.getSingleton().players.add(player);
player.changeWeapon(player.primaryWeapon);
player.currentWeaponNumber = 1;
World.getSingleton().playedCharacter = player;
} else {
player = PlayableCharacter(World.getSingleton().playedCharacter);
if (!player.body){
player.initRigidBody();
};
if (!World.getSingleton().players.contains(player)){
World.getSingleton().players.add(player);
};
};
World.getSingleton().level.playerGround.addChild(player.image);
if (World.getSingleton().waveNum == 0){
player.position.x = (MovieClip(World.getSingleton().level.middleGround).spawnPoint.x + World.getSingleton().level.middleGround.x);
player.position.y = (MovieClip(World.getSingleton().level.middleGround).spawnPoint.y + World.getSingleton().level.middleGround.y);
player.body.SetXForm(new b2Vec2((player.position.x / World.physScale), (player.position.y / World.physScale)), 0);
};
weaponInventory = new WeaponInventory(player);
weaponInventory.image.visible = false;
player.setIdle();
player.health = player.maxHealth;
}
public function modeBuldozer(_arg1:MouseEvent):void{
if (buldozerMode){
buldozerMode = false;
World.getSingleton().mousePointer = handCrossHair;
handCrossHair.image.visible = true;
buldozerHair.image.visible = false;
barricadeShop.image.buldozerButton.gotoAndStop(1);
} else {
buldozerMode = true;
World.getSingleton().mousePointer = buldozerHair;
handCrossHair.image.visible = false;
buldozerHair.image.visible = true;
barricadeShop.image.buldozerButton.gotoAndStop(2);
};
}
public function initEventListener():void{
keyPoll = new KeyPoll(this.stage);
this.stage.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown, false, 0, true);
this.stage.addEventListener(MouseEvent.MOUSE_UP, onMouseUp, false, 0, true);
this.stage.addEventListener(MouseEvent.MOUSE_WHEEL, onMouseWheel, false, 0, true);
}
public function checkShopFinish():Boolean{
if (barricadeShop){
if (barricadeShop.finish){
barricadeShop.finish = false;
barricadeShop.destroy();
return (true);
};
return (false);
//unresolved jump
};
return (false);
}
public function initLevel():void{
var _local1:int;
_local1 = World.getSingleton().currentLevelNumber;
World.getSingleton().changeLevel(LevelManager.getSingleton().getLevel(_local1));
}
public function destroyEverything(_arg1:Boolean=true, _arg2=true):void{
var _local3:int;
var _local4:int;
_local3 = 0;
_local4 = 0;
_local4 = World.getSingleton().enemies.size();
_local3 = (_local4 - 1);
while (_local3 >= 0) {
World.getSingleton().enemies.get(_local3).health = 0;
World.getSingleton().enemies.get(_local3).deathTime = 0;
World.getSingleton().enemies.get(_local3).update();
_local3--;
};
if (_arg1){
_local4 = World.getSingleton().npcs.size();
_local3 = (_local4 - 1);
while (_local3 >= 0) {
World.getSingleton().npcs.get(_local3).health = 0;
World.getSingleton().npcs.get(_local3).deathTime = 0;
World.getSingleton().npcs.get(_local3).update();
_local3--;
};
};
if (_arg2){
_local4 = World.getSingleton().barricades.size();
_local3 = (_local4 - 1);
while (_local3 >= 0) {
World.getSingleton().barricades.get(_local3).health = 0;
World.getSingleton().barricades.get(_local3).deathTime = 0;
World.getSingleton().barricades.get(_local3).update();
_local3--;
};
};
_local4 = World.getSingleton().itemPickUps.size();
_local3 = (_local4 - 1);
while (_local3 >= 0) {
World.getSingleton().itemPickUps.get(_local3).destroy();
_local3--;
};
if (keyPoll){
keyPoll.destroy();
};
}
public function setMediumQuality(_arg1:MouseEvent):void{
movieClip.stage.quality = StageQuality.MEDIUM;
}
public function crossHairNpcCollision():void{
var _local1:int;
var _local2:int;
var _local3:NPCFriend;
if (World.getSingleton().mousePointer){
_local1 = World.getSingleton().npcs.size();
_local2 = (_local1 - 1);
while (_local2 >= 0) {
_local3 = World.getSingleton().npcs.get(_local2);
if (PixelCollision.isColliding(_local3.image.head, handCrossHair.image, World.getSingleton().sceneRoot.stage)){
if (((!(talkCrosshair.clicked)) && (!(inventoryMode)))){
talkCrosshair.npc = _local3;
handCrossHair.image.visible = false;
talkCrosshair.image.visible = true;
World.getSingleton().mousePointer = talkCrosshair;
Mouse.hide();
};
break;
} else {
if (!talkCrosshair.clicked){
handCrossHair.image.visible = true;
talkCrosshair.image.visible = false;
World.getSingleton().mousePointer = handCrossHair;
Mouse.hide();
};
};
_local2--;
};
};
}
public function onEnterFrame(_arg1:Event):void{
checkInput();
}
override public function update():GameManager{
if (checkShopFinish()){
setBarricadesToHeavy();
destroy();
detachFromRoot();
return (new InGameState(movieClip));
};
if (backToMainMenu){
World.getSingleton().gameStarted = false;
World.getSingleton().gameEnded = false;
Mouse.show();
detachFromRoot();
if (World.getSingleton().backGroundSoundChannel){
World.getSingleton().backGroundSoundChannel.stop();
};
return (new MainMenuState(movieClip));
} else {
crossHairNpcCollision();
};
return (!NULL!);
}
public function initBarricades():void{
var _local1:int;
var _local2:int;
var _local3:b2Body;
var _local4:b2Shape;
_local1 = 0;
_local2 = World.getSingleton().barricades.size();
while (_local1 < _local2) {
if (World.getSingleton().barricades.get(_local1).body){
_local3 = World.getSingleton().barricades.get(_local1).body;
_local4 = _local3.m_shapeList;
while (_local4) {
_local4.m_density = 1;
_local4.m_filter.groupIndex = BodyType.PLAYER;
_local4 = _local4.m_next;
};
_local3.SetMassFromShapes();
};
if (World.getSingleton().level){
World.getSingleton().level.backGround.addChild(World.getSingleton().barricades.get(_local1));
};
_local1++;
};
}
public function showOptionScreen():void{
World.getSingleton().menuBar.image.optionScreen.visible = true;
World.getSingleton().menuBar.image.optionScreen.backToMainMenuButton.addEventListener(MouseEvent.CLICK, setBackToMainMenu2);
World.getSingleton().menuBar.image.optionScreen.closeBtn.addEventListener(MouseEvent.CLICK, closeOptionScreen);
World.getSingleton().menuBar.image.optionScreen.lowButton.addEventListener(MouseEvent.CLICK, setLowQuality);
World.getSingleton().menuBar.image.optionScreen.mediumButton.addEventListener(MouseEvent.CLICK, setMediumQuality);
World.getSingleton().menuBar.image.optionScreen.highButton.addEventListener(MouseEvent.CLICK, setHighQuality);
barricadeShop.image.visible = false;
World.getSingleton().pauseGame();
if (World.getSingleton().muted){
World.getSingleton().menuBar.image.optionScreen.soundButton.gotoAndStop(1);
} else {
World.getSingleton().menuBar.image.optionScreen.soundButton.gotoAndStop(2);
};
World.getSingleton().menuBar.image.optionScreen.soundButton.addEventListener(MouseEvent.CLICK, soundMute);
onPause();
talkCrosshair.removeClickListener();
talkCrosshair.addListener();
talkCrosshair.clicked = false;
}
public function onResume():void{
this.removeEventListener(Event.ENTER_FRAME, onEnterFrame);
}
public function onMouseWheel(_arg1:MouseEvent):void{
var _local2:PlayableCharacter;
if (World.getSingleton().playedCharacter){
_local2 = PlayableCharacter(World.getSingleton().playedCharacter);
if (_arg1.delta > 0){
player.currentWeaponNumber++;
if (player.currentWeaponNumber > 4){
player.currentWeaponNumber = 1;
};
} else {
if (_arg1.delta < 0){
player.currentWeaponNumber--;
if (player.currentWeaponNumber < 1){
player.currentWeaponNumber = 4;
};
};
};
if (player.currentWeaponNumber == 1){
if (player.primaryWeapon){
player.changeWeapon(player.primaryWeapon);
} else {
onMouseWheel(_arg1);
};
} else {
if (player.currentWeaponNumber == 2){
if (player.secondaryWeapon){
player.changeWeapon(player.secondaryWeapon);
} else {
onMouseWheel(_arg1);
};
} else {
if (player.currentWeaponNumber == 3){
if (player.meleeWeapon){
player.changeWeapon(player.meleeWeapon);
} else {
onMouseWheel(_arg1);
};
} else {
if (player.currentWeaponNumber == 4){
if (player.explosiveWeapon){
player.changeWeapon(player.explosiveWeapon);
} else {
onMouseWheel(_arg1);
};
};
};
};
};
};
}
public function initMenuBar():void{
if (!World.getSingleton().menuBar){
bottomMenu = new MenuBar();
World.getSingleton().menuBar = bottomMenu;
};
World.getSingleton().menuBar.image.resultScreen.visible = false;
World.getSingleton().menuBar.image.optionScreen.visible = false;
World.getSingleton().menuBar.image.infoBox.visible = true;
}
public function setLowQuality(_arg1:MouseEvent):void{
movieClip.stage.quality = StageQuality.LOW;
}
public function init():void{
World.getSingleton().addEventListener(WorldEvent.ON_INIT, onInit);
World.getSingleton().addEventListener(WorldEvent.ON_UPDATE, onUpdate);
World.getSingleton().initWorld();
}
public function initCrossHair():void{
Mouse.hide();
talkCrosshair = new TalkCrosshair();
talkCrosshair.image.visible = false;
buldozerHair = new BuldozerPointer();
buldozerHair.image.visible = false;
handCrossHair = new HandCrosshair();
}
private function talkToNpc():Boolean{
if (World.getSingleton().mousePointer){
if (World.getSingleton().mousePointer.type == MousePointerType.TALK){
if (!talkCrosshair.clicked){
handCrossHair.image.visible = true;
talkCrosshair.clicked = true;
talkCrosshair.removeListener();
talkCrosshair.addClickListener();
return (true);
};
};
};
return (false);
}
public function saveGame():void{
var _local1:int;
var _local2:int;
var _local3:NPCFriend;
if (World.getSingleton().playedCharacter){
World.getSingleton().savedPlayer = PlayableCharacter(World.getSingleton().playedCharacter);
World.getSingleton().savedMoney = World.getSingleton().money;
World.getSingleton().savedNpcs.clear();
_local1 = 0;
_local2 = World.getSingleton().npcs.size();
while (_local1 < _local2) {
_local3 = World.getSingleton().npcs.get(_local1);
World.getSingleton().savedNpcs.add(_local3);
_local1++;
};
_local1 = 0;
_local2 = World.getSingleton().savedPlayer.ammoInventory.size();
while (_local1 < _local2) {
World.getSingleton().savedAmmoInventory.get(_local1).amount = World.getSingleton().savedPlayer.ammoInventory.get(_local1).amount;
_local1++;
};
};
}
public function setHighQuality(_arg1:MouseEvent):void{
movieClip.stage.quality = StageQuality.HIGH;
}
public function onMouseUp(_arg1:MouseEvent):void{
mousePressed = false;
}
public function initBarricadeShop():void{
if (!World.getSingleton().barricadeShop){
barricadeShop = new BarricadeShop();
barricadeShop.addImageToMenuRoot();
barricadeShop.addListener();
World.getSingleton().barricadeShop = barricadeShop;
} else {
barricadeShop = World.getSingleton().barricadeShop;
barricadeShop.finish = false;
barricadeShop.addImageToMenuRoot();
barricadeShop.addListener();
};
barricadeShop.refresh();
barricadeShop.image.buldozerButton.addEventListener(MouseEvent.CLICK, modeBuldozer);
}
public function onPause():void{
this.addEventListener(Event.ENTER_FRAME, onEnterFrame);
}
public function closeOptionScreen(_arg1:MouseEvent=null):void{
barricadeShop.image.visible = true;
World.getSingleton().menuBar.image.optionScreen.visible = false;
World.getSingleton().menuBar.image.optionScreen.backToMainMenuButton.removeEventListener(MouseEvent.CLICK, setBackToMainMenu2);
World.getSingleton().menuBar.image.optionScreen.closeBtn.removeEventListener(MouseEvent.CLICK, closeOptionScreen);
World.getSingleton().menuBar.image.optionScreen.lowButton.removeEventListener(MouseEvent.CLICK, setLowQuality);
World.getSingleton().menuBar.image.optionScreen.mediumButton.removeEventListener(MouseEvent.CLICK, setMediumQuality);
World.getSingleton().menuBar.image.optionScreen.highButton.removeEventListener(MouseEvent.CLICK, setHighQuality);
World.getSingleton().menuBar.image.optionScreen.soundButton.removeEventListener(MouseEvent.CLICK, soundMute);
World.getSingleton().startGame();
onResume();
}
public function onUpdate(_arg1:Event):void{
Updater.getSingleton().preUpdate();
CollisionDetector.getSingleton().update();
Updater.getSingleton().update();
checkInput();
pickUpThing();
}
public function closeWeaponInventory(_arg1:MouseEvent=null):void{
iPressed = true;
weaponInventory.stopDrag2();
weaponInventory.image.visible = false;
inventoryMode = false;
World.getSingleton().startGame();
onResume();
weaponInventory.image.close.removeEventListener(MouseEvent.CLICK, closeWeaponInventory);
}
public function setBackToMainMenu(_arg1:MouseEvent):void{
World.getSingleton().menuBar.image.infoBox.visible = true;
World.getSingleton().score = 0;
World.getSingleton().money = World.getSingleton().startMoney;
World.getSingleton().waveLevel = 0;
World.getSingleton().waveNum = 0;
World.getSingleton().waveCounter = 0;
World.getSingleton().levelDone = 0;
World.getSingleton().kills = 0;
destroyEverything(true, true);
backToMainMenu = true;
World.getSingleton().pauseGame();
}
public function onInit(_arg1:Event):void{
mousePressed = false;
initMenuBar();
initLevel();
initBarricadeShop();
initPlayer();
initNPCFriend();
initBarricades();
initCrossHair();
initEventListener();
World.getSingleton().startGame();
World.getSingleton().setDebugMode(false);
if ((((World.getSingleton().waveNum == 0)) && ((World.getSingleton().waveLevel == 0)))){
} else {
showWeaponInventory();
};
saveGame();
}
public function checkInput():void{
if (((keyPoll.isDown(Keyboard.SHIFT)) && (((keyPoll.isDown(Keyboard.LEFT)) || (keyPoll.isDown(65)))))){
player.runLeft();
if (player.faceState == FaceState.FACE_RIGHT){
player.turnFace();
};
} else {
if (((keyPoll.isDown(Keyboard.LEFT)) || (keyPoll.isDown(65)))){
player.walkLeft();
if (player.faceState == FaceState.FACE_RIGHT){
player.turnFace();
};
};
};
if (((keyPoll.isDown(Keyboard.SHIFT)) && (((keyPoll.isDown(Keyboard.RIGHT)) || (keyPoll.isDown(68)))))){
player.runRight();
if (player.faceState == FaceState.FACE_LEFT){
player.turnFace();
};
} else {
if (((keyPoll.isDown(Keyboard.RIGHT)) || (keyPoll.isDown(68)))){
player.walkRight();
if (player.faceState == FaceState.FACE_LEFT){
player.turnFace();
};
};
};
if (((keyPoll.isDown(Keyboard.UP)) || (keyPoll.isDown(87)))){
player.moveUp();
};
if (((keyPoll.isDown(Keyboard.DOWN)) || (keyPoll.isDown(83)))){
player.moveDown();
};
if (((((((((((keyPoll.isUp(Keyboard.DOWN)) && (keyPoll.isUp(83)))) && (((keyPoll.isUp(Keyboard.UP)) && (keyPoll.isUp(87)))))) && (((keyPoll.isUp(Keyboard.RIGHT)) && (keyPoll.isUp(68)))))) && (((keyPoll.isUp(Keyboard.LEFT)) && (keyPoll.isUp(65)))))) && (keyPoll.isUp(Keyboard.SPACE)))){
player.setIdle();
};
if (keyPoll.isDown(82)){
player.reload();
};
if (keyPoll.isDown(49)){
if (player.primaryWeapon){
player.changeWeapon(player.primaryWeapon);
player.currentWeaponNumber = 1;
};
};
if (keyPoll.isDown(50)){
if (player.secondaryWeapon){
player.changeWeapon(player.secondaryWeapon);
player.currentWeaponNumber = 2;
};
};
if (keyPoll.isDown(51)){
if (player.meleeWeapon){
player.changeWeapon(player.meleeWeapon);
};
};
if (keyPoll.isDown(52)){
if (player.explosiveWeapon){
player.changeWeapon(player.explosiveWeapon);
player.currentWeaponNumber = 3;
};
};
if (keyPoll.isDown(73)){
if (((!(iPressed)) && (!(weaponInventory.image.visible)))){
showWeaponInventory();
} else {
if (!iPressed){
closeWeaponInventory();
};
};
};
if (keyPoll.isUp(73)){
if (iPressed){
iPressed = false;
};
};
if (keyPoll.isDown(Keyboard.ESCAPE)){
if (((!(escPressed)) && (!(World.getSingleton().menuBar.image.optionScreen.visible)))){
escPressed = true;
showOptionScreen();
} else {
if (!escPressed){
closeOptionScreen();
escPressed = true;
};
};
};
if (keyPoll.isUp(Keyboard.ESCAPE)){
if (escPressed){
escPressed = false;
};
};
if (keyPoll.isDown(Keyboard.SPACE)){
if (World.getSingleton().playedCharacter){
World.getSingleton().playedCharacter.jump();
};
};
}
public function initNPCFriend():void{
var _local1:int;
var _local2:int;
_local1 = 0;
_local2 = World.getSingleton().npcs.size();
while (_local1 < _local2) {
npcFriend = World.getSingleton().npcs.get(_local1);
if (!npcFriend.body){
npcFriend.initRigidBody();
};
npcFriend.changeWeapon(npcFriend.currentWeapon);
World.getSingleton().level.enemyGround.addChild(npcFriend.image);
npcFriend.position.x = World.getSingleton().playedCharacter.position.x;
npcFriend.position.y = World.getSingleton().playedCharacter.position.y;
npcFriend.position.x = (npcFriend.position.x - (100 * (_local1 + 1)));
npcFriend.body.SetXForm(new b2Vec2((npcFriend.position.x / World.physScale), (npcFriend.position.y / World.physScale)), 0);
if (World.getSingleton().playedCharacter){
npcFriend.charToFollow = World.getSingleton().playedCharacter;
};
npcFriend.image.head.head.hired.visible = false;
npcFriend.setIdle();
npcFriend.salaryPaid = false;
npcFriend.follow = true;
npcFriend.reset();
npcFriend.setIdle();
npcFriend.bodyPartsGotoAndPlay("idle");
npcFriend.image.leg.gotoAndStop("idle");
npcFriend.image.head.alpha = 1;
npcFriend.image.head.visible = true;
npcFriend.initTimer();
npcFriend.image.weaponHolderb.alpha = 1;
npcFriend.image.weaponHolderf.alpha = 1;
npcFriend.image.weaponHolderb.rotation = 0;
npcFriend.image.weaponHolderf.rotation = 0;
npcFriend.health = npcFriend.maxHealth;
_local1++;
};
}
public function pickUpThing():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:b2Body;
var _local8:Barricade;
var _local9:int;
var _local10:int;
var _local11:b2MouseJointDef;
var _local12:b2Joint;
var _local13:b2Vec2;
if (player){
_local1 = World.getSingleton().mousePointer.image.x;
_local2 = World.getSingleton().mousePointer.image.y;
_local3 = ((_local1 - player.screenPosition.x) + player.position.x);
_local4 = ((_local2 - player.screenPosition.y) + player.position.y);
_local5 = (_local3 / World.physScale);
_local6 = (_local4 / World.physScale);
if (((mousePressed) && (!(mouseJoint)))){
_local7 = World.getSingleton().GetBodyAt(_local5, _local6);
if (_local7){
if (_local7.type == BodyType.BARRICADE){
if (buldozerMode){
_local8 = null;
_local9 = 0;
_local10 = World.getSingleton().barricades.size();
while (_local9 < _local10) {
if (World.getSingleton().barricades.get(_local9).body){
if (World.getSingleton().barricades.get(_local9).body == _local7){
_local8 = World.getSingleton().barricades.get(_local9);
break;
};
};
_local9++;
};
if (_local8){
World.getSingleton().money = (World.getSingleton().money + _local8.localPrice);
_local8.health = 0;
_local8.deathTime = 0;
_local8.update();
if (!World.getSingleton().muted){
buldozerSound.play();
};
};
} else {
if (_local7.m_userData.active){
_local11 = new b2MouseJointDef();
_local11.body1 = World.getSingleton().physicWorld.GetGroundBody();
_local11.body2 = _local7;
_local11.target.Set(_local5, _local6);
_local11.maxForce = (1000 * _local7.GetMass());
_local11.timeStep = World.physicsDT;
mouseJoint = (World.getSingleton().physicWorld.CreateJoint(_local11) as b2MouseJoint);
_local7.WakeUp();
} else {
_local7.m_userData.active = true;
_local7.m_linearDamping = 0;
_local7.m_angularDamping = 0;
};
};
};
};
};
if (!mousePressed){
if (mouseJoint){
_local12 = World.getSingleton().physicWorld.GetJointList();
if (_local12 == mouseJoint){
World.getSingleton().physicWorld.DestroyJoint(mouseJoint);
};
mouseJoint = null;
};
};
if (mouseJoint){
_local13 = new b2Vec2(_local5, _local6);
mouseJoint.SetTarget(_local13);
};
};
}
private function handTalkCollision():Boolean{
if (!buldozerMode){
if (handCrossHair){
if (talkCrosshair){
if (PixelCollision.isColliding(talkCrosshair.image, handCrossHair.image, World.getSingleton().sceneRoot.stage)){
return (true);
};
};
};
};
return (false);
}
public function setBarricadesToHeavy():void{
var _local1:int;
var _local2:int;
var _local3:b2Body;
var _local4:b2Shape;
_local1 = World.getSingleton().barricades.size();
_local2 = (_local1 - 1);
while (_local2 >= 0) {
_local3 = World.getSingleton().barricades.get(_local2).body;
_local4 = _local3.m_shapeList;
while (_local4) {
_local4.m_density = 0;
_local4.m_filter.groupIndex = World.getSingleton().barricades.get(_local2).bodyType;
_local4 = _local4.m_next;
};
_local3.SetMassFromShapes();
_local2--;
};
}
public function onMouseDown(_arg1:MouseEvent):void{
if (!talkToNpc()){
if (talkCrosshair){
if (!handTalkCollision()){
talkCrosshair.removeClickListener();
talkCrosshair.addListener();
talkCrosshair.clicked = false;
};
};
};
mousePressed = true;
}
public function soundMute(_arg1:MouseEvent):void{
var _local2:int;
var _local3:int;
_local2 = 0;
_local3 = World.getSingleton().enemies.size();
if (World.getSingleton().muted){
World.getSingleton().muted = false;
World.getSingleton().menuBar.image.optionScreen.soundButton.gotoAndStop(2);
while (_local2 < _local3) {
if (World.getSingleton().enemies.get(_local2).soundChannel){
World.getSingleton().enemies.get(_local2).soundChannel.stop();
};
World.getSingleton().enemies.get(_local2).soundChannel = World.getSingleton().enemies.get(_local2).sound.play(0, 9999, World.getSingleton().enemies.get(_local2).soundTransform);
_local2++;
};
} else {
World.getSingleton().muted = true;
World.getSingleton().menuBar.image.optionScreen.soundButton.gotoAndStop(1);
while (_local2 < _local3) {
if (World.getSingleton().enemies.get(_local2).soundChannel){
World.getSingleton().enemies.get(_local2).soundChannel.stop();
};
_local2++;
};
};
}
public function showWeaponInventory():void{
inventoryMode = true;
weaponInventory.image.visible = true;
weaponInventory.refresh();
World.getSingleton().pauseGame();
iPressed = true;
onPause();
talkCrosshair.removeClickListener();
talkCrosshair.addListener();
talkCrosshair.clicked = false;
weaponInventory.image.close.addEventListener(MouseEvent.CLICK, closeWeaponInventory);
}
public function destroy():void{
weaponInventory.destroy();
handCrossHair.destroy();
talkCrosshair.destroy();
buldozerHair.destroy();
World.getSingleton().removeEventListener(WorldEvent.ON_INIT, onInit);
World.getSingleton().removeEventListener(WorldEvent.ON_UPDATE, onUpdate);
this.stage.removeEventListener(MouseEvent.MOUSE_DOWN, onMouseDown);
this.stage.removeEventListener(MouseEvent.MOUSE_UP, onMouseUp);
this.stage.removeEventListener(MouseEvent.MOUSE_WHEEL, onMouseWheel);
barricadeShop.image.buldozerButton.removeEventListener(MouseEvent.CLICK, modeBuldozer);
Mouse.show();
if (keyPoll){
keyPoll.destroy();
};
}
}
}//package p_gameManager
Section 235
//CreditState (p_gameManager.CreditState)
package p_gameManager {
import flash.events.*;
import p_singleton.*;
import flash.display.*;
import flash.media.*;
import p_crosshair.*;
import flash.ui.*;
public class CreditState extends GameManager {
public var closePressed:Boolean;
public var image:MovieClip;
public var clickSound:Sound;
public var handCrossHair:HandCrosshair;
public function CreditState(_arg1:MovieClip){
super(_arg1);
image = new creditScreen();
World.getSingleton().menuRoot.addChild(image);
closePressed = false;
initListener();
initCrossHair();
clickSound = new ClickSound();
}
public function initListener():void{
image.closeBtn.addEventListener(MouseEvent.CLICK, closeInstruction);
}
public function initCrossHair():void{
handCrossHair = new HandCrosshair();
World.getSingleton().mousePointer = handCrossHair;
Mouse.hide();
}
public function destroyCrossHair():void{
Mouse.show();
handCrossHair.destroy();
}
public function closeInstruction(_arg1:MouseEvent):void{
closePressed = true;
if (!World.getSingleton().muted){
clickSound.play();
};
}
override public function update():GameManager{
if (closePressed){
image.closeBtn.removeEventListener(MouseEvent.CLICK, closeInstruction);
World.getSingleton().menuRoot.removeChild(image);
image = null;
detachFromRoot();
destroyCrossHair();
return (new MainMenuState(movieClip));
};
return (this);
}
}
}//package p_gameManager
Section 236
//EndingMovieFirst (p_gameManager.EndingMovieFirst)
package p_gameManager {
import flash.events.*;
import p_singleton.*;
import flash.display.*;
import flash.media.*;
public class EndingMovieFirst extends GameManager {
public var sound:Sound;
public var yesPressed:Boolean;
public var noPressed:Boolean;
public var soundChannel:SoundChannel;
public var image:MovieClip;
public var imageWarning:MovieClip;
public var submitPressed:Boolean;
public function EndingMovieFirst(_arg1:MovieClip){
super(_arg1);
yesPressed = false;
noPressed = false;
submitPressed = false;
image = new endingMovie();
image.x = 400;
image.y = 250;
image.gotoAndPlay(2);
imageWarning = new extendedPlay();
addChild(image);
addChild(imageWarning);
imageWarning.visible = false;
initListener();
sound = new Sound2();
if (!World.getSingleton().muted){
soundChannel = sound.play();
};
destroyNPCS();
}
public function initListener():void{
imageWarning.yesButton.addEventListener(MouseEvent.CLICK, yesFunction);
imageWarning.noButton.addEventListener(MouseEvent.CLICK, noFunction);
imageWarning.submitButton.addEventListener(MouseEvent.CLICK, submitFunction);
}
public function submitFunction(_arg1:MouseEvent):void{
submitPressed = true;
}
public function removeListener():void{
imageWarning.yesButton.removeEventListener(MouseEvent.CLICK, yesFunction);
imageWarning.noButton.removeEventListener(MouseEvent.CLICK, noFunction);
imageWarning.submitButton.removeEventListener(MouseEvent.CLICK, submitFunction);
}
public function destroyNPCS():void{
var _local1:Boolean;
var _local2:int;
var _local3:int;
_local1 = World.getSingleton().muted;
World.getSingleton().muted = true;
_local2 = World.getSingleton().npcs.size();
_local3 = (_local2 - 1);
while (_local3 >= 0) {
World.getSingleton().npcs.get(_local3).health = 0;
World.getSingleton().npcs.get(_local3).deathTime = 0;
World.getSingleton().npcs.get(_local3).update();
_local3--;
};
World.getSingleton().muted = _local1;
}
public function noFunction(_arg1:MouseEvent):void{
noPressed = true;
}
override public function update():GameManager{
if (yesPressed){
removeChild(image);
detachFromRoot();
removeListener();
if (soundChannel){
soundChannel.stop();
};
return (new LocationSelectorState(movieClip));
};
if (noPressed){
removeChild(image);
detachFromRoot();
removeListener();
if (soundChannel){
soundChannel.stop();
};
World.getSingleton().gameEnded = false;
World.getSingleton().score = 0;
World.getSingleton().money = World.getSingleton().startMoney;
World.getSingleton().waveLevel = 0;
World.getSingleton().waveNum = 0;
World.getSingleton().waveCounter = 0;
World.getSingleton().levelDone = 0;
World.getSingleton().kills = 0;
if (World.getSingleton().playedCharacter){
if (World.getSingleton().playedCharacter.body){
World.getSingleton().physicWorld.DestroyBody(World.getSingleton().playedCharacter.body);
World.getSingleton().playedCharacter.body = null;
};
World.getSingleton().players.remove(World.getSingleton().playedCharacter);
World.getSingleton().playedCharacter = null;
};
return (new MainMenuState(movieClip));
};
if (submitPressed){
removeChild(image);
detachFromRoot();
removeListener();
if (soundChannel){
soundChannel.stop();
};
World.getSingleton().gameEnded = false;
World.getSingleton().money = World.getSingleton().startMoney;
World.getSingleton().waveLevel = 0;
World.getSingleton().waveNum = 0;
World.getSingleton().waveCounter = 0;
World.getSingleton().levelDone = 0;
World.getSingleton().kills = 0;
if (World.getSingleton().playedCharacter){
if (World.getSingleton().playedCharacter.body){
World.getSingleton().physicWorld.DestroyBody(World.getSingleton().playedCharacter.body);
World.getSingleton().playedCharacter.body = null;
};
World.getSingleton().players.remove(World.getSingleton().playedCharacter);
World.getSingleton().playedCharacter = null;
};
return (new SubmitHighscoresState(movieClip));
};
if (image.animationDone){
imageWarning.visible = true;
if (soundChannel){
soundChannel.stop();
};
return (this);
//unresolved jump
};
return (this);
}
public function yesFunction(_arg1:MouseEvent):void{
yesPressed = true;
}
}
}//package p_gameManager
Section 237
//EndingMovieSecond (p_gameManager.EndingMovieSecond)
package p_gameManager {
import flash.events.*;
import flash.display.*;
public class EndingMovieSecond extends GameManager {
public var yesPressed:Boolean;
public var noPressed:Boolean;
public var image:MovieClip;
public function EndingMovieSecond(_arg1:MovieClip){
super(_arg1);
yesPressed = false;
noPressed = false;
image = new harbourWarning();
addChild(image);
initListener();
}
public function initListener():void{
image.yesButton.addEventListener(MouseEvent.CLICK, yesFunction);
image.noButton.addEventListener(MouseEvent.CLICK, noFunction);
}
public function removeListener():void{
image.yesButton.removeEventListener(MouseEvent.CLICK, yesFunction);
image.noButton.removeEventListener(MouseEvent.CLICK, noFunction);
}
public function noFunction(_arg1:MouseEvent):void{
noPressed = true;
}
override public function update():GameManager{
if (yesPressed){
removeChild(image);
detachFromRoot();
removeListener();
return (new EndingMovieFirst(movieClip));
};
if (noPressed){
removeChild(image);
detachFromRoot();
removeListener();
return (new LocationSelectorState(movieClip));
};
return (this);
}
public function yesFunction(_arg1:MouseEvent):void{
yesPressed = true;
}
}
}//package p_gameManager
Section 238
//GameManager (p_gameManager.GameManager)
package p_gameManager {
import p_singleton.*;
import flash.display.*;
public class GameManager extends MovieClip {
public var movieClip:MovieClip;
public function GameManager(_arg1:MovieClip){
this.movieClip = _arg1;
this.movieClip.addChild(this);
this.addChild(World.getSingleton().sceneRoot);
this.addChild(World.getSingleton().backgroundRoot);
this.addChild(World.getSingleton().menuRoot);
}
public function detachFromRoot():void{
this.movieClip.removeChild(this);
}
public function update():GameManager{
return (this);
}
}
}//package p_gameManager
Section 239
//InGameState (p_gameManager.InGameState)
package p_gameManager {
import Box2D.Common.Math.*;
import Box2D.Dynamics.Joints.*;
import flash.events.*;
import p_weapon.*;
import p_singleton.*;
import flash.display.*;
import p_char.p_playable.*;
import p_char.p_nonplayable.*;
import p_levelManager.*;
import flash.media.*;
import p_menuBar.*;
import p_crosshair.*;
import flash.utils.*;
import mochi.as3.*;
import p_billboard.*;
import input.*;
import flash.ui.*;
public class InGameState extends GameManager {
public var waveDone:Boolean;// = false
public var bottomMenu:MenuBar;
public var healTimer:Timer;
public var crossHair:Crosshair;
public var handCrossHair:HandCrosshair;
public var backToMainMenu:Boolean;
public var retry:Boolean;
public var weaponInventory:WeaponInventory;
public var keyPoll:KeyPoll;
public var enemySpawner:Timer;
public var npcFriend:NPCFriend;
public var player:PlayableCharacter;
public var mouseJoint:b2MouseJoint;
public var submitPressed:Boolean;
public var escPressed:Boolean;
public var levelUpSound:Sound;
public var iPressed:Boolean;
public var billboardMiddle:MiddleBillboard;
public var mousePressed:Boolean;
public var waveTimer:Timer;
public var gameOver:Boolean;
public var ePressed:Boolean;
public function InGameState(_arg1:MovieClip){
waveDone = false;
iPressed = false;
escPressed = false;
submitPressed = false;
retry = false;
gameOver = false;
backToMainMenu = false;
typedEnemyClass();
super(_arg1);
World.getSingleton().waveTime = World.getSingleton().waveTimeEach;
World.getSingleton().setFocusToStage();
init();
World.getSingleton().gameStarted = true;
levelUpSound = new LevelUpSound();
}
public function showGameOverMenu():void{
if (gameOver){
return;
};
gameOver = true;
weaponInventory.destroy();
crossHair.destroy();
handCrossHair.image.visible = true;
Mouse.show();
World.getSingleton().removeEventListener(WorldEvent.ON_INIT, onInit);
enemySpawner.stop();
enemySpawner.removeEventListener(TimerEvent.TIMER, spawnEnemy);
healTimer.stop();
healTimer.removeEventListener(TimerEvent.TIMER, healBarricades);
waveTimer.stop();
if (waveTimer.hasEventListener(TimerEvent.TIMER)){
waveTimer.removeEventListener(TimerEvent.TIMER, reduceWaveTime);
};
this.stage.removeEventListener(Event.ENTER_FRAME, aim);
this.stage.removeEventListener(MouseEvent.MOUSE_DOWN, onMouseDown);
this.stage.removeEventListener(MouseEvent.MOUSE_UP, onMouseUp);
this.stage.removeEventListener(MouseEvent.MOUSE_WHEEL, onMouseWheel);
World.getSingleton().menuBar.image.resultScreen.gotoAndStop("gameover");
World.getSingleton().menuBar.image.resultScreen.alpha = 0;
World.getSingleton().menuBar.image.infoBox.visible = false;
World.getSingleton().menuBar.image.resultScreen.visible = true;
World.getSingleton().menuBar.showResultScreen();
World.getSingleton().menuBar.image.resultScreen.gameOverMenu.retryButton.addEventListener(MouseEvent.CLICK, retryLevel);
World.getSingleton().menuBar.image.resultScreen.gameOverMenu.submitButton.addEventListener(MouseEvent.CLICK, submitScore);
World.getSingleton().menuBar.image.resultScreen.backToMainMenuButton.addEventListener(MouseEvent.CLICK, setBackToMainMenu);
}
public function setBackToMainMenu2(_arg1:MouseEvent):void{
if (!gameOver){
weaponInventory.destroy();
crossHair.destroy();
Mouse.show();
World.getSingleton().removeEventListener(WorldEvent.ON_INIT, onInit);
enemySpawner.stop();
enemySpawner.removeEventListener(TimerEvent.TIMER, spawnEnemy);
healTimer.stop();
healTimer.removeEventListener(TimerEvent.TIMER, healBarricades);
waveTimer.stop();
if (waveTimer.hasEventListener(TimerEvent.TIMER)){
waveTimer.removeEventListener(TimerEvent.TIMER, reduceWaveTime);
};
this.stage.removeEventListener(Event.ENTER_FRAME, aim);
this.stage.removeEventListener(MouseEvent.MOUSE_DOWN, onMouseDown);
this.stage.removeEventListener(MouseEvent.MOUSE_UP, onMouseUp);
this.stage.removeEventListener(MouseEvent.MOUSE_WHEEL, onMouseWheel);
};
if (World.getSingleton().playedCharacter){
if (World.getSingleton().playedCharacter.body){
World.getSingleton().physicWorld.DestroyBody(World.getSingleton().playedCharacter.body);
World.getSingleton().playedCharacter.body = null;
};
World.getSingleton().players.remove(World.getSingleton().playedCharacter);
World.getSingleton().playedCharacter = null;
};
setBackToMainMenu(_arg1);
World.getSingleton().menuBar.image.optionScreen.visible = false;
World.getSingleton().menuBar.image.optionScreen.backToMainMenuButton.removeEventListener(MouseEvent.CLICK, setBackToMainMenu2);
World.getSingleton().menuBar.image.optionScreen.closeBtn.removeEventListener(MouseEvent.CLICK, closeOptionScreen);
World.getSingleton().menuBar.image.optionScreen.lowButton.removeEventListener(MouseEvent.CLICK, setLowQuality);
World.getSingleton().menuBar.image.optionScreen.mediumButton.removeEventListener(MouseEvent.CLICK, setMediumQuality);
World.getSingleton().menuBar.image.optionScreen.highButton.removeEventListener(MouseEvent.CLICK, setHighQuality);
}
public function initPlayer():void{
if (World.getSingleton().playedCharacter == null){
player = new FemaleChar();
player.initRigidBody();
World.getSingleton().players.add(player);
player.changeWeapon(player.primaryWeapon);
player.currentWeaponNumber = 1;
World.getSingleton().playedCharacter = player;
} else {
player = PlayableCharacter(World.getSingleton().playedCharacter);
if (!player.body){
player.initRigidBody();
};
if (!World.getSingleton().players.contains(player)){
World.getSingleton().players.add(player);
};
};
World.getSingleton().level.playerGround.addChild(player.image);
weaponInventory = new WeaponInventory(player);
weaponInventory.image.visible = false;
}
public function shoot():void{
if (mousePressed){
player.attack(true);
};
}
public function initEventListener():void{
keyPoll = new KeyPoll(this.stage);
this.stage.addEventListener(Event.ENTER_FRAME, aim, false, 0, true);
this.stage.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown, false, 0, true);
this.stage.addEventListener(MouseEvent.MOUSE_UP, onMouseUp, false, 0, true);
this.stage.addEventListener(MouseEvent.MOUSE_WHEEL, onMouseWheel, false, 0, true);
}
public function initEnemy():void{
enemySpawner = new Timer(World.getSingleton().level.enemySpawnerDelay);
enemySpawner.addEventListener(TimerEvent.TIMER, spawnEnemy);
enemySpawner.start();
}
public function initLevel():void{
var _local1:int;
_local1 = World.getSingleton().currentLevelNumber;
World.getSingleton().changeLevel(LevelManager.getSingleton().getLevel(_local1));
}
public function playerDied():Boolean{
if (World.getSingleton().playedCharacter){
if (World.getSingleton().playedCharacter.health <= 0){
return (true);
};
return (false);
//unresolved jump
};
return (true);
}
public function destroyEverything(_arg1:Boolean=true, _arg2=true):void{
var _local3:int;
var _local4:int;
_local3 = 0;
_local4 = 0;
_local4 = World.getSingleton().enemies.size();
_local3 = (_local4 - 1);
while (_local3 >= 0) {
World.getSingleton().enemies.get(_local3).health = 0;
World.getSingleton().enemies.get(_local3).deathTime = 0;
World.getSingleton().enemies.get(_local3).update();
_local3--;
};
if (_arg1){
_local4 = World.getSingleton().npcs.size();
_local3 = (_local4 - 1);
while (_local3 >= 0) {
World.getSingleton().npcs.get(_local3).health = 0;
World.getSingleton().npcs.get(_local3).deathTime = 0;
World.getSingleton().npcs.get(_local3).update();
_local3--;
};
};
if (_arg2){
_local4 = World.getSingleton().barricades.size();
_local3 = (_local4 - 1);
while (_local3 >= 0) {
World.getSingleton().barricades.get(_local3).health = 0;
World.getSingleton().barricades.get(_local3).deathTime = 0;
World.getSingleton().barricades.get(_local3).update();
_local3--;
};
};
_local4 = World.getSingleton().itemPickUps.size();
_local3 = (_local4 - 1);
while (_local3 >= 0) {
World.getSingleton().itemPickUps.get(_local3).destroy();
_local3--;
};
if (keyPoll){
keyPoll.destroy();
};
}
public function nextWave(_arg1:MouseEvent):void{
World.getSingleton().waveNum++;
World.getSingleton().waveCounter++;
waveDone = true;
}
public function setMediumQuality(_arg1:MouseEvent):void{
movieClip.stage.quality = StageQuality.MEDIUM;
}
public function onEnterFrame(_arg1:Event):void{
checkInput();
}
override public function update():GameManager{
if (waveDone){
World.getSingleton().gameStarted = false;
World.getSingleton().menuBar.image.resultScreen.visible = false;
World.getSingleton().menuBar.image.optionScreen.visible = false;
World.getSingleton().menuBar.image.infoBox.visible = false;
if (World.getSingleton().waveNum >= World.getSingleton().numOfWave){
destroyEverything(false, true);
} else {
destroyEverything(false, false);
};
World.getSingleton().removeEventListener(WorldEvent.ON_UPDATE, onUpdate);
World.getSingleton().pauseGame();
World.getSingleton().menuBar.image.resultScreen.gameScoreMenu.nextButton.removeEventListener(MouseEvent.CLICK, nextWave);
handCrossHair.destroy();
detachFromRoot();
if (World.getSingleton().waveNum >= World.getSingleton().numOfWave){
World.getSingleton().waveNum = 0;
World.getSingleton().waveLevel++;
if (World.getSingleton().levelDone < World.getSingleton().currentLevelNumber){
World.getSingleton().levelDone = World.getSingleton().currentLevelNumber;
};
if (World.getSingleton().backGroundSoundChannel){
World.getSingleton().backGroundSoundChannel.stop();
};
return (new LocationSelectorState(movieClip));
};
if (World.getSingleton().backGroundSoundChannel){
World.getSingleton().backGroundSoundChannel.stop();
};
return (new WeaponShopState(movieClip));
};
if (backToMainMenu){
World.getSingleton().gameStarted = false;
World.getSingleton().gameEnded = false;
handCrossHair.destroy();
Mouse.show();
detachFromRoot();
if (World.getSingleton().backGroundSoundChannel){
World.getSingleton().backGroundSoundChannel.stop();
};
return (new MainMenuState(movieClip));
};
if (retry){
World.getSingleton().gameStarted = false;
handCrossHair.destroy();
Mouse.show();
detachFromRoot();
if (World.getSingleton().backGroundSoundChannel){
World.getSingleton().backGroundSoundChannel.stop();
};
return (new WeaponShopState(movieClip));
};
if (submitPressed){
World.getSingleton().gameStarted = false;
World.getSingleton().gameEnded = false;
handCrossHair.destroy();
Mouse.show();
detachFromRoot();
if (World.getSingleton().backGroundSoundChannel){
World.getSingleton().backGroundSoundChannel.stop();
};
return (new SubmitHighscoresState(movieClip));
};
if (playerDied()){
showGameOverMenu();
} else {
checkLevelUp();
checkTimeDone();
return (this);
};
return (this);
}
public function spawnEnemy(_arg1:TimerEvent=null):void{
var _local2:int;
var _local3:Class;
var _local4:NonPlayableCharacter;
if ((((World.getSingleton().enemies.size() >= 10)) || ((World.getSingleton().waveTime <= 0)))){
return;
};
if (World.getSingleton().level.arrayOfStage.get(World.getSingleton().currentStage).enemyCounter >= World.getSingleton().level.arrayOfStage.get(World.getSingleton().currentStage).numOfEnemies){
enemySpawner.stop();
return;
};
_local2 = World.getSingleton().level.findSpawnPoint(World.getSingleton().currentStage);
if (_local2 == -1){
return;
};
_local3 = (getDefinitionByName(World.getSingleton().level.getEnemyClass()) as Class);
_local4 = NonPlayableCharacter(new (_local3));
_local4.position.x = (MovieClip(World.getSingleton().level.middleGround)[("enemySpawnPoint" + _local2)].x + World.getSingleton().level.middleGround.x);
_local4.position.y = (MovieClip(World.getSingleton().level.middleGround)[("enemySpawnPoint" + _local2)].y + World.getSingleton().level.middleGround.y);
if (_local4.currentWeapon){
_local4.currentWeapon.screenPosition = _local4.screenPosition;
};
if (_local4){
_local4.initRigidBody();
World.getSingleton().enemies.add(_local4);
};
if (_local4){
if (_local4.currentWeapon){
if (_local4.currentWeapon.damage < 50){
_local4.currentWeapon.damage = (_local4.currentWeapon.damage + ((_local4.currentWeapon.damage * World.getSingleton().waveCounter) * 0.01));
if (_local4.currentWeapon.damage > 50){
_local4.currentWeapon.damage = 50;
};
};
_local4.health = (_local4.health + ((_local4.health * World.getSingleton().waveCounter) * 0.5));
_local4.maxHealth = _local4.health;
_local4.point = (_local4.point + ((_local4.point * World.getSingleton().waveCounter) * 0.2));
if (_local4.speed < 11){
_local4.speed = (_local4.speed + ((_local4.speed * World.getSingleton().waveCounter) * 0.3));
_local4.runSpeed = (_local4.speed * 1.5);
if (_local4.speed > 11){
_local4.speed = 11;
_local4.runSpeed = (_local4.speed * 1.5);
_local4.walkAnimationSpeed = 200;
_local4.runAnimationSpeed = 150;
_local4.setSpeed(_local4.speed, _local4.walkAnimationSpeed);
_local4.setRunSpeed(_local4.runSpeed, _local4.runAnimationSpeed);
} else {
_local4.walkAnimationSpeed = (_local4.walkAnimationSpeed / ((World.getSingleton().waveCounter + 1) * 0.3));
_local4.runAnimationSpeed = (_local4.runAnimationSpeed / ((World.getSingleton().waveCounter + 1) * 0.3));
_local4.setSpeed(_local4.speed, _local4.walkAnimationSpeed);
_local4.setRunSpeed(_local4.runSpeed, _local4.runAnimationSpeed);
};
};
};
};
}
public function typedEnemyClass():void{
var _local1:ZombieNormal01;
var _local2:Zombie01;
var _local3:Zombie02;
var _local4:Zombie03;
var _local5:Zombie04;
var _local6:Zombie05;
var _local7:Zombie06;
var _local8:Zombie07;
var _local9:Zombie08;
var _local10:Zombie09;
var _local11:Zombie10;
var _local12:ZombieCrawler01;
var _local13:NPCFriendTest;
}
public function showOptionScreen():void{
World.getSingleton().menuBar.image.optionScreen.visible = true;
World.getSingleton().menuBar.image.optionScreen.backToMainMenuButton.addEventListener(MouseEvent.CLICK, setBackToMainMenu2);
World.getSingleton().menuBar.image.optionScreen.closeBtn.addEventListener(MouseEvent.CLICK, closeOptionScreen);
World.getSingleton().menuBar.image.optionScreen.lowButton.addEventListener(MouseEvent.CLICK, setLowQuality);
World.getSingleton().menuBar.image.optionScreen.mediumButton.addEventListener(MouseEvent.CLICK, setMediumQuality);
World.getSingleton().menuBar.image.optionScreen.highButton.addEventListener(MouseEvent.CLICK, setHighQuality);
if (World.getSingleton().muted){
World.getSingleton().menuBar.image.optionScreen.soundButton.gotoAndStop(1);
} else {
World.getSingleton().menuBar.image.optionScreen.soundButton.gotoAndStop(2);
};
World.getSingleton().menuBar.image.optionScreen.soundButton.addEventListener(MouseEvent.CLICK, soundMute);
World.getSingleton().pauseGame();
handCrossHair.image.visible = true;
crossHair.image.visible = false;
waveTimer.stop();
healTimer.stop();
enemySpawner.stop();
onPause();
}
public function reduceWaveTime(_arg1:TimerEvent):void{
if (World.getSingleton().waveTime > 0){
World.getSingleton().waveTime--;
} else {
waveTimer.stop();
if (waveTimer.hasEventListener(TimerEvent.TIMER)){
waveTimer.removeEventListener(TimerEvent.TIMER, reduceWaveTime);
};
billboardMiddle = new MiddleBillboard("Kill All Remaining Zombies!", 50);
};
}
public function onMouseWheel(_arg1:MouseEvent):void{
var _local2:PlayableCharacter;
if (World.getSingleton().playedCharacter){
_local2 = PlayableCharacter(World.getSingleton().playedCharacter);
if (_arg1.delta > 0){
player.currentWeaponNumber++;
if (player.currentWeaponNumber > 4){
player.currentWeaponNumber = 1;
};
} else {
if (_arg1.delta < 0){
player.currentWeaponNumber--;
if (player.currentWeaponNumber < 1){
player.currentWeaponNumber = 4;
};
};
};
if (player.currentWeaponNumber == 1){
if (player.primaryWeapon){
player.changeWeapon(player.primaryWeapon);
} else {
onMouseWheel(_arg1);
};
} else {
if (player.currentWeaponNumber == 2){
if (player.secondaryWeapon){
player.changeWeapon(player.secondaryWeapon);
} else {
onMouseWheel(_arg1);
};
} else {
if (player.currentWeaponNumber == 3){
if (player.meleeWeapon){
player.changeWeapon(player.meleeWeapon);
} else {
onMouseWheel(_arg1);
};
} else {
if (player.currentWeaponNumber == 4){
if (player.explosiveWeapon){
player.changeWeapon(player.explosiveWeapon);
} else {
onMouseWheel(_arg1);
};
};
};
};
};
};
}
public function initMenuBar():void{
if (!World.getSingleton().menuBar){
bottomMenu = new MenuBar();
World.getSingleton().menuBar = bottomMenu;
};
World.getSingleton().menuBar.image.resultScreen.visible = false;
World.getSingleton().menuBar.image.optionScreen.visible = false;
World.getSingleton().menuBar.image.infoBox.visible = true;
MochiAd.unload({clip:World.getSingleton().menuBar.image.resultScreen.gameScoreMenu.adSpace.adSpace});
MochiAd.showClickAwayAd({clip:World.getSingleton().menuBar.image.resultScreen.gameScoreMenu.adSpace.adSpace, id:"349f9764c411a8cb", ad_loaded:function ():void{
Mouse.hide();
}});
}
public function setLowQuality(_arg1:MouseEvent):void{
movieClip.stage.quality = StageQuality.LOW;
}
public function onResume():void{
this.removeEventListener(Event.ENTER_FRAME, onEnterFrame);
}
public function initCrossHair():void{
crossHair = new Crosshair();
handCrossHair = new HandCrosshair();
handCrossHair.image.visible = false;
Mouse.hide();
}
public function init():void{
World.getSingleton().addEventListener(WorldEvent.ON_INIT, onInit);
World.getSingleton().addEventListener(WorldEvent.ON_UPDATE, onUpdate);
World.getSingleton().initWorld();
Mouse.hide();
healTimer = new Timer(500);
healTimer.addEventListener(TimerEvent.TIMER, healBarricades);
waveTimer = new Timer(1000);
waveTimer.addEventListener(TimerEvent.TIMER, reduceWaveTime);
waveTimer.start();
}
public function checkTimeDone():void{
if (World.getSingleton().waveTime <= 0){
if (World.getSingleton().enemies.size() == 0){
showResult();
};
};
}
public function checkLevelUp():void{
var _local1:PlayableCharacter;
var _local2:int;
var _local3:int;
var _local4:RangeWeapon;
var _local5:MeleeWeapon;
var _local6:ExplosiveWeapon;
var _local7:int;
var _local8:int;
var _local9:Number;
if (World.getSingleton().playedCharacter){
_local1 = PlayableCharacter(World.getSingleton().playedCharacter);
_local2 = 0;
_local3 = World.getSingleton().rangeWeaponInventory.size();
_local4 = null;
_local5 = null;
_local6 = null;
_local7 = 0;
_local8 = 0;
_local9 = 0;
if (_local1.level == 1){
_local8 = 25;
_local9 = ((World.getSingleton().kills - _local1.lastKillLimit) / (_local8 - _local1.lastKillLimit));
World.getSingleton().menuBar.image.expSign.expBar.width = (800 * _local9);
if (World.getSingleton().kills >= _local8){
if (!World.getSingleton().muted){
levelUpSound.play();
};
if (enemySpawner){
if (enemySpawner.running){
enemySpawner.stop();
enemySpawner.delay = (World.getSingleton().level.enemySpawnerDelay - (25 * _local1.level));
if (enemySpawner.delay < 1){
enemySpawner.delay = 1;
};
enemySpawner.start();
};
};
_local1.lastKillLimit = _local8;
_local1.level++;
_local7 = 15;
billboardMiddle = new MiddleBillboard(("Reload Speed +" + _local7), 50);
while (_local2 < _local3) {
_local4 = World.getSingleton().rangeWeaponInventory.get(_local2);
World.getSingleton().rangeWeaponInventory.get(_local2).reloadTime = (_local4.reloadTime - _local7);
if (_local4.reloadTime < 1){
_local4.reloadTime = 1;
};
_local4.setReloadSpeed(_local4.reloadTime);
_local2++;
};
};
} else {
if (_local1.level == 2){
_local8 = 50;
_local9 = ((World.getSingleton().kills - _local1.lastKillLimit) / (_local8 - _local1.lastKillLimit));
World.getSingleton().menuBar.image.expSign.expBar.width = (800 * _local9);
if (World.getSingleton().kills >= _local8){
if (!World.getSingleton().muted){
levelUpSound.play();
};
if (enemySpawner){
if (enemySpawner.running){
enemySpawner.stop();
enemySpawner.delay = (World.getSingleton().level.enemySpawnerDelay - (25 * _local1.level));
if (enemySpawner.delay < 1){
enemySpawner.delay = 1;
};
enemySpawner.start();
};
};
_local1.lastKillLimit = _local8;
_local1.level++;
_local7 = 15;
billboardMiddle = new MiddleBillboard(("Attack Damage +" + _local7), 50);
while (_local2 < _local3) {
_local4 = World.getSingleton().rangeWeaponInventory.get(_local2);
World.getSingleton().rangeWeaponInventory.get(_local2).damage = (_local4.damage + _local7);
_local2++;
};
_local2 = 0;
_local3 = World.getSingleton().meleeWeaponInventory.size();
while (_local2 < _local3) {
_local5 = World.getSingleton().meleeWeaponInventory.get(_local2);
World.getSingleton().meleeWeaponInventory.get(_local2).damage = (_local5.damage + _local7);
_local2++;
};
_local2 = 0;
_local3 = World.getSingleton().explosiveWeaponInventory.size();
while (_local2 < _local3) {
_local6 = World.getSingleton().explosiveWeaponInventory.get(_local2);
World.getSingleton().explosiveWeaponInventory.get(_local2).damage = (_local6.damage + _local7);
_local2++;
};
};
} else {
if (_local1.level == 3){
_local8 = 80;
_local9 = ((World.getSingleton().kills - _local1.lastKillLimit) / (_local8 - _local1.lastKillLimit));
World.getSingleton().menuBar.image.expSign.expBar.width = (800 * _local9);
if (World.getSingleton().kills >= _local8){
if (!World.getSingleton().muted){
levelUpSound.play();
};
if (enemySpawner){
if (enemySpawner.running){
enemySpawner.stop();
enemySpawner.delay = (World.getSingleton().level.enemySpawnerDelay - (25 * _local1.level));
if (enemySpawner.delay < 1){
enemySpawner.delay = 1;
};
enemySpawner.start();
};
};
_local1.lastKillLimit = _local8;
_local1.level++;
_local7 = 5;
billboardMiddle = new MiddleBillboard(("Attack Speed +" + _local7), 50);
while (_local2 < _local3) {
_local4 = World.getSingleton().rangeWeaponInventory.get(_local2);
World.getSingleton().rangeWeaponInventory.get(_local2).delay = (_local4.delay - _local7);
if (_local4.delay < 1){
_local4.delay = 1;
};
_local4.setDelaySpeed(_local4.delay);
_local2++;
};
_local2 = 0;
_local3 = World.getSingleton().meleeWeaponInventory.size();
while (_local2 < _local3) {
_local5 = World.getSingleton().meleeWeaponInventory.get(_local2);
World.getSingleton().meleeWeaponInventory.get(_local2).attackTime = (_local5.attackTime - (_local7 / 2));
if (_local5.attackTime < 1){
_local5.attackTime = 1;
};
_local5.setAttackSpeed(_local5.attackTime);
_local2++;
};
};
} else {
if (_local1.level == 4){
_local8 = 120;
_local9 = ((World.getSingleton().kills - _local1.lastKillLimit) / (_local8 - _local1.lastKillLimit));
World.getSingleton().menuBar.image.expSign.expBar.width = (800 * _local9);
if (World.getSingleton().kills >= _local8){
if (!World.getSingleton().muted){
levelUpSound.play();
};
if (enemySpawner){
if (enemySpawner.running){
enemySpawner.stop();
enemySpawner.delay = (World.getSingleton().level.enemySpawnerDelay - (25 * _local1.level));
if (enemySpawner.delay < 1){
enemySpawner.delay = 1;
};
enemySpawner.start();
};
};
_local1.lastKillLimit = _local8;
_local1.level++;
_local7 = 15;
billboardMiddle = new MiddleBillboard(("Reload Speed +" + _local7), 50);
while (_local2 < _local3) {
_local4 = World.getSingleton().rangeWeaponInventory.get(_local2);
World.getSingleton().rangeWeaponInventory.get(_local2).reloadTime = (_local4.reloadTime - _local7);
if (_local4.reloadTime < 1){
_local4.reloadTime = 1;
};
_local4.setReloadSpeed(_local4.reloadTime);
_local2++;
};
};
} else {
if (_local1.level == 5){
_local8 = 180;
_local9 = ((World.getSingleton().kills - _local1.lastKillLimit) / (_local8 - _local1.lastKillLimit));
World.getSingleton().menuBar.image.expSign.expBar.width = (800 * _local9);
if (World.getSingleton().kills >= _local8){
if (!World.getSingleton().muted){
levelUpSound.play();
};
if (enemySpawner){
if (enemySpawner.running){
enemySpawner.stop();
enemySpawner.delay = (World.getSingleton().level.enemySpawnerDelay - (50 * _local1.level));
enemySpawner.start();
};
};
_local1.lastKillLimit = _local8;
_local1.level++;
_local7 = 20;
billboardMiddle = new MiddleBillboard(("Attack Damage +" + _local7), 50);
while (_local2 < _local3) {
_local4 = World.getSingleton().rangeWeaponInventory.get(_local2);
World.getSingleton().rangeWeaponInventory.get(_local2).damage = (_local4.damage + _local7);
_local2++;
};
_local2 = 0;
_local3 = World.getSingleton().meleeWeaponInventory.size();
while (_local2 < _local3) {
_local5 = World.getSingleton().meleeWeaponInventory.get(_local2);
World.getSingleton().meleeWeaponInventory.get(_local2).damage = (_local5.damage + _local7);
_local2++;
};
_local2 = 0;
_local3 = World.getSingleton().explosiveWeaponInventory.size();
while (_local2 < _local3) {
_local6 = World.getSingleton().explosiveWeaponInventory.get(_local2);
World.getSingleton().explosiveWeaponInventory.get(_local2).damage = (_local6.damage + _local7);
_local2++;
};
};
} else {
if (_local1.level == 6){
_local8 = 300;
_local9 = ((World.getSingleton().kills - _local1.lastKillLimit) / (_local8 - _local1.lastKillLimit));
World.getSingleton().menuBar.image.expSign.expBar.width = (800 * _local9);
if (World.getSingleton().kills >= _local8){
if (!World.getSingleton().muted){
levelUpSound.play();
};
if (enemySpawner){
if (enemySpawner.running){
enemySpawner.stop();
enemySpawner.delay = (World.getSingleton().level.enemySpawnerDelay - (25 * _local1.level));
if (enemySpawner.delay < 1){
enemySpawner.delay = 1;
};
enemySpawner.start();
};
};
_local1.lastKillLimit = _local8;
_local1.level++;
_local7 = 5;
billboardMiddle = new MiddleBillboard(("Attack Speed +" + _local7), 50);
while (_local2 < _local3) {
_local4 = World.getSingleton().rangeWeaponInventory.get(_local2);
World.getSingleton().rangeWeaponInventory.get(_local2).delay = (_local4.delay - _local7);
if (_local4.delay < 1){
_local4.delay = 1;
};
_local4.setDelaySpeed(_local4.delay);
_local2++;
};
_local2 = 0;
_local3 = World.getSingleton().meleeWeaponInventory.size();
while (_local2 < _local3) {
_local5 = World.getSingleton().meleeWeaponInventory.get(_local2);
World.getSingleton().meleeWeaponInventory.get(_local2).attackTime = (_local5.attackTime - (_local7 / 2));
if (_local5.attackTime < 1){
_local5.attackTime = 1;
};
_local5.setAttackSpeed(_local5.attackTime);
_local2++;
};
};
} else {
if (_local1.level == 7){
_local8 = 500;
_local9 = ((World.getSingleton().kills - _local1.lastKillLimit) / (_local8 - _local1.lastKillLimit));
World.getSingleton().menuBar.image.expSign.expBar.width = (800 * _local9);
if (World.getSingleton().kills >= _local8){
if (!World.getSingleton().muted){
levelUpSound.play();
};
if (enemySpawner){
if (enemySpawner.running){
enemySpawner.stop();
enemySpawner.delay = (World.getSingleton().level.enemySpawnerDelay - (25 * _local1.level));
if (enemySpawner.delay < 1){
enemySpawner.delay = 1;
};
enemySpawner.start();
};
};
_local1.lastKillLimit = _local8;
_local1.level++;
_local7 = 15;
billboardMiddle = new MiddleBillboard(("Reload Speed +" + _local7), 50);
while (_local2 < _local3) {
_local4 = World.getSingleton().rangeWeaponInventory.get(_local2);
World.getSingleton().rangeWeaponInventory.get(_local2).reloadTime = (_local4.reloadTime - _local7);
if (_local4.reloadTime < 1){
_local4.reloadTime = 1;
};
_local4.setReloadSpeed(_local4.reloadTime);
_local2++;
};
};
} else {
if (_local1.level == 8){
_local8 = 1000;
_local9 = ((World.getSingleton().kills - _local1.lastKillLimit) / (_local8 - _local1.lastKillLimit));
World.getSingleton().menuBar.image.expSign.expBar.width = (800 * _local9);
if (World.getSingleton().kills >= _local8){
if (!World.getSingleton().muted){
levelUpSound.play();
};
if (enemySpawner){
if (enemySpawner.running){
enemySpawner.stop();
enemySpawner.delay = (World.getSingleton().level.enemySpawnerDelay - (25 * _local1.level));
if (enemySpawner.delay < 1){
enemySpawner.delay = 1;
};
enemySpawner.start();
};
};
_local1.lastKillLimit = _local8;
_local1.level++;
_local7 = 30;
billboardMiddle = new MiddleBillboard(("Attack Damage +" + _local7), 50);
while (_local2 < _local3) {
_local4 = World.getSingleton().rangeWeaponInventory.get(_local2);
World.getSingleton().rangeWeaponInventory.get(_local2).damage = (_local4.damage + _local7);
_local2++;
};
_local2 = 0;
_local3 = World.getSingleton().meleeWeaponInventory.size();
while (_local2 < _local3) {
_local5 = World.getSingleton().meleeWeaponInventory.get(_local2);
World.getSingleton().meleeWeaponInventory.get(_local2).damage = (_local5.damage + _local7);
_local2++;
};
_local2 = 0;
_local3 = World.getSingleton().explosiveWeaponInventory.size();
while (_local2 < _local3) {
_local6 = World.getSingleton().explosiveWeaponInventory.get(_local2);
World.getSingleton().explosiveWeaponInventory.get(_local2).damage = (_local6.damage + _local7);
_local2++;
};
};
} else {
if (_local1.level == 9){
_local8 = 1600;
_local9 = ((World.getSingleton().kills - _local1.lastKillLimit) / (_local8 - _local1.lastKillLimit));
World.getSingleton().menuBar.image.expSign.expBar.width = (800 * _local9);
if (World.getSingleton().kills >= _local8){
if (!World.getSingleton().muted){
levelUpSound.play();
};
if (enemySpawner){
if (enemySpawner.running){
enemySpawner.stop();
enemySpawner.delay = (World.getSingleton().level.enemySpawnerDelay - (25 * _local1.level));
if (enemySpawner.delay < 1){
enemySpawner.delay = 1;
};
enemySpawner.start();
};
};
_local1.lastKillLimit = _local8;
_local1.level++;
_local7 = 5;
billboardMiddle = new MiddleBillboard(("Attack Speed +" + _local7), 50);
while (_local2 < _local3) {
_local4 = World.getSingleton().rangeWeaponInventory.get(_local2);
World.getSingleton().rangeWeaponInventory.get(_local2).delay = (_local4.delay - _local7);
if (_local4.delay < 1){
_local4.delay = 1;
};
_local4.setDelaySpeed(_local4.delay);
_local2++;
};
_local2 = 0;
_local3 = World.getSingleton().meleeWeaponInventory.size();
while (_local2 < _local3) {
_local5 = World.getSingleton().meleeWeaponInventory.get(_local2);
World.getSingleton().meleeWeaponInventory.get(_local2).attackTime = (_local5.attackTime - (_local7 / 2));
if (_local5.attackTime < 1){
_local5.attackTime = 1;
};
_local5.setAttackSpeed(_local5.attackTime);
_local2++;
};
};
} else {
if (_local1.level == 10){
_local8 = 2100;
_local9 = ((World.getSingleton().kills - _local1.lastKillLimit) / (_local8 - _local1.lastKillLimit));
World.getSingleton().menuBar.image.expSign.expBar.width = (800 * _local9);
if (World.getSingleton().kills >= _local8){
if (!World.getSingleton().muted){
levelUpSound.play();
};
if (enemySpawner){
if (enemySpawner.running){
enemySpawner.stop();
enemySpawner.delay = (World.getSingleton().level.enemySpawnerDelay - (25 * _local1.level));
if (enemySpawner.delay < 1){
enemySpawner.delay = 1;
};
enemySpawner.start();
};
};
_local1.lastKillLimit = _local8;
_local1.level++;
_local7 = 15;
billboardMiddle = new MiddleBillboard(("Reload Speed +" + _local7), 50);
while (_local2 < _local3) {
_local4 = World.getSingleton().rangeWeaponInventory.get(_local2);
World.getSingleton().rangeWeaponInventory.get(_local2).reloadTime = (_local4.reloadTime - _local7);
if (_local4.reloadTime < 1){
_local4.reloadTime = 1;
};
_local4.setReloadSpeed(_local4.reloadTime);
_local2++;
};
};
} else {
if (_local1.level == 11){
_local8 = 2600;
_local9 = ((World.getSingleton().kills - _local1.lastKillLimit) / (_local8 - _local1.lastKillLimit));
World.getSingleton().menuBar.image.expSign.expBar.width = (800 * _local9);
if (World.getSingleton().kills >= _local8){
if (!World.getSingleton().muted){
levelUpSound.play();
};
if (enemySpawner){
if (enemySpawner.running){
enemySpawner.stop();
enemySpawner.delay = (World.getSingleton().level.enemySpawnerDelay - (25 * _local1.level));
if (enemySpawner.delay < 1){
enemySpawner.delay = 1;
};
enemySpawner.start();
};
};
_local1.lastKillLimit = _local8;
_local1.level++;
_local7 = 60;
billboardMiddle = new MiddleBillboard(("Attack Damage +" + _local7), 50);
while (_local2 < _local3) {
_local4 = World.getSingleton().rangeWeaponInventory.get(_local2);
World.getSingleton().rangeWeaponInventory.get(_local2).damage = (_local4.damage + _local7);
_local2++;
};
_local2 = 0;
_local3 = World.getSingleton().meleeWeaponInventory.size();
while (_local2 < _local3) {
_local5 = World.getSingleton().meleeWeaponInventory.get(_local2);
World.getSingleton().meleeWeaponInventory.get(_local2).damage = (_local5.damage + _local7);
_local2++;
};
_local2 = 0;
_local3 = World.getSingleton().explosiveWeaponInventory.size();
while (_local2 < _local3) {
_local6 = World.getSingleton().explosiveWeaponInventory.get(_local2);
World.getSingleton().explosiveWeaponInventory.get(_local2).damage = (_local6.damage + _local7);
_local2++;
};
};
} else {
if (_local1.level == 12){
_local8 = 3100;
_local9 = ((World.getSingleton().kills - _local1.lastKillLimit) / (_local8 - _local1.lastKillLimit));
World.getSingleton().menuBar.image.expSign.expBar.width = (800 * _local9);
if (World.getSingleton().kills >= _local8){
if (!World.getSingleton().muted){
levelUpSound.play();
};
if (enemySpawner){
if (enemySpawner.running){
enemySpawner.stop();
enemySpawner.delay = (World.getSingleton().level.enemySpawnerDelay - (25 * _local1.level));
if (enemySpawner.delay < 1){
enemySpawner.delay = 1;
};
enemySpawner.start();
};
};
_local1.lastKillLimit = _local8;
_local1.level++;
_local7 = 5;
billboardMiddle = new MiddleBillboard(("Attack Speed +" + _local7), 50);
while (_local2 < _local3) {
_local4 = World.getSingleton().rangeWeaponInventory.get(_local2);
World.getSingleton().rangeWeaponInventory.get(_local2).delay = (_local4.delay - _local7);
if (_local4.delay < 1){
_local4.delay = 1;
};
_local4.setDelaySpeed(_local4.delay);
_local2++;
};
_local2 = 0;
_local3 = World.getSingleton().meleeWeaponInventory.size();
while (_local2 < _local3) {
_local5 = World.getSingleton().meleeWeaponInventory.get(_local2);
World.getSingleton().meleeWeaponInventory.get(_local2).attackTime = (_local5.attackTime - (_local7 / 2));
if (_local5.attackTime < 1){
_local5.attackTime = 1;
};
_local5.setAttackSpeed(_local5.attackTime);
_local2++;
};
};
} else {
if (_local1.level == 13){
_local8 = 3600;
_local9 = ((World.getSingleton().kills - _local1.lastKillLimit) / (_local8 - _local1.lastKillLimit));
World.getSingleton().menuBar.image.expSign.expBar.width = (800 * _local9);
if (World.getSingleton().kills >= _local8){
if (!World.getSingleton().muted){
levelUpSound.play();
};
if (enemySpawner){
if (enemySpawner.running){
enemySpawner.stop();
enemySpawner.delay = (World.getSingleton().level.enemySpawnerDelay - (25 * _local1.level));
if (enemySpawner.delay < 1){
enemySpawner.delay = 1;
};
enemySpawner.start();
};
};
_local1.lastKillLimit = _local8;
_local1.level++;
_local7 = 15;
billboardMiddle = new MiddleBillboard(("Reload Speed +" + _local7), 50);
while (_local2 < _local3) {
_local4 = World.getSingleton().rangeWeaponInventory.get(_local2);
World.getSingleton().rangeWeaponInventory.get(_local2).reloadTime = (_local4.reloadTime - _local7);
if (_local4.reloadTime < 1){
_local4.reloadTime = 1;
};
_local4.setReloadSpeed(_local4.reloadTime);
_local2++;
};
};
} else {
if (_local1.level == 14){
_local8 = 4100;
_local9 = ((World.getSingleton().kills - _local1.lastKillLimit) / (_local8 - _local1.lastKillLimit));
World.getSingleton().menuBar.image.expSign.expBar.width = (800 * _local9);
if (World.getSingleton().kills >= _local8){
if (!World.getSingleton().muted){
levelUpSound.play();
};
if (enemySpawner){
if (enemySpawner.running){
enemySpawner.stop();
enemySpawner.delay = (World.getSingleton().level.enemySpawnerDelay - (25 * _local1.level));
if (enemySpawner.delay < 1){
enemySpawner.delay = 1;
};
enemySpawner.start();
};
};
_local1.lastKillLimit = _local8;
_local1.level++;
_local7 = 150;
billboardMiddle = new MiddleBillboard(("Attack Damage +" + _local7), 50);
while (_local2 < _local3) {
_local4 = World.getSingleton().rangeWeaponInventory.get(_local2);
World.getSingleton().rangeWeaponInventory.get(_local2).damage = (_local4.damage + _local7);
_local2++;
};
_local2 = 0;
_local3 = World.getSingleton().meleeWeaponInventory.size();
while (_local2 < _local3) {
_local5 = World.getSingleton().meleeWeaponInventory.get(_local2);
World.getSingleton().meleeWeaponInventory.get(_local2).damage = (_local5.damage + _local7);
_local2++;
};
_local2 = 0;
_local3 = World.getSingleton().explosiveWeaponInventory.size();
while (_local2 < _local3) {
_local6 = World.getSingleton().explosiveWeaponInventory.get(_local2);
World.getSingleton().explosiveWeaponInventory.get(_local2).damage = (_local6.damage + _local7);
_local2++;
};
};
} else {
if (_local1.level == 15){
_local8 = 4600;
_local9 = ((World.getSingleton().kills - _local1.lastKillLimit) / (_local8 - _local1.lastKillLimit));
World.getSingleton().menuBar.image.expSign.expBar.width = (800 * _local9);
if (World.getSingleton().kills >= _local8){
if (!World.getSingleton().muted){
levelUpSound.play();
};
if (enemySpawner){
if (enemySpawner.running){
enemySpawner.stop();
enemySpawner.delay = (World.getSingleton().level.enemySpawnerDelay - (25 * _local1.level));
if (enemySpawner.delay < 1){
enemySpawner.delay = 1;
};
enemySpawner.start();
};
};
_local1.lastKillLimit = _local8;
_local1.level++;
_local7 = 5;
billboardMiddle = new MiddleBillboard(("Attack Speed +" + _local7), 50);
while (_local2 < _local3) {
_local4 = World.getSingleton().rangeWeaponInventory.get(_local2);
World.getSingleton().rangeWeaponInventory.get(_local2).delay = (_local4.delay - _local7);
if (_local4.delay < 1){
_local4.delay = 1;
};
_local4.setDelaySpeed(_local4.delay);
_local2++;
};
_local2 = 0;
_local3 = World.getSingleton().meleeWeaponInventory.size();
while (_local2 < _local3) {
_local5 = World.getSingleton().meleeWeaponInventory.get(_local2);
World.getSingleton().meleeWeaponInventory.get(_local2).attackTime = (_local5.attackTime - (_local7 / 2));
if (_local5.attackTime < 1){
_local5.attackTime = 1;
};
_local5.setAttackSpeed(_local5.attackTime);
_local2++;
};
};
} else {
if (_local1.level == 16){
_local8 = 5100;
_local9 = ((World.getSingleton().kills - _local1.lastKillLimit) / (_local8 - _local1.lastKillLimit));
World.getSingleton().menuBar.image.expSign.expBar.width = (800 * _local9);
if (World.getSingleton().kills >= _local8){
if (!World.getSingleton().muted){
levelUpSound.play();
};
if (enemySpawner){
if (enemySpawner.running){
enemySpawner.stop();
enemySpawner.delay = (World.getSingleton().level.enemySpawnerDelay - (25 * _local1.level));
if (enemySpawner.delay < 1){
enemySpawner.delay = 1;
};
enemySpawner.start();
};
};
_local1.lastKillLimit = _local8;
_local1.level++;
_local7 = 15;
billboardMiddle = new MiddleBillboard(("Reload Speed +" + _local7), 50);
while (_local2 < _local3) {
_local4 = World.getSingleton().rangeWeaponInventory.get(_local2);
World.getSingleton().rangeWeaponInventory.get(_local2).reloadTime = (_local4.reloadTime - _local7);
if (_local4.reloadTime < 1){
_local4.reloadTime = 1;
};
_local4.setReloadSpeed(_local4.reloadTime);
_local2++;
};
};
} else {
if (_local1.level == 17){
_local8 = 5600;
_local9 = ((World.getSingleton().kills - _local1.lastKillLimit) / (_local8 - _local1.lastKillLimit));
World.getSingleton().menuBar.image.expSign.expBar.width = (800 * _local9);
if (World.getSingleton().kills >= _local8){
if (!World.getSingleton().muted){
levelUpSound.play();
};
if (enemySpawner){
if (enemySpawner.running){
enemySpawner.stop();
enemySpawner.delay = (World.getSingleton().level.enemySpawnerDelay - (25 * _local1.level));
if (enemySpawner.delay < 1){
enemySpawner.delay = 1;
};
enemySpawner.start();
};
};
_local1.lastKillLimit = _local8;
_local1.level++;
_local7 = 300;
billboardMiddle = new MiddleBillboard(("Attack Damage +" + _local7), 50);
while (_local2 < _local3) {
_local4 = World.getSingleton().rangeWeaponInventory.get(_local2);
World.getSingleton().rangeWeaponInventory.get(_local2).damage = (_local4.damage + _local7);
_local2++;
};
_local2 = 0;
_local3 = World.getSingleton().meleeWeaponInventory.size();
while (_local2 < _local3) {
_local5 = World.getSingleton().meleeWeaponInventory.get(_local2);
World.getSingleton().meleeWeaponInventory.get(_local2).damage = (_local5.damage + _local7);
_local2++;
};
_local2 = 0;
_local3 = World.getSingleton().explosiveWeaponInventory.size();
while (_local2 < _local3) {
_local6 = World.getSingleton().explosiveWeaponInventory.get(_local2);
World.getSingleton().explosiveWeaponInventory.get(_local2).damage = (_local6.damage + _local7);
_local2++;
};
};
} else {
if (_local1.level == 18){
_local8 = 6100;
_local9 = ((World.getSingleton().kills - _local1.lastKillLimit) / (_local8 - _local1.lastKillLimit));
World.getSingleton().menuBar.image.expSign.expBar.width = (800 * _local9);
if (World.getSingleton().kills >= _local8){
if (!World.getSingleton().muted){
levelUpSound.play();
};
if (enemySpawner){
if (enemySpawner.running){
enemySpawner.stop();
enemySpawner.delay = (World.getSingleton().level.enemySpawnerDelay - (25 * _local1.level));
if (enemySpawner.delay < 1){
enemySpawner.delay = 1;
};
enemySpawner.start();
};
};
_local1.lastKillLimit = _local8;
_local1.level++;
_local7 = 5;
billboardMiddle = new MiddleBillboard(("Attack Speed +" + _local7), 50);
while (_local2 < _local3) {
_local4 = World.getSingleton().rangeWeaponInventory.get(_local2);
World.getSingleton().rangeWeaponInventory.get(_local2).delay = (_local4.delay - _local7);
if (_local4.delay < 1){
_local4.delay = 1;
};
_local4.setDelaySpeed(_local4.delay);
_local2++;
};
_local2 = 0;
_local3 = World.getSingleton().meleeWeaponInventory.size();
while (_local2 < _local3) {
_local5 = World.getSingleton().meleeWeaponInventory.get(_local2);
World.getSingleton().meleeWeaponInventory.get(_local2).attackTime = (_local5.attackTime - (_local7 / 2));
if (_local5.attackTime < 1){
_local5.attackTime = 1;
};
_local5.setAttackSpeed(_local5.attackTime);
_local2++;
};
};
} else {
if (_local1.level == 19){
_local8 = 6600;
_local9 = ((World.getSingleton().kills - _local1.lastKillLimit) / (_local8 - _local1.lastKillLimit));
World.getSingleton().menuBar.image.expSign.expBar.width = (800 * _local9);
if (World.getSingleton().kills >= _local8){
if (!World.getSingleton().muted){
levelUpSound.play();
};
if (enemySpawner){
if (enemySpawner.running){
enemySpawner.stop();
enemySpawner.delay = (World.getSingleton().level.enemySpawnerDelay - (25 * _local1.level));
if (enemySpawner.delay < 1){
enemySpawner.delay = 1;
};
enemySpawner.start();
};
};
_local1.lastKillLimit = _local8;
_local1.level++;
_local7 = 50;
billboardMiddle = new MiddleBillboard(("Attack Damage +" + _local7), 50);
while (_local2 < _local3) {
_local4 = World.getSingleton().rangeWeaponInventory.get(_local2);
World.getSingleton().rangeWeaponInventory.get(_local2).damage = (_local4.damage + _local7);
_local2++;
};
_local2 = 0;
_local3 = World.getSingleton().meleeWeaponInventory.size();
while (_local2 < _local3) {
_local5 = World.getSingleton().meleeWeaponInventory.get(_local2);
World.getSingleton().meleeWeaponInventory.get(_local2).damage = (_local5.damage + _local7);
_local2++;
};
_local2 = 0;
_local3 = World.getSingleton().explosiveWeaponInventory.size();
while (_local2 < _local3) {
_local6 = World.getSingleton().explosiveWeaponInventory.get(_local2);
World.getSingleton().explosiveWeaponInventory.get(_local2).damage = (_local6.damage + _local7);
_local2++;
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
}
public function setHighQuality(_arg1:MouseEvent):void{
movieClip.stage.quality = StageQuality.HIGH;
}
public function aim(_arg1:Event):void{
player.aim(this.stage.mouseX, this.stage.mouseY);
}
public function onMouseUp(_arg1:MouseEvent):void{
mousePressed = false;
}
public function onPause():void{
this.addEventListener(Event.ENTER_FRAME, onEnterFrame);
}
public function submitScore(_arg1:MouseEvent):void{
World.getSingleton().menuBar.image.infoBox.visible = true;
World.getSingleton().money = World.getSingleton().startMoney;
World.getSingleton().waveLevel = 0;
World.getSingleton().waveNum = 0;
World.getSingleton().waveCounter = 0;
World.getSingleton().levelDone = 0;
World.getSingleton().kills = 0;
World.getSingleton().removeEventListener(WorldEvent.ON_UPDATE, onUpdate);
destroyEverything(true, true);
submitPressed = true;
World.getSingleton().menuBar.image.resultScreen.gameOverMenu.retryButton.removeEventListener(MouseEvent.CLICK, retryLevel);
World.getSingleton().menuBar.image.resultScreen.gameOverMenu.submitButton.removeEventListener(MouseEvent.CLICK, submitScore);
World.getSingleton().menuBar.image.resultScreen.backToMainMenuButton.removeEventListener(MouseEvent.CLICK, setBackToMainMenu);
World.getSingleton().pauseGame();
World.getSingleton().menuBar.image.resultScreen.visible = false;
World.getSingleton().menuBar.image.optionScreen.visible = false;
World.getSingleton().menuBar.image.infoBox.visible = false;
}
public function closeOptionScreen(_arg1:MouseEvent=null):void{
World.getSingleton().menuBar.image.optionScreen.visible = false;
World.getSingleton().menuBar.image.optionScreen.backToMainMenuButton.removeEventListener(MouseEvent.CLICK, setBackToMainMenu2);
World.getSingleton().menuBar.image.optionScreen.closeBtn.removeEventListener(MouseEvent.CLICK, closeOptionScreen);
World.getSingleton().menuBar.image.optionScreen.lowButton.removeEventListener(MouseEvent.CLICK, setLowQuality);
World.getSingleton().menuBar.image.optionScreen.mediumButton.removeEventListener(MouseEvent.CLICK, setMediumQuality);
World.getSingleton().menuBar.image.optionScreen.highButton.removeEventListener(MouseEvent.CLICK, setHighQuality);
World.getSingleton().menuBar.image.optionScreen.soundButton.removeEventListener(MouseEvent.CLICK, soundMute);
waveTimer.start();
enemySpawner.start();
onResume();
World.getSingleton().startGame();
handCrossHair.image.visible = false;
crossHair.image.visible = true;
}
public function showResult():void{
if (gameOver){
return;
};
gameOver = true;
mousePressed = false;
weaponInventory.destroy();
crossHair.destroy();
handCrossHair.image.visible = true;
Mouse.show();
World.getSingleton().removeEventListener(WorldEvent.ON_INIT, onInit);
enemySpawner.stop();
enemySpawner.removeEventListener(TimerEvent.TIMER, spawnEnemy);
healTimer.stop();
healTimer.removeEventListener(TimerEvent.TIMER, healBarricades);
waveTimer.stop();
if (waveTimer.hasEventListener(TimerEvent.TIMER)){
waveTimer.removeEventListener(TimerEvent.TIMER, reduceWaveTime);
};
this.stage.removeEventListener(Event.ENTER_FRAME, aim);
this.stage.removeEventListener(MouseEvent.MOUSE_DOWN, onMouseDown);
this.stage.removeEventListener(MouseEvent.MOUSE_UP, onMouseUp);
this.stage.removeEventListener(MouseEvent.MOUSE_WHEEL, onMouseWheel);
World.getSingleton().menuBar.image.resultScreen.gotoAndPlay("score");
World.getSingleton().menuBar.image.resultScreen.alpha = 0;
World.getSingleton().menuBar.image.infoBox.visible = false;
World.getSingleton().menuBar.image.resultScreen.visible = true;
World.getSingleton().menuBar.showResultScreen();
World.getSingleton().menuBar.image.resultScreen.gameScoreMenu.nextButton.addEventListener(MouseEvent.CLICK, nextWave);
}
public function onInit(_arg1:Event):void{
mousePressed = false;
initMenuBar();
initPlayer();
initEnemy();
initCrossHair();
initEventListener();
billboardMiddle = new MiddleBillboard(("Day " + (World.getSingleton().waveCounter + 1)), 50);
World.getSingleton().startGame();
World.getSingleton().setDebugMode(false);
}
public function onUpdate(_arg1:Event):void{
Updater.getSingleton().preUpdate();
CollisionDetector.getSingleton().update();
Updater.getSingleton().update();
checkInput();
shoot();
}
public function setBackToMainMenu(_arg1:MouseEvent):void{
World.getSingleton().menuBar.image.infoBox.visible = true;
World.getSingleton().score = 0;
World.getSingleton().money = World.getSingleton().startMoney;
World.getSingleton().waveLevel = 0;
World.getSingleton().waveNum = 0;
World.getSingleton().waveCounter = 0;
World.getSingleton().levelDone = 0;
World.getSingleton().kills = 0;
World.getSingleton().removeEventListener(WorldEvent.ON_UPDATE, onUpdate);
destroyEverything(true, true);
backToMainMenu = true;
World.getSingleton().menuBar.image.resultScreen.gameOverMenu.retryButton.removeEventListener(MouseEvent.CLICK, retryLevel);
World.getSingleton().menuBar.image.resultScreen.gameOverMenu.submitButton.removeEventListener(MouseEvent.CLICK, submitScore);
World.getSingleton().menuBar.image.resultScreen.backToMainMenuButton.removeEventListener(MouseEvent.CLICK, setBackToMainMenu);
World.getSingleton().pauseGame();
World.getSingleton().menuBar.image.resultScreen.visible = false;
World.getSingleton().menuBar.image.optionScreen.visible = false;
World.getSingleton().menuBar.image.infoBox.visible = false;
}
public function closeWeaponInventory(_arg1:MouseEvent=null):void{
enemySpawner.start();
iPressed = true;
weaponInventory.stopDrag2();
weaponInventory.image.visible = false;
World.getSingleton().startGame();
onResume();
waveTimer.start();
handCrossHair.image.visible = false;
crossHair.image.visible = true;
weaponInventory.image.close.removeEventListener(MouseEvent.CLICK, closeWeaponInventory);
}
public function checkInput():void{
if (((keyPoll.isDown(Keyboard.SHIFT)) && (((keyPoll.isDown(Keyboard.LEFT)) || (keyPoll.isDown(65)))))){
player.runLeft();
} else {
if (((keyPoll.isDown(Keyboard.LEFT)) || (keyPoll.isDown(65)))){
player.walkLeft();
};
};
if (((keyPoll.isDown(Keyboard.SHIFT)) && (((keyPoll.isDown(Keyboard.RIGHT)) || (keyPoll.isDown(68)))))){
player.runRight();
} else {
if (((keyPoll.isDown(Keyboard.RIGHT)) || (keyPoll.isDown(68)))){
player.walkRight();
};
};
if (((keyPoll.isDown(Keyboard.UP)) || (keyPoll.isDown(87)))){
player.moveUp();
};
if (((keyPoll.isDown(Keyboard.DOWN)) || (keyPoll.isDown(83)))){
player.moveDown();
};
if (((((((((((keyPoll.isUp(Keyboard.DOWN)) && (keyPoll.isUp(83)))) && (((keyPoll.isUp(Keyboard.UP)) && (keyPoll.isUp(87)))))) && (((keyPoll.isUp(Keyboard.RIGHT)) && (keyPoll.isUp(68)))))) && (((keyPoll.isUp(Keyboard.LEFT)) && (keyPoll.isUp(65)))))) && (keyPoll.isUp(Keyboard.SPACE)))){
player.setIdle();
};
if (keyPoll.isDown(82)){
player.reload();
};
if (keyPoll.isDown(49)){
if (player.primaryWeapon){
player.changeWeapon(player.primaryWeapon);
player.currentWeaponNumber = 1;
};
};
if (keyPoll.isDown(50)){
if (player.secondaryWeapon){
player.changeWeapon(player.secondaryWeapon);
player.currentWeaponNumber = 2;
};
};
if (keyPoll.isDown(51)){
if (player.meleeWeapon){
player.changeWeapon(player.meleeWeapon);
};
};
if (keyPoll.isDown(52)){
if (player.explosiveWeapon){
player.changeWeapon(player.explosiveWeapon);
player.currentWeaponNumber = 3;
};
};
if (keyPoll.isDown(69)){
if (!healTimer.running){
healTimer.start();
};
};
if (keyPoll.isUp(69)){
if (healTimer.running){
healTimer.stop();
};
};
if (keyPoll.isDown(73)){
if (((!(iPressed)) && (!(weaponInventory.image.visible)))){
showWeaponInventory();
} else {
if (!iPressed){
closeWeaponInventory();
};
};
};
if (keyPoll.isUp(73)){
if (iPressed){
iPressed = false;
};
};
if (keyPoll.isDown(Keyboard.ESCAPE)){
if (((!(escPressed)) && (!(World.getSingleton().menuBar.image.optionScreen.visible)))){
escPressed = true;
showOptionScreen();
} else {
if (!escPressed){
closeOptionScreen();
escPressed = true;
};
};
};
if (keyPoll.isUp(Keyboard.ESCAPE)){
if (escPressed){
escPressed = false;
};
};
if (keyPoll.isDown(Keyboard.SPACE)){
if (World.getSingleton().playedCharacter){
World.getSingleton().playedCharacter.jump();
};
};
}
public function healBarricades(_arg1:TimerEvent):void{
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:b2Vec2;
var _local8:Number;
var _local9:b2Vec2;
var _local10:Billboard;
if (World.getSingleton().playedCharacter){
if (World.getSingleton().playedCharacter.body){
if (World.getSingleton().playedCharacter.body.touchedBarricade){
_local2 = World.getSingleton().barricades.size();
_local3 = (_local2 - 1);
_local4 = 150;
_local5 = 10;
_local6 = 5;
while (_local3 >= 0) {
_local7 = World.getSingleton().playedCharacter.position.Copy();
_local7.Subtract(World.getSingleton().barricades.get(_local3).position);
_local7.x = (_local7.x * _local7.x);
_local7.y = (_local7.y * _local7.y);
_local8 = (_local7.x + _local7.y);
_local8 = Math.sqrt(_local8);
if (_local8 <= _local4){
if (World.getSingleton().barricades.get(_local3).health < World.getSingleton().barricades.get(_local3).maxHealth){
if (World.getSingleton().money >= _local6){
World.getSingleton().money = (World.getSingleton().money - _local6);
_local9 = World.getSingleton().barricades.get(_local3).position.Copy();
_local10 = new Billboard(("+" + _local5), _local9.x, _local9.y);
World.getSingleton().barricades.get(_local3).health = (World.getSingleton().barricades.get(_local3).health + _local5);
if (World.getSingleton().barricades.get(_local3).health > World.getSingleton().barricades.get(_local3).maxHealth){
World.getSingleton().barricades.get(_local3).health = World.getSingleton().barricades.get(_local3).maxHealth;
};
};
};
};
_local3--;
};
};
};
};
}
public function retryLevel(_arg1:MouseEvent):void{
var _local2:int;
var _local3:int;
var _local4:NPCFriend;
World.getSingleton().menuBar.image.infoBox.visible = true;
World.getSingleton().removeEventListener(WorldEvent.ON_UPDATE, onUpdate);
destroyEverything(true, true);
retry = true;
World.getSingleton().menuBar.image.resultScreen.gameOverMenu.retryButton.removeEventListener(MouseEvent.CLICK, retryLevel);
World.getSingleton().menuBar.image.resultScreen.gameOverMenu.submitButton.removeEventListener(MouseEvent.CLICK, submitScore);
World.getSingleton().menuBar.image.resultScreen.backToMainMenuButton.removeEventListener(MouseEvent.CLICK, setBackToMainMenu);
World.getSingleton().npcs.clear();
World.getSingleton().playedCharacter = World.getSingleton().savedPlayer;
PlayableCharacter(World.getSingleton().playedCharacter).revive();
_local2 = 0;
_local3 = World.getSingleton().savedPlayer.ammoInventory.size();
while (_local2 < _local3) {
World.getSingleton().savedPlayer.ammoInventory.get(_local2).amount = World.getSingleton().savedAmmoInventory.get(_local2).amount;
_local2++;
};
_local2 = 0;
_local3 = World.getSingleton().savedNpcs.size();
while (_local2 < _local3) {
_local4 = World.getSingleton().savedNpcs.get(_local2);
World.getSingleton().savedNpcs.get(_local2).health = _local4.maxHealth;
_local4.playerOwned = true;
_local4.setIdle();
if (_local4.currentWeapon){
_local4.currentWeapon.initTimer();
};
World.getSingleton().npcs.add(_local4);
_local4.charToFollow = World.getSingleton().playedCharacter;
_local4.health = _local4.maxHealth;
_local4.image.weaponHolderb.alpha = 1;
_local4.image.weaponHolderf.alpha = 1;
_local4.image.weaponHolderb.rotation = 0;
_local4.image.weaponHolderf.rotation = 0;
_local4.reset();
_local4.setIdle();
_local4.bodyPartsGotoAndPlay("idle");
_local4.image.leg.gotoAndPlay("idle");
_local4.image.head.alpha = 1;
_local4.image.head.visible = true;
_local4.initTimer();
_local2++;
};
World.getSingleton().pauseGame();
World.getSingleton().menuBar.image.resultScreen.visible = false;
World.getSingleton().menuBar.image.optionScreen.visible = false;
World.getSingleton().menuBar.image.infoBox.visible = false;
}
public function onMouseDown(_arg1:MouseEvent):void{
mousePressed = true;
}
public function soundMute(_arg1:MouseEvent):void{
var _local2:int;
var _local3:int;
_local2 = 0;
_local3 = World.getSingleton().enemies.size();
if (World.getSingleton().muted){
World.getSingleton().muted = false;
World.getSingleton().menuBar.image.optionScreen.soundButton.gotoAndStop(2);
while (_local2 < _local3) {
if (World.getSingleton().enemies.get(_local2).soundChannel){
World.getSingleton().enemies.get(_local2).soundChannel.stop();
};
World.getSingleton().enemies.get(_local2).soundChannel = World.getSingleton().enemies.get(_local2).sound.play(0, 9999, World.getSingleton().enemies.get(_local2).soundTransform);
_local2++;
};
} else {
World.getSingleton().muted = true;
World.getSingleton().menuBar.image.optionScreen.soundButton.gotoAndStop(1);
while (_local2 < _local3) {
if (World.getSingleton().enemies.get(_local2).soundChannel){
World.getSingleton().enemies.get(_local2).soundChannel.stop();
};
_local2++;
};
};
}
public function showWeaponInventory():void{
enemySpawner.stop();
weaponInventory.image.visible = true;
weaponInventory.refresh();
World.getSingleton().pauseGame();
iPressed = true;
onPause();
handCrossHair.image.visible = true;
crossHair.image.visible = false;
waveTimer.stop();
weaponInventory.image.close.addEventListener(MouseEvent.CLICK, closeWeaponInventory);
}
}
}//package p_gameManager
Section 240
//InitializeGameState (p_gameManager.InitializeGameState)
package p_gameManager {
import Box2D.Common.Math.*;
import p_weapon.*;
import p_singleton.*;
import flash.display.*;
import p_char.p_playable.*;
import p_char.p_nonplayable.*;
import p_crosshair.*;
import p_util.*;
public class InitializeGameState extends GameManager {
public var crossHair:Crosshair;
public var player:PlayableCharacter;
public function InitializeGameState(_arg1:MovieClip){
super(_arg1);
init();
}
public function destroy():void{
if (crossHair){
crossHair.destroy();
};
}
public function init():void{
initPhysicWorld();
initWorldInventory();
initPlayer();
}
public function initCrossHair():void{
crossHair = new Crosshair();
}
public function initWorldInventory():void{
World.getSingleton().initInventory();
World.getSingleton().rangeWeaponInventory.add(new Beretta());
World.getSingleton().rangeWeaponInventory.add(new M4());
World.getSingleton().rangeWeaponInventory.add(new SteyrTMP());
World.getSingleton().rangeWeaponInventory.add(new Shotgun());
World.getSingleton().rangeWeaponInventory.add(new AK());
World.getSingleton().rangeWeaponInventory.add(new Deagle());
World.getSingleton().rangeWeaponInventory.add(new SM5());
World.getSingleton().rangeWeaponInventory.add(new MPU());
World.getSingleton().rangeWeaponInventory.add(new WaltherP99());
World.getSingleton().rangeWeaponInventory.add(new M1911());
World.getSingleton().rangeWeaponInventory.add(new M14());
World.getSingleton().meleeWeaponInventory.add(new Knife());
World.getSingleton().meleeWeaponInventory.add(new BaseBallBat());
World.getSingleton().meleeWeaponInventory.add(new Katana());
World.getSingleton().meleeWeaponInventory.add(new ChainSaw());
World.getSingleton().explosiveWeaponInventory.add(new Grenade());
World.getSingleton().explosiveWeaponInventory.add(new Dynamite());
World.getSingleton().mercInventory.add(new Andrew());
World.getSingleton().mercInventory.add(new Wendy());
World.getSingleton().mercInventory.add(new Bill());
World.getSingleton().mercInventory.add(new Francis());
World.getSingleton().mercInventory.add(new Ivy());
World.getSingleton().mercInventory.add(new Melisa());
World.getSingleton().mercInventory.add(new Darmin());
World.getSingleton().mercInventory.add(new Kris());
World.getSingleton().mercInventory.add(new Louis());
}
public function initPlayer():void{
if (World.getSingleton().playedCharacter){
if (World.getSingleton().playedCharacter.body){
World.getSingleton().physicWorld.DestroyBody(World.getSingleton().playedCharacter.body);
World.getSingleton().playedCharacter.body = null;
};
World.getSingleton().players.remove(World.getSingleton().playedCharacter);
World.getSingleton().playedCharacter = null;
};
player = new FemaleChar();
player.initRigidBody();
World.getSingleton().players.add(player);
player.changeWeapon(player.primaryWeapon);
player.currentWeaponNumber = 1;
World.getSingleton().playedCharacter = player;
}
public function initPhysicWorld():void{
if (!World.getSingleton().physicWorld){
World.getSingleton().initPhysicWorld(new b2Vec2(-100000, -100000), new b2Vec2(100000, 100000), new b2Vec2(0, 50), true, new ContactListener(), new ContactFilterer());
};
}
override public function update():GameManager{
detachFromRoot();
return (new LocationSelectorState(movieClip));
}
}
}//package p_gameManager
Section 241
//InstructionScreen (p_gameManager.InstructionScreen)
package p_gameManager {
import flash.events.*;
import p_singleton.*;
import flash.display.*;
import flash.media.*;
import p_crosshair.*;
import flash.ui.*;
public class InstructionScreen extends GameManager {
public var closePressed:Boolean;
public var image:MovieClip;
public var clickSound:Sound;
public var handCrossHair:HandCrosshair;
public function InstructionScreen(_arg1:MovieClip){
super(_arg1);
image = new instructionScreen();
World.getSingleton().menuRoot.addChild(image);
closePressed = false;
initListener();
initCrossHair();
clickSound = new ClickSound();
}
public function initListener():void{
image.closeBtn.addEventListener(MouseEvent.CLICK, closeInstruction);
}
public function initCrossHair():void{
handCrossHair = new HandCrosshair();
World.getSingleton().mousePointer = handCrossHair;
Mouse.hide();
}
public function destroyCrossHair():void{
Mouse.show();
handCrossHair.destroy();
}
public function closeInstruction(_arg1:MouseEvent):void{
closePressed = true;
if (!World.getSingleton().muted){
clickSound.play();
};
}
override public function update():GameManager{
if (closePressed){
image.closeBtn.removeEventListener(MouseEvent.CLICK, closeInstruction);
World.getSingleton().menuRoot.removeChild(image);
image = null;
detachFromRoot();
destroyCrossHair();
return (new MainMenuState(movieClip));
};
return (this);
}
}
}//package p_gameManager
Section 242
//IntroSponsor (p_gameManager.IntroSponsor)
package p_gameManager {
import flash.display.*;
public class IntroSponsor extends GameManager {
public var image:MovieClip;
public function IntroSponsor(_arg1:MovieClip){
super(_arg1);
image = new introSponsorSplashScreen();
addChild(image);
}
override public function update():GameManager{
if (image){
if (image.animationDone){
this.removeChild(image);
image = null;
detachFromRoot();
return (new TogeIntroScreen(movieClip));
};
};
return (this);
}
}
}//package p_gameManager
Section 243
//LoadingScreen (p_gameManager.LoadingScreen)
package p_gameManager {
import flash.events.*;
import p_singleton.*;
import flash.display.*;
import flash.media.*;
import mochi.as3.*;
public class LoadingScreen extends GameManager {
public var image:MovieClip;
public var playPressed:Boolean;
public var clickSound:Sound;
public var loadingDone:Boolean;
public function LoadingScreen(_arg1:MovieClip){
super(_arg1);
init();
clickSound = new ClickSound();
}
public function init():void{
image = new loaderScreen();
this.addChild(image);
MochiAd.showClickAwayAd({clip:image.adSpace.adSpace, id:"349f9764c411a8cb"});
movieClip.loaderInfo.addEventListener(ProgressEvent.PROGRESS, loadingProgress);
movieClip.loaderInfo.addEventListener(Event.COMPLETE, loadingComplete);
loadingDone = false;
playPressed = false;
}
public function loadingProgress(_arg1:ProgressEvent):void{
var _local2:int;
_local2 = (100 * (movieClip.loaderInfo.bytesLoaded / movieClip.loaderInfo.bytesTotal));
image.progressText.text = (("" + _local2) + "%");
}
public function loadingComplete(_arg1:Event):void{
}
public function playIntro(_arg1:MouseEvent):void{
playPressed = true;
if (!World.getSingleton().muted){
clickSound.play();
};
}
override public function update():GameManager{
var _local1:Loader;
if (movieClip.loaderInfo.bytesLoaded == movieClip.loaderInfo.bytesTotal){
if (!loadingDone){
loadingDone = true;
image.loadingClip.gotoAndStop(2);
image.loadingClip.playBtn.addEventListener(MouseEvent.CLICK, playIntro);
};
};
if (playPressed){
image.loadingClip.playBtn.removeEventListener(MouseEvent.CLICK, playIntro);
movieClip.gotoAndStop(3);
this.removeChild(image);
image = null;
detachFromRoot();
return (new IntroSponsor(movieClip));
};
return (this);
}
}
}//package p_gameManager
Section 244
//LocationSelectorState (p_gameManager.LocationSelectorState)
package p_gameManager {
import flash.events.*;
import p_singleton.*;
import flash.display.*;
import flash.media.*;
import p_crosshair.*;
import flash.ui.*;
public class LocationSelectorState extends GameManager {
public var image:MovieClip;
public var chose:Boolean;// = false
public var handCrossHair:HandCrosshair;
public function LocationSelectorState(_arg1:MovieClip){
chose = false;
super(_arg1);
image = new MapScreen();
World.getSingleton().menuRoot.addChild(image);
disableAll();
initListener();
initCrossHair();
}
public function mouseClick(_arg1:MouseEvent):void{
var _local2:Sound;
MovieClip(_arg1.target).gotoAndStop(2);
World.getSingleton().currentLevelNumber = (MovieClip(_arg1.target).id + 1);
chose = true;
_local2 = new ClickSound();
if (!World.getSingleton().muted){
_local2.play();
};
}
public function initListener():void{
var _local1:int;
var _local2:int;
_local1 = 0;
_local2 = (World.getSingleton().levelDone + 1);
while (_local1 < _local2) {
image.places[("place" + _local1)].gotoAndStop(1);
image.places[("place" + _local1)].id = _local1;
image.places[("place" + _local1)].addEventListener(MouseEvent.MOUSE_OVER, mouseOver);
image.places[("place" + _local1)].addEventListener(MouseEvent.MOUSE_OUT, mouseOut);
image.places[("place" + _local1)].addEventListener(MouseEvent.CLICK, mouseClick);
_local1++;
};
}
public function initCrossHair():void{
handCrossHair = new HandCrosshair();
World.getSingleton().mousePointer = handCrossHair;
Mouse.hide();
}
public function mouseOver(_arg1:MouseEvent):void{
MovieClip(_arg1.target).gotoAndStop(2);
}
public function mouseOut(_arg1:MouseEvent):void{
MovieClip(_arg1.target).gotoAndStop(1);
}
public function removeListener():void{
var _local1:int;
var _local2:int;
_local1 = 0;
_local2 = (World.getSingleton().levelDone + 1);
while (_local1 < _local2) {
image.places[("place" + _local1)].removeEventListener(MouseEvent.MOUSE_OVER, mouseOver);
image.places[("place" + _local1)].removeEventListener(MouseEvent.MOUSE_OUT, mouseOut);
image.places[("place" + _local1)].removeEventListener(MouseEvent.CLICK, mouseClick);
_local1++;
};
}
public function destroyCrossHair():void{
Mouse.show();
handCrossHair.destroy();
}
public function disableAll():void{
var _local1:int;
var _local2:int;
_local1 = 0;
_local2 = 6;
while (_local1 < _local2) {
image.places[("place" + _local1)].gotoAndStop(3);
_local1++;
};
}
override public function update():GameManager{
if (chose){
removeListener();
World.getSingleton().menuRoot.removeChild(image);
detachFromRoot();
image = null;
destroyCrossHair();
if (World.getSingleton().currentLevelNumber == 6){
if (World.getSingleton().gameEnded){
if (World.getSingleton().backGroundSoundChannel){
World.getSingleton().backGroundSoundChannel.stop();
};
return (new EndingMovieSecond(movieClip));
} else {
if (World.getSingleton().backGroundSoundChannel){
World.getSingleton().backGroundSoundChannel.stop();
};
World.getSingleton().gameEnded = true;
return (new EndingMovieFirst(movieClip));
};
};
if ((((World.getSingleton().waveNum == 0)) && ((World.getSingleton().waveLevel == 0)))){
return (new BarricadeState(movieClip));
};
return (new WeaponShopState(movieClip));
};
return (this);
}
}
}//package p_gameManager
Section 245
//MainMenuState (p_gameManager.MainMenuState)
package p_gameManager {
import flash.events.*;
import p_singleton.*;
import flash.display.*;
import flash.media.*;
import p_crosshair.*;
import mochi.as3.*;
import flash.ui.*;
public class MainMenuState extends GameManager {
public var sound:Sound;
public var image:MovieClip;
public var playPressed:Boolean;
public var highscoresPressed:Boolean;
public var clickSound:Sound;
public var handCrossHair:HandCrosshair;
public var instructionPressed:Boolean;
public var creditPressed:Boolean;
public var optionPressed:Boolean;
public function MainMenuState(_arg1:MovieClip){
var movieClip = _arg1;
super(movieClip);
playPressed = false;
instructionPressed = false;
optionPressed = false;
creditPressed = false;
image = new mainMenu();
World.getSingleton().menuRoot.addChild(image);
MochiAd.showClickAwayAd({clip:image.adSpace.adSpace, id:"349f9764c411a8cb", ad_loaded:function ():void{
Mouse.hide();
}});
image.playButton.addEventListener(MouseEvent.CLICK, initializeGame);
image.optionButton.addEventListener(MouseEvent.CLICK, optionMenu);
image.instructionButton.addEventListener(MouseEvent.CLICK, gameInstruction);
image.soundButton.addEventListener(MouseEvent.CLICK, soundMute);
image.creditButton.addEventListener(MouseEvent.CLICK, showCredit);
image.highscoresButton.addEventListener(MouseEvent.CLICK, showScores);
initCrossHair();
clickSound = new ClickSound();
if (World.getSingleton().muted){
image.soundButton.gotoAndStop(1);
} else {
image.soundButton.gotoAndStop(2);
};
sound = new Sound3();
World.getSingleton().backGroundSoundChannel = sound.play(0, 9999);
}
public function initCrossHair():void{
handCrossHair = new HandCrosshair();
World.getSingleton().mousePointer = handCrossHair;
Mouse.hide();
}
public function gameInstruction(_arg1:MouseEvent):void{
instructionPressed = true;
if (!World.getSingleton().muted){
clickSound.play();
};
}
public function optionMenu(_arg1:MouseEvent):void{
optionPressed = true;
if (!World.getSingleton().muted){
clickSound.play();
};
}
public function showCredit(_arg1:MouseEvent):void{
creditPressed = true;
if (!World.getSingleton().muted){
clickSound.play();
};
}
public function destroyCrossHair():void{
Mouse.show();
handCrossHair.destroy();
}
public function initializeGame(_arg1:MouseEvent):void{
playPressed = true;
if (!World.getSingleton().muted){
clickSound.play();
};
}
public function showScores(_arg1:MouseEvent):void{
highscoresPressed = true;
if (!World.getSingleton().muted){
clickSound.play();
};
}
override public function update():GameManager{
if (playPressed){
image.playButton.removeEventListener(MouseEvent.CLICK, initializeGame);
image.optionButton.removeEventListener(MouseEvent.CLICK, optionMenu);
image.instructionButton.removeEventListener(MouseEvent.CLICK, gameInstruction);
image.soundButton.removeEventListener(MouseEvent.CLICK, soundMute);
image.highscoresButton.removeEventListener(MouseEvent.CLICK, showScores);
World.getSingleton().menuRoot.removeChild(image);
detachFromRoot();
image = null;
destroyCrossHair();
if (World.getSingleton().backGroundSoundChannel){
World.getSingleton().backGroundSoundChannel.stop();
};
return (new InitializeGameState(movieClip));
//unresolved jump
};
if (instructionPressed){
image.playButton.removeEventListener(MouseEvent.CLICK, initializeGame);
image.optionButton.removeEventListener(MouseEvent.CLICK, optionMenu);
image.instructionButton.removeEventListener(MouseEvent.CLICK, gameInstruction);
image.soundButton.removeEventListener(MouseEvent.CLICK, soundMute);
image.highscoresButton.removeEventListener(MouseEvent.CLICK, showScores);
World.getSingleton().menuRoot.removeChild(image);
detachFromRoot();
image = null;
destroyCrossHair();
if (World.getSingleton().backGroundSoundChannel){
World.getSingleton().backGroundSoundChannel.stop();
};
return (new InstructionScreen(movieClip));
//unresolved jump
};
if (optionPressed){
image.playButton.removeEventListener(MouseEvent.CLICK, initializeGame);
image.optionButton.removeEventListener(MouseEvent.CLICK, optionMenu);
image.instructionButton.removeEventListener(MouseEvent.CLICK, gameInstruction);
image.soundButton.removeEventListener(MouseEvent.CLICK, soundMute);
image.creditButton.removeEventListener(MouseEvent.CLICK, showCredit);
image.highscoresButton.removeEventListener(MouseEvent.CLICK, showScores);
World.getSingleton().menuRoot.removeChild(image);
detachFromRoot();
image = null;
destroyCrossHair();
if (World.getSingleton().backGroundSoundChannel){
World.getSingleton().backGroundSoundChannel.stop();
};
return (new OptionScreen(movieClip));
//unresolved jump
};
if (creditPressed){
image.playButton.removeEventListener(MouseEvent.CLICK, initializeGame);
image.optionButton.removeEventListener(MouseEvent.CLICK, optionMenu);
image.instructionButton.removeEventListener(MouseEvent.CLICK, gameInstruction);
image.soundButton.removeEventListener(MouseEvent.CLICK, soundMute);
image.creditButton.removeEventListener(MouseEvent.CLICK, showCredit);
image.highscoresButton.removeEventListener(MouseEvent.CLICK, showScores);
World.getSingleton().menuRoot.removeChild(image);
detachFromRoot();
image = null;
destroyCrossHair();
if (World.getSingleton().backGroundSoundChannel){
World.getSingleton().backGroundSoundChannel.stop();
};
return (new CreditState(movieClip));
//unresolved jump
};
if (highscoresPressed){
image.playButton.removeEventListener(MouseEvent.CLICK, initializeGame);
image.optionButton.removeEventListener(MouseEvent.CLICK, optionMenu);
image.instructionButton.removeEventListener(MouseEvent.CLICK, gameInstruction);
image.soundButton.removeEventListener(MouseEvent.CLICK, soundMute);
image.creditButton.removeEventListener(MouseEvent.CLICK, showCredit);
image.highscoresButton.removeEventListener(MouseEvent.CLICK, showScores);
World.getSingleton().menuRoot.removeChild(image);
detachFromRoot();
image = null;
destroyCrossHair();
if (World.getSingleton().backGroundSoundChannel){
World.getSingleton().backGroundSoundChannel.stop();
};
return (new ShowHighScoresState(movieClip));
//unresolved jump
};
return (this);
}
public function soundMute(_arg1:MouseEvent):void{
if (World.getSingleton().muted){
World.getSingleton().muted = false;
image.soundButton.gotoAndStop(2);
if (World.getSingleton().backGroundSoundChannel){
World.getSingleton().backGroundSoundChannel.stop();
World.getSingleton().backGroundSoundChannel = sound.play(0, 9999);
};
} else {
World.getSingleton().muted = true;
image.soundButton.gotoAndStop(1);
if (World.getSingleton().backGroundSoundChannel){
World.getSingleton().backGroundSoundChannel.stop();
};
};
}
}
}//package p_gameManager
Section 246
//OptionScreen (p_gameManager.OptionScreen)
package p_gameManager {
import flash.events.*;
import p_singleton.*;
import flash.display.*;
import flash.media.*;
import p_crosshair.*;
import flash.ui.*;
public class OptionScreen extends GameManager {
public var closePressed:Boolean;
public var image:MovieClip;
public var clickSound:Sound;
public var handCrossHair:HandCrosshair;
public function OptionScreen(_arg1:MovieClip){
super(_arg1);
image = new optionScreen();
World.getSingleton().menuRoot.addChild(image);
closePressed = false;
initListener();
initCrossHair();
clickSound = new ClickSound();
if (World.getSingleton().muted){
image.soundButton.gotoAndStop(1);
} else {
image.soundButton.gotoAndStop(2);
};
}
public function initListener():void{
image.closeBtn.addEventListener(MouseEvent.CLICK, closeInstruction);
image.lowButton.addEventListener(MouseEvent.CLICK, setLowQuality);
image.mediumButton.addEventListener(MouseEvent.CLICK, setMediumQuality);
image.highButton.addEventListener(MouseEvent.CLICK, setHighQuality);
image.soundButton.addEventListener(MouseEvent.CLICK, soundMute);
}
public function setLowQuality(_arg1:MouseEvent):void{
movieClip.stage.quality = StageQuality.LOW;
}
public function initCrossHair():void{
handCrossHair = new HandCrosshair();
World.getSingleton().mousePointer = handCrossHair;
Mouse.hide();
}
public function setHighQuality(_arg1:MouseEvent):void{
movieClip.stage.quality = StageQuality.HIGH;
}
public function destroyCrossHair():void{
Mouse.show();
handCrossHair.destroy();
}
public function setMediumQuality(_arg1:MouseEvent):void{
movieClip.stage.quality = StageQuality.MEDIUM;
}
public function closeInstruction(_arg1:MouseEvent):void{
closePressed = true;
if (!World.getSingleton().muted){
clickSound.play();
};
}
override public function update():GameManager{
if (closePressed){
image.closeBtn.removeEventListener(MouseEvent.CLICK, closeInstruction);
image.lowButton.removeEventListener(MouseEvent.CLICK, setLowQuality);
image.mediumButton.removeEventListener(MouseEvent.CLICK, setMediumQuality);
image.highButton.removeEventListener(MouseEvent.CLICK, setHighQuality);
image.soundButton.removeEventListener(MouseEvent.CLICK, soundMute);
World.getSingleton().menuRoot.removeChild(image);
image = null;
detachFromRoot();
destroyCrossHair();
return (new MainMenuState(movieClip));
};
return (this);
}
public function soundMute(_arg1:MouseEvent):void{
if (World.getSingleton().muted){
World.getSingleton().muted = false;
image.soundButton.gotoAndStop(2);
if (World.getSingleton().backGroundSoundChannel){
World.getSingleton().backGroundSoundChannel.soundTransform.volume = 1;
};
} else {
World.getSingleton().muted = true;
image.soundButton.gotoAndStop(1);
if (World.getSingleton().backGroundSoundChannel){
World.getSingleton().backGroundSoundChannel.soundTransform.volume = 0;
};
};
}
}
}//package p_gameManager
Section 247
//ShowHighScoresState (p_gameManager.ShowHighScoresState)
package p_gameManager {
import p_singleton.*;
import flash.display.*;
import flash.media.*;
import p_crosshair.*;
import mochi.as3.*;
import flash.ui.*;
public class ShowHighScoresState extends GameManager {
public var closePressed:Boolean;
public var image:MovieClip;
public var clickSound:Sound;
public var handCrossHair:HandCrosshair;
public function ShowHighScoresState(_arg1:MovieClip){
super(_arg1);
image = new highscoresClip();
World.getSingleton().menuRoot.addChild(image);
image.loadingClip.visible = true;
closePressed = false;
clickSound = new ClickSound();
connect();
showScores();
initCrossHair();
}
public function initCrossHair():void{
handCrossHair = new HandCrosshair();
World.getSingleton().mousePointer = handCrossHair;
}
public function onClose(_arg1:Object=null):void{
closePressed = true;
}
public function destroyCrossHair():void{
Mouse.show();
handCrossHair.destroy();
}
public function onDoneLoading(_arg1:Object=null):void{
image.loadingClip.visible = true;
}
public function showScores():void{
var o:Object;
var boardID:String;
o = {n:[15, 15, 0, 11, 8, 9, 0, 7, 11, 13, 8, 14, 1, 0, 14, 12], f:function (_arg1:Number, _arg2:String):String{
if (_arg2.length == 16){
return (_arg2);
};
return (this.f((_arg1 + 1), (_arg2 + this.n[_arg1].toString(16))));
}};
boardID = o.f(0, "");
MochiScores.showLeaderboard({boardID:boardID, onDisplay:onDoneLoading});
MochiScores.onCloseHandler = onClose;
}
override public function update():GameManager{
if (closePressed){
World.getSingleton().menuRoot.removeChild(image);
image = null;
detachFromRoot();
destroyCrossHair();
return (new MainMenuState(movieClip));
};
return (this);
}
public function connect():void{
MochiServices.connect("349f9764c411a8cb", movieClip);
}
}
}//package p_gameManager
Section 248
//SubmitHighscoresState (p_gameManager.SubmitHighscoresState)
package p_gameManager {
import flash.events.*;
import p_singleton.*;
import flash.display.*;
import mochi.as3.*;
public class SubmitHighscoresState extends GameManager {
public var image:MovieClip;
public var scoreReceived:Boolean;
public function SubmitHighscoresState(_arg1:MovieClip){
super(_arg1);
scoreReceived = false;
image = new preSubmitHighscores();
image.scoreText.text = ("" + World.getSingleton().score);
image.pleaseWait.visible = false;
addChild(image);
initListener();
}
public function initListener():void{
image.submitButton.addEventListener(MouseEvent.CLICK, submitFunction);
}
public function submitFunction(_arg1:MouseEvent):void{
var o:Object;
var boardID:String;
var e = _arg1;
World.getSingleton().userName = ("" + image.nameText.text);
MochiServices.connect("349f9764c411a8cb", movieClip);
o = {n:[15, 15, 0, 11, 8, 9, 0, 7, 11, 13, 8, 14, 1, 0, 14, 12], f:function (_arg1:Number, _arg2:String):String{
if (_arg2.length == 16){
return (_arg2);
};
return (this.f((_arg1 + 1), (_arg2 + this.n[_arg1].toString(16))));
}};
boardID = o.f(0, "");
MochiScores.setBoardID(boardID);
MochiScores.submit(World.getSingleton().score, World.getSingleton().userName, this, "onScoresReceived");
MochiScores.onCloseHandler = onClose;
MochiScores.onErrorHandler = onClose;
image.submitButton.visible = false;
image.pleaseWait.visible = true;
}
public function removeListener():void{
image.submitButton.removeEventListener(MouseEvent.CLICK, submitFunction);
}
public function onClose(_arg1:Object=null):void{
trace("onClose");
image.submitButton.visible = true;
image.pleaseWait.visible = false;
}
override public function update():GameManager{
if (scoreReceived){
removeChild(image);
detachFromRoot();
removeListener();
return (new ShowHighScoresState(movieClip));
};
return (this);
}
public function onScoresReceived(_arg1:Object):void{
if (_arg1.scores != null){
trace("Scores received!");
World.getSingleton().score = 0;
scoreReceived = true;
} else {
if (_arg1.error){
trace(("Error: " + _arg1.errorCode));
};
};
}
}
}//package p_gameManager
Section 249
//TogeIntroScreen (p_gameManager.TogeIntroScreen)
package p_gameManager {
import p_singleton.*;
import flash.display.*;
import flash.media.*;
public class TogeIntroScreen extends GameManager {
public var sound:Sound;
public var image:MovieClip;
public function TogeIntroScreen(_arg1:MovieClip){
super(_arg1);
image = new introScreen();
addChild(image);
sound = new introductionSound2();
if (!World.getSingleton().muted){
World.getSingleton().backGroundSoundChannel = sound.play(0, 9999);
};
}
override public function update():GameManager{
if (image){
if (image.animationDone){
this.removeChild(image);
image = null;
detachFromRoot();
if (World.getSingleton().backGroundSoundChannel){
World.getSingleton().backGroundSoundChannel.stop();
};
return (new MainMenuState(movieClip));
};
};
return (this);
}
}
}//package p_gameManager
Section 250
//WeaponShopState (p_gameManager.WeaponShopState)
package p_gameManager {
import p_singleton.*;
import flash.display.*;
import p_menuBar.*;
import p_crosshair.*;
import flash.ui.*;
public class WeaponShopState extends GameManager {
public var weaponShop:WeaponShop;
public var handCrossHair:HandCrosshair;
public function WeaponShopState(_arg1:MovieClip){
super(_arg1);
weaponShop = new WeaponShop();
World.getSingleton().menuRoot.addChild(weaponShop.image);
weaponShop.image.warningClip.visible = false;
weaponShop.updateUpKeep();
weaponShop.refresh();
initCrossHair();
}
public function initCrossHair():void{
handCrossHair = new HandCrosshair();
World.getSingleton().mousePointer = handCrossHair;
Mouse.hide();
}
public function destroyCrossHair():void{
Mouse.show();
handCrossHair.destroy();
}
override public function update():GameManager{
if (weaponShop.done){
weaponShop.destroy();
detachFromRoot();
weaponShop = null;
destroyCrossHair();
return (new BarricadeState(movieClip));
};
return (this);
}
}
}//package p_gameManager
Section 251
//Gibs (p_gibs.Gibs)
package p_gibs {
import Box2D.Collision.Shapes.*;
import Box2D.Dynamics.*;
import flash.events.*;
import p_char.*;
import p_singleton.*;
import flash.utils.*;
import p_entity.*;
public class Gibs extends Entity {
public var bodyDef:b2BodyDef;
public var imageTime:int;
public var restitution:Number;
public var circleDef:b2CircleDef;
public var body:b2Body;
public var density:Number;
public var lifeTimer:Timer;
public var polygonDef:b2PolygonDef;
public var imageTimer:Timer;
public var lifeTime:int;
public var numOfGibsType:int;
public var friction:Number;
public var bodyType:int;
public function Gibs(){
density = 1;
friction = 1;
restitution = 0;
lifeTime = 20;
lifeTimer = new Timer(100);
lifeTimer.addEventListener(TimerEvent.TIMER, die);
imageTime = 20;
imageTimer = new Timer(100);
imageTimer.addEventListener(TimerEvent.TIMER, removeImage);
bodyType = BodyType.GIBS;
if (World.getSingleton().gibs.size() > 10){
World.getSingleton().gibs.get(0).lifeTime = 0;
};
}
public function die(_arg1:TimerEvent):void{
if (lifeTime > 0){
lifeTime--;
} else {
if (body){
World.getSingleton().physicWorld.DestroyBody(body);
body = null;
};
if (World.getSingleton().gibs.contains(this)){
World.getSingleton().gibs.remove(this);
};
lifeTimer.stop();
lifeTimer.removeEventListener(TimerEvent.TIMER, die);
imageTimer.start();
};
}
public function removeImage(_arg1:TimerEvent):void{
if (imageTime > 0){
imageTime--;
} else {
if (image){
if (image.parent){
image.parent.removeChild(image);
};
};
imageTimer.stop();
imageTimer.removeEventListener(TimerEvent.TIMER, removeImage);
};
}
override public function initRigidBody():void{
var _local1:b2World;
_local1 = World.getSingleton().physicWorld;
if (_local1){
polygonDef = new b2PolygonDef();
polygonDef.SetAsBox((image.width / (2 * 30)), (image.height / (2 * 30)));
polygonDef.density = density;
polygonDef.friction = friction;
polygonDef.restitution = restitution;
polygonDef.filter.groupIndex = bodyType;
polygonDef.id = "gibs";
bodyDef = new b2BodyDef();
bodyDef.userData = image;
bodyDef.position.Set((position.x / World.physScale), (position.y / World.physScale));
body = _local1.CreateBody(bodyDef);
body.CreateShape(polygonDef);
body.SetMassFromShapes();
body.type = bodyType;
};
}
}
}//package p_gibs
Section 252
//GibsBone (p_gibs.GibsBone)
package p_gibs {
import p_singleton.*;
import flash.utils.*;
public class GibsBone extends Gibs {
public function GibsBone(){
var _local1:int;
var _local2:Class;
super();
numOfGibsType = 3;
_local1 = (Math.round(((Math.random() * 10) + 1)) % numOfGibsType);
_local2 = (getDefinitionByName(("gibs_bone" + _local1)) as Class);
image = new (_local2);
lifeTimer.start();
World.getSingleton().gibs.add(this);
}
private function typedClass():void{
var _local1:gibs_bone0;
var _local2:gibs_bone1;
var _local3:gibs_bone2;
}
}
}//package p_gibs
Section 253
//GibsBrain (p_gibs.GibsBrain)
package p_gibs {
import p_singleton.*;
import flash.utils.*;
public class GibsBrain extends Gibs {
public function GibsBrain(){
var _local1:int;
var _local2:Class;
super();
numOfGibsType = 1;
_local1 = (Math.round(((Math.random() * 10) + 1)) % numOfGibsType);
_local2 = (getDefinitionByName(("gibs_brain" + _local1)) as Class);
image = new (_local2);
lifeTimer.start();
World.getSingleton().gibs.add(this);
}
private function typedClass():void{
var _local1:gibs_brain0;
}
}
}//package p_gibs
Section 254
//GibsHead (p_gibs.GibsHead)
package p_gibs {
import Box2D.Collision.Shapes.*;
import Box2D.Dynamics.*;
import p_singleton.*;
public class GibsHead extends Gibs {
public function GibsHead(){
lifeTimer.start();
World.getSingleton().gibs.add(this);
}
override public function initRigidBody():void{
var _local1:b2World;
_local1 = World.getSingleton().physicWorld;
if (_local1){
circleDef = new b2CircleDef();
circleDef.radius = (image.width / (2 * 30));
circleDef.friction = friction;
circleDef.restitution = restitution;
circleDef.density = density;
circleDef.filter.groupIndex = bodyType;
circleDef.id = "gibs";
bodyDef = new b2BodyDef();
bodyDef.userData = image;
bodyDef.position.Set((position.x / World.physScale), (position.y / World.physScale));
body = _local1.CreateBody(bodyDef);
body.CreateShape(circleDef);
body.SetMassFromShapes();
body.type = bodyType;
};
}
}
}//package p_gibs
Section 255
//GibsMeat (p_gibs.GibsMeat)
package p_gibs {
import p_singleton.*;
import flash.utils.*;
public class GibsMeat extends Gibs {
public function GibsMeat(){
var _local1:int;
var _local2:Class;
super();
numOfGibsType = 6;
_local1 = (Math.round(((Math.random() * 10) + 1)) % numOfGibsType);
_local2 = (getDefinitionByName(("gibs_meat" + _local1)) as Class);
image = new (_local2);
lifeTimer.start();
World.getSingleton().gibs.add(this);
}
private function typedClass():void{
var _local1:gibs_meat0;
var _local2:gibs_meat1;
var _local3:gibs_meat2;
var _local4:gibs_meat3;
var _local5:gibs_meat4;
var _local6:gibs_meat5;
}
}
}//package p_gibs
Section 256
//ItemHealth (p_item.ItemHealth)
package p_item {
import p_singleton.*;
public class ItemHealth extends ItemPickUp {
public function ItemHealth(){
density = 1;
friction = 1;
restitution = 0;
bonusTotal = 50;
image = new medikit();
logo = new medikit();
type = ItemPickUpType.HEALTH;
World.getSingleton().level.playerGround.addChild(image);
}
}
}//package p_item
Section 257
//ItemPickUp (p_item.ItemPickUp)
package p_item {
import Box2D.Collision.Shapes.*;
import Box2D.Dynamics.*;
import flash.events.*;
import p_char.*;
import p_singleton.*;
import flash.display.*;
import org.idmedia.as3commons.util.*;
import flash.media.*;
import flash.utils.*;
import p_entity.*;
public class ItemPickUp extends Entity {
public var bodyDef:b2BodyDef;
public var lifeTime:int;
public var amount:int;
public var friction:Number;
public var body:b2Body;
public var bonusTotal:Number;
public var density:Number;
public var polygonDef:b2PolygonDef;
public var lifeTimer:Timer;
public var restitution:Number;
public var logo:MovieClip;
public var type:String;
public var bodyType:int;
public function ItemPickUp(){
amount = 1;
bodyType = BodyType.ITEM_PICK_UP;
lifeTime = 100;
lifeTimer = new Timer(100);
lifeTimer.addEventListener(TimerEvent.TIMER, reduceLifeTime);
lifeTimer.start();
}
public function getItem(_arg1:int):ItemPickUp{
if (_arg1 == 0){
return (new ItemHealth());
};
return (this);
}
override public function update():void{
var _local1:Sound;
var _local2:ArrayList;
var _local3:int;
var _local4:ArrayList;
var _local5:int;
var _local6:int;
var _local7:int;
super.update();
if (body){
if (body.touchedChar){
body.touchedChar = false;
destroy();
if (type == ItemPickUpType.HEALTH){
_local1 = new healthSound();
if (!World.getSingleton().muted){
_local1.play();
};
_local2 = World.getSingleton().players;
_local3 = _local2.size();
_local4 = World.getSingleton().npcs;
_local5 = _local4.size();
bonusTotal = (bonusTotal / (_local3 + _local5));
_local6 = (_local3 - 1);
_local7 = (_local5 - 1);
while (_local6 >= 0) {
_local2.get(_local6).health = (_local2.get(_local6).health + bonusTotal);
if (_local2.get(_local6).health > _local2.get(_local6).maxHealth){
_local2.get(_local6).health = _local2.get(_local6).maxHealth;
};
_local6--;
};
while (_local7 >= 0) {
_local4.get(_local7).health = (_local4.get(_local7).health + bonusTotal);
if (_local4.get(_local7).health > _local4.get(_local7).maxHealth){
_local4.get(_local7).health = _local4.get(_local7).maxHealth;
};
_local7--;
};
};
};
};
}
public function reduceLifeTime(_arg1:TimerEvent):void{
if (lifeTime > 0){
lifeTime--;
} else {
destroy();
};
}
public function destroy():void{
lifeTimer.stop();
lifeTimer.removeEventListener(TimerEvent.TIMER, reduceLifeTime);
if (image){
if (World.getSingleton().level){
World.getSingleton().level.playerGround.removeChild(image);
};
};
if (body){
World.getSingleton().physicWorld.DestroyBody(body);
body = null;
};
World.getSingleton().itemPickUps.remove(this);
}
override public function initRigidBody():void{
var _local1:b2World;
_local1 = World.getSingleton().physicWorld;
if (_local1){
polygonDef = new b2PolygonDef();
polygonDef.SetAsBox((image.width / (2 * 30)), (image.height / (2 * 30)));
polygonDef.density = density;
polygonDef.friction = friction;
polygonDef.restitution = restitution;
polygonDef.filter.groupIndex = bodyType;
bodyDef = new b2BodyDef();
bodyDef.userData = image;
bodyDef.position.Set((position.x / World.physScale), (position.y / World.physScale));
body = _local1.CreateBody(bodyDef);
body.CreateShape(polygonDef);
body.SetMassFromShapes();
body.type = bodyType;
};
}
}
}//package p_item
Section 258
//ItemPickUpType (p_item.ItemPickUpType)
package p_item {
public class ItemPickUpType {
public static var HEALTH:String = "health";
public static var AMMO_357:String = "3.57";
public static var AMMO_556:String = "5.56";
public static var AMMO_762:String = "7.62";
public static var AMMO_12_GAUGE:String = "12 gauge";
public static var GRENADE:String = "grenade";
public static var AMMO_45:String = ".45";
public static var WALTHER_P99:String = "Walther P99";
public static var STEYR_TMP:String = "Steyr TMP";
public static var AMMO_9MM:String = "9mm";
public static var KEY:String = "key";
}
}//package p_item
Section 259
//LevelManager (p_levelManager.LevelManager)
package p_levelManager {
import p_gamelevel.*;
import flash.media.*;
public class LevelManager {
private var sound:Sound;
private static var INSTANCE:LevelManager;
public function getLevel(_arg1:int):GameLevel{
if (_arg1 == 1){
return (new Level1());
};
if (_arg1 == 2){
return (new Level2());
};
if (_arg1 == 3){
return (new Level3());
};
if (_arg1 == 4){
return (new Level4());
};
if (_arg1 == 5){
return (new Level5());
};
return (new Level1());
}
public static function getSingleton():LevelManager{
if (INSTANCE == null){
INSTANCE = new (LevelManager);
};
return (INSTANCE);
}
}
}//package p_levelManager
Section 260
//BarricadeShop (p_menuBar.BarricadeShop)
package p_menuBar {
import Box2D.Common.Math.*;
import flash.events.*;
import p_singleton.*;
import flash.display.*;
import flash.media.*;
import flash.utils.*;
import p_barricade.*;
public class BarricadeShop {
public var maxPage:int;
public var finish:Boolean;
public var image:MovieClip;
public var sellSound:Sound;
public var page:int;
public var buySound:Sound;
public function BarricadeShop(){
page = 0;
maxPage = 2;
image = new barricadeShop();
if (World.getSingleton().level){
image.barricadeLimit.text = ("" + World.getSingleton().level.maxBarricade);
};
finish = false;
giveId();
addListener();
buySound = new BuySound();
sellSound = new SellSound();
}
public function showItems():void{
var _local1:Class;
var _local2:Barricade;
_local1 = (getDefinitionByName(("barricadeA" + page)) as Class);
_local2 = new (_local1);
_local2.scaleX = (_local2.scaleX * 0.5);
_local2.scaleY = (_local2.scaleY * 0.5);
image.barricade0.addChild(_local2);
_local1 = (getDefinitionByName(("barricadeB" + page)) as Class);
_local2 = new (_local1);
_local2.scaleX = (_local2.scaleX * 0.5);
_local2.scaleY = (_local2.scaleY * 0.5);
image.barricade1.addChild(_local2);
}
public function buy(_arg1:MouseEvent):void{
var _local2:Barricade;
var _local3:Class;
var _local4:b2Vec2;
var _local5:b2Vec2;
var _local6:b2Vec2;
var _local7:int;
var _local8:int;
if (World.getSingleton().playedCharacter){
if (World.getSingleton().level){
if (World.getSingleton().barricades.size() >= World.getSingleton().level.maxBarricade){
return;
};
};
_local4 = World.getSingleton().playedCharacter.position;
_local5 = World.getSingleton().playedCharacter.direction;
_local6 = new b2Vec2();
_local6.x = (_local4.x + (_local5.x * 60));
_local6.y = _local4.y;
_local7 = Barricade.price;
_local8 = 500;
if (MovieClip(_arg1.target.parent).id == 0){
_local3 = (getDefinitionByName(("barricadeA" + page)) as Class);
_local2 = new (_local3);
_local7 = (_local7 * (page + 1));
_local7 = (_local7 + (400 * page));
_local8 = (_local8 * (page + 1));
_local8 = (_local8 + 50);
} else {
if (MovieClip(_arg1.target.parent).id == 1){
_local3 = (getDefinitionByName(("barricadeB" + page)) as Class);
_local2 = new (_local3);
_local7 = (_local7 * (page + 1));
_local7 = (_local7 + 100);
_local7 = (_local7 + (600 * page));
_local8 = (_local8 * (page + 1));
_local8 = (_local8 + 80);
};
};
if (World.getSingleton().money < _local7){
return;
};
World.getSingleton().money = (World.getSingleton().money - _local7);
_local2.health = _local8;
_local2.maxHealth = _local2.health;
_local2.position.x = _local6.x;
_local2.position.y = _local6.y;
_local2.x = _local6.x;
_local2.y = _local6.y;
_local2.initTimer();
_local2.initRigidBody();
_local2.localPrice = _local7;
World.getSingleton().level.backGround.addChild(_local2);
World.getSingleton().barricades.add(_local2);
refresh();
if (!World.getSingleton().muted){
buySound.play();
};
};
}
public function destroy():void{
removeListener();
World.getSingleton().menuRoot.removeChild(image);
}
public function giveId():void{
image.barricade0.id = 0;
image.barricade1.id = 1;
image.infoBarricade0.mouseOut = true;
image.infoBarricade1.mouseOut = true;
}
public function update(_arg1:Event):void{
if (image.infoBarricade0.mouseOut){
if (image.infoBarricade0.x < 764.5){
image.infoBarricade0.x = (image.infoBarricade0.x + 5);
};
} else {
if (!image.infoBarricade0.mouseOut){
if (image.infoBarricade0.x > 614.5){
image.infoBarricade0.x = (image.infoBarricade0.x - 5);
};
};
};
if (image.infoBarricade1.mouseOut){
if (image.infoBarricade1.x < 764.5){
image.infoBarricade1.x = (image.infoBarricade1.x + 5);
};
} else {
if (!image.infoBarricade1.mouseOut){
if (image.infoBarricade1.x > 614.5){
image.infoBarricade1.x = (image.infoBarricade1.x - 5);
};
};
};
image.barricadeLimit.text = ("" + (World.getSingleton().level.maxBarricade - World.getSingleton().barricades.size()));
if (World.getSingleton().playerInsideBarricade){
image.startButton.alpha = 0.5;
SimpleButton(image.startButton).enabled = false;
} else {
image.startButton.alpha = 1;
SimpleButton(image.startButton).enabled = true;
};
}
public function addImageToMenuRoot():void{
World.getSingleton().menuRoot.addChild(image);
}
public function removeListener():void{
image.barricade0.removeEventListener(MouseEvent.CLICK, buy);
image.barricade0.removeEventListener(MouseEvent.MOUSE_OVER, mouseOver);
image.barricade0.removeEventListener(MouseEvent.MOUSE_OUT, mouseOut);
image.barricade1.removeEventListener(MouseEvent.CLICK, buy);
image.barricade1.removeEventListener(MouseEvent.MOUSE_OVER, mouseOver);
image.barricade1.removeEventListener(MouseEvent.MOUSE_OUT, mouseOut);
image.chooserBox.prevButton.removeEventListener(MouseEvent.CLICK, prevPage);
image.chooserBox.nextButton.removeEventListener(MouseEvent.CLICK, nextPage);
image.startButton.removeEventListener(MouseEvent.CLICK, finishShop);
image.removeEventListener(Event.ENTER_FRAME, update);
}
public function mouseOver(_arg1:MouseEvent):void{
var _local2:int;
var _local3:int;
_local2 = Barricade.price;
_local3 = 500;
if (MovieClip(_arg1.target.parent).id == 0){
image.infoBarricade0.mouseOut = false;
_local2 = (_local2 * (page + 1));
_local2 = (_local2 + (400 * page));
_local3 = (_local3 * (page + 1));
_local3 = (_local3 + 50);
image.infoBarricade0.price.text = ("$ " + _local2);
image.infoBarricade0.durability.text = (("" + _local3) + " dmg");
} else {
if (MovieClip(_arg1.target.parent).id == 1){
image.infoBarricade1.mouseOut = false;
_local2 = (_local2 * (page + 1));
_local2 = (_local2 + 100);
_local2 = (_local2 + (600 * page));
_local3 = (_local3 * (page + 1));
_local3 = (_local3 + 250);
image.infoBarricade1.price.text = ("$ " + _local2);
image.infoBarricade1.durability.text = (("" + _local3) + " dmg");
};
};
_arg1.updateAfterEvent();
}
public function removeItems():void{
if (image.barricade0.numChildren > 0){
image.barricade0.removeChildAt(image.barricade0.getChildAt(0));
};
if (image.barricade1.numChildren > 0){
image.barricade1.removeChildAt(image.barricade1.getChildAt(0));
};
}
public function prevPage(_arg1:MouseEvent):void{
if (page > 0){
page--;
refresh();
};
}
public function refresh():void{
removeItems();
showItems();
if (World.getSingleton().level){
image.barricadeLimit.text = ("" + (World.getSingleton().level.maxBarricade - World.getSingleton().barricades.size()));
};
}
private function typedClass():void{
var _local1:TestBox0;
var _local2:TestBox1;
var _local3:TestTriangleA0;
var _local4:TestTriangleA1;
var _local5:TestTriangleB0;
var _local6:TestTriangleB1;
var _local7:TestRect0;
var _local8:TestRect1;
var _local9:barricadeA0;
var _local10:barricadeB0;
var _local11:barricadeA1;
var _local12:barricadeB1;
}
public function mouseOut(_arg1:MouseEvent):void{
if (MovieClip(_arg1.target.parent).id == 0){
image.infoBarricade0.mouseOut = true;
} else {
if (MovieClip(_arg1.target.parent).id == 1){
image.infoBarricade1.mouseOut = true;
};
};
}
public function nextPage(_arg1:MouseEvent):void{
if (page < (maxPage - 1)){
page++;
refresh();
};
}
public function addListener():void{
image.addEventListener(Event.ENTER_FRAME, update);
image.barricade0.addEventListener(MouseEvent.CLICK, buy);
image.barricade0.addEventListener(MouseEvent.MOUSE_OVER, mouseOver);
image.barricade0.addEventListener(MouseEvent.MOUSE_OUT, mouseOut);
image.barricade1.addEventListener(MouseEvent.CLICK, buy);
image.barricade1.addEventListener(MouseEvent.MOUSE_OVER, mouseOver);
image.barricade1.addEventListener(MouseEvent.MOUSE_OUT, mouseOut);
image.chooserBox.prevButton.addEventListener(MouseEvent.CLICK, prevPage);
image.chooserBox.nextButton.addEventListener(MouseEvent.CLICK, nextPage);
image.startButton.addEventListener(MouseEvent.CLICK, finishShop);
}
public function finishShop(_arg1:MouseEvent):void{
if (!World.getSingleton().playerInsideBarricade){
finish = true;
};
}
}
}//package p_menuBar
Section 261
//MenuBar (p_menuBar.MenuBar)
package p_menuBar {
import flash.events.*;
import p_weapon.*;
import p_singleton.*;
import flash.display.*;
import flash.utils.*;
public class MenuBar {
public var timer:Timer;
public var image:MovieClip;
public function MenuBar(){
image = new menuBarClip();
World.getSingleton().menuRoot.addChild(image);
timer = new Timer(100);
timer.addEventListener(TimerEvent.TIMER, fadeIn);
addListener();
}
public function fadeIn(_arg1:TimerEvent):void{
image.resultScreen.alpha = (image.resultScreen.alpha + 0.05);
if (image.resultScreen.alpha >= 1){
timer.stop();
};
}
public function showResultScreen():void{
image.resultScreen.alpha = 0;
if (World.getSingleton().currentLevelNumber == 1){
image.resultScreen.gameScoreMenu.locationName.text = "Home Sweet Home";
} else {
if (World.getSingleton().currentLevelNumber == 2){
image.resultScreen.gameScoreMenu.locationName.text = "Supermart";
} else {
if (World.getSingleton().currentLevelNumber == 3){
image.resultScreen.gameScoreMenu.locationName.text = "Apartment";
} else {
if (World.getSingleton().currentLevelNumber == 4){
image.resultScreen.gameScoreMenu.locationName.text = "Police HQ";
} else {
if (World.getSingleton().currentLevelNumber == 5){
image.resultScreen.gameScoreMenu.locationName.text = "Military Checkpoint";
} else {
if (World.getSingleton().currentLevelNumber == 6){
image.resultScreen.gameScoreMenu.locationName.text = "Harbor";
};
};
};
};
};
};
image.resultScreen.gameScoreMenu.dayText.text = ("" + (World.getSingleton().waveCounter + 1));
image.resultScreen.gameScoreMenu.killText.text = ("" + World.getSingleton().kills);
image.resultScreen.gameScoreMenu.scoreText.text = ("" + World.getSingleton().score);
image.resultScreen.gameOverMenu.scoreText.text = ("" + World.getSingleton().score);
image.resultScreen.gameScoreMenu.advanceText.text = (("" + ((World.getSingleton().numOfWave - 1) - World.getSingleton().waveNum)) + " more days to advance");
timer.start();
}
public function update(_arg1:Event):void{
var _local2:Number;
var _local3:Number;
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:Weapon;
if (World.getSingleton().players.size() > 0){
_local2 = World.getSingleton().money;
_local3 = World.getSingleton().playedCharacter.health;
image.money.text = ("" + _local2);
image.health.text = ("" + Math.round(_local3));
if (World.getSingleton().level){
image.kills.text = ("" + World.getSingleton().level.enemyKilled);
};
_local4 = World.getSingleton().waveTime;
_local5 = (_local4 / 60);
_local6 = (_local4 % 60);
image.minute.text = ("" + _local5);
image.second.text = ("" + _local6);
_local7 = World.getSingleton().playedCharacter.currentWeapon;
if (_local7){
image.weaponName.text = _local7.id;
image.weaponPic.gotoAndStop(_local7.id);
if (_local7.weaponType == WeaponType.RANGE){
image.ammo.text = ("" + RangeWeapon(_local7).ammo);
image.reloadAmmo.text = ("" + RangeWeapon(_local7).ammoType.amount);
} else {
if (_local7.weaponType == WeaponType.MELEE){
image.ammo.text = "~";
image.reloadAmmo.text = "~";
} else {
if (_local7.weaponType == WeaponType.EXPLOSIVE){
image.ammo.text = ("" + ExplosiveWeapon(_local7).ammo);
image.reloadAmmo.text = ("" + ExplosiveWeapon(_local7).reloadAmmo);
};
};
};
};
} else {
image.health.text = "0";
};
}
public function addListener():void{
image.addEventListener(Event.ENTER_FRAME, update);
}
public function removeListener():void{
image.removeEventListener(Event.ENTER_FRAME, update);
}
}
}//package p_menuBar
Section 262
//WeaponInventory (p_menuBar.WeaponInventory)
package p_menuBar {
import flash.events.*;
import p_weapon.*;
import p_singleton.*;
import flash.display.*;
import p_char.p_playable.*;
import p_ammo.*;
import p_util.*;
public class WeaponInventory {
public var draggedItem:MovieClip;
public var page:int;
public var prevPositionX:Number;
public var prevPositionY:Number;
public var player:PlayableCharacter;
public var image:MovieClip;
public var numOfItemsInOnePage:int;
public var weaponType:String;
public function WeaponInventory(_arg1:PlayableCharacter){
numOfItemsInOnePage = 6;
this.player = _arg1;
image = new weaponInventory();
World.getSingleton().menuRoot.addChild(image);
weaponType = WeaponType.RANGE;
page = 0;
initListener();
giveId();
image.explanationBox.ammoType.alpha = 0;
image.explanationBox.priceText.visible = false;
image.explanationBox.priceLabel.visible = false;
image.explanationBox.ownedLabel.visible = false;
image.explanationBox.ownedText.visible = false;
image.chooserBox.prevButton.addEventListener(MouseEvent.CLICK, prevPage);
image.chooserBox.nextButton.addEventListener(MouseEvent.CLICK, nextPage);
}
public function giveId():void{
var _local1:int;
var _local2:int;
_local1 = 0;
_local2 = numOfItemsInOnePage;
while (_local1 < _local2) {
image.weaponOption[("holder" + _local1)].id = _local1;
image.weaponOption[("holder" + _local1)].prevX = image.weaponOption[("holder" + _local1)].x;
image.weaponOption[("holder" + _local1)].prevY = image.weaponOption[("holder" + _local1)].y;
_local1++;
};
}
public function showFireArmWeapons(_arg1:MouseEvent):void{
weaponType = WeaponType.RANGE;
page = 0;
image.chooserBox.pageNumber.text = ("" + (page + 1));
refresh();
}
public function removeListener():void{
var _local1:int;
var _local2:int;
_local1 = 0;
_local2 = numOfItemsInOnePage;
while (_local1 < _local2) {
if (image.weaponOption[("holder" + _local1)].hasEventListener(MouseEvent.MOUSE_DOWN)){
image.weaponOption[("holder" + _local1)].removeEventListener(MouseEvent.MOUSE_DOWN, startDrag);
};
if (image.weaponOption[("holder" + _local1)].hasEventListener(MouseEvent.MOUSE_UP)){
image.weaponOption[("holder" + _local1)].removeEventListener(MouseEvent.MOUSE_UP, stopDrag);
};
_local1++;
};
}
public function refresh():void{
if (player.primaryWeapon){
image.equipBox.primaryWeapon.addChild(player.primaryWeapon.logo);
};
if (player.secondaryWeapon){
image.equipBox.secondaryWeapon.addChild(player.secondaryWeapon.logo);
};
if (player.meleeWeapon){
image.equipBox.meleeWeapon.addChild(player.meleeWeapon.logo);
};
if (player.explosiveWeapon){
image.equipBox.explosiveWeapon.addChild(player.explosiveWeapon.logo);
};
image.equipBox.ammo12gaugeText.text = ("x " + player.ammoInventory.get(0).amount);
image.equipBox.ammo357Text.text = ("x " + player.ammoInventory.get(1).amount);
image.equipBox.ammo45Text.text = ("x " + player.ammoInventory.get(2).amount);
image.equipBox.ammo556Text.text = ("x " + player.ammoInventory.get(3).amount);
image.equipBox.ammo762Text.text = ("x " + player.ammoInventory.get(4).amount);
image.equipBox.ammo9mmText.text = ("x " + player.ammoInventory.get(5).amount);
removeListener();
clearWeaponImages();
showWeapons();
}
public function showMeleeWeapons(_arg1:MouseEvent):void{
weaponType = WeaponType.MELEE;
page = 0;
image.chooserBox.pageNumber.text = ("" + (page + 1));
refresh();
}
public function nextPage(_arg1:MouseEvent):void{
if (page < 3){
page++;
image.chooserBox.pageNumber.text = ("" + (page + 1));
refresh();
};
}
public function startDrag(_arg1:MouseEvent):void{
var _local2:int;
_local2 = MovieClip(_arg1.target.parent).id;
showExplanation(_arg1);
draggedItem = image.weaponOption[("holder" + _local2)];
draggedItem.startDrag();
}
public function initListener():void{
MovieClip(image.fireArm).addEventListener(MouseEvent.CLICK, showFireArmWeapons);
MovieClip(image.melee).addEventListener(MouseEvent.CLICK, showMeleeWeapons);
MovieClip(image.explosive).addEventListener(MouseEvent.CLICK, showExplosiveWeapons);
image.equipBox.switchButton.addEventListener(MouseEvent.CLICK, switchWeapon);
}
public function stopDrag(_arg1:MouseEvent=null):void{
var _local2:int;
if (draggedItem){
_local2 = MovieClip(_arg1.target.parent).id;
changeWeaponLogo(_arg1);
image.weaponOption[("holder" + _local2)].stopDrag();
image.weaponOption[("holder" + _local2)].x = image.weaponOption[("holder" + _local2)].prevX;
image.weaponOption[("holder" + _local2)].y = image.weaponOption[("holder" + _local2)].prevY;
draggedItem = null;
};
}
public function showExplosiveWeapons(_arg1:MouseEvent):void{
weaponType = WeaponType.EXPLOSIVE;
page = 0;
image.chooserBox.pageNumber.text = ("" + (page + 1));
refresh();
}
public function clearWeaponImages():void{
var _local1:int;
var _local2:int;
var _local3:int;
var _local4:int;
_local1 = 0;
_local2 = numOfItemsInOnePage;
while (_local1 < _local2) {
if (image.weaponOption[("holder" + _local1)].numChildren > 0){
_local3 = 0;
_local4 = image.weaponOption[("holder" + _local1)].numChildren;
_local3 = (_local4 - 1);
while (_local3 >= 0) {
image.weaponOption[("holder" + _local1)].removeChildAt(_local3);
_local3--;
};
};
_local1++;
};
}
public function prevPage(_arg1:MouseEvent):void{
if (page > 0){
page--;
image.chooserBox.pageNumber.text = ("" + (page + 1));
refresh();
};
}
public function stopDrag2(_arg1:Event=null):void{
if (draggedItem){
draggedItem.stopDrag();
draggedItem.x = prevPositionX;
draggedItem.y = prevPositionY;
draggedItem = null;
};
}
public function switchWeapon(_arg1:MouseEvent):void{
var _local2:RangeWeapon;
var _local3:MovieClip;
if (((player.primaryWeapon) && (player.secondaryWeapon))){
_local2 = player.primaryWeapon;
player.primaryWeapon = player.secondaryWeapon;
player.secondaryWeapon = _local2;
_local3 = image.equipBox.primaryWeapon.getChildAt(2);
if (image.equipBox.primaryWeapon.numChildren > 2){
image.equipBox.primaryWeapon.removeChildAt(2);
};
image.equipBox.primaryWeapon.addChild(image.equipBox.secondaryWeapon.getChildAt(2));
if (image.equipBox.secondaryWeapon.numChildren > 2){
image.equipBox.secondaryWeapon.removeChildAt(2);
};
image.equipBox.secondaryWeapon.addChild(_local3);
if (player.currentWeapon == player.primaryWeapon){
player.changeWeapon(player.primaryWeapon);
} else {
if (player.currentWeapon == player.secondaryWeapon){
player.changeWeapon(player.secondaryWeapon);
};
};
};
}
public function showWeapons():void{
var _local1:int;
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:MovieClip;
_local1 = 0;
_local4 = 0;
if (weaponType == WeaponType.RANGE){
_local2 = player.rangeWeaponInventory.size();
_local1 = (0 + (page * numOfItemsInOnePage));
_local3 = 0;
if (_local1 < _local2){
while (_local1 < _local2) {
if (_local3 < numOfItemsInOnePage){
image.weaponOption[("holder" + _local3)].addEventListener(MouseEvent.MOUSE_DOWN, startDrag);
image.weaponOption[("holder" + _local3)].addEventListener(MouseEvent.MOUSE_UP, stopDrag);
image.weaponOption[("holder" + _local3)].addChild(DisplayObjectModifier.duplicateMovieClip(player.rangeWeaponInventory.get(_local1).logo));
_local5 = image.weaponOption[("holder" + _local3)].numChildren;
_local4 = 0;
while (_local4 < _local5) {
_local6 = image.weaponOption[("holder" + _local3)].getChildAt(_local4);
_local6.id = _local3;
_local4++;
};
_local3++;
};
_local1++;
};
};
} else {
if (weaponType == WeaponType.MELEE){
_local2 = player.meleeWeaponInventory.size();
_local1 = (0 + (page * numOfItemsInOnePage));
_local3 = 0;
if (_local1 < _local2){
while (_local1 < _local2) {
if (_local3 < numOfItemsInOnePage){
image.weaponOption[("holder" + _local3)].addEventListener(MouseEvent.MOUSE_DOWN, startDrag);
image.weaponOption[("holder" + _local3)].addEventListener(MouseEvent.MOUSE_UP, stopDrag);
image.weaponOption[("holder" + _local3)].addChild(DisplayObjectModifier.duplicateMovieClip(player.meleeWeaponInventory.get(_local1).logo));
_local5 = image.weaponOption[("holder" + _local3)].numChildren;
_local4 = 0;
while (_local4 < _local5) {
_local6 = image.weaponOption[("holder" + _local3)].getChildAt(_local4);
_local6.id = _local3;
_local4++;
};
_local3++;
};
_local1++;
};
};
} else {
if (weaponType == WeaponType.EXPLOSIVE){
_local2 = player.explosiveWeaponInventory.size();
_local1 = (0 + (page * numOfItemsInOnePage));
_local3 = 0;
if (_local1 < _local2){
while (_local1 < _local2) {
if (_local3 < numOfItemsInOnePage){
image.weaponOption[("holder" + _local3)].addEventListener(MouseEvent.MOUSE_DOWN, startDrag);
image.weaponOption[("holder" + _local3)].addEventListener(MouseEvent.MOUSE_UP, stopDrag);
image.weaponOption[("holder" + _local3)].addChild(DisplayObjectModifier.duplicateMovieClip(player.explosiveWeaponInventory.get(_local1).logo));
_local5 = image.weaponOption[("holder" + _local3)].numChildren;
_local4 = 0;
while (_local4 < _local5) {
_local6 = image.weaponOption[("holder" + _local3)].getChildAt(_local4);
_local6.id = _local3;
_local4++;
};
_local3++;
};
_local1++;
};
};
};
};
};
}
public function showExplanation(_arg1:MouseEvent):void{
var _local2:int;
var _local3:RangeWeapon;
var _local4:Number;
var _local5:MeleeWeapon;
var _local6:ExplosiveWeapon;
_local2 = MovieClip(_arg1.target.parent).id;
if (weaponType == WeaponType.RANGE){
_local3 = player.rangeWeaponInventory.get((_local2 + (page * numOfItemsInOnePage)));
if (image.explanationBox.weaponPic.numChildren > 0){
image.explanationBox.weaponPic.removeChildAt(0);
};
image.explanationBox.weaponPic.addChild(DisplayObjectModifier.duplicateMovieClip(_local3.logo));
changeAmmoImage(_local3);
_local4 = (Math.floor(((1000 / _local3.delay) * 100)) / 100);
image.explanationBox.rpsText.text = ("" + _local4);
image.explanationBox.weaponName.text = ("" + _local3.id);
image.explanationBox.damageText.text = ("" + _local3.damage);
image.explanationBox.ownedLabel.visible = false;
image.explanationBox.ownedText.visible = false;
} else {
if (weaponType == WeaponType.MELEE){
_local5 = player.meleeWeaponInventory.get((_local2 + (page * numOfItemsInOnePage)));
if (image.explanationBox.weaponPic.numChildren > 0){
image.explanationBox.weaponPic.removeChildAt(0);
};
image.explanationBox.weaponPic.addChild(DisplayObjectModifier.duplicateMovieClip(_local5.logo));
image.explanationBox.ammoType.alpha = 0;
_local4 = (Math.floor(((1000 / _local5.delay) * 100)) / 100);
image.explanationBox.rpsText.text = ("" + _local4);
image.explanationBox.weaponName.text = ("" + _local5.id);
image.explanationBox.damageText.text = ("" + _local5.damage);
image.explanationBox.ownedLabel.visible = false;
image.explanationBox.ownedText.visible = false;
} else {
if (weaponType == WeaponType.EXPLOSIVE){
_local6 = player.explosiveWeaponInventory.get((_local2 + (page * numOfItemsInOnePage)));
if (image.explanationBox.weaponPic.numChildren > 0){
image.explanationBox.weaponPic.removeChildAt(0);
};
image.explanationBox.weaponPic.addChild(DisplayObjectModifier.duplicateMovieClip(_local6.logo));
image.explanationBox.ammoType.alpha = 0;
_local4 = (Math.floor(((1000 / _local6.delay) * 100)) / 100);
image.explanationBox.rpsText.text = ("" + _local4);
image.explanationBox.weaponName.text = ("" + _local6.id);
image.explanationBox.damageText.text = ("" + _local6.damage);
image.explanationBox.ownedLabel.visible = true;
image.explanationBox.ownedText.visible = true;
image.explanationBox.ownedText.text = ("" + _local6.reloadAmmo);
};
};
};
}
public function changeAmmoImage(_arg1:RangeWeapon):void{
if (weaponType == WeaponType.RANGE){
image.explanationBox.ammoType.alpha = 1;
if (_arg1.ammoType.id == AmmoType.AMMO_12_GAUGE){
image.explanationBox.ammoType.gotoAndStop("ammo12gauge");
} else {
if (_arg1.ammoType.id == AmmoType.AMMO_357){
image.explanationBox.ammoType.gotoAndStop("ammo357");
} else {
if (_arg1.ammoType.id == AmmoType.AMMO_45){
image.explanationBox.ammoType.gotoAndStop("ammo45");
} else {
if (_arg1.ammoType.id == AmmoType.AMMO_556){
image.explanationBox.ammoType.gotoAndStop("ammo556");
} else {
if (_arg1.ammoType.id == AmmoType.AMMO_762){
image.explanationBox.ammoType.gotoAndStop("ammo762");
} else {
if (_arg1.ammoType.id == AmmoType.AMMO_9MM){
image.explanationBox.ammoType.gotoAndStop("ammo9mm");
};
};
};
};
};
};
};
}
public function changeWeaponLogo(_arg1:MouseEvent):void{
var _local2:int;
if (PixelCollision.isColliding(MovieClip(_arg1.target), image.equipBox.primaryWeapon, World.getSingleton().menuRoot)){
_local2 = MovieClip(_arg1.target.parent).id;
if (weaponType == WeaponType.RANGE){
if (player.secondaryWeapon != player.rangeWeaponInventory.get((_local2 + (page * numOfItemsInOnePage)))){
if (image.equipBox.primaryWeapon.numChildren > 2){
image.equipBox.primaryWeapon.removeChildAt(2);
};
image.equipBox.primaryWeapon.addChild(player.rangeWeaponInventory.get((_local2 + (page * numOfItemsInOnePage))).logo);
if (player.currentWeapon == player.primaryWeapon){
player.changeWeapon(player.rangeWeaponInventory.get((_local2 + (page * numOfItemsInOnePage))));
};
player.primaryWeapon = player.rangeWeaponInventory.get((_local2 + (page * numOfItemsInOnePage)));
};
};
} else {
if (PixelCollision.isColliding(MovieClip(_arg1.target), image.equipBox.secondaryWeapon, World.getSingleton().menuRoot)){
_local2 = MovieClip(_arg1.target.parent).id;
if (weaponType == WeaponType.RANGE){
if (player.primaryWeapon != player.rangeWeaponInventory.get((_local2 + (page * numOfItemsInOnePage)))){
if (image.equipBox.secondaryWeapon.numChildren > 2){
image.equipBox.secondaryWeapon.removeChildAt(2);
};
image.equipBox.secondaryWeapon.addChild(player.rangeWeaponInventory.get((_local2 + (page * numOfItemsInOnePage))).logo);
if (player.currentWeapon == player.secondaryWeapon){
player.changeWeapon(player.rangeWeaponInventory.get((_local2 + (page * numOfItemsInOnePage))));
};
player.secondaryWeapon = player.rangeWeaponInventory.get((_local2 + (page * numOfItemsInOnePage)));
};
};
} else {
if (PixelCollision.isColliding(MovieClip(_arg1.target), image.equipBox.meleeWeapon, World.getSingleton().menuRoot)){
if (weaponType == WeaponType.MELEE){
if (image.equipBox.meleeWeapon.numChildren > 2){
image.equipBox.meleeWeapon.removeChildAt(2);
};
_local2 = MovieClip(_arg1.target.parent).id;
image.equipBox.meleeWeapon.addChild(player.meleeWeaponInventory.get((_local2 + (page * numOfItemsInOnePage))).logo);
if (player.currentWeapon == player.meleeWeapon){
player.changeWeapon(player.meleeWeaponInventory.get((_local2 + (page * numOfItemsInOnePage))));
};
player.meleeWeapon = player.meleeWeaponInventory.get((_local2 + (page * numOfItemsInOnePage)));
};
} else {
if (PixelCollision.isColliding(MovieClip(_arg1.target), image.equipBox.explosiveWeapon, World.getSingleton().menuRoot)){
if (weaponType == WeaponType.EXPLOSIVE){
if (image.equipBox.explosiveWeapon.numChildren > 2){
image.equipBox.explosiveWeapon.removeChildAt(2);
};
_local2 = MovieClip(_arg1.target.parent).id;
image.equipBox.explosiveWeapon.addChild(player.explosiveWeaponInventory.get((_local2 + (page * numOfItemsInOnePage))).logo);
if (player.currentWeapon == player.explosiveWeapon){
player.changeWeapon(player.explosiveWeaponInventory.get((_local2 + (page * numOfItemsInOnePage))));
};
player.explosiveWeapon = player.explosiveWeaponInventory.get((_local2 + (page * numOfItemsInOnePage)));
};
};
};
};
};
}
public function destroy():void{
image.chooserBox.prevButton.removeEventListener(MouseEvent.CLICK, prevPage);
image.chooserBox.nextButton.removeEventListener(MouseEvent.CLICK, nextPage);
removeListener();
clearWeaponImages();
if (image){
World.getSingleton().menuRoot.removeChild(image);
};
MovieClip(image.fireArm).removeEventListener(MouseEvent.CLICK, showFireArmWeapons);
MovieClip(image.melee).removeEventListener(MouseEvent.CLICK, showMeleeWeapons);
MovieClip(image.explosive).removeEventListener(MouseEvent.CLICK, showExplosiveWeapons);
image.equipBox.switchButton.removeEventListener(MouseEvent.CLICK, switchWeapon);
}
}
}//package p_menuBar
Section 263
//WeaponShop (p_menuBar.WeaponShop)
package p_menuBar {
import flash.events.*;
import p_weapon.*;
import p_singleton.*;
import flash.display.*;
import p_char.p_playable.*;
import p_char.p_nonplayable.*;
import flash.media.*;
import p_ammo.*;
import p_util.*;
public class WeaponShop {
public var ammo357Price:int;// = 50
public var done:Boolean;// = false
public var page:int;
public var npcSelected:NPCFriend;
public var ammo12GaugePrice:int;// = 30
public var ammo556Price:int;// = 50
public var ammo762Price:int;// = 50
public var buySound:Sound;
public var numOfItemsInOnePage:int;
public var ammo45Price:int;// = 35
public var MERC:String;// = "Merc"
public var weaponSelected:Weapon;
public var ammoBought:int;// = 50
public var image:MovieClip;
public var sellSound:Sound;
public var player:PlayableCharacter;
public var itemType:String;
public var ammo9mmPrice:int;// = 20
public function WeaponShop(){
MERC = "Merc";
ammo12GaugePrice = 30;
ammo357Price = 50;
ammo45Price = 35;
ammo9mmPrice = 20;
ammo762Price = 50;
ammo556Price = 50;
ammoBought = 50;
done = false;
super();
numOfItemsInOnePage = 10;
this.player = PlayableCharacter(World.getSingleton().playedCharacter);
image = new shopScreen();
World.getSingleton().menuRoot.addChild(image);
itemType = WeaponType.RANGE;
page = 0;
initListener();
giveId();
image.explanationBox.ammoType.alpha = 0;
image.mercExplanationBox.mercPic.visible = false;
image.buyButton.visible = true;
image.hireButton.visible = false;
image.fireButton.visible = false;
image.sellButton.visible = false;
image.chooserBox.prevButton.addEventListener(MouseEvent.CLICK, prevPage);
image.chooserBox.nextButton.addEventListener(MouseEvent.CLICK, nextPage);
image.explanationBox.ownedLabel.visible = false;
image.explanationBox.ownedText.visible = false;
buySound = new BuySound();
sellSound = new SellSound();
}
public function giveId():void{
var _local1:int;
var _local2:int;
_local1 = 0;
_local2 = numOfItemsInOnePage;
while (_local1 < _local2) {
image.weaponOption[("holder" + _local1)].id = _local1;
_local1++;
};
}
public function showFireArmWeapons(_arg1:MouseEvent):void{
itemType = WeaponType.RANGE;
image.buyButton.visible = true;
image.hireButton.visible = false;
image.fireButton.visible = false;
image.explanationBox.ownedLabel.visible = false;
image.explanationBox.ownedText.visible = false;
page = 0;
image.chooserBox.pageNumber.text = ("" + (page + 1));
refresh();
}
public function doneShop(_arg1:MouseEvent):void{
done = true;
}
public function showWeapons():void{
var _local1:int;
var _local2:int;
var _local3:int;
var _local4:MovieClip;
_local1 = 0;
if (itemType == WeaponType.RANGE){
_local2 = World.getSingleton().rangeWeaponInventory.size();
_local1 = (0 + (page * numOfItemsInOnePage));
_local3 = 0;
if (_local1 < _local2){
while (_local1 < _local2) {
if (_local3 < numOfItemsInOnePage){
image.weaponOption[("holder" + _local3)].addEventListener(MouseEvent.MOUSE_DOWN, mouseDown);
image.weaponOption[("holder" + _local3)].addChild(DisplayObjectModifier.duplicateMovieClip(World.getSingleton().rangeWeaponInventory.get(_local1).logo));
if (World.getSingleton().rangeWeaponInventory.get(_local1).playerOwned){
MovieClip(image.weaponOption[("holder" + _local3)].getChildAt(0)).gotoAndStop(2);
} else {
MovieClip(image.weaponOption[("holder" + _local3)].getChildAt(0)).gotoAndStop(1);
};
_local3++;
};
_local1++;
};
};
} else {
if (itemType == WeaponType.MELEE){
_local2 = World.getSingleton().meleeWeaponInventory.size();
_local1 = (0 + (page * numOfItemsInOnePage));
_local3 = 0;
if (_local1 < _local2){
while (_local1 < _local2) {
if (_local3 < numOfItemsInOnePage){
image.weaponOption[("holder" + _local3)].addEventListener(MouseEvent.MOUSE_DOWN, mouseDown);
image.weaponOption[("holder" + _local3)].addChild(DisplayObjectModifier.duplicateMovieClip(World.getSingleton().meleeWeaponInventory.get(_local1).logo));
if (World.getSingleton().meleeWeaponInventory.get(_local1).playerOwned){
MovieClip(image.weaponOption[("holder" + _local3)].getChildAt(0)).gotoAndStop(2);
} else {
MovieClip(image.weaponOption[("holder" + _local3)].getChildAt(0)).gotoAndStop(1);
};
_local3++;
};
_local1++;
};
};
} else {
if (itemType == WeaponType.EXPLOSIVE){
_local2 = World.getSingleton().explosiveWeaponInventory.size();
_local1 = (0 + (page * numOfItemsInOnePage));
_local3 = 0;
if (_local1 < _local2){
while (_local1 < _local2) {
if (_local3 < numOfItemsInOnePage){
image.weaponOption[("holder" + _local3)].addEventListener(MouseEvent.MOUSE_DOWN, mouseDown);
image.weaponOption[("holder" + _local3)].addChild(DisplayObjectModifier.duplicateMovieClip(World.getSingleton().explosiveWeaponInventory.get(_local1).logo));
_local3++;
};
_local1++;
};
};
} else {
if (itemType == MERC){
_local2 = World.getSingleton().mercInventory.size();
_local1 = (0 + (page * numOfItemsInOnePage));
_local3 = 0;
if (_local1 < _local2){
while (_local1 < _local2) {
if (_local3 < numOfItemsInOnePage){
image.weaponOption[("holder" + _local3)].addEventListener(MouseEvent.MOUSE_DOWN, mouseDown);
_local4 = new mainHead();
new mainHead().scaleX = (_local4.scaleX * 0.5);
_local4.scaleY = (_local4.scaleY * 0.5);
_local4.gotoAndStop(World.getSingleton().mercInventory.get(_local1).Name);
_local4.id = _local3;
if (World.getSingleton().mercInventory.get(_local1).playerOwned){
_local4.hired.visible = true;
} else {
_local4.hired.visible = false;
};
image.weaponOption[("holder" + _local3)].addChild(_local4);
_local3++;
};
_local1++;
};
};
};
};
};
};
}
public function nextPage(_arg1:MouseEvent):void{
if (page < 3){
page++;
image.chooserBox.pageNumber.text = ("" + (page + 1));
refresh();
};
}
public function refreshMoney():void{
image.money.text = World.getSingleton().money;
}
public function fireMerc(_arg1:MouseEvent):void{
if (itemType == MERC){
if (npcSelected){
if (World.getSingleton().npcs.contains(npcSelected)){
World.getSingleton().npcs.remove(npcSelected);
npcSelected.health = npcSelected.maxHealth;
if (npcSelected.body){
World.getSingleton().physicWorld.DestroyBody(npcSelected.body);
};
npcSelected.playerOwned = false;
npcSelected.salaryPaid = true;
image.fireButton.visible = false;
image.hireButton.visible = true;
refresh();
sellSound.play();
};
};
};
}
public function sellAmmo12Gauge(_arg1:MouseEvent):void{
if (World.getSingleton().playedCharacter.ammoInventory.get(0).amount > ammoBought){
World.getSingleton().money = (World.getSingleton().money + ammo12GaugePrice);
World.getSingleton().playedCharacter.ammoInventory.get(0).amount = (World.getSingleton().playedCharacter.ammoInventory.get(0).amount - ammoBought);
refresh();
buySound.play();
};
}
public function buyAmmo357(_arg1:MouseEvent):void{
if (World.getSingleton().money >= ammo357Price){
World.getSingleton().money = (World.getSingleton().money - ammo357Price);
World.getSingleton().playedCharacter.ammoInventory.get(1).amount = (World.getSingleton().playedCharacter.ammoInventory.get(1).amount + ammoBought);
refresh();
buySound.play();
};
}
public function buyAmmo9mm(_arg1:MouseEvent):void{
if (World.getSingleton().money >= ammo9mmPrice){
World.getSingleton().money = (World.getSingleton().money - ammo9mmPrice);
World.getSingleton().playedCharacter.ammoInventory.get(5).amount = (World.getSingleton().playedCharacter.ammoInventory.get(5).amount + ammoBought);
refresh();
buySound.play();
};
}
public function clearWeaponImages():void{
var _local1:int;
var _local2:int;
var _local3:int;
var _local4:int;
_local1 = 0;
_local2 = numOfItemsInOnePage;
while (_local1 < _local2) {
if (image.weaponOption[("holder" + _local1)].numChildren > 0){
_local3 = 0;
_local4 = image.weaponOption[("holder" + _local1)].numChildren;
_local3 = (_local4 - 1);
while (_local3 >= 0) {
image.weaponOption[("holder" + _local1)].removeChildAt(_local3);
_local3--;
};
};
_local1++;
};
}
public function buyAmmo556(_arg1:MouseEvent):void{
if (World.getSingleton().money >= ammo556Price){
World.getSingleton().money = (World.getSingleton().money - ammo556Price);
World.getSingleton().playedCharacter.ammoInventory.get(3).amount = (World.getSingleton().playedCharacter.ammoInventory.get(3).amount + ammoBought);
refresh();
buySound.play();
};
}
public function buyAmmo762(_arg1:MouseEvent):void{
if (World.getSingleton().money >= ammo762Price){
World.getSingleton().money = (World.getSingleton().money - ammo762Price);
World.getSingleton().playedCharacter.ammoInventory.get(4).amount = (World.getSingleton().playedCharacter.ammoInventory.get(4).amount + ammoBought);
refresh();
buySound.play();
};
}
public function refreshExpBox():void{
image.explanationBox.visible = false;
image.mercExplanationBox.visible = false;
if (itemType == MERC){
image.mercExplanationBox.visible = true;
} else {
image.explanationBox.visible = true;
};
}
public function showMercs(_arg1:MouseEvent):void{
itemType = MERC;
image.buyButton.visible = false;
image.hireButton.visible = true;
image.explanationBox.ownedLabel.visible = false;
image.explanationBox.ownedText.visible = false;
page = 0;
image.chooserBox.pageNumber.text = ("" + (page + 1));
refresh();
}
public function showExplosiveWeapons(_arg1:MouseEvent):void{
itemType = WeaponType.EXPLOSIVE;
image.buyButton.visible = true;
image.hireButton.visible = false;
image.fireButton.visible = false;
image.explanationBox.ownedLabel.visible = true;
image.explanationBox.ownedText.visible = true;
page = 0;
image.chooserBox.pageNumber.text = ("" + (page + 1));
refresh();
}
public function sellAmmo45(_arg1:MouseEvent):void{
if (World.getSingleton().playedCharacter.ammoInventory.get(2).amount > ammoBought){
World.getSingleton().money = (World.getSingleton().money + ammo45Price);
World.getSingleton().playedCharacter.ammoInventory.get(2).amount = (World.getSingleton().playedCharacter.ammoInventory.get(2).amount - ammoBought);
refresh();
buySound.play();
};
}
public function sellAmmo357(_arg1:MouseEvent):void{
if (World.getSingleton().playedCharacter.ammoInventory.get(1).amount > ammoBought){
World.getSingleton().money = (World.getSingleton().money + ammo357Price);
World.getSingleton().playedCharacter.ammoInventory.get(1).amount = (World.getSingleton().playedCharacter.ammoInventory.get(1).amount - ammoBought);
refresh();
buySound.play();
};
}
public function sellAmmo556(_arg1:MouseEvent):void{
if (World.getSingleton().playedCharacter.ammoInventory.get(3).amount > ammoBought){
World.getSingleton().money = (World.getSingleton().money + ammo556Price);
World.getSingleton().playedCharacter.ammoInventory.get(3).amount = (World.getSingleton().playedCharacter.ammoInventory.get(3).amount - ammoBought);
refresh();
buySound.play();
};
}
public function removeListener():void{
var _local1:int;
var _local2:int;
_local1 = 0;
_local2 = numOfItemsInOnePage;
while (_local1 < _local2) {
if (image.weaponOption[("holder" + _local1)].hasEventListener(MouseEvent.MOUSE_DOWN)){
image.weaponOption[("holder" + _local1)].removeEventListener(MouseEvent.MOUSE_DOWN, mouseDown);
};
_local1++;
};
}
public function showExplanation(_arg1:MouseEvent):void{
var _local2:int;
var _local3:RangeWeapon;
var _local4:Number;
var _local5:MeleeWeapon;
var _local6:ExplosiveWeapon;
var _local7:NPCFriend;
_local2 = MovieClip(_arg1.target.parent).id;
if (itemType == WeaponType.RANGE){
_local3 = World.getSingleton().rangeWeaponInventory.get((_local2 + (page * numOfItemsInOnePage)));
if (image.explanationBox.weaponPic.numChildren > 0){
image.explanationBox.weaponPic.removeChildAt(0);
};
image.explanationBox.weaponPic.addChild(DisplayObjectModifier.duplicateMovieClip(_local3.logo));
changeAmmoImage(_local3);
_local4 = (Math.floor(((1000 / _local3.delay) * 100)) / 100);
image.explanationBox.rpsText.text = ("" + _local4);
image.explanationBox.weaponName.text = ("" + _local3.id);
image.explanationBox.damageText.text = ("" + _local3.damage);
image.explanationBox.priceText.text = ("$" + _local3.price);
weaponSelected = _local3;
if (weaponSelected.playerOwned){
image.buyButton.visible = false;
} else {
image.buyButton.visible = true;
};
} else {
if (itemType == WeaponType.MELEE){
_local5 = World.getSingleton().meleeWeaponInventory.get((_local2 + (page * numOfItemsInOnePage)));
if (image.explanationBox.weaponPic.numChildren > 0){
image.explanationBox.weaponPic.removeChildAt(0);
};
image.explanationBox.weaponPic.addChild(DisplayObjectModifier.duplicateMovieClip(_local5.logo));
image.explanationBox.ammoType.alpha = 0;
_local4 = (Math.floor(((1000 / _local5.delay) * 100)) / 100);
image.explanationBox.rpsText.text = ("" + _local4);
image.explanationBox.weaponName.text = ("" + _local5.id);
image.explanationBox.damageText.text = ("" + _local5.damage);
image.explanationBox.priceText.text = ("$" + _local5.price);
weaponSelected = _local5;
if (weaponSelected.playerOwned){
image.buyButton.visible = false;
} else {
image.buyButton.visible = true;
};
} else {
if (itemType == WeaponType.EXPLOSIVE){
_local6 = World.getSingleton().explosiveWeaponInventory.get((_local2 + (page * numOfItemsInOnePage)));
if (image.explanationBox.weaponPic.numChildren > 0){
image.explanationBox.weaponPic.removeChildAt(0);
};
image.explanationBox.weaponPic.addChild(DisplayObjectModifier.duplicateMovieClip(_local6.logo));
image.explanationBox.ammoType.alpha = 0;
_local4 = (Math.floor(((1000 / _local6.delay) * 100)) / 100);
image.explanationBox.rpsText.text = ("" + _local4);
image.explanationBox.weaponName.text = ("" + _local6.id);
image.explanationBox.damageText.text = ("" + _local6.damage);
image.explanationBox.priceText.text = ("$" + _local6.price);
weaponSelected = _local6;
image.explanationBox.ownedText.text = ("" + _local6.reloadAmmo);
} else {
if (itemType == MERC){
_local7 = World.getSingleton().mercInventory.get((_local2 + (page * numOfItemsInOnePage)));
image.mercExplanationBox.weaponPic.gotoAndStop(_local7.currentWeapon.id);
image.mercExplanationBox.mercPic.alpha = 1;
image.mercExplanationBox.mercPic.gotoAndStop(_local7.Name);
image.mercExplanationBox.mercName.text = ("" + _local7.Name);
image.mercExplanationBox.priceText.text = ("$" + _local7.price);
image.mercExplanationBox.healthText.text = _local7.maxHealth;
image.mercExplanationBox.accText.text = _local7.accuracy;
image.mercExplanationBox.speedText.text = _local7.speed;
image.mercExplanationBox.salaryText.text = (("$" + _local7.salary) + "/day");
image.mercExplanationBox.mercPic.visible = true;
npcSelected = _local7;
if (npcSelected.playerOwned){
image.fireButton.visible = true;
image.hireButton.visible = false;
} else {
image.fireButton.visible = false;
image.hireButton.visible = true;
};
};
};
};
};
}
public function sellAmmo9mm(_arg1:MouseEvent):void{
if (World.getSingleton().playedCharacter.ammoInventory.get(5).amount > ammoBought){
World.getSingleton().money = (World.getSingleton().money + ammo9mmPrice);
World.getSingleton().playedCharacter.ammoInventory.get(5).amount = (World.getSingleton().playedCharacter.ammoInventory.get(5).amount - ammoBought);
refresh();
buySound.play();
};
}
public function prevPage(_arg1:MouseEvent):void{
if (page > 0){
page--;
image.chooserBox.pageNumber.text = ("" + (page + 1));
refresh();
};
}
public function initListener():void{
MovieClip(image.fireArm).addEventListener(MouseEvent.CLICK, showFireArmWeapons);
MovieClip(image.melee).addEventListener(MouseEvent.CLICK, showMeleeWeapons);
MovieClip(image.explosive).addEventListener(MouseEvent.CLICK, showExplosiveWeapons);
MovieClip(image.merc).addEventListener(MouseEvent.CLICK, showMercs);
image.doneButton.addEventListener(MouseEvent.CLICK, doneShop);
image.buyButton.addEventListener(MouseEvent.CLICK, buyWeapon);
image.hireButton.addEventListener(MouseEvent.CLICK, hireMerc);
image.fireButton.addEventListener(MouseEvent.CLICK, fireMerc);
image.ammo12gaugeBuyButton.addEventListener(MouseEvent.CLICK, buyAmmo12Gauge);
image.ammo12gaugeSellButton.addEventListener(MouseEvent.CLICK, sellAmmo12Gauge);
image.ammo357BuyButton.addEventListener(MouseEvent.CLICK, buyAmmo357);
image.ammo357SellButton.addEventListener(MouseEvent.CLICK, sellAmmo357);
image.ammo45BuyButton.addEventListener(MouseEvent.CLICK, buyAmmo45);
image.ammo45SellButton.addEventListener(MouseEvent.CLICK, sellAmmo45);
image.ammo9mmBuyButton.addEventListener(MouseEvent.CLICK, buyAmmo9mm);
image.ammo9mmSellButton.addEventListener(MouseEvent.CLICK, sellAmmo9mm);
image.ammo762BuyButton.addEventListener(MouseEvent.CLICK, buyAmmo762);
image.ammo762SellButton.addEventListener(MouseEvent.CLICK, sellAmmo762);
image.ammo556BuyButton.addEventListener(MouseEvent.CLICK, buyAmmo556);
image.ammo556SellButton.addEventListener(MouseEvent.CLICK, sellAmmo556);
image.warningClip.closeButton.addEventListener(MouseEvent.CLICK, closeWarningClip);
}
public function showMeleeWeapons(_arg1:MouseEvent):void{
itemType = WeaponType.MELEE;
image.buyButton.visible = true;
image.hireButton.visible = false;
image.fireButton.visible = false;
image.explanationBox.ownedLabel.visible = false;
image.explanationBox.ownedText.visible = false;
page = 0;
image.chooserBox.pageNumber.text = ("" + (page + 1));
refresh();
}
public function refresh():void{
refreshExpBox();
image.ammo12gaugeText.text = ("x " + player.ammoInventory.get(0).amount);
image.ammo357Text.text = ("x " + player.ammoInventory.get(1).amount);
image.ammo45Text.text = ("x " + player.ammoInventory.get(2).amount);
image.ammo556Text.text = ("x " + player.ammoInventory.get(3).amount);
image.ammo762Text.text = ("x " + player.ammoInventory.get(4).amount);
image.ammo9mmText.text = ("x " + player.ammoInventory.get(5).amount);
removeListener();
clearWeaponImages();
showWeapons();
refreshMoney();
}
public function buyAmmo12Gauge(_arg1:MouseEvent):void{
if (World.getSingleton().money >= ammo12GaugePrice){
World.getSingleton().money = (World.getSingleton().money - ammo12GaugePrice);
World.getSingleton().playedCharacter.ammoInventory.get(0).amount = (World.getSingleton().playedCharacter.ammoInventory.get(0).amount + ammoBought);
refresh();
buySound.play();
};
}
public function hireMerc(_arg1:MouseEvent):void{
if (itemType == MERC){
if (npcSelected){
if (World.getSingleton().npcs.size() < World.getSingleton().maxNPC){
if (World.getSingleton().money >= npcSelected.price){
World.getSingleton().money = (World.getSingleton().money - npcSelected.price);
World.getSingleton().npcs.add(npcSelected);
npcSelected.playerOwned = true;
npcSelected.salaryPaid = true;
image.fireButton.visible = true;
image.hireButton.visible = false;
refresh();
buySound.play();
};
} else {
image.warningClip.visible = true;
image.warningClip.message.text = (("You can only hire " + World.getSingleton().maxNPC) + " mercs max");
};
};
};
}
public function mouseDown(_arg1:MouseEvent):void{
showExplanation(_arg1);
}
public function buyWeapon(_arg1:MouseEvent):void{
var _local2:int;
var _local3:int;
var _local4:Boolean;
var _local5:int;
if (itemType != MERC){
if (weaponSelected){
if (World.getSingleton().money >= weaponSelected.price){
World.getSingleton().money = (World.getSingleton().money - weaponSelected.price);
if (!World.getSingleton().muted){
buySound.play();
};
if (weaponSelected.weaponType == WeaponType.RANGE){
World.getSingleton().playedCharacter.rangeWeaponInventory.add(weaponSelected);
weaponSelected.playerOwned = true;
weaponSelected = null;
image.buyButton.visible = false;
} else {
if (weaponSelected.weaponType == WeaponType.MELEE){
World.getSingleton().playedCharacter.meleeWeaponInventory.add(weaponSelected);
weaponSelected.playerOwned = true;
weaponSelected = null;
image.buyButton.visible = false;
} else {
if (weaponSelected.weaponType == WeaponType.EXPLOSIVE){
_local2 = 0;
_local3 = World.getSingleton().playedCharacter.explosiveWeaponInventory.size();
_local4 = false;
while (_local2 < _local3) {
if (World.getSingleton().playedCharacter.explosiveWeaponInventory.get(_local2).id == weaponSelected.id){
_local4 = true;
_local5 = _local2;
};
_local2++;
};
if (!_local4){
World.getSingleton().playedCharacter.explosiveWeaponInventory.add(weaponSelected);
_local5 = (World.getSingleton().playedCharacter.explosiveWeaponInventory.size() - 1);
};
World.getSingleton().playedCharacter.explosiveWeaponInventory.get(_local5).reloadAmmo = (World.getSingleton().playedCharacter.explosiveWeaponInventory.get(_local5).reloadAmmo + 1);
World.getSingleton().playedCharacter.explosiveWeaponInventory.get(_local5).checkWhichIdle();
World.getSingleton().playedCharacter.explosiveWeaponInventory.get(_local5).reload();
image.explanationBox.ownedText.text = ("" + World.getSingleton().playedCharacter.explosiveWeaponInventory.get(_local5).reloadAmmo);
};
};
};
refresh();
};
};
};
}
public function updateUpKeep():void{
var _local1:int;
var _local2:int;
var _local3:NPCFriend;
_local1 = World.getSingleton().npcs.size();
_local2 = (_local1 - 1);
while (_local2 >= 0) {
_local3 = World.getSingleton().npcs.get(_local2);
if (!_local3.salaryPaid){
if (World.getSingleton().money < _local3.salary){
World.getSingleton().npcs.remove(_local3);
_local3.health = _local3.maxHealth;
if (_local3.body){
World.getSingleton().physicWorld.DestroyBody(_local3.body);
};
_local3.playerOwned = false;
_local3.salaryPaid = true;
image.warningClip.visible = true;
image.warningClip.message.text = (("You don't have enough money\n" + _local3.Name) + " has left you");
break;
} else {
World.getSingleton().money = (World.getSingleton().money - _local3.salary);
_local3.salaryPaid = true;
};
};
_local2--;
};
refresh();
}
public function sellAmmo762(_arg1:MouseEvent):void{
if (World.getSingleton().playedCharacter.ammoInventory.get(4).amount > ammoBought){
World.getSingleton().money = (World.getSingleton().money + ammo762Price);
World.getSingleton().playedCharacter.ammoInventory.get(4).amount = (World.getSingleton().playedCharacter.ammoInventory.get(4).amount - ammoBought);
refresh();
buySound.play();
};
}
public function buyAmmo45(_arg1:MouseEvent):void{
if (World.getSingleton().money >= ammo45Price){
World.getSingleton().money = (World.getSingleton().money - ammo45Price);
World.getSingleton().playedCharacter.ammoInventory.get(2).amount = (World.getSingleton().playedCharacter.ammoInventory.get(2).amount + ammoBought);
refresh();
buySound.play();
};
}
public function destroy():void{
image.chooserBox.prevButton.removeEventListener(MouseEvent.CLICK, prevPage);
image.chooserBox.nextButton.removeEventListener(MouseEvent.CLICK, nextPage);
removeListener();
clearWeaponImages();
if (image.parent){
image.parent.removeChild(image);
};
MovieClip(image.fireArm).removeEventListener(MouseEvent.CLICK, showFireArmWeapons);
MovieClip(image.melee).removeEventListener(MouseEvent.CLICK, showMeleeWeapons);
MovieClip(image.explosive).removeEventListener(MouseEvent.CLICK, showExplosiveWeapons);
MovieClip(image.merc).removeEventListener(MouseEvent.CLICK, showMercs);
image.warningClip.closeButton.removeEventListener(MouseEvent.CLICK, closeWarningClip);
image.doneButton.removeEventListener(MouseEvent.CLICK, doneShop);
image.buyButton.removeEventListener(MouseEvent.CLICK, buyWeapon);
image.hireButton.removeEventListener(MouseEvent.CLICK, hireMerc);
image.fireButton.removeEventListener(MouseEvent.CLICK, fireMerc);
image.ammo12gaugeBuyButton.removeEventListener(MouseEvent.CLICK, buyAmmo12Gauge);
image.ammo12gaugeSellButton.removeEventListener(MouseEvent.CLICK, sellAmmo12Gauge);
image.ammo357BuyButton.removeEventListener(MouseEvent.CLICK, buyAmmo357);
image.ammo357SellButton.removeEventListener(MouseEvent.CLICK, sellAmmo357);
image.ammo45BuyButton.removeEventListener(MouseEvent.CLICK, buyAmmo45);
image.ammo45SellButton.removeEventListener(MouseEvent.CLICK, sellAmmo45);
image.ammo9mmBuyButton.removeEventListener(MouseEvent.CLICK, buyAmmo9mm);
image.ammo9mmSellButton.removeEventListener(MouseEvent.CLICK, sellAmmo9mm);
image.ammo762BuyButton.removeEventListener(MouseEvent.CLICK, buyAmmo762);
image.ammo762SellButton.removeEventListener(MouseEvent.CLICK, sellAmmo762);
image.ammo556BuyButton.removeEventListener(MouseEvent.CLICK, buyAmmo556);
image.ammo556SellButton.removeEventListener(MouseEvent.CLICK, sellAmmo556);
image = null;
}
public function closeWarningClip(_arg1:MouseEvent):void{
image.warningClip.visible = false;
updateUpKeep();
}
public function changeAmmoImage(_arg1:RangeWeapon):void{
if (itemType == WeaponType.RANGE){
image.explanationBox.ammoType.alpha = 1;
if (_arg1.ammoType.id == AmmoType.AMMO_12_GAUGE){
image.explanationBox.ammoType.gotoAndStop("ammo12gauge");
} else {
if (_arg1.ammoType.id == AmmoType.AMMO_357){
image.explanationBox.ammoType.gotoAndStop("ammo357");
} else {
if (_arg1.ammoType.id == AmmoType.AMMO_45){
image.explanationBox.ammoType.gotoAndStop("ammo45");
} else {
if (_arg1.ammoType.id == AmmoType.AMMO_556){
image.explanationBox.ammoType.gotoAndStop("ammo556");
} else {
if (_arg1.ammoType.id == AmmoType.AMMO_762){
image.explanationBox.ammoType.gotoAndStop("ammo762");
} else {
if (_arg1.ammoType.id == AmmoType.AMMO_9MM){
image.explanationBox.ammoType.gotoAndStop("ammo9mm");
};
};
};
};
};
};
};
}
}
}//package p_menuBar
Section 264
//BloodParticle (p_particle.BloodParticle)
package p_particle {
public class BloodParticle extends Particle {
public function BloodParticle(){
lifeTime = 25;
initialLifeTime = lifeTime;
speed = 5;
gravity = 5;
maxWidth = 6;
maxHeight = 6;
image = new blood_clip();
isWidthEqualHeight = true;
init();
}
}
}//package p_particle
Section 265
//ExplosionParticle (p_particle.ExplosionParticle)
package p_particle {
import Box2D.Common.Math.*;
import flash.events.*;
import p_singleton.*;
import flash.utils.*;
public class ExplosionParticle extends Particle {
public function ExplosionParticle(){
lifeTime = 100;
initialLifeTime = lifeTime;
speed = 40;
gravity = 2;
maxWidth = 5;
maxHeight = 5;
image = new Star2();
isWidthEqualHeight = true;
init();
}
override public function init():void{
World.getSingleton().sceneRoot.addChild(image);
timer = new Timer(25);
timer.addEventListener(TimerEvent.TIMER, playParticle);
image.width = (((Math.floor((Math.random() * 10)) + 1) % maxWidth) + 1);
if (isWidthEqualHeight){
image.height = image.width;
} else {
image.height = (((Math.floor((Math.random() * 10)) + 1) % maxHeight) + 1);
};
direction = new b2Vec2(0, 0);
direction.x = (Math.random() - Math.random());
direction.y = (Math.random() - Math.random());
if (direction.y > 0){
direction.y = (direction.y * -1);
};
timer.start();
}
}
}//package p_particle
Section 266
//Particle (p_particle.Particle)
package p_particle {
import Box2D.Common.Math.*;
import flash.events.*;
import p_singleton.*;
import flash.utils.*;
import p_entity.*;
public class Particle extends Entity {
public var maxWidth:Number;
public var timer:Timer;
public var initialLifeTime:int;
public var speed:Number;
public var gravity:Number;
public var isWidthEqualHeight:Boolean;
public var maxHeight:Number;
public var lifeTime:int;
public function init():void{
World.getSingleton().sceneRoot.addChild(image);
timer = new Timer(25);
timer.addEventListener(TimerEvent.TIMER, playParticle);
image.width = (((Math.floor((Math.random() * 10)) + 1) % maxWidth) + 1);
if (isWidthEqualHeight){
image.height = image.width;
} else {
image.height = (((Math.floor((Math.random() * 10)) + 1) % maxHeight) + 1);
};
direction = new b2Vec2(0, 0);
direction.x = (Math.random() - Math.random());
direction.y = (Math.random() - Math.random());
timer.start();
}
public function playParticle(_arg1:TimerEvent):void{
if (image){
lifeTime--;
image.alpha = (lifeTime / initialLifeTime);
position.x = (position.x + (direction.x * speed));
position.y = (position.y + (direction.y * speed));
position.y = (position.y + gravity);
super.update();
if (image.alpha <= 0){
if (World.getSingleton().sceneRoot.contains(image)){
World.getSingleton().sceneRoot.removeChild(image);
timer.stop();
World.getSingleton().setFocusToStage();
timer.removeEventListener(TimerEvent.TIMER, playParticle);
};
};
};
}
}
}//package p_particle
Section 267
//SmokeParticle (p_particle.SmokeParticle)
package p_particle {
import Box2D.Common.Math.*;
import flash.events.*;
import p_singleton.*;
import flash.utils.*;
public class SmokeParticle extends Particle {
public function SmokeParticle(){
lifeTime = 25;
initialLifeTime = lifeTime;
speed = 5;
gravity = 0;
maxWidth = 1000;
maxHeight = 1000;
image = new smokeAnimate();
isWidthEqualHeight = true;
init();
}
override public function init():void{
if (World.getSingleton().level){
World.getSingleton().level.playerGround.addChild(image);
timer = new Timer(25);
timer.addEventListener(TimerEvent.TIMER, playParticle);
image.width = (((Math.floor((Math.random() * 10)) + 1) % maxWidth) + 1);
if (isWidthEqualHeight){
image.height = image.width;
} else {
image.height = (((Math.floor((Math.random() * 10)) + 1) % maxHeight) + 1);
};
direction = new b2Vec2(0, 0);
direction.x = (Math.random() - Math.random());
direction.y = (Math.random() - Math.random());
timer.start();
};
}
override public function playParticle(_arg1:TimerEvent):void{
if (image){
lifeTime--;
image.alpha = (lifeTime / initialLifeTime);
position.x = (position.x + (direction.x * speed));
position.y = (position.y + (direction.y * speed));
position.y = (position.y + gravity);
super.update();
if (image.alpha <= 0){
if (World.getSingleton().level){
if (World.getSingleton().level.playerGround.contains(image)){
World.getSingleton().level.playerGround.removeChild(image);
timer.stop();
World.getSingleton().setFocusToStage();
timer.removeEventListener(TimerEvent.TIMER, playParticle);
};
};
};
};
}
}
}//package p_particle
Section 268
//StarParticle (p_particle.StarParticle)
package p_particle {
public class StarParticle extends Particle {
public function StarParticle(){
lifeTime = 20;
initialLifeTime = lifeTime;
speed = 5;
gravity = 2;
maxWidth = 5;
maxHeight = 5;
image = new Star();
isWidthEqualHeight = true;
init();
}
}
}//package p_particle
Section 269
//CollisionDetector (p_singleton.CollisionDetector)
package p_singleton {
import p_char.*;
import flash.display.*;
import p_char.p_playable.*;
import p_char.p_nonplayable.*;
import org.idmedia.as3commons.util.*;
import p_gamelevel.*;
import p_util.*;
public class CollisionDetector {
public var itemPickUps:ArrayList;
public var enemyBullets:ArrayList;
public var level:GameLevel;
public var playerBullets:ArrayList;
public var signBaloonVisible:Boolean;// = false
public var enemies:ArrayList;
public var barricades:ArrayList;
public var players:ArrayList;
public var npcs:ArrayList;
private static var INSTANCE:CollisionDetector;
public function CollisionDetector(){
signBaloonVisible = false;
super();
players = World.getSingleton().players;
enemies = World.getSingleton().enemies;
npcs = World.getSingleton().npcs;
itemPickUps = World.getSingleton().itemPickUps;
barricades = World.getSingleton().barricades;
playerBullets = World.getSingleton().playerBullets;
enemyBullets = World.getSingleton().enemyBullets;
level = World.getSingleton().level;
}
public function playerItemPickUpCollision(_arg1:PlayableCharacter):void{
var _local2:int;
_local2 = (itemPickUps.size() - 1);
while (_local2 >= 0) {
if (PixelCollision.isColliding(_arg1.image, itemPickUps.get(_local2).image, World.getSingleton().sceneRoot)){
itemPickUps.get(_local2).destroy();
};
_local2--;
};
}
public function enemyCollision():void{
var _local1:int;
var _local2:int;
var _local3:int;
_local1 = enemies.size();
_local2 = (_local1 - 1);
while (_local2 >= 0) {
mousePointerEnemyCollision(enemies.get(_local2));
enemyLevelCollision(enemies.get(_local2));
_local2--;
};
}
public function playerCollision():void{
var _local1:int;
var _local2:int;
var _local3:int;
_local1 = players.size();
_local2 = (_local1 - 1);
signBaloonVisible = false;
while (_local2 >= 0) {
players.get(_local2).image.xcross.visible = false;
playerLevelCollision(players.get(_local2));
_local2--;
};
}
public function playerLevelCollision(_arg1:PlayableCharacter):void{
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:int;
var _local8:int;
var _local9:NumOfSign;
var _local10:int;
var _local11:int;
var _local12:int;
var _local13:int;
var _local14:int;
if (((level) && ((players.size() > 0)))){
_local2 = players.size();
_local3 = (_local2 - 1);
_local5 = level.numOfDoor;
_local6 = level.numOfStage;
_local7 = level.numOfTutorial;
_local4 = (_local6 - 1);
while (_local4 >= 0) {
if (PixelCollision.isColliding(_arg1.image, MovieClip(level.middleGround)[("stageSign" + _local4)], World.getSingleton().sceneRoot)){
_arg1.stageNumber = _local4;
MovieClip(level.foreGround)[("stageSign" + _local4)].alpha = 0;
} else {
MovieClip(level.foreGround)[("stageSign" + _local4)].alpha = 1;
};
_local4--;
};
_local4 = (_local7 - 1);
while (_local4 >= 0) {
if (PixelCollision.isColliding(_arg1.image, MovieClip(level.backGround)[("tutor" + _local4)], World.getSingleton().sceneRoot)){
signBaloonVisible = true;
if (World.getSingleton().menuBar){
if (((!(World.getSingleton().menuBar.image.animationPlaying)) && (World.getSingleton().menuBar.image.ended))){
World.getSingleton().menuBar.image.gotoAndPlay("enter");
};
World.getSingleton().menuBar.image.infoBox.infoBox.text = ("" + level.getTutorialContent(_local4));
};
if (_arg1.image.signBaloon){
_arg1.image.signBaloon.alpha = 1;
if (_arg1.faceState == FaceState.FACE_LEFT){
_arg1.image.signBaloon.gotoAndStop("question2");
} else {
_arg1.image.signBaloon.gotoAndStop("question");
};
};
};
_local4--;
};
if (!signBaloonVisible){
_arg1.image.signBaloon.alpha = 0;
if (World.getSingleton().menuBar){
if (((World.getSingleton().menuBar.image.animationPlaying) && (World.getSingleton().menuBar.image.ended))){
World.getSingleton().menuBar.image.gotoAndPlay("out");
};
};
};
World.getSingleton().currentStage = World.getSingleton().playedCharacter.stageNumber;
_local8 = World.getSingleton().currentStage;
_local9 = level.arrayOfStage.get(_local8);
_local10 = _local9.numOfWall;
_local11 = _local9.numOfFloor;
_local12 = _local9.numOfLadder;
_local13 = _local9.numOfLantaiSign;
_local4 = ((_local12 + _local9.initialLadder) - 1);
while (_local4 >= _local9.initialLadder) {
if (PixelCollision.isColliding(_arg1.image.clipTop, MovieClip(level.middleGround)[("ladder" + _local4)], World.getSingleton().sceneRoot)){
_arg1.ableToMoveUp = true;
_arg1.onTheLadderUp = _local4;
_arg1.onTheLadderDown = _local4;
_arg1.body.m_linearDamping = 10000;
};
if (PixelCollision.isColliding(_arg1.image.ladderDetector, MovieClip(level.middleGround)[("ladder" + _local4)], World.getSingleton().sceneRoot)){
_arg1.ableToMoveDown = true;
_arg1.ableToMoveUp = true;
_arg1.onTheLadderUp = _local4;
_arg1.onTheLadderDown = _local4;
_arg1.body.m_linearDamping = 10000;
};
_local4--;
};
if (_arg1.onTheLadderUp != -1){
if (!PixelCollision.isColliding(_arg1.image.clipTop, MovieClip(level.middleGround)[("ladder" + _arg1.onTheLadderUp)], World.getSingleton().sceneRoot)){
if (!PixelCollision.isColliding(_arg1.image.ladderDetector, MovieClip(level.middleGround)[("ladder" + _arg1.onTheLadderUp)], World.getSingleton().sceneRoot)){
_arg1.onTheLadderUp = -1;
};
};
};
if (_arg1.onTheLadderDown != -1){
if (!PixelCollision.isColliding(_arg1.image.ladderDetector, MovieClip(level.middleGround)[("ladder" + _arg1.onTheLadderDown)], World.getSingleton().sceneRoot)){
_arg1.onTheLadderDown = -1;
};
};
_local4 = ((_local13 + _local9.initialLantaiSign) - 1);
while (_local4 >= 0) {
if (PixelCollision.isColliding(_arg1.image, MovieClip(level.middleGround)[("lantaiSign" + _local4)], World.getSingleton().sceneRoot)){
_arg1.lantai = _local4;
};
_local4--;
};
};
if (!World.getSingleton().gameStarted){
_local14 = World.getSingleton().barricades.size();
_local3 = 0;
while (_local3 < _local14) {
if (PixelCollision.isColliding(_arg1.image, World.getSingleton().barricades.get(_local3), World.getSingleton().sceneRoot)){
_arg1.image.xcross.visible = true;
World.getSingleton().playerInsideBarricade = true;
};
_local3++;
};
};
}
public function update():void{
World.getSingleton().playerInsideBarricade = false;
playerCollision();
enemyCollision();
npcCollision();
}
public function mousePointerEnemyCollision(_arg1:NonPlayableCharacter):void{
if (World.getSingleton().mousePointer){
if (PixelCollision.isColliding(_arg1.image, World.getSingleton().mousePointer.image, World.getSingleton().sceneRoot.stage)){
_arg1.image.bloodSign.alpha = 1;
} else {
_arg1.image.bloodSign.alpha = 0;
};
};
}
public function npcLevelCollision(_arg1:NPCFriend):void{
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:NumOfSign;
var _local7:int;
var _local8:int;
var _local9:int;
var _local10:int;
var _local11:int;
var _local12:int;
if (((level) && ((npcs.size() > 0)))){
_local3 = level.numOfDoor;
_local4 = level.numOfStage;
_local2 = (_local4 - 1);
while (_local2 >= 0) {
if (PixelCollision.isColliding(_arg1.image, MovieClip(level.middleGround)[("stageSign" + _local2)], World.getSingleton().sceneRoot)){
_arg1.stageNumber = _local2;
};
_local2--;
};
_local5 = World.getSingleton().currentStage;
_local6 = level.arrayOfStage.get(_local5);
_local7 = _local6.numOfWall;
_local8 = _local6.numOfFloor;
_local9 = _local6.numOfLadder;
_local10 = _local6.numOfLantaiSign;
_local2 = ((_local9 + _local6.initialLadder) - 1);
while (_local2 >= _local6.initialLadder) {
if (PixelCollision.isColliding(_arg1.image.clipTop, MovieClip(level.middleGround)[("ladder" + _local2)], World.getSingleton().sceneRoot)){
_arg1.body.m_linearDamping = 10000;
if (PixelCollision.isColliding(_arg1.image.clipTop, MovieClip(level.middleGround)[("ladder" + _local2)].center, World.getSingleton().sceneRoot)){
_arg1.ableToMoveUp = true;
_arg1.onTheLadderUp = _local2;
_arg1.onTheLadderDown = _local2;
};
};
if (PixelCollision.isColliding(_arg1.image.ladderDetector, MovieClip(level.middleGround)[("ladder" + _local2)], World.getSingleton().sceneRoot)){
_arg1.body.m_linearDamping = 10000;
if (PixelCollision.isColliding(_arg1.image.ladderDetector, MovieClip(level.middleGround)[("ladder" + _local2)].center, World.getSingleton().sceneRoot)){
_arg1.ableToMoveDown = true;
_arg1.ableToMoveUp = true;
_arg1.onTheLadderUp = _local2;
_arg1.onTheLadderDown = _local2;
};
};
_local2--;
};
if (_arg1.onTheLadderUp != -1){
if (!PixelCollision.isColliding(_arg1.image.clipTop, MovieClip(level.middleGround)[("ladder" + _arg1.onTheLadderUp)].center, World.getSingleton().sceneRoot)){
if (!PixelCollision.isColliding(_arg1.image.ladderDetector, MovieClip(level.middleGround)[("ladder" + _arg1.onTheLadderUp)].center, World.getSingleton().sceneRoot)){
_arg1.onTheLadderUp = -1;
};
};
};
if (_arg1.onTheLadderDown != -1){
if (!PixelCollision.isColliding(_arg1.image.ladderDetector, MovieClip(level.middleGround)[("ladder" + _arg1.onTheLadderDown)].center, World.getSingleton().sceneRoot)){
_arg1.onTheLadderDown = -1;
};
};
_local2 = ((_local10 + _local6.initialLantaiSign) - 1);
while (_local2 >= 0) {
if (PixelCollision.isColliding(_arg1.image, MovieClip(level.middleGround)[("lantaiSign" + _local2)], World.getSingleton().sceneRoot)){
_arg1.lantai = _local2;
};
_local2--;
};
};
if (!World.getSingleton().gameStarted){
_local11 = World.getSingleton().barricades.size();
_local12 = 0;
while (_local12 < _local11) {
if (PixelCollision.isColliding(_arg1.image, World.getSingleton().barricades.get(_local12), World.getSingleton().sceneRoot)){
_arg1.image.xcross.visible = true;
World.getSingleton().playerInsideBarricade = true;
};
_local12++;
};
};
}
public function mousePointerNpcCollision(_arg1:NPCFriend):void{
if (World.getSingleton().mousePointer){
if (PixelCollision.isColliding(_arg1.image, World.getSingleton().mousePointer.image, World.getSingleton().sceneRoot.stage)){
_arg1.image.bloodSign.alpha = 1;
} else {
_arg1.image.bloodSign.alpha = 0;
};
};
}
public function npcCollision():void{
var _local1:int;
var _local2:int;
var _local3:int;
_local1 = npcs.size();
_local2 = (_local1 - 1);
while (_local2 >= 0) {
npcs.get(_local2).image.xcross.visible = false;
mousePointerNpcCollision(npcs.get(_local2));
npcLevelCollision(npcs.get(_local2));
_local2--;
};
}
public function enemyLevelCollision(_arg1:NonPlayableCharacter):void{
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:NumOfSign;
var _local7:int;
var _local8:int;
var _local9:int;
var _local10:int;
if (level){
_local3 = level.numOfDoor;
_local4 = level.numOfStage;
_local2 = (_local4 - 1);
while (_local2 >= 0) {
if (PixelCollision.isColliding(_arg1.image, MovieClip(level.middleGround)[("stageSign" + _local2)], World.getSingleton().sceneRoot)){
_arg1.stageNumber = _local2;
if (players.size() > 0){
if (_arg1.stageNumber != players.get(0).stageNumber){
_arg1.deactivate();
} else {
_arg1.activate();
};
};
};
_local2--;
};
_local5 = World.getSingleton().currentStage;
_local6 = level.arrayOfStage.get(_local5);
_local7 = _local6.numOfWall;
_local8 = _local6.numOfFloor;
_local9 = _local6.numOfLadder;
_local10 = _local6.numOfLantaiSign;
_local2 = ((_local9 + _local6.initialLadder) - 1);
while (_local2 >= _local6.initialLadder) {
if (PixelCollision.isColliding(_arg1.image.clipTop, MovieClip(level.middleGround)[("ladder" + _local2)], World.getSingleton().sceneRoot)){
if (PixelCollision.isColliding(_arg1.image.clipTop, MovieClip(level.middleGround)[("ladder" + _local2)].center, World.getSingleton().sceneRoot)){
_arg1.ableToMoveUp = true;
_arg1.onTheLadderUp = _local2;
};
if (!_arg1.body.gotShot){
_arg1.body.m_linearDamping = 10000;
};
};
if (PixelCollision.isColliding(_arg1.image.ladderDetector, MovieClip(level.middleGround)[("ladder" + _local2)], World.getSingleton().sceneRoot)){
if (PixelCollision.isColliding(_arg1.image.ladderDetector, MovieClip(level.middleGround)[("ladder" + _local2)].center, World.getSingleton().sceneRoot)){
_arg1.ableToMoveDown = true;
_arg1.ableToMoveUp = true;
_arg1.onTheLadderDown = _local2;
};
if (!_arg1.body.gotShot){
_arg1.body.m_linearDamping = 10000;
};
};
_local2--;
};
if (_arg1.onTheLadderUp != -1){
if (!PixelCollision.isColliding(_arg1.image.clipTop, MovieClip(level.middleGround)[("ladder" + _arg1.onTheLadderUp)].center, World.getSingleton().sceneRoot)){
if (!PixelCollision.isColliding(_arg1.image.ladderDetector, MovieClip(level.middleGround)[("ladder" + _arg1.onTheLadderUp)].center, World.getSingleton().sceneRoot)){
_arg1.onTheLadderUp = -1;
};
};
};
if (_arg1.onTheLadderDown != -1){
if (!PixelCollision.isColliding(_arg1.image.ladderDetector, MovieClip(level.middleGround)[("ladder" + _arg1.onTheLadderDown)].center, World.getSingleton().sceneRoot)){
_arg1.onTheLadderDown = -1;
};
};
_local2 = ((_local10 + _local6.initialLantaiSign) - 1);
while (_local2 >= _local6.initialLantaiSign) {
if (PixelCollision.isColliding(_arg1.image, MovieClip(level.middleGround)[("lantaiSign" + _local2)], World.getSingleton().sceneRoot)){
_arg1.lantai = _local2;
};
_local2--;
};
};
}
public static function getSingleton():CollisionDetector{
if (INSTANCE == null){
INSTANCE = new (CollisionDetector);
};
return (INSTANCE);
}
public static function boxToBoxCollision(_arg1:DisplayObject, _arg2:DisplayObject):Boolean{
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
_local3 = _arg1.x;
_local4 = _arg2.x;
_local5 = (_arg1.x + _arg1.width);
_local6 = (_arg2.x + _arg2.width);
_local7 = _arg1.y;
_local8 = _arg2.y;
_local9 = (_arg1.y + _arg1.height);
_local10 = (_arg2.y + _arg2.height);
if (_local9 < _local8){
return (false);
};
if (_local7 > _local10){
return (false);
};
if (_local5 < _local4){
return (false);
};
if (_local3 > _local6){
return (false);
};
return (true);
}
}
}//package p_singleton
Section 270
//Updater (p_singleton.Updater)
package p_singleton {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import flash.display.*;
import org.idmedia.as3commons.util.*;
import p_gamelevel.*;
public class Updater {
public var mags:ArrayList;
public var level:GameLevel;
public var enemyBullets:ArrayList;
private var sceneRoot:Sprite;
private var midX:Number;
private var midY:Number;
public var playerBullets:ArrayList;
public var enemies:ArrayList;
public var barricades:ArrayList;
public var players:ArrayList;
public var gibs:ArrayList;
public var npcs:ArrayList;
public var shells:ArrayList;
public var itemPickUps:ArrayList;
private var stageHeight:Number;
private var stageWidth:Number;
private static var INSTANCE:Updater;
public function Updater(){
stageWidth = World.getSingleton().gameWidth;
stageHeight = World.getSingleton().gameHeight;
midX = (stageWidth / 2);
midY = (stageHeight / 2);
sceneRoot = World.getSingleton().sceneRoot;
super();
players = World.getSingleton().players;
enemies = World.getSingleton().enemies;
npcs = World.getSingleton().npcs;
itemPickUps = World.getSingleton().itemPickUps;
barricades = World.getSingleton().barricades;
playerBullets = World.getSingleton().playerBullets;
enemyBullets = World.getSingleton().enemyBullets;
shells = World.getSingleton().shells;
mags = World.getSingleton().mags;
level = World.getSingleton().level;
gibs = World.getSingleton().gibs;
}
public function updateNpcs():void{
var _local1:int;
var _local2:int;
_local1 = npcs.size();
_local2 = (_local1 - 1);
while (_local2 >= 0) {
if (npcs.get(_local2).active){
npcs.get(_local2).screenPosition.x = (npcs.get(_local2).position.x + sceneRoot.x);
npcs.get(_local2).screenPosition.y = (npcs.get(_local2).position.y + sceneRoot.y);
npcs.get(_local2).position.x = (npcs.get(_local2).body.GetPosition().x * 30);
npcs.get(_local2).position.y = (npcs.get(_local2).body.GetPosition().y * 30);
npcs.get(_local2).angle = b2Math.radiansToDegrees(npcs.get(_local2).body.GetAngle());
npcs.get(_local2).update();
};
_local2--;
};
}
public function updateEnemies():void{
var _local1:int;
var _local2:int;
_local1 = enemies.size();
_local2 = (_local1 - 1);
while (_local2 >= 0) {
if (enemies.get(_local2).active){
enemies.get(_local2).screenPosition.x = (enemies.get(_local2).position.x + sceneRoot.x);
enemies.get(_local2).screenPosition.y = (enemies.get(_local2).position.y + sceneRoot.y);
enemies.get(_local2).position.x = (enemies.get(_local2).body.GetPosition().x * 30);
enemies.get(_local2).position.y = (enemies.get(_local2).body.GetPosition().y * 30);
enemies.get(_local2).angle = b2Math.radiansToDegrees(enemies.get(_local2).body.GetAngle());
enemies.get(_local2).update();
};
_local2--;
};
}
public function preUpdateNpcs():void{
var _local1:int;
var _local2:int;
_local1 = npcs.size();
_local2 = (_local1 - 1);
while (_local2 >= 0) {
if (npcs.get(_local2).active){
npcs.get(_local2).falling();
npcs.get(_local2).climbing();
npcs.get(_local2).reset();
};
_local2--;
};
}
public function updateGibs():void{
var _local1:int;
var _local2:int;
_local1 = gibs.size();
_local2 = (_local1 - 1);
while (_local2 >= 0) {
gibs.get(_local2).screenPosition.x = (gibs.get(_local2).position.x + sceneRoot.x);
gibs.get(_local2).screenPosition.y = (gibs.get(_local2).position.y + sceneRoot.y);
gibs.get(_local2).position.x = (gibs.get(_local2).body.GetPosition().x * 30);
gibs.get(_local2).position.y = (gibs.get(_local2).body.GetPosition().y * 30);
gibs.get(_local2).angle = b2Math.radiansToDegrees(gibs.get(_local2).body.GetAngle());
gibs.get(_local2).update();
_local2--;
};
}
public function updateBullets():void{
var _local1:int;
var _local2:int;
_local1 = playerBullets.size();
_local2 = (_local1 - 1);
while (_local2 >= 0) {
playerBullets.get(_local2).screenPosition.x = (playerBullets.get(_local2).position.x + sceneRoot.x);
playerBullets.get(_local2).screenPosition.y = (playerBullets.get(_local2).position.y + sceneRoot.y);
playerBullets.get(_local2).position.x = (playerBullets.get(_local2).body.GetPosition().x * 30);
playerBullets.get(_local2).position.y = (playerBullets.get(_local2).body.GetPosition().y * 30);
playerBullets.get(_local2).angle = b2Math.radiansToDegrees(playerBullets.get(_local2).body.GetAngle());
playerBullets.get(_local2).update();
_local2--;
};
_local1 = enemyBullets.size();
_local2 = (_local1 - 1);
while (_local2 >= 0) {
enemyBullets.get(_local2).screenPosition.x = (enemyBullets.get(_local2).position.x + sceneRoot.x);
enemyBullets.get(_local2).screenPosition.y = (enemyBullets.get(_local2).position.y + sceneRoot.y);
enemyBullets.get(_local2).position.x = (enemyBullets.get(_local2).body.GetPosition().x * 30);
enemyBullets.get(_local2).position.y = (enemyBullets.get(_local2).body.GetPosition().y * 30);
enemyBullets.get(_local2).angle = b2Math.radiansToDegrees(enemyBullets.get(_local2).body.GetAngle());
enemyBullets.get(_local2).update();
_local2--;
};
}
public function updatePlayers():void{
var _local1:int;
var _local2:int;
_local1 = players.size();
_local2 = (_local1 - 1);
while (_local2 >= 0) {
if (players.get(_local2).active){
players.get(_local2).screenPosition.x = (players.get(_local2).position.x + sceneRoot.x);
players.get(_local2).screenPosition.y = (players.get(_local2).position.y + sceneRoot.y);
players.get(_local2).position.x = (players.get(_local2).body.GetPosition().x * 30);
players.get(_local2).position.y = (players.get(_local2).body.GetPosition().y * 30);
players.get(_local2).angle = b2Math.radiansToDegrees(players.get(_local2).body.GetAngle());
players.get(_local2).update();
};
_local2--;
};
}
public function preUpdateEnemies():void{
var _local1:int;
var _local2:int;
_local1 = enemies.size();
_local2 = (_local1 - 1);
while (_local2 >= 0) {
if (enemies.get(_local2).active){
enemies.get(_local2).falling();
enemies.get(_local2).climbing();
enemies.get(_local2).reset();
};
_local2--;
};
}
protected function updateItemPickUps():void{
var _local1:int;
var _local2:int;
_local1 = itemPickUps.size();
_local2 = (_local1 - 1);
while (_local2 >= 0) {
itemPickUps.get(_local2).screenPosition.x = (itemPickUps.get(_local2).position.x + sceneRoot.x);
itemPickUps.get(_local2).screenPosition.y = (itemPickUps.get(_local2).position.y + sceneRoot.y);
itemPickUps.get(_local2).position.x = (itemPickUps.get(_local2).body.GetPosition().x * 30);
itemPickUps.get(_local2).position.y = (itemPickUps.get(_local2).body.GetPosition().y * 30);
itemPickUps.get(_local2).angle = b2Math.radiansToDegrees(itemPickUps.get(_local2).body.GetAngle());
itemPickUps.get(_local2).update();
_local2--;
};
}
protected function updateLevel():void{
var _local1:Number;
var _local2:Number;
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:Number;
var _local7:String;
var _local8:Number;
var _local9:Number;
if (((World.getSingleton().playedCharacter) && ((World.getSingleton().players.size() > 0)))){
_local1 = World.getSingleton().playedCharacter.screenPosition.x;
_local2 = World.getSingleton().playedCharacter.screenPosition.y;
_local3 = World.getSingleton().gameWidth;
_local4 = World.getSingleton().gameHeight;
_local5 = World.getSingleton().level.backGround.width;
_local6 = 50;
_local7 = sceneRoot.stage.quality;
sceneRoot.stage.quality = StageQuality.LOW;
if ((((sceneRoot.x >= _local6)) && ((World.getSingleton().playedCharacter.position.x < (_local3 / 2))))){
} else {
if ((((sceneRoot.x <= ((_local3 - _local5) - _local6))) && ((World.getSingleton().playedCharacter.position.x > (_local5 - (_local3 / 2)))))){
} else {
if (midX != _local1){
_local8 = (midX - _local1);
sceneRoot.x = (sceneRoot.x + (_local8 / 10));
};
};
};
if (midY != _local2){
_local9 = (midY - _local2);
sceneRoot.y = (sceneRoot.y + (_local9 / 10));
};
level.update();
sceneRoot.stage.quality = _local7;
};
}
public function preUpdatePlayers():void{
var _local1:int;
var _local2:int;
_local1 = players.size();
_local2 = (_local1 - 1);
while (_local2 >= 0) {
if (players.get(_local2).active){
players.get(_local2).falling();
players.get(_local2).climbing();
players.get(_local2).reset();
};
_local2--;
};
}
public function update():void{
if (level){
updateLevel();
};
updatePlayers();
updateEnemies();
updateNpcs();
updateBullets();
updateShells();
updateMags();
updateItemPickUps();
updateBarricades();
updateGibs();
}
protected function updateBodyAccordingToImages():void{
var _local1:b2Body;
_local1 = World.getSingleton().physicWorld.m_bodyList;
while (_local1) {
if ((((_local1.m_userData is Sprite)) || ((_local1.m_userData is MovieClip)))){
_local1.SetXForm(new b2Vec2((_local1.m_userData.x / 30), (_local1.m_userData.y / 30)), _local1.GetAngle());
};
_local1 = _local1.m_next;
};
}
public function preUpdate():void{
preUpdatePlayers();
preUpdateEnemies();
preUpdateNpcs();
}
protected function updateBarricades():void{
var _local1:int;
var _local2:int;
_local1 = barricades.size();
_local2 = (_local1 - 1);
while (_local2 >= 0) {
barricades.get(_local2).screenPosition.x = (barricades.get(_local2).position.x + sceneRoot.x);
barricades.get(_local2).screenPosition.y = (barricades.get(_local2).position.y + sceneRoot.y);
barricades.get(_local2).position.x = (barricades.get(_local2).body.GetPosition().x * 30);
barricades.get(_local2).position.y = (barricades.get(_local2).body.GetPosition().y * 30);
barricades.get(_local2).angle = b2Math.radiansToDegrees(barricades.get(_local2).body.GetAngle());
barricades.get(_local2).update();
_local2--;
};
}
public function updateMags():void{
var _local1:int;
var _local2:int;
_local1 = mags.size();
_local2 = (_local1 - 1);
while (_local2 >= 0) {
mags.get(_local2).screenPosition.x = (mags.get(_local2).position.x + sceneRoot.x);
mags.get(_local2).screenPosition.y = (mags.get(_local2).position.y + sceneRoot.y);
mags.get(_local2).position.x = (mags.get(_local2).body.GetPosition().x * 30);
mags.get(_local2).position.y = (mags.get(_local2).body.GetPosition().y * 30);
mags.get(_local2).angle = b2Math.radiansToDegrees(mags.get(_local2).body.GetAngle());
mags.get(_local2).update();
_local2--;
};
}
public function updateShells():void{
var _local1:int;
var _local2:int;
_local1 = shells.size();
_local2 = (_local1 - 1);
while (_local2 >= 0) {
shells.get(_local2).screenPosition.x = (shells.get(_local2).position.x + sceneRoot.x);
shells.get(_local2).screenPosition.y = (shells.get(_local2).position.y + sceneRoot.y);
shells.get(_local2).position.x = (shells.get(_local2).body.GetPosition().x * 30);
shells.get(_local2).position.y = (shells.get(_local2).body.GetPosition().y * 30);
shells.get(_local2).angle = b2Math.radiansToDegrees(shells.get(_local2).body.GetAngle());
shells.get(_local2).update();
_local2--;
};
}
protected function updateAllScreenPosition():void{
var _local1:Sprite;
var _local2:int;
var _local3:int;
_local1 = World.getSingleton().sceneRoot;
_local2 = players.size();
_local3 = (_local2 - 1);
while (_local3 >= 0) {
players.get(_local3).screenPosition.x = (players.get(_local3).position.x + _local1.x);
players.get(_local3).screenPosition.y = (players.get(_local3).position.y + _local1.y);
_local3--;
};
_local2 = enemies.size();
_local3 = (_local2 - 1);
while (_local3 >= 0) {
enemies.get(_local3).screenPosition.x = (enemies.get(_local3).position.x + _local1.x);
enemies.get(_local3).screenPosition.y = (enemies.get(_local3).position.y + _local1.y);
_local3--;
};
_local2 = npcs.size();
_local3 = (_local2 - 1);
while (_local3 >= 0) {
npcs.get(_local3).screenPosition.x = (npcs.get(_local3).position.x + _local1.x);
npcs.get(_local3).screenPosition.y = (npcs.get(_local3).position.y + _local1.y);
_local3--;
};
_local2 = playerBullets.size();
_local3 = (_local2 - 1);
while (_local3 >= 0) {
playerBullets.get(_local3).screenPosition.x = (playerBullets.get(_local3).position.x + _local1.x);
playerBullets.get(_local3).screenPosition.y = (playerBullets.get(_local3).position.y + _local1.y);
_local3--;
};
_local2 = enemyBullets.size();
_local3 = (_local2 - 1);
while (_local3 >= 0) {
enemyBullets.get(_local3).screenPosition.x = (enemyBullets.get(_local3).position.x + _local1.x);
enemyBullets.get(_local3).screenPosition.y = (enemyBullets.get(_local3).position.y + _local1.y);
_local3--;
};
_local2 = shells.size();
_local3 = (_local2 - 1);
while (_local3 >= 0) {
shells.get(_local3).screenPosition.x = (shells.get(_local3).position.x + _local1.x);
shells.get(_local3).screenPosition.y = (shells.get(_local3).position.y + _local1.y);
_local3--;
};
_local2 = mags.size();
_local3 = (_local2 - 1);
while (_local3 >= 0) {
mags.get(_local3).screenPosition.x = (mags.get(_local3).position.x + _local1.x);
mags.get(_local3).screenPosition.y = (mags.get(_local3).position.y + _local1.y);
_local3--;
};
_local2 = itemPickUps.size();
_local3 = (_local2 - 1);
while (_local3 >= 0) {
itemPickUps.get(_local3).screenPosition.x = (itemPickUps.get(_local3).position.x + _local1.x);
itemPickUps.get(_local3).screenPosition.y = (itemPickUps.get(_local3).position.y + _local1.y);
_local3--;
};
_local2 = barricades.size();
_local3 = (_local2 - 1);
while (_local3 >= 0) {
barricades.get(_local3).screenPosition.x = (barricades.get(_local3).position.x + _local1.x);
barricades.get(_local3).screenPosition.y = (barricades.get(_local3).position.y + _local1.y);
_local3--;
};
}
public static function getSingleton():Updater{
if (INSTANCE == null){
INSTANCE = new (Updater);
};
return (INSTANCE);
}
}
}//package p_singleton
Section 271
//World (p_singleton.World)
package p_singleton {
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Collision.*;
import flash.events.*;
import p_char.*;
import flash.display.*;
import p_char.p_playable.*;
import org.idmedia.as3commons.util.*;
import p_gamelevel.*;
import flash.media.*;
import p_menuBar.*;
import p_crosshair.*;
import flash.utils.*;
import p_ammo.*;
import p_util.*;
import flash.net.*;
public class World extends EventDispatcher {
public var explosiveWeaponInventory:ArrayList;
public var sharedObject:SharedObject;
public var currentStage:int;// = 0
public var enemyBullets:ArrayList;
public var waveLevel:int;// = 0
private var _shakeCounter:int;// = 0
public var signBaloonVisible:Boolean;// = false
private var _direction:b2Vec2;
public var enemies:ArrayList;
private var _fps:FPSCounter;
public var levelDone:int;// = 0
public var gameStarted:Boolean;// = false
public var backgroundRoot:Sprite;
public var weaponShop:WeaponShop;
public var menuBar:MenuBar;
private var _shakeCounterMax:int;// = 10
public var playerInsideBarricade:Boolean;// = false
public var shells:ArrayList;
public var physicWorld:b2World;
public var savedPlayer:PlayableCharacter;
private var mousePVec:b2Vec2;
public var backGroundSoundChannel:SoundChannel;
public var waveTime:int;
private var _prevPosition:b2Vec2;
public var gameTimer:Timer;
public var muted:Boolean;
public var startMoney:int;// = 700
public var barricadeShop:BarricadeShop;
public var mags:ArrayList;
public var level:GameLevel;
private var _shakeTimer:Timer;
public var waveTimeEach:int;// = 90
public var sceneRoot:Sprite;
public var playerBullets:ArrayList;
public var savedMoney:Number;
public var test:int;// = 0
public var meleeWeaponInventory:ArrayList;
protected var dbgDraw:b2DebugDraw;
public var numOfWave:int;// = 4
public var score:int;
public var playedCharacter:Character;
public var numOfLevel:int;// = 2
public var mercInventory:ArrayList;
public var rangeWeaponInventory:ArrayList;
public var blackBackground:MovieClip;
private var _distance:Number;// = 15
public var barricades:ArrayList;
public var players:ArrayList;
public var gibs:ArrayList;
public var currentLevelNumber:int;// = 0
public var npcs:ArrayList;
public var gameHeight:Number;// = 500
public var waveCounter:int;// = 0
public var itemPickUps:ArrayList;
public var money:int;
public var bloods:ArrayList;
public var waveNum:int;// = 0
protected var dbgSprite:Sprite;
public var kills:int;
public var mousePointer:MousePointer;
public var savedNpcs:ArrayList;
public var tempPlayer:PlayableCharacter;
public var maxNPC:int;// = 2
public var menuRoot:Sprite;
public var savedAmmoInventory:ArrayList;
public var gameEnded:Boolean;
public var scoreMultiplier:int;// = 33
public var gameWidth:Number;// = 800
public var blurBackground:MovieClip;
public var userName:String;// = ""
public static const gameUpdateInterval:int = 30;
public static const gravity:Number = 2;
public static const physicsIteration:int = 5;
public static const physicsDT:Number = 0.0333333333333333;
public static const physScale:Number = 30;
private static var INSTANCE:World;
public function World(){
var _local1:Ammo;
gameWidth = 800;
gameHeight = 500;
test = 0;
startMoney = 700;
money = startMoney;
numOfWave = 4;
waveNum = 0;
waveLevel = 0;
waveCounter = 0;
scoreMultiplier = 33;
waveTimeEach = 90;
currentStage = 0;
currentLevelNumber = 0;
levelDone = 0;
numOfLevel = 2;
userName = "";
signBaloonVisible = false;
maxNPC = 2;
playerInsideBarricade = false;
gameStarted = false;
_shakeCounter = 0;
_shakeCounterMax = 10;
_distance = 15;
mousePVec = new b2Vec2();
super();
sceneRoot = new Sprite();
menuRoot = new Sprite();
backgroundRoot = new Sprite();
players = new ArrayList();
enemies = new ArrayList();
npcs = new ArrayList();
savedNpcs = new ArrayList();
itemPickUps = new ArrayList();
barricades = new ArrayList();
playerBullets = new ArrayList();
enemyBullets = new ArrayList();
shells = new ArrayList();
mags = new ArrayList();
bloods = new ArrayList();
gibs = new ArrayList();
dbgDraw = new b2DebugDraw();
dbgSprite = new Sprite();
score = 0;
kills = 0;
savedMoney = startMoney;
savedAmmoInventory = new ArrayList();
_local1 = new Ammo12Gauge(30);
savedAmmoInventory.add(_local1);
_local1 = new Ammo357(30);
savedAmmoInventory.add(_local1);
_local1 = new Ammo45(30);
savedAmmoInventory.add(_local1);
_local1 = new Ammo556(30);
savedAmmoInventory.add(_local1);
_local1 = new Ammo762(30);
savedAmmoInventory.add(_local1);
_local1 = new Ammo9mm(50);
savedAmmoInventory.add(_local1);
blurBackground = new blurBG();
blurBackground.alpha = 0;
blackBackground = new blackBG();
blackBackground.alpha = 0;
backgroundRoot.addChild(blurBackground);
backgroundRoot.addChild(blackBackground);
gameTimer = new Timer(gameUpdateInterval);
gameTimer.addEventListener(TimerEvent.TIMER, updateWorld);
gameEnded = false;
muted = false;
}
public function shakeScreen():void{
if (!_shakeTimer){
_shakeTimer = new Timer(10);
_shakeTimer.addEventListener(TimerEvent.TIMER, shaking);
};
if (!_shakeTimer.running){
_shakeTimer.start();
_prevPosition = new b2Vec2(sceneRoot.x, sceneRoot.y);
};
}
public function initPhysicWorld(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:b2Vec2, _arg4:Boolean=true, _arg5:b2ContactListener=null, _arg6:b2ContactFilter=null):void{
var _local7:b2AABB;
_local7 = new b2AABB();
_local7.lowerBound.Set((_arg1.x / physScale), (_arg1.y / physScale));
_local7.upperBound.Set((_arg2.x / physScale), (_arg2.y / physScale));
physicWorld = new b2World(_local7, _arg3, _arg4);
if (_arg5){
physicWorld.SetContactListener(_arg5);
};
if (_arg6){
physicWorld.SetContactFilter(_arg6);
};
}
public function saveGame():void{
initSharedObject();
sharedObject.data.levelDone = levelDone;
sharedObject.flush();
sharedObject.close();
}
public function pauseGame():void{
dispatchEvent(new Event(WorldEvent.ON_PAUSE));
gameTimer.stop();
}
public function initInventory():void{
if (meleeWeaponInventory){
meleeWeaponInventory.clear();
} else {
meleeWeaponInventory = new ArrayList();
};
if (rangeWeaponInventory){
rangeWeaponInventory.clear();
} else {
rangeWeaponInventory = new ArrayList();
};
if (explosiveWeaponInventory){
explosiveWeaponInventory.clear();
} else {
explosiveWeaponInventory = new ArrayList();
};
if (mercInventory){
mercInventory.clear();
} else {
mercInventory = new ArrayList();
};
}
public function updateWorld(_arg1:TimerEvent):void{
physicWorld.Step(physicsDT, physicsIteration);
dispatchEvent(new Event(WorldEvent.ON_UPDATE));
_arg1.updateAfterEvent();
}
public function GetBodyAt(_arg1:Number, _arg2:Number):b2Body{
var _local3:b2AABB;
var _local4:int;
var _local5:Array;
var _local6:int;
var _local7:b2Body;
var _local8:int;
var _local9:b2Shape;
var _local10:Boolean;
mousePVec.Set(_arg1, _arg2);
_local3 = new b2AABB();
_local3.lowerBound.Set((_arg1 - 0.01), (_arg2 - 0.01));
_local3.upperBound.Set((_arg1 + 0.01), (_arg2 + 0.01));
_local4 = 10;
_local5 = new Array();
_local6 = physicWorld.Query(_local3, _local5, _local4);
_local7 = null;
_local8 = 0;
while (_local8 < _local6) {
if (_local5[_local8].GetBody().IsStatic() == false){
_local9 = (_local5[_local8] as b2Shape);
_local10 = (_local5[_local8] as b2Shape).TestPoint(_local9.GetBody().GetXForm(), mousePVec);
if (_local10){
_local7 = _local9.GetBody();
break;
};
};
_local8++;
};
return (_local7);
}
public function shaking(_arg1:TimerEvent):void{
if (_shakeCounter >= _shakeCounterMax){
_shakeTimer.stop();
_shakeCounter = 0;
sceneRoot.x = _prevPosition.x;
sceneRoot.y = _prevPosition.y;
return;
};
_direction = new b2Vec2(0, 0);
_direction.x = (Math.random() - Math.random());
_direction.y = (Math.random() - Math.random());
sceneRoot.x = (sceneRoot.x + (_direction.x * _distance));
sceneRoot.y = (sceneRoot.y + (_direction.y * _distance));
_shakeCounter++;
}
public function initSharedObject():void{
try {
sharedObject = SharedObject.getLocal("noMoreDaysMemory");
} catch(error:Error) {
trace(("SharedObject Error:" + error.toString()));
return;
};
}
public function initWorld():void{
dispatchEvent(new Event(WorldEvent.ON_INIT));
}
public function startGame():void{
dispatchEvent(new Event(WorldEvent.ON_START));
gameTimer.start();
}
public function setDebugMode(_arg1:Boolean):void{
if (_arg1){
dbgDraw.m_sprite = dbgSprite;
dbgDraw.m_drawScale = 30;
dbgDraw.m_fillAlpha = 0.6;
dbgDraw.m_lineThickness = 1;
dbgDraw.m_drawFlags = 4294967295;
physicWorld.SetDebugDraw(dbgDraw);
sceneRoot.addChild(dbgSprite);
} else {
if (sceneRoot.contains(dbgSprite)){
sceneRoot.removeChild(dbgSprite);
};
};
}
public function changeLevel(_arg1:GameLevel):void{
if (this.level){
this.level.detachChild();
this.level.destroyBodies();
};
this.level = _arg1;
CollisionDetector.getSingleton().level = _arg1;
Updater.getSingleton().level = _arg1;
this.level.attachChild();
}
public function setFocusToStage():void{
sceneRoot.stage.focus = sceneRoot.stage;
}
public function loadGame():void{
initSharedObject();
levelDone = sharedObject.data.levelDone;
sharedObject.flush();
sharedObject.close();
}
public static function getSingleton():World{
if (INSTANCE == null){
INSTANCE = new (World);
};
return (INSTANCE);
}
}
}//package p_singleton
Section 272
//WorldEvent (p_singleton.WorldEvent)
package p_singleton {
public class WorldEvent {
public static var ON_UPDATE:String = "OnUpdate";
public static var ON_LOADED:String = "OnLoaded";
public static var ON_START:String = "OnStart";
public static var ON_INIT:String = "OnInit";
public static var ON_PAUSE:String = "OnPause";
public static var ON_LOADING:String = "OnLoading";
}
}//package p_singleton
Section 273
//StateEnemy (p_state.p_enemyState.StateEnemy)
package p_state.p_enemyState {
import p_char.*;
import p_singleton.*;
import p_char.p_nonplayable.*;
public class StateEnemy {
public var id:String;
public var char:NonPlayableCharacter;
public function StateEnemy(_arg1:NonPlayableCharacter){
char = _arg1;
}
public function moveTo(_arg1:Number):void{
if (_arg1 < char.position.x){
char.direction.x = -1;
if (char.run){
char.runLeft();
} else {
char.walkLeft();
};
if (char.faceState == FaceState.FACE_RIGHT){
char.turnFace();
};
} else {
char.direction.x = 1;
if (char.run){
char.runRight();
} else {
char.walkRight();
};
if (char.faceState == FaceState.FACE_LEFT){
char.turnFace();
};
};
}
public function checkFace(_arg1:Number):void{
if (_arg1 < char.position.x){
char.direction.x = -1;
if (char.faceState == FaceState.FACE_RIGHT){
char.turnFace();
};
} else {
char.direction.x = 1;
if (char.faceState == FaceState.FACE_LEFT){
char.turnFace();
};
};
}
public function checkIsRangeReached():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
_local1 = Math.abs((char.position.x - char.nearestTarget.position.x));
_local2 = Math.abs((char.position.y - char.nearestTarget.position.y));
_local3 = (_local1 * _local1);
_local4 = (_local2 * _local2);
_local5 = Math.sqrt((_local3 + _local4));
if (_local5 <= char.distanceLimit){
char.rangeIsReached = true;
} else {
char.rangeIsReached = false;
};
}
public function update():StateEnemy{
return (this);
}
public function isInsideRangeVertical(_arg1:Number, _arg2:Number, _arg3:Number):Boolean{
var _local4:Number;
_local4 = Math.abs((_arg1 - _arg2));
if (_local4 <= _arg3){
return (true);
};
return (false);
}
public function isInsideRangeHorizontal(_arg1:Number, _arg2:Number, _arg3:Number):Boolean{
var _local4:Number;
_local4 = Math.abs((_arg1 - _arg2));
if (_local4 <= _arg3){
return (true);
};
return (false);
}
public function storeNearestPlayer():void{
var _local1:int;
var _local2:int;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
_local1 = World.getSingleton().players.size();
_local2 = 0;
char.nearestDistance = 10000;
_local2 = (_local1 - 1);
while (_local2 >= 0) {
_local3 = Math.abs((char.position.x - World.getSingleton().players.get(_local2).position.x));
_local4 = Math.abs((char.position.y - World.getSingleton().players.get(_local2).position.y));
_local5 = (_local3 * _local3);
_local6 = (_local4 * _local4);
_local7 = Math.sqrt((_local5 + _local6));
if (_local7 < char.nearestDistance){
char.nearestDistance = _local7;
char.nearestTarget = World.getSingleton().players.get(_local2);
};
_local2--;
};
_local1 = World.getSingleton().npcs.size();
_local2 = 0;
_local2 = (_local1 - 1);
while (_local2 >= 0) {
_local3 = Math.abs((char.position.x - World.getSingleton().npcs.get(_local2).position.x));
_local4 = Math.abs((char.position.y - World.getSingleton().npcs.get(_local2).position.y));
_local5 = (_local3 * _local3);
_local6 = (_local4 * _local4);
_local7 = Math.sqrt((_local5 + _local6));
if (_local7 < char.nearestDistance){
char.nearestDistance = _local7;
char.nearestTarget = World.getSingleton().npcs.get(_local2);
};
_local2--;
};
}
}
}//package p_state.p_enemyState
Section 274
//StateEnemyAttack (p_state.p_enemyState.StateEnemyAttack)
package p_state.p_enemyState {
import p_char.p_nonplayable.*;
import p_state.*;
public class StateEnemyAttack extends StateEnemy {
public function StateEnemyAttack(_arg1:NonPlayableCharacter){
id = StateId.ATTACK;
super(_arg1);
}
override public function update():StateEnemy{
if (char.nearestTarget.body == null){
return (new StateEnemyIdle(char));
};
checkIsRangeReached();
if (char.rangeIsReached){
checkFace(char.nearestTarget.position.x);
char.attack(false);
} else {
return (new StateEnemySearching(char));
};
return (this);
}
}
}//package p_state.p_enemyState
Section 275
//StateEnemyCalculate (p_state.p_enemyState.StateEnemyCalculate)
package p_state.p_enemyState {
import p_singleton.*;
import p_char.p_nonplayable.*;
import p_state.*;
public class StateEnemyCalculate extends StateEnemy {
public function StateEnemyCalculate(_arg1:NonPlayableCharacter){
id = StateId.CALCULATE;
super(_arg1);
}
override public function update():StateEnemy{
var _local1:Number;
if (char.nearestTarget == null){
return (new StateEnemyIdle(char));
};
if (char.lantai == -1){
return (this);
};
if (char.lantai < char.nearestTarget.lantai){
char.isMovingUp = true;
char.ladderDestination = char.level.findNearestLadderUp(char, World.getSingleton().currentStage, char.lantai);
char.previousLantai = char.lantai;
if (char.ladderDestination == -1){
char.isMovingUp = false;
char.isMovingDown = false;
_local1 = ((Math.floor((Math.random() * 10)) + 1) % 2);
if (_local1 == 0){
char.isMovingRight = true;
char.isMovingLeft = false;
} else {
char.isMovingRight = false;
char.isMovingLeft = true;
};
return (new StateEnemyPatrol(char));
} else {
return (new StateEnemyChase(char));
};
//unresolved jump
};
if (char.lantai > char.nearestTarget.lantai){
char.isMovingDown = true;
char.ladderDestination = char.level.findNearestLadderDown(char, World.getSingleton().currentStage, char.lantai);
char.previousLantai = char.lantai;
if (char.ladderDestination == -1){
char.isMovingUp = false;
char.isMovingDown = false;
_local1 = ((Math.floor((Math.random() * 10)) + 1) % 2);
if (_local1 == 0){
char.isMovingRight = true;
char.isMovingLeft = false;
} else {
char.isMovingRight = false;
char.isMovingLeft = true;
};
return (new StateEnemyPatrol(char));
} else {
return (new StateEnemyChase(char));
};
} else {
};
return (!NULL!);
}
}
}//package p_state.p_enemyState
Section 276
//StateEnemyChase (p_state.p_enemyState.StateEnemyChase)
package p_state.p_enemyState {
import p_char.*;
import p_singleton.*;
import flash.display.*;
import p_char.p_nonplayable.*;
import p_state.*;
public class StateEnemyChase extends StateEnemy {
public function StateEnemyChase(_arg1:NonPlayableCharacter){
id = StateId.CHASE;
super(_arg1);
}
override public function update():StateEnemy{
if (char.body.touchedBarricade){
char.body.touchedBarricade = false;
if (char.body.faceRight){
if (char.faceState == FaceState.FACE_LEFT){
char.turnFace();
};
} else {
if (char.faceState == FaceState.FACE_RIGHT){
char.turnFace();
};
};
char.attack(false);
return (this);
};
if ((((World.getSingleton().players.size() <= 0)) || ((char.nearestTarget == null)))){
return (new StateEnemyIdle(char));
};
checkIsRangeReached();
if (char.rangeIsReached){
return (new StateEnemyAttack(char));
};
if (char.isMovingUp){
if (char.nearestTarget){
if (char.nearestTarget.lantai == char.lantai){
if (char.onTheLadderDown == -1){
char.isMovingDown = false;
char.isMovingUp = false;
};
};
};
if (char.onTheLadderUp == char.ladderDestination){
char.arrived = true;
char.moveUp();
} else {
if (char.arrived){
if (char.onTheLadderDown != char.ladderDestination){
char.isMovingUp = false;
char.arrived = false;
} else {
char.onTheLadderUp = char.ladderDestination;
char.moveUp();
};
} else {
moveTo(MovieClip(char.level.middleGround)[("ladder" + char.ladderDestination)].x);
if (isInsideRangeHorizontal(char.position.x, MovieClip(char.level.middleGround)[("ladder" + char.ladderDestination)].x, 10)){
char.onTheLadderUp = char.ladderDestination;
char.ableToMoveUp = true;
char.moveUp();
};
};
};
} else {
if (char.isMovingDown){
if (char.onTheLadderDown == char.ladderDestination){
char.arrived = true;
char.moveDown();
} else {
if (char.arrived){
char.isMovingDown = false;
char.arrived = false;
} else {
moveTo(MovieClip(char.level.middleGround)[("ladder" + char.ladderDestination)].x);
if (isInsideRangeHorizontal(char.position.x, MovieClip(char.level.middleGround)[("ladder" + char.ladderDestination)].x, 10)){
char.onTheLadderDown = char.ladderDestination;
char.ableToMoveDown = true;
char.moveDown();
};
};
};
} else {
if (char.lantai == char.nearestTarget.lantai){
moveTo(char.nearestTarget.position.x);
if (char.nearestTarget.onTheLadderUp != -1){
if (char.nearestTarget.position.y < char.position.y){
if (char.onTheLadderUp != -1){
char.moveUp();
};
} else {
if (char.nearestTarget.position.y > char.position.y){
if (char.onTheLadderDown != -1){
char.moveDown();
};
};
};
} else {
if (char.nearestTarget.onTheLadderDown != -1){
if (char.nearestTarget.position.y < char.position.y){
if (char.onTheLadderUp != -1){
char.moveUp();
};
} else {
if (char.nearestTarget.position.y > char.position.y){
if (char.onTheLadderDown != -1){
char.moveDown();
};
};
};
};
};
} else {
return (new StateEnemySearching(char));
};
};
};
return (this);
}
}
}//package p_state.p_enemyState
Section 277
//StateEnemyIdle (p_state.p_enemyState.StateEnemyIdle)
package p_state.p_enemyState {
import p_singleton.*;
import p_char.p_nonplayable.*;
import p_state.*;
public class StateEnemyIdle extends StateEnemy {
public function StateEnemyIdle(_arg1:NonPlayableCharacter){
id = StateId.IDLE;
super(_arg1);
}
override public function update():StateEnemy{
var _local1:Number;
char.setIdle();
if ((((char.nearestTarget == null)) && ((((World.getSingleton().players.size() > 0)) || ((World.getSingleton().npcs.size() > 0)))))){
this.storeNearestPlayer();
return (new StateEnemySearching(char));
};
if (((char.nearestTarget) && ((((World.getSingleton().players.size() > 0)) || ((World.getSingleton().npcs.size() > 0)))))){
if (char.nearestTarget.body == null){
this.storeNearestPlayer();
return (new StateEnemySearching(char));
};
} else {
_local1 = ((Math.floor((Math.random() * 10)) + 1) % 2);
if (_local1 == 0){
_local1 = ((Math.floor((Math.random() * 10)) + 1) % 2);
if (_local1 == 0){
char.isMovingRight = true;
char.isMovingLeft = false;
} else {
char.isMovingRight = false;
char.isMovingLeft = true;
};
return (new StateEnemyPatrol(char));
};
};
return (this);
}
}
}//package p_state.p_enemyState
Section 278
//StateEnemyPatrol (p_state.p_enemyState.StateEnemyPatrol)
package p_state.p_enemyState {
import p_char.*;
import p_singleton.*;
import p_char.p_nonplayable.*;
import p_state.*;
public class StateEnemyPatrol extends StateEnemy {
public function StateEnemyPatrol(_arg1:NonPlayableCharacter){
id = StateId.PATROL;
super(_arg1);
}
override public function update():StateEnemy{
if ((((World.getSingleton().players.size() > 0)) && (char.nearestTarget))){
checkIsRangeReached();
if (char.rangeIsReached){
return (new StateEnemyAttack(char));
};
};
if (char.isMovingRight){
if (char.ableToMoveRight){
char.walkRight();
if (char.faceState == FaceState.FACE_LEFT){
char.turnFace();
};
} else {
char.isMovingRight = false;
char.isMovingLeft = true;
return (new StateEnemySearching(char));
};
} else {
if (char.isMovingLeft){
if (char.ableToMoveLeft){
char.walkLeft();
if (char.faceState == FaceState.FACE_RIGHT){
char.turnFace();
};
} else {
char.isMovingRight = true;
char.isMovingLeft = false;
return (new StateEnemySearching(char));
};
};
};
return (this);
}
}
}//package p_state.p_enemyState
Section 279
//StateEnemySearching (p_state.p_enemyState.StateEnemySearching)
package p_state.p_enemyState {
import p_char.p_nonplayable.*;
import p_state.*;
public class StateEnemySearching extends StateEnemy {
public function StateEnemySearching(_arg1:NonPlayableCharacter){
id = StateId.SEARCH;
super(_arg1);
}
override public function update():StateEnemy{
if (char.nearestTarget){
checkIsRangeReached();
if (char.rangeIsReached){
return (new StateEnemyAttack(char));
};
return (new StateEnemyCalculate(char));
} else {
};
return (!NULL!);
}
}
}//package p_state.p_enemyState
Section 280
//StateNPCFriend (p_state.p_npcFriendState.StateNPCFriend)
package p_state.p_npcFriendState {
import Box2D.Common.Math.*;
import p_weapon.*;
import p_char.*;
import p_singleton.*;
import p_char.p_nonplayable.*;
public class StateNPCFriend {
public var id:String;
public var char:NPCFriend;
public function StateNPCFriend(_arg1:NPCFriend){
char = _arg1;
}
public function moveTo(_arg1:b2Vec2):void{
if (_arg1.x < char.position.x){
char.direction.x = -1;
if (char.run){
char.runLeft();
} else {
char.walkLeft();
};
} else {
if (_arg1.x > char.position.x){
char.direction.x = 1;
if (char.run){
char.runRight();
} else {
char.walkRight();
};
};
};
}
public function checkFace(_arg1:Number):void{
if (_arg1 < char.position.x){
char.direction.x = -1;
if (char.faceState == FaceState.FACE_RIGHT){
char.turnFace();
};
} else {
char.direction.x = 1;
if (char.faceState == FaceState.FACE_LEFT){
char.turnFace();
};
};
}
public function attack():void{
if (((char.nearestTarget) && ((World.getSingleton().enemies.size() > 0)))){
checkFace(char.nearestTarget.screenPosition.x);
char.aim(char.nearestTarget.screenPosition.x, char.nearestTarget.screenPosition.y);
if (char.currentWeapon){
char.attack(true);
if (char.currentWeapon.weaponType == WeaponType.RANGE){
RangeWeapon(char.currentWeapon).ammoType.amount++;
} else {
if (char.currentWeapon.weaponType == WeaponType.MELEE){
} else {
if (char.currentWeapon.weaponType == WeaponType.EXPLOSIVE){
ExplosiveWeapon(char.currentWeapon).reloadAmmo++;
};
};
};
};
};
}
public function update():StateNPCFriend{
return (this);
}
public function storeNearestEnemy():void{
var _local1:int;
var _local2:int;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
_local1 = World.getSingleton().enemies.size();
_local2 = 0;
char.nearestDistance = 10000;
_local2 = (_local1 - 1);
while (_local2 >= 0) {
if ((((World.getSingleton().enemies.get(_local2).lantai == char.lantai)) && ((World.getSingleton().enemies.get(_local2).stageNumber == char.stageNumber)))){
_local3 = Math.abs((char.position.x - World.getSingleton().enemies.get(_local2).position.x));
_local4 = Math.abs((char.position.y - World.getSingleton().enemies.get(_local2).position.y));
_local5 = (_local3 * _local3);
_local6 = (_local4 * _local4);
_local7 = Math.sqrt((_local5 + _local6));
if (_local7 < char.nearestDistance){
char.nearestDistance = _local7;
char.nearestTarget = World.getSingleton().enemies.get(_local2);
};
};
_local2--;
};
}
public function isInsideRangeVertical(_arg1:Number, _arg2:Number, _arg3:Number):Boolean{
var _local4:Number;
_local4 = Math.abs((_arg1 - _arg2));
if (_local4 <= _arg3){
return (true);
};
return (false);
}
public function checkIsRangeReached():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
if (char.nearestTarget){
if ((((char.stageNumber == char.nearestTarget.stageNumber)) && ((char.lantai == char.nearestTarget.lantai)))){
_local1 = Math.abs((char.position.x - char.nearestTarget.position.x));
_local2 = Math.abs((char.position.y - char.nearestTarget.position.y));
_local3 = (_local1 * _local1);
_local4 = (_local2 * _local2);
_local5 = Math.sqrt((_local3 + _local4));
if (_local5 <= char.distanceLimit){
char.enemyRangeIsReached = true;
} else {
char.enemyRangeIsReached = false;
};
} else {
char.enemyRangeIsReached = false;
};
};
}
public function checkOnLadder():void{
if (char.charToFollow){
if (char.charToFollow.position.y < char.position.y){
if (char.charToFollow.onTheLadderUp != -1){
if (char.onTheLadderUp != -1){
char.ableToMoveUp = true;
char.moveUp();
};
} else {
if (char.charToFollow.onTheLadderDown != -1){
if (char.onTheLadderUp != -1){
char.ableToMoveUp = true;
char.moveUp();
};
};
};
} else {
if (char.charToFollow.position.y > char.position.y){
if (char.charToFollow.onTheLadderUp != -1){
if (char.onTheLadderDown != -1){
char.ableToMoveDown = true;
char.moveDown();
};
} else {
if (char.charToFollow.onTheLadderDown != -1){
if (char.onTheLadderDown != -1){
char.ableToMoveDown = true;
char.moveDown();
};
};
};
};
};
};
}
public function checkDifferentLantai():Boolean{
if (char.charToFollow){
if (char.charToFollow.lantai > char.lantai){
char.isMovingUp = true;
char.ladderDestination = World.getSingleton().level.findNearestLadderUp(char, World.getSingleton().currentStage, char.lantai);
return (true);
};
if (char.charToFollow.lantai < char.lantai){
char.isMovingDown = true;
char.ladderDestination = World.getSingleton().level.findNearestLadderDown(char, World.getSingleton().currentStage, char.lantai);
return (true);
};
};
char.ladderDestination = -1;
return (false);
}
public function isInsideRangeHorizontal(_arg1:Number, _arg2:Number, _arg3:Number):Boolean{
var _local4:Number;
_local4 = Math.abs((_arg1 - _arg2));
if (_local4 <= _arg3){
return (true);
};
return (false);
}
}
}//package p_state.p_npcFriendState
Section 281
//StateNPCFriendClimb (p_state.p_npcFriendState.StateNPCFriendClimb)
package p_state.p_npcFriendState {
import Box2D.Common.Math.*;
import p_singleton.*;
import flash.display.*;
import p_char.p_nonplayable.*;
public class StateNPCFriendClimb extends StateNPCFriend {
public function StateNPCFriendClimb(_arg1:NPCFriend){
super(_arg1);
}
override public function update():StateNPCFriend{
if (char.ladderDestination != -1){
if (char.charToFollow){
if (char.charToFollow.lantai == char.lantai){
if (char.onTheLadderDown == -1){
char.isMovingDown = false;
char.isMovingUp = false;
};
};
};
if (char.isMovingUp){
if (char.onTheLadderUp == char.ladderDestination){
char.arrived = true;
char.moveUp();
} else {
if (char.arrived){
if (char.onTheLadderDown != char.ladderDestination){
char.isMovingUp = false;
char.arrived = false;
} else {
char.onTheLadderUp = char.ladderDestination;
char.moveUp();
};
} else {
moveTo(new b2Vec2(MovieClip(World.getSingleton().level.middleGround)[("ladder" + char.ladderDestination)].x, 0));
if (isInsideRangeHorizontal(char.position.x, MovieClip(World.getSingleton().level.middleGround)[("ladder" + char.ladderDestination)].x, 10)){
char.onTheLadderUp = char.ladderDestination;
char.ableToMoveUp = true;
char.moveUp();
};
};
};
return (this);
} else {
if (char.isMovingDown){
if (char.onTheLadderDown == char.ladderDestination){
char.arrived = true;
char.moveDown();
} else {
if (char.arrived){
char.isMovingDown = false;
char.arrived = false;
} else {
moveTo(new b2Vec2(MovieClip(World.getSingleton().level.middleGround)[("ladder" + char.ladderDestination)].x, 0));
if (isInsideRangeHorizontal(char.position.x, MovieClip(World.getSingleton().level.middleGround)[("ladder" + char.ladderDestination)].x, 10)){
char.onTheLadderDown = char.ladderDestination;
char.ableToMoveDown = true;
char.moveDown();
};
};
};
return (this);
};
};
};
char.isMovingUp = false;
char.isMovingDown = false;
return (new StateNPCFriendIdle(char));
}
}
}//package p_state.p_npcFriendState
Section 282
//StateNPCFriendFollow (p_state.p_npcFriendState.StateNPCFriendFollow)
package p_state.p_npcFriendState {
import p_singleton.*;
import p_char.p_nonplayable.*;
import p_state.*;
public class StateNPCFriendFollow extends StateNPCFriend {
public function StateNPCFriendFollow(_arg1:NPCFriend){
id = StateId.FOLLOW;
super(_arg1);
}
override public function update():StateNPCFriend{
storeNearestEnemy();
checkIsRangeReached();
if (char.enemyRangeIsReached){
if (World.getSingleton().playedCharacter){
attack();
};
};
if (char.charToFollow){
if (char.follow){
if (char.body.shouldJump){
char.body.shouldJump = false;
char.jump();
};
if (checkDifferentLantai()){
return (new StateNPCFriendClimb(char));
};
if (!arriveToChar()){
return (this);
};
return (new StateNPCFriendIdle(char));
};
} else {
char.follow = false;
return (new StateNPCFriendIdle(char));
};
return (this);
}
public function arriveToChar():Boolean{
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
_local1 = 0;
_local1 = (char.charToFollow.position.x - char.position.x);
_local2 = 0;
_local2 = (char.charToFollow.position.y - char.position.y);
_local3 = (_local1 * _local1);
_local4 = (_local2 * _local2);
_local5 = Math.abs(_local1);
if (_local5 > char.charDistanceLimit){
moveTo(char.charToFollow.position);
return (false);
};
return (true);
}
}
}//package p_state.p_npcFriendState
Section 283
//StateNPCFriendIdle (p_state.p_npcFriendState.StateNPCFriendIdle)
package p_state.p_npcFriendState {
import p_singleton.*;
import p_char.p_nonplayable.*;
import p_state.*;
public class StateNPCFriendIdle extends StateNPCFriend {
public function StateNPCFriendIdle(_arg1:NPCFriend){
id = StateId.IDLE;
super(_arg1);
}
override public function update():StateNPCFriend{
char.setIdle();
storeNearestEnemy();
checkIsRangeReached();
if (char.enemyRangeIsReached){
if (World.getSingleton().playedCharacter){
attack();
};
};
if (char.follow){
return (new StateNPCFriendFollow(char));
};
return (this);
}
}
}//package p_state.p_npcFriendState
Section 284
//StateId (p_state.StateId)
package p_state {
public class StateId {
public static var ATTACK:String = "ATTACK";
public static var CALCULATE:String = "CALCULATE";
public static var SEARCH:String = "SEARCH";
public static var PATROL:String = "PATROL";
public static var CHASE:String = "CHASE";
public static var FOLLOW:String = "FOLLOW";
public static var IDLE:String = "IDLE";
}
}//package p_state
Section 285
//ContactFilterer (p_util.ContactFilterer)
package p_util {
import Box2D.Collision.Shapes.*;
import Box2D.Dynamics.*;
import p_char.*;
public class ContactFilterer extends b2ContactFilter {
public static var b2_defaultFilter:b2ContactFilter = new b2ContactFilter();
public function itemPickUpCollision(_arg1:b2FilterData, _arg2:b2FilterData):Boolean{
if (_arg1.groupIndex == BodyType.ITEM_PICK_UP){
if (((((!((_arg2.groupIndex == BodyType.WALL))) && (!((_arg2.groupIndex == BodyType.FLOOR))))) && (!((_arg2.groupIndex == BodyType.ITEM_PICK_UP))))){
if (_arg2.groupIndex != BodyType.PLAYER){
return (false);
};
};
} else {
if (_arg2.groupIndex == BodyType.ITEM_PICK_UP){
if (((((!((_arg1.groupIndex == BodyType.WALL))) && (!((_arg1.groupIndex == BodyType.FLOOR))))) && (!((_arg1.groupIndex == BodyType.ITEM_PICK_UP))))){
if (_arg1.groupIndex != BodyType.PLAYER){
return (false);
};
};
};
};
return (true);
}
public function charCharCollision(_arg1:b2FilterData, _arg2:b2FilterData):Boolean{
if ((((_arg1.groupIndex == BodyType.PLAYER)) || ((_arg1.groupIndex == BodyType.ENEMY)))){
if ((((_arg2.groupIndex == BodyType.PLAYER)) || ((_arg2.groupIndex == BodyType.ENEMY)))){
return (false);
};
};
return (true);
}
public function bulletBarricadeCollision(_arg1:b2Shape, _arg2:b2Shape):Boolean{
var _local3:b2FilterData;
var _local4:b2FilterData;
_local3 = _arg1.GetFilterData();
_local4 = _arg2.GetFilterData();
if (_local3.groupIndex == BodyType.PLAYER_BULLET){
if (_local4.groupIndex == BodyType.BARRICADE){
return (false);
};
} else {
if (_local3.groupIndex == BodyType.BARRICADE){
if (_local4.groupIndex == BodyType.PLAYER_BULLET){
return (false);
};
};
};
return (true);
}
public function shellCharCollision(_arg1:b2FilterData, _arg2:b2FilterData):Boolean{
if (_arg1.groupIndex == BodyType.SHELL){
if ((((_arg2.groupIndex == BodyType.PLAYER)) || ((_arg2.groupIndex == BodyType.ENEMY)))){
return (false);
};
} else {
if (_arg2.groupIndex == BodyType.SHELL){
if ((((_arg1.groupIndex == BodyType.PLAYER)) || ((_arg1.groupIndex == BodyType.ENEMY)))){
return (false);
};
};
};
return (true);
}
public function bulletBulletCollision(_arg1:b2Shape, _arg2:b2Shape):Boolean{
var _local3:b2FilterData;
var _local4:b2FilterData;
_local3 = _arg1.GetFilterData();
_local4 = _arg2.GetFilterData();
if ((((_local3.groupIndex == BodyType.PLAYER_BULLET)) || ((_local3.groupIndex == BodyType.ENEMY_BULLET)))){
if ((((_local4.groupIndex == BodyType.PLAYER_BULLET)) || ((_local4.groupIndex == BodyType.ENEMY_BULLET)))){
return (false);
};
};
return (true);
}
override public function ShouldCollide(_arg1:b2Shape, _arg2:b2Shape):Boolean{
var _local3:b2FilterData;
var _local4:b2FilterData;
var _local5:Boolean;
_local3 = _arg1.GetFilterData();
_local4 = _arg2.GetFilterData();
if (!charCharCollision(_local3, _local4)){
return (false);
};
if (!bulletBulletCollision(_arg1, _arg2)){
return (false);
};
if (!charBulletCollision(_arg1, _arg2)){
return (false);
};
if (!bulletBarricadeCollision(_arg1, _arg2)){
return (false);
};
if (!gibsCollision(_local3, _local4)){
return (false);
};
if (!magsCharCollision(_local3, _local4)){
return (false);
};
if (!itemPickUpCollision(_local3, _local4)){
return (false);
};
if (!shellCharCollision(_local3, _local4)){
return (false);
};
if (!playerLimitCollision(_local3, _local4)){
return (false);
};
_local5 = ((!(((_local3.maskBits & _local4.categoryBits) == 0))) && (!(((_local3.categoryBits & _local4.maskBits) == 0))));
return (_local5);
}
public function playerLimitCollision(_arg1:b2FilterData, _arg2:b2FilterData):Boolean{
if (_arg1.groupIndex == BodyType.PLAYERLIMIT){
if (((!((_arg2.groupIndex == BodyType.PLAYER))) && (!((_arg2.groupIndex == BodyType.BARRICADE))))){
return (false);
};
} else {
if (_arg2.groupIndex == BodyType.PLAYERLIMIT){
if (((!((_arg1.groupIndex == BodyType.PLAYER))) && (!((_arg1.groupIndex == BodyType.BARRICADE))))){
return (false);
};
};
};
return (true);
}
public function charBulletCollision(_arg1:b2Shape, _arg2:b2Shape):Boolean{
var _local3:b2FilterData;
var _local4:b2FilterData;
_local3 = _arg1.GetFilterData();
_local4 = _arg2.GetFilterData();
if (_local3.groupIndex == BodyType.PLAYER_BULLET){
if (_local4.groupIndex == BodyType.PLAYER){
return (false);
};
} else {
if (_local4.groupIndex == BodyType.PLAYER_BULLET){
if (_local3.groupIndex == BodyType.PLAYER){
return (false);
};
};
};
if (_local3.groupIndex == BodyType.ENEMY_BULLET){
if (_local4.groupIndex == BodyType.ENEMY){
return (false);
};
} else {
if (_local4.groupIndex == BodyType.ENEMY_BULLET){
if (_local3.groupIndex == BodyType.ENEMY){
return (false);
};
};
};
return (true);
}
public function magsCharCollision(_arg1:b2FilterData, _arg2:b2FilterData):Boolean{
if (_arg1.groupIndex == BodyType.MAGZ){
if ((((_arg2.groupIndex == BodyType.PLAYER)) || ((_arg2.groupIndex == BodyType.ENEMY)))){
return (false);
};
} else {
if (_arg2.groupIndex == BodyType.MAGZ){
if ((((_arg1.groupIndex == BodyType.PLAYER)) || ((_arg1.groupIndex == BodyType.ENEMY)))){
return (false);
};
};
};
return (true);
}
public function gibsCollision(_arg1:b2FilterData, _arg2:b2FilterData):Boolean{
if (_arg1.groupIndex == BodyType.GIBS){
if (((!((_arg2.groupIndex == BodyType.WALL))) && (!((_arg2.groupIndex == BodyType.FLOOR))))){
return (false);
};
} else {
if (_arg2.groupIndex == BodyType.GIBS){
if (((!((_arg1.groupIndex == BodyType.WALL))) && (!((_arg1.groupIndex == BodyType.FLOOR))))){
return (false);
};
};
};
return (true);
}
}
}//package p_util
Section 286
//ContactListener (p_util.ContactListener)
package p_util {
import Box2D.Dynamics.*;
import Box2D.Collision.*;
import Box2D.Dynamics.Contacts.*;
import p_char.*;
import p_bullet.*;
public class ContactListener extends b2ContactListener {
override public function Remove(_arg1:b2ContactPoint, _arg2:b2Contact):void{
charTouchTheGroundFalse(_arg1, _arg2);
grenadeBulletTouchTheGroundFalse(_arg1, _arg2);
characterBarricadesCollision2(_arg1, _arg2);
}
public function bulletBarricadesCollision(_arg1:b2ContactPoint, _arg2:b2Contact):void{
if (_arg1.shape1.GetBody().type == BodyType.ENEMY_BULLET){
if (_arg1.shape2.GetBody().type == BodyType.BARRICADE){
if (!_arg1.shape2.GetBody().m_userData.active){
_arg2.m_flags = (_arg2.m_flags | b2Contact.e_nonSolidFlag);
} else {
if (_arg1.shape1.GetBody().bulletType != BulletType.GRENADE){
_arg1.shape1.GetBody().touchedSolid = true;
_arg1.shape1.GetBody().m_linearDamping = 10000;
_arg1.shape1.GetBody().GetLinearVelocity().x = 0;
_arg1.shape1.GetBody().GetLinearVelocity().y = 0;
if (!_arg1.shape2.GetBody().gotShot){
_arg1.shape2.GetBody().impulseApplied = _arg1.shape1.GetBody().GetLinearVelocity().Copy();
_arg1.shape2.GetBody().impulseApplied.x = (_arg1.shape2.GetBody().impulseApplied.x / 10);
_arg1.shape2.GetBody().impulseApplied.y = (_arg1.shape2.GetBody().impulseApplied.y / 10);
_arg1.shape2.GetBody().pointCollision = _arg1.position.Copy();
_arg1.shape2.GetBody().damage = _arg1.shape1.GetBody().damage;
_arg1.shape2.GetBody().gotShot = true;
};
};
};
};
} else {
if (_arg1.shape2.GetBody().type == BodyType.ENEMY_BULLET){
if (_arg1.shape1.GetBody().type == BodyType.BARRICADE){
if (!_arg1.shape1.GetBody().m_userData.active){
_arg2.m_flags = (_arg2.m_flags | b2Contact.e_nonSolidFlag);
} else {
if (_arg1.shape2.GetBody().bulletType != BulletType.GRENADE){
_arg1.shape2.GetBody().touchedSolid = true;
_arg1.shape2.GetBody().m_linearDamping = 10000;
_arg1.shape2.GetBody().GetLinearVelocity().x = 0;
_arg1.shape2.GetBody().GetLinearVelocity().y = 0;
if (!_arg1.shape1.GetBody().gotShot){
_arg1.shape1.GetBody().impulseApplied = _arg1.shape2.GetBody().GetLinearVelocity().Copy();
_arg1.shape1.GetBody().impulseApplied.x = (_arg1.shape1.GetBody().impulseApplied.x / 10);
_arg1.shape1.GetBody().impulseApplied.y = (_arg1.shape1.GetBody().impulseApplied.y / 10);
_arg1.shape1.GetBody().pointCollision = _arg1.position.Copy();
_arg1.shape1.GetBody().damage = _arg1.shape2.GetBody().damage;
_arg1.shape1.GetBody().gotShot = true;
};
};
};
};
};
};
}
override public function Add(_arg1:b2ContactPoint, _arg2:b2Contact):void{
bulletLevelCollision(_arg1, _arg2);
bulletCharacterCollision(_arg1, _arg2, BodyType.PLAYER_BULLET, BodyType.ENEMY);
bulletCharacterCollision(_arg1, _arg2, BodyType.ENEMY_BULLET, BodyType.PLAYER);
characterItemPickUpsCollision(_arg1, _arg2);
bulletBarricadesCollision(_arg1, _arg2);
}
public function grenadeBulletTouchTheGroundFalse(_arg1:b2ContactPoint, _arg2:b2Contact):void{
if (_arg1.shape1.GetBody().bulletType == BulletType.GRENADE){
if (_arg1.shape2.GetBody().type == BodyType.FLOOR){
_arg1.shape1.GetBody().touchedTheGround = false;
};
} else {
(_arg1.shape2.GetBody().bulletType == BulletType.GRENADE);
};
if (_arg1.shape1.GetBody().type == BodyType.FLOOR){
_arg1.shape2.GetBody().touchedTheGround = false;
};
}
public function bulletCharacterCollision(_arg1:b2ContactPoint, _arg2:b2Contact, _arg3:int, _arg4:int):void{
if ((((_arg1.shape1.GetBody().type == _arg3)) && (!((_arg1.shape1.GetBody().bulletType == BulletType.GRENADE))))){
if (_arg1.shape2.GetBody().type == _arg4){
if (!_arg1.shape2.GetBody().gotShot){
_arg1.shape2.GetBody().impulseApplied = _arg1.shape1.GetBody().GetLinearVelocity().Copy();
if (_arg1.shape1.GetBody().bulletType == BulletType.KNIFE){
_arg1.shape2.GetBody().impulseApplied.x = (_arg1.shape2.GetBody().impulseApplied.x * 4);
_arg1.shape2.GetBody().impulseApplied.y = (_arg1.shape2.GetBody().impulseApplied.y * 4);
} else {
_arg1.shape2.GetBody().impulseApplied.x = (_arg1.shape2.GetBody().impulseApplied.x / 10);
_arg1.shape2.GetBody().impulseApplied.y = (_arg1.shape2.GetBody().impulseApplied.y / 10);
};
_arg1.shape2.GetBody().pointCollision = _arg1.position.Copy();
_arg1.shape2.GetBody().damage = _arg1.shape1.GetBody().damage;
_arg1.shape2.GetBody().gotShot = true;
if (_arg1.shape2.id == "head"){
_arg1.shape2.GetBody().headShot = true;
};
if (_arg1.shape2.id == "body"){
_arg1.shape2.GetBody().bodyShot = true;
} else {
_arg1.shape2.GetBody().legShot = true;
};
_arg1.shape1.GetBody().touchedChar = true;
if (_arg1.shape1.GetBody().bulletType == BulletType.MAGNUM){
_arg2.m_flags = (_arg2.m_flags | b2Contact.e_nonSolidFlag);
} else {
_arg1.shape1.GetBody().m_linearDamping = 10000;
_arg1.shape1.GetBody().GetLinearVelocity().x = 0;
_arg1.shape1.GetBody().GetLinearVelocity().y = 0;
};
} else {
_arg2.m_flags = (_arg2.m_flags | b2Contact.e_nonSolidFlag);
};
};
} else {
if ((((_arg1.shape2.GetBody().type == _arg3)) && (!((_arg1.shape2.GetBody().bulletType == BulletType.GRENADE))))){
if (_arg1.shape1.GetBody().type == _arg4){
if (!_arg1.shape1.GetBody().gotShot){
_arg1.shape1.GetBody().impulseApplied = _arg1.shape2.GetBody().GetLinearVelocity().Copy();
if (_arg1.shape2.GetBody().bulletType == BulletType.KNIFE){
_arg1.shape1.GetBody().impulseApplied.x = (_arg1.shape1.GetBody().impulseApplied.x * 4);
_arg1.shape1.GetBody().impulseApplied.y = (_arg1.shape1.GetBody().impulseApplied.y * 4);
} else {
_arg1.shape1.GetBody().impulseApplied.x = (_arg1.shape1.GetBody().impulseApplied.x / 10);
_arg1.shape1.GetBody().impulseApplied.y = (_arg1.shape1.GetBody().impulseApplied.y / 10);
};
_arg1.shape1.GetBody().pointCollision = _arg1.position.Copy();
_arg1.shape1.GetBody().damage = _arg1.shape2.GetBody().damage;
_arg1.shape1.GetBody().gotShot = true;
if (_arg1.shape1.id == "head"){
_arg1.shape1.GetBody().headShot = true;
};
if (_arg1.shape1.id == "body"){
_arg1.shape1.GetBody().bodyShot = true;
} else {
_arg1.shape1.GetBody().legShot = true;
};
_arg1.shape2.GetBody().touchedChar = true;
if (_arg1.shape2.GetBody().bulletType == BulletType.MAGNUM){
_arg2.m_flags = (_arg2.m_flags | b2Contact.e_nonSolidFlag);
} else {
_arg1.shape2.GetBody().m_linearDamping = 10000;
_arg1.shape2.GetBody().GetLinearVelocity().x = 0;
_arg1.shape2.GetBody().GetLinearVelocity().y = 0;
};
} else {
_arg2.m_flags = (_arg2.m_flags | b2Contact.e_nonSolidFlag);
};
};
};
};
}
public function charTouchTheGroundTrue(_arg1:b2ContactResult, _arg2:b2Contact):void{
if ((((_arg1.shape2.GetBody().type == BodyType.PLAYER)) || ((_arg1.shape2.GetBody().type == BodyType.ENEMY)))){
if (_arg1.shape2.id == "floorDetector"){
if (((!((_arg1.shape1.GetBody().type == BodyType.ENEMY_BULLET))) || ((_arg1.shape1.GetBody().type == BodyType.PLAYER_BULLET)))){
_arg1.shape2.GetBody().touchedTheGround = true;
};
};
} else {
if ((((_arg1.shape1.GetBody().type == BodyType.PLAYER)) || ((_arg1.shape1.GetBody().type == BodyType.ENEMY)))){
if (_arg1.shape1.id == "floorDetector"){
if (((!((_arg1.shape2.GetBody().type == BodyType.ENEMY_BULLET))) || ((_arg1.shape2.GetBody().type == BodyType.PLAYER_BULLET)))){
_arg1.shape1.GetBody().touchedTheGround = true;
};
};
};
};
}
public function bulletLevelCollision(_arg1:b2ContactPoint, _arg2:b2Contact):void{
if ((((_arg1.shape1.GetBody().type == BodyType.PLAYER_BULLET)) || ((_arg1.shape1.GetBody().type == BodyType.ENEMY_BULLET)))){
if ((((_arg1.shape2.GetBody().type == BodyType.FLOOR)) || ((_arg1.shape2.GetBody().type == BodyType.WALL)))){
if (_arg1.shape1.GetBody().bulletType != BulletType.GRENADE){
_arg1.shape1.GetBody().touchedSolid = true;
_arg1.shape1.GetBody().m_linearDamping = 10000;
_arg1.shape1.GetBody().GetLinearVelocity().x = 0;
_arg1.shape1.GetBody().GetLinearVelocity().y = 0;
};
};
} else {
if ((((_arg1.shape2.GetBody().type == BodyType.PLAYER_BULLET)) || ((_arg1.shape2.GetBody().type == BodyType.ENEMY_BULLET)))){
if ((((_arg1.shape1.GetBody().type == BodyType.FLOOR)) || ((_arg1.shape1.GetBody().type == BodyType.WALL)))){
if (_arg1.shape2.GetBody().bulletType != BulletType.GRENADE){
_arg1.shape2.GetBody().touchedSolid = true;
_arg1.shape2.GetBody().m_linearDamping = 10000;
_arg1.shape2.GetBody().GetLinearVelocity().x = 0;
_arg1.shape2.GetBody().GetLinearVelocity().y = 0;
};
};
};
};
}
override public function Persist(_arg1:b2ContactPoint, _arg2:b2Contact):void{
characterBarricadesCollision(_arg1, _arg2);
}
public function characterItemPickUpsCollision(_arg1:b2ContactPoint, _arg2:b2Contact):void{
if (_arg1.shape1.GetBody().type == BodyType.PLAYER){
if (_arg1.shape2.GetBody().type == BodyType.ITEM_PICK_UP){
_arg1.shape2.GetBody().touchedChar = true;
_arg2.m_flags = (_arg2.m_flags | b2Contact.e_nonSolidFlag);
};
} else {
if (_arg1.shape2.GetBody().type == BodyType.PLAYER){
if (_arg1.shape1.GetBody().type == BodyType.ITEM_PICK_UP){
_arg1.shape1.GetBody().touchedChar = true;
_arg2.m_flags = (_arg2.m_flags | b2Contact.e_nonSolidFlag);
};
};
};
if (_arg1.shape1.GetBody().type == BodyType.ENEMY){
if (_arg1.shape2.GetBody().type == BodyType.ITEM_PICK_UP){
_arg2.m_flags = (_arg2.m_flags | b2Contact.e_nonSolidFlag);
};
} else {
if (_arg1.shape2.GetBody().type == BodyType.ENEMY){
if (_arg1.shape1.GetBody().type == BodyType.ITEM_PICK_UP){
_arg2.m_flags = (_arg2.m_flags | b2Contact.e_nonSolidFlag);
};
};
};
}
public function characterBarricadesCollision2(_arg1:b2ContactPoint, _arg2:b2Contact):void{
if (_arg1.shape1.GetBody().type == BodyType.PLAYER){
if (_arg1.shape2.GetBody().type == BodyType.BARRICADE){
_arg1.shape1.GetBody().touchedBarricade = false;
};
} else {
if (_arg1.shape2.GetBody().type == BodyType.PLAYER){
if (_arg1.shape1.GetBody().type == BodyType.BARRICADE){
_arg1.shape2.GetBody().touchedBarricade = false;
};
};
};
}
public function charTouchTheGroundFalse(_arg1:b2ContactPoint, _arg2:b2Contact):void{
if ((((_arg1.shape2.GetBody().type == BodyType.PLAYER)) || ((_arg1.shape2.GetBody().type == BodyType.ENEMY)))){
if (_arg1.shape2.id == "floorDetector"){
_arg1.shape2.GetBody().touchedTheGround = false;
};
} else {
if ((((_arg1.shape1.GetBody().type == BodyType.PLAYER)) || ((_arg1.shape1.GetBody().type == BodyType.ENEMY)))){
if (_arg1.shape1.id == "floorDetector"){
_arg1.shape1.GetBody().touchedTheGround = false;
};
};
};
}
public function bulletShellMagsCollision(_arg1:b2ContactResult, _arg2:b2Contact):void{
if ((((_arg1.shape1.GetBody().type == BodyType.PLAYER_BULLET)) || ((_arg1.shape1.GetBody().type == BodyType.ENEMY_BULLET)))){
if ((((_arg1.shape2.GetBody().type == BodyType.MAGZ)) || ((_arg1.shape2.GetBody().type == BodyType.SHELL)))){
if (_arg1.shape1.GetBody().bulletType != BulletType.GRENADE){
_arg1.shape1.GetBody().touchedSolid = true;
_arg1.shape1.GetBody().m_linearDamping = 10000;
_arg1.shape1.GetBody().GetLinearVelocity().x = 0;
_arg1.shape1.GetBody().GetLinearVelocity().y = 0;
};
};
} else {
if ((((_arg1.shape2.GetBody().type == BodyType.PLAYER_BULLET)) || ((_arg1.shape2.GetBody().type == BodyType.ENEMY_BULLET)))){
if ((((_arg1.shape1.GetBody().type == BodyType.MAGZ)) || ((_arg1.shape1.GetBody().type == BodyType.SHELL)))){
if (_arg1.shape2.GetBody().bulletType != BulletType.GRENADE){
_arg1.shape2.GetBody().touchedSolid = true;
_arg1.shape2.GetBody().m_linearDamping = 10000;
_arg1.shape2.GetBody().GetLinearVelocity().x = 0;
_arg1.shape2.GetBody().GetLinearVelocity().y = 0;
};
};
};
};
}
override public function Result(_arg1:b2ContactResult, _arg2:b2Contact):void{
charTouchTheGroundTrue(_arg1, _arg2);
grenadeBulletTouchTheGroundTrue(_arg1, _arg2);
bulletShellMagsCollision(_arg1, _arg2);
}
public function grenadeBulletTouchTheGroundTrue(_arg1:b2ContactResult, _arg2:b2Contact):void{
if (_arg1.shape1.GetBody().bulletType == BulletType.GRENADE){
if (_arg1.shape2.GetBody().type == BodyType.FLOOR){
_arg1.shape1.GetBody().touchedTheGround = true;
};
} else {
(_arg1.shape2.GetBody().bulletType == BulletType.GRENADE);
};
if (_arg1.shape1.GetBody().type == BodyType.FLOOR){
_arg1.shape2.GetBody().touchedTheGround = true;
};
}
public function characterBarricadesCollision(_arg1:b2ContactPoint, _arg2:b2Contact):void{
if (_arg1.shape1.GetBody().type == BodyType.PLAYER){
if (_arg1.shape2.GetBody().type == BodyType.BARRICADE){
if (!_arg1.shape2.GetBody().m_userData.active){
_arg2.m_flags = (_arg2.m_flags | b2Contact.e_nonSolidFlag);
} else {
_arg1.shape1.GetBody().touchedBarricade = true;
_arg1.shape1.GetBody().shouldJump = true;
};
};
} else {
if (_arg1.shape2.GetBody().type == BodyType.PLAYER){
if (_arg1.shape1.GetBody().type == BodyType.BARRICADE){
if (!_arg1.shape1.GetBody().m_userData.active){
_arg2.m_flags = (_arg2.m_flags | b2Contact.e_nonSolidFlag);
} else {
_arg1.shape2.GetBody().touchedBarricade = true;
_arg1.shape2.GetBody().shouldJump = true;
};
};
};
};
if (_arg1.shape1.GetBody().type == BodyType.ENEMY){
if (_arg1.shape2.GetBody().type == BodyType.BARRICADE){
if (!_arg1.shape2.GetBody().m_userData.active){
_arg2.m_flags = (_arg2.m_flags | b2Contact.e_nonSolidFlag);
} else {
_arg1.shape1.GetBody().touchedBarricade = true;
if (_arg1.shape1.GetBody().GetPosition().x > _arg1.shape2.GetBody().GetPosition().x){
_arg1.shape1.GetBody().faceRight = false;
} else {
_arg1.shape1.GetBody().faceRight = true;
};
};
};
} else {
if (_arg1.shape2.GetBody().type == BodyType.ENEMY){
if (_arg1.shape1.GetBody().type == BodyType.BARRICADE){
if (!_arg1.shape1.GetBody().m_userData.active){
_arg2.m_flags = (_arg2.m_flags | b2Contact.e_nonSolidFlag);
} else {
_arg1.shape2.GetBody().touchedBarricade = true;
if (_arg1.shape2.GetBody().GetPosition().x > _arg1.shape1.GetBody().GetPosition().x){
_arg1.shape2.GetBody().faceRight = false;
} else {
_arg1.shape2.GetBody().faceRight = true;
};
};
};
};
};
}
}
}//package p_util
Section 287
//DisplayObjectModifier (p_util.DisplayObjectModifier)
package p_util {
import flash.display.*;
import flash.geom.*;
import flash.utils.*;
import flash.system.*;
public class DisplayObjectModifier {
public static function cloneDisplayObject(_arg1:DisplayObject):Bitmap{
var _local2:BitmapData;
var _local3:Bitmap;
_local2 = new BitmapData(_arg1.width, _arg1.height, true, 0xFFFFFF);
_local3 = new Bitmap(_local2);
_local2.draw(_arg1);
return (_local3);
}
public static function duplicateMovieClip(_arg1:MovieClip):MovieClip{
var _local2:*;
var _local3:MovieClip;
var _local4:String;
var _local5:MovieClip;
_local3 = _arg1;
_local4 = getQualifiedClassName(_local3);
_local2 = getDefinitionByName(_local4);
_local5 = MovieClip(new (_local2));
_local5.width = _arg1.width;
_local5.height = _arg1.height;
return (_local5);
}
public static function duplicateDisplayObject(_arg1:DisplayObject, _arg2:Boolean=false):DisplayObject{
var _local3:Class;
var _local4:DisplayObject;
var _local5:Rectangle;
_local3 = Object(_arg1).constructor;
_local4 = (new (_local3) as DisplayObject);
_local4.transform = _arg1.transform;
_local4.filters = _arg1.filters;
_local4.cacheAsBitmap = _arg1.cacheAsBitmap;
_local4.opaqueBackground = _arg1.opaqueBackground;
if (_arg1.scale9Grid){
_local5 = _arg1.scale9Grid;
if (Capabilities.version.split(" ")[1] == "9,0,16,0"){
_local5.x = (_local5.x / 20);
_local5.y = (_local5.y / 20);
_local5.width = (_local5.width / 20);
_local5.height = (_local5.height / 20);
};
_local4.scale9Grid = _local5;
};
if (((_arg2) && (_arg1.parent))){
_arg1.parent.addChild(_local4);
};
return (_local4);
}
public static function duplicateMovieClip2(_arg1:MovieClip, _arg2:String):MovieClip{
var _local3:*;
var _local4:MovieClip;
var _local5:String;
var _local6:MovieClip;
_local4 = _arg1;
_local5 = getQualifiedClassName(_local4[_arg2]);
_local3 = getDefinitionByName(_local5);
_local6 = MovieClip(new (_local3));
_local6.width = _arg1.width;
_local6.height = _arg1.height;
return (_local6);
}
}
}//package p_util
Section 288
//FPSCounter (p_util.FPSCounter)
package p_util {
import flash.display.*;
import flash.utils.*;
import flash.text.*;
import flash.system.*;
public class FPSCounter extends Sprite {
private var oldT:uint;
private var mfpsCount:int;// = 0
private var avgCount:int;// = 30
private var avgCount2:int;// = 30
private var textBox:TextField;
private var mfpsCount2:int;// = 0
private var textBox3:TextField;
private var textBox2:TextField;
public function FPSCounter(){
mfpsCount = 0;
mfpsCount2 = 0;
avgCount = 30;
avgCount2 = 30;
super();
textBox = new TextField();
textBox.text = "...";
textBox.x = 50;
textBox.textColor = 0xFF0000;
textBox.selectable = false;
textBox2 = new TextField();
textBox2.text = "...";
textBox2.x = 50;
textBox2.width = 150;
textBox2.textColor = 0xFF0000;
textBox2.selectable = false;
textBox2.y = 15;
textBox3 = new TextField();
textBox3.text = "...";
textBox3.x = 50;
textBox3.textColor = 0xFF0000;
textBox3.selectable = false;
textBox3.y = 30;
oldT = getTimer();
addChild(textBox);
addChild(textBox2);
addChild(textBox3);
}
public function updateEnd():void{
}
public function updatePhys(_arg1:uint):void{
var _local2:uint;
var _local3:uint;
_local2 = getTimer();
_local3 = (_local2 - _arg1);
mfpsCount2 = (mfpsCount2 + _local3);
if (avgCount2 < 1){
textBox2.text = String((((("Physics step: " + Math.round((mfpsCount2 / 30))) + " ms (") + Math.round((1000 / (mfpsCount2 / 30)))) + " fps)"));
avgCount2 = 30;
mfpsCount2 = 0;
};
avgCount2--;
}
public function update():void{
var _local1:uint;
var _local2:uint;
_local1 = getTimer();
_local2 = (_local1 - oldT);
mfpsCount = (mfpsCount + _local2);
if (avgCount < 1){
textBox.text = String((Math.round((1000 / (mfpsCount / 30))) + " fps average"));
avgCount = 30;
mfpsCount = 0;
};
updatePhys(oldT);
avgCount--;
oldT = getTimer();
textBox3.text = (Math.round((System.totalMemory / (0x0400 * 0x0400))) + " MB used");
}
}
}//package p_util
Section 289
//PixelCollision (p_util.PixelCollision)
package p_util {
import flash.display.*;
import flash.geom.*;
public class PixelCollision {
public static function getCollisionRect(_arg1:DisplayObject, _arg2:DisplayObject, _arg3:DisplayObjectContainer, _arg4:Boolean=false, _arg5:Number=0):Rectangle{
var _local6:Rectangle;
var _local7:Rectangle;
var _local8:Rectangle;
var _local9:BitmapData;
var _local10:BitmapData;
var _local11:uint;
var _local12:Rectangle;
var _local13:int;
_local6 = _arg1.getBounds(_arg3);
_local7 = _arg2.getBounds(_arg3);
_local8 = _local6.intersection(_local7);
if (_local8.size.length > 0){
if (_arg4){
_local8.width = Math.ceil(_local8.width);
_local8.height = Math.ceil(_local8.height);
_local9 = getAlphaMap(_arg1, _local8, BitmapDataChannel.RED, _arg3);
_local10 = getAlphaMap(_arg2, _local8, BitmapDataChannel.GREEN, _arg3);
_local9.draw(_local10, null, null, BlendMode.LIGHTEN);
if (_arg5 <= 0){
_local11 = 65792;
} else {
if (_arg5 > 1){
_arg5 = 1;
};
_local13 = Math.round((_arg5 * 0xFF));
_local11 = (((_local13 << 16) | (_local13 << 8)) | 0);
};
_local12 = _local9.getColorBoundsRect(_local11, _local11);
_local9.getColorBoundsRect(_local11, _local11).x = (_local12.x + _local8.x);
_local12.y = (_local12.y + _local8.y);
return (_local12);
} else {
return (_local8);
};
//unresolved jump
};
return (null);
}
public static function isColliding(_arg1:DisplayObject, _arg2:DisplayObject, _arg3:DisplayObjectContainer, _arg4:Boolean=false, _arg5:Number=0):Boolean{
var _local6:Rectangle;
_local6 = getCollisionRect(_arg1, _arg2, _arg3, _arg4, _arg5);
if (((!((_local6 == null))) && ((_local6.size.length > 0)))){
return (true);
};
return (false);
}
public static function getCollisionPoint(_arg1:DisplayObject, _arg2:DisplayObject, _arg3:DisplayObjectContainer, _arg4:Boolean=false, _arg5:Number=0):Point{
var _local6:Rectangle;
var _local7:Number;
var _local8:Number;
_local6 = getCollisionRect(_arg1, _arg2, _arg3, _arg4, _arg5);
if (((!((_local6 == null))) && ((_local6.size.length > 0)))){
_local7 = ((_local6.left + _local6.right) / 2);
_local8 = ((_local6.top + _local6.bottom) / 2);
return (new Point(_local7, _local8));
};
return (null);
}
private static function getAlphaMap(_arg1:DisplayObject, _arg2:Rectangle, _arg3:uint, _arg4:DisplayObjectContainer):BitmapData{
var _local5:Matrix;
var _local6:Matrix;
var _local7:BitmapData;
var _local8:BitmapData;
_local5 = _arg4.transform.concatenatedMatrix.clone();
_local5.invert();
_local6 = _arg1.transform.concatenatedMatrix.clone();
_local6.concat(_local5);
_local6.translate(-(_arg2.x), -(_arg2.y));
_local7 = new BitmapData(_arg2.width, _arg2.height, true, 0);
_local7.draw(_arg1, _local6);
_local8 = new BitmapData(_arg2.width, _arg2.height, false, 0);
_local8.copyChannel(_local7, _local7.rect, new Point(0, 0), BitmapDataChannel.ALPHA, _arg3);
return (_local8);
}
}
}//package p_util
Section 290
//AK (p_weapon.AK)
package p_weapon {
import Box2D.Common.Math.*;
import p_char.*;
import p_singleton.*;
import flash.geom.*;
import p_ammo.*;
import p_bullet.*;
public class AK extends RangeWeapon {
public function AK(){
id = "AK47";
image = new armAKF();
image2 = new armAKB();
logo = new weaponAKLogo();
ammo = 30;
maxAmmo = 30;
delay = 200;
speed = 10;
reloadTime = 1000;
angle = 0;
damage = 100;
accuracy = 82;
reloadFrame = 31;
initialReloadFrame = 4;
price = 4300;
initTimer();
ammoType = new Ammo762(0);
attackSound = new attackSoundAK();
}
override public function reload():void{
var _local1:Point;
var _local2:b2Vec2;
if ((((((ammo < maxAmmo)) && ((ammoType.amount > 0)))) && (!(reloading)))){
if (!World.getSingleton().muted){
clipInSound.play();
clipOutSound.play();
};
reloading = true;
ableToShoot = false;
reloadTimer.start();
mags = new MagsAK();
if (faceState == FaceState.FACE_LEFT){
mags.image.scaleX = (mags.image.scaleX * -1);
mags.angle = -(image.rotation);
} else {
mags.angle = image.rotation;
};
mags.speed = 0;
mags.position = position.Copy();
mags.screenPosition = screenPosition.Copy();
mags.direction = direction;
_local1 = new Point(image.magOut.x, image.magOut.y);
_local1 = image.localToGlobal(_local1);
_local2 = position.Copy();
_local2.Subtract(screenPosition);
mags.position.x = (_local2.x + _local1.x);
mags.position.y = (_local2.y + _local1.y);
mags.screenPosition.x = _local1.x;
mags.screenPosition.y = _local1.y;
mags.damage = damage;
mags.initRigidBody();
mags.away();
World.getSingleton().mags.add(mags);
};
}
override public function attack(_arg1:Boolean):void{
if (((((ableToShoot) && ((ammo > 0)))) && (!(reloading)))){
bullet = new HandGunBullet();
image.gotoAndPlay("shoot");
image2.gotoAndPlay("shoot");
};
super.attack(_arg1);
}
}
}//package p_weapon
Section 291
//BaseBallBat (p_weapon.BaseBallBat)
package p_weapon {
import Box2D.Common.Math.*;
import flash.events.*;
import p_char.*;
import p_singleton.*;
import flash.geom.*;
import p_bullet.*;
public class BaseBallBat extends MeleeWeapon {
public function BaseBallBat(){
id = "BaseBall";
image = new armBaseballBatF();
image2 = new armBaseballBatB();
logo = new weaponBaseballBatLogo();
attackTime = 300;
initialAttackFrame = 2;
attackFrame = 11;
delay = 15;
damage = 40;
angle = 0;
bulletOutCounter = 6;
bulletIsOut = false;
price = 200;
initTimer();
attackSound = new knifeSlash();
}
override protected function animateAttack(_arg1:TimerEvent):void{
var _local2:Point;
var _local3:b2Vec2;
super.animateAttack(_arg1);
if ((((attackCounter > bulletOutCounter)) && (!(bulletIsOut)))){
bulletIsOut = true;
bullet = new KnifeBullet();
bullet.speed = speed;
bullet.position = position.Copy();
bullet.screenPosition = screenPosition.Copy();
bullet.direction = direction.Copy();
_local2 = new Point(image.bulletOut.x, image.bulletOut.y);
_local2 = image.localToGlobal(_local2);
_local3 = position.Copy();
_local3.Subtract(screenPosition);
bullet.position.x = (_local3.x + _local2.x);
bullet.position.y = (_local3.y + _local2.y);
bullet.screenPosition.x = _local2.x;
bullet.screenPosition.y = _local2.y;
bullet.angle = angle;
bullet.damage = damage;
if (isAPlayer){
World.getSingleton().playerBullets.add(bullet);
bullet.bodyType = BodyType.PLAYER_BULLET;
} else {
World.getSingleton().enemyBullets.add(bullet);
bullet.bodyType = BodyType.ENEMY_BULLET;
};
bullet.initRigidBody();
bullet.away();
};
}
}
}//package p_weapon
Section 292
//Beretta (p_weapon.Beretta)
package p_weapon {
import Box2D.Common.Math.*;
import p_char.*;
import p_singleton.*;
import flash.geom.*;
import p_ammo.*;
import p_bullet.*;
public class Beretta extends RangeWeapon {
public function Beretta(){
id = "Beretta M9";
image = new armBerettaF();
image2 = new armPistolB();
logo = new weaponBerettaLogo();
ammo = 15;
maxAmmo = 15;
delay = 275;
speed = 10;
reloadTime = 750;
angle = 0;
damage = 25;
accuracy = 85;
reloadFrame = 32;
initialReloadFrame = 7;
initTimer();
ammoType = new Ammo9mm(0);
price = 500;
attackSound = new attackSoundUSP();
}
override public function reload():void{
var _local1:Point;
var _local2:b2Vec2;
if ((((((ammo < maxAmmo)) && ((ammoType.amount > 0)))) && (!(reloading)))){
if (!World.getSingleton().muted){
clipOutSound.play();
};
reloading = true;
ableToShoot = false;
reloadTimer.start();
mags = new MagsWaltherP99();
if (faceState == FaceState.FACE_LEFT){
mags.image.scaleX = (mags.image.scaleX * -1);
mags.angle = -(image.rotation);
} else {
mags.angle = image.rotation;
};
mags.speed = 0;
mags.position = position.Copy();
mags.screenPosition = screenPosition.Copy();
mags.direction = direction;
_local1 = new Point(image.magOut.x, image.magOut.y);
_local1 = image.localToGlobal(_local1);
_local2 = position.Copy();
_local2.Subtract(screenPosition);
mags.position.x = (_local2.x + _local1.x);
mags.position.y = (_local2.y + _local1.y);
mags.screenPosition.x = _local1.x;
mags.screenPosition.y = _local1.y;
mags.damage = damage;
mags.initRigidBody();
mags.away();
World.getSingleton().mags.add(mags);
};
}
override public function attack(_arg1:Boolean):void{
if (((((ableToShoot) && ((ammo > 0)))) && (!(reloading)))){
bullet = new HandGunBullet();
image.gotoAndPlay("shoot");
image2.gotoAndPlay("shoot");
};
super.attack(_arg1);
}
}
}//package p_weapon
Section 293
//ChainSaw (p_weapon.ChainSaw)
package p_weapon {
import Box2D.Common.Math.*;
import flash.events.*;
import p_char.*;
import p_singleton.*;
import flash.geom.*;
import flash.media.*;
import p_bullet.*;
public class ChainSaw extends MeleeWeapon {
public var playOnce:Boolean;// = false
public var soundChannel:SoundChannel;
public function ChainSaw(){
playOnce = false;
super();
id = "Chain Saw";
image = new armChainSawF();
image2 = new armChainSawB();
logo = new weaponChainSawLogo();
attackTime = 1;
initialAttackFrame = 2;
attackFrame = 2;
delay = 5;
damage = 10;
angle = 0;
bulletOutCounter = 1;
bulletIsOut = false;
price = 5000;
initTimer();
attackSound = new chainSawSound();
}
override protected function animateAttack(_arg1:TimerEvent):void{
var _local2:Point;
var _local3:b2Vec2;
image.gotoAndStop((initialAttackFrame + attackCounter));
image2.gotoAndStop((initialAttackFrame + attackCounter));
attackCounter++;
if (attackCounter > attackFrame){
attackCounter = 0;
bulletIsOut = false;
attackTimer.stop();
ableToSlice = true;
attacking = false;
delayTimer.start();
};
if ((((attackCounter > bulletOutCounter)) && (!(bulletIsOut)))){
bulletIsOut = true;
bullet = new ChainSawBullet();
bullet.speed = speed;
bullet.position = position.Copy();
bullet.screenPosition = screenPosition.Copy();
bullet.direction = direction.Copy();
_local2 = new Point(image.bulletOut.x, image.bulletOut.y);
_local2 = image.localToGlobal(_local2);
_local3 = position.Copy();
_local3.Subtract(screenPosition);
bullet.position.x = (_local3.x + _local2.x);
bullet.position.y = (_local3.y + _local2.y);
bullet.screenPosition.x = _local2.x;
bullet.screenPosition.y = _local2.y;
bullet.angle = angle;
bullet.damage = damage;
if (isAPlayer){
World.getSingleton().playerBullets.add(bullet);
bullet.bodyType = BodyType.PLAYER_BULLET;
} else {
World.getSingleton().enemyBullets.add(bullet);
bullet.bodyType = BodyType.ENEMY_BULLET;
};
bullet.initRigidBody();
bullet.away();
};
}
override public function attack(_arg1:Boolean):void{
isAPlayer = _arg1;
if (((ableToSlice) && (!(attacking)))){
attacking = true;
ableToSlice = false;
attackTimer.start();
if (!World.getSingleton().muted){
if (soundChannel){
if (soundChannel.position >= 603){
soundChannel = attackSound.play();
} else {
trace(("position = " + soundChannel.position));
trace(("length = " + attackSound.length));
};
} else {
soundChannel = attackSound.play();
};
};
};
}
}
}//package p_weapon
Section 294
//Deagle (p_weapon.Deagle)
package p_weapon {
import Box2D.Common.Math.*;
import p_char.*;
import p_singleton.*;
import flash.geom.*;
import p_ammo.*;
import p_bullet.*;
public class Deagle extends RangeWeapon {
public function Deagle(){
id = "Desert Eagle";
image = new armDeagleF();
image2 = new armPistolB();
logo = new weaponDeagleLogo();
ammo = 7;
maxAmmo = 7;
delay = 600;
speed = 10;
reloadTime = 750;
angle = 0;
damage = 100;
accuracy = 90;
reloadFrame = 32;
initialReloadFrame = 7;
initTimer();
ammoType = new Ammo357(0);
price = 750;
attackSound = new attackSoundDeagle();
}
override public function reload():void{
var _local1:Point;
var _local2:b2Vec2;
if ((((((ammo < maxAmmo)) && ((ammoType.amount > 0)))) && (!(reloading)))){
if (!World.getSingleton().muted){
clipInSound.play();
clipOutSound.play();
};
reloading = true;
ableToShoot = false;
reloadTimer.start();
mags = new MagsWaltherP99();
if (faceState == FaceState.FACE_LEFT){
mags.image.scaleX = (mags.image.scaleX * -1);
mags.angle = -(image.rotation);
} else {
mags.angle = image.rotation;
};
mags.speed = 0;
mags.position = position.Copy();
mags.screenPosition = screenPosition.Copy();
mags.direction = direction;
_local1 = new Point(image.magOut.x, image.magOut.y);
_local1 = image.localToGlobal(_local1);
_local2 = position.Copy();
_local2.Subtract(screenPosition);
mags.position.x = (_local2.x + _local1.x);
mags.position.y = (_local2.y + _local1.y);
mags.screenPosition.x = _local1.x;
mags.screenPosition.y = _local1.y;
mags.damage = damage;
mags.initRigidBody();
mags.away();
World.getSingleton().mags.add(mags);
};
}
override public function attack(_arg1:Boolean):void{
if (((((ableToShoot) && ((ammo > 0)))) && (!(reloading)))){
bullet = new HandGunBullet();
image.gotoAndPlay("shoot");
image2.gotoAndPlay("shoot");
};
super.attack(_arg1);
}
}
}//package p_weapon
Section 295
//Dynamite (p_weapon.Dynamite)
package p_weapon {
import Box2D.Common.Math.*;
import flash.events.*;
import p_char.*;
import p_singleton.*;
import flash.geom.*;
import p_bullet.*;
public class Dynamite extends ExplosiveWeapon {
public function Dynamite(){
id = "Dynamite";
image = new armDynamiteF();
image2 = new armGrenadeB();
logo = new weaponDynamiteLogo();
ammo = 0;
reloadAmmo = 0;
maxAmmo = 1;
delay = 400;
speed = 13;
reloadTime = 500;
angle = 0;
damage = 3000;
reloadFrame = 10;
initialReloadFrame = 17;
radius = 300;
throwTime = 200;
initialThrowFrame = 2;
throwFrame = 14;
bulletOutCounter = 10;
bulletIsOut = false;
price = 750;
initTimer();
checkWhichIdle();
}
override protected function animateThrow(_arg1:TimerEvent):void{
var _local2:Point;
var _local3:b2Vec2;
image.gotoAndStop((initialThrowFrame + throwCounter));
image2.gotoAndStop((initialThrowFrame + throwCounter));
throwCounter++;
if (throwCounter > throwFrame){
throwCounter = 0;
bulletIsOut = false;
throwTimer.stop();
throwing = false;
checkWhichIdle();
delayTimer.start();
reload();
};
if ((((throwCounter > bulletOutCounter)) && (!(bulletIsOut)))){
ammo--;
bulletIsOut = true;
bullet = new DynamiteBullet();
bullet.speed = speed;
bullet.position = position.Copy();
bullet.screenPosition = screenPosition.Copy();
bullet.direction = direction.Copy();
bullet.radius = radius;
_local2 = new Point(image.bulletOut.x, image.bulletOut.y);
_local2 = image.localToGlobal(_local2);
_local3 = position.Copy();
_local3.Subtract(screenPosition);
bullet.position.x = (_local3.x + _local2.x);
bullet.position.y = (_local3.y + _local2.y);
bullet.screenPosition.x = _local2.x;
bullet.screenPosition.y = _local2.y;
bullet.angle = angle;
bullet.damage = damage;
if (isAPlayer){
World.getSingleton().playerBullets.add(bullet);
bullet.bodyType = BodyType.PLAYER_BULLET;
} else {
World.getSingleton().enemyBullets.add(bullet);
bullet.bodyType = BodyType.ENEMY_BULLET;
};
bullet.initRigidBody();
bullet.away();
};
}
}
}//package p_weapon
Section 296
//ExplosiveWeapon (p_weapon.ExplosiveWeapon)
package p_weapon {
import Box2D.Common.Math.*;
import flash.events.*;
import flash.utils.*;
import p_bullet.*;
public class ExplosiveWeapon extends Weapon {
public var bullet:Bullet;
public var reloadTime:Number;
public var reloadAmmo:int;
public var isAPlayer:Boolean;
public var reloadCounter:int;
public var throwFrame:int;
public var reloadTimer:Timer;
public var shell:Shell;
public var throwing:Boolean;
public var throwCounter:int;
public var speed:Number;
public var reloadFrame:int;
public var maxAmmo:int;
public var shellLimit:int;
public var initialReloadFrame:int;
public var ableToThrow:Boolean;
public var bulletOutCounter:int;
public var mags:Mags;
public var delayTimer:Timer;
public var delay:Number;
public var initialThrowFrame:int;
public var deviation:int;
public var radius:Number;
public var reloading:Boolean;
public var ammo:int;
public var throwTime:Number;
public var bulletIsOut:Boolean;
public var accuracy:int;
public var throwTimer:Timer;
public function ExplosiveWeapon(){
weaponType = WeaponType.EXPLOSIVE;
ableToThrow = true;
reloadCounter = 0;
reloading = false;
direction = new b2Vec2();
deviation = 20;
shellLimit = 20;
}
public function setThrowSpeed(_arg1:Number):void{
var _local2:Boolean;
_local2 = false;
if (throwTimer.running){
_local2 = true;
throwTimer.stop();
};
throwTimer.removeEventListener(TimerEvent.TIMER, animateThrow);
this.throwTime = _arg1;
throwTimer = new Timer((_arg1 / throwFrame));
throwTimer.addEventListener(TimerEvent.TIMER, animateThrow);
if (_local2){
throwTimer.start();
};
}
override public function initTimer():void{
delayTimer = new Timer(delay);
delayTimer.addEventListener(TimerEvent.TIMER, setAbleToThrow);
reloadTimer = new Timer((reloadTime / reloadFrame));
reloadTimer.addEventListener(TimerEvent.TIMER, reloadNow);
throwTimer = new Timer((throwTime / throwFrame));
throwTimer.addEventListener(TimerEvent.TIMER, animateThrow);
}
public function attack(_arg1:Boolean):void{
if (ammo <= 0){
reload();
} else {
if (((((ableToThrow) && ((ammo > 0)))) && (!(reloading)))){
this.isAPlayer = _arg1;
if (((ableToThrow) && (!(throwing)))){
throwing = true;
ableToThrow = false;
throwTimer.start();
};
};
};
}
public function checkWhichIdle():void{
if ((((ammo <= 0)) && ((reloadAmmo <= 0)))){
image.gotoAndStop("idle2");
image2.gotoAndStop("idle2");
} else {
image.gotoAndStop("idle");
image2.gotoAndStop("idle");
};
}
public function setReloadSpeed(_arg1:Number):void{
var _local2:Boolean;
_local2 = false;
if (reloadTimer.running){
_local2 = true;
reloadTimer.stop();
};
reloadTimer.removeEventListener(TimerEvent.TIMER, reloadNow);
this.reloadTime = _arg1;
reloadTimer = new Timer((_arg1 / reloadFrame));
reloadTimer.addEventListener(TimerEvent.TIMER, reloadNow);
if (_local2){
reloadTimer.start();
};
}
protected function reloadNow(_arg1:TimerEvent):void{
var _local2:int;
image.gotoAndStop((initialReloadFrame + reloadCounter));
image2.gotoAndStop((initialReloadFrame + reloadCounter));
reloadCounter++;
if (reloadCounter > reloadFrame){
reloadCounter = 0;
reloadTimer.stop();
if (reloadAmmo > 0){
_local2 = (maxAmmo - ammo);
if (reloadAmmo > _local2){
reloadAmmo = (reloadAmmo - _local2);
ammo = (ammo + _local2);
} else {
ammo = (ammo + reloadAmmo);
reloadAmmo = 0;
};
};
reloading = false;
};
}
protected function animateThrow(_arg1:TimerEvent):void{
image.gotoAndStop((initialThrowFrame + throwCounter));
image2.gotoAndStop((initialThrowFrame + throwCounter));
throwCounter++;
if (throwCounter > throwFrame){
throwCounter = 0;
bulletIsOut = false;
throwTimer.stop();
throwing = false;
image.gotoAndStop("idle");
image2.gotoAndStop("idle");
delayTimer.start();
};
}
public function setDelaySpeed(_arg1:Number):void{
var _local2:Boolean;
_local2 = false;
if (delayTimer.running){
_local2 = true;
delayTimer.stop();
};
delayTimer.removeEventListener(TimerEvent.TIMER, setAbleToThrow);
delay = _arg1;
delayTimer = new Timer(delay);
delayTimer.addEventListener(TimerEvent.TIMER, setAbleToThrow);
if (_local2){
delayTimer.start();
};
}
public function reload():void{
if ((((((ammo < maxAmmo)) && ((reloadAmmo > 0)))) && (!(reloading)))){
reloading = true;
reloadTimer.start();
};
}
public function setAbleToThrow(_arg1:TimerEvent):void{
ableToThrow = true;
trace("masuk sini");
delayTimer.stop();
}
override public function update():void{
super.update();
}
override public function timerOff():void{
delayTimer.removeEventListener(TimerEvent.TIMER, setAbleToThrow);
reloadTimer.removeEventListener(TimerEvent.TIMER, reloadNow);
throwTimer.removeEventListener(TimerEvent.TIMER, animateThrow);
delayTimer.stop();
reloadTimer.stop();
throwTimer.stop();
ableToThrow = true;
reloading = false;
throwing = false;
throwCounter = 0;
image.gotoAndStop("idle");
image2.gotoAndStop("idle");
}
}
}//package p_weapon
Section 297
//Grenade (p_weapon.Grenade)
package p_weapon {
import Box2D.Common.Math.*;
import flash.events.*;
import p_char.*;
import p_singleton.*;
import flash.geom.*;
import p_bullet.*;
public class Grenade extends ExplosiveWeapon {
public function Grenade(){
id = "Grenade";
image = new armGrenadeF();
image2 = new armGrenadeB();
logo = new weaponGrenadeLogo();
ammo = 0;
reloadAmmo = 0;
maxAmmo = 1;
delay = 400;
speed = 3;
reloadTime = 500;
angle = 0;
damage = 1500;
reloadFrame = 10;
initialReloadFrame = 17;
radius = 150;
throwTime = 200;
initialThrowFrame = 2;
throwFrame = 14;
bulletOutCounter = 10;
bulletIsOut = false;
price = 500;
initTimer();
checkWhichIdle();
}
override protected function animateThrow(_arg1:TimerEvent):void{
var _local2:Point;
var _local3:b2Vec2;
image.gotoAndStop((initialThrowFrame + throwCounter));
image2.gotoAndStop((initialThrowFrame + throwCounter));
throwCounter++;
if (throwCounter > throwFrame){
throwCounter = 0;
bulletIsOut = false;
throwTimer.stop();
throwing = false;
checkWhichIdle();
delayTimer.start();
reload();
};
if ((((throwCounter > bulletOutCounter)) && (!(bulletIsOut)))){
ammo--;
bulletIsOut = true;
bullet = new GrenadeBullet();
bullet.speed = speed;
bullet.position = position.Copy();
bullet.screenPosition = screenPosition.Copy();
bullet.direction = direction.Copy();
bullet.radius = radius;
_local2 = new Point(image.bulletOut.x, image.bulletOut.y);
_local2 = image.localToGlobal(_local2);
_local3 = position.Copy();
_local3.Subtract(screenPosition);
bullet.position.x = (_local3.x + _local2.x);
bullet.position.y = (_local3.y + _local2.y);
bullet.screenPosition.x = _local2.x;
bullet.screenPosition.y = _local2.y;
bullet.angle = angle;
bullet.damage = damage;
if (isAPlayer){
World.getSingleton().playerBullets.add(bullet);
bullet.bodyType = BodyType.PLAYER_BULLET;
} else {
World.getSingleton().enemyBullets.add(bullet);
bullet.bodyType = BodyType.ENEMY_BULLET;
};
bullet.initRigidBody();
bullet.away();
shell = new GrenadeSafety();
shell.speed = (speed / 100);
shell.position = position.Copy();
shell.screenPosition = screenPosition.Copy();
shell.direction = bullet.direction.Negative();
_local2 = new Point(image.shellOut.x, image.shellOut.y);
_local2 = image.localToGlobal(_local2);
_local3 = position.Copy();
_local3.Subtract(screenPosition);
shell.position.x = (_local3.x + _local2.x);
shell.position.y = (_local3.y + _local2.y);
shell.screenPosition.x = _local2.x;
shell.screenPosition.y = _local2.y;
shell.angle = angle;
shell.damage = damage;
shell.initRigidBody();
shell.away();
if (World.getSingleton().shells.size() > shellLimit){
World.getSingleton().shells.get(0).lifeTime = 0;
World.getSingleton().shells.get(0).die();
};
World.getSingleton().shells.add(shell);
};
}
}
}//package p_weapon
Section 298
//Katana (p_weapon.Katana)
package p_weapon {
import Box2D.Common.Math.*;
import flash.events.*;
import p_char.*;
import p_singleton.*;
import flash.geom.*;
import p_bullet.*;
public class Katana extends MeleeWeapon {
public function Katana(){
id = "Katana";
image = new armKatanaF();
image2 = new armKatanaB();
logo = new weaponKatanaLogo();
attackTime = 300;
initialAttackFrame = 2;
attackFrame = 11;
delay = 10;
damage = 60;
angle = 0;
bulletOutCounter = 6;
bulletIsOut = false;
price = 1500;
initTimer();
attackSound = new knifeSlash();
}
override protected function animateAttack(_arg1:TimerEvent):void{
var _local2:Point;
var _local3:b2Vec2;
super.animateAttack(_arg1);
if ((((attackCounter > bulletOutCounter)) && (!(bulletIsOut)))){
bulletIsOut = true;
bullet = new ChainSawBullet();
bullet.speed = speed;
bullet.position = position.Copy();
bullet.screenPosition = screenPosition.Copy();
bullet.direction = direction.Copy();
_local2 = new Point(image.bulletOut.x, image.bulletOut.y);
_local2 = image.localToGlobal(_local2);
_local3 = position.Copy();
_local3.Subtract(screenPosition);
bullet.position.x = (_local3.x + _local2.x);
bullet.position.y = (_local3.y + _local2.y);
bullet.screenPosition.x = _local2.x;
bullet.screenPosition.y = _local2.y;
bullet.angle = angle;
bullet.damage = damage;
if (isAPlayer){
World.getSingleton().playerBullets.add(bullet);
bullet.bodyType = BodyType.PLAYER_BULLET;
} else {
World.getSingleton().enemyBullets.add(bullet);
bullet.bodyType = BodyType.ENEMY_BULLET;
};
bullet.initRigidBody();
bullet.away();
};
}
}
}//package p_weapon
Section 299
//Knife (p_weapon.Knife)
package p_weapon {
import Box2D.Common.Math.*;
import flash.events.*;
import p_char.*;
import p_singleton.*;
import flash.geom.*;
import p_bullet.*;
public class Knife extends MeleeWeapon {
public function Knife(){
id = "Knife";
image = new armKnifeF();
image2 = new armKnifeB();
logo = new weaponKnifeLogo();
attackTime = 200;
initialAttackFrame = 2;
attackFrame = 6;
delay = 10;
damage = 25;
angle = 0;
bulletOutCounter = 3;
bulletIsOut = false;
price = 25;
initTimer();
attackSound = new knifeSlash();
}
override protected function animateAttack(_arg1:TimerEvent):void{
var _local2:Point;
var _local3:b2Vec2;
super.animateAttack(_arg1);
if ((((attackCounter > bulletOutCounter)) && (!(bulletIsOut)))){
bulletIsOut = true;
bullet = new KnifeBullet();
bullet.speed = speed;
bullet.position = position.Copy();
bullet.screenPosition = screenPosition.Copy();
bullet.direction = direction.Copy();
_local2 = new Point(image.bulletOut.x, image.bulletOut.y);
_local2 = image.localToGlobal(_local2);
_local3 = position.Copy();
_local3.Subtract(screenPosition);
bullet.position.x = (_local3.x + _local2.x);
bullet.position.y = (_local3.y + _local2.y);
bullet.screenPosition.x = _local2.x;
bullet.screenPosition.y = _local2.y;
bullet.angle = angle;
bullet.damage = damage;
if (isAPlayer){
World.getSingleton().playerBullets.add(bullet);
bullet.bodyType = BodyType.PLAYER_BULLET;
} else {
World.getSingleton().enemyBullets.add(bullet);
bullet.bodyType = BodyType.ENEMY_BULLET;
};
bullet.initRigidBody();
bullet.away();
};
}
}
}//package p_weapon
Section 300
//M14 (p_weapon.M14)
package p_weapon {
import Box2D.Common.Math.*;
import p_char.*;
import p_singleton.*;
import flash.geom.*;
import p_ammo.*;
import p_bullet.*;
public class M14 extends RangeWeapon {
public function M14(){
id = "M14";
image = new armM14F();
image2 = new armM4B();
logo = new weaponM14Logo();
ammo = 20;
maxAmmo = 20;
delay = 500;
speed = 10;
reloadTime = 1100;
angle = 0;
damage = 200;
accuracy = 100;
reloadFrame = 31;
initialReloadFrame = 4;
price = 7000;
initTimer();
ammoType = new Ammo762(0);
attackSound = new attackSoundM4();
}
override public function reload():void{
var _local1:Point;
var _local2:b2Vec2;
if ((((((ammo < maxAmmo)) && ((ammoType.amount > 0)))) && (!(reloading)))){
if (!World.getSingleton().muted){
clipInSound.play();
clipOutSound.play();
};
reloading = true;
ableToShoot = false;
reloadTimer.start();
mags = new MagsM4();
if (faceState == FaceState.FACE_LEFT){
mags.image.scaleX = (mags.image.scaleX * -1);
mags.angle = -(image.rotation);
} else {
mags.angle = image.rotation;
};
mags.speed = 0;
mags.position = position.Copy();
mags.screenPosition = screenPosition.Copy();
mags.direction = direction;
_local1 = new Point(image.magOut.x, image.magOut.y);
_local1 = image.localToGlobal(_local1);
_local2 = position.Copy();
_local2.Subtract(screenPosition);
mags.position.x = (_local2.x + _local1.x);
mags.position.y = (_local2.y + _local1.y);
mags.screenPosition.x = _local1.x;
mags.screenPosition.y = _local1.y;
mags.damage = damage;
mags.initRigidBody();
mags.away();
World.getSingleton().mags.add(mags);
};
}
override public function attack(_arg1:Boolean):void{
if (((((ableToShoot) && ((ammo > 0)))) && (!(reloading)))){
bullet = new HandGunBullet();
image.gotoAndPlay("shoot");
image2.gotoAndPlay("shoot");
};
super.attack(_arg1);
}
}
}//package p_weapon
Section 301
//M1911 (p_weapon.M1911)
package p_weapon {
import Box2D.Common.Math.*;
import p_char.*;
import p_singleton.*;
import flash.geom.*;
import p_ammo.*;
import p_bullet.*;
public class M1911 extends RangeWeapon {
public function M1911(){
id = "M1911";
image = new armM1911F();
image2 = new armPistolB();
logo = new weaponM1911Logo();
ammo = 8;
maxAmmo = 8;
delay = 350;
speed = 10;
reloadTime = 750;
angle = 0;
damage = 45;
accuracy = 90;
reloadFrame = 32;
initialReloadFrame = 7;
initTimer();
ammoType = new Ammo45(0);
price = 650;
attackSound = new attackSoundDeagle();
}
override public function reload():void{
var _local1:Point;
var _local2:b2Vec2;
if ((((((ammo < maxAmmo)) && ((ammoType.amount > 0)))) && (!(reloading)))){
if (!World.getSingleton().muted){
clipInSound.play();
clipOutSound.play();
};
reloading = true;
ableToShoot = false;
reloadTimer.start();
mags = new MagsWaltherP99();
if (faceState == FaceState.FACE_LEFT){
mags.image.scaleX = (mags.image.scaleX * -1);
mags.angle = -(image.rotation);
} else {
mags.angle = image.rotation;
};
mags.speed = 0;
mags.position = position.Copy();
mags.screenPosition = screenPosition.Copy();
mags.direction = direction;
_local1 = new Point(image.magOut.x, image.magOut.y);
_local1 = image.localToGlobal(_local1);
_local2 = position.Copy();
_local2.Subtract(screenPosition);
mags.position.x = (_local2.x + _local1.x);
mags.position.y = (_local2.y + _local1.y);
mags.screenPosition.x = _local1.x;
mags.screenPosition.y = _local1.y;
mags.damage = damage;
mags.initRigidBody();
mags.away();
World.getSingleton().mags.add(mags);
};
}
override public function attack(_arg1:Boolean):void{
if (((((ableToShoot) && ((ammo > 0)))) && (!(reloading)))){
bullet = new HandGunBullet();
image.gotoAndPlay("shoot");
image2.gotoAndPlay("shoot");
};
super.attack(_arg1);
}
}
}//package p_weapon
Section 302
//M4 (p_weapon.M4)
package p_weapon {
import Box2D.Common.Math.*;
import p_char.*;
import p_singleton.*;
import flash.geom.*;
import p_ammo.*;
import p_bullet.*;
public class M4 extends RangeWeapon {
public function M4(){
id = "M4";
image = new armM4F();
image2 = new armM4B();
logo = new weaponM4Logo();
ammo = 30;
maxAmmo = 30;
delay = 175;
speed = 10;
reloadTime = 850;
angle = 0;
damage = 75;
accuracy = 98;
reloadFrame = 31;
initialReloadFrame = 4;
price = 5000;
initTimer();
ammoType = new Ammo556(0);
attackSound = new attackSoundM4();
}
override public function reload():void{
var _local1:Point;
var _local2:b2Vec2;
if ((((((ammo < maxAmmo)) && ((ammoType.amount > 0)))) && (!(reloading)))){
if (!World.getSingleton().muted){
clipInSound.play();
clipOutSound.play();
};
reloading = true;
ableToShoot = false;
reloadTimer.start();
mags = new MagsM4();
if (faceState == FaceState.FACE_LEFT){
mags.image.scaleX = (mags.image.scaleX * -1);
mags.angle = -(image.rotation);
} else {
mags.angle = image.rotation;
};
mags.speed = 0;
mags.position = position.Copy();
mags.screenPosition = screenPosition.Copy();
mags.direction = direction;
_local1 = new Point(image.magOut.x, image.magOut.y);
_local1 = image.localToGlobal(_local1);
_local2 = position.Copy();
_local2.Subtract(screenPosition);
mags.position.x = (_local2.x + _local1.x);
mags.position.y = (_local2.y + _local1.y);
mags.screenPosition.x = _local1.x;
mags.screenPosition.y = _local1.y;
mags.damage = damage;
mags.initRigidBody();
mags.away();
World.getSingleton().mags.add(mags);
};
}
override public function attack(_arg1:Boolean):void{
if (((((ableToShoot) && ((ammo > 0)))) && (!(reloading)))){
bullet = new HandGunBullet();
image.gotoAndPlay("shoot");
image2.gotoAndPlay("shoot");
};
super.attack(_arg1);
}
}
}//package p_weapon
Section 303
//MeleeWeapon (p_weapon.MeleeWeapon)
package p_weapon {
import Box2D.Common.Math.*;
import flash.events.*;
import p_singleton.*;
import flash.media.*;
import flash.utils.*;
import p_bullet.*;
public class MeleeWeapon extends Weapon {
public var bullet:Bullet;
public var delay:Number;
public var attackFrame:int;
public var delayTimer:Timer;
public var attackCounter:int;
public var isAPlayer:Boolean;
public var attacking:Boolean;
public var ableToSlice:Boolean;
public var initialAttackFrame:int;
public var attackSound:Sound;
public var attackTime:Number;
public var speed:Number;
public var attackTimer:Timer;
public var bulletIsOut:Boolean;
public var bulletOutCounter:int;
public function MeleeWeapon(){
weaponType = WeaponType.MELEE;
speed = 20;
ableToSlice = true;
attackCounter = 0;
attacking = false;
attackTime = 500;
direction = new b2Vec2();
isAPlayer = true;
}
public function setDelaySpeed(_arg1:Number):void{
var _local2:Boolean;
_local2 = false;
if (delayTimer.running){
_local2 = true;
delayTimer.stop();
};
delayTimer.removeEventListener(TimerEvent.TIMER, setAbleToSlice);
delay = _arg1;
delayTimer = new Timer(delay);
delayTimer.addEventListener(TimerEvent.TIMER, setAbleToSlice);
if (_local2){
delayTimer.start();
};
}
protected function animateAttack(_arg1:TimerEvent):void{
image.gotoAndStop((initialAttackFrame + attackCounter));
image2.gotoAndStop((initialAttackFrame + attackCounter));
attackCounter++;
if (attackCounter > attackFrame){
attackCounter = 0;
bulletIsOut = false;
attackTimer.stop();
ableToSlice = true;
attacking = false;
image.gotoAndStop("idle");
image2.gotoAndStop("idle");
delayTimer.start();
};
}
override public function initTimer():void{
delayTimer = new Timer(delay);
delayTimer.addEventListener(TimerEvent.TIMER, setAbleToSlice);
attackTimer = new Timer((attackTime / attackFrame));
attackTimer.addEventListener(TimerEvent.TIMER, animateAttack);
}
public function setAttackSpeed(_arg1:Number):void{
var _local2:Boolean;
_local2 = false;
if (attackTimer.running){
_local2 = true;
attackTimer.stop();
};
attackTimer.removeEventListener(TimerEvent.TIMER, animateAttack);
this.attackTime = _arg1;
attackTimer = new Timer((_arg1 / attackFrame));
attackTimer.addEventListener(TimerEvent.TIMER, animateAttack);
if (_local2){
attackTimer.start();
};
}
public function attack(_arg1:Boolean):void{
isAPlayer = _arg1;
if (((ableToSlice) && (!(attacking)))){
attacking = true;
ableToSlice = false;
attackTimer.start();
if (!World.getSingleton().muted){
attackSound.play(0, 0, soundTransform);
};
};
}
override public function update():void{
super.update();
}
override public function timerOff():void{
delayTimer.removeEventListener(TimerEvent.TIMER, setAbleToSlice);
attackTimer.removeEventListener(TimerEvent.TIMER, animateAttack);
delayTimer.stop();
attackTimer.stop();
image.gotoAndStop("idle");
image2.gotoAndStop("idle");
bulletIsOut = false;
ableToSlice = true;
attacking = false;
attackCounter = 0;
}
public function setAbleToSlice(_arg1:TimerEvent):void{
ableToSlice = true;
delayTimer.stop();
}
}
}//package p_weapon
Section 304
//MPU (p_weapon.MPU)
package p_weapon {
import Box2D.Common.Math.*;
import p_char.*;
import p_singleton.*;
import flash.geom.*;
import p_ammo.*;
import p_bullet.*;
public class MPU extends RangeWeapon {
public function MPU(){
id = "MPU";
image = new armMPUF();
image2 = new armMPUB();
logo = new weaponMPULogo();
ammo = 25;
maxAmmo = 25;
delay = 200;
speed = 10;
reloadTime = 850;
angle = 0;
damage = 45;
accuracy = 85;
reloadFrame = 31;
initialReloadFrame = 5;
price = 2500;
initTimer();
ammoType = new Ammo45(0);
attackSound = new attackSoundSteyrUMP();
}
override public function reload():void{
var _local1:Point;
var _local2:b2Vec2;
if ((((((ammo < maxAmmo)) && ((ammoType.amount > 0)))) && (!(reloading)))){
if (!World.getSingleton().muted){
clipOutSound.play();
};
reloading = true;
ableToShoot = false;
reloadTimer.start();
mags = new MagsUMP();
if (faceState == FaceState.FACE_LEFT){
mags.image.scaleX = (mags.image.scaleX * -1);
mags.angle = -(image.rotation);
} else {
mags.angle = image.rotation;
};
mags.speed = 0;
mags.position = position.Copy();
mags.screenPosition = screenPosition.Copy();
mags.direction = direction;
_local1 = new Point(image.magOut.x, image.magOut.y);
_local1 = image.localToGlobal(_local1);
_local2 = position.Copy();
_local2.Subtract(screenPosition);
mags.position.x = (_local2.x + _local1.x);
mags.position.y = (_local2.y + _local1.y);
mags.screenPosition.x = _local1.x;
mags.screenPosition.y = _local1.y;
mags.damage = damage;
mags.initRigidBody();
mags.away();
World.getSingleton().mags.add(mags);
};
}
override public function attack(_arg1:Boolean):void{
if (((((ableToShoot) && ((ammo > 0)))) && (!(reloading)))){
bullet = new HandGunBullet();
image.gotoAndPlay("shoot");
image2.gotoAndPlay("shoot");
};
super.attack(_arg1);
}
}
}//package p_weapon
Section 305
//RangeWeapon (p_weapon.RangeWeapon)
package p_weapon {
import Box2D.Common.Math.*;
import flash.events.*;
import p_char.*;
import p_singleton.*;
import flash.geom.*;
import flash.media.*;
import flash.utils.*;
import p_ammo.*;
import p_bullet.*;
public class RangeWeapon extends Weapon {
public var mags:Mags;
public var bullet:Bullet;
public var delay:Number;
public var delayTimer:Timer;
public var reloadTime:Number;
public var deviation:int;
public var reloadCounter:int;
public var attackSound:Sound;
public var ableToShoot:Boolean;
public var reloadTimer:Timer;
public var ammoType:Ammo;
public var reloading:Boolean;
public var shell:Shell;
public var speed:Number;
public var ammo:int;
public var clipOutSound:Sound;
public var maxAmmo:int;
public var reloadFrame:int;
public var shellLimit:int;
public var initialReloadFrame:int;
public var accuracy:int;
public var clipInSound:Sound;
public var soundChannel:SoundChannel;
public function RangeWeapon(){
weaponType = WeaponType.RANGE;
ableToShoot = true;
reloadCounter = 0;
reloading = false;
direction = new b2Vec2();
deviation = 100;
shellLimit = 15;
clipInSound = new ClipIn();
clipOutSound = new ClipOut();
attackSound = new AttackSound();
}
public function setAbleToShoot(_arg1:TimerEvent):void{
ableToShoot = true;
delayTimer.stop();
}
override public function initTimer():void{
delayTimer = new Timer(delay);
delayTimer.addEventListener(TimerEvent.TIMER, setAbleToShoot);
reloadTimer = new Timer((reloadTime / reloadFrame));
reloadTimer.addEventListener(TimerEvent.TIMER, reloadNow);
}
public function reload():void{
if ((((((ammo < maxAmmo)) && ((ammoType.amount > 0)))) && (!(reloading)))){
reloading = true;
ableToShoot = false;
reloadTimer.start();
};
}
public function attack(_arg1:Boolean):void{
var _local2:Number;
var _local3:Number;
var _local4:Point;
var _local5:b2Vec2;
var _local6:Number;
if (ammo <= 0){
reload();
} else {
if (((((ableToShoot) && ((ammo > 0)))) && (!(reloading)))){
if (!World.getSingleton().muted){
soundChannel = attackSound.play(0, 0, soundTransform);
};
ableToShoot = false;
delayTimer.start();
ammo--;
bullet.speed = speed;
bullet.position = position.Copy();
bullet.screenPosition = screenPosition.Copy();
bullet.direction = direction.Copy();
_local2 = ((Math.random() * (deviation - accuracy)) / deviation);
_local3 = ((((Math.floor((Math.random() * 10)) + 1) % 2) == 0)) ? -1 : 1;
bullet.direction.y = (bullet.direction.y + (_local2 * _local3));
_local4 = new Point(image.bulletOut.x, image.bulletOut.y);
_local4 = image.localToGlobal(_local4);
_local5 = position.Copy();
_local5.Subtract(screenPosition);
bullet.position.x = (_local5.x + _local4.x);
bullet.position.y = (_local5.y + _local4.y);
bullet.screenPosition.x = _local4.x;
bullet.screenPosition.y = _local4.y;
_local6 = b2Vec2.vectorToRotation(direction, bullet.direction);
if ((((((bullet.direction.x > 0)) && ((bullet.direction.y < 0)))) || ((((bullet.direction.x < 0)) && ((bullet.direction.y > 0)))))){
_local6 = (_local6 * -1);
};
if (isNaN(_local6)){
_local6 = 0;
};
bullet.angle = (angle + _local6);
bullet.damage = damage;
if (_arg1){
World.getSingleton().playerBullets.add(bullet);
bullet.bodyType = BodyType.PLAYER_BULLET;
} else {
World.getSingleton().enemyBullets.add(bullet);
bullet.bodyType = BodyType.ENEMY_BULLET;
};
bullet.initRigidBody();
bullet.away();
shell = new HandGunShell();
shell.speed = (speed / 100);
shell.position = position.Copy();
shell.screenPosition = screenPosition.Copy();
shell.direction = bullet.direction.Negative();
_local4 = new Point(image.shellOut.x, image.shellOut.y);
_local4 = image.localToGlobal(_local4);
_local5 = position.Copy();
_local5.Subtract(screenPosition);
shell.position.x = (_local5.x + _local4.x);
shell.position.y = (_local5.y + _local4.y);
shell.screenPosition.x = _local4.x;
shell.screenPosition.y = _local4.y;
shell.angle = angle;
shell.damage = damage;
shell.initRigidBody();
shell.away();
if (World.getSingleton().shells.size() > shellLimit){
World.getSingleton().shells.get(0).lifeTime = 0;
World.getSingleton().shells.get(0).die();
};
World.getSingleton().shells.add(shell);
};
};
}
public function setDelaySpeed(_arg1:Number):void{
var _local2:Boolean;
_local2 = false;
if (delayTimer.running){
_local2 = true;
delayTimer.stop();
};
delayTimer.removeEventListener(TimerEvent.TIMER, setAbleToShoot);
delay = _arg1;
delayTimer = new Timer(delay);
delayTimer.addEventListener(TimerEvent.TIMER, setAbleToShoot);
if (_local2){
delayTimer.start();
};
}
override public function update():void{
super.update();
}
override public function timerOff():void{
delayTimer.removeEventListener(TimerEvent.TIMER, setAbleToShoot);
reloadTimer.removeEventListener(TimerEvent.TIMER, reloadNow);
delayTimer.stop();
reloadTimer.stop();
ableToShoot = true;
reloading = false;
reloadCounter = 0;
image.gotoAndStop("idle");
image2.gotoAndStop("idle");
}
public function setReloadSpeed(_arg1:Number):void{
var _local2:Boolean;
_local2 = false;
if (reloadTimer.running){
_local2 = true;
reloadTimer.stop();
};
reloadTimer.removeEventListener(TimerEvent.TIMER, reloadNow);
this.reloadTime = _arg1;
reloadTimer = new Timer((_arg1 / reloadFrame));
reloadTimer.addEventListener(TimerEvent.TIMER, reloadNow);
if (_local2){
reloadTimer.start();
};
}
protected function reloadNow(_arg1:TimerEvent):void{
var _local2:int;
image.gotoAndStop((initialReloadFrame + reloadCounter));
image2.gotoAndStop((initialReloadFrame + reloadCounter));
reloadCounter++;
if (reloadCounter > reloadFrame){
reloadCounter = 0;
reloadTimer.stop();
if (ammoType.amount > 0){
_local2 = (maxAmmo - ammo);
if (ammoType.amount > _local2){
ammoType.amount = (ammoType.amount - _local2);
ammo = (ammo + _local2);
} else {
ammo = (ammo + ammoType.amount);
ammoType.amount = 0;
};
};
ableToShoot = true;
reloading = false;
if (!World.getSingleton().muted){
clipInSound.play();
};
};
}
}
}//package p_weapon
Section 306
//Shotgun (p_weapon.Shotgun)
package p_weapon {
import Box2D.Common.Math.*;
import flash.events.*;
import p_char.*;
import p_singleton.*;
import flash.geom.*;
import flash.media.*;
import flash.utils.*;
import p_ammo.*;
import p_bullet.*;
public class Shotgun extends RangeWeapon {
public var pumpCounter:int;
public var initialPumpFrame:int;
public var pumpSound:Sound;
public var reloadMode:Boolean;
public var pumpFrame:int;
public function Shotgun(){
id = "Shotgun";
image = new armShotGunF();
image2 = new armShotGunB();
logo = new weaponShotGunLogo();
ammo = 8;
maxAmmo = 8;
delay = 400;
speed = 10;
reloadTime = 450;
angle = 0;
damage = 55;
pumpFrame = 7;
initialPumpFrame = 31;
pumpCounter = 0;
accuracy = 80;
reloadFrame = 20;
initialReloadFrame = 10;
initTimer();
reloadMode = false;
ammoType = new Ammo12Gauge(0);
price = 2100;
attackSound = new attackSoundShotgun();
pumpSound = new pumpShotgun();
clipInSound = new reloadShotgun();
}
override public function reload():void{
if ((((((ammo < maxAmmo)) && ((ammoType.amount > 0)))) && (!(reloading)))){
reloading = true;
reloadMode = true;
ableToShoot = false;
reloadTimer.start();
} else {
if ((((ammo >= maxAmmo)) || ((ammoType.amount <= 0)))){
reloadMode = false;
};
};
}
override public function initTimer():void{
delayTimer = new Timer((delay / pumpFrame));
delayTimer.addEventListener(TimerEvent.TIMER, setAbleToShoot);
reloadTimer = new Timer((reloadTime / reloadFrame));
reloadTimer.addEventListener(TimerEvent.TIMER, reloadNow);
}
override protected function reloadNow(_arg1:TimerEvent):void{
var _local2:int;
image.gotoAndStop((initialReloadFrame + reloadCounter));
image2.gotoAndStop((initialReloadFrame + reloadCounter));
reloadCounter++;
if (reloadCounter > reloadFrame){
reloadCounter = 0;
reloadTimer.stop();
if (ammoType.amount > 0){
_local2 = 1;
if (ammoType.amount > _local2){
ammoType.amount = (ammoType.amount - _local2);
ammo = (ammo + _local2);
} else {
ammo = (ammo + ammoType.amount);
ammoType.amount = 0;
};
};
reloading = false;
pumpCounter = 0;
delayTimer.start();
if (!World.getSingleton().muted){
clipInSound.play();
};
};
}
override public function setDelaySpeed(_arg1:Number):void{
if (delayTimer.running){
delayTimer.stop();
};
delayTimer.removeEventListener(TimerEvent.TIMER, setAbleToShoot);
delay = _arg1;
delayTimer = new Timer((delay / pumpFrame));
delayTimer.addEventListener(TimerEvent.TIMER, setAbleToShoot);
}
override public function attack(_arg1:Boolean):void{
var _local2:int;
var _local3:int;
var _local4:Number;
var _local5:Number;
var _local6:Point;
var _local7:b2Vec2;
var _local8:Number;
if (ammo > 0){
reloadMode = false;
};
if (((ableToShoot) && ((ammo > 0)))){
reloadMode = false;
image.gotoAndPlay("shoot");
image2.gotoAndPlay("shoot");
};
if (ammo <= 0){
reload();
} else {
if (((ableToShoot) && ((ammo > 0)))){
reloadMode = false;
reloadTimer.stop();
reloading = false;
reloadCounter = 0;
ableToShoot = false;
delayTimer.start();
ammo--;
_local2 = 0;
_local3 = 5;
while (_local2 < _local3) {
bullet = new HandGunBullet();
bullet.speed = speed;
bullet.position = position.Copy();
bullet.screenPosition = screenPosition.Copy();
bullet.direction = direction.Copy();
_local4 = ((Math.random() * (deviation - accuracy)) / deviation);
_local5 = ((((Math.floor((Math.random() * 10)) + 1) % 2) == 0)) ? -1 : 1;
bullet.direction.y = (bullet.direction.y + (_local4 * _local5));
_local6 = new Point(image.bulletOut.x, image.bulletOut.y);
_local6 = image.localToGlobal(_local6);
_local7 = position.Copy();
_local7.Subtract(screenPosition);
bullet.position.x = (_local7.x + _local6.x);
bullet.position.y = (_local7.y + _local6.y);
bullet.screenPosition.x = _local6.x;
bullet.screenPosition.y = _local6.y;
_local8 = b2Vec2.vectorToRotation(direction, bullet.direction);
if ((((((bullet.direction.x > 0)) && ((bullet.direction.y < 0)))) || ((((bullet.direction.x < 0)) && ((bullet.direction.y > 0)))))){
_local8 = (_local8 * -1);
};
bullet.angle = (angle + _local8);
bullet.damage = damage;
if (_arg1){
World.getSingleton().playerBullets.add(bullet);
bullet.bodyType = BodyType.PLAYER_BULLET;
} else {
World.getSingleton().enemyBullets.add(bullet);
bullet.bodyType = BodyType.ENEMY_BULLET;
};
bullet.initRigidBody();
bullet.away();
_local2++;
};
if (!World.getSingleton().muted){
soundChannel = attackSound.play(0, 0, soundTransform);
};
};
};
}
override public function update():void{
super.update();
if (reloadMode){
reload();
};
}
override public function setAbleToShoot(_arg1:TimerEvent):void{
var _local2:Point;
var _local3:b2Vec2;
if (!reloading){
image.gotoAndStop((initialPumpFrame + pumpCounter));
image2.gotoAndStop((initialPumpFrame + pumpCounter));
};
pumpCounter++;
if (pumpCounter > pumpFrame){
if (!World.getSingleton().muted){
pumpSound.play();
};
pumpCounter = 0;
ableToShoot = true;
delayTimer.stop();
shell = new ShotGunShell();
shell.speed = (speed / 100);
shell.position = position.Copy();
shell.screenPosition = screenPosition.Copy();
shell.direction = bullet.direction.Negative();
_local2 = new Point(image.shellOut.x, image.shellOut.y);
_local2 = image.localToGlobal(_local2);
_local3 = position.Copy();
_local3.Subtract(screenPosition);
shell.position.x = (_local3.x + _local2.x);
shell.position.y = (_local3.y + _local2.y);
shell.screenPosition.x = _local2.x;
shell.screenPosition.y = _local2.y;
shell.angle = angle;
shell.damage = damage;
shell.initRigidBody();
shell.away();
if (World.getSingleton().shells.size() > shellLimit){
World.getSingleton().shells.get(0).lifeTime = 0;
World.getSingleton().shells.get(0).die();
};
World.getSingleton().shells.add(shell);
};
}
override public function timerOff():void{
delayTimer.removeEventListener(TimerEvent.TIMER, setAbleToShoot);
reloadTimer.removeEventListener(TimerEvent.TIMER, reloadNow);
delayTimer.stop();
reloadTimer.stop();
ableToShoot = true;
reloading = false;
reloadMode = false;
reloadCounter = 0;
pumpCounter = 0;
image.gotoAndStop("idle");
image2.gotoAndStop("idle");
}
}
}//package p_weapon
Section 307
//SM5 (p_weapon.SM5)
package p_weapon {
import Box2D.Common.Math.*;
import p_char.*;
import p_singleton.*;
import flash.geom.*;
import p_ammo.*;
import p_bullet.*;
public class SM5 extends RangeWeapon {
public function SM5(){
id = "SM5";
image = new armSM5F();
image2 = new armSM5B();
logo = new weaponSM5Logo();
ammo = 30;
maxAmmo = 30;
delay = 175;
speed = 10;
reloadTime = 850;
angle = 0;
damage = 25;
accuracy = 95;
reloadFrame = 31;
initialReloadFrame = 5;
price = 1600;
initTimer();
ammoType = new Ammo9mm(0);
attackSound = new attackSoundMP5();
}
override public function reload():void{
var _local1:Point;
var _local2:b2Vec2;
if ((((((ammo < maxAmmo)) && ((ammoType.amount > 0)))) && (!(reloading)))){
if (!World.getSingleton().muted){
clipInSound.play();
clipOutSound.play();
};
reloading = true;
ableToShoot = false;
reloadTimer.start();
mags = new MagsMP5();
if (faceState == FaceState.FACE_LEFT){
mags.image.scaleX = (mags.image.scaleX * -1);
mags.angle = -(image.rotation);
} else {
mags.angle = image.rotation;
};
mags.speed = 0;
mags.position = position.Copy();
mags.screenPosition = screenPosition.Copy();
mags.direction = direction;
_local1 = new Point(image.magOut.x, image.magOut.y);
_local1 = image.localToGlobal(_local1);
_local2 = position.Copy();
_local2.Subtract(screenPosition);
mags.position.x = (_local2.x + _local1.x);
mags.position.y = (_local2.y + _local1.y);
mags.screenPosition.x = _local1.x;
mags.screenPosition.y = _local1.y;
mags.damage = damage;
mags.initRigidBody();
mags.away();
World.getSingleton().mags.add(mags);
};
}
override public function attack(_arg1:Boolean):void{
if (((((ableToShoot) && ((ammo > 0)))) && (!(reloading)))){
bullet = new HandGunBullet();
image.gotoAndPlay("shoot");
image2.gotoAndPlay("shoot");
};
super.attack(_arg1);
}
}
}//package p_weapon
Section 308
//SteyrTMP (p_weapon.SteyrTMP)
package p_weapon {
import Box2D.Common.Math.*;
import p_char.*;
import p_singleton.*;
import flash.geom.*;
import p_ammo.*;
import p_bullet.*;
public class SteyrTMP extends RangeWeapon {
public function SteyrTMP(){
id = "Steyr TMP";
image = new armSMGF();
image2 = new armSMGB();
logo = new weaponSteyrTMPLogo();
ammo = 30;
maxAmmo = 30;
delay = 150;
speed = 10;
reloadTime = 850;
angle = 0;
damage = 30;
accuracy = 80;
reloadFrame = 32;
initialReloadFrame = 5;
initTimer();
ammoType = new Ammo9mm(0);
price = 1500;
attackSound = new attackSoundSteyrTMP();
}
override public function reload():void{
var _local1:Point;
var _local2:b2Vec2;
if ((((((ammo < maxAmmo)) && ((ammoType.amount > 0)))) && (!(reloading)))){
if (!World.getSingleton().muted){
clipOutSound.play();
};
reloading = true;
ableToShoot = false;
reloadTimer.start();
mags = new MagsSteyrTMP();
if (faceState == FaceState.FACE_LEFT){
mags.image.scaleX = (mags.image.scaleX * -1);
mags.angle = -(image.rotation);
} else {
mags.angle = image.rotation;
};
mags.speed = 0;
mags.position = position.Copy();
mags.screenPosition = screenPosition.Copy();
mags.direction = direction;
_local1 = new Point(image.magOut.x, image.magOut.y);
_local1 = image.localToGlobal(_local1);
_local2 = position.Copy();
_local2.Subtract(screenPosition);
mags.position.x = (_local2.x + _local1.x);
mags.position.y = (_local2.y + _local1.y);
mags.screenPosition.x = _local1.x;
mags.screenPosition.y = _local1.y;
mags.damage = damage;
mags.initRigidBody();
mags.away();
World.getSingleton().mags.add(mags);
};
}
override public function attack(_arg1:Boolean):void{
if (((((ableToShoot) && ((ammo > 0)))) && (!(reloading)))){
bullet = new HandGunBullet();
image.gotoAndPlay("shoot");
image2.gotoAndPlay("shoot");
};
super.attack(_arg1);
}
}
}//package p_weapon
Section 309
//WaltherP99 (p_weapon.WaltherP99)
package p_weapon {
import Box2D.Common.Math.*;
import p_char.*;
import p_singleton.*;
import flash.geom.*;
import p_ammo.*;
import p_bullet.*;
public class WaltherP99 extends RangeWeapon {
public function WaltherP99(){
id = "Walther P99";
image = new armPistolF();
image2 = new armPistolB();
logo = new weaponWaltherP99Logo();
ammo = 16;
maxAmmo = 16;
delay = 300;
speed = 10;
reloadTime = 750;
angle = 0;
damage = 30;
accuracy = 85;
reloadFrame = 32;
initialReloadFrame = 7;
initTimer();
ammoType = new Ammo9mm(0);
price = 600;
attackSound = new attackSoundUSP();
}
override public function reload():void{
var _local1:Point;
var _local2:b2Vec2;
if ((((((ammo < maxAmmo)) && ((ammoType.amount > 0)))) && (!(reloading)))){
if (!World.getSingleton().muted){
clipOutSound.play();
};
reloading = true;
ableToShoot = false;
reloadTimer.start();
mags = new MagsWaltherP99();
if (faceState == FaceState.FACE_LEFT){
mags.image.scaleX = (mags.image.scaleX * -1);
mags.angle = -(image.rotation);
} else {
mags.angle = image.rotation;
};
mags.speed = 0;
mags.position = position.Copy();
mags.screenPosition = screenPosition.Copy();
mags.direction = direction;
_local1 = new Point(image.magOut.x, image.magOut.y);
_local1 = image.localToGlobal(_local1);
_local2 = position.Copy();
_local2.Subtract(screenPosition);
mags.position.x = (_local2.x + _local1.x);
mags.position.y = (_local2.y + _local1.y);
mags.screenPosition.x = _local1.x;
mags.screenPosition.y = _local1.y;
mags.damage = damage;
mags.initRigidBody();
mags.away();
World.getSingleton().mags.add(mags);
};
}
override public function attack(_arg1:Boolean):void{
if (((((ableToShoot) && ((ammo > 0)))) && (!(reloading)))){
bullet = new HandGunBullet();
image.gotoAndPlay("shoot");
image2.gotoAndPlay("shoot");
};
super.attack(_arg1);
}
}
}//package p_weapon
Section 310
//Weapon (p_weapon.Weapon)
package p_weapon {
import flash.display.*;
import flash.media.*;
import p_entity.*;
public class Weapon extends Entity {
public var playerOwned:Boolean;// = false
public var price:int;
public var id:String;
public var soundTransform:SoundTransform;
public var logo:MovieClip;
public var damage:Number;
public var faceState:String;
public var weaponType:String;
public var image2:MovieClip;
public function Weapon(){
playerOwned = false;
super();
soundTransform = new SoundTransform(0.4);
}
override public function update():void{
}
public function initTimer():void{
}
public function timerOff():void{
}
}
}//package p_weapon
Section 311
//WeaponType (p_weapon.WeaponType)
package p_weapon {
public class WeaponType {
public static var MELEE:String = "MELEE";
public static var EXPLOSIVE:String = "EXPLOSIVE";
public static var THROW:String = "THROW";
public static var RANGE:String = "RANGE";
}
}//package p_weapon
Section 312
//Zombie01Weapon (p_weapon.Zombie01Weapon)
package p_weapon {
import Box2D.Common.Math.*;
import flash.events.*;
import p_char.*;
import p_singleton.*;
import flash.geom.*;
import p_bullet.*;
public class Zombie01Weapon extends MeleeWeapon {
public function Zombie01Weapon(){
id = "Zombie 01 weapon";
image = new zombieArmF01();
image2 = new zombieArmB01();
attackTime = 500;
initialAttackFrame = 78;
attackFrame = 8;
delay = 10;
damage = 10;
angle = 0;
bulletOutCounter = 5;
bulletIsOut = false;
price = 0;
initTimer();
attackSound = new knifeSlash();
}
override protected function animateAttack(_arg1:TimerEvent):void{
var _local2:Point;
var _local3:b2Vec2;
super.animateAttack(_arg1);
if ((((attackCounter > bulletOutCounter)) && (!(bulletIsOut)))){
bulletIsOut = true;
bullet = new ZombieBullet();
bullet.speed = speed;
bullet.position = position.Copy();
bullet.screenPosition = screenPosition.Copy();
bullet.direction = direction.Copy();
_local2 = new Point(image.bulletOut.x, image.bulletOut.y);
_local2 = image.localToGlobal(_local2);
_local3 = position.Copy();
_local3.Subtract(screenPosition);
bullet.position.x = (_local3.x + _local2.x);
bullet.position.y = (_local3.y + _local2.y);
bullet.screenPosition.x = _local2.x;
bullet.screenPosition.y = _local2.y;
bullet.angle = angle;
bullet.damage = damage;
if (isAPlayer){
World.getSingleton().playerBullets.add(bullet);
bullet.bodyType = BodyType.PLAYER_BULLET;
} else {
World.getSingleton().enemyBullets.add(bullet);
bullet.bodyType = BodyType.ENEMY_BULLET;
};
bullet.initRigidBody();
bullet.away();
};
}
override public function timerOff():void{
delayTimer.removeEventListener(TimerEvent.TIMER, setAbleToSlice);
attackTimer.removeEventListener(TimerEvent.TIMER, animateAttack);
delayTimer.stop();
attackTimer.stop();
bulletIsOut = false;
ableToSlice = true;
attacking = false;
attackCounter = 0;
}
}
}//package p_weapon
Section 313
//Zombie02Weapon (p_weapon.Zombie02Weapon)
package p_weapon {
import Box2D.Common.Math.*;
import flash.events.*;
import p_char.*;
import p_singleton.*;
import flash.geom.*;
import p_bullet.*;
public class Zombie02Weapon extends MeleeWeapon {
public function Zombie02Weapon(){
id = "Zombie 02 weapon";
image = new zombieArmF02();
image2 = new zombieArmB02();
attackTime = 500;
initialAttackFrame = 78;
attackFrame = 8;
delay = 10;
damage = 10;
angle = 0;
bulletOutCounter = 5;
bulletIsOut = false;
price = 0;
initTimer();
attackSound = new knifeSlash();
}
override protected function animateAttack(_arg1:TimerEvent):void{
var _local2:Point;
var _local3:b2Vec2;
super.animateAttack(_arg1);
if ((((attackCounter > bulletOutCounter)) && (!(bulletIsOut)))){
bulletIsOut = true;
bullet = new ZombieBullet();
bullet.speed = speed;
bullet.position = position.Copy();
bullet.screenPosition = screenPosition.Copy();
bullet.direction = direction.Copy();
_local2 = new Point(image.bulletOut.x, image.bulletOut.y);
_local2 = image.localToGlobal(_local2);
_local3 = position.Copy();
_local3.Subtract(screenPosition);
bullet.position.x = (_local3.x + _local2.x);
bullet.position.y = (_local3.y + _local2.y);
bullet.screenPosition.x = _local2.x;
bullet.screenPosition.y = _local2.y;
bullet.angle = angle;
bullet.damage = damage;
if (isAPlayer){
World.getSingleton().playerBullets.add(bullet);
bullet.bodyType = BodyType.PLAYER_BULLET;
} else {
World.getSingleton().enemyBullets.add(bullet);
bullet.bodyType = BodyType.ENEMY_BULLET;
};
bullet.initRigidBody();
bullet.away();
};
}
override public function timerOff():void{
delayTimer.removeEventListener(TimerEvent.TIMER, setAbleToSlice);
attackTimer.removeEventListener(TimerEvent.TIMER, animateAttack);
delayTimer.stop();
attackTimer.stop();
bulletIsOut = false;
ableToSlice = true;
attacking = false;
attackCounter = 0;
}
}
}//package p_weapon
Section 314
//Zombie03Weapon (p_weapon.Zombie03Weapon)
package p_weapon {
import Box2D.Common.Math.*;
import flash.events.*;
import p_char.*;
import p_singleton.*;
import flash.geom.*;
import p_bullet.*;
public class Zombie03Weapon extends MeleeWeapon {
public function Zombie03Weapon(){
id = "Zombie 03 weapon";
image = new zombieArmF03();
image2 = new zombieArmB03();
attackTime = 650;
initialAttackFrame = 78;
attackFrame = 8;
delay = 10;
damage = 20;
angle = 0;
bulletOutCounter = 5;
bulletIsOut = false;
price = 0;
initTimer();
attackSound = new knifeSlash();
}
override protected function animateAttack(_arg1:TimerEvent):void{
var _local2:Point;
var _local3:b2Vec2;
super.animateAttack(_arg1);
if ((((attackCounter > bulletOutCounter)) && (!(bulletIsOut)))){
bulletIsOut = true;
bullet = new ZombieBullet();
bullet.speed = speed;
bullet.position = position.Copy();
bullet.screenPosition = screenPosition.Copy();
bullet.direction = direction.Copy();
_local2 = new Point(image.bulletOut.x, image.bulletOut.y);
_local2 = image.localToGlobal(_local2);
_local3 = position.Copy();
_local3.Subtract(screenPosition);
bullet.position.x = (_local3.x + _local2.x);
bullet.position.y = (_local3.y + _local2.y);
bullet.screenPosition.x = _local2.x;
bullet.screenPosition.y = _local2.y;
bullet.angle = angle;
bullet.damage = damage;
if (isAPlayer){
World.getSingleton().playerBullets.add(bullet);
bullet.bodyType = BodyType.PLAYER_BULLET;
} else {
World.getSingleton().enemyBullets.add(bullet);
bullet.bodyType = BodyType.ENEMY_BULLET;
};
bullet.initRigidBody();
bullet.away();
};
}
override public function timerOff():void{
delayTimer.removeEventListener(TimerEvent.TIMER, setAbleToSlice);
attackTimer.removeEventListener(TimerEvent.TIMER, animateAttack);
delayTimer.stop();
attackTimer.stop();
bulletIsOut = false;
ableToSlice = true;
attacking = false;
attackCounter = 0;
}
}
}//package p_weapon
Section 315
//Zombie04Weapon (p_weapon.Zombie04Weapon)
package p_weapon {
import Box2D.Common.Math.*;
import flash.events.*;
import p_char.*;
import p_singleton.*;
import flash.geom.*;
import p_bullet.*;
public class Zombie04Weapon extends MeleeWeapon {
public function Zombie04Weapon(){
id = "Zombie 04 weapon";
image = new zombieArmF04();
image2 = new zombieArmB04();
attackTime = 650;
initialAttackFrame = 78;
attackFrame = 8;
delay = 10;
damage = 20;
angle = 0;
bulletOutCounter = 5;
bulletIsOut = false;
price = 0;
initTimer();
attackSound = new knifeSlash();
}
override protected function animateAttack(_arg1:TimerEvent):void{
var _local2:Point;
var _local3:b2Vec2;
super.animateAttack(_arg1);
if ((((attackCounter > bulletOutCounter)) && (!(bulletIsOut)))){
bulletIsOut = true;
bullet = new ZombieBullet();
bullet.speed = speed;
bullet.position = position.Copy();
bullet.screenPosition = screenPosition.Copy();
bullet.direction = direction.Copy();
_local2 = new Point(image.bulletOut.x, image.bulletOut.y);
_local2 = image.localToGlobal(_local2);
_local3 = position.Copy();
_local3.Subtract(screenPosition);
bullet.position.x = (_local3.x + _local2.x);
bullet.position.y = (_local3.y + _local2.y);
bullet.screenPosition.x = _local2.x;
bullet.screenPosition.y = _local2.y;
bullet.angle = angle;
bullet.damage = damage;
if (isAPlayer){
World.getSingleton().playerBullets.add(bullet);
bullet.bodyType = BodyType.PLAYER_BULLET;
} else {
World.getSingleton().enemyBullets.add(bullet);
bullet.bodyType = BodyType.ENEMY_BULLET;
};
bullet.initRigidBody();
bullet.away();
};
}
override public function timerOff():void{
delayTimer.removeEventListener(TimerEvent.TIMER, setAbleToSlice);
attackTimer.removeEventListener(TimerEvent.TIMER, animateAttack);
delayTimer.stop();
attackTimer.stop();
bulletIsOut = false;
ableToSlice = true;
attacking = false;
attackCounter = 0;
}
}
}//package p_weapon
Section 316
//armAKB (armAKB)
package {
import flash.display.*;
public dynamic class armAKB extends MovieClip {
public function armAKB(){
addFrameScript(0, frame1, 2, frame3, 34, frame35);
}
function frame3(){
gotoAndStop("idle");
}
function frame1(){
stop();
}
function frame35(){
gotoAndStop("idle");
}
}
}//package
Section 317
//armAKF (armAKF)
package {
import flash.display.*;
public dynamic class armAKF extends MovieClip {
public var bulletOut:MovieClip;
public var shellOut:MovieClip;
public var magOut:MovieClip;
public function armAKF(){
addFrameScript(0, frame1, 2, frame3, 34, frame35);
}
function frame3(){
gotoAndStop("idle");
}
function frame1(){
stop();
}
function frame35(){
gotoAndStop("idle");
}
}
}//package
Section 318
//armBaseballBatB (armBaseballBatB)
package {
import flash.display.*;
public dynamic class armBaseballBatB extends MovieClip {
public function armBaseballBatB(){
addFrameScript(0, frame1, 11, frame12, 12, frame13);
}
function frame12(){
stop();
}
function frame1(){
stop();
}
function frame13(){
gotoAndStop("idle");
}
}
}//package
Section 319
//armBaseballBatF (armBaseballBatF)
package {
import flash.display.*;
public dynamic class armBaseballBatF extends MovieClip {
public var bulletOut:MovieClip;
public var attackDone:Boolean;
public function armBaseballBatF(){
addFrameScript(0, frame1, 1, frame2, 7, frame8, 11, frame12, 12, frame13);
}
function frame12(){
attackDone = false;
stop();
}
function frame1(){
stop();
attackDone = false;
}
function frame13(){
gotoAndStop("idle");
}
function frame8(){
attackDone = true;
}
function frame2(){
attackDone = false;
}
}
}//package
Section 320
//armBerettaF (armBerettaF)
package {
import flash.display.*;
public dynamic class armBerettaF extends MovieClip {
public var bulletOut:MovieClip;
public var shellOut:MovieClip;
public var magOut:MovieClip;
public function armBerettaF(){
addFrameScript(0, frame1, 5, frame6, 38, frame39);
}
function frame6(){
gotoAndStop("idle");
}
function frame1(){
stop();
}
function frame39(){
gotoAndStop("idle");
}
}
}//package
Section 321
//armChainSawB (armChainSawB)
package {
import flash.display.*;
public dynamic class armChainSawB extends MovieClip {
public var attackDone:Boolean;
public function armChainSawB(){
addFrameScript(0, frame1, 1, frame2);
}
function frame1(){
stop();
attackDone = false;
}
function frame2(){
attackDone = false;
}
}
}//package
Section 322
//armChainSawF (armChainSawF)
package {
import flash.display.*;
public dynamic class armChainSawF extends MovieClip {
public var bulletOut:MovieClip;
public function armChainSawF(){
addFrameScript(0, frame1, 2, frame3);
}
function frame3(){
gotoAndPlay("shoot");
}
function frame1(){
stop();
}
}
}//package
Section 323
//armDeagleF (armDeagleF)
package {
import flash.display.*;
public dynamic class armDeagleF extends MovieClip {
public var bulletOut:MovieClip;
public var shellOut:MovieClip;
public var magOut:MovieClip;
public function armDeagleF(){
addFrameScript(0, frame1, 5, frame6, 38, frame39);
}
function frame6(){
gotoAndStop("idle");
}
function frame1(){
stop();
}
function frame39(){
gotoAndStop("idle");
}
}
}//package
Section 324
//armDynamiteF (armDynamiteF)
package {
import flash.display.*;
public dynamic class armDynamiteF extends MovieClip {
public var bulletOut:MovieClip;
public var shellOut:MovieClip;
public function armDynamiteF(){
addFrameScript(0, frame1, 16, frame17, 26, frame27, 27, frame28);
}
function frame1(){
stop();
}
function frame17(){
stop();
}
function frame27(){
gotoAndStop("idle");
}
function frame28(){
stop();
}
}
}//package
Section 325
//armGrenadeB (armGrenadeB)
package {
import flash.display.*;
public dynamic class armGrenadeB extends MovieClip {
public function armGrenadeB(){
addFrameScript(0, frame1, 16, frame17, 26, frame27);
}
function frame1(){
stop();
}
function frame17(){
stop();
}
function frame27(){
gotoAndStop("idle");
}
}
}//package
Section 326
//armGrenadeF (armGrenadeF)
package {
import flash.display.*;
public dynamic class armGrenadeF extends MovieClip {
public var bulletOut:MovieClip;
public var shellOut:MovieClip;
public function armGrenadeF(){
addFrameScript(0, frame1, 16, frame17, 26, frame27, 27, frame28);
}
function frame1(){
stop();
}
function frame17(){
stop();
}
function frame27(){
gotoAndStop("idle");
}
function frame28(){
stop();
}
}
}//package
Section 327
//armKatanaB (armKatanaB)
package {
import flash.display.*;
public dynamic class armKatanaB extends MovieClip {
public var attackDone:Boolean;
public function armKatanaB(){
addFrameScript(0, frame1, 1, frame2, 7, frame8, 9, frame10, 10, frame11);
}
function frame10(){
attackDone = false;
stop();
}
function frame1(){
stop();
attackDone = false;
}
function frame8(){
attackDone = true;
}
function frame2(){
attackDone = false;
}
function frame11(){
gotoAndStop("idle");
}
}
}//package
Section 328
//armKatanaF (armKatanaF)
package {
import flash.display.*;
public dynamic class armKatanaF extends MovieClip {
public var bulletOut:MovieClip;
public var attackDone:Boolean;
public function armKatanaF(){
addFrameScript(0, frame1, 1, frame2, 7, frame8, 9, frame10, 10, frame11);
}
function frame10(){
attackDone = false;
stop();
}
function frame1(){
stop();
attackDone = false;
}
function frame8(){
attackDone = true;
}
function frame2(){
attackDone = false;
}
function frame11(){
gotoAndStop("idle");
}
}
}//package
Section 329
//armKnifeB (armKnifeB)
package {
import flash.display.*;
public dynamic class armKnifeB extends MovieClip {
public function armKnifeB(){
addFrameScript(0, frame1, 7, frame8, 8, frame9);
}
function frame1(){
stop();
}
function frame9(){
gotoAndStop("idle");
}
function frame8(){
stop();
}
}
}//package
Section 330
//armKnifeF (armKnifeF)
package {
import flash.display.*;
public dynamic class armKnifeF extends MovieClip {
public var bulletOut:MovieClip;
public var attackDone:Boolean;
public function armKnifeF(){
addFrameScript(0, frame1, 1, frame2, 4, frame5, 7, frame8, 8, frame9);
}
function frame1(){
stop();
attackDone = false;
}
function frame5(){
attackDone = true;
}
function frame9(){
gotoAndStop("idle");
}
function frame8(){
attackDone = false;
stop();
}
function frame2(){
attackDone = false;
}
}
}//package
Section 331
//armM14F (armM14F)
package {
import flash.display.*;
public dynamic class armM14F extends MovieClip {
public var bulletOut:MovieClip;
public var shellOut:MovieClip;
public var magOut:MovieClip;
public function armM14F(){
addFrameScript(0, frame1, 2, frame3, 34, frame35);
}
function frame3(){
gotoAndStop("idle");
}
function frame1(){
stop();
}
function frame35(){
gotoAndStop("idle");
}
}
}//package
Section 332
//armM1911F (armM1911F)
package {
import flash.display.*;
public dynamic class armM1911F extends MovieClip {
public var bulletOut:MovieClip;
public var shellOut:MovieClip;
public var magOut:MovieClip;
public function armM1911F(){
addFrameScript(0, frame1, 5, frame6, 38, frame39);
}
function frame6(){
gotoAndStop("idle");
}
function frame1(){
stop();
}
function frame39(){
gotoAndStop("idle");
}
}
}//package
Section 333
//armM4B (armM4B)
package {
import flash.display.*;
public dynamic class armM4B extends MovieClip {
public function armM4B(){
addFrameScript(0, frame1, 2, frame3, 34, frame35);
}
function frame3(){
gotoAndStop("idle");
}
function frame1(){
stop();
}
function frame35(){
gotoAndStop("idle");
}
}
}//package
Section 334
//armM4F (armM4F)
package {
import flash.display.*;
public dynamic class armM4F extends MovieClip {
public var bulletOut:MovieClip;
public var shellOut:MovieClip;
public var magOut:MovieClip;
public function armM4F(){
addFrameScript(0, frame1, 2, frame3, 34, frame35);
}
function frame3(){
gotoAndStop("idle");
}
function frame1(){
stop();
}
function frame35(){
gotoAndStop("idle");
}
}
}//package
Section 335
//armMPUB (armMPUB)
package {
import flash.display.*;
public dynamic class armMPUB extends MovieClip {
public function armMPUB(){
addFrameScript(0, frame1, 3, frame4, 35, frame36);
}
function frame1(){
stop();
}
function frame4(){
gotoAndStop("idle");
}
function frame36(){
gotoAndStop("idle");
}
}
}//package
Section 336
//armMPUF (armMPUF)
package {
import flash.display.*;
public dynamic class armMPUF extends MovieClip {
public var bulletOut:MovieClip;
public var shellOut:MovieClip;
public var magOut:MovieClip;
public function armMPUF(){
addFrameScript(0, frame1, 3, frame4, 35, frame36);
}
function frame1(){
stop();
}
function frame4(){
gotoAndStop("idle");
}
function frame36(){
gotoAndStop("idle");
}
}
}//package
Section 337
//armPistolB (armPistolB)
package {
import flash.display.*;
public dynamic class armPistolB extends MovieClip {
public function armPistolB(){
addFrameScript(0, frame1, 5, frame6, 38, frame39);
}
function frame6(){
gotoAndStop("idle");
}
function frame1(){
stop();
}
function frame39(){
gotoAndStop("idle");
}
}
}//package
Section 338
//armPistolF (armPistolF)
package {
import flash.display.*;
public dynamic class armPistolF extends MovieClip {
public var bulletOut:MovieClip;
public var shellOut:MovieClip;
public var magOut:MovieClip;
public function armPistolF(){
addFrameScript(0, frame1, 5, frame6, 38, frame39);
}
function frame6(){
gotoAndStop("idle");
}
function frame1(){
stop();
}
function frame39(){
gotoAndStop("idle");
}
}
}//package
Section 339
//armShotGunB (armShotGunB)
package {
import flash.display.*;
public dynamic class armShotGunB extends MovieClip {
public function armShotGunB(){
addFrameScript(0, frame1, 8, frame9, 37, frame38);
}
function frame1(){
stop();
}
function frame9(){
gotoAndStop("idle");
}
function frame38(){
stop();
}
}
}//package
Section 340
//armShotGunF (armShotGunF)
package {
import flash.display.*;
public dynamic class armShotGunF extends MovieClip {
public var bulletOut:MovieClip;
public var shellOut:MovieClip;
public var magOut:MovieClip;
public function armShotGunF(){
addFrameScript(0, frame1, 8, frame9, 37, frame38);
}
function frame1(){
stop();
}
function frame9(){
gotoAndStop("idle");
}
function frame38(){
stop();
}
}
}//package
Section 341
//armSM5B (armSM5B)
package {
import flash.display.*;
public dynamic class armSM5B extends MovieClip {
public function armSM5B(){
addFrameScript(0, frame1, 3, frame4, 35, frame36);
}
function frame1(){
stop();
}
function frame4(){
gotoAndStop("idle");
}
function frame36(){
gotoAndStop("idle");
}
}
}//package
Section 342
//armSM5F (armSM5F)
package {
import flash.display.*;
public dynamic class armSM5F extends MovieClip {
public var bulletOut:MovieClip;
public var shellOut:MovieClip;
public var magOut:MovieClip;
public function armSM5F(){
addFrameScript(0, frame1, 3, frame4, 35, frame36);
}
function frame1(){
stop();
}
function frame4(){
gotoAndStop("idle");
}
function frame36(){
gotoAndStop("idle");
}
}
}//package
Section 343
//armSMGB (armSMGB)
package {
import flash.display.*;
public dynamic class armSMGB extends MovieClip {
public function armSMGB(){
addFrameScript(0, frame1, 2, frame3, 35, frame36);
}
function frame3(){
gotoAndStop("idle");
}
function frame1(){
stop();
}
function frame36(){
gotoAndStop("idle");
}
}
}//package
Section 344
//armSMGF (armSMGF)
package {
import flash.display.*;
public dynamic class armSMGF extends MovieClip {
public var bulletOut:MovieClip;
public var shellOut:MovieClip;
public var magOut:MovieClip;
public function armSMGF(){
addFrameScript(0, frame1, 3, frame4, 36, frame37);
}
function frame1(){
stop();
}
function frame4(){
gotoAndStop("idle");
}
function frame37(){
gotoAndStop("idle");
}
}
}//package
Section 345
//AttackSound (AttackSound)
package {
import flash.media.*;
public dynamic class AttackSound extends Sound {
}
}//package
Section 346
//attackSoundAK (attackSoundAK)
package {
import flash.media.*;
public dynamic class attackSoundAK extends Sound {
}
}//package
Section 347
//attackSoundDeagle (attackSoundDeagle)
package {
import flash.media.*;
public dynamic class attackSoundDeagle extends Sound {
}
}//package
Section 348
//attackSoundM4 (attackSoundM4)
package {
import flash.media.*;
public dynamic class attackSoundM4 extends Sound {
}
}//package
Section 349
//attackSoundMP5 (attackSoundMP5)
package {
import flash.media.*;
public dynamic class attackSoundMP5 extends Sound {
}
}//package
Section 350
//attackSoundShotgun (attackSoundShotgun)
package {
import flash.media.*;
public dynamic class attackSoundShotgun extends Sound {
}
}//package
Section 351
//attackSoundSteyrTMP (attackSoundSteyrTMP)
package {
import flash.media.*;
public dynamic class attackSoundSteyrTMP extends Sound {
}
}//package
Section 352
//attackSoundSteyrUMP (attackSoundSteyrUMP)
package {
import flash.media.*;
public dynamic class attackSoundSteyrUMP extends Sound {
}
}//package
Section 353
//attackSoundUSP (attackSoundUSP)
package {
import flash.media.*;
public dynamic class attackSoundUSP extends Sound {
}
}//package
Section 354
//backGroundLevel1 (backGroundLevel1)
package {
import p_gamelevel.*;
public dynamic class backGroundLevel1 extends Ground {
}
}//package
Section 355
//backGroundLevel2 (backGroundLevel2)
package {
import p_gamelevel.*;
public dynamic class backGroundLevel2 extends Ground {
}
}//package
Section 356
//backGroundLevel3 (backGroundLevel3)
package {
import p_gamelevel.*;
public dynamic class backGroundLevel3 extends Ground {
}
}//package
Section 357
//backGroundLevel4 (backGroundLevel4)
package {
import p_gamelevel.*;
public dynamic class backGroundLevel4 extends Ground {
}
}//package
Section 358
//backGroundLevel5 (backGroundLevel5)
package {
import p_gamelevel.*;
public dynamic class backGroundLevel5 extends Ground {
}
}//package
Section 359
//barricadeA0 (barricadeA0)
package {
import p_barricade.*;
public dynamic class barricadeA0 extends TestBox {
public function barricadeA0(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 360
//barricadeA1 (barricadeA1)
package {
import p_barricade.*;
public dynamic class barricadeA1 extends TestBox {
public function barricadeA1(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 361
//barricadeB0 (barricadeB0)
package {
import p_barricade.*;
public dynamic class barricadeB0 extends TestBox {
public function barricadeB0(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 362
//barricadeB1 (barricadeB1)
package {
import p_barricade.*;
public dynamic class barricadeB1 extends TestBox {
public function barricadeB1(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 363
//barricadeShop (barricadeShop)
package {
import flash.display.*;
import flash.text.*;
public dynamic class barricadeShop extends MovieClip {
public var startButton:SimpleButton;
public var buldozerButton:MovieClip;
public var barricade0:MovieClip;
public var barricade1:MovieClip;
public var barricadeLimit:TextField;
public var chooserBox:MovieClip;
public var infoBarricade0:MovieClip;
public var infoBarricade1:MovieClip;
}
}//package
Section 364
//billboard_text (billboard_text)
package {
import flash.display.*;
import flash.text.*;
public dynamic class billboard_text extends MovieClip {
public var content:TextField;
}
}//package
Section 365
//blackBG (blackBG)
package {
import flash.display.*;
public dynamic class blackBG extends MovieClip {
}
}//package
Section 366
//blood_clip (blood_clip)
package {
import flash.display.*;
public dynamic class blood_clip extends MovieClip {
}
}//package
Section 367
//blood_floor0 (blood_floor0)
package {
import flash.display.*;
public dynamic class blood_floor0 extends MovieClip {
}
}//package
Section 368
//blood_floor1 (blood_floor1)
package {
import flash.display.*;
public dynamic class blood_floor1 extends MovieClip {
}
}//package
Section 369
//blood_floor2 (blood_floor2)
package {
import flash.display.*;
public dynamic class blood_floor2 extends MovieClip {
}
}//package
Section 370
//blood_shoot0 (blood_shoot0)
package {
import flash.display.*;
public dynamic class blood_shoot0 extends MovieClip {
}
}//package
Section 371
//blood_shoot1 (blood_shoot1)
package {
import flash.display.*;
public dynamic class blood_shoot1 extends MovieClip {
}
}//package
Section 372
//blood_shoot2 (blood_shoot2)
package {
import flash.display.*;
public dynamic class blood_shoot2 extends MovieClip {
}
}//package
Section 373
//bloodScreen (bloodScreen)
package {
import flash.display.*;
public dynamic class bloodScreen extends MovieClip {
}
}//package
Section 374
//blurBG (blurBG)
package {
import flash.display.*;
public dynamic class blurBG extends MovieClip {
}
}//package
Section 375
//buldozerCursor (buldozerCursor)
package {
import flash.display.*;
public dynamic class buldozerCursor extends MovieClip {
}
}//package
Section 376
//BuySound (BuySound)
package {
import flash.media.*;
public dynamic class BuySound extends Sound {
}
}//package
Section 377
//chainsawBullet (chainsawBullet)
package {
import flash.display.*;
public dynamic class chainsawBullet extends MovieClip {
}
}//package
Section 378
//chainSawSound (chainSawSound)
package {
import flash.media.*;
public dynamic class chainSawSound extends Sound {
}
}//package
Section 379
//ClickSound (ClickSound)
package {
import flash.media.*;
public dynamic class ClickSound extends Sound {
}
}//package
Section 380
//ClipIn (ClipIn)
package {
import flash.media.*;
public dynamic class ClipIn extends Sound {
}
}//package
Section 381
//ClipOut (ClipOut)
package {
import flash.media.*;
public dynamic class ClipOut extends Sound {
}
}//package
Section 382
//creditScreen (creditScreen)
package {
import flash.events.*;
import flash.display.*;
import flash.net.*;
public dynamic class creditScreen extends MovieClip {
public var sponsor:SimpleButton;
public var closeBtn:SimpleButton;
public function creditScreen(){
addFrameScript(0, frame1);
}
function frame1(){
sponsor.addEventListener(MouseEvent.CLICK, onSponsorLogoClicked);
}
public function onSponsorLogoClicked(_arg1:MouseEvent){
var _local2:URLRequest;
_local2 = new URLRequest("http://www.coolbuddy.com/?cid=161");
navigateToURL(_local2, "_blank");
}
}
}//package
Section 383
//crosshair (crosshair)
package {
import flash.display.*;
public dynamic class crosshair extends MovieClip {
}
}//package
Section 384
//Days2Die (Days2Die)
package {
import flash.events.*;
import flash.display.*;
import p_gameManager.*;
public dynamic class Days2Die extends MovieClip {
private var lock:Boolean;// = true
private var lockURL:Array;
public var gameManager:GameManager;
public function Days2Die(){
lockURL = ["www.localhost.com", "www.site2.com", "www.site3.com"];
lock = true;
super();
addFrameScript(0, frame1, 2, frame3);
gameManager = new LoadingScreen(this);
this.addEventListener(Event.ENTER_FRAME, update);
MochiBot.track(this, "299d79ea");
}
private function siteLock(_arg1:Array):void{
var _local2:String;
var _local3:Array;
var _local4:Array;
var _local5:uint;
_local2 = stage.loaderInfo.url;
_local3 = _local2.split("://");
_local4 = _local3[1].split("/");
_local5 = 0;
while (_local5 < _arg1.length) {
if (_arg1[_local5] == _local4[0]){
lock = false;
};
_local5++;
};
if (lock){
alpha = 0;
};
}
function frame3(){
stop();
}
function frame1(){
stop();
}
public function update(_arg1:Event):void{
gameManager = gameManager.update();
}
}
}//package
Section 385
//dieGirl (dieGirl)
package {
import flash.media.*;
public dynamic class dieGirl extends Sound {
}
}//package
Section 386
//dieGirl2 (dieGirl2)
package {
import flash.media.*;
public dynamic class dieGirl2 extends Sound {
}
}//package
Section 387
//dieSound1 (dieSound1)
package {
import flash.media.*;
public dynamic class dieSound1 extends Sound {
}
}//package
Section 388
//dieSound2 (dieSound2)
package {
import flash.media.*;
public dynamic class dieSound2 extends Sound {
}
}//package
Section 389
//dieSound3 (dieSound3)
package {
import flash.media.*;
public dynamic class dieSound3 extends Sound {
}
}//package
Section 390
//dynamiteBullet (dynamiteBullet)
package {
import flash.display.*;
public dynamic class dynamiteBullet extends MovieClip {
}
}//package
Section 391
//Egg (Egg)
package {
import flash.display.*;
public dynamic class Egg extends MovieClip {
public var ladderDetector:MovieClip;
public var torso:MovieClip;
public var clipBack:MovieClip;
public var clipBottom:MovieClip;
public var clipFront:MovieClip;
public var clipTop:MovieClip;
public var weaponHolder:MovieClip;
}
}//package
Section 392
//endingMovie (endingMovie)
package {
import flash.events.*;
import flash.display.*;
public dynamic class endingMovie extends MovieClip {
public var animationDone:Boolean;
public var skipButton:SimpleButton;
public function endingMovie(){
addFrameScript(0, frame1, 1, frame2, 822, frame823);
}
function frame823(){
animationDone = true;
stop();
}
function frame1(){
animationDone = false;
skipButton.visible = true;
stop();
}
function frame2(){
skipButton.visible = true;
skipButton.addEventListener(MouseEvent.CLICK, skipMovie);
}
public function skipMovie(_arg1:MouseEvent):void{
gotoAndStop("finish");
}
}
}//package
Section 393
//explodeSound (explodeSound)
package {
import flash.media.*;
public dynamic class explodeSound extends Sound {
}
}//package
Section 394
//explosion (explosion)
package {
import flash.display.*;
public dynamic class explosion extends MovieClip {
public var crack:MovieClip;
public function explosion(){
addFrameScript(19, frame20);
}
function frame20(){
stop();
}
}
}//package
Section 395
//extendedPlay (extendedPlay)
package {
import flash.display.*;
public dynamic class extendedPlay extends MovieClip {
public var submitButton:SimpleButton;
public var noButton:SimpleButton;
public var yesButton:SimpleButton;
}
}//package
Section 396
//femaleChar (femaleChar)
package {
import flash.display.*;
public dynamic class femaleChar extends MovieClip {
public var floorDetector:MovieClip;
public var ladderDetector:MovieClip;
public var torso:MovieClip;
public var leg:MovieClip;
public var kaki:MovieClip;
public var smokeOut:MovieClip;
public var shadow:MovieClip;
public var kepala:MovieClip;
public var weaponHolderb:MovieClip;
public var weaponHolderf:MovieClip;
public var xcross:MovieClip;
public var signBaloon:MovieClip;
public var bloodSign:MovieClip;
public var head:MovieClip;
public var clipTop:MovieClip;
public var badan:MovieClip;
public function femaleChar(){
addFrameScript(0, frame1);
}
function frame1(){
xcross.visible = false;
}
}
}//package
Section 397
//Floor (Floor)
package {
import p_gamelevel.*;
public dynamic class Floor extends Floor {
}
}//package
Section 398
//followSound (followSound)
package {
import flash.media.*;
public dynamic class followSound extends Sound {
}
}//package
Section 399
//foreGroundLevel1 (foreGroundLevel1)
package {
import p_gamelevel.*;
public dynamic class foreGroundLevel1 extends Ground {
}
}//package
Section 400
//foreGroundLevel2 (foreGroundLevel2)
package {
import p_gamelevel.*;
public dynamic class foreGroundLevel2 extends Ground {
}
}//package
Section 401
//foreGroundLevel3 (foreGroundLevel3)
package {
import p_gamelevel.*;
public dynamic class foreGroundLevel3 extends Ground {
}
}//package
Section 402
//foreGroundLevel4 (foreGroundLevel4)
package {
import p_gamelevel.*;
public dynamic class foreGroundLevel4 extends Ground {
}
}//package
Section 403
//foreGroundLevel5 (foreGroundLevel5)
package {
import p_gamelevel.*;
public dynamic class foreGroundLevel5 extends Ground {
}
}//package
Section 404
//gibs_bone0 (gibs_bone0)
package {
import flash.display.*;
public dynamic class gibs_bone0 extends MovieClip {
}
}//package
Section 405
//gibs_bone1 (gibs_bone1)
package {
import flash.display.*;
public dynamic class gibs_bone1 extends MovieClip {
}
}//package
Section 406
//gibs_bone2 (gibs_bone2)
package {
import flash.display.*;
public dynamic class gibs_bone2 extends MovieClip {
}
}//package
Section 407
//gibs_brain0 (gibs_brain0)
package {
import flash.display.*;
public dynamic class gibs_brain0 extends MovieClip {
}
}//package
Section 408
//gibs_meat0 (gibs_meat0)
package {
import flash.display.*;
public dynamic class gibs_meat0 extends MovieClip {
}
}//package
Section 409
//gibs_meat1 (gibs_meat1)
package {
import flash.display.*;
public dynamic class gibs_meat1 extends MovieClip {
}
}//package
Section 410
//gibs_meat2 (gibs_meat2)
package {
import flash.display.*;
public dynamic class gibs_meat2 extends MovieClip {
}
}//package
Section 411
//gibs_meat3 (gibs_meat3)
package {
import flash.display.*;
public dynamic class gibs_meat3 extends MovieClip {
}
}//package
Section 412
//gibs_meat4 (gibs_meat4)
package {
import flash.display.*;
public dynamic class gibs_meat4 extends MovieClip {
}
}//package
Section 413
//gibs_meat5 (gibs_meat5)
package {
import flash.display.*;
public dynamic class gibs_meat5 extends MovieClip {
}
}//package
Section 414
//gotShot1 (gotShot1)
package {
import flash.media.*;
public dynamic class gotShot1 extends Sound {
}
}//package
Section 415
//gotShot2 (gotShot2)
package {
import flash.media.*;
public dynamic class gotShot2 extends Sound {
}
}//package
Section 416
//gotShot3 (gotShot3)
package {
import flash.media.*;
public dynamic class gotShot3 extends Sound {
}
}//package
Section 417
//grenadeBullet (grenadeBullet)
package {
import flash.display.*;
public dynamic class grenadeBullet extends MovieClip {
}
}//package
Section 418
//grenadePin (grenadePin)
package {
import flash.display.*;
public dynamic class grenadePin extends MovieClip {
}
}//package
Section 419
//grenadeSafety (grenadeSafety)
package {
import flash.display.*;
public dynamic class grenadeSafety extends MovieClip {
public var body0:MovieClip;
public var body1:MovieClip;
public var body2:MovieClip;
}
}//package
Section 420
//handGunBullet (handGunBullet)
package {
import flash.display.*;
public dynamic class handGunBullet extends MovieClip {
public var body:MovieClip;
}
}//package
Section 421
//handGunHitBody (handGunHitBody)
package {
import flash.media.*;
public dynamic class handGunHitBody extends Sound {
}
}//package
Section 422
//handSign (handSign)
package {
import flash.display.*;
public dynamic class handSign extends MovieClip {
}
}//package
Section 423
//harbourWarning (harbourWarning)
package {
import flash.display.*;
public dynamic class harbourWarning extends MovieClip {
public var noButton:SimpleButton;
public var yesButton:SimpleButton;
}
}//package
Section 424
//healthSound (healthSound)
package {
import flash.media.*;
public dynamic class healthSound extends Sound {
}
}//package
Section 425
//highscoresClip (highscoresClip)
package {
import flash.events.*;
import flash.display.*;
import flash.net.*;
public dynamic class highscoresClip extends MovieClip {
public var sponsor:SimpleButton;
public var loadingClip:MovieClip;
public function highscoresClip(){
addFrameScript(0, frame1);
}
function frame1(){
sponsor.addEventListener(MouseEvent.CLICK, onSponsorLogoClicked);
}
public function onSponsorLogoClicked(_arg1:MouseEvent){
var _local2:URLRequest;
_local2 = new URLRequest("http://www.coolbuddy.com/?cid=161");
navigateToURL(_local2, "_blank");
}
}
}//package
Section 426
//hitWallSound (hitWallSound)
package {
import flash.media.*;
public dynamic class hitWallSound extends Sound {
}
}//package
Section 427
//hitWallSound2 (hitWallSound2)
package {
import flash.media.*;
public dynamic class hitWallSound2 extends Sound {
}
}//package
Section 428
//hitWallSound3 (hitWallSound3)
package {
import flash.media.*;
public dynamic class hitWallSound3 extends Sound {
}
}//package
Section 429
//hurtGirl1 (hurtGirl1)
package {
import flash.media.*;
public dynamic class hurtGirl1 extends Sound {
}
}//package
Section 430
//hurtGirl2 (hurtGirl2)
package {
import flash.media.*;
public dynamic class hurtGirl2 extends Sound {
}
}//package
Section 431
//hurtGuy1 (hurtGuy1)
package {
import flash.media.*;
public dynamic class hurtGuy1 extends Sound {
}
}//package
Section 432
//hurtGuy2 (hurtGuy2)
package {
import flash.media.*;
public dynamic class hurtGuy2 extends Sound {
}
}//package
Section 433
//hurtGuy3 (hurtGuy3)
package {
import flash.media.*;
public dynamic class hurtGuy3 extends Sound {
}
}//package
Section 434
//instructionScreen (instructionScreen)
package {
import flash.events.*;
import flash.display.*;
import flash.net.*;
public dynamic class instructionScreen extends MovieClip {
public var sponsor:SimpleButton;
public var maxPage:int;
public var prevBtn:SimpleButton;
public var closeBtn:SimpleButton;
public var nextBtn:SimpleButton;
public var currentPage:int;
public function instructionScreen(){
addFrameScript(0, frame1);
}
public function onNextClick(_arg1:MouseEvent){
if (currentPage < maxPage){
currentPage++;
};
if (currentPage == maxPage){
nextBtn.visible = false;
};
if (currentPage != 1){
prevBtn.visible = true;
};
gotoAndStop(currentPage);
}
function frame1(){
stop();
sponsor.addEventListener(MouseEvent.CLICK, onSponsorLogoClicked);
nextBtn.addEventListener(MouseEvent.CLICK, onNextClick);
prevBtn.addEventListener(MouseEvent.CLICK, onPrevClick);
prevBtn.visible = false;
maxPage = 8;
currentPage = 1;
}
public function onSponsorLogoClicked(_arg1:MouseEvent){
var _local2:URLRequest;
_local2 = new URLRequest("http://www.coolbuddy.com/?cid=161");
navigateToURL(_local2, "_blank");
}
public function onPrevClick(_arg1:MouseEvent){
if (currentPage > 1){
currentPage--;
};
if (currentPage != maxPage){
nextBtn.visible = true;
};
if (currentPage == 1){
prevBtn.visible = false;
};
gotoAndStop(currentPage);
}
}
}//package
Section 435
//introductionSound2 (introductionSound2)
package {
import flash.media.*;
public dynamic class introductionSound2 extends Sound {
}
}//package
Section 436
//introScreen (introScreen)
package {
import flash.events.*;
import flash.display.*;
public dynamic class introScreen extends MovieClip {
public var animationDone:Boolean;
public var movie:MovieClip;
public var skipButton:SimpleButton;
public function introScreen(){
addFrameScript(0, frame1, 150, frame151, 568, frame569);
}
function frame151(){
skipButton.visible = true;
skipButton.addEventListener(MouseEvent.CLICK, skipMovie);
}
function frame569(){
movie.gotoAndStop("finish");
animationDone = true;
stop();
}
function frame1(){
animationDone = false;
skipButton.visible = false;
}
public function skipMovie(_arg1:MouseEvent):void{
gotoAndStop("finish");
movie.gotoAndStop("finish");
}
}
}//package
Section 437
//introSponsorSplashScreen (introSponsorSplashScreen)
package {
import flash.events.*;
import flash.display.*;
import flash.net.*;
public dynamic class introSponsorSplashScreen extends MovieClip {
public var sponsor:MovieClip;
public var animationDone:Boolean;
public function introSponsorSplashScreen(){
addFrameScript(0, frame1, 89, frame90);
}
function frame90(){
animationDone = true;
stop();
}
function frame1(){
animationDone = false;
sponsor.addEventListener(MouseEvent.CLICK, onSponsorLogoClicked);
}
public function onSponsorLogoClicked(_arg1:MouseEvent){
var _local2:URLRequest;
_local2 = new URLRequest("http://www.coolbuddy.com/?cid=161");
navigateToURL(_local2, "_blank");
}
}
}//package
Section 438
//itemBaseballBat (itemBaseballBat)
package {
import flash.display.*;
public dynamic class itemBaseballBat extends MovieClip {
public var body:MovieClip;
}
}//package
Section 439
//itemGrenade (itemGrenade)
package {
import flash.display.*;
public dynamic class itemGrenade extends MovieClip {
public var body0:MovieClip;
public var body1:MovieClip;
public var body2:MovieClip;
}
}//package
Section 440
//itemKnife (itemKnife)
package {
import flash.display.*;
public dynamic class itemKnife extends MovieClip {
}
}//package
Section 441
//itemM4 (itemM4)
package {
import flash.display.*;
public dynamic class itemM4 extends MovieClip {
}
}//package
Section 442
//itemShotGun (itemShotGun)
package {
import flash.display.*;
public dynamic class itemShotGun extends MovieClip {
}
}//package
Section 443
//itemSteyrTMP (itemSteyrTMP)
package {
import flash.display.*;
public dynamic class itemSteyrTMP extends MovieClip {
}
}//package
Section 444
//itemStick (itemStick)
package {
import flash.display.*;
public dynamic class itemStick extends MovieClip {
}
}//package
Section 445
//itemWaltherP99 (itemWaltherP99)
package {
import flash.display.*;
public dynamic class itemWaltherP99 extends MovieClip {
}
}//package
Section 446
//knifeBullet (knifeBullet)
package {
import flash.display.*;
public dynamic class knifeBullet extends MovieClip {
}
}//package
Section 447
//knifeHit (knifeHit)
package {
import flash.media.*;
public dynamic class knifeHit extends Sound {
}
}//package
Section 448
//knifeSlash (knifeSlash)
package {
import flash.media.*;
public dynamic class knifeSlash extends Sound {
}
}//package
Section 449
//LevelUpSound (LevelUpSound)
package {
import flash.media.*;
public dynamic class LevelUpSound extends Sound {
}
}//package
Section 450
//loaderScreen (loaderScreen)
package {
import flash.events.*;
import flash.display.*;
import flash.text.*;
import flash.net.*;
public dynamic class loaderScreen extends MovieClip {
public var progressText:TextField;
public var sponsor:SimpleButton;
public var loadingClip:MovieClip;
public var adSpace:MovieClip;
public function loaderScreen(){
addFrameScript(0, frame1);
}
function frame1(){
sponsor.addEventListener(MouseEvent.CLICK, onSponsorLogoClicked);
}
public function onSponsorLogoClicked(_arg1:MouseEvent){
var _local2:URLRequest;
_local2 = new URLRequest("http://www.coolbuddy.com/?cid=161");
navigateToURL(_local2, "_blank");
}
}
}//package
Section 451
//magAK (magAK)
package {
import flash.display.*;
public dynamic class magAK extends MovieClip {
}
}//package
Section 452
//magM4 (magM4)
package {
import flash.display.*;
public dynamic class magM4 extends MovieClip {
}
}//package
Section 453
//magMP5 (magMP5)
package {
import flash.display.*;
public dynamic class magMP5 extends MovieClip {
}
}//package
Section 454
//magPistol (magPistol)
package {
import flash.display.*;
public dynamic class magPistol extends MovieClip {
}
}//package
Section 455
//magSMG (magSMG)
package {
import flash.display.*;
public dynamic class magSMG extends MovieClip {
}
}//package
Section 456
//magUMP (magUMP)
package {
import flash.display.*;
public dynamic class magUMP extends MovieClip {
}
}//package
Section 457
//mainHead (mainHead)
package {
import flash.display.*;
public dynamic class mainHead extends MovieClip {
public var eye:MovieClip;
public var hired:MovieClip;
public function mainHead(){
addFrameScript(0, frame1, 1, frame2, 2, frame3, 3, frame4, 4, frame5, 5, frame6, 6, frame7, 7, frame8, 8, frame9, 9, frame10);
}
function frame10(){
stop();
}
function frame3(){
stop();
}
function frame7(){
stop();
}
function frame1(){
stop();
hired.visible = false;
}
function frame6(){
stop();
}
function frame4(){
stop();
}
function frame5(){
stop();
}
function frame9(){
stop();
}
function frame8(){
stop();
}
function frame2(){
stop();
}
}
}//package
Section 458
//mainMenu (mainMenu)
package {
import flash.events.*;
import flash.display.*;
import flash.net.*;
public dynamic class mainMenu extends MovieClip {
public var optionButton:SimpleButton;
public var sponsor:SimpleButton;
public var soundButton:MovieClip;
public var highscoresButton:SimpleButton;
public var playButton:SimpleButton;
public var instructionButton:SimpleButton;
public var creditButton:SimpleButton;
public var adSpace:MovieClip;
public var moreGamesButton:SimpleButton;
public function mainMenu(){
addFrameScript(0, frame1);
}
function frame1(){
sponsor.addEventListener(MouseEvent.CLICK, onSponsorLogoClicked);
moreGamesButton.addEventListener(MouseEvent.CLICK, onSponsorLogoClicked);
}
public function onSponsorLogoClicked(_arg1:MouseEvent){
var _local2:URLRequest;
_local2 = new URLRequest("http://www.coolbuddy.com/?cid=161");
navigateToURL(_local2, "_blank");
}
}
}//package
Section 459
//MapScreen (MapScreen)
package {
import flash.events.*;
import flash.display.*;
import flash.net.*;
public dynamic class MapScreen extends MovieClip {
public var sponsor:SimpleButton;
public var places:MovieClip;
public function MapScreen(){
addFrameScript(0, frame1);
}
function frame1(){
sponsor.addEventListener(MouseEvent.CLICK, onSponsorLogoClicked);
}
public function onSponsorLogoClicked(_arg1:MouseEvent){
var _local2:URLRequest;
_local2 = new URLRequest("http://www.coolbuddy.com/?cid=161");
navigateToURL(_local2, "_blank");
}
}
}//package
Section 460
//medikit (medikit)
package {
import flash.display.*;
public dynamic class medikit extends MovieClip {
}
}//package
Section 461
//menuBarClip (menuBarClip)
package {
import flash.events.*;
import flash.display.*;
import flash.text.*;
import flash.net.*;
public dynamic class menuBarClip extends MovieClip {
public var reloadAmmo:TextField;
public var sponsor:SimpleButton;
public var minute:TextField;
public var upperBar:MovieClip;
public var animationPlaying:Boolean;
public var infoBox:MovieClip;
public var optionScreen:optionScreen2;
public var health:TextField;
public var second:TextField;
public var moreGames:SimpleButton;
public var expSign:MovieClip;
public var ended:Boolean;
public var weaponName:TextField;
public var money:TextField;
public var kills:TextField;
public var weaponPic:MovieClip;
public var ammo:TextField;
public var resultScreen:MovieClip;
public function menuBarClip(){
addFrameScript(0, frame1, 1, frame2, 11, frame12, 12, frame13, 18, frame19);
}
function frame12(){
ended = true;
stop();
}
function frame1(){
stop();
animationPlaying = false;
ended = true;
upperBar.visible = true;
optionScreen.visible = false;
sponsor.addEventListener(MouseEvent.CLICK, onSponsorLogoClicked);
moreGames.addEventListener(MouseEvent.CLICK, onSponsorLogoClicked);
}
function frame19(){
ended = true;
gotoAndStop("idle");
}
function frame13(){
animationPlaying = true;
ended = false;
}
function frame2(){
animationPlaying = true;
ended = false;
}
public function onSponsorLogoClicked(_arg1:MouseEvent){
var _local2:URLRequest;
_local2 = new URLRequest("http://www.coolbuddy.com/?cid=161");
navigateToURL(_local2, "_blank");
}
}
}//package
Section 462
//middleBillboard (middleBillboard)
package {
import flash.display.*;
import flash.text.*;
public dynamic class middleBillboard extends MovieClip {
public var content:TextField;
}
}//package
Section 463
//middleGroundLevel1 (middleGroundLevel1)
package {
import flash.display.*;
public dynamic class middleGroundLevel1 extends MovieClip {
public var roof0:Floor;
public var playerLimit1:PlayerLimit;
public var playerLimit0:PlayerLimit;
public var enemySpawnPoint1:Egg;
public var enemySpawnPoint0:Egg;
public var lantaiSign0:MovieClip;
public var lantaiSign1:MovieClip;
public var wall1:Wall;
public var wall2:Wall;
public var wall3:Wall;
public var floor1:Floor;
public var wall0:Wall;
public var floor0:Floor;
public var stageSign0:MovieClip;
public var stageSign1:MovieClip;
public var spawnPoint:Egg;
public var doorLockedA0b:Egg;
public var roof1:Floor;
}
}//package
Section 464
//middleGroundLevel2 (middleGroundLevel2)
package {
import flash.display.*;
public dynamic class middleGroundLevel2 extends MovieClip {
public var playerLimit1:PlayerLimit;
public var playerLimit0:PlayerLimit;
public var enemySpawnPoint1:Egg;
public var ladder0:MovieClip;
public var enemySpawnPoint0:Egg;
public var enemySpawnPoint2:Egg;
public var lantaiSign0:MovieClip;
public var lantaiSign1:MovieClip;
public var wall1:Wall;
public var wall2:Wall;
public var wall3:Wall;
public var floor1:Wall;
public var wall0:Wall;
public var floor0:Wall;
public var stageSign0:MovieClip;
public var floor2:Wall;
public var spawnPoint:Egg;
}
}//package
Section 465
//middleGroundLevel3 (middleGroundLevel3)
package {
import flash.display.*;
public dynamic class middleGroundLevel3 extends MovieClip {
public var roof0:Wall;
public var playerLimit1:PlayerLimit;
public var playerLimit0:PlayerLimit;
public var floor2:Floor;
public var ladder2:MovieClip;
public var ladder3:MovieClip;
public var enemySpawnPoint0:Egg;
public var enemySpawnPoint2:Egg;
public var lantaiSign0:MovieClip;
public var lantaiSign1:MovieClip;
public var enemySpawnPoint1:Egg;
public var ladder0:MovieClip;
public var ladder1:MovieClip;
public var ladder4:MovieClip;
public var enemySpawnPoint4:Egg;
public var lantaiSign2:MovieClip;
public var enemySpawnPoint5:Egg;
public var lantaiSign3:MovieClip;
public var floor4:Floor;
public var wall2:Wall;
public var wall3:Wall;
public var wall4:Wall;
public var stageSign0:MovieClip;
public var floor6:Floor;
public var floor7:Floor;
public var floor5:Floor;
public var wall1:Wall;
public var floor0:Floor;
public var wall0:Wall;
public var floor3:Floor;
public var spawnPoint:Egg;
public var enemySpawnPoint3:Egg;
public var floor1:Floor;
}
}//package
Section 466
//middleGroundLevel4 (middleGroundLevel4)
package {
import flash.display.*;
public dynamic class middleGroundLevel4 extends MovieClip {
public var floor2:Floor;
public var playerLimit1:PlayerLimit;
public var playerLimit0:PlayerLimit;
public var ladder2:MovieClip;
public var enemySpawnPoint1:Egg;
public var enemySpawnPoint0:Egg;
public var enemySpawnPoint2:Egg;
public var lantaiSign0:MovieClip;
public var lantaiSign1:MovieClip;
public var ladder0:MovieClip;
public var ladder1:MovieClip;
public var enemySpawnPoint4:Egg;
public var lantaiSign2:MovieClip;
public var wall2:Wall;
public var wall3:Wall;
public var floor4:Floor;
public var floor5:Floor;
public var wall4:Wall;
public var floor0:Floor;
public var stageSign0:MovieClip;
public var wall5:Wall;
public var wall1:Wall;
public var floor1:Floor;
public var wall0:Wall;
public var floor3:Floor;
public var spawnPoint:Egg;
public var enemySpawnPoint3:Egg;
}
}//package
Section 467
//middleGroundLevel5 (middleGroundLevel5)
package {
import flash.display.*;
public dynamic class middleGroundLevel5 extends MovieClip {
public var floor2:Floor;
public var playerLimit1:PlayerLimit;
public var playerLimit0:PlayerLimit;
public var playerLimit2:PlayerLimit;
public var playerLimit3:PlayerLimit;
public var ladder2:MovieClip;
public var enemySpawnPoint1:Egg;
public var enemySpawnPoint0:Egg;
public var enemySpawnPoint2:Egg;
public var lantaiSign0:MovieClip;
public var lantaiSign1:MovieClip;
public var ladder0:MovieClip;
public var ladder1:MovieClip;
public var enemySpawnPoint4:Egg;
public var lantaiSign2:MovieClip;
public var wall1:Floor;
public var wall2:Floor;
public var wall3:Floor;
public var floor5:Floor;
public var wall4:Floor;
public var floor0:Floor;
public var stageSign0:MovieClip;
public var floor4:Floor;
public var wall5:Floor;
public var floor3:Floor;
public var floor1:Floor;
public var wall0:Floor;
public var spawnPoint:Egg;
public var enemySpawnPoint3:Egg;
}
}//package
Section 468
//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 469
//movieLevel1 (movieLevel1)
package {
import flash.events.*;
import flash.display.*;
public dynamic class movieLevel1 extends MovieClip {
public var skipButton:SimpleButton;
public var endOfAnimation:Boolean;
public function movieLevel1(){
addFrameScript(0, frame1, 929, frame930);
}
function frame1(){
endOfAnimation = false;
skipButton.addEventListener(MouseEvent.CLICK, skipMovie);
}
function frame930(){
endOfAnimation = true;
stop();
}
public function skipMovie(_arg1:MouseEvent):void{
gotoAndStop("finish");
}
}
}//package
Section 470
//optionScreen (optionScreen)
package {
import flash.events.*;
import flash.display.*;
import flash.net.*;
public dynamic class optionScreen extends MovieClip {
public var mediumButton:SimpleButton;
public var sponsor:SimpleButton;
public var soundButton:MovieClip;
public var closeBtn:SimpleButton;
public var highButton:SimpleButton;
public var lowButton:SimpleButton;
public function optionScreen(){
addFrameScript(0, frame1);
}
function frame1(){
sponsor.addEventListener(MouseEvent.CLICK, onSponsorLogoClicked);
}
public function onSponsorLogoClicked(_arg1:MouseEvent){
var _local2:URLRequest;
_local2 = new URLRequest("http://www.coolbuddy.com/?cid=161");
navigateToURL(_local2, "_blank");
}
}
}//package
Section 471
//optionScreen2 (optionScreen2)
package {
import flash.events.*;
import flash.display.*;
import flash.net.*;
public dynamic class optionScreen2 extends MovieClip {
public var mediumButton:SimpleButton;
public var sponsor:SimpleButton;
public var soundButton:MovieClip;
public var closeBtn:SimpleButton;
public var backToMainMenuButton:SimpleButton;
public var highButton:SimpleButton;
public var lowButton:SimpleButton;
public function optionScreen2(){
addFrameScript(0, frame1);
}
function frame1(){
sponsor.addEventListener(MouseEvent.CLICK, onSponsorLogoClicked);
}
public function onSponsorLogoClicked(_arg1:MouseEvent){
var _local2:URLRequest;
_local2 = new URLRequest("http://www.coolbuddy.com/?cid=161");
navigateToURL(_local2, "_blank");
}
}
}//package
Section 472
//PlayerLimit (PlayerLimit)
package {
import p_gamelevel.*;
public dynamic class PlayerLimit extends PlayerLimit {
}
}//package
Section 473
//preSubmitHighscores (preSubmitHighscores)
package {
import flash.display.*;
import flash.text.*;
public dynamic class preSubmitHighscores extends MovieClip {
public var nameText:TextField;
public var submitButton:SimpleButton;
public var pleaseWait:MovieClip;
public var scoreText:TextField;
}
}//package
Section 474
//pumpShotgun (pumpShotgun)
package {
import flash.media.*;
public dynamic class pumpShotgun extends Sound {
}
}//package
Section 475
//reloadShotgun (reloadShotgun)
package {
import flash.media.*;
public dynamic class reloadShotgun extends Sound {
}
}//package
Section 476
//SellSound (SellSound)
package {
import flash.media.*;
public dynamic class SellSound extends Sound {
}
}//package
Section 477
//shell01 (shell01)
package {
import flash.display.*;
public dynamic class shell01 extends MovieClip {
}
}//package
Section 478
//shell02 (shell02)
package {
import flash.display.*;
public dynamic class shell02 extends MovieClip {
}
}//package
Section 479
//shopScreen (shopScreen)
package {
import flash.events.*;
import flash.display.*;
import flash.text.*;
import flash.net.*;
public dynamic class shopScreen extends MovieClip {
public var ammo556:MovieClip;
public var ammo9mm:MovieClip;
public var ammo556BuyButton:SimpleButton;
public var fireArm:MovieClip;
public var ammo45BuyButton:SimpleButton;
public var ammo357Text:TextField;
public var ammo45SellButton:SimpleButton;
public var ammo357:MovieClip;
public var ammo762Text:TextField;
public var chooserBox:MovieClip;
public var ammo357BuyButton:SimpleButton;
public var ammo762SellButton:SimpleButton;
public var money:TextField;
public var ammo12gauge:MovieClip;
public var explanationBox:MovieClip;
public var fireButton:SimpleButton;
public var ammo357SellButton:SimpleButton;
public var warningClip:MovieClip;
public var mercExplanationBox:MovieClip;
public var sponsor:SimpleButton;
public var sellButton:SimpleButton;
public var ammo762BuyButton:SimpleButton;
public var ammo12gaugeText:TextField;
public var ammo556SellButton:SimpleButton;
public var hireButton:SimpleButton;
public var doneButton:SimpleButton;
public var ammo556Text:TextField;
public var buyButton:SimpleButton;
public var melee:MovieClip;
public var ammo12gaugeBuyButton:SimpleButton;
public var ammo9mmSellButton:SimpleButton;
public var ammo9mmBuyButton:SimpleButton;
public var ammo762:MovieClip;
public var weaponOption:MovieClip;
public var ammo45Text:TextField;
public var ammo12gaugeSellButton:SimpleButton;
public var merc:MovieClip;
public var ammo45:MovieClip;
public var ammo9mmText:TextField;
public var explosive:MovieClip;
public function shopScreen(){
addFrameScript(0, frame1);
}
function frame1(){
ammo12gauge.gotoAndStop("ammo12gauge");
ammo357.gotoAndStop("ammo357");
ammo45.gotoAndStop("ammo45");
ammo9mm.gotoAndStop("ammo9mm");
ammo762.gotoAndStop("ammo762");
ammo556.gotoAndStop("ammo556");
sponsor.addEventListener(MouseEvent.CLICK, onSponsorLogoClicked);
}
public function onSponsorLogoClicked(_arg1:MouseEvent){
var _local2:URLRequest;
_local2 = new URLRequest("http://www.coolbuddy.com/?cid=161");
navigateToURL(_local2, "_blank");
}
}
}//package
Section 480
//smokeAnimate (smokeAnimate)
package {
import flash.display.*;
public dynamic class smokeAnimate extends MovieClip {
}
}//package
Section 481
//Sound1 (Sound1)
package {
import flash.media.*;
public dynamic class Sound1 extends Sound {
}
}//package
Section 482
//Sound2 (Sound2)
package {
import flash.media.*;
public dynamic class Sound2 extends Sound {
}
}//package
Section 483
//Sound3 (Sound3)
package {
import flash.media.*;
public dynamic class Sound3 extends Sound {
}
}//package
Section 484
//Sound4 (Sound4)
package {
import flash.media.*;
public dynamic class Sound4 extends Sound {
}
}//package
Section 485
//Sound5 (Sound5)
package {
import flash.media.*;
public dynamic class Sound5 extends Sound {
}
}//package
Section 486
//Star (Star)
package {
import flash.display.*;
public dynamic class Star extends MovieClip {
}
}//package
Section 487
//Star2 (Star2)
package {
import flash.display.*;
public dynamic class Star2 extends MovieClip {
}
}//package
Section 488
//talkSymbol (talkSymbol)
package {
import flash.display.*;
public dynamic class talkSymbol extends MovieClip {
public var stay:MovieClip;
public var follow:MovieClip;
}
}//package
Section 489
//TestBox0 (TestBox0)
package {
import p_barricade.*;
public dynamic class TestBox0 extends TestBox {
}
}//package
Section 490
//TestBox1 (TestBox1)
package {
import p_barricade.*;
public dynamic class TestBox1 extends TestBox {
}
}//package
Section 491
//TestRect0 (TestRect0)
package {
import p_barricade.*;
public dynamic class TestRect0 extends TestBox {
}
}//package
Section 492
//TestRect1 (TestRect1)
package {
import p_barricade.*;
public dynamic class TestRect1 extends TestBox {
}
}//package
Section 493
//TestTriangleA0 (TestTriangleA0)
package {
import p_barricade.*;
public dynamic class TestTriangleA0 extends TestTriangle {
}
}//package
Section 494
//TestTriangleA1 (TestTriangleA1)
package {
import p_barricade.*;
public dynamic class TestTriangleA1 extends TestTriangle {
}
}//package
Section 495
//TestTriangleB0 (TestTriangleB0)
package {
import p_barricade.*;
public dynamic class TestTriangleB0 extends TestTriangle2 {
}
}//package
Section 496
//TestTriangleB1 (TestTriangleB1)
package {
import p_barricade.*;
public dynamic class TestTriangleB1 extends TestTriangle2 {
}
}//package
Section 497
//waitSound (waitSound)
package {
import flash.media.*;
public dynamic class waitSound extends Sound {
}
}//package
Section 498
//Wall (Wall)
package {
import p_gamelevel.*;
public dynamic class Wall extends Floor {
}
}//package
Section 499
//weaponAKLogo (weaponAKLogo)
package {
import flash.display.*;
public dynamic class weaponAKLogo extends MovieClip {
public function weaponAKLogo(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 500
//weaponBaseballBatLogo (weaponBaseballBatLogo)
package {
import flash.display.*;
public dynamic class weaponBaseballBatLogo extends MovieClip {
public function weaponBaseballBatLogo(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 501
//weaponBerettaLogo (weaponBerettaLogo)
package {
import flash.display.*;
public dynamic class weaponBerettaLogo extends MovieClip {
public function weaponBerettaLogo(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 502
//weaponChainSawLogo (weaponChainSawLogo)
package {
import flash.display.*;
public dynamic class weaponChainSawLogo extends MovieClip {
public function weaponChainSawLogo(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 503
//weaponDeagleLogo (weaponDeagleLogo)
package {
import flash.display.*;
public dynamic class weaponDeagleLogo extends MovieClip {
public function weaponDeagleLogo(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 504
//weaponDynamiteLogo (weaponDynamiteLogo)
package {
import flash.display.*;
public dynamic class weaponDynamiteLogo extends MovieClip {
public function weaponDynamiteLogo(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 505
//weaponGrenadeLogo (weaponGrenadeLogo)
package {
import flash.display.*;
public dynamic class weaponGrenadeLogo extends MovieClip {
public var body0:MovieClip;
public var body1:MovieClip;
public var body2:MovieClip;
public function weaponGrenadeLogo(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 506
//weaponInventory (weaponInventory)
package {
import flash.events.*;
import flash.display.*;
import flash.net.*;
public dynamic class weaponInventory extends MovieClip {
public var sponsor:SimpleButton;
public var equipBox:MovieClip;
public var fireArm:MovieClip;
public var melee:MovieClip;
public var chooserBox:MovieClip;
public var weaponOption:MovieClip;
public var explosive:MovieClip;
public var explanationBox:MovieClip;
public var close:SimpleButton;
public function weaponInventory(){
addFrameScript(0, frame1);
}
function frame1(){
sponsor.addEventListener(MouseEvent.CLICK, onSponsorLogoClicked);
}
public function onSponsorLogoClicked(_arg1:MouseEvent){
var _local2:URLRequest;
_local2 = new URLRequest("http://www.coolbuddy.com/?cid=161");
navigateToURL(_local2, "_blank");
}
}
}//package
Section 507
//weaponKatanaLogo (weaponKatanaLogo)
package {
import flash.display.*;
public dynamic class weaponKatanaLogo extends MovieClip {
public function weaponKatanaLogo(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 508
//weaponKnifeLogo (weaponKnifeLogo)
package {
import flash.display.*;
public dynamic class weaponKnifeLogo extends MovieClip {
public function weaponKnifeLogo(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 509
//weaponM14Logo (weaponM14Logo)
package {
import flash.display.*;
public dynamic class weaponM14Logo extends MovieClip {
public function weaponM14Logo(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 510
//weaponM1911Logo (weaponM1911Logo)
package {
import flash.display.*;
public dynamic class weaponM1911Logo extends MovieClip {
public function weaponM1911Logo(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 511
//weaponM4Logo (weaponM4Logo)
package {
import flash.display.*;
public dynamic class weaponM4Logo extends MovieClip {
public function weaponM4Logo(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 512
//weaponMPULogo (weaponMPULogo)
package {
import flash.display.*;
public dynamic class weaponMPULogo extends MovieClip {
public function weaponMPULogo(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 513
//weaponShotGunLogo (weaponShotGunLogo)
package {
import flash.display.*;
public dynamic class weaponShotGunLogo extends MovieClip {
public function weaponShotGunLogo(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 514
//weaponSM5Logo (weaponSM5Logo)
package {
import flash.display.*;
public dynamic class weaponSM5Logo extends MovieClip {
public function weaponSM5Logo(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 515
//weaponSteyrTMPLogo (weaponSteyrTMPLogo)
package {
import flash.display.*;
public dynamic class weaponSteyrTMPLogo extends MovieClip {
public function weaponSteyrTMPLogo(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 516
//weaponStickLogo (weaponStickLogo)
package {
import flash.display.*;
public dynamic class weaponStickLogo extends MovieClip {
}
}//package
Section 517
//weaponWaltherP99Logo (weaponWaltherP99Logo)
package {
import flash.display.*;
public dynamic class weaponWaltherP99Logo extends MovieClip {
public function weaponWaltherP99Logo(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 518
//zombieArmB01 (zombieArmB01)
package {
import flash.display.*;
public dynamic class zombieArmB01 extends MovieClip {
public var animationDone:Boolean;
public var attackingDone:Boolean;
public function zombieArmB01(){
addFrameScript(0, frame1, 23, frame24, 24, frame25, 56, frame57, 57, frame58, 76, frame77, 77, frame78, 85, frame86, 86, frame87, 107, frame108);
}
function frame77(){
animationDone = true;
}
function frame78(){
animationDone = false;
attackingDone = false;
}
function frame86(){
animationDone = true;
attackingDone = true;
stop();
}
function frame87(){
animationDone = false;
}
function frame1(){
animationDone = false;
attackingDone = false;
}
function frame25(){
animationDone = false;
}
function frame24(){
animationDone = true;
gotoAndPlay("idle");
}
function frame108(){
animationDone = true;
stop();
}
function frame57(){
animationDone = true;
}
function frame58(){
animationDone = false;
}
}
}//package
Section 519
//zombieArmB02 (zombieArmB02)
package {
import flash.display.*;
public dynamic class zombieArmB02 extends MovieClip {
public var animationDone:Boolean;
public var attackingDone:Boolean;
public function zombieArmB02(){
addFrameScript(0, frame1, 23, frame24, 24, frame25, 56, frame57, 57, frame58, 76, frame77, 77, frame78, 85, frame86, 86, frame87, 107, frame108);
}
function frame77(){
animationDone = true;
}
function frame78(){
animationDone = false;
attackingDone = false;
}
function frame86(){
animationDone = true;
attackingDone = true;
stop();
}
function frame87(){
animationDone = false;
}
function frame1(){
animationDone = false;
attackingDone = false;
}
function frame25(){
animationDone = false;
}
function frame24(){
animationDone = true;
gotoAndPlay("idle");
}
function frame108(){
animationDone = true;
stop();
}
function frame57(){
animationDone = true;
}
function frame58(){
animationDone = false;
}
}
}//package
Section 520
//zombieArmB03 (zombieArmB03)
package {
import flash.display.*;
public dynamic class zombieArmB03 extends MovieClip {
public var animationDone:Boolean;
public var attackingDone:Boolean;
public function zombieArmB03(){
addFrameScript(0, frame1, 23, frame24, 24, frame25, 56, frame57, 57, frame58, 76, frame77, 77, frame78, 85, frame86, 86, frame87, 107, frame108);
}
function frame77(){
animationDone = true;
}
function frame78(){
animationDone = false;
attackingDone = false;
}
function frame86(){
animationDone = true;
attackingDone = true;
stop();
}
function frame87(){
animationDone = false;
}
function frame1(){
animationDone = false;
attackingDone = false;
}
function frame25(){
animationDone = false;
}
function frame24(){
animationDone = true;
gotoAndPlay("idle");
}
function frame108(){
animationDone = true;
stop();
}
function frame57(){
animationDone = true;
}
function frame58(){
animationDone = false;
}
}
}//package
Section 521
//zombieArmB04 (zombieArmB04)
package {
import flash.display.*;
public dynamic class zombieArmB04 extends MovieClip {
public var animationDone:Boolean;
public var attackingDone:Boolean;
public function zombieArmB04(){
addFrameScript(0, frame1, 23, frame24, 24, frame25, 56, frame57, 57, frame58, 76, frame77, 77, frame78, 85, frame86, 86, frame87, 107, frame108);
}
function frame77(){
animationDone = true;
}
function frame78(){
animationDone = false;
attackingDone = false;
}
function frame86(){
animationDone = true;
attackingDone = true;
stop();
}
function frame87(){
animationDone = false;
}
function frame1(){
animationDone = false;
attackingDone = false;
}
function frame25(){
animationDone = false;
}
function frame24(){
animationDone = true;
gotoAndPlay("idle");
}
function frame108(){
animationDone = true;
stop();
}
function frame57(){
animationDone = true;
}
function frame58(){
animationDone = false;
}
}
}//package
Section 522
//zombieArmF01 (zombieArmF01)
package {
import flash.display.*;
public dynamic class zombieArmF01 extends MovieClip {
public var bulletOut:MovieClip;
public var animationDone:Boolean;
public var attackingDone:Boolean;
public function zombieArmF01(){
addFrameScript(0, frame1, 23, frame24, 24, frame25, 56, frame57, 57, frame58, 76, frame77, 77, frame78, 85, frame86, 86, frame87, 107, frame108);
}
function frame77(){
animationDone = true;
}
function frame78(){
animationDone = false;
attackingDone = false;
}
function frame86(){
animationDone = true;
attackingDone = true;
stop();
}
function frame87(){
animationDone = false;
}
function frame1(){
animationDone = false;
attackingDone = false;
}
function frame25(){
animationDone = false;
}
function frame24(){
animationDone = true;
gotoAndPlay("idle");
}
function frame108(){
animationDone = true;
stop();
}
function frame57(){
animationDone = true;
}
function frame58(){
animationDone = false;
}
}
}//package
Section 523
//zombieArmF02 (zombieArmF02)
package {
import flash.display.*;
public dynamic class zombieArmF02 extends MovieClip {
public var bulletOut:MovieClip;
public var animationDone:Boolean;
public var attackingDone:Boolean;
public function zombieArmF02(){
addFrameScript(0, frame1, 23, frame24, 24, frame25, 56, frame57, 57, frame58, 76, frame77, 77, frame78, 85, frame86, 86, frame87, 107, frame108);
}
function frame77(){
animationDone = true;
}
function frame78(){
animationDone = false;
attackingDone = false;
}
function frame86(){
animationDone = true;
attackingDone = true;
stop();
}
function frame87(){
animationDone = false;
}
function frame1(){
animationDone = false;
attackingDone = false;
}
function frame25(){
animationDone = false;
}
function frame24(){
animationDone = true;
gotoAndPlay("idle");
}
function frame108(){
animationDone = true;
stop();
}
function frame57(){
animationDone = true;
}
function frame58(){
animationDone = false;
}
}
}//package
Section 524
//zombieArmF03 (zombieArmF03)
package {
import flash.display.*;
public dynamic class zombieArmF03 extends MovieClip {
public var bulletOut:MovieClip;
public var animationDone:Boolean;
public var attackingDone:Boolean;
public function zombieArmF03(){
addFrameScript(0, frame1, 23, frame24, 24, frame25, 56, frame57, 57, frame58, 76, frame77, 77, frame78, 85, frame86, 86, frame87, 107, frame108);
}
function frame77(){
animationDone = true;
}
function frame78(){
animationDone = false;
attackingDone = false;
}
function frame86(){
animationDone = true;
attackingDone = true;
stop();
}
function frame87(){
animationDone = false;
}
function frame1(){
animationDone = false;
attackingDone = false;
}
function frame25(){
animationDone = false;
}
function frame24(){
animationDone = true;
gotoAndPlay("idle");
}
function frame108(){
animationDone = true;
stop();
}
function frame57(){
animationDone = true;
}
function frame58(){
animationDone = false;
}
}
}//package
Section 525
//zombieArmF04 (zombieArmF04)
package {
import flash.display.*;
public dynamic class zombieArmF04 extends MovieClip {
public var bulletOut:MovieClip;
public var animationDone:Boolean;
public var attackingDone:Boolean;
public function zombieArmF04(){
addFrameScript(0, frame1, 23, frame24, 24, frame25, 56, frame57, 57, frame58, 76, frame77, 77, frame78, 85, frame86, 86, frame87, 107, frame108);
}
function frame77(){
animationDone = true;
}
function frame78(){
animationDone = false;
attackingDone = false;
}
function frame86(){
animationDone = true;
attackingDone = true;
stop();
}
function frame87(){
animationDone = false;
}
function frame1(){
animationDone = false;
attackingDone = false;
}
function frame25(){
animationDone = false;
}
function frame24(){
animationDone = true;
gotoAndPlay("idle");
}
function frame108(){
animationDone = true;
stop();
}
function frame57(){
animationDone = true;
}
function frame58(){
animationDone = false;
}
}
}//package
Section 526
//zombieBody01 (zombieBody01)
package {
import flash.display.*;
public dynamic class zombieBody01 extends MovieClip {
public function zombieBody01(){
addFrameScript(0, frame1, 7, frame8, 13, frame14, 20, frame21);
}
function frame14(){
stop();
}
function frame1(){
stop();
}
function frame21(){
stop();
}
function frame8(){
stop();
}
}
}//package
Section 527
//zombieBullet1 (zombieBullet1)
package {
import flash.display.*;
public dynamic class zombieBullet1 extends MovieClip {
}
}//package
Section 528
//zombieCrawl01 (zombieCrawl01)
package {
import flash.display.*;
public dynamic class zombieCrawl01 extends MovieClip {
public var floorDetector:MovieClip;
public var ladderDetector:MovieClip;
public var torso:MovieClip;
public var leg:MovieClip;
public var kaki:MovieClip;
public var smokeOut:MovieClip;
public var shadow:MovieClip;
public var kepala:MovieClip;
public var weaponHolderb:MovieClip;
public var weaponHolderf:MovieClip;
public var bloodSign:MovieClip;
public var head:MovieClip;
public var clipTop:MovieClip;
public var badan:MovieClip;
}
}//package
Section 529
//zombieHand (zombieHand)
package {
import flash.display.*;
public dynamic class zombieHand extends MovieClip {
}
}//package
Section 530
//zombieNormal01Image (zombieNormal01Image)
package {
import flash.display.*;
public dynamic class zombieNormal01Image extends MovieClip {
public var floorDetector:MovieClip;
public var ladderDetector:MovieClip;
public var torso:MovieClip;
public var leg:MovieClip;
public var kaki:MovieClip;
public var smokeOut:MovieClip;
public var shadow:MovieClip;
public var kepala:MovieClip;
public var weaponHolderb:MovieClip;
public var weaponHolderf:MovieClip;
public var bloodSign:MovieClip;
public var head:MovieClip;
public var clipTop:MovieClip;
public var badan:MovieClip;
}
}//package
Section 531
//zombieNormal02Image (zombieNormal02Image)
package {
import flash.display.*;
public dynamic class zombieNormal02Image extends MovieClip {
public var floorDetector:MovieClip;
public var ladderDetector:MovieClip;
public var torso:MovieClip;
public var leg:MovieClip;
public var kaki:MovieClip;
public var smokeOut:MovieClip;
public var shadow:MovieClip;
public var kepala:MovieClip;
public var weaponHolderb:MovieClip;
public var weaponHolderf:MovieClip;
public var bloodSign:MovieClip;
public var head:MovieClip;
public var clipTop:MovieClip;
public var badan:MovieClip;
}
}//package
Section 532
//zombieSound1 (zombieSound1)
package {
import flash.media.*;
public dynamic class zombieSound1 extends Sound {
}
}//package
Section 533
//zombieSound2 (zombieSound2)
package {
import flash.media.*;
public dynamic class zombieSound2 extends Sound {
}
}//package
Section 534
//zombieSound3 (zombieSound3)
package {
import flash.media.*;
public dynamic class zombieSound3 extends Sound {
}
}//package
Section 535
//zombieSound4 (zombieSound4)
package {
import flash.media.*;
public dynamic class zombieSound4 extends Sound {
}
}//package
Section 536
//zombieSound5 (zombieSound5)
package {
import flash.media.*;
public dynamic class zombieSound5 extends Sound {
}
}//package
Section 537
//zombieSound6 (zombieSound6)
package {
import flash.media.*;
public dynamic class zombieSound6 extends Sound {
}
}//package
Section 538
//zombieSound7 (zombieSound7)
package {
import flash.media.*;
public dynamic class zombieSound7 extends Sound {
}
}//package
Section 539
//zombieSound8 (zombieSound8)
package {
import flash.media.*;
public dynamic class zombieSound8 extends Sound {
}
}//package
Section 540
//zombieSound9 (zombieSound9)
package {
import flash.media.*;
public dynamic class zombieSound9 extends Sound {
}
}//package