Section 1
//AbstractCollection (ape.AbstractCollection)
package ape {
import flash.display.*;
import flash.utils.*;
public class AbstractCollection {
private var _sprite:Sprite;
private var _isParented:Boolean;
private var _particles:Array;
private var _constraints:Array;
public function AbstractCollection(){
if (getQualifiedClassName(this) == "ape::AbstractCollection"){
throw (new ArgumentError("AbstractCollection can't be instantiated directly"));
};
_isParented = false;
_particles = new Array();
_constraints = new Array();
}
function checkCollisionsVsCollection(_arg1:AbstractCollection):void{
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:AbstractParticle;
var _local6:int;
var _local7:int;
var _local8:int;
var _local9:AbstractParticle;
var _local10:*;
var _local11:*;
var _local12:int;
_local2 = _particles.length;
_local3 = 0;
while (_local3 < _local2) {
_local5 = _particles[_local3];
if (!_local5.collidable){
} else {
_local6 = _arg1.particles.length;
_local7 = 0;
while (_local7 < _local6) {
_local9 = _arg1.particles[_local7];
if (_local9.collidable){
CollisionDetector.test(_local5, _local9);
};
_local7++;
};
_local8 = _arg1.constraints.length;
_local7 = 0;
while (_local7 < _local8) {
_local10 = _arg1.constraints[_local7];
if ((((((_local10 is SpringConstraint)) && (_local10.collidable))) && (!(_local10.isConnectedTo(_local5))))){
_local10.scp.updatePosition();
CollisionDetector.test(_local5, _local10.scp);
};
_local7++;
};
};
_local3++;
};
_local4 = _constraints.length;
_local3 = 0;
while (_local3 < _local4) {
_local11 = _constraints[_local3];
if ((_local11 is SpringConstraint)){
if (!_local11.collidable){
} else {
_local6 = _arg1.particles.length;
_local12 = 0;
while (_local12 < _local6) {
_local9 = _arg1.particles[_local12];
if (((_local9.collidable) && (!(_local11.isConnectedTo(_local9))))){
_local11.scp.updatePosition();
CollisionDetector.test(_local9, _local11.scp);
};
_local12++;
};
};
};
_local3++;
};
}
public function get sprite():Sprite{
if (_sprite != null){
return (_sprite);
};
if (APEngine.container == null){
throw (new Error("The container property of the APEngine class has not been set"));
};
_sprite = new Sprite();
APEngine.container.addChild(_sprite);
return (_sprite);
}
function checkInternalCollisions():void{
var _local1:int;
var _local2:int;
var _local3:AbstractParticle;
var _local4:int;
var _local5:*;
var _local6:AbstractParticle;
_local1 = _particles.length;
_local2 = 0;
while (_local2 < _local1) {
_local3 = _particles[_local2];
if (!_local3.collidable){
} else {
_local4 = (_local2 + 1);
while (_local4 < _local1) {
_local6 = _particles[_local4];
if (_local6.collidable){
CollisionDetector.test(_local3, _local6);
};
_local4++;
};
for each (_local5 in _constraints) {
if ((((((_local5 is SpringConstraint)) && (_local5.collidable))) && (!(_local5.isConnectedTo(_local3))))){
_local5.scp.updatePosition();
CollisionDetector.test(_local3, _local5.scp);
};
};
};
_local2++;
};
}
public function addParticle(_arg1:AbstractParticle):void{
_arg1.group = this;
particles.push(_arg1);
if (isParented){
_arg1.init();
};
}
public function removeConstraint(_arg1:IConstraint):void{
var _local2:int;
_local2 = constraints.indexOf(_arg1);
if (_local2 == -1){
return;
};
constraints.splice(_local2, 1);
}
function get isParented():Boolean{
return (_isParented);
}
public function init():void{
var _local1:int;
_local1 = 0;
while (_local1 < particles.length) {
particles[_local1].init();
_local1++;
};
_local1 = 0;
while (_local1 < constraints.length) {
constraints[_local1].init();
_local1++;
};
}
function satisfyConstraints():void{
var _local1:int;
var _local2:int;
var _local3:IConstraint;
_local1 = _constraints.length;
_local2 = 0;
while (_local2 < _local1) {
_local3 = _constraints[_local2];
_local3.resolve();
_local2++;
};
}
public function paint():void{
var _local1:AbstractParticle;
var _local2:IConstraint;
for each (_local1 in _particles) {
if (!_local1.fixed){
_local1.paint();
};
};
for each (_local2 in _constraints) {
if (!_local2.fixed){
_local2.paint();
};
};
}
public function addConstraint(_arg1:IConstraint):void{
constraints.push(_arg1);
if (isParented){
_arg1.init();
};
}
function set isParented(_arg1:Boolean):void{
_isParented = _arg1;
}
public function removeParticle(_arg1:AbstractParticle):void{
var _local2:int;
_local2 = particles.indexOf(_arg1);
if (_local2 == -1){
return;
};
particles.splice(_local2, 1);
}
public function get particles():Array{
return (_particles);
}
function integrate(_arg1:Number):void{
var _local2:int;
var _local3:int;
var _local4:AbstractParticle;
_local2 = _particles.length;
_local3 = 0;
while (_local3 < _local2) {
_local4 = _particles[_local3];
_local4.update(_arg1);
_local3++;
};
}
public function get constraints():Array{
return (_constraints);
}
public function getAll():Array{
return (particles.concat(constraints));
}
}
}//package ape
Section 2
//AbstractParticle (ape.AbstractParticle)
package ape {
import flash.display.*;
import apeSp.*;
public class AbstractParticle {
private var _collidable:Boolean;
private var __sprite:Sprite;
public var onHitGroup:Function;
private var _kfr:Number;
public var curr:Vector;
public var prev:Vector;
private var _invMass:Number;
var interval:Interval;
private var _mass:Number;
private var temp:Vector;
private var _friction:Number;
public var onHitParticle:Function;
public var sp:PhSp;
private var collision:Collision;
private var forces:Vector;
var samp:Vector;
private var _multisample:int;
private var _fixed:Boolean;
private var _center:Vector;
public var group;
private static var tp:Vector = new Vector();
public function AbstractParticle(_arg1:Sprite, _arg2:Number, _arg3:Number, _arg4:Boolean, _arg5:Number, _arg6:Number, _arg7:Number){
var _sprite = _arg1;
var x = _arg2;
var y = _arg3;
var isFixed = _arg4;
var mass = _arg5;
var elasticity = _arg6;
var friction = _arg7;
super();
sprite = _sprite;
interval = new Interval(0, 0);
curr = new Vector(x, y);
prev = new Vector(x, y);
samp = new Vector();
temp = new Vector();
fixed = isFixed;
forces = new Vector();
collision = new Collision(new Vector(), new Vector());
collidable = true;
this.mass = mass;
this.elasticity = elasticity;
this.friction = friction;
_center = new Vector();
_multisample = 0;
onHitParticle = function (_arg1:AbstractParticle):void{
};
onHitGroup = function (_arg1:Group):void{
};
}
public function set friction(_arg1:Number):void{
if ((((_arg1 < 0)) || ((_arg1 > 1)))){
throw (new ArgumentError("Legal friction must be >= 0 and <=1"));
};
_friction = _arg1;
}
function get invMass():Number{
return ((fixed) ? 0 : _invMass);
}
public function get px():Number{
return (curr.x);
}
public function get py():Number{
return (curr.y);
}
public function set sprite(_arg1:Sprite):void{
__sprite = _arg1;
}
public function set px(_arg1:Number):void{
curr.x = _arg1;
prev.x = _arg1;
}
public function set py(_arg1:Number):void{
curr.y = _arg1;
prev.y = _arg1;
}
public function hit(_arg1:AbstractParticle):void{
if (_arg1){
onHitParticle(_arg1);
if (_arg1.group){
onHitGroup(_arg1.group);
};
};
}
public function set fixed(_arg1:Boolean):void{
_fixed = _arg1;
}
public function get fixed():Boolean{
return (_fixed);
}
function init():void{
paint();
}
public function getVelocity(_arg1:Vector):void{
_arg1.x = (curr.x - prev.x);
_arg1.y = (curr.y - prev.y);
}
function getComponents(_arg1:Vector):Collision{
var _local2:Number;
getVelocity(tp);
_local2 = _arg1.dot(tp);
collision.vn.x = (_arg1.x * _local2);
collision.vn.y = (_arg1.y * _local2);
collision.vt.x = (tp.x - collision.vn.x);
collision.vt.y = (tp.y - collision.vn.y);
return (collision);
}
public function addForce(_arg1:Vector):void{
forces.x = (forces.x + (_arg1.x * invMass));
forces.y = (forces.y + (_arg1.y * invMass));
}
public function get multisample():int{
return (_multisample);
}
public function get position():Vector{
return (new Vector(curr.x, curr.y));
}
function resolveCollision(_arg1:Vector, _arg2:Vector, _arg3:Vector, _arg4:Number, _arg5:int, _arg6:AbstractParticle):void{
curr.plusEquals(_arg1);
velocity = _arg2;
}
public function get elasticity():Number{
return (_kfr);
}
public function addMasslessForce(_arg1:Vector):void{
forces.plusEquals(_arg1);
}
public function get sprite():Sprite{
if (__sprite.root == null){
};
return (__sprite);
}
public function set velocity(_arg1:Vector):void{
prev.x = (curr.x - _arg1.x);
prev.y = (curr.y - _arg1.y);
}
public function set multisample(_arg1:int):void{
_multisample = _arg1;
}
public function set collidable(_arg1:Boolean):void{
_collidable = _arg1;
}
public function set position(_arg1:Vector):void{
curr.copy(_arg1);
prev.copy(_arg1);
}
public function get center():Vector{
_center.setTo(px, py);
return (_center);
}
public function update(_arg1:Number):void{
if (fixed){
return;
};
addForce(APEngine.force);
addMasslessForce(APEngine.masslessForce);
temp.copy(curr);
getVelocity(tp);
curr.x = (curr.x + ((tp.x + (forces.x = (forces.x * _arg1))) * APEngine.damping));
curr.y = (curr.y + ((tp.y + (forces.y = (forces.y * _arg1))) * APEngine.damping));
prev.copy(temp);
forces.setTo(0, 0);
}
function paint():void{
}
public function get collidable():Boolean{
return (_collidable);
}
public function set mass(_arg1:Number):void{
if (_arg1 <= 0){
throw (new ArgumentError("mass may not be set <= 0"));
};
_mass = _arg1;
_invMass = (1 / _mass);
}
public function get velocity():Vector{
return (curr.minus(prev));
}
public function set elasticity(_arg1:Number):void{
_kfr = _arg1;
}
public function get mass():Number{
return (_mass);
}
public function get friction():Number{
return (_friction);
}
}
}//package ape
Section 3
//APEngine (ape.APEngine)
package ape {
import flash.display.*;
public final class APEngine {
private static var _container:DisplayObjectContainer;
private static var _damping:Number;
private static var _constraintCollisionCycles:int;
private static var groups:Array;
static var masslessForce:Vector;
private static var _constraintCycles:int;
static var force:Vector;
private static var delayGroups:Array = new Array();
private static var timeStep:Number;
private static var numGroups:int;
public static function get container():DisplayObjectContainer{
return (_container);
}
public static function adjustArguments(_arg1:Array):Array{
var _local2:Array;
var _local3:*;
_local2 = new Array();
for each (_local3 in _arg1) {
if ((_local3 is Array)){
_local2 = _local2.concat(_local3);
} else {
_local2.push(_local3);
};
};
return (_local2);
}
public static function get constraintCollisionCycles():int{
return (_constraintCollisionCycles);
}
public static function set damping(_arg1:Number):void{
_damping = _arg1;
}
public static function step():void{
var _local1:int;
var _local2:int;
integrate();
_local1 = 0;
while (_local1 < _constraintCycles) {
satisfyConstraints();
_local1++;
};
_local2 = 0;
while (_local2 < _constraintCollisionCycles) {
satisfyConstraints();
checkCollisions();
_local2++;
};
}
public static function init(_arg1:Number=0.25):void{
var _local2:Group;
timeStep = (_arg1 * _arg1);
numGroups = 0;
groups = new Array();
force = new Vector(0, 0);
masslessForce = new Vector(0, 0);
damping = 1;
_constraintCycles = 0;
_constraintCollisionCycles = 1;
for each (_local2 in delayGroups) {
addGroup(_local2);
};
delayGroups = null;
}
public static function get constraintCycles():int{
return (_constraintCycles);
}
public static function set constraintCollisionCycles(_arg1:int):void{
_constraintCollisionCycles = _arg1;
}
public static function set constraintCycles(_arg1:int):void{
_constraintCycles = _arg1;
}
public static function addForce(_arg1:Vector):void{
force.plusEquals(_arg1);
}
public static function get damping():Number{
return (_damping);
}
public static function set container(_arg1:DisplayObjectContainer):void{
_container = _arg1;
}
public static function addGroup(_arg1:Group):void{
if (groups){
groups.push(_arg1);
_arg1.isParented = true;
numGroups++;
_arg1.init();
} else {
delayGroups.push(_arg1);
};
}
public static function removeGroup(_arg1:Group):void{
var _local2:int;
trace((("APEngine.removeGroup(" + _arg1) + ")"));
_local2 = groups.indexOf(_arg1);
if (_local2 == -1){
return;
};
groups.splice(_local2, 1);
_arg1.isParented = false;
numGroups--;
}
public static function paint():void{
var _local1:int;
var _local2:Group;
_local1 = 0;
while (_local1 < numGroups) {
_local2 = groups[_local1];
_local2.paint();
_local1++;
};
}
private static function checkCollisions():void{
var _local1:int;
var _local2:Group;
_local1 = 0;
while (_local1 < numGroups) {
_local2 = groups[_local1];
_local2.checkCollisions();
_local1++;
};
}
private static function integrate():void{
var _local1:int;
var _local2:Group;
_local1 = 0;
while (_local1 < numGroups) {
_local2 = groups[_local1];
_local2.integrate(timeStep);
_local1++;
};
}
private static function satisfyConstraints():void{
var _local1:int;
var _local2:Group;
_local1 = 0;
while (_local1 < numGroups) {
_local2 = groups[_local1];
_local2.satisfyConstraints();
_local1++;
};
}
public static function addMasslessForce(_arg1:Vector):void{
masslessForce.plusEquals(_arg1);
}
}
}//package ape
Section 4
//CircleParticle (ape.CircleParticle)
package ape {
import flash.display.*;
public class CircleParticle extends AbstractParticle {
private var _radius:Number;
public function CircleParticle(_arg1:Sprite, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Boolean=false, _arg6:Number=1, _arg7:Number=0.3, _arg8:Number=0){
super(_arg1, _arg2, _arg3, _arg5, _arg6, _arg7, _arg8);
_radius = _arg4;
}
function getIntervalY():Interval{
interval.min = (curr.y - _radius);
interval.max = (curr.y + _radius);
return (interval);
}
public function get radius():Number{
return (_radius);
}
public function set radius(_arg1:Number):void{
_radius = _arg1;
}
function getProjection(_arg1:Vector):Interval{
var _local2:Number;
_local2 = samp.dot(_arg1);
interval.min = (_local2 - _radius);
interval.max = (_local2 + _radius);
return (interval);
}
override function paint():void{
sprite.x = curr.x;
sprite.y = curr.y;
}
function getIntervalX():Interval{
interval.min = (curr.x - _radius);
interval.max = (curr.x + _radius);
return (interval);
}
}
}//package ape
Section 5
//Collision (ape.Collision)
package ape {
import ape.*;
final class Collision {
var vn:Vector;
var vt:Vector;
function Collision(_arg1:Vector, _arg2:Vector){
this.vn = _arg1;
this.vt = _arg2;
}
}
}//package ape
Section 6
//CollisionDetector (ape.CollisionDetector)
package ape {
import ape.*;
final class CollisionDetector {
private static var dp:Vector = new Vector();
private static var collisionNormal2:Vector = new Vector();
private static var collisionNormal3:Vector = new Vector();
private static var tp:Vector = new Vector();
private static var collisionNormal1:Vector = new Vector();
static function test(_arg1:AbstractParticle, _arg2:AbstractParticle):void{
if (((_arg1.fixed) && (_arg2.fixed))){
return;
};
if ((((_arg1.multisample == 0)) && ((_arg2.multisample == 0)))){
normVsNorm(_arg1, _arg2);
} else {
if ((((_arg1.multisample > 0)) && ((_arg2.multisample == 0)))){
sampVsNorm(_arg1, _arg2);
} else {
if ((((_arg2.multisample > 0)) && ((_arg1.multisample == 0)))){
sampVsNorm(_arg2, _arg1);
} else {
if (_arg1.multisample == _arg2.multisample){
sampVsSamp(_arg1, _arg2);
} else {
normVsNorm(_arg1, _arg2);
};
};
};
};
}
private static function testIntervals(_arg1:Interval, _arg2:Interval):Number{
var _local3:Number;
var _local4:Number;
if (_arg1.max < _arg2.min){
return (0);
};
if (_arg2.max < _arg1.min){
return (0);
};
_local3 = (_arg2.max - _arg1.min);
_local4 = (_arg2.min - _arg1.max);
return (((Math.abs(_local3))<Math.abs(_local4)) ? _local3 : _local4);
}
private static function testOBBvsOBB(_arg1:RectangleParticle, _arg2:RectangleParticle):Boolean{
var _local3:Number;
var _local4:int;
var _local5:Vector;
var _local6:Number;
var _local7:Vector;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Boolean;
_local3 = Number.POSITIVE_INFINITY;
_local4 = 0;
while (_local4 < 2) {
_local5 = _arg1.axes[_local4];
_local6 = testIntervals(_arg1.getProjection(_local5), _arg2.getProjection(_local5));
if (_local6 == 0){
return (false);
};
_local7 = _arg2.axes[_local4];
_local8 = testIntervals(_arg1.getProjection(_local7), _arg2.getProjection(_local7));
if (_local8 == 0){
return (false);
};
_local9 = Math.abs(_local6);
_local10 = Math.abs(_local8);
if ((((_local9 < Math.abs(_local3))) || ((_local10 < Math.abs(_local3))))){
_local11 = (_local9 < _local10);
collisionNormal1.copy((_local11) ? _local5 : _local7);
_local3 = (_local11) ? _local6 : _local8;
};
_local4++;
};
CollisionResolver.resolveParticleParticle(_arg1, _arg2, collisionNormal1, _local3);
return (true);
}
private static function sampVsSamp(_arg1:AbstractParticle, _arg2:AbstractParticle):void{
var _local3:Number;
var _local4:Number;
var _local5:int;
_local3 = (1 / (_arg1.multisample + 1));
_local4 = _local3;
_local5 = 0;
while (_local5 <= _arg1.multisample) {
_arg1.samp.setTo((_arg1.prev.x + (_local4 * (_arg1.curr.x - _arg1.prev.x))), (_arg1.prev.y + (_local4 * (_arg1.curr.y - _arg1.prev.y))));
_arg2.samp.setTo((_arg2.prev.x + (_local4 * (_arg2.curr.x - _arg2.prev.x))), (_arg2.prev.y + (_local4 * (_arg2.curr.y - _arg2.prev.y))));
if (testTypes(_arg1, _arg2)){
return;
};
_local4 = (_local4 + _local3);
_local5++;
};
}
private static function testTypes(_arg1:AbstractParticle, _arg2:AbstractParticle):Boolean{
var _local3:Boolean;
if (_arg1 == _arg2){
return (false);
};
_local3 = false;
if ((((_arg1 is RectangleParticle)) && ((_arg2 is RectangleParticle)))){
_local3 = ((_local3) || (testOBBvsOBB((_arg1 as RectangleParticle), (_arg2 as RectangleParticle))));
} else {
if ((((_arg1 is CircleParticle)) && ((_arg2 is CircleParticle)))){
_local3 = ((_local3) || (testCirclevsCircle((_arg1 as CircleParticle), (_arg2 as CircleParticle))));
} else {
if ((((_arg1 is RectangleParticle)) && ((_arg2 is CircleParticle)))){
_local3 = ((_local3) || (testOBBvsCircle((_arg1 as RectangleParticle), (_arg2 as CircleParticle))));
} else {
if ((((_arg1 is CircleParticle)) && ((_arg2 is RectangleParticle)))){
_local3 = ((_local3) || (testOBBvsCircle((_arg2 as RectangleParticle), (_arg1 as CircleParticle))));
};
};
};
};
if (_local3){
_arg1.hit(_arg2);
_arg2.hit(_arg1);
};
return (_local3);
}
private static function getClosestVertexOnOBB(_arg1:Vector, _arg2:RectangleParticle, _arg3:Vector):void{
var _local4:int;
var _local5:Number;
var _local6:Vector;
dp.x = (_arg1.x - _arg2.samp.x);
dp.y = (_arg1.y - _arg2.samp.y);
_arg3.copy(_arg2.samp);
_local4 = 0;
while (_local4 < 2) {
_local5 = dp.dot(_arg2.axes[_local4]);
if (_local5 >= 0){
_local5 = _arg2.extents[_local4];
} else {
if (_local5 < 0){
_local5 = -(_arg2.extents[_local4]);
};
};
_local6 = _arg2.axes[_local4];
_arg3.x = (_arg3.x + (_local6.x * _local5));
_arg3.y = (_arg3.y + (_local6.y * _local5));
_local4++;
};
}
private static function sampVsNorm(_arg1:AbstractParticle, _arg2:AbstractParticle):void{
var _local3:Number;
var _local4:Number;
var _local5:int;
_local3 = (1 / (_arg1.multisample + 1));
_local4 = _local3;
_arg2.samp.copy(_arg2.curr);
_local5 = 0;
while (_local5 <= _arg1.multisample) {
_arg1.samp.setTo((_arg1.prev.x + (_local4 * (_arg1.curr.x - _arg1.prev.x))), (_arg1.prev.y + (_local4 * (_arg1.curr.y - _arg1.prev.y))));
if (testTypes(_arg1, _arg2)){
return;
};
_local4 = (_local4 + _local3);
_local5++;
};
}
private static function testCirclevsCircle(_arg1:CircleParticle, _arg2:CircleParticle):Boolean{
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
_local3 = testIntervals(_arg1.getIntervalX(), _arg2.getIntervalX());
if (_local3 == 0){
return (false);
};
_local4 = testIntervals(_arg1.getIntervalY(), _arg2.getIntervalY());
if (_local4 == 0){
return (false);
};
collisionNormal3.x = (_arg1.samp.x - _arg2.samp.x);
collisionNormal3.y = (_arg1.samp.y - _arg2.samp.y);
_local5 = collisionNormal3.length;
_local6 = ((_arg1.radius + _arg2.radius) - _local5);
if (_local6 > 0){
collisionNormal3.divEquals(_local5);
CollisionResolver.resolveParticleParticle(_arg1, _arg2, collisionNormal3, _local6);
return (true);
};
return (false);
}
private static function testOBBvsCircle(_arg1:RectangleParticle, _arg2:CircleParticle):Boolean{
var _local3:Number;
var _local4:Array;
var _local5:int;
var _local6:Number;
var _local7:Vector;
var _local8:Number;
var _local9:Number;
_local3 = Number.POSITIVE_INFINITY;
_local4 = new Array(2);
_local5 = 0;
while (_local5 < 2) {
_local7 = _arg1.axes[_local5];
_local8 = testIntervals(_arg1.getProjection(_local7), _arg2.getProjection(_local7));
if (_local8 == 0){
return (false);
};
if (Math.abs(_local8) < Math.abs(_local3)){
collisionNormal2.copy(_local7);
_local3 = _local8;
};
_local4[_local5] = _local8;
_local5++;
};
_local6 = _arg2.radius;
if ((((Math.abs(_local4[0]) < _local6)) && ((Math.abs(_local4[1]) < _local6)))){
getClosestVertexOnOBB(_arg2.samp, _arg1, tp);
collisionNormal2.x = (tp.x - _arg2.samp.x);
collisionNormal2.y = (tp.y - _arg2.samp.y);
_local9 = collisionNormal2.length;
_local3 = (_local6 - _local9);
if (_local3 > 0){
collisionNormal2.divEquals(_local9);
} else {
return (false);
};
};
CollisionResolver.resolveParticleParticle(_arg1, _arg2, collisionNormal2, _local3);
return (true);
}
private static function closestVertexOnOBB(_arg1:Vector, _arg2:RectangleParticle):Vector{
var _local3:Vector;
var _local4:Vector;
var _local5:int;
var _local6:Number;
var _local7:Vector;
_local3 = _arg1.minus(_arg2.samp);
_local4 = new Vector(_arg2.samp.x, _arg2.samp.y);
_local5 = 0;
while (_local5 < 2) {
_local6 = _local3.dot(_arg2.axes[_local5]);
if (_local6 >= 0){
_local6 = _arg2.extents[_local5];
} else {
if (_local6 < 0){
_local6 = -(_arg2.extents[_local5]);
};
};
_local7 = _arg2.axes[_local5];
_local4.x = (_local4.x + (_local7.x * _local6));
_local4.y = (_local4.y + (_local7.y * _local6));
_local5++;
};
return (_local4);
}
private static function normVsNorm(_arg1:AbstractParticle, _arg2:AbstractParticle):void{
_arg1.samp.copy(_arg1.curr);
_arg2.samp.copy(_arg2.curr);
testTypes(_arg1, _arg2);
}
}
}//package ape
Section 7
//CollisionResolver (ape.CollisionResolver)
package ape {
import ape.*;
final class CollisionResolver {
private static var mtdA:Vector = new Vector();
private static var mtdB:Vector = new Vector();
private static var vnA:Vector = new Vector();
private static var vnB:Vector = new Vector();
private static var mtd:Vector = new Vector();
static function resolveParticleParticle(_arg1:AbstractParticle, _arg2:AbstractParticle, _arg3:Vector, _arg4:Number):void{
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Collision;
var _local9:Collision;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
_arg1.curr.copy(_arg1.samp);
_arg2.curr.copy(_arg2.samp);
mtd.x = (_arg3.x * _arg4);
mtd.y = (_arg3.y * _arg4);
_local5 = (_arg1.elasticity + _arg2.elasticity);
_local6 = (_arg1.invMass + _arg2.invMass);
_local7 = clamp((1 - (_arg1.friction + _arg2.friction)), 0, 1);
_local8 = _arg1.getComponents(_arg3);
_local9 = _arg2.getComponents(_arg3);
_local10 = ((_local5 + 1) * _arg1.invMass);
_local11 = (_arg2.invMass - (_local5 * _arg1.invMass));
_local12 = ((_local5 + 1) * _arg2.invMass);
_local13 = (_arg1.invMass - (_local5 * _arg2.invMass));
vnA.x = (((_local9.vn.x * _local10) + (_local8.vn.x * _local11)) / _local6);
vnA.y = (((_local9.vn.y * _local10) + (_local8.vn.y * _local11)) / _local6);
vnB.x = (((_local8.vn.x * _local12) + (_local9.vn.x * _local13)) / _local6);
vnB.y = (((_local8.vn.y * _local12) + (_local9.vn.y * _local13)) / _local6);
_local8.vt.multEquals(_local7);
_local9.vt.multEquals(_local7);
_local14 = (_arg1.invMass / _local6);
mtdA.x = (mtd.x * _local14);
mtdA.y = (mtd.y * _local14);
_local15 = (-(_arg2.invMass) / _local6);
mtdB.x = (mtd.x * _local15);
mtdB.y = (mtd.y * _local15);
vnA.plusEquals(_local8.vt);
vnB.plusEquals(_local9.vt);
if (!_arg1.fixed){
_arg1.resolveCollision(mtdA, vnA, _arg3, _arg4, -1, _arg2);
};
if (!_arg2.fixed){
_arg2.resolveCollision(mtdB, vnB, _arg3, _arg4, 1, _arg1);
};
}
static function clamp(_arg1:Number, _arg2:Number, _arg3:Number):Number{
if (_arg1 > _arg3){
return (_arg3);
};
if (_arg1 < _arg2){
return (_arg2);
};
return (_arg1);
}
}
}//package ape
Section 8
//Composite (ape.Composite)
package ape {
public class Composite extends AbstractCollection {
private var delta:Vector;
public function Composite(){
delta = new Vector();
}
private function getRelativeAngle(_arg1:Vector, _arg2:Vector):Number{
delta.setTo((_arg2.x - _arg1.x), (_arg2.y - _arg1.y));
return (Math.atan2(delta.y, delta.x));
}
public function rotateByRadian(_arg1:Number, _arg2:Vector):void{
var _local3:AbstractParticle;
var _local4:Array;
var _local5:int;
var _local6:int;
var _local7:Number;
var _local8:Number;
_local4 = particles;
_local5 = _local4.length;
_local6 = 0;
while (_local6 < _local5) {
_local3 = _local4[_local6];
_local7 = Vector.distance(_local3.center, _arg2);
_local8 = (getRelativeAngle(_arg2, _local3.center) + _arg1);
_local3.px = ((Math.cos(_local8) * _local7) + _arg2.x);
_local3.py = ((Math.sin(_local8) * _local7) + _arg2.y);
_local6++;
};
}
public function rotateByAngle(_arg1:Number, _arg2:Vector):void{
var _local3:Number;
_local3 = (_arg1 * MathUtil.PI_OVER_ONE_EIGHTY);
rotateByRadian(_local3, _arg2);
}
public function set fixed(_arg1:Boolean):void{
var _local2:int;
_local2 = 0;
while (_local2 < particles.length) {
particles[_local2].fixed = _arg1;
_local2++;
};
}
public function get fixed():Boolean{
var _local1:int;
_local1 = 0;
while (_local1 < particles.length) {
if (!particles[_local1].fixed){
return (false);
};
_local1++;
};
return (true);
}
}
}//package ape
Section 9
//Group (ape.Group)
package ape {
import apeSp.*;
public class Group extends AbstractCollection {
public var onPaint:Function;
private var _collideInternal:Boolean;
private var _composites:Array;
private var _collisionList:Array;
public var groupSp:GroupSp;
public function Group(_arg1:Boolean=false){
var collideInternal = _arg1;
super();
_composites = new Array();
_collisionList = new Array();
this.collideInternal = collideInternal;
onPaint = function (){
};
}
override public function removeConstraint(_arg1:IConstraint):void{
super.removeConstraint(_arg1);
checkRemove();
}
function checkCollisions():void{
var _local1:int;
var _local2:int;
var _local3:Group;
if (collideInternal){
checkCollisionGroupInternal();
};
_local1 = collisionList.length;
_local2 = 0;
while (_local2 < _local1) {
_local3 = collisionList[_local2];
checkCollisionVsGroup(_local3);
_local2++;
};
}
override public function init():void{
var _local1:int;
super.init();
_local1 = 0;
while (_local1 < composites.length) {
composites[_local1].init();
_local1++;
};
}
public function removeCollidable(_arg1:Group):void{
var _local2:int;
_local2 = collisionList.indexOf(_arg1);
if (_local2 == -1){
return;
};
collisionList.splice(_local2, 1);
}
public function set collideInternal(_arg1:Boolean):void{
_collideInternal = _arg1;
}
override function satisfyConstraints():void{
var _local1:int;
var _local2:int;
var _local3:Composite;
super.satisfyConstraints();
_local1 = _composites.length;
_local2 = 0;
while (_local2 < _local1) {
_local3 = _composites[_local2];
_local3.satisfyConstraints();
_local2++;
};
}
public function get composites():Array{
return (_composites);
}
private function checkCollisionVsGroup(_arg1:Group):void{
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:Composite;
var _local6:int;
var _local7:Composite;
checkCollisionsVsCollection(_arg1);
_local2 = _composites.length;
_local3 = _arg1.composites.length;
_local4 = 0;
while (_local4 < _local2) {
_local5 = _composites[_local4];
_local5.checkCollisionsVsCollection(_arg1);
_local6 = 0;
while (_local6 < _local3) {
_local7 = _arg1.composites[_local6];
_local5.checkCollisionsVsCollection(_local7);
_local6++;
};
_local4++;
};
_local6 = 0;
while (_local6 < _local3) {
_local7 = _arg1.composites[_local6];
checkCollisionsVsCollection(_local7);
_local6++;
};
}
public function addCollidableList(... _args):void{
var _local2:Group;
for each (_local2 in APEngine.adjustArguments(_args)) {
collisionList.push(_local2);
};
}
public function removeComposite(_arg1:Composite):void{
var _local2:int;
_local2 = composites.indexOf(_arg1);
if (_local2 == -1){
return;
};
composites.splice(_local2, 1);
_arg1.isParented = false;
}
override public function paint():void{
var _local1:int;
var _local2:int;
var _local3:Composite;
super.paint();
_local1 = _composites.length;
_local2 = 0;
while (_local2 < _local1) {
_local3 = _composites[_local2];
_local3.paint();
_local2++;
};
onPaint();
}
public function addCollidable(_arg1:Group):void{
collisionList.push(_arg1);
}
override public function removeParticle(_arg1:AbstractParticle):void{
super.removeParticle(_arg1);
checkRemove();
}
override public function getAll():Array{
return (particles.concat(constraints).concat(composites));
}
private function checkRemove():void{
trace(("particles.length=" + particles.length), ("constraints.length=" + constraints.length));
if ((((particles.length == 0)) && ((constraints.length == 0)))){
APEngine.removeGroup(this);
};
}
public function get collisionList():Array{
return (_collisionList);
}
override function integrate(_arg1:Number):void{
var _local2:int;
var _local3:int;
var _local4:Composite;
super.integrate(_arg1);
_local2 = _composites.length;
_local3 = 0;
while (_local3 < _local2) {
_local4 = _composites[_local3];
_local4.integrate(_arg1);
_local3++;
};
}
public function addComposite(_arg1:Composite):void{
composites.push(_arg1);
_arg1.isParented = true;
if (isParented){
_arg1.init();
};
}
private function checkCollisionGroupInternal():void{
var _local1:int;
var _local2:int;
var _local3:Composite;
var _local4:int;
var _local5:Composite;
checkInternalCollisions();
_local1 = _composites.length;
_local2 = 0;
while (_local2 < _local1) {
_local3 = _composites[_local2];
_local3.checkCollisionsVsCollection(this);
_local4 = (_local2 + 1);
while (_local4 < _local1) {
_local5 = _composites[_local4];
_local3.checkCollisionsVsCollection(_local5);
_local4++;
};
_local2++;
};
}
public function get collideInternal():Boolean{
return (_collideInternal);
}
public static function makeGroup(... _args):Group{
var _local2:Group;
var _local3:*;
_local2 = new (Group);
for each (_local3 in APEngine.adjustArguments(_args)) {
if ((_local3 is Group)){
_local2.addParticle(_local3);
} else {
if ((_local3 is PhSp)){
_local2.addParticle(_local3.particle);
};
};
};
return (_local2);
}
}
}//package ape
Section 10
//IConstraint (ape.IConstraint)
package ape {
public interface IConstraint {
function init():void;
function get fixed():Boolean;
function resolve():void;
function paint():void;
}
}//package ape
Section 11
//Interval (ape.Interval)
package ape {
final class Interval {
var min:Number;
var max:Number;
function Interval(_arg1:Number, _arg2:Number){
this.min = _arg1;
this.max = _arg2;
}
function toString():String{
return (((min + " : ") + max));
}
}
}//package ape
Section 12
//LineConstraint (ape.LineConstraint)
package ape {
import flash.display.*;
import flash.geom.*;
public class LineConstraint implements IConstraint {
public var curr2:Vector;
public var curr1:Vector;
public var p1:AbstractParticle;
public var p2:AbstractParticle;
public var restLength:Number;
public var point1;
public var point2;
private var __sprite:Sprite;
public var stiffness:Number;
public function LineConstraint(_arg1:Sprite, _arg2:AbstractParticle, _arg3:AbstractParticle, _arg4, _arg5, _arg6:Number=0.5){
sprite = _arg1;
p1 = _arg2;
p2 = _arg3;
curr1 = p1.curr;
curr2 = p2.curr;
point1 = _arg4;
point2 = _arg5;
stiffness = _arg6;
checkParticlesLocation();
restLength = currLength;
}
public function get fixed():Boolean{
return (((p1.fixed) && (p2.fixed)));
}
public function get sprite():Sprite{
if (__sprite.root == null){
};
return (__sprite);
}
public function set sprite(_arg1:Sprite):void{
__sprite = _arg1;
}
public function init():void{
paint();
}
public function paint2(_arg1:Vector, _arg2:Vector):void{
var _local3:Vector;
var _local4:Vector;
var _local5:Point;
_local3 = new Vector((point2.x - point1.x), (point2.y - point1.y));
_local4 = new Vector((_arg2.x - _arg1.x), (_arg2.y - _arg1.y));
sprite.rotation = (Vector.toAngle(_local3, _local4) * (180 / Math.PI));
sprite.scaleX = (_local4.length / _local3.length);
_local5 = sprite.transform.matrix.transformPoint(new Point(point1.x, point1.y));
sprite.x = (sprite.x + (_arg1.x - _local5.x));
sprite.y = (sprite.y + (_arg1.y - _local5.y));
}
public function paint():void{
if (sprite){
paint2(curr1, curr2);
};
}
private function checkParticlesLocation():void{
if (Vector.distance2(curr1, curr2) < 0.01){
curr2.x = (curr2.x + (curr2.x - curr1.x));
};
}
public function resolve():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
if (((p1.fixed) && (p2.fixed))){
return;
};
_local1 = (curr2.x - curr1.x);
_local2 = (curr2.y - curr1.y);
_local3 = p1.invMass;
_local4 = p2.invMass;
_local5 = (((1 - (restLength / Math.sqrt(((_local1 * _local1) + (_local2 * _local2))))) * stiffness) / (_local3 + _local4));
_local1 = (_local1 * _local5);
_local2 = (_local2 * _local5);
curr1.x = (curr1.x + (_local1 * _local3));
curr1.y = (curr1.y + (_local2 * _local3));
curr2.x = (curr2.x - (_local1 * _local4));
curr2.y = (curr2.y - (_local2 * _local4));
}
public function isConnectedTo(_arg1:AbstractParticle):Boolean{
return ((((_arg1 == p1)) || ((_arg1 == p2))));
}
public function get currLength():Number{
return (Vector.distance(curr1, curr2));
}
}
}//package ape
Section 13
//MathUtil (ape.MathUtil)
package ape {
final class MathUtil {
static const ONE_EIGHTY_OVER_PI:Number = 57.2957795130823;
static const PI_OVER_ONE_EIGHTY:Number = 0.0174532925199433;
static function clamp(_arg1:Number, _arg2:Number, _arg3:Number):Number{
if (_arg1 < _arg2){
return (_arg2);
};
if (_arg1 > _arg3){
return (_arg3);
};
return (_arg1);
}
static function sign(_arg1:Number):int{
if (_arg1 < 0){
return (-1);
};
return (1);
}
}
}//package ape
Section 14
//RectangleParticle (ape.RectangleParticle)
package ape {
import flash.display.*;
public class RectangleParticle extends AbstractParticle {
private var _axes:Array;
private var _radian:Number;
private var _extents:Array;
public function RectangleParticle(_arg1:Sprite, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number=0, _arg7:Boolean=false, _arg8:Number=1, _arg9:Number=0.3, _arg10:Number=0){
super(_arg1, _arg2, _arg3, _arg7, _arg8, _arg9, _arg10);
_extents = new Array((_arg4 / 2), (_arg5 / 2));
_axes = new Array(new Vector(0, 0), new Vector(0, 0));
radian = _arg6;
}
public function set radian(_arg1:Number):void{
_radian = _arg1;
setAxes(_arg1);
}
function get extents():Array{
return (_extents);
}
public function set width(_arg1:Number):void{
_extents[0] = (_arg1 / 2);
}
public function get radian():Number{
return (_radian);
}
function get axes():Array{
return (_axes);
}
public function get height():Number{
return ((_extents[1] * 2));
}
public function set angle(_arg1:Number):void{
radian = (_arg1 * MathUtil.PI_OVER_ONE_EIGHTY);
}
private function setAxes(_arg1:Number):void{
var _local2:Number;
var _local3:Number;
_local2 = Math.sin(_arg1);
_local3 = Math.cos(_arg1);
axes[0].x = _local3;
axes[0].y = _local2;
axes[1].x = -(_local2);
axes[1].y = _local3;
}
public function get width():Number{
return ((_extents[0] * 2));
}
public function set height(_arg1:Number):void{
_extents[1] = (_arg1 / 2);
}
function getProjection(_arg1:Vector):Interval{
var _local2:Number;
var _local3:Number;
_local2 = ((extents[0] * Math.abs(_arg1.dot(axes[0]))) + (extents[1] * Math.abs(_arg1.dot(axes[1]))));
_local3 = samp.dot(_arg1);
interval.min = (_local3 - _local2);
interval.max = (_local3 + _local2);
return (interval);
}
override function paint():void{
sprite.x = curr.x;
sprite.y = curr.y;
sprite.rotation = angle;
}
public function get angle():Number{
return ((radian * MathUtil.ONE_EIGHTY_OVER_PI));
}
}
}//package ape
Section 15
//RimParticle (ape.RimParticle)
package ape {
import ape.*;
class RimParticle {
private var maxTorque:Number;
var curr:Vector;
var prev:Vector;
private var av:Number;
private var wr:Number;
private var sp:Number;
function RimParticle(_arg1:Number, _arg2:Number){
curr = new Vector(_arg1, 0);
prev = new Vector(0, 0);
sp = 0;
av = 0;
maxTorque = _arg2;
wr = _arg1;
}
function update(_arg1:Number):void{
var _local2: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;
sp = Math.max(-(maxTorque), Math.min(maxTorque, (sp + av)));
_local2 = -(curr.y);
_local3 = curr.x;
_local4 = Math.sqrt(((_local2 * _local2) + (_local3 * _local3)));
_local2 = (_local2 / _local4);
_local3 = (_local3 / _local4);
curr.x = (curr.x + (sp * _local2));
curr.y = (curr.y + (sp * _local3));
_local5 = prev.x;
_local6 = prev.y;
_local7 = (prev.x = curr.x);
_local8 = (prev.y = curr.y);
curr.x = (curr.x + (APEngine.damping * (_local7 - _local5)));
curr.y = (curr.y + (APEngine.damping * (_local8 - _local6)));
_local9 = Math.sqrt(((curr.x * curr.x) + (curr.y * curr.y)));
_local10 = ((_local9 - wr) / _local9);
curr.x = (curr.x - (curr.x * _local10));
curr.y = (curr.y - (curr.y * _local10));
}
function set speed(_arg1:Number):void{
sp = _arg1;
}
function get angularVelocity():Number{
return (av);
}
function set angularVelocity(_arg1:Number):void{
av = _arg1;
}
function get speed():Number{
return (sp);
}
}
}//package ape
Section 16
//SpringConstraint (ape.SpringConstraint)
package ape {
import flash.display.*;
public class SpringConstraint extends LineConstraint implements IConstraint {
private var _collidable:Boolean;
private var _scp:SpringConstraintParticle;
public function SpringConstraint(_arg1:Sprite, _arg2:AbstractParticle, _arg3:AbstractParticle, _arg4, _arg5, _arg6:Number=0.5, _arg7:Boolean=false, _arg8:Number=1, _arg9:Number=1, _arg10:Boolean=false){
super(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6);
setCollidable(_arg7, _arg8, _arg9, _arg10);
}
public function set rectScale(_arg1:Number):void{
if (scp == null){
return;
};
scp.rectScale = _arg1;
}
override public function init():void{
if (collidable){
scp.init();
};
paint();
}
public function get angle():Number{
return ((radian * MathUtil.ONE_EIGHTY_OVER_PI));
}
public function get rectScale():Number{
return (scp.rectScale);
}
public function set rectHeight(_arg1:Number):void{
if (scp == null){
return;
};
scp.rectHeight = _arg1;
}
override public function paint():void{
if (collidable){
scp.paint();
} else {
super.paint();
};
(sprite as Object).update();
}
function get scp():SpringConstraintParticle{
return (_scp);
}
public function setCollidable(_arg1:Boolean, _arg2:Number, _arg3:Number, _arg4:Boolean=false):void{
_collidable = _arg1;
_scp = null;
if (_collidable){
_scp = new SpringConstraintParticle(sprite, p1, p2, this, _arg2, _arg3, _arg4);
};
}
public function get fixedEndLimit():Number{
return (scp.fixedEndLimit);
}
public function get rectHeight():Number{
return (scp.rectHeight);
}
public function set fixedEndLimit(_arg1:Number):void{
if (scp == null){
return;
};
scp.fixedEndLimit = _arg1;
}
public function get radian():Number{
return (Math.atan2((p1.curr.y - p2.curr.y), (p1.curr.x - p2.curr.x)));
}
private function checkParticlesLocation():void{
if ((((p1.curr.x == p2.curr.x)) && ((p1.curr.y == p2.curr.y)))){
p2.curr.x = (p2.curr.x + 0.0001);
};
}
public function get collidable():Boolean{
return (_collidable);
}
}
}//package ape
Section 17
//SpringConstraintParticle (ape.SpringConstraintParticle)
package ape {
import flash.display.*;
import ape.*;
class SpringConstraintParticle extends RectangleParticle {
private var _fixedEndLimit:Number;
private var curr1:Vector;
private var curr2:Vector;
private var _rectScale:Number;
private var rca:Vector;
private var rcb:Vector;
private var s:Number;
private var parent:SpringConstraint;
private var scaleToLength:Boolean;
private var lambda:Vector;
private var p1:AbstractParticle;
private var avgVelocity:Vector;
private var p2:AbstractParticle;
private var _rectHeight:Number;
private static var p2v:Vector = new Vector();
private static var p1v:Vector = new Vector();
private static var r:Vector = new Vector();
private static var d1:Vector = new Vector();
private static var d2:Vector = new Vector();
function SpringConstraintParticle(_arg1:Sprite, _arg2:AbstractParticle, _arg3:AbstractParticle, _arg4:SpringConstraint, _arg5:Number, _arg6:Number, _arg7:Boolean){
super(_arg1, 0, 0, 0, 0, 0, false);
p1 = _arg2;
p2 = _arg3;
curr1 = p1.curr;
curr2 = p2.curr;
lambda = new Vector(0, 0);
avgVelocity = new Vector(0, 0);
parent = _arg4;
rectScale = _arg6;
scaleToLength = _arg7;
rectHeight = _arg5;
fixedEndLimit = 0;
rca = new Vector();
rcb = new Vector();
}
function updatePosition():void{
curr.setTo(((parent.p1.curr.x + parent.p2.curr.x) / 2), ((parent.p1.curr.y + parent.p2.curr.y) / 2));
width = (scaleToLength) ? (parent.currLength * rectScale) : (parent.restLength * rectScale);
height = rectHeight;
radian = parent.radian;
}
private function closestPtSegmentSegment():Number{
var _local1:Vector;
var _local2:Vector;
var _local3:Vector;
var _local4:Vector;
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;
_local1 = p1.curr;
_local2 = p2.curr;
_local3 = rca;
_local4 = rcb;
d1.x = (_local2.x - _local1.x);
d1.y = (_local2.y - _local1.y);
d2.x = (_local4.x - _local3.x);
d1.y = (_local4.y - _local3.y);
r.x = (_local1.x - _local3.x);
r.y = (_local1.y - _local3.y);
_local6 = d1.dot(d1);
_local7 = d2.dot(d2);
_local8 = d2.dot(r);
_local9 = d1.dot(r);
_local10 = d1.dot(d2);
_local11 = ((_local6 * _local7) - (_local10 * _local10));
if (_local11 != 0){
s = MathUtil.clamp((((_local10 * _local8) - (_local9 * _local7)) / _local11), 0, 1);
} else {
s = 0.5;
};
_local5 = (((_local10 * s) + _local8) / _local7);
if (_local5 < 0){
_local5 = 0;
s = MathUtil.clamp((-(_local9) / _local6), 0, 1);
} else {
if (_local5 > 0){
_local5 = 1;
s = MathUtil.clamp(((_local10 - _local9) / _local6), 0, 1);
};
};
_local12 = ((_local1.x + (d1.x * s)) - (_local3.x + (d2.x * _local5)));
_local13 = ((_local1.y + (d1.y * s)) - (_local3.y + (d2.y * _local5)));
return (((_local12 * _local12) + (_local13 * _local13)));
}
function get rectHeight():Number{
return (_rectHeight);
}
function get fixedEndLimit():Number{
return (_fixedEndLimit);
}
private function closestParamPoint(_arg1:Vector):Number{
var _local2:Number;
var _local3:Number;
_local2 = (p2.curr.x - p1.curr.x);
_local3 = (p2.curr.y - p1.curr.y);
return (MathUtil.clamp((((_local2 * (_arg1.x - p1.curr.x)) + (_local3 * (_arg1.y - p1.curr.y))) / ((_local2 * _local2) + (_local3 * _local3))), 0, 1));
}
override public function getVelocity(_arg1:Vector):void{
p1.getVelocity(p1v);
p2.getVelocity(p2v);
avgVelocity.setTo(((p1v.x + p2v.x) / 2), ((p1v.y + p2v.y) / 2));
_arg1.x = avgVelocity.x;
_arg1.y = avgVelocity.y;
}
override function paint():void{
if (sprite){
parent.paint2(curr1, curr2);
};
}
private function getContactPointParam(_arg1:AbstractParticle):Number{
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:int;
var _local6:Number;
if ((_arg1 is CircleParticle)){
_local2 = closestParamPoint(_arg1.curr);
} else {
if ((_arg1 is RectangleParticle)){
_local4 = Number.POSITIVE_INFINITY;
_local5 = 0;
while (_local5 < 4) {
setCorners((_arg1 as RectangleParticle), _local5);
_local6 = closestPtSegmentSegment();
if (_local6 < _local4){
_local4 = _local6;
_local3 = _local5;
_local2 = s;
};
_local5++;
};
};
};
return (_local2);
}
function set fixedEndLimit(_arg1:Number):void{
_fixedEndLimit = _arg1;
}
function set rectHeight(_arg1:Number):void{
_rectHeight = _arg1;
}
override function get invMass():Number{
if (((p1.fixed) && (p2.fixed))){
return (0);
};
return ((1 / ((p1.mass + p2.mass) / 2)));
}
function set rectScale(_arg1:Number):void{
_rectScale = _arg1;
}
override function resolveCollision(_arg1:Vector, _arg2:Vector, _arg3:Vector, _arg4:Number, _arg5:int, _arg6:AbstractParticle):void{
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:AbstractParticle;
_local7 = getContactPointParam(_arg6);
_local8 = (1 - _local7);
_local9 = _local7;
if (p1.fixed){
if (_local9 <= fixedEndLimit){
return;
};
lambda.setTo((_arg1.x / _local9), (_arg1.y / _local9));
p2.curr.plusEquals(lambda);
p2.velocity = _arg2;
} else {
if (p2.fixed){
if (_local8 <= fixedEndLimit){
return;
};
lambda.setTo((_arg1.x / _local8), (_arg1.y / _local8));
p1.curr.plusEquals(lambda);
p1.velocity = _arg2;
} else {
_local10 = ((_local8 * _local8) + (_local9 * _local9));
if (_local10 == 0){
return;
};
lambda.setTo((_arg1.x / _local10), (_arg1.y / _local10));
p1.curr.x = (p1.curr.x + (lambda.x * _local8));
p1.curr.y = (p1.curr.y + (lambda.y * _local8));
p2.curr.x = (p2.curr.x + (lambda.x * _local9));
p2.curr.y = (p2.curr.y + (lambda.y * _local9));
if (_local7 == 0.5){
p1.velocity = _arg2;
p2.velocity = _arg2;
} else {
_local11 = ((_local7)<0.5) ? p1 : p2;
_local11.velocity = _arg2;
};
};
};
}
override public function get elasticity():Number{
return (((p1.elasticity + p2.elasticity) / 2));
}
function get rectScale():Number{
return (_rectScale);
}
override public function get mass():Number{
return (((p1.mass + p2.mass) / 2));
}
override public function get friction():Number{
return (((p1.friction + p2.friction) / 2));
}
private function setCorners(_arg1:RectangleParticle, _arg2:int):void{
var _local3:Number;
var _local4:Number;
var _local5:Array;
var _local6:Array;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
_local3 = _arg1.curr.x;
_local4 = _arg1.curr.y;
_local5 = _arg1.axes;
_local6 = _arg1.extents;
_local7 = (_local5[0].x * _local6[0]);
_local8 = (_local5[0].y * _local6[0]);
_local9 = (_local5[1].x * _local6[1]);
_local10 = (_local5[1].y * _local6[1]);
_local11 = (_local7 - _local9);
_local12 = (_local8 - _local10);
_local13 = (_local7 + _local9);
_local14 = (_local8 + _local10);
if (_arg2 == 0){
rca.x = (_local3 - _local13);
rca.y = (_local4 - _local14);
rcb.x = (_local3 + _local11);
rcb.y = (_local4 + _local12);
} else {
if (_arg2 == 1){
rca.x = (_local3 + _local11);
rca.y = (_local4 + _local12);
rcb.x = (_local3 + _local13);
rcb.y = (_local4 + _local14);
} else {
if (_arg2 == 2){
rca.x = (_local3 + _local13);
rca.y = (_local4 + _local14);
rcb.x = (_local3 - _local11);
rcb.y = (_local4 - _local12);
} else {
if (_arg2 == 3){
rca.x = (_local3 - _local11);
rca.y = (_local4 - _local12);
rcb.x = (_local3 - _local13);
rcb.y = (_local4 - _local14);
};
};
};
};
}
}
}//package ape
Section 18
//Vector (ape.Vector)
package ape {
public class Vector {
public var y:Number;
public var x:Number;
public static var totalVector:int = 0;
public function Vector(_arg1:Number=0, _arg2:Number=0){
x = _arg1;
y = _arg2;
totalVector++;
}
public function cross(_arg1:Vector):Number{
return (((x * _arg1.y) - (y * _arg1.x)));
}
public function times(_arg1:Vector):Vector{
return (new Vector((x * _arg1.x), (y * _arg1.y)));
}
public function dot(_arg1:Vector):Number{
return (((x * _arg1.x) + (y * _arg1.y)));
}
public function normalize():void{
var _local1:Number;
_local1 = length;
if (_local1 == 0){
_local1 = 0.0001;
};
_local1 = (1 / _local1);
x = (x * _local1);
y = (y * _local1);
}
public function getTimes(_arg1:Vector, _arg2:Vector):void{
_arg2.x = (x * _arg1.x);
_arg2.y = (y * _arg1.y);
}
public function minus(_arg1:Vector):Vector{
trace("use getMinus better");
return (new Vector((x - _arg1.x), (y - _arg1.y)));
}
public function minusEquals(_arg1:Vector):Vector{
x = (x - _arg1.x);
y = (y - _arg1.y);
return (this);
}
public function getPlus(_arg1:Vector, _arg2:Vector):void{
_arg2.x = (x + _arg1.x);
_arg2.y = (y + _arg1.y);
}
public function plus(_arg1:Vector):Vector{
trace("use getPlus better");
return (new Vector((x + _arg1.x), (y + _arg1.y)));
}
public function multEquals(_arg1:Number):Vector{
x = (x * _arg1);
y = (y * _arg1);
return (this);
}
public function getMult(_arg1:Number, _arg2:Vector):void{
_arg2.x = (x * _arg1);
_arg2.y = (y * _arg1);
}
public function toString():String{
return (((x + " : ") + y));
}
public function get length():Number{
return (Math.sqrt(((x * x) + (y * y))));
}
public function getNormalize(_arg1:Vector):void{
var _local2:Number;
_local2 = length;
if (_local2 == 0){
_local2 = 0.0001;
};
_local2 = (1 / _local2);
_arg1.x = (_arg1.x * _local2);
_arg1.y = (_arg1.y * _local2);
}
public function mult(_arg1:Number):Vector{
return (new Vector((x * _arg1), (y * _arg1)));
}
public function copy(_arg1:Vector):void{
x = _arg1.x;
y = _arg1.y;
}
public function plusEquals(_arg1:Vector):Vector{
x = (x + _arg1.x);
y = (y + _arg1.y);
return (this);
}
public function getMinus(_arg1:Vector, _arg2:Vector):void{
_arg2.x = (x - _arg1.x);
_arg2.y = (y - _arg1.y);
}
public function setTo(_arg1:Number, _arg2:Number):void{
x = _arg1;
y = _arg2;
}
public function divEquals(_arg1:Number):Vector{
if (_arg1 == 0){
_arg1 = 0.0001;
};
x = (x / _arg1);
y = (y / _arg1);
return (this);
}
public static function distance(_arg1:Vector, _arg2:Vector):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 toAngle(_arg1:Vector, _arg2:Vector):Number{
return (Math.atan2(_arg1.cross(_arg2), _arg1.dot(_arg2)));
}
public static function distance2(_arg1:Vector, _arg2:Vector):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 getIntersection(_arg1:Vector, _arg2:Vector, _arg3:Vector, _arg4:Vector, _arg5:Vector):void{
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
_local6 = _arg1.cross(_arg3);
_local7 = _arg2.cross(_arg4);
_local8 = _arg3.cross(_arg2);
_local9 = _arg4.cross(_arg1);
_local10 = _arg3.cross(_arg4);
_local11 = (((_local6 + _local10) + _local9) / (((_local6 + _local7) + _local8) + _local9));
_arg5.x = ((_arg1.x * (1 - _local11)) + (_arg2.x * _local11));
_arg5.y = ((_arg1.y * (1 - _local11)) + (_arg2.y * _local11));
}
}
}//package ape
Section 19
//WheelParticle (ape.WheelParticle)
package ape {
import flash.display.*;
public class WheelParticle extends CircleParticle {
private var _traction:Number;
private var normSlip:Vector;
private var tan:Vector;
private var rp:RimParticle;
private var orientation:Vector;
private static var combinedVelocity:Vector = new Vector();
private static var tp:Vector = new Vector();
private static var wheelSurfaceVelocity:Vector = new Vector();
public function WheelParticle(_arg1:Sprite, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Boolean=false, _arg6:Number=1, _arg7:Number=0.3, _arg8:Number=0, _arg9:Number=1){
super(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8);
tan = new Vector(0, 0);
normSlip = new Vector(0, 0);
rp = new RimParticle(_arg4, 2);
this.traction = _arg9;
orientation = new Vector();
}
public function set speed(_arg1:Number):void{
rp.speed = _arg1;
}
override function resolveCollision(_arg1:Vector, _arg2:Vector, _arg3:Vector, _arg4:Number, _arg5:int, _arg6:AbstractParticle):void{
var _local7:Number;
super.resolveCollision(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6);
_local7 = MathUtil.sign((_arg4 * _arg5));
tp.x = (_arg3.x * _local7);
tp.y = (_arg3.y * _local7);
resolve(tp);
}
public function get radian():Number{
orientation.setTo(rp.curr.x, rp.curr.y);
return ((Math.atan2(orientation.y, orientation.x) + Math.PI));
}
public function get traction():Number{
return ((1 - _traction));
}
public function get speed():Number{
return (rp.speed);
}
override public function update(_arg1:Number):void{
super.update(_arg1);
rp.update(_arg1);
}
public function set angularVelocity(_arg1:Number):void{
rp.angularVelocity = _arg1;
}
override function paint():void{
sprite.x = curr.x;
sprite.y = curr.y;
sprite.rotation = angle;
}
public function get angularVelocity():Number{
return (rp.angularVelocity);
}
private function resolve(_arg1:Vector):void{
var _local2:Number;
var _local3:Number;
var _local4:Number;
tan.setTo(-(rp.curr.y), rp.curr.x);
tan.normalize();
_local2 = rp.speed;
wheelSurfaceVelocity.x = (tan.x * _local2);
wheelSurfaceVelocity.y = (tan.y * _local2);
getVelocity(combinedVelocity);
combinedVelocity.x = (combinedVelocity.x + wheelSurfaceVelocity.x);
combinedVelocity.y = (combinedVelocity.y + wheelSurfaceVelocity.y);
_local3 = combinedVelocity.cross(_arg1);
tan.multEquals(_local3);
rp.prev.x = (rp.curr.x - tan.x);
rp.prev.y = (rp.curr.y - tan.y);
_local4 = ((1 - _traction) * rp.speed);
normSlip.setTo((_local4 * _arg1.y), (_local4 * _arg1.x));
curr.plusEquals(normSlip);
rp.speed = (rp.speed * _traction);
}
public function get angle():Number{
return ((radian * MathUtil.ONE_EIGHTY_OVER_PI));
}
public function set traction(_arg1:Number):void{
_traction = (1 - _arg1);
}
}
}//package ape
Section 20
//Circle (apeSp.Circle)
package apeSp {
import flash.display.*;
import ape.*;
import flash.geom.*;
public class Circle extends PhSp {
public var chuizi_mc:MovieClip;
public var hit1_mc:MovieClip;
public var hit2_mc:MovieClip;
override public function init(_arg1:GroupSp):void{
var _local2:Rectangle;
super.init(_arg1);
_local2 = this.getBounds(this);
particle = new CircleParticle(this, this.x, this.y, ((this.scaleX * _local2.width) / 2), fixed, mass, elasticity, friction);
}
override public function update():void{
var _local1:Rectangle;
var _local2:Point;
var _local3:Point;
_local1 = this.getBounds(this);
_local2 = APEngine.container.globalToLocal(this.localToGlobal(new Point((_local1.x + (_local1.width / 2)), (_local1.y + (_local1.height / 2)))));
_local3 = APEngine.container.globalToLocal(this.localToGlobal(new Point((_local1.x + _local1.width), _local1.y)));
particle.radius = Point.distance(_local2, _local3);
particle.position = new Vector(_local2.x, _local2.y);
}
}
}//package apeSp
Section 21
//Circle2 (apeSp.Circle2)
package apeSp {
public dynamic class Circle2 extends Circle {
}
}//package apeSp
Section 22
//GroupSp (apeSp.GroupSp)
package apeSp {
import flash.display.*;
import ape.*;
import flash.events.*;
import flash.geom.*;
public class GroupSp extends Sprite {
public var group:Group;
private static var __tempGroupSp:GroupSp;
public function GroupSp(){
var _local1:Array;
var _local2:Array;
var _local3:*;
var _local4:Spring;
super();
_local1 = new Array();
_local2 = new Array();
for each (_local3 in getAllChildren(this)) {
if (_local3.parent == this){
_local3.x = (_local3.x + this.x);
_local3.y = (_local3.y + this.y);
};
if ((_local3 is PhSp)){
_local1.push(_local3);
_local3.init(this);
} else {
if ((_local3 is Spring)){
_local2.push(_local3);
};
};
};
this.x = (this.y = 0);
this.rotation = 0;
APEngine.addGroup((group = Group.makeGroup(_local1)));
group.groupSp = this;
for each (_local4 in _local2) {
_local4.init(this);
};
this.addEventListener(Event.REMOVED_FROM_STAGE, removed, false, 0, true);
}
public function set posX(_arg1):void{
setPos("x", "width", _arg1);
}
public function set posY(_arg1:Number):void{
setPos("y", "height", _arg1);
}
public function getPos(_arg1:String, _arg2:String):Number{
var _local3:Rectangle;
_local3 = this.getBounds(this.parent);
return ((_local3[_arg1] + (_local3[_arg2] / 2)));
}
public function set collidableList(_arg1:String):void{
var arr:Array;
var i:int;
var groupName:String;
var _collidableList = _arg1;
try {
if (_collidableList.length > 0){
arr = _collidableList.split(",");
i = -1;
for each (groupName in arr) {
i = (i + 1);
var _local5:int = (i + 1);
arr[_local5] = GroupSp(this.parent[groupName]).group;
};
group.addCollidableList(arr);
};
} catch(e) {
trace("碰撞列表出错");
};
}
public function removed(_arg1:Event=null):void{
trace((this + "删掉的group"));
}
public function get posX():Number{
return (getPos("x", "width"));
}
public function setPos(_arg1:String, _arg2:String, _arg3:Number):void{
var _local4:Rectangle;
var _local5:Number;
var _local6:AbstractParticle;
var _local7:Vector;
_local4 = this.getBounds(this.parent);
_local5 = (_arg3 - (_local4[_arg1] + (_local4[_arg2] / 2)));
for each (_local6 in group.particles) {
_local7 = _local6.position;
_local7[_arg1] = (_local7[_arg1] + _local5);
_local6.position = _local7;
};
}
public function get posY():Number{
return (getPos("y", "height"));
}
public function addSp(_arg1):void{
if ((_arg1 is PhSp)){
this.addChild(_arg1);
_arg1.init(this);
group.addParticle(_arg1.particle);
} else {
if ((_arg1 is Spring)){
this.addChild(_arg1);
_arg1.init(this);
group.addConstraint(_arg1.c);
} else {
trace((("sp=" + _arg1) + ",不能加入除PhSp和Spring外的东西"));
return;
};
};
}
public static function getAllChildren(_arg1:Sprite):Array{
var _local2:Number;
var _local3:Array;
var _local4:*;
_local2 = _arg1.numChildren;
_local3 = new Array();
while (--_local2 >= 0) {
_local4 = _arg1.getChildAt(_local2);
_local3.push(_local4);
if ((_local4 is Sprite)){
_local3 = _local3.concat(getAllChildren(_local4));
};
};
return (_local3);
}
public static function get tempGroupSp():GroupSp{
if (__tempGroupSp == null){
__tempGroupSp = new (GroupSp);
trace(("APEngine.container=" + APEngine.container));
APEngine.container.addChild(__tempGroupSp);
};
return (__tempGroupSp);
}
}
}//package apeSp
Section 23
//PhSp (apeSp.PhSp)
package apeSp {
import flash.display.*;
import ape.*;
import flash.events.*;
import flash.geom.*;
public class PhSp extends MovieClip {
public var groupSp:GroupSp;
private var __particle;
public var onHitGroupSp:Function;
private var __elasticity:Number;
private var __fixed:Boolean;
public var onHitSp:Function;
private var __mass:Number;
private var __friction:Number;
public function PhSp(){
super();
onHitSp = function (){
};
onHitGroupSp = function (){
};
fixed = false;
mass = 1;
elasticity = 0.3;
friction = 0;
this.addEventListener(Event.ADDED_TO_STAGE, added, false, 0, true);
this.addEventListener(Event.REMOVED_FROM_STAGE, removed, false, 0, true);
}
public function added(_arg1:Event=null):void{
var _parent:*;
var event = _arg1;
this.removeEventListener(Event.ADDED_TO_STAGE, added);
_parent = this;
while ((_parent = _parent.parent)) {
if ((_parent is GroupSp)){
return;
};
};
try {
init(GroupSp.tempGroupSp);
GroupSp.tempGroupSp.group.addParticle(particle);
trace((this + "自成一组"));
} catch(e) {
trace("加入tempGroupSp不成功");
};
}
public function get friction():Number{
if (particle){
return (particle.friction);
};
return (__friction);
}
public function set movable(_arg1:Boolean):void{
if (_arg1){
this.addEventListener(Event.ENTER_FRAME, movRun, false, 0, true);
} else {
this.removeEventListener(Event.ENTER_FRAME, movRun);
};
}
public function init(_arg1:GroupSp):void{
groupSp = _arg1;
}
public function set particle(_arg1):void{
__particle = _arg1;
__particle.sp = this;
__particle.onHitParticle = hitParticle;
__particle.onHitGroup = hitGroup;
}
public function get mass():Number{
if (particle){
return (particle.mass);
};
return (__mass);
}
public function set friction(_arg1:Number):void{
__friction = _arg1;
if (particle){
particle.friction = __friction;
};
}
private function hitParticle(_arg1:AbstractParticle):void{
onHitSp(_arg1.sp);
}
public function get fixed():Boolean{
if (particle){
return (particle.fixed);
};
return (__fixed);
}
public function set elasticity(_arg1:Number):void{
__elasticity = _arg1;
if (particle){
particle.elasticity = __elasticity;
};
}
public function get particle(){
return (__particle);
}
public function removed(_arg1:Event=null):void{
trace("remove this");
groupSp.group.removeParticle(particle);
this.removeEventListener(Event.ENTER_FRAME, movRun);
}
private function hitGroup(_arg1:Group):void{
onHitGroupSp(_arg1.groupSp);
}
public function get elasticity():Number{
if (particle){
return (particle.elasticity);
};
return (__elasticity);
}
public function update():void{
}
private function movRun(_arg1:Event=null):void{
update();
}
public function getPToParent(_arg1:Point):Point{
return (this.transform.matrix.transformPoint(_arg1));
}
public function set fixed(_arg1:Boolean):void{
__fixed = _arg1;
if (particle){
particle.fixed = __fixed;
};
}
public function set mass(_arg1:Number):void{
__mass = _arg1;
if (particle){
particle.mass = __mass;
};
}
}
}//package apeSp
Section 24
//Rect (apeSp.Rect)
package apeSp {
import flash.display.*;
import ape.*;
import flash.geom.*;
public class Rect extends PhSp {
private static const p0:Point = new Point();
override public function init(_arg1:GroupSp):void{
var _local2:Number;
super.init(_arg1);
_local2 = this.rotation;
this.rotation = 0;
particle = new RectangleParticle(this, this.x, this.y, this.width, this.height, (_local2 * (Math.PI / 180)), fixed, mass, elasticity, friction);
this.rotation = _local2;
}
override public function update():void{
var _local1:Rectangle;
var _local2:Point;
var _local3:Point;
var _local4:Point;
var _local5:Number;
var _local6:Number;
_local1 = this.getBounds(this);
_local2 = APEngine.container.globalToLocal(this.localToGlobal(new Point(_local1.x, _local1.y)));
_local3 = APEngine.container.globalToLocal(this.localToGlobal(new Point((_local1.x + _local1.width), _local1.y)));
_local4 = APEngine.container.globalToLocal(this.localToGlobal(new Point(_local1.x, (_local1.y + _local1.height))));
_local5 = (_local3.x - _local2.x);
_local6 = (_local4.y - _local2.y);
particle.width = Math.abs(_local5);
particle.height = Math.abs(_local6);
particle.position = new Vector(((_local3.x + _local4.x) / 2), ((_local3.y + _local4.y) / 2));
particle.radian = Math.atan2((_local3.y - _local2.y), _local5);
}
}
}//package apeSp
Section 25
//Spring (apeSp.Spring)
package apeSp {
import flash.display.*;
import ape.*;
import flash.events.*;
import flash.geom.*;
public class Spring extends Sprite {
public var fixArr:Array;
private var hitRect:Sprite;
public var p2_mc:MovieClip;
public var gaizi_mc:MovieClip;
public var groupSp:GroupSp;
public var stiffness:Number;// = 0.5
public var wSet1_mc:MovieClip;
public var c;
public var joinP1:Point;
public var joinP2:Point;
public var wSet2_mc:MovieClip;
public var hit_mc:MovieClip;
public var p1_mc:MovieClip;
public function Spring(){
stiffness = 0.5;
super();
this.addEventListener(Event.REMOVED_FROM_STAGE, removed, false, 0, true);
fixArr = new Array();
}
public function init(_arg1:GroupSp):void{
groupSp = _arg1;
}
public function set joinP2Str(_arg1:String):void{
var _local2:Rectangle;
joinP2 = getPByStr(_arg1);
if (joinP2 == null){
_local2 = this.getBounds(this);
joinP2 = new Point((_local2.x + _local2.width), (_local2.y + (_local2.height / 2)));
};
}
public function addFixP(_arg1:Spring, _arg2:Point):Circle{
var _local3:Matrix;
var _local4:*;
var _local5:FixNode;
_local3 = this.transform.matrix;
_local3.invert();
_arg2 = _local3.transformPoint(_arg1.transform.matrix.transformPoint(_arg2));
_local4 = newCircle(_arg2);
_local5 = new FixNode(_local4, _arg2);
fixArr.push(_local5);
return (_local5.p);
}
public function join(_arg1, _arg2):void{
var _local3:Number;
var _local4:Rectangle;
if (hitRect){
_local3 = hitRect.height;
} else {
_local4 = this.getBounds(this);
_local3 = _local4.height;
};
if ((_arg1 is PhSp)){
_arg1 = _arg1.particle;
};
if ((_arg2 is PhSp)){
_arg2 = _arg2.particle;
};
c = new SpringConstraint(this, _arg1, _arg2, joinP1, joinP2, stiffness, true, _local3);
groupSp.group.addConstraint(c);
}
public function set joinP1Str(_arg1:String):void{
var _local2:Rectangle;
joinP1 = getPByStr(_arg1);
if (joinP1 == null){
_local2 = this.getBounds(this);
joinP1 = new Point(_local2.x, (_local2.y + (_local2.height / 2)));
};
}
public function removed(_arg1:Event=null):void{
groupSp.group.removeConstraint(c);
}
public function set phSpList(_arg1:String):void{
var phSpArr:Array;
var p1:*;
var p2:*;
var _phSpList = _arg1;
if (c){
trace("设置连接的物体无效");
return;
};
if (_phSpList.length > 0){
phSpArr = _phSpList.split(",");
try {
p1 = groupSp[phSpArr[0]];
if ((p1 is Spring)){
trace(("joinP1=" + joinP1));
p1 = p1.addFixP(this, joinP1);
trace(("p1=" + p1));
};
} catch(e) {
trace(("e=" + e));
trace("设置连接的物体1无效");
p1 = getNearSp(joinP1);
if (p1 == null){
trace("p1尝试自动连接失败,创建一个新的关节");
p1 = newCircle(joinP1);
};
};
try {
p2 = groupSp[phSpArr[1]];
if ((p2 is Spring)){
trace(("joinP2=" + joinP2));
p2 = p2.addFixP(joinP2);
};
} catch(e) {
trace(("e=" + e));
trace("设置连接的物体2无效");
p2 = getNearSp(joinP2);
if (p2 == null){
trace("p2尝试自动连接失败,创建一个新的关节");
p2 = newCircle(joinP2);
};
};
join(p1, p2);
};
}
public function newCircle(_arg1:Point):Circle{
var _local2:Circle;
_arg1 = this.transform.matrix.transformPoint(_arg1);
_local2 = new Circle();
_local2.x = _arg1.x;
_local2.y = _arg1.y;
groupSp.addSp(_local2);
return (_local2);
}
public function set hitRectName(_arg1:String):void{
if (_arg1 != ""){
hitRect = this[_arg1];
};
}
public function updateFixPs():void{
var _local1:FixNode;
var _local2:Point;
for each (_local1 in fixArr) {
_local2 = APEngine.container.globalToLocal(this.localToGlobal(_local1.pt));
_local1.p.x = (_local1.p.particle.px = _local2.x);
_local1.p.y = (_local1.p.particle.py = _local2.y);
};
}
public function getNearSp(_arg1:Point, _arg2:Number=5):PhSp{
var _local3:Number;
var _local4:int;
var _local5:*;
var _local6:Number;
var _local7:Number;
_local3 = (_arg2 * _arg2);
_arg1 = this.transform.matrix.transformPoint(_arg1);
_local4 = groupSp.numChildren;
while (--_local4 >= 0) {
_local5 = parent.getChildAt(_local4);
if ((_local5 is PhSp)){
_local6 = (_local5.x - _arg1.x);
_local7 = (_local5.y - _arg1.y);
if (((_local6 * _local6) + (_local7 * _local7)) <= _local3){
return (_local5);
};
};
};
return (null);
}
private function getPByStr(_arg1:String):Point{
var _local2:Array;
var _local3:*;
var _local4:Number;
var _local5:Number;
_local2 = _arg1.split(",");
switch (_local2.length){
case 1:
_local3 = this[_local2[0]];
if (_local3){
return (new Point(_local3.x, _local3.y));
};
break;
case 2:
_local4 = Number(_local2[0]);
_local5 = Number(_local2[1]);
if (((isNaN(_local4)) || (isNaN(_local5)))){
return (null);
};
return (new Point(_local4, _local5));
};
return (null);
}
public function update():void{
updateFixPs();
}
public function set autoJoin(_arg1:Boolean):void{
var _local2:PhSp;
var _local3:PhSp;
if (c){
trace("设置自动连接无效");
return;
};
_local2 = getNearSp(joinP1);
if (_local2 == null){
trace("p1尝试自动连接失败,创建一个新的关节");
_local2 = newCircle(joinP1);
};
_local3 = getNearSp(joinP2);
if (_local3 == null){
trace("p2尝试自动连接失败,创建一个新的关节");
_local3 = newCircle(joinP2);
};
join(_local2, _local3);
}
}
}//package apeSp
import flash.geom.*;
class FixNode {
public var p:Circle;
public var pt:Point;
private function FixNode(_arg1, _arg2:Point){
p = _arg1;
pt = _arg2;
trace(("pt=" + pt));
}
}
Section 26
//Wheel (apeSp.Wheel)
package apeSp {
import flash.display.*;
import ape.*;
import flash.geom.*;
public class Wheel extends PhSp {
private var __traction:Number;
public var lunzi_mc:MovieClip;
override public function init(_arg1:GroupSp):void{
var _local2:Rectangle;
super.init(_arg1);
_local2 = this.getBounds(this);
particle = new WheelParticle(this, this.x, this.y, ((this.scaleX * _local2.width) / 2), fixed, mass, elasticity, friction);
}
public function get traction():Number{
if (particle){
return (particle.traction);
};
return (__traction);
}
public function set traction(_arg1:Number):void{
__traction = _arg1;
if (particle){
particle.traction = __traction;
};
}
override public function update():void{
var _local1:Rectangle;
var _local2:Point;
var _local3:Point;
_local1 = this.getBounds(this);
_local2 = APEngine.container.globalToLocal(this.localToGlobal(new Point((_local1.x + (_local1.width / 2)), (_local1.y + (_local1.height / 2)))));
_local3 = APEngine.container.globalToLocal(this.localToGlobal(new Point((_local1.x + _local1.width), _local1.y)));
particle.radius = Point.distance(_local2, _local3);
particle.position = new Vector(_local2.x, _local2.y);
}
}
}//package apeSp
Section 27
//Building (computer.Building)
package computer {
import flash.display.*;
import manage.*;
public class Building extends MovieClip {
private var myType:int;
private var addScore:int;
public function Building(){
Global.addRun((this.name + ".run()"), run);
}
public function removeThis(){
if (parent){
Global.delRun(run);
parent.removeChild(this);
};
}
public function die(){
var _local1:BoooB1;
var _local2:MovieClip;
var _local3:MovieClip;
Global.delRun(run);
GameManage.gameCtrl.addScore((this.addScore + (GameManage.gameCtrl.level * 20)));
if (this.myType == 1){
GlobalCtrl.createUpFire(this);
_local1 = new BoooB1();
_local1.x = this.x;
_local1.y = this.y;
_local1.gotoAndStop(this.currentFrame);
GameManage.Game.map_mc.car.dieArray_mc.addChild(_local1);
Main.playSound("za_s");
new Exp(_local1);
if (parent){
ScreenShake.shake(root);
GlobalCtrl.createBuildBad(this);
};
};
if (this.myType < 3){
switch (this.myType){
case 1:
_local2 = new bad1();
_local2.gotoAndStop(((CommonManage.rand(4) + 1) + ((this.currentFrame - 1) * 4)));
break;
case 2:
_local2 = new bad2();
break;
};
_local2.x = this.x;
_local2.y = this.y;
GameManage.Game.map_mc.car.bulidingDieArray_mc.addChild(_local2);
} else {
GlobalCtrl.createBoooFire(this);
switch (this.myType){
case 3:
_local3 = new Booobcar1();
break;
case 4:
_local3 = new Booobcar2();
break;
case 5:
_local3 = new Booobcar3();
break;
case 6:
_local3 = new Booobcar4();
break;
case 7:
_local3 = new Booobcar5();
break;
};
_local3.x = this.x;
_local3.y = this.y;
GameManage.Game.map_mc.car.dieArray_mc.addChild(_local3);
new Exp(_local3);
if (parent){
ScreenShake.shake(root);
};
};
this.removeThis();
}
public function run(){
var _local1:*;
if (parent){
_local1 = CommonManage.to_global(this.parent, this.x, this.y);
if (_local1.x < -100){
this.removeThis();
};
};
}
public function setType(_arg1:int){
this.myType = _arg1;
switch (_arg1){
case 1:
this.addScore = 150;
break;
case 2:
this.addScore = 80;
break;
case 3:
this.addScore = 50;
break;
case 4:
this.addScore = 100;
break;
case 5:
this.addScore = 120;
break;
case 6:
this.addScore = 100;
break;
case 7:
this.addScore = 90;
break;
};
}
}
}//package computer
Section 28
//Computer (computer.Computer)
package computer {
import flash.display.*;
public class Computer extends MovieClip {
public var hp:int;
public var attackTime:int;
public var hpMax:int;
public var attack:int;
public var speed:int;
public var level:int;
public var attackLen:int;
public var attackSpeed:int;
}
}//package computer
Section 29
//PeopleLife (computer.PeopleLife)
package computer {
import flash.display.*;
import manage.*;
public class PeopleLife extends MovieClip {
public var yan_mc:MovieClip;
public function PeopleLife(){
this.gotoAndStop((CommonManage.rand(this.totalFrames) + 1));
this.cacheAsBitmap = true;
Global.addRun((("peopleLife_" + this.name) + ".run()"), run);
}
public function removeThis(){
if (yan_mc){
yan_mc.stop();
};
if (parent){
Global.delRun(run);
parent.removeChild(this);
};
}
public function run(){
var _local1:*;
_local1 = CommonManage.to_global(this.parent, this.x, this.y);
if (_local1.x < -100){
this.removeThis();
};
}
}
}//package computer
Section 30
//Plane (computer.Plane)
package computer {
import flash.display.*;
import manage.*;
public class Plane extends Computer {
public var isAttack:Boolean;
public var fangxiang:int;
public var fire1_mc:MovieClip;
public var fire2_mc:MovieClip;
public function Plane(){
this.init();
Global.addRun((this.name + ".run()"), run);
}
public function init(){
this.isAttack = false;
this.attackTime = (CommonManage.rand(10) + 28);
this.hpMax = 150;
this.attack = 4;
this.speed = 18;
this.attackSpeed = 50;
this.attackLen = (CommonManage.rand(40) + 150);
}
public function fire(){
var _local1:Object;
var _local2:Object;
var _local3:Object;
var _local4:PlaneFire;
var _local5:*;
this.isAttack = true;
this.attackTime = 0;
_local1 = CommonManage.to_global(this.fire1_mc.parent, this.fire1_mc.x, this.fire1_mc.y);
_local2 = CommonManage.to_global(this.fire2_mc.parent, this.fire2_mc.x, this.fire2_mc.y);
_local3 = ExtMath.countMoveLen(_local1, _local2, 6);
_local4 = new PlaneFire();
_local4.setObj(_local3.x, _local3.y);
_local5 = CommonManage.to_local(GameManage.Game.map_mc.car.throwArray_mc, _local2.x, _local2.y);
_local4.x = _local5.x;
_local4.y = _local5.y;
if (this.fangxiang == 2){
_local4.scaleX = -1;
};
GameManage.Game.map_mc.car.throwArray_mc.addChild(_local4);
}
public function removeThis(){
if (parent){
Global.delRun(run);
parent.removeChild(this);
};
}
public function die(){
}
public function run(){
var _local1:*;
this.x = (this.x - this.speed);
if (this.isAttack){
this.y = (this.y - 8);
} else {
this.y = (this.y + 14);
this.attackTime++;
if (this.attackTime >= this.attackSpeed){
this.fire();
};
};
if (parent){
_local1 = CommonManage.to_global(this.parent, this.x, this.y);
if ((((_local1.x < -100)) || ((_local1.x > 900)))){
this.removeThis();
};
};
}
public function setFangxiang(_arg1:int){
this.fangxiang = _arg1;
if (this.fangxiang == 1){
this.x = (890 - GameManage.Game.map_mc.x);
} else {
this.speed = (this.speed * -1);
this.scaleX = -1;
this.x = (-80 - GameManage.Game.map_mc.x);
};
this.y = -100;
}
}
}//package computer
Section 31
//PlaneFire (computer.PlaneFire)
package computer {
import flash.display.*;
import manage.*;
public class PlaneFire extends MovieClip {
private var power:int;
private var flyObj:Object;
public function PlaneFire(){
addFrameScript(0, frame1, 17, frame18);
this.power = 25;
Global.addRun((this.name + ".run()"), run);
}
public function setObj(_arg1:Number, _arg2:Number){
this.flyObj = new Object();
this.flyObj.x = _arg1;
this.flyObj.y = _arg2;
Global.addRun((this.name + ".run()"), run);
}
function frame18(){
this.die();
}
function frame1(){
stop();
}
public function die(){
if (parent){
parent.removeChild(this);
Global.delRun(run);
};
}
public function run(){
var _local1:*;
if (this.flyObj){
this.x = (this.x + this.flyObj.x);
this.y = (this.y + this.flyObj.y);
};
_local1 = CommonManage.to_global(GameManage.Game.map_mc.car.throwArray_mc, this.x, this.y);
if (GameManage.car.hitTestPoint(_local1.x, _local1.y, true)){
GameManage.car.removeLife(this.power);
Global.delRun(run);
this.gotoAndPlay(2);
};
if (_local1.y > 455){
ScreenShake.shake(root);
Global.delRun(run);
this.gotoAndPlay(2);
};
if ((((_local1.x > 800)) || ((_local1.x < 0)))){
this.die();
};
}
}
}//package computer
Section 32
//Tank (computer.Tank)
package computer {
import flash.display.*;
import manage.*;
public class Tank extends Computer {
public var hitTime:int;
public var myType:int;
public var isAttack:Boolean;
public var fangxiang:int;
public var cancelObj:Object;
public var myState:int;
public var body_mc:MovieClip;
private var addScore:int;
public var fire1_mc:MovieClip;
public var fire2_mc:MovieClip;
public static var tankSum:int = 0;
public static var pDieNum:int = 0;
public static var peopleSum:int = 0;
public function Tank(){
this.hitTime = 0;
this.isAttack = false;
this.myState = 1;
}
public function run2(){
this.cancelObj = CommonManage.getBoundsToCenter(this.body_mc, root);
if ((((this.isAttack == false)) && ((this.myState == 1)))){
if (this.cancelObj.x < (GameManage.car.cancelObj.x - this.attackLen)){
if (((!((this.body_mc.currentFrame == 1))) && ((this.myState == 1)))){
this.body_mc.gotoAndStop(1);
};
this.x = (this.x + this.speed);
} else {
if (this.cancelObj.x > (GameManage.car.cancelObj.x - 150)){
if (((!((this.body_mc.currentFrame == 1))) && ((this.myState == 1)))){
this.body_mc.gotoAndStop(1);
};
this.x = (this.x - this.speed);
} else {
if (this.isAttack == false){
if (this.body_mc.currentFrame != 2){
this.body_mc.gotoAndStop(2);
};
this.attackTime++;
if (this.attackTime >= this.attackSpeed){
this.isAttack = true;
this.fire();
};
};
};
};
if (this.cancelObj.x < -100){
this.x = (this.x + 1100);
this.scaleX = 1;
this.fangxiang = 1;
Global.delRun(run2);
Global.addRun((this.name + ".run()"), run);
};
} else {
if (this.cancelObj.x < -100){
this.remove();
};
};
if (this.hitTime > 0){
this.hitTime--;
};
if (this.myType == 0){
if (this.cancelObj.x > (GameManage.car.cancelObj.x - 100)){
this.removeHp(10);
};
};
}
public function xue(){
if (Tank.pDieNum == 10){
GameManage.car.w1_mc.lunzi_mc.gotoAndStop(2);
GameManage.car.w2_mc.lunzi_mc.gotoAndStop(2);
if (GameManage.car.h1_mc.chuizi_mc.tou_mc){
GameManage.car.h1_mc.chuizi_mc.tou_mc.gotoAndStop(2);
};
} else {
if (Tank.pDieNum == 25){
GameManage.car.w1_mc.lunzi_mc.gotoAndStop(3);
GameManage.car.w2_mc.lunzi_mc.gotoAndStop(3);
if (GameManage.car.h1_mc.chuizi_mc.tou_mc){
GameManage.car.h1_mc.chuizi_mc.tou_mc.gotoAndStop(3);
};
} else {
if (Tank.pDieNum == 50){
GameManage.car.w1_mc.lunzi_mc.gotoAndStop(4);
GameManage.car.w2_mc.lunzi_mc.gotoAndStop(4);
if (GameManage.car.h1_mc.chuizi_mc.tou_mc){
GameManage.car.h1_mc.chuizi_mc.tou_mc.gotoAndStop(4);
};
} else {
if (Tank.pDieNum == 80){
GameManage.car.w1_mc.lunzi_mc.gotoAndStop(5);
GameManage.car.w2_mc.lunzi_mc.gotoAndStop(5);
if (GameManage.car.h1_mc.chuizi_mc.tou_mc){
GameManage.car.h1_mc.chuizi_mc.tou_mc.gotoAndStop(5);
};
} else {
if (Tank.pDieNum == 100){
GameManage.car.w1_mc.lunzi_mc.gotoAndStop(6);
GameManage.car.w2_mc.lunzi_mc.gotoAndStop(6);
if (GameManage.car.h1_mc.chuizi_mc.tou_mc){
GameManage.car.h1_mc.chuizi_mc.tou_mc.gotoAndStop(6);
};
};
};
};
};
};
}
public function fire(){
this.attackTime = 0;
this.isAttack = true;
this.body_mc.gotoAndStop(3);
}
public function initT(){
switch (this.myType){
case 0:
this.hpMax = 1;
this.attack = 1;
this.speed = 3;
this.addScore = 50;
this.attackSpeed = 20;
this.attackLen = (CommonManage.rand(40) + 150);
break;
case 1:
this.hpMax = (100 + (GameManage.gameCtrl.level * 20));
this.attack = (4 + int((GameManage.gameCtrl.level / 3)));
this.speed = 6;
this.addScore = 80;
this.attackSpeed = 50;
this.attackLen = (CommonManage.rand(50) + 220);
break;
case 2:
this.hpMax = (200 + (GameManage.gameCtrl.level * 20));
this.attack = (5 + int((GameManage.gameCtrl.level / 2)));
this.speed = 8;
this.addScore = 120;
this.attackSpeed = 40;
this.attackLen = (CommonManage.rand(50) + 260);
break;
case 3:
this.hpMax = (300 + (GameManage.gameCtrl.level * 20));
this.attack = (5 + GameManage.gameCtrl.level);
this.speed = 7;
this.addScore = 150;
this.attackSpeed = 60;
this.attackLen = (CommonManage.rand(50) + 210);
break;
};
this.hp = this.hpMax;
this.attackTime = this.attackSpeed;
}
public function peopleFire(){
GameManage.car.removeLife(this.attack);
}
public function addHp(){
}
public function hitMy(_arg1:Number){
if (this.hitTime <= 0){
this.removeHp(_arg1);
this.hitTime = 5;
};
}
public function removeHp(_arg1:Number){
var _local2:BoooTank1;
var _local3:PeopleLife2;
var _local4:PeopleLife1;
if (this.myType != 0){
Main.playSound("za_s");
if (parent){
ScreenShake.shake(root);
};
};
this.hp = (this.hp - _arg1);
if ((((this.hp <= this.hpMax)) && ((this.myState == 1)))){
this.myState = 2;
if (this.body_mc.currentFrame != 2){
this.body_mc.gotoAndStop(2);
} else {
if (this.body_mc.budong_mc){
this.body_mc.budong_mc.gotoAndStop(2);
} else {
trace("sdrg");
};
};
};
if (this.hp <= 0){
if (this.myType != 0){
GlobalCtrl.createBoooFire(this);
GlobalCtrl.createBuildBad(this);
_local2 = new BoooTank1();
_local2.x = this.x;
_local2.y = this.y;
GameManage.Game.map_mc.car.dieArray_mc.addChild(_local2);
Main.playSound("za_s");
new Exp(_local2);
_local3 = new PeopleLife2();
_local3.x = this.x;
_local3.y = this.y;
GameManage.Game.map_mc.car.dieArray_mc.addChild(_local3);
this.die();
} else {
_local4 = new PeopleLife1();
_local4.x = this.x;
_local4.y = this.y;
GameManage.Game.map_mc.car.dieArray_mc.addChild(_local4);
Tank.pDieNum++;
this.xue();
this.die();
};
};
}
public function remove(){
switch (this.fangxiang){
case 1:
Global.delRun(run);
break;
case 2:
Global.delRun(run2);
break;
};
if (parent){
parent.removeChild(this);
};
}
public function die(){
GameManage.gameCtrl.addScore((this.addScore + (GameManage.gameCtrl.level * 20)));
switch (this.myType){
case 0:
Tank.peopleSum++;
Main.playSound(("death_" + CommonManage.rand(4)));
break;
case 1:
case 2:
case 3:
Tank.tankSum++;
break;
};
switch (this.fangxiang){
case 1:
Global.delRun(run);
break;
case 2:
Global.delRun(run2);
break;
};
if (parent){
parent.removeChild(this);
};
}
public function fire3(){
var _local1:Object;
var _local2:Object;
var _local3:TankFire2;
var _local4:*;
_local1 = CommonManage.to_global(this.fire1_mc.parent, this.fire1_mc.x, this.fire1_mc.y);
_local2 = CommonManage.to_global(this.fire2_mc.parent, this.fire2_mc.x, this.fire2_mc.y);
_local3 = new TankFire2();
_local3.setObj(((this.fangxiang)==1) ? -7 : 7);
_local4 = CommonManage.to_local(GameManage.Game.map_mc.car.throwArray_mc, _local2.x, _local2.y);
_local3.x = _local4.x;
_local3.y = _local4.y;
_local3.rotation = ExtMath.angleOfLine(_local1.x, _local1.y, _local2.x, _local2.y);
GameManage.Game.map_mc.car.throwArray_mc.addChild(_local3);
}
public function setType(_arg1:Number, _arg2:int):void{
this.myType = _arg1;
this.fangxiang = _arg2;
this.initT();
switch (this.fangxiang){
case 1:
Global.addRun((this.name + ".run()"), run);
break;
case 2:
this.scaleX = -1;
Global.addRun((this.name + ".run()"), run2);
break;
};
}
public function run(){
this.cancelObj = CommonManage.getBoundsToCenter(this.body_mc, root);
if ((((this.isAttack == false)) && ((this.myState == 1)))){
if (this.cancelObj.x > (GameManage.car.cancelObj.x + this.attackLen)){
if (this.body_mc.currentFrame != 1){
this.body_mc.gotoAndStop(1);
};
this.x = (this.x - this.speed);
} else {
if (this.cancelObj.x < (GameManage.car.cancelObj.x + 120)){
if (this.body_mc.currentFrame != 1){
this.body_mc.gotoAndStop(1);
};
this.x = (this.x + this.speed);
} else {
if (this.body_mc.currentFrame != 2){
this.body_mc.gotoAndStop(2);
};
this.attackTime++;
if (this.attackTime >= this.attackSpeed){
this.isAttack = true;
this.fire();
};
};
};
if (this.cancelObj.x < -100){
this.x = (this.x + 1100);
};
} else {
if (this.cancelObj.x < -100){
this.remove();
};
};
if (this.hitTime > 0){
this.hitTime--;
};
if (this.myType == 0){
if (this.cancelObj.x < (GameManage.car.cancelObj.x + 100)){
this.removeHp(10);
};
};
}
public function fire2(){
var _local1:Object;
var _local2:Object;
var _local3:Object;
var _local4:TankFire1;
var _local5:*;
_local1 = CommonManage.to_global(this.fire1_mc.parent, this.fire1_mc.x, this.fire1_mc.y);
_local2 = CommonManage.to_global(this.fire2_mc.parent, this.fire2_mc.x, this.fire2_mc.y);
_local3 = ExtMath.countMoveLen(_local1, _local2, 7);
_local4 = new TankFire1();
_local4.setObj(_local3.x, _local3.y);
_local5 = CommonManage.to_local(GameManage.Game.map_mc.car.throwArray_mc, _local2.x, _local2.y);
_local4.x = _local5.x;
_local4.y = _local5.y;
_local4.setPower(this.attack);
_local4.rotation = ExtMath.angleOfLine(_local1.x, _local1.y, _local2.x, _local2.y);
GameManage.Game.map_mc.car.throwArray_mc.addChild(_local4);
}
}
}//package computer
Section 33
//TankFire (computer.TankFire)
package computer {
import flash.display.*;
import manage.*;
public class TankFire extends MovieClip {
private var power:int;
private var flyObj:Object;
public function TankFire(){
this.power = 1;
Global.addRun((this.name + ".run()"), run);
}
public function setObj(_arg1:Number, _arg2:Number){
this.flyObj = new Object();
this.flyObj.x = _arg1;
this.flyObj.y = _arg2;
Global.addRun((this.name + ".run()"), run);
}
public function die(){
if (parent){
Global.delRun(run);
parent.removeChild(this);
};
}
public function run(){
var _local1:*;
this.x = (this.x + this.flyObj.x);
this.y = (this.y + this.flyObj.y);
_local1 = CommonManage.to_global(this.parent, this.x, this.y);
if (GameManage.car.hitTestPoint(_local1.x, _local1.y, true)){
GameManage.car.removeLife(this.power);
Global.delRun(run);
this.gotoAndPlay(2);
};
if ((((_local1.x > 800)) || ((_local1.x < 0)))){
if (parent){
Global.delRun(run);
parent.removeChild(this);
};
};
}
public function setPower(_arg1:int){
this.power = _arg1;
}
}
}//package computer
Section 34
//TankFire2 (computer.TankFire2)
package computer {
import flash.display.*;
import manage.*;
public class TankFire2 extends MovieClip {
public var power:int;
public var myObj:Object;
public function TankFire2(){
this.power = 3;
this.myObj = new Object();
Global.addRun((this.name + ".run()"), run);
}
public function setObj(_arg1:int){
this.myObj.x = _arg1;
this.myObj.y = -4;
}
public function die(){
if (parent){
parent.removeChild(this);
Global.delRun(run);
};
}
public function run(){
var _local1:*;
var _local2:*;
var _local3:*;
if (this.myObj){
_local2 = (this.x + this.myObj.x);
_local3 = (this.y + this.myObj.y);
this.rotation = ExtMath.angleOfLine(this.x, this.y, _local2, _local3);
this.x = _local2;
this.y = _local3;
this.myObj.y = (this.myObj.y + 0.2);
};
_local1 = CommonManage.to_global(GameManage.Game.map_mc.car.throwArray_mc, this.x, this.y);
if (GameManage.car.hitTestPoint(_local1.x, _local1.y, true)){
GameManage.car.removeLife(this.power);
Global.delRun(run);
this.gotoAndPlay(2);
};
if (_local1.y > 455){
ScreenShake.shake(root);
Global.delRun(run);
this.gotoAndPlay(2);
};
if ((((_local1.x > 800)) || ((_local1.x < 0)))){
this.die();
};
}
}
}//package computer
Section 35
//Btn_Add_Games_To_Your_Site (framework.btns.Btn_Add_Games_To_Your_Site)
package framework.btns {
import framework.*;
public class Btn_Add_Games_To_Your_Site extends BasicBtn {
public function Btn_Add_Games_To_Your_Site(){
action = BtnActions.ADD_GAMES_TO_YOUR_SITE;
}
}
}//package framework.btns
Section 36
//Btn_Back (framework.btns.Btn_Back)
package framework.btns {
import framework.*;
public class Btn_Back extends BasicBtn {
public function Btn_Back(){
action = BtnActions.BACK;
}
}
}//package framework.btns
Section 37
//Btn_Best (framework.btns.Btn_Best)
package framework.btns {
import framework.*;
public class Btn_Best extends BasicBtn {
public function Btn_Best(){
action = BtnActions.BEST;
}
}
}//package framework.btns
Section 38
//Btn_Copyright (framework.btns.Btn_Copyright)
package framework.btns {
import framework.*;
public class Btn_Copyright extends BasicBtn {
public function Btn_Copyright(){
action = BtnActions.COPYRIGHT;
}
}
}//package framework.btns
Section 39
//Btn_Credits (framework.btns.Btn_Credits)
package framework.btns {
import framework.*;
public class Btn_Credits extends BasicBtn {
public function Btn_Credits(){
action = BtnActions.CREDITS;
}
}
}//package framework.btns
Section 40
//Btn_Download_Games (framework.btns.Btn_Download_Games)
package framework.btns {
import framework.*;
public class Btn_Download_Games extends BasicBtn {
public function Btn_Download_Games(){
action = BtnActions.DOWNLOAD_GAMES;
}
}
}//package framework.btns
Section 41
//Btn_High (framework.btns.Btn_High)
package framework.btns {
import framework.*;
public class Btn_High extends BasicBtn {
public function Btn_High(){
action = BtnActions.HIGH;
}
}
}//package framework.btns
Section 42
//Btn_Instructions (framework.btns.Btn_Instructions)
package framework.btns {
import framework.*;
public class Btn_Instructions extends BasicBtn {
public function Btn_Instructions(){
action = BtnActions.INSTRUCTIONS;
}
}
}//package framework.btns
Section 43
//Btn_Low (framework.btns.Btn_Low)
package framework.btns {
import framework.*;
public class Btn_Low extends BasicBtn {
public function Btn_Low(){
action = BtnActions.LOW;
}
}
}//package framework.btns
Section 44
//Btn_Medium (framework.btns.Btn_Medium)
package framework.btns {
import framework.*;
public class Btn_Medium extends BasicBtn {
public function Btn_Medium(){
action = BtnActions.MEDIUM;
}
}
}//package framework.btns
Section 45
//Btn_Menu (framework.btns.Btn_Menu)
package framework.btns {
import framework.*;
public class Btn_Menu extends BasicBtn {
public function Btn_Menu(){
action = BtnActions.MENU;
}
}
}//package framework.btns
Section 46
//Btn_More_Online_Games (framework.btns.Btn_More_Online_Games)
package framework.btns {
import framework.*;
public class Btn_More_Online_Games extends BasicBtn {
public function Btn_More_Online_Games(){
action = BtnActions.MORE_ONLINE_GAMES;
}
}
}//package framework.btns
Section 47
//Btn_Music (framework.btns.Btn_Music)
package framework.btns {
import framework.*;
public class Btn_Music extends BasicBtn {
public function Btn_Music(){
action = BtnActions.MUSIC;
}
}
}//package framework.btns
Section 48
//Btn_Next (framework.btns.Btn_Next)
package framework.btns {
import framework.*;
public class Btn_Next extends BasicBtn {
public function Btn_Next(){
action = BtnActions.NEXT;
}
}
}//package framework.btns
Section 49
//Btn_Next_Level (framework.btns.Btn_Next_Level)
package framework.btns {
import framework.*;
public class Btn_Next_Level extends BasicBtn {
public function Btn_Next_Level(){
action = BtnActions.NEXT_LEVEL;
}
}
}//package framework.btns
Section 50
//Btn_No (framework.btns.Btn_No)
package framework.btns {
import framework.*;
public class Btn_No extends BasicBtn {
}
}//package framework.btns
Section 51
//Btn_Pause (framework.btns.Btn_Pause)
package framework.btns {
import framework.*;
public class Btn_Pause extends BasicBtn {
public function Btn_Pause(){
action = BtnActions.PAUSE;
hotKeys = "P";
}
}
}//package framework.btns
Section 52
//Btn_Play (framework.btns.Btn_Play)
package framework.btns {
import framework.*;
public class Btn_Play extends BasicBtn {
public function Btn_Play(){
action = BtnActions.PLAY;
}
}
}//package framework.btns
Section 53
//Btn_Play_Game (framework.btns.Btn_Play_Game)
package framework.btns {
import framework.*;
public class Btn_Play_Game extends BasicBtn {
public function Btn_Play_Game(){
action = BtnActions.PLAY_GAME;
}
}
}//package framework.btns
Section 54
//Btn_Quality (framework.btns.Btn_Quality)
package framework.btns {
import framework.*;
public class Btn_Quality extends BasicBtn {
public function Btn_Quality(){
action = BtnActions.QUALITY;
}
}
}//package framework.btns
Section 55
//Btn_Remove (framework.btns.Btn_Remove)
package framework.btns {
import framework.*;
public class Btn_Remove extends BasicBtn {
public function Btn_Remove(){
action = BtnActions.REMOVE;
}
}
}//package framework.btns
Section 56
//Btn_Replay (framework.btns.Btn_Replay)
package framework.btns {
import framework.*;
public class Btn_Replay extends BasicBtn {
public function Btn_Replay(){
action = BtnActions.REPLAY;
}
}
}//package framework.btns
Section 57
//Btn_Retry (framework.btns.Btn_Retry)
package framework.btns {
import framework.*;
public class Btn_Retry extends BasicBtn {
public function Btn_Retry(){
action = BtnActions.RETRY;
}
}
}//package framework.btns
Section 58
//Btn_Skip (framework.btns.Btn_Skip)
package framework.btns {
import framework.*;
public class Btn_Skip extends BasicBtn {
public function Btn_Skip(){
action = BtnActions.SKIP;
}
}
}//package framework.btns
Section 59
//Btn_Sound (framework.btns.Btn_Sound)
package framework.btns {
import framework.*;
public class Btn_Sound extends BasicBtn {
public function Btn_Sound(){
action = BtnActions.SOUND;
}
}
}//package framework.btns
Section 60
//Btn_Submit (framework.btns.Btn_Submit)
package framework.btns {
import framework.*;
public class Btn_Submit extends BasicBtn {
public function Btn_Submit(){
action = BtnActions.SUBMIT;
}
}
}//package framework.btns
Section 61
//Btn_Submit_Score (framework.btns.Btn_Submit_Score)
package framework.btns {
import framework.*;
public class Btn_Submit_Score extends BasicBtn {
public static var btnSs:Btn_Submit_Score;
public function Btn_Submit_Score(){
action = BtnActions.SUBMIT_SCORE;
btnSs = this;
}
}
}//package framework.btns
Section 62
//Btn_View_Highscores (framework.btns.Btn_View_Highscores)
package framework.btns {
import framework.*;
public class Btn_View_Highscores extends BasicBtn {
public function Btn_View_Highscores(){
action = BtnActions.VIEW_HIGHSCORES;
}
}
}//package framework.btns
Section 63
//Btn_X (framework.btns.Btn_X)
package framework.btns {
public class Btn_X extends Btn_Remove {
}
}//package framework.btns
Section 64
//Btn_Yes (framework.btns.Btn_Yes)
package framework.btns {
import framework.*;
public class Btn_Yes extends BasicBtn {
public function Btn_Yes(){
action = "";
}
}
}//package framework.btns
Section 65
//Btn1 (framework.btns.Btn1)
package framework.btns {
import framework.*;
public dynamic class Btn1 extends BasicBtn {
}
}//package framework.btns
Section 66
//AnimationFade (framework.fadeEffect.AnimationFade)
package framework.fadeEffect {
import flash.display.*;
import framework.*;
public class AnimationFade extends AlignToMiddleThing {
private static var bmd:BitmapData;
public function AnimationFade(){
addFrameScript(4, frame5, 10, frame11);
}
public function flip():void{
Fade.fade.removeChildAt(0);
}
function frame5(){
flip();
}
public function removeAll():void{
_slot1.removeAll();
}
function frame11(){
stop();
removeAll();
}
public static function removeAll():void{
var _local1:*;
var _local2:*;
_local1 = Fade.fade;
while (_local1.numChildren > 0) {
_local2 = _local1.getChildAt(0);
if ((_local2 is MovieClip)){
_local2.stop();
};
_local1.removeChildAt(0);
};
}
public static function start(_arg1:Object=null):void{
var _local2:*;
removeAll();
_local2 = Fade.fade;
if (bmd == null){
bmd = new BitmapData(Fade.wid, Fade.hei, false, 0);
};
bmd.fillRect(bmd.rect, 0);
bmd.draw(_local2.parent);
_local2.addChild(new Bitmap(bmd));
_local2.addChild(new (AnimationFade));
}
}
}//package framework.fadeEffect
Section 67
//DuanFade (framework.fadeEffect.DuanFade)
package framework.fadeEffect {
public class DuanFade {
public static function start(_arg1:Object=null):void{
}
}
}//package framework.fadeEffect
Section 68
//GridFade (framework.fadeEffect.GridFade)
package framework.fadeEffect {
import flash.display.*;
import flash.events.*;
import framework.*;
import flash.geom.*;
public class GridFade {
private static var d:Number = 10;
private static var gridSize:Number;
private static var isHiding:Boolean;
private static var bmp0:Bitmap;
private static var bmd:BitmapData;
private static var gridBmp:Bitmap;
public static function start(_arg1:Object=null):void{
var _local2:*;
if (bmd == null){
bmd = new BitmapData(Fade.wid, Fade.hei, false, 0);
};
_local2 = Fade.fade;
bmp0 = new Bitmap();
_local2.addChild((gridBmp = new Bitmap()));
bmd.draw(_local2.parent);
bmp0.bitmapData = bmd;
gridBmp.bitmapData = bmd;
gridSize = 1;
isHiding = true;
_local2.stage.addEventListener(Event.ENTER_FRAME, run, false, 0, true);
}
private static function mcToGrid(_arg1:DisplayObject, _arg2:Bitmap, _arg3:Number, _arg4:Number, _arg5:Number):void{
var _local6:int;
var _local7:int;
var _local8:BitmapData;
if (_arg5 > 1){
} else {
_arg5 = 1;
};
_local6 = Math.round((_arg3 / _arg5));
_local7 = Math.round((_arg4 / _arg5));
_local8 = new BitmapData(_local6, _local7, false);
_local8.draw(_arg1, new Matrix((_local6 / _arg3), 0, 0, (_local7 / _arg4), 0, 0));
_arg2.bitmapData = _local8;
_arg2.width = _arg3;
_arg2.height = _arg4;
}
private static function run(_arg1:Event):void{
var _local2:Fade;
_local2 = Fade.fade;
if (isHiding){
gridSize = (gridSize + d);
mcToGrid(bmp0, gridBmp, Fade.wid, Fade.hei, gridSize);
if (gridSize >= 90){
isHiding = false;
};
} else {
gridSize = (gridSize - d);
gridBmp.visible = false;
mcToGrid(_local2.parent, gridBmp, Fade.wid, Fade.hei, gridSize);
gridBmp.visible = true;
if (gridSize <= 1){
_local2.stage.removeEventListener(Event.ENTER_FRAME, run);
Fade.clear();
};
};
}
}
}//package framework.fadeEffect
Section 69
//Page_Credits (framework.pages.Page_Credits)
package framework.pages {
import framework.*;
public class Page_Credits extends Page {
}
}//package framework.pages
Section 70
//Page_Game (framework.pages.Page_Game)
package framework.pages {
import framework.*;
public class Page_Game extends Page {
public var game_mc:gameMain;
}
}//package framework.pages
Section 71
//Page_Instructions (framework.pages.Page_Instructions)
package framework.pages {
import framework.*;
import flash.utils.*;
import framework.btns.*;
public class Page_Instructions extends Page {
public var __setPropDict:Dictionary;
public var __id13_:Btn_Menu;
public function Page_Instructions(){
__setPropDict = new Dictionary(true);
super();
addFrameScript(0, frame1);
stop();
}
function frame1(){
if ((((__setPropDict[__id13_] == undefined)) || (!((int(__setPropDict[__id13_]) == 1))))){
__setPropDict[__id13_] = currentFrame;
__setProp___id13__framework_1();
};
}
function __setProp___id13__framework_1(){
try {
__id13_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id13_.action = "自定义";
__id13_.toolTip = "";
__id13_.alert = "";
__id13_.hotKeys = "可输入字符或键值或键名^_^";
try {
__id13_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
}
}//package framework.pages
Section 72
//Page_Level_Complete (framework.pages.Page_Level_Complete)
package framework.pages {
import framework.*;
public class Page_Level_Complete extends Page {
}
}//package framework.pages
Section 73
//Page_Lose (framework.pages.Page_Lose)
package framework.pages {
import framework.*;
public class Page_Lose extends Page {
}
}//package framework.pages
Section 74
//Page_Menu (framework.pages.Page_Menu)
package framework.pages {
import framework.*;
public class Page_Menu extends Page {
}
}//package framework.pages
Section 75
//Page_Win (framework.pages.Page_Win)
package framework.pages {
import framework.*;
public class Page_Win extends Page {
}
}//package framework.pages
Section 76
//Alert (framework.Alert)
package framework {
import flash.display.*;
import framework.btns.*;
public class Alert extends AlignToMiddleThing {
public var btnYes:Btn_Yes;
public var btnNo:Btn_No;
public var txt:Txt;
public var blackBg:MovieClip;
private static var onCallBack:Function;
private static var currRoot:Sprite;
private static var alert:Alert;
public function Alert(){
super();
alert = this;
trace(("parent=" + this.parent));
if (this.parent){
currRoot = (this.root as Sprite);
this.parent.removeChild(this);
};
btnYes.release = function ():void{
_slot1.callBack(true);
};
btnNo.release = function ():void{
_slot1.callBack(false);
};
}
public function set msg(_arg1:String):void{
txt.text = _arg1;
}
public function get msg():String{
return (txt.text);
}
public static function callBack(_arg1:Boolean):void{
alert.parent.removeChild(alert);
onCallBack(_arg1);
}
public static function show(_arg1:String, _arg2:Function):void{
if (currRoot){
currRoot.addChild(alert);
} else {
trace("请在调用show前放一个Alert在场景里^_^;ps:因为你的过错,将自动执行onCallBack(true)");
_arg2(true);
return;
};
Global.pause = true;
alert.msg = _arg1;
onCallBack = _arg2;
}
}
}//package framework
Section 77
//AlignToMiddleThing (framework.AlignToMiddleThing)
package framework {
import flash.display.*;
import flash.events.*;
public class AlignToMiddleThing extends MovieClip {
public static var stageWid:int;
public static var stageHei:int;
public function AlignToMiddleThing(){
if ((((stageWid > 0)) && ((stageHei > 0)))){
align();
} else {
Global.addEvent(this, Event.ENTER_FRAME, firstInit, "firstInit");
};
}
public function align():void{
var _local1:*;
this.x = (stageWid / 2);
this.y = (stageHei / 2);
_local1 = this.getChildByName("blackBg");
if (_local1 == null){
_local1 = this;
};
_local1.width = stageWid;
_local1.height = stageHei;
}
private function firstInit(_arg1:Event):void{
var event = _arg1;
if (this.parent == null){
Global.removeEvent(this, Event.ENTER_FRAME, firstInit);
return;
};
try {
stageWid = this.loaderInfo.width;
stageHei = this.loaderInfo.height;
} catch(e) {
trace(("AlignToMiddleThing.firstInit(),e=" + e));
return;
};
Global.removeEvent(this, Event.ENTER_FRAME, firstInit);
align();
}
}
}//package framework
Section 78
//BasicBtn (framework.BasicBtn)
package framework {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import flash.utils.*;
import flash.text.*;
import flash.filters.*;
public class BasicBtn extends MovieClip {
public var release:Function;
private var __toolTip:String;
private var __action:String;
public var press:Function;
private var __bDown:Boolean;
private var __bIn:Boolean;
public var errorAction:Function;
private var __selected:Boolean;
private var __alert:String;
private var __bGrey:Boolean;
public var rollOut:Function;
private var filters0:Array;
private var __hotKey:String;// = ""
public var playRollOverSound:Function;
public var playPressSound:Function;
public var rollOver:Function;
private static const keyCodeArr:Array = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 49, 222, 51, 52, 53, 55, 222, 57, 48, 56, 187, 188, 189, 190, 191, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 186, 186, 188, 187, 190, 191, 50, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 219, 220, 221, 54, 189, 192, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 219, 220, 221, 192, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
private static const someKeyNameArr:Array = [["left", 37], ["up", 38], ["right", 39], ["down", 40], ["tab", 9], ["enter", 13], ["back", 8]];
private static var greyFilter:ColorMatrixFilter = new ColorMatrixFilter([0.308600038290024, 0.609399974346161, 0.0820000022649765, 0, 0, 0.308600008487701, 0.609399974346161, 0.0820000022649765, 0, 0, 0.308600008487701, 0.609399974346161, 0.0820000246167183, 0, 0, 0, 0, 0, 1, 0]);
public static var onSetAction:Function = function (){
};
public function BasicBtn(){
playRollOverSound = function (){
};
playPressSound = function (){
};
__hotKey = "";
rollOver = function (){
};
rollOut = function (){
};
press = function (){
};
release = function (){
};
errorAction = function (){
};
super();
this.buttonMode = true;
this.mouseChildren = false;
this.stop();
this.addEventListener(Event.ADDED_TO_STAGE, added, false, 0, true);
}
private function actionRelease():void{
if (bGrey){
errorAction();
} else {
release();
};
}
private function callBackRelease(_arg1:Boolean):void{
if (_arg1){
actionRelease();
};
}
public function get bDown():Boolean{
return (__bDown);
}
private function added(_arg1:Event):void{
if (__hotKey.length > 0){
trace(((("__hotKey.length=" + __hotKey.length) + ",") + this));
Global.addEvent(stage, KeyboardEvent.KEY_DOWN, hotKeyDown, "hotKeyDown");
};
Global.addEvent(this, MouseEvent.MOUSE_OVER, _onRollOver, "_onRollOver");
Global.addEvent(this, MouseEvent.MOUSE_OUT, _onRollOut, "_onRollOut");
Global.addEvent(this, MouseEvent.MOUSE_DOWN, _onPress, "_onPress");
Global.addEvent(this, MouseEvent.MOUSE_UP, _onRelease, "_onRelease");
Global.addEvent(this, Event.REMOVED_FROM_STAGE, removed, "removed");
}
public function get bIn():Boolean{
return (__bIn);
}
public function set selected(_arg1:Boolean):void{
__selected = _arg1;
if (__selected){
this.gotoAndStop("selected");
} else {
this.gotoAndStop("up");
};
}
public function get action():String{
return (__action);
}
public function set bDown(_arg1:Boolean):void{
if (__bDown != _arg1){
if (__bDown){
prevRelease();
} else {
press();
};
__bDown = _arg1;
replace();
};
}
private function prevRelease():void{
if (((__alert) && (AlertClass))){
AlertClass.show(__alert, callBackRelease);
} else {
actionRelease();
};
}
public function set bIn(_arg1:Boolean):void{
if (__bIn != _arg1){
if (__bIn){
rollOut();
} else {
rollOver();
};
__bIn = _arg1;
replace();
};
}
public function get bGrey():Boolean{
return (__bGrey);
}
public function set action(_arg1:String):void{
__action = _arg1;
onSetAction(this);
}
private function _onRollOut(_arg1:MouseEvent):void{
if (bGrey){
return;
};
bIn = false;
if (((__toolTip) && (ToolTipClass))){
ToolTipClass.hide();
};
}
private function removed(_arg1:Event):void{
Global.removeEvent(stage, KeyboardEvent.KEY_DOWN, hotKeyDown);
Global.removeEvent(this, MouseEvent.MOUSE_OVER, _onRollOver);
Global.removeEvent(this, MouseEvent.MOUSE_OUT, _onRollOut);
Global.removeEvent(this, MouseEvent.MOUSE_DOWN, _onPress);
Global.removeEvent(this, MouseEvent.MOUSE_UP, _onRelease);
Global.removeEvent(this, Event.REMOVED_FROM_STAGE, removed);
this.gotoAndStop("up");
if (stage.focus == this){
stage.focus = null;
};
}
private function _onRollOver(_arg1:MouseEvent):void{
if (bGrey){
return;
};
bIn = true;
if (((__toolTip) && (ToolTipClass))){
ToolTipClass.show(__toolTip);
};
}
private function haveStr(_arg1:String, _arg2:String):Boolean{
_arg1.replace(/\ /g, "");
_arg1 = _arg1.toLowerCase();
_arg2 = _arg2.toLowerCase();
return ((_arg1.indexOf(_arg2) >= 0));
}
private function _onPress(_arg1:MouseEvent):void{
if (bGrey){
return;
};
bDown = true;
}
private function _onRelease(_arg1:MouseEvent):void{
bDown = false;
}
public function get selected():Boolean{
return (__selected);
}
public function replace():void{
var _local1:String;
bGrey = bGrey;
if (bGrey){
this.gotoAndStop("up");
return;
};
if (__selected){
_local1 = "selected";
} else {
if (((bIn) && (bDown))){
_local1 = "down";
} else {
if (((bIn) || (bDown))){
_local1 = "over";
} else {
_local1 = "up";
};
};
};
this.gotoAndStop(_local1);
}
private function hotKeyDown(_arg1:KeyboardEvent):void{
if ((((__hotKey == "any")) || ((__hotKey.indexOf(String(_arg1.keyCode)) >= 0)))){
press();
prevRelease();
};
}
public function set bGrey(_arg1:Boolean):void{
if (__bGrey != _arg1){
__bGrey = _arg1;
if (__bGrey){
filters0 = this.filters.slice();
this.filters = this.filters.concat([greyFilter]);
this.buttonMode = false;
} else {
this.filters = filters0;
this.buttonMode = true;
};
};
}
public function set hotKeys(_arg1:String):void{
var _local2:String;
var _local3:Number;
var _local4:Boolean;
var _local5:Array;
if ((((_arg1 == "")) || ((_arg1 == "可输入字符或键值或键名^_^")))){
__hotKey = "";
return;
};
if (((((haveStr(_arg1, "any")) || (haveStr(_arg1, "all")))) || (haveStr(_arg1, "任意")))){
__hotKey = "any";
return;
};
__hotKey = "";
for each (_local2 in _arg1.split(",")) {
if (_local2 == ""){
} else {
_local3 = Number(_local2);
if (isNaN(_local3)){
_local4 = false;
for each (_local5 in someKeyNameArr) {
if (haveStr(_local2, _local5[0])){
__hotKey = (__hotKey + (_local5[1] + ","));
_local4 = true;
};
};
if (!_local4){
__hotKey = (__hotKey + (keyCodeArr[_local2.charCodeAt(0)] + ","));
};
} else {
if ((((_local3 >= 0)) && ((_local3 <= 9)))){
__hotKey = (__hotKey + ((_local3 + 48) + ","));
} else {
__hotKey = (__hotKey + (_local3 + ","));
};
};
};
};
}
public function set toolTip(_arg1:String):void{
var _local2:Point;
__toolTip = _arg1;
_local2 = this.localToGlobal(new Point(this.mouseX, this.mouseY));
if (this.hitTestPoint(_local2.x, _local2.y, true)){
ToolTipClass.show(__toolTip);
};
}
public function set alert(_arg1:String):void{
__alert = _arg1;
}
private static function get ToolTipClass(){
try {
return ((getDefinitionByName("framework.ToolTip") as Class));
} catch(e) {
trace(("BasicBtn.ToolTipClass(),e=" + e));
trace("请在调用前放一个ToolTip在场景里^_^");
};
return (null);
}
private static function get AlertClass(){
try {
return ((getDefinitionByName("framework.Alert") as Class));
} catch(e) {
trace(("BasicBtn.AlertClass(),e=" + e));
trace("请在调用前放一个Alert在场景里^_^");
};
return (null);
}
}
}//package framework
Section 79
//BtnActions (framework.BtnActions)
package framework {
import flash.display.*;
public class BtnActions {
public static const REMOVE:String = "Remove";
public static const MUSIC:String = "Music";
public static const REPLAY:String = "Replay";
public static const SUBMIT_SCORE:String = "Submit Score";
public static const RETRY:String = "Retry";
public static const SUBMIT:String = "Submit";
public static const PLAY_GAME:String = "Play Game";
public static const NEXT_LEVEL:String = "Next Level";
public static const VIEW_HIGHSCORES:String = "View Highscores";
public static const INSTRUCTIONS:String = "Instructions";
public static const COPYRIGHT:String = "Copyright 2008 freeworldgroup.com";
public static const HIGH:String = StageQuality.HIGH;
public static const DOWNLOAD_GAMES:String = "Download Games";
public static const LOW:String = StageQuality.LOW;
public static const PLAY:String = "Play";
public static const MENU:String = "Menu";
public static const BEST:String = StageQuality.BEST;
public static const PAUSE:String = "Pause";
public static const BACK:String = "Back";
public static const ADD_GAMES_TO_YOUR_SITE:String = "Add Games to Your Site";
public static const MORE_ONLINE_GAMES:String = "More Online Games";
public static const NEXT:String = "Next";
public static const MEDIUM:String = StageQuality.MEDIUM;
public static const SOUND:String = "Sound";
public static const QUALITY:String = "Quality";
public static const CREDITS:String = "Credits";
public static const SKIP:String = "Skip";
}
}//package framework
Section 80
//Fade (framework.Fade)
package framework {
import flash.display.*;
import framework.fadeEffect.*;
public class Fade extends Sprite {
public static var wid:Number;
public static var hei:Number;
public static var fadeClass:Class = DuanFade;
public static var fade:Fade;
public function Fade(_arg1:Number=-1, _arg2:Number=-1){
fade = this;
wid = _arg1;
hei = _arg2;
}
public static function start(_arg1:Object=null):void{
if (wid > 0){
} else {
wid = fade.loaderInfo.width;
};
if (hei > 0){
} else {
hei = fade.loaderInfo.height;
};
fadeClass.start(_arg1);
}
public static function clear():void{
while (fade.numChildren > 0) {
fade.removeChildAt(0);
};
}
}
}//package framework
Section 81
//GamePan (framework.GamePan)
package framework {
import flash.display.*;
public class GamePan extends Sprite {
public static var gamePan:GamePan;
public function GamePan(){
gamePan = this;
}
public static function setValue(_arg1:String, _arg2):void{
var valueName = _arg1;
var value = _arg2;
try {
gamePan[(valueName + "Txt")].text = String(value);
} catch(e) {
trace(("GamePan.setValue(),e=" + e));
trace((valueName + "Txt 找不到"));
};
}
}
}//package framework
Section 82
//LoadingTxt (framework.LoadingTxt)
package framework {
import flash.display.*;
import flash.events.*;
import flash.text.*;
public class LoadingTxt extends Sprite {
private var txt:TextField;
public var onLoadComplete:Function;
public function LoadingTxt(){
txt = (this.getChildAt(0) as TextField);
this.addEventListener(Event.ENTER_FRAME, run, false, 0, true);
}
private function run(_arg1:Event):void{
var _local2:int;
_local2 = ((this.loaderInfo.bytesLoaded / this.loaderInfo.bytesTotal) * 100);
txt.text = (_local2 + "%");
if (_local2 == 100){
this.removeEventListener(Event.ENTER_FRAME, run);
onLoadComplete();
};
}
}
}//package framework
Section 83
//LocalSetting (framework.LocalSetting)
package framework {
import flash.net.*;
import flash.utils.*;
public class LocalSetting {
private var lso:SharedObject;
public var version:int;
public function LocalSetting(_arg1:String, _arg2:int=1){
var varName:String;
var str = _arg1;
var _version = _arg2;
super();
str = (str + "_as3");
version = _version;
try {
lso = SharedObject.getLocal(str, "/");
} catch(e:Error) {
trace((("和as2共享名称的" + str) + "存储文件时发生错误"));
lso = SharedObject.getLocal(str, "/");
};
if (isEmpty(lso.data)){
trace((str + " 第一次设定"));
lso.data.defaultDataObj = cloneObj(this);
} else {
if (version != lso.data.dataObj.version){
trace((str + "版本改变,重置"));
lso.data.defaultDataObj = cloneObj(this);
} else {
for (varName in lso.data.dataObj) {
this[varName] = lso.data.dataObj[varName];
};
};
};
lso.data.dataObj = this;
}
public function getDefault():Object{
return (lso.data.defaultDataObj);
}
public function setDefault():void{
var _local1:String;
for (_local1 in lso.data.defaultDataObj) {
this[_local1] = cloneObj(lso.data.defaultDataObj[_local1]);
};
}
public static function cloneObj(_arg1:Object){
var _local2:ByteArray;
_local2 = new ByteArray();
_local2.writeObject(_arg1);
_local2.position = 0;
return (_local2.readObject());
}
public static function isEmpty(_arg1:Object):Boolean{
var _local2:String;
if (_arg1 == null){
return (true);
};
_local2 = "";
for (_local2 in _arg1) {
break;
};
return ((_local2 == ""));
}
}
}//package framework
Section 84
//Logo (framework.Logo)
package framework {
import flash.display.*;
import flash.events.*;
public class Logo extends Sprite {
public function Logo(){
Global.addEvent(this, Event.ADDED_TO_STAGE, added, "added");
}
public function added(_arg1:Event):void{
this.buttonMode = true;
Global.removeEvent(this, Event.ADDED_TO_STAGE, added);
Global.addEvent(this, MouseEvent.MOUSE_UP, Main.linkToFWG, "linkToFWG");
Global.addEvent(this, Event.REMOVED_FROM_STAGE, removed, "removed");
}
public function removed(_arg1:Event):void{
Global.removeEvent(this, MouseEvent.MOUSE_UP, Main.linkToFWG);
Global.removeEvent(this, Event.REMOVED_FROM_STAGE, removed);
}
}
}//package framework
Section 85
//Page (framework.Page)
package framework {
import flash.display.*;
public class Page extends MovieClip {
}
}//package framework
Section 86
//PausePan (framework.PausePan)
package framework {
import flash.display.*;
import flash.events.*;
import framework.btns.*;
public class PausePan extends AlignToMiddleThing {
public var blackBg:MovieClip;
public var hideBtn:Btn_Remove;
public function PausePan(){
Global.addEvent(this, Event.REMOVED_FROM_STAGE, removed, "removed");
__setProp_hideBtn_framework_1();
}
override public function align():void{
super.align();
hideBtn.width = stageWid;
hideBtn.height = stageHei;
}
private function removed(_arg1:Event):void{
Global.removeEvent(this, Event.REMOVED_FROM_STAGE, removed);
Global.pause = false;
}
function __setProp_hideBtn_framework_1(){
try {
hideBtn["componentInspectorSetting"] = true;
} catch(e:Error) {
};
hideBtn.action = "Remove";
hideBtn.hotKeys = "any";
try {
hideBtn["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
}
}//package framework
Section 87
//PlayerInfo (framework.PlayerInfo)
package framework {
public class PlayerInfo extends LocalSetting {
public var playerName:String;// = "MrNoName"
public function PlayerInfo(){
playerName = "MrNoName";
super("FWGPlayerInfo");
}
public static function isIllegalName(_arg1:String):Boolean{
return ((((_arg1 == "")) || ((_arg1 == "MrNoName"))));
}
}
}//package framework
Section 88
//PrevLoader (framework.PrevLoader)
package framework {
import flash.display.*;
public class PrevLoader extends AlignToMiddleThing {
public var blackBg:MovieClip;
public var protection:Boolean;// = true
public static var prevLoader:PrevLoader;
public function PrevLoader(){
protection = true;
super();
prevLoader = this;
stop();
(root as MovieClip).stop();
RightClickMenu.addTo(root);
}
private function isInUrlFront(_arg1:String):Boolean{
var _local2:String;
_local2 = this.loaderInfo.url;
_local2.toLowerCase();
_arg1.toLowerCase();
return ((_local2.indexOf(_arg1) == 0));
}
public function set skip(_arg1:Boolean):void{
if (_arg1){
(root as MovieClip).play();
this.visible = false;
};
}
public function checkGoNext():void{
stage.showDefaultContextMenu = false;
if (this.loaderInfo.bytesLoaded == this.loaderInfo.bytesTotal){
goNext();
};
}
public function goNext():void{
prevLoader = null;
if (protection){
if (((isIn("freeworldgroup.com")) || (isIn("ifungames.com")))){
this.gotoAndStop(3);
} else {
this.gotoAndStop(2);
};
} else {
this.gotoAndStop(3);
};
}
private function isIn(_arg1:String):Boolean{
return (((((((isInUrlFront(_arg1)) || (isInUrlFront(("http://" + _arg1))))) || (isInUrlFront(("http://www." + _arg1))))) || (isInUrlFront(("www." + _arg1)))));
}
public static function goNext():void{
if (prevLoader){
prevLoader.goNext();
};
}
}
}//package framework
Section 89
//prevLoader_loading_percent_txt (framework.prevLoader_loading_percent_txt)
package framework {
public dynamic class prevLoader_loading_percent_txt extends LoadingTxt {
}
}//package framework
Section 90
//QualitySetting (framework.QualitySetting)
package framework {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
public class QualitySetting extends Sprite {
public var bg:MovieClip;
public var bigBg:MovieClip;
public function QualitySetting(){
Main.qualitySetting = this;
Global.addEvent(this, Event.ADDED_TO_STAGE, added, "added");
}
private function added(_arg1:Event):void{
update();
Global.removeEvent(this, Event.ADDED_TO_STAGE, added);
Global.addEvent(this, Event.REMOVED_FROM_STAGE, removed, "removed");
Global.addEvent(bigBg, MouseEvent.MOUSE_DOWN, _onPressOutside, "_onPressOutside");
Global.addEvent(bg, MouseEvent.MOUSE_OVER, _onRollOverBg, "_onRollOverBg");
}
private function _onRollOverBg(_arg1:MouseEvent):void{
Global.removeEvent(bg, MouseEvent.MOUSE_OVER, _onRollOverBg);
Global.addEvent(bg, MouseEvent.MOUSE_OUT, _onRollOutBg, "_onRollOutBg");
}
private function removed(_arg1:Event):void{
Global.removeEvent(this, Event.REMOVED_FROM_STAGE, removed);
Global.removeEvent(bigBg, MouseEvent.MOUSE_DOWN, _onPressOutside);
Global.removeEvent(bg, MouseEvent.MOUSE_OVER, _onRollOverBg);
Global.removeEvent(bg, MouseEvent.MOUSE_OUT, _onRollOutBg);
Global.pause = false;
}
private function remove():void{
this.parent.removeChild(this);
}
private function _onPressOutside(_arg1:MouseEvent):void{
remove();
}
public function update(_arg1:String=null):void{
var _local2:int;
var _local3:*;
if (_arg1 == null){
_arg1 = stage.quality;
};
_arg1 = _arg1.toLowerCase();
_local2 = this.numChildren;
while (--_local2 >= 0) {
_local3 = this.getChildAt(_local2);
if ((_local3 is BasicBtn)){
_local3.selected = (_local3.action.toLowerCase() == _arg1);
};
};
}
private function _onRollOutBg(_arg1:MouseEvent):void{
var _local2:Point;
_local2 = this.localToGlobal(new Point(this.mouseX, this.mouseY));
if (!bg.hitTestPoint(_local2.x, _local2.y, true)){
remove();
};
}
}
}//package framework
Section 91
//RightClickMenu (framework.RightClickMenu)
package framework {
import flash.display.*;
import flash.events.*;
import flash.ui.*;
public class RightClickMenu {
private static function menuItemSelectHandler(_arg1){
Main.linkToFWG();
}
public static function addTo(_arg1):void{
var _local2:*;
var _local3:ContextMenuBuiltInItems;
var _local4:ContextMenuItem;
_local2 = new ContextMenu();
_local2.hideBuiltInItems();
_local3 = _local2.builtInItems;
_local3.print = true;
_local4 = new ContextMenuItem("www.freeworldgroup.com");
_local2.customItems.push(_local4);
_local4.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, menuItemSelectHandler, false, 0, true);
_local2.addEventListener(ContextMenuEvent.MENU_SELECT, menuSelectHandler, false, 0, true);
_arg1.contextMenu = _local2;
}
private static function menuSelectHandler(_arg1){
}
}
}//package framework
Section 92
//SoundManage (framework.SoundManage)
package framework {
import flash.media.*;
import flash.utils.*;
public class SoundManage {
private static var initObj:Object = firstInit();
private static var soundList:Object;
public static var isSoundPlay:Boolean = true;
private static var musicList:Object;
public static var isMusicPlay:Boolean = true;
public static function stopMusic(... _args){
stopSound2(musicList, "volume", _args);
}
public static function addMusic(... _args){
addSound2(musicList, _args);
}
private static function adjustVolume(_arg1:Number):Number{
if (isNaN(_arg1)){
return (1);
};
if (_arg1 > 1){
trace(("小子又忘了音量不是0到100的了吧 vol=" + _arg1));
return (1);
};
if (_arg1 < 0){
return (0);
};
return (_arg1);
}
private static function addSound2(_arg1:Object, _arg2:Array):void{
var _local3:int;
var _local4:int;
var _local5:*;
var _local6:String;
var _local7:Class;
var _local8:SndObj;
var _local9:*;
_local3 = _arg2.length;
if (_local3 == 1){
_local6 = _arg2[0];
if (_local6.indexOf(",") >= 0){
_arg2 = _local6.split(",");
};
_local4 = 0;
for each (_local5 in _arg2) {
if (!isNaN(_local5)){
_arg2[_local4] = Number(_local5);
};
_local4++;
};
_local3 = _arg2.length;
};
_local4 = -1;
while (++_local4 < _local3) {
_local5 = _arg2[_local4];
if ((_local5 is String)){
_local7 = (getDefinitionByName(_local5) as Class);
_local8 = (_arg1[_local5] = new SndObj());
_local8.sound = new (_local7);
_local8.name = _local5;
_local9 = _arg2[(_local4 + 1)];
if ((_local9 is Number)){
_local8.vol = adjustVolume(_local9);
_local4++;
} else {
_local8.vol = 1;
};
trace(((("加入音效:" + _local5) + "音量为:") + _local8.vol));
};
};
}
public static function setSoundVol(... _args){
setSoundVol2(soundList, _args);
}
public static function playMusic(... _args){
if (isMusicPlay){
playSound2(musicList, _args);
};
}
public static function isTrueStopMusic(... _args){
stopSound2(musicList, "stop", _args);
}
public static function returnMusic(){
var _local1:*;
isMusicPlay = true;
for (_local1 in musicList) {
setVolume(musicList[_local1].channel, musicList[_local1].vol);
};
}
private static function playSound2(_arg1:Object, _arg2:Array):void{
var _local3:String;
var _local4:int;
var _local5:Number;
var _local6:SndObj;
if (!sndListPlayAble(_arg1)){
return;
};
_local3 = _arg2[0];
_local4 = _arg2[1];
if (isNaN(_local4)){
_local4 = 1;
};
_local5 = _arg2[2];
_local6 = _arg1[_local3];
_arg1[_local3].channel = _local6.sound.play(0, _local4);
if (isNaN(_local5)){
_local5 = _local6.vol;
} else {
_local5 = adjustVolume(_local5);
};
setVolume(_local6.channel, _local5);
}
private static function setVolume(_arg1:SoundChannel, _arg2:Number):void{
var _local3:SoundTransform;
if (_arg1){
_local3 = _arg1.soundTransform;
_local3.volume = _arg2;
_arg1.soundTransform = _local3;
};
}
public static function firstInit():Object{
soundList = new Object();
musicList = new Object();
return (null);
}
private static function stopSound2(_arg1:Object, _arg2:String, _arg3:Array):void{
var _local4:*;
switch (_arg2){
case "stop":
if (_arg3.length > 0){
for (_local4 in _arg3) {
_arg1[_arg3[_local4]].sound.stop();
};
} else {
for (_local4 in _arg1) {
_arg1[_local4].sound.stop();
};
};
break;
default:
if (_arg3.length > 0){
for (_local4 in _arg3) {
setVolume(_arg1[_arg3[_local4]].channel, 0);
};
} else {
for (_local4 in _arg1) {
setVolume(_arg1[_local4].channel, 0);
};
};
break;
};
}
private static function setSoundVol2(_arg1:Object, _arg2:Array):void{
var _local3:int;
var _local4:Number;
var _local5:String;
var _local6:int;
var _local7:*;
var _local8:SndObj;
var _local9:*;
_local3 = _arg2.length;
if (_local3 > 0){
if (_local3 == 1){
_local4 = adjustVolume(_arg2[0]);
for (_local5 in _arg1) {
_arg1[_local5].vol = _local4;
};
} else {
_local6 = -1;
while (++_local6 < _local3) {
_local7 = _arg2[_local6];
if (typeof(_local7) == "string"){
_local8 = _arg1[_local7];
_local9 = _arg2[(_local6 + 1)];
if (typeof(_local9) == "number"){
_local8.vol = adjustVolume(_local9);
_local6++;
} else {
_local8.vol = 1;
};
setVolume(_local8.channel, _local8.vol);
};
trace(((("设置音效:" + _local7) + "音量为:") + _local8.vol));
};
};
};
}
public static function stopSound(... _args){
stopSound2(soundList, "volume", _args);
}
public static function addSound(... _args){
addSound2(soundList, _args);
}
public static function setMusicVol(... _args){
setSoundVol2(musicList, _args);
}
private static function findObjBySnd(_arg1:Sound):Object{
var _local2:*;
for (_local2 in soundList) {
if (soundList[_local2].sound == _arg1){
return (soundList[_local2]);
};
};
for (_local2 in musicList) {
if (musicList[_local2].music == _arg1){
return (musicList[_local2]);
};
};
return (null);
}
private static function sndListPlayAble(_arg1:Object):Boolean{
var _local2:*;
if (typeof(_arg1) == "string"){
if (musicList[_arg1]){
_local2 = musicList;
} else {
_local2 = soundList;
};
} else {
_local2 = _arg1;
};
if (_local2 == musicList){
return (isMusicPlay);
};
if (_local2 == soundList){
return (isSoundPlay);
};
return (false);
}
public static function clearSoundAndMusic(){
soundList = null;
musicList = null;
}
public static function playSound(... _args){
if (isSoundPlay == true){
playSound2(soundList, _args);
};
}
public static function isTrueStopSound(... _args){
stopSound2(soundList, "stop", _args);
}
public static function moveSound(_arg1:String, _arg2:int, _arg3:Number, _arg4:Number, _arg5:int):void{
var _local6:SndObj;
_local6 = soundList[_arg1];
if (_local6 == null){
_local6 = musicList[_arg1];
};
if (_local6 == null){
return;
};
if (!sndListPlayAble(_arg1)){
return;
};
if (isNaN(_arg4)){
_arg4 = _local6.vol;
};
_local6.startVol = ((_arg3 >= 0)) ? _arg3 : 0;
_local6.endVol = ((_arg4 >= 0)) ? _arg4 : 0;
_local6.currTime = 0;
_local6.totalTime = ((_arg2 > 0)) ? _arg2 : 0;
if (_arg3 < _arg4){
if (soundList[_arg1]){
playSound(_local6.name, _arg5);
} else {
playMusic(_local6.name, _arg5);
};
};
setVolume(_local6.channel, _arg3);
_local6.intervalId = setInterval(_local6.setSound, 30);
}
public static function returnSound(){
var _local1:*;
isSoundPlay = true;
for (_local1 in soundList) {
setVolume(soundList[_local1].channel, soundList[_local1].vol);
};
}
}
}//package framework
import flash.media.*;
class SndObj {
public var totalTime:Number;
public var channel:SoundChannel;
public var name:String;
public var startVol:Number;
public var vol:Number;
public var endVol:Number;
public var intervalId:int;
public var sound:Sound;
public var currTime:Number;
private function SndObj(){
}
public function setSound():void{
}
}
Section 93
//SubmitScore (framework.SubmitScore)
package framework {
import flash.display.*;
import flash.net.*;
import flash.events.*;
public class SubmitScore extends AlignToMiddleThing {
public var blackBg:MovieClip;
public var scoreTxt:Txt;
public var nameTxt:Txt;
private static var submitScore:SubmitScore;
public static var btnSsArr:Array = new Array();
public function SubmitScore(){
submitScore = this;
stop();
nameTxt.type = "input";
nameTxt.selectable = true;
nameTxt.maxChars = 10;
nameTxt.text = Main.playerInfo.playerName;
scoreTxt.text = Main.totalScore;
trace(((("playerName=" + nameTxt.text) + ",score=") + scoreTxt.text));
Global.addEvent(this, Event.ADDED_TO_STAGE, added, "added");
}
private function added(_arg1:Event):void{
Global.removeEvent(this, Event.ADDED_TO_STAGE, added);
Global.addEvent(this, Event.REMOVED_FROM_STAGE, removed, "removed");
}
private function errorHandler(_arg1:IOErrorEvent):void{
trace(("error: " + _arg1));
}
private function submit():void{
var _local1:String;
var _local2:URLVariables;
_local1 = nameTxt.text;
if (PlayerInfo.isIllegalName(_local1)){
ToolTip.show("You must enter your name!", nameTxt);
return;
};
if (_local1 == ""){
_local1 = ("guest" + int((1000 * Math.random())));
};
if (Main.totalScore > 0){
_local2 = new URLVariables();
_local2.game = Main.game_name;
_local2.score = Main.totalScore;
_local2.name = (Main.playerInfo.playerName = nameTxt.text);
Net.sendData(_local2, "http://www.freeworldgroup.com/score/score.asp", completeHandler, errorHandler);
gotoAndStop(2);
} else {
trace("score is 0! can't submit!");
};
}
private function removed(_arg1:Event):void{
Global.removeEvent(this, Event.REMOVED_FROM_STAGE, removed);
btnSsArr = new Array();
}
private function completeHandler(_arg1:Event):void{
var _local2:*;
for each (_local2 in btnSsArr) {
_local2.parent.removeChild(_local2);
};
gotoAndStop(3);
}
public static function submit():void{
submitScore.submit();
}
}
}//package framework
Section 94
//ToolTip (framework.ToolTip)
package framework {
import flash.display.*;
import flash.geom.*;
import flash.utils.*;
import flash.text.*;
public class ToolTip extends Sprite {
public var bg:MovieClip;
public var txt:TextField;
public static var toolTip:ToolTip;
private static var currRoot:Sprite;
private static var hideDelayTimeoutId:int = -1;
public function ToolTip(){
toolTip = this;
if (this.parent){
currRoot = (this.root as Sprite);
this.parent.removeChild(this);
};
}
public function set msg(_arg1:String):void{
txt.text = _arg1;
}
private function hide(_arg1:int=0):void{
toolTip.parent.removeChild(toolTip);
}
public function get msg():String{
return (txt.text);
}
private function show(_arg1:String, _arg2:DisplayObject):void{
var _local3:Rectangle;
var _local4:Point;
msg = _arg1;
txt.autoSize = "center";
bg.width = (txt.width + 10);
if (_arg2){
_local4 = this.parent.globalToLocal(_arg2.localToGlobal(new Point()));
this.x = _local4.x;
this.y = _local4.y;
} else {
this.x = this.parent.mouseX;
this.y = this.parent.mouseY;
};
_local3 = bg.getBounds(root);
if (_local3.x < 0){
this.x = (this.x + (10 - _local3.x));
} else {
if ((_local3.x + _local3.width) > this.loaderInfo.width){
this.x = (this.x - (((10 + _local3.x) + _local3.width) - this.loaderInfo.width));
};
};
if (_local3.y < 0){
this.y = (this.y + (10 - _local3.y));
} else {
if ((_local3.y + _local3.height) > this.loaderInfo.height){
this.y = (this.y - (((10 + _local3.y) + _local3.height) - this.loaderInfo.height));
};
};
this.x = Math.round(this.x);
this.y = Math.round(this.y);
}
public static function hideDelay(_arg1:int=30):void{
clearTimeout(hideDelayTimeoutId);
hideDelayTimeoutId = setTimeout(toolTip.hide, (_arg1 * 33));
}
public static function hide():void{
toolTip.hide();
}
public static function show(_arg1:String, _arg2:DisplayObject=null):void{
if (currRoot){
currRoot.addChild(toolTip);
} else {
trace("请在调用show前放一个ToolTip在场景里^_^");
return;
};
toolTip.show(_arg1, _arg2);
}
}
}//package framework
Section 95
//Top4 (framework.Top4)
package framework {
import flash.display.*;
public class Top4 extends Sprite {
public var d:Number;// = 10
public var autoAlign:Boolean;// = true
public function Top4(){
autoAlign = true;
d = 10;
super();
}
}
}//package framework
Section 96
//Txt (framework.Txt)
package framework {
import flash.display.*;
import flash.text.*;
public class Txt extends Sprite {
private var __text:String;
public var txt:TextField;
public function Txt(){
__text = "";
}
public function get text(){
if (txt.selectable){
__text = txt.text;
};
return (__text);
}
public function get type():String{
return (txt.type);
}
public function get autoSize():String{
return (txt.autoSize);
}
public function get selectable():Boolean{
return (txt.selectable);
}
public function set text(_arg1):void{
txt.text = (__text = _arg1);
}
public function set type(_arg1:String):void{
txt.type = _arg1;
}
public function set autoSize(_arg1:String):void{
txt.autoSize = _arg1;
}
public function set selectable(_arg1:Boolean):void{
txt.selectable = _arg1;
}
public function set maxChars(_arg1:int):void{
txt.maxChars = _arg1;
}
public function get maxChars():int{
return (txt.maxChars);
}
}
}//package framework
Section 97
//24_264 (framework_new4_fla.24_264)
package framework_new4_fla {
import flash.display.*;
import flash.media.*;
import flash.net.*;
import flash.events.*;
import flash.geom.*;
import flash.utils.*;
import flash.text.*;
import flash.filters.*;
import flash.system.*;
import flash.ui.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.xml.*;
public dynamic class 24_264 extends MovieClip {
public var nono:int;
public function 24_264(){
addFrameScript(0, frame1, 19, frame20);
}
function frame1(){
if (!nono){
nono = 1;
};
}
function frame20(){
nono++;
if (nono >= 10){
stop();
(this.parent as MovieClip).removeThis();
};
}
}
}//package framework_new4_fla
Section 98
//all_mc2_10 (framework_new4_fla.all_mc2_10)
package framework_new4_fla {
import flash.display.*;
public dynamic class all_mc2_10 extends MovieClip {
public function all_mc2_10(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package framework_new4_fla
Section 99
//dtgyhtyyyrtywertw_71 (framework_new4_fla.dtgyhtyyyrtywertw_71)
package framework_new4_fla {
import flash.display.*;
import flash.text.*;
public dynamic class dtgyhtyyyrtywertw_71 extends MovieClip {
public var zi:TextField;
}
}//package framework_new4_fla
Section 100
//framework_3 (framework_new4_fla.framework_3)
package framework_new4_fla {
import flash.display.*;
import flash.media.*;
import flash.net.*;
import flash.events.*;
import framework.*;
import flash.geom.*;
import flash.utils.*;
import flash.text.*;
import flash.filters.*;
import flash.system.*;
import flash.ui.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.xml.*;
public dynamic class framework_3 extends MovieClip {
public var txt:prevLoader_loading_percent_txt;
public function framework_3(){
addFrameScript(0, frame1, 1, frame2, 38, frame39);
}
function frame1(){
this.visible = false;
}
function frame2(){
this.visible = true;
(parent as MovieClip).checkGoNext();
}
function frame39(){
stop();
txt.onLoadComplete = (parent as MovieClip).goNext;
}
}
}//package framework_new4_fla
Section 101
//framework_8 (framework_new4_fla.framework_8)
package framework_new4_fla {
import flash.display.*;
public dynamic class framework_8 extends MovieClip {
public function framework_8(){
addFrameScript(134, frame135);
}
function frame135(){
stop();
(root as MovieClip).play();
}
}
}//package framework_new4_fla
Section 102
//frontpage_77 (framework_new4_fla.frontpage_77)
package framework_new4_fla {
import flash.display.*;
public dynamic class frontpage_77 extends MovieClip {
public function frontpage_77(){
addFrameScript(1, frame2, 537, frame538);
}
function frame2(){
if (!Main.isFirstTimeMenuAnimation){
gotoAndStop(this.totalFrames);
};
}
function frame538(){
stop();
}
}
}//package framework_new4_fla
Section 103
//g_51 (framework_new4_fla.g_51)
package framework_new4_fla {
import flash.display.*;
public dynamic class g_51 extends MovieClip {
public function g_51(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package framework_new4_fla
Section 104
//g_55 (framework_new4_fla.g_55)
package framework_new4_fla {
import flash.display.*;
public dynamic class g_55 extends MovieClip {
public function g_55(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package framework_new4_fla
Section 105
//GAMEOVER_164 (framework_new4_fla.GAMEOVER_164)
package framework_new4_fla {
import flash.display.*;
import manage.*;
import flash.text.*;
import computer.*;
public dynamic class GAMEOVER_164 extends MovieClip {
public var tankSum:TextField;
public var peopleSum:TextField;
public var myScore:TextField;
public var kmSum:TextField;
public function GAMEOVER_164(){
addFrameScript(84, frame85);
}
function frame85(){
stop();
GameManage.gameCtrl.score = (GameManage.gameCtrl.score + Math.abs((GameManage.gameCtrl.lenMax * 5)));
myScore.text = String(GameManage.gameCtrl.score);
Main.totalScore = GameManage.gameCtrl.score;
peopleSum.text = String(Tank.peopleSum);
tankSum.text = String(Tank.tankSum);
kmSum.text = String(GameManage.gameCtrl.liner);
}
}
}//package framework_new4_fla
Section 106
//jkykjgjh_70 (framework_new4_fla.jkykjgjh_70)
package framework_new4_fla {
import flash.display.*;
public dynamic class jkykjgjh_70 extends MovieClip {
public var zi_mc:MovieClip;
public function jkykjgjh_70(){
addFrameScript(10, frame11);
}
function frame11(){
stop();
}
}
}//package framework_new4_fla
Section 107
//LEVELUP_62 (framework_new4_fla.LEVELUP_62)
package framework_new4_fla {
import flash.display.*;
public dynamic class LEVELUP_62 extends MovieClip {
public function LEVELUP_62(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package framework_new4_fla
Section 108
//MainTimeline (framework_new4_fla.MainTimeline)
package framework_new4_fla {
import flash.display.*;
import framework.*;
import flash.utils.*;
public dynamic class MainTimeline extends MovieClip {
public var __setPropDict:Dictionary;
public var __id3_:PrevLoader;
public var __id27_:Main;
public function MainTimeline(){
__setPropDict = new Dictionary(true);
super();
addFrameScript(0, frame1, 2, frame3);
}
function frame3(){
if ((((__setPropDict[__id27_] == undefined)) || (!((int(__setPropDict[__id27_]) == 3))))){
__setPropDict[__id27_] = currentFrame;
__setProp___id27___3();
};
}
function frame1(){
if ((((__setPropDict[__id3_] == undefined)) || (!((int(__setPropDict[__id3_]) == 1))))){
__setPropDict[__id3_] = currentFrame;
__setProp___id3___1();
};
MochiAd.showPreGameAd({clip:this, ad_finished:PrevLoader.goNext, id:"c8289716a75cde0b", res:"800x500", background:6845841, color:788068, outline:12695210, no_bg:false});
}
function __setProp___id3___1(){
try {
__id3_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id3_.protection = false;
__id3_.skip = false;
try {
__id3_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id27___3(){
try {
__id27_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id27_.soundNames = "booo_s,za_s,death_0,death_1,,death_2,death_3";
__id27_.musicNames = "Main_S";
__id27_.fadeClass = "AnimationFade";
__id27_.__game_name = "ET_Smash";
__id27_.skipToGame = false;
try {
__id27_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
}
}//package framework_new4_fla
Section 109
//menu_btns_127 (framework_new4_fla.menu_btns_127)
package framework_new4_fla {
import flash.display.*;
public dynamic class menu_btns_127 extends MovieClip {
public function menu_btns_127(){
addFrameScript(0, frame1, 14, frame15);
}
function frame15(){
stop();
}
function frame1(){
gotoAndPlay(2);
}
}
}//package framework_new4_fla
Section 110
//Timeline_140 (framework_new4_fla.Timeline_140)
package framework_new4_fla {
import flash.display.*;
public dynamic class Timeline_140 extends MovieClip {
public function Timeline_140(){
addFrameScript(139, frame140);
}
function frame140(){
stop();
}
}
}//package framework_new4_fla
Section 111
//Timeline_268 (framework_new4_fla.Timeline_268)
package framework_new4_fla {
import flash.display.*;
import flash.media.*;
import flash.net.*;
import flash.events.*;
import flash.geom.*;
import flash.utils.*;
import flash.text.*;
import flash.filters.*;
import flash.system.*;
import flash.ui.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.xml.*;
public dynamic class Timeline_268 extends MovieClip {
public function Timeline_268(){
addFrameScript(0, frame1, 2, frame3);
}
function frame3(){
(this.parent as MovieClip).peopleFire();
}
function frame1(){
stop();
}
}
}//package framework_new4_fla
Section 112
//Timeline_270 (framework_new4_fla.Timeline_270)
package framework_new4_fla {
import flash.display.*;
import flash.media.*;
import flash.net.*;
import flash.events.*;
import flash.geom.*;
import flash.utils.*;
import flash.text.*;
import flash.filters.*;
import flash.system.*;
import flash.ui.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.xml.*;
public dynamic class Timeline_270 extends MovieClip {
public var p;
public function Timeline_270(){
addFrameScript(10, frame11);
}
function frame11(){
p = this.parent.parent;
p.isAttack = false;
(this.parent as MovieClip).gotoAndStop(2);
}
}
}//package framework_new4_fla
Section 113
//Timeline_272 (framework_new4_fla.Timeline_272)
package framework_new4_fla {
import flash.display.*;
public dynamic class Timeline_272 extends MovieClip {
public var budong_mc:MovieClip;
public function Timeline_272(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package framework_new4_fla
Section 114
//Timeline_275 (framework_new4_fla.Timeline_275)
package framework_new4_fla {
import flash.display.*;
import computer.*;
public dynamic class Timeline_275 extends MovieClip {
public function Timeline_275(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
if ((this.parent.parent as Tank).myState == 2){
gotoAndStop(2);
};
}
}
}//package framework_new4_fla
Section 115
//Timeline_277 (framework_new4_fla.Timeline_277)
package framework_new4_fla {
import flash.display.*;
import flash.media.*;
import flash.net.*;
import flash.events.*;
import flash.geom.*;
import flash.utils.*;
import flash.text.*;
import flash.filters.*;
import flash.system.*;
import flash.ui.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.xml.*;
public dynamic class Timeline_277 extends MovieClip {
public function Timeline_277(){
addFrameScript(9, frame10, 19, frame20, 28, frame29);
}
function frame10(){
(this.parent.parent as MovieClip).fire3();
}
function frame20(){
(this.parent.parent as MovieClip).fire3();
}
function frame29(){
(this.parent.parent as MovieClip).isAttack = false;
(this.parent as MovieClip).gotoAndStop(2);
}
}
}//package framework_new4_fla
Section 116
//Timeline_279 (framework_new4_fla.Timeline_279)
package framework_new4_fla {
import flash.display.*;
import flash.media.*;
import flash.net.*;
import flash.events.*;
import flash.geom.*;
import flash.utils.*;
import flash.text.*;
import flash.filters.*;
import flash.system.*;
import flash.ui.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.xml.*;
public dynamic class Timeline_279 extends MovieClip {
public var budong_mc:MovieClip;
public function Timeline_279(){
addFrameScript(0, frame1, 2, frame3);
}
function frame3(){
(this.parent as MovieClip).fire2();
}
function frame1(){
stop();
}
}
}//package framework_new4_fla
Section 117
//Timeline_282 (framework_new4_fla.Timeline_282)
package framework_new4_fla {
import flash.display.*;
import computer.*;
public dynamic class Timeline_282 extends MovieClip {
public function Timeline_282(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
if ((this.parent.parent as Tank).myState == 2){
gotoAndStop(2);
};
}
}
}//package framework_new4_fla
Section 118
//Timeline_284 (framework_new4_fla.Timeline_284)
package framework_new4_fla {
import flash.display.*;
import flash.media.*;
import flash.net.*;
import flash.events.*;
import flash.geom.*;
import flash.utils.*;
import flash.text.*;
import flash.filters.*;
import flash.system.*;
import flash.ui.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.xml.*;
public dynamic class Timeline_284 extends MovieClip {
public function Timeline_284(){
addFrameScript(10, frame11);
}
function frame11(){
(this.parent.parent as MovieClip).isAttack = false;
(this.parent as MovieClip).gotoAndStop(2);
}
}
}//package framework_new4_fla
Section 119
//Timeline_287 (framework_new4_fla.Timeline_287)
package framework_new4_fla {
import flash.display.*;
import flash.media.*;
import flash.net.*;
import flash.events.*;
import flash.geom.*;
import flash.utils.*;
import flash.text.*;
import flash.filters.*;
import flash.system.*;
import flash.ui.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.xml.*;
public dynamic class Timeline_287 extends MovieClip {
public var budong_mc:MovieClip;
public function Timeline_287(){
addFrameScript(0, frame1, 2, frame3);
}
function frame3(){
(this.parent as MovieClip).fire2();
}
function frame1(){
stop();
}
}
}//package framework_new4_fla
Section 120
//Timeline_290 (framework_new4_fla.Timeline_290)
package framework_new4_fla {
import flash.display.*;
import computer.*;
public dynamic class Timeline_290 extends MovieClip {
public function Timeline_290(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
if ((this.parent.parent as Tank).myState == 2){
gotoAndStop(2);
};
}
}
}//package framework_new4_fla
Section 121
//Timeline_292 (framework_new4_fla.Timeline_292)
package framework_new4_fla {
import flash.display.*;
import flash.media.*;
import flash.net.*;
import flash.events.*;
import flash.geom.*;
import flash.utils.*;
import flash.text.*;
import flash.filters.*;
import flash.system.*;
import flash.ui.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.xml.*;
public dynamic class Timeline_292 extends MovieClip {
public function Timeline_292(){
addFrameScript(10, frame11);
}
function frame11(){
(this.parent.parent as MovieClip).isAttack = false;
(this.parent as MovieClip).gotoAndStop(2);
}
}
}//package framework_new4_fla
Section 122
//Timeline_297 (framework_new4_fla.Timeline_297)
package framework_new4_fla {
import flash.display.*;
public dynamic class Timeline_297 extends MovieClip {
public function Timeline_297(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package framework_new4_fla
Section 123
//Timeline_39 (framework_new4_fla.Timeline_39)
package framework_new4_fla {
import flash.display.*;
public dynamic class Timeline_39 extends MovieClip {
public var backArray_mc:MovieClip;
public var mapArray_mc:MovieClip;
public var car:MovieClip;
public function Timeline_39(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package framework_new4_fla
Section 124
//Timeline_41 (framework_new4_fla.Timeline_41)
package framework_new4_fla {
import flash.display.*;
import flash.utils.*;
public dynamic class Timeline_41 extends MovieClip {
public var dieArray_mc:MovieClip;
public var __id10_:Car;
public var __setPropDict:Dictionary;
public var leihenArray_mc:MovieClip;
public var ground_mc:地面;
public var computerArray_mc:MovieClip;
public var throwArray_mc:MovieClip;
public var bulidArray_mc:MovieClip;
public var planeArray_mc:MovieClip;
public var bulidingDieArray_mc:MovieClip;
public function Timeline_41(){
__setPropDict = new Dictionary(true);
super();
addFrameScript(1, frame2);
}
function __setProp___id10___2(){
try {
__id10_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id10_.collidableList = "ground_mc";
try {
__id10_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function frame2(){
if ((((__setPropDict[__id10_] == undefined)) || (!((int(__setPropDict[__id10_]) == 2))))){
__setPropDict[__id10_] = currentFrame;
__setProp___id10___2();
};
stop();
}
}
}//package framework_new4_fla
Section 125
//Timeline_57 (framework_new4_fla.Timeline_57)
package framework_new4_fla {
import flash.display.*;
public dynamic class Timeline_57 extends MovieClip {
public var zhuazi_mc:MovieClip;
public var tou_mc:MovieClip;
public function Timeline_57(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package framework_new4_fla
Section 126
//Timeline_58 (framework_new4_fla.Timeline_58)
package framework_new4_fla {
import flash.display.*;
public dynamic class Timeline_58 extends MovieClip {
public function Timeline_58(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package framework_new4_fla
Section 127
//Timeline_59 (framework_new4_fla.Timeline_59)
package framework_new4_fla {
import flash.display.*;
import manage.*;
public dynamic class Timeline_59 extends MovieClip {
public var tank_mc:MovieClip;
public function Timeline_59(){
addFrameScript(0, frame1, 1, frame2);
}
function frame1(){
stop();
}
function frame2(){
tank_mc.gotoAndStop(GameManage.car.throwType);
}
}
}//package framework_new4_fla
Section 128
//Timeline_61 (framework_new4_fla.Timeline_61)
package framework_new4_fla {
import flash.display.*;
public dynamic class Timeline_61 extends MovieClip {
public function Timeline_61(){
addFrameScript(0, frame1, 3, frame4);
}
function frame1(){
stop();
}
function frame4(){
stop();
}
}
}//package framework_new4_fla
Section 129
//Timeline_65 (framework_new4_fla.Timeline_65)
package framework_new4_fla {
import flash.display.*;
public dynamic class Timeline_65 extends MovieClip {
public function Timeline_65(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package framework_new4_fla
Section 130
//Timeline_66 (framework_new4_fla.Timeline_66)
package framework_new4_fla {
import flash.display.*;
import manage.*;
public dynamic class Timeline_66 extends MovieClip {
public var life_mc:MovieClip;
public var mask_mc:bar;
public function Timeline_66(){
addFrameScript(0, frame1);
}
function frame1(){
life_mc.mask = mask_mc;
mask_mc.maxValue = GameManage.car.lifeMax;
mask_mc.value = GameManage.car.life;
}
}
}//package framework_new4_fla
Section 131
//FPS (help.FPS)
package help {
import flash.display.*;
import flash.utils.*;
import flash.text.*;
public class FPS extends Sprite {
public var txt:TextField;
private var ms:int;
private var fs:int;
public function FPS(){
reset();
TestBar.addRun(run);
}
private function reset():void{
ms = getTimer();
fs = 0;
}
private function run():void{
if ((getTimer() - ms) >= 1000){
txt.text = (fs + "fps");
reset();
} else {
fs++;
};
}
}
}//package help
Section 132
//MemoryBar (help.MemoryBar)
package help {
import flash.display.*;
import flash.text.*;
import flash.system.*;
public class MemoryBar extends Sprite {
public var bar:MovieClip;
public var txt:TextField;
public function MemoryBar(){
TestBar.addRun(run);
}
private function run():void{
bar.width = (System.totalMemory / 200000);
txt.text = ((System.totalMemory / (0x0400 * 0x0400)) + "MB");
}
}
}//package help
Section 133
//TestBar (help.TestBar)
package help {
import flash.display.*;
import flash.events.*;
import flash.text.*;
import flash.system.*;
public class TestBar extends Sprite {
public var osTxt:TextField;
public var screenResolutionTxt:TextField;
public var btnDebug:SimpleButton;
public var txt:TextField;
public var versionTxt:TextField;
public var playerTypeTxt:TextField;
public var btnPause:SimpleButton;
public var languageTxt:TextField;
private static var runArr:Array = new Array();
public function TestBar(){
Global.testBar = this;
versionTxt.text = Capabilities.version;
osTxt.text = Capabilities.os;
playerTypeTxt.text = Capabilities.playerType;
languageTxt.text = Capabilities.language;
screenResolutionTxt.text = ((Capabilities.screenResolutionX + "*") + Capabilities.screenResolutionY);
btnPause.addEventListener(MouseEvent.MOUSE_UP, setPause, false, 0, true);
btnDebug.addEventListener(MouseEvent.MOUSE_UP, debug, false, 0, true);
this.addEventListener(Event.ENTER_FRAME, run, false, 0, true);
}
public function showMsg(_arg1:String):void{
txt.text = _arg1;
}
public function clearMsg():void{
txt.text = "";
}
public function debug(_arg1:MouseEvent):void{
Global.debug();
}
public function setPause(_arg1:MouseEvent):void{
Global.pause = !(Global.pause);
}
public static function addRun(_arg1:Function):void{
runArr.push(_arg1);
}
public static function run(_arg1:Event):void{
var _local2:Function;
for each (_local2 in runArr) {
_local2();
};
}
}
}//package help
Section 134
//CommonManage (manage.CommonManage)
package manage {
import flash.display.*;
import flash.geom.*;
public class CommonManage {
public static function rand(_arg1:Number):Number{
return (int((Math.random() * _arg1)));
}
public static function to_global(_arg1:DisplayObject, _arg2:Number, _arg3:Number){
var _local4:Point;
_local4 = new Point(_arg2, _arg3);
return (_arg1.localToGlobal(_local4));
}
public static function to_local(_arg1:DisplayObject, _arg2:Number, _arg3:Number){
var _local4:Point;
_local4 = new Point(_arg2, _arg3);
return (_arg1.globalToLocal(_local4));
}
public static function getBoundsToCenter(_arg1:DisplayObject, _arg2:DisplayObject):Object{
var _local3:*;
var _local4:Object;
_local3 = _arg1.getBounds(_arg2);
_local4 = new Object();
_local4.x = (_local3.x + (_arg1.width / 2));
_local4.y = (_local3.y + (_arg1.height / 2));
return (_local4);
}
public static function frameToTime(_arg1:Number, _arg2:String):String{
var _local3:Number;
var _local4:Number;
var _local5:Number;
_local3 = int((_arg1 / ((32 * 60) * 60)));
_local4 = (int((_arg1 / (32 * 60))) % 60);
_local5 = (int((_arg1 / 32)) % 60);
if (_arg2 == "h:m:s"){
return (((((_local3 + ":") + _local4) + ":") + _local5));
};
return (((_local4 + ":") + _local5));
}
public static function random100(_arg1:Number){
var _local2:*;
if (_arg1 > 100){
_arg1 = 100;
};
_local2 = (Math.random() * 100);
if (_local2 <= _arg1){
return (true);
};
return (false);
}
public static function frameToSeconds(_arg1:int):int{
var _local2:*;
_local2 = int((_arg1 / 32));
return (_local2);
}
}
}//package manage
Section 135
//GameManage (manage.GameManage)
package manage {
import flash.display.*;
import flash.text.*;
public class GameManage extends MovieClip {
public var isPause:Boolean;// = false
public var pressQ_btn:SimpleButton;
public var isGameOver:Boolean;// = false
public var lifebar_mc:MovieClip;
public var km:TextField;
public var isSelectLevel:Boolean;// = false
public var map_mc:MovieClip;
public var level:Number;
public var score:Number;
public var zi_mc:MovieClip;
private var levelMax:Number;
var level_l:Number;
public var gameLevel:TextField;
public var levelup_mc:MovieClip;
public var gameScore:TextField;
var keyManage;
public var viewPress_mc:MovieClip;
public var money:Number;
var runTime:Number;
public static var frameSpeed:Number = 32;
static var levelScoreArray:Array = new Array(0, 800, 1600, 2300, 3500, 4800, 5500, 6800, 8000, 10000);
public static var gameCtrl:GameControl;
public static var Game:MovieClip;
static var levelMoneyArray:Array = new Array(250, 260, 300, 340, 380, 430, 500, 580, 650, 720);
public static var car:Car;
public static var gameName:String = "ET_SMASH";
public function GameManage(){
isGameOver = false;
isPause = false;
isSelectLevel = false;
super();
this.isSelectLevel = false;
this.isPause = true;
}
function reduceMoney(_arg1:Number){
this.addMoney((_arg1 * -1));
}
function win(){
trace("胜利了!");
this.isGameOver = true;
this.runTime = 0;
this.gotoAndStop("win");
}
public function init(){
this.isGameOver = false;
this.score = 0;
this.levelMax = 15;
this.level = 0;
this.level_l = 1;
this.runTime = 0;
this.nextLevel();
GameManage.gameCtrl = new GameControl();
trace("初始化GAME对象!");
}
function clearAll(){
}
function clearScore(){
this.score = 0;
}
function flashUpdateScore(_arg1:Number){
}
function flashUpdateMoney(_arg1:Number){
}
function nextLevel(){
this.isPause = false;
this.clearAll();
this.addNextLevelScore();
this.level = (this.level + 1);
if (this.level > this.levelMax){
this.win();
return;
};
trace((("进入第 " + this.level) + " 关!"));
}
function clearMoney(){
this.money = 0;
}
function run(){
if (this.isGameOver == false){
if (this.isPause == false){
};
};
}
function addMoney(_arg1:Number){
if (!isNaN(_arg1)){
this.money = (this.money + _arg1);
if (this.money < 0){
this.money = 0;
} else {
this.money = int(this.money);
};
this.flashUpdateMoney(_arg1);
};
}
function addNextLevelScore(){
}
function addScore(_arg1:Number){
if (!isNaN(_arg1)){
this.score = (this.score + _arg1);
if (this.score < 0){
this.score = 0;
} else {
this.score = int(this.score);
};
this.flashUpdateScore(_arg1);
};
}
function reduceScore(_arg1:Number){
this.addScore((_arg1 * -1));
}
function getLevel(){
return (this.level);
}
function gameOver(){
trace("gameover");
this.isGameOver = true;
this.runTime = 0;
this.gotoAndStop("gameover");
}
function isAllOver(){
}
}
}//package manage
Section 136
//CrashMissile (tank2007_2.CrashMissile)
package tank2007_2 {
import flash.display.*;
public dynamic class CrashMissile extends MovieClip {
public var flame_mc:MovieClip;
}
}//package tank2007_2
Section 137
//BackBuild (BackBuild)
package {
import flash.display.*;
public dynamic class BackBuild extends MovieClip {
public function BackBuild(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 138
//Bad (Bad)
package {
import flash.display.*;
public dynamic class Bad extends MovieClip {
public var bl:MovieClip;
public function Bad(){
addFrameScript(0, frame1, 12, frame13, 13, frame14, 14, frame15, 15, frame16);
}
function frame14(){
new Exp(bl);
}
function frame15(){
new Exp(bl);
}
function frame16(){
new Exp(bl);
}
function frame1(){
stop();
}
function frame13(){
new Exp(bl);
}
}
}//package
Section 139
//bad1 (bad1)
package {
import flash.display.*;
public dynamic class bad1 extends MovieClip {
public function bad1(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 140
//bad2 (bad2)
package {
import computer.*;
public dynamic class bad2 extends PeopleLife {
public function bad2(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 141
//bar (bar)
package {
public dynamic class bar extends ValueBar {
}
}//package
Section 142
//bcar1 (bcar1)
package {
import computer.*;
public dynamic class bcar1 extends Building {
}
}//package
Section 143
//bcar2 (bcar2)
package {
import computer.*;
public dynamic class bcar2 extends Building {
}
}//package
Section 144
//bcar3 (bcar3)
package {
import computer.*;
public dynamic class bcar3 extends Building {
}
}//package
Section 145
//bcar4 (bcar4)
package {
import computer.*;
public dynamic class bcar4 extends Building {
}
}//package
Section 146
//bcar5 (bcar5)
package {
import computer.*;
public dynamic class bcar5 extends Building {
}
}//package
Section 147
//Booo (Booo)
package {
import flash.display.*;
public dynamic class Booo extends MovieClip {
public function Booo(){
addFrameScript(15, frame16);
}
function frame16(){
if (parent){
parent.removeChild(this);
};
}
}
}//package
Section 148
//booo_s (booo_s)
package {
import flash.media.*;
public dynamic class booo_s extends Sound {
}
}//package
Section 149
//Booo2 (Booo2)
package {
import flash.display.*;
public dynamic class Booo2 extends MovieClip {
public function Booo2(){
addFrameScript(1, frame2, 18, frame19);
}
function frame19(){
stop();
if (parent){
parent.removeChild(this);
};
}
function frame2(){
Main.playSound("booo_s");
}
}
}//package
Section 150
//BoooB1 (BoooB1)
package {
import flash.display.*;
public dynamic class BoooB1 extends MovieClip {
public function BoooB1(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 151
//Booobcar1 (Booobcar1)
package {
import flash.display.*;
public dynamic class Booobcar1 extends MovieClip {
}
}//package
Section 152
//Booobcar2 (Booobcar2)
package {
import flash.display.*;
public dynamic class Booobcar2 extends MovieClip {
}
}//package
Section 153
//Booobcar3 (Booobcar3)
package {
import flash.display.*;
public dynamic class Booobcar3 extends MovieClip {
}
}//package
Section 154
//Booobcar4 (Booobcar4)
package {
import flash.display.*;
public dynamic class Booobcar4 extends MovieClip {
}
}//package
Section 155
//Booobcar5 (Booobcar5)
package {
import flash.display.*;
public dynamic class Booobcar5 extends MovieClip {
}
}//package
Section 156
//BoooTank1 (BoooTank1)
package {
import flash.display.*;
public dynamic class BoooTank1 extends MovieClip {
}
}//package
Section 157
//Building1 (Building1)
package {
import computer.*;
public dynamic class Building1 extends Building {
public function Building1(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 158
//Building2 (Building2)
package {
import computer.*;
public dynamic class Building2 extends Building {
public function Building2(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 159
//Car (Car)
package {
import flash.display.*;
import ape.*;
import flash.events.*;
import apeSp.*;
import flash.geom.*;
import manage.*;
import computer.*;
public class Car extends GroupSp {
public var life:int;
public var cancelObj:Object;
public var hitPower:int;
public var prevObject:Object;
public var throwType:int;
public var w1_mc:轮子;
public var body_mc:车身;
public var __id0_:连接;
public var __id1_:连接2;
public var __id2_:连接3;
public var attackType:int;
public var w2_mc:轮子;
public var lifeMax:int;
public var h1_mc:锤子;
public function Car(){
this.prevObject = new Object();
this.prevObject.x = 0;
this.prevObject.y = 0;
this.lifeMax = 1000;
this.life = this.lifeMax;
this.attackType = 1;
this.throwType = 0;
GameManage.car = this;
this.hitPower = 0;
Global.addRun("car.run()", run);
this.addEventListener(Event.ADDED_TO_STAGE, added, false, 0, true);
this.cancelObj = CommonManage.getBoundsToCenter(this.body_mc, root);
__setProp_w2_mc__1();
__setProp_w1_mc__1();
__setProp_body_mc__1();
__setProp___id2___1();
__setProp___id1___1();
__setProp___id0___1();
}
private function added(_arg1:Event):void{
this.removeEventListener(Event.ADDED_TO_STAGE, added);
stage.addEventListener(MouseEvent.MOUSE_DOWN, mouseDown, false, 0, true);
stage.addEventListener(MouseEvent.MOUSE_UP, mouseUp, false, 0, true);
stage.addEventListener(KeyboardEvent.KEY_DOWN, keyDown, false, 0, true);
stage.addEventListener(KeyboardEvent.KEY_UP, keyUp, false, 0, true);
}
function __setProp_w1_mc__1(){
try {
w1_mc["componentInspectorSetting"] = true;
} catch(e:Error) {
};
w1_mc.elasticity = 0.3;
w1_mc.fixed = false;
w1_mc.traction = 1;
w1_mc.mass = 100;
w1_mc.friction = 0.2;
try {
w1_mc["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
public function xue(){
if (this.life < (this.lifeMax * 0.2)){
if (this.body_mc.gaizi_mc.currentFrame != 4){
this.body_mc.gaizi_mc.gotoAndStop(4);
};
} else {
if (this.life < (this.lifeMax * 0.4)){
if (this.body_mc.gaizi_mc.currentFrame != 3){
this.body_mc.gaizi_mc.gotoAndStop(3);
};
} else {
if (this.life < (this.lifeMax * 0.7)){
if (this.body_mc.gaizi_mc.currentFrame != 2){
this.body_mc.gaizi_mc.gotoAndStop(2);
};
};
};
};
}
public function mouseUp(_arg1:MouseEvent){
var _local2:Object;
var _local3:ThrowTank;
if (this.throwType != 0){
_local2 = CommonManage.getBoundsToCenter(this.h1_mc, GameManage.Game.map_mc.car.throwArray_mc);
_local3 = new ThrowTank();
_local3.x = _local2.x;
_local3.y = _local2.y;
_local3.setType(this.throwType);
trace(("this.h1_mc.particle.velocity.x=" + this.h1_mc.particle.velocity.x));
_local3.setObject((this.h1_mc.particle.velocity.x / 3), (this.h1_mc.particle.velocity.y / 3));
this.h1_mc.chuizi_mc.zhuazi_mc.gotoAndStop(1);
this.throwType = 0;
GameManage.Game.map_mc.car.throwArray_mc.addChild(_local3);
};
}
public function addLife(_arg1:int){
this.life = (this.life + _arg1);
if (this.life > this.lifeMax){
this.life = this.lifeMax;
};
}
private function keyUp(_arg1:KeyboardEvent):void{
goSpeed = 0;
}
public function pressQ(){
if (this.attackType == 1){
this.throwType = 0;
this.h1_mc.chuizi_mc.gotoAndStop(2);
this.attackType = 2;
} else {
this.attackType = 1;
this.h1_mc.chuizi_mc.gotoAndStop(1);
};
}
function __setProp___id1___1(){
try {
__id1_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id1_.joinP1Str = "p1_mc";
__id1_.joinP2Str = "p2_mc";
__id1_.phSpList = "";
__id1_.hitRectName = "";
__id1_.stiffness = 1;
__id1_.autoJoin = false;
try {
__id1_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp_w2_mc__1(){
try {
w2_mc["componentInspectorSetting"] = true;
} catch(e:Error) {
};
w2_mc.elasticity = 0.3;
w2_mc.fixed = false;
w2_mc.traction = 1;
w2_mc.mass = 100;
w2_mc.friction = 0.2;
try {
w2_mc["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
public function set goSpeed(_arg1:Number):void{
w1_mc.particle.angularVelocity = (w2_mc.particle.angularVelocity = _arg1);
}
private function run():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:*;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:*;
var _local9:*;
var _local10:int;
var _local11:*;
var _local12:Object;
_local1 = (this.mouseX - h1_mc.x);
_local2 = (this.mouseY - h1_mc.y);
_local3 = Math.sqrt(((_local1 * _local1) + (_local2 * _local2)));
_local4 = 100;
if (_local3 > _local4){
_local7 = (_local4 / _local3);
_local1 = (_local1 * _local7);
_local2 = (_local2 * _local7);
};
h1_mc.particle.velocity = new Vector(_local1, _local2);
_local5 = (this.h1_mc.x - this.prevObject.x);
_local6 = (this.h1_mc.y - this.prevObject.y);
if (_local6 > 10){
this.hitPower = int(((Math.abs(_local5) / 2) + (Math.abs(_local6) * 2)));
} else {
this.hitPower = 0;
};
this.prevObject.x = this.h1_mc.x;
this.prevObject.y = this.h1_mc.y;
this.cancelObj = CommonManage.getBoundsToCenter(this.body_mc, root);
if (this.attackType == 1){
if (this.hitPower != 0){
_local8 = CommonManage.to_global(this.h1_mc, this.h1_mc.hit1_mc.x, this.h1_mc.hit1_mc.y);
_local9 = CommonManage.to_global(this.h1_mc, this.h1_mc.hit2_mc.x, this.h1_mc.hit2_mc.y);
if (((GameManage.Game.map_mc.car.computerArray_mc.hitTestPoint(_local8.x, _local8.y, true)) || (GameManage.Game.map_mc.car.computerArray_mc.hitTestPoint(_local9.x, _local9.y, true)))){
_local10 = 0;
while (_local10 < GameManage.Game.map_mc.car.computerArray_mc.numChildren) {
if (((GameManage.Game.map_mc.car.computerArray_mc.getChildAt(_local10).hitTestPoint(_local8.x, _local8.y, true)) || (GameManage.Game.map_mc.car.computerArray_mc.getChildAt(_local10).hitTestPoint(_local9.x, _local9.y, true)))){
GameManage.Game.map_mc.car.computerArray_mc.getChildAt(_local10).hitMy(GameManage.car.hitPower);
};
_local10++;
};
};
if (((GameManage.Game.map_mc.car.bulidArray_mc.hitTestPoint(_local8.x, _local8.y, true)) || (GameManage.Game.map_mc.car.bulidArray_mc.hitTestPoint(_local9.x, _local9.y, true)))){
_local10 = 0;
while (_local10 < GameManage.Game.map_mc.car.bulidArray_mc.numChildren) {
if (((GameManage.Game.map_mc.car.bulidArray_mc.getChildAt(_local10).hitTestPoint(_local8.x, _local8.y, true)) || (GameManage.Game.map_mc.car.bulidArray_mc.getChildAt(_local10).hitTestPoint(_local9.x, _local9.y, true)))){
GameManage.Game.map_mc.car.bulidArray_mc.getChildAt(_local10).die();
};
_local10++;
};
};
};
} else {
if (this.h1_mc.x >= this.body_mc.x){
if (this.h1_mc.chuizi_mc.zhuazi_mc){
this.h1_mc.chuizi_mc.zhuazi_mc.rotation = 40;
};
} else {
if (this.h1_mc.chuizi_mc.zhuazi_mc){
this.h1_mc.chuizi_mc.zhuazi_mc.rotation = 220;
};
};
};
if (this.cancelObj.x > 400){
_local11 = (400 - this.cancelObj.x);
GameManage.Game.map_mc.x = (GameManage.Game.map_mc.x + int(_local11));
if (int((_local11 > 1))){
GameManage.gameCtrl.addScore(1);
};
GameManage.Game.map_mc.backArray_mc.x = (GameManage.Game.map_mc.backArray_mc.x - int((_local11 / 2)));
_local12 = CommonManage.getBoundsToCenter(this.body_mc, GameManage.Game.map_mc.car);
GameManage.Game.map_mc.car.ground_mc.x = (_local12.x - 400);
GameManage.gameCtrl.upDateMap();
GameManage.gameCtrl.liner = int((Math.abs((GameManage.Game.map_mc.x - 500)) / 10));
GameManage.Game.km.text = ((String(GameManage.gameCtrl.liner) + "/") + String(GameManage.gameCtrl.nextLiner));
};
}
function __setProp_body_mc__1(){
try {
body_mc["componentInspectorSetting"] = true;
} catch(e:Error) {
};
body_mc.joinP1Str = "wSet1_mc";
body_mc.joinP2Str = "wSet2_mc";
body_mc.phSpList = "";
body_mc.hitRectName = "hit_mc";
body_mc.stiffness = 0.5;
body_mc.autoJoin = false;
try {
body_mc["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
private function keyDown(_arg1:KeyboardEvent):void{
switch (_arg1.keyCode){
case 37:
goSpeed = -1;
break;
case 39:
goSpeed = 1;
break;
};
}
public function removeLife(_arg1:int){
this.life = (this.life - _arg1);
GameManage.Game.lifebar_mc.mask_mc.value = this.life;
this.xue();
if (this.life <= 0){
trace("结束了!!");
GameManage.gameCtrl.costLenMax();
Main.lose();
};
}
public function set velocity(_arg1:Vector):void{
w1_mc.particle.velocity = (w2_mc.particle.velocity = _arg1);
}
public function get velocity():Vector{
return (w1_mc.particle.velocity);
}
function __setProp___id0___1(){
try {
__id0_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id0_.joinP1Str = "p1_mc";
__id0_.joinP2Str = "p2_mc";
__id0_.phSpList = "body_mc";
__id0_.hitRectName = "";
__id0_.stiffness = 1;
__id0_.autoJoin = true;
try {
__id0_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
public function mouseDown(_arg1:MouseEvent){
var _local2:*;
var _local3:*;
var _local4:int;
if (this.attackType == 2){
_local2 = CommonManage.to_global(this.h1_mc, this.h1_mc.hit1_mc.x, this.h1_mc.hit1_mc.y);
_local3 = CommonManage.to_global(this.h1_mc, this.h1_mc.hit2_mc.x, this.h1_mc.hit2_mc.y);
if (((GameManage.Game.map_mc.car.computerArray_mc.hitTestPoint(_local2.x, _local2.y, true)) || (GameManage.Game.map_mc.car.computerArray_mc.hitTestPoint(_local3.x, _local3.y, true)))){
_local4 = 0;
while (_local4 < GameManage.Game.map_mc.car.computerArray_mc.numChildren) {
if (((GameManage.Game.map_mc.car.computerArray_mc.getChildAt(_local4).hitTestPoint(_local2.x, _local2.y, true)) || (GameManage.Game.map_mc.car.computerArray_mc.getChildAt(_local4).hitTestPoint(_local3.x, _local3.y, true)))){
if (GameManage.Game.map_mc.car.computerArray_mc.getChildAt(_local4).myType != 0){
this.throwType = GameManage.Game.map_mc.car.computerArray_mc.getChildAt(_local4).myType;
this.h1_mc.chuizi_mc.zhuazi_mc.gotoAndStop(2);
GameManage.Game.map_mc.car.computerArray_mc.getChildAt(_local4).die();
break;
};
};
_local4++;
};
};
};
}
function __setProp___id2___1(){
try {
__id2_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id2_.joinP1Str = "p1_mc";
__id2_.joinP2Str = "p2_mc";
__id2_.phSpList = "";
__id2_.hitRectName = "";
__id2_.stiffness = 1;
__id2_.autoJoin = false;
try {
__id2_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
}
}//package
Section 160
//death_0 (death_0)
package {
import flash.media.*;
public dynamic class death_0 extends Sound {
}
}//package
Section 161
//death_1 (death_1)
package {
import flash.media.*;
public dynamic class death_1 extends Sound {
}
}//package
Section 162
//death_2 (death_2)
package {
import flash.media.*;
public dynamic class death_2 extends Sound {
}
}//package
Section 163
//death_3 (death_3)
package {
import flash.media.*;
public dynamic class death_3 extends Sound {
}
}//package
Section 164
//Exp (Exp)
package {
import flash.display.*;
import flash.events.*;
public class Exp {
private var pieceArr:Array;
private var g:Number;
private var sp:Sprite;
public function Exp(_arg1:Sprite, _arg2:Number=2):void{
var _local3:int;
var _local4:Piece;
super();
sp = _arg1;
g = _arg2;
pieceArr = new Array();
_local3 = sp.numChildren;
while (--_local3 >= 0) {
pieceArr.push(new Piece((sp.getChildAt(_local3) as Sprite)));
};
sp.addEventListener(Event.ENTER_FRAME, expRun);
}
private function expRun(_arg1:Event):void{
var _local2:int;
var _local3:Piece;
_local2 = pieceArr.length;
while (--_local2 >= 0) {
_local3 = pieceArr[_local2];
if (_local3.run(g)){
pieceArr.splice(_local2, 1);
};
};
if (pieceArr.length == 0){
sp.removeEventListener(Event.ENTER_FRAME, expRun);
};
}
}
}//package
import flash.display.*;
import flash.geom.*;
class Piece {
private var vx:Number;
private var vy:Number;
private var va:Number;
private var xCenter:Number;
private var yCenter:Number;
private var vxP:Point;
private var x:Number;
private var y:Number;
private var sp:Sprite;
private function Piece(_arg1:Sprite){
var _local2:Rectangle;
super();
sp = _arg1;
_local2 = sp.getBounds(sp);
xCenter = (_local2.x + (_local2.width / 2));
yCenter = (_local2.y + (_local2.height / 2));
vxP = new Point((sp.x - xCenter), (sp.y - yCenter));
vxP.normalize((0.1 + (0.9 * Math.abs((vxP.x / vxP.length)))));
vx = (15 + ((Math.random() - 0.5) * 7));
vy = (-30 - ((Math.random() + 0.5) * 10));
va = (10 - (Math.random() * 21));
screenToPoint(sp, this);
}
public function screenToPoint(_arg1:Sprite, _arg2:Piece):void{
_arg2.x = ((_arg1.x - xCenter) / vxP.x);
_arg2.y = ((_arg1.y - yCenter) - (vxP.y * _arg2.x));
}
public function run(_arg1:Number):Boolean{
vx = (vx * 0.95);
vy = (vy * 0.95);
x = (x + vx);
vy = (vy + _arg1);
y = (y + vy);
if (y > 0){
y = 0;
vy = (vy * -0.6);
};
pointToScreen(this, sp);
sp.rotation = (sp.rotation + va);
sp.scaleX = (sp.scaleY = (sp.scaleY * 0.95));
if ((((vx * vx) + (vy * vy)) + (y * y)) < 5){
sp.parent.removeChild(sp);
return (true);
};
return (false);
}
public function pointToScreen(_arg1:Piece, _arg2:Sprite):void{
_arg2.x = (xCenter + (vxP.x * _arg1.x));
_arg2.y = ((yCenter + (vxP.y * _arg1.x)) + _arg1.y);
}
}
Section 165
//ExtMath (ExtMath)
package {
import flash.geom.*;
public class ExtMath {
public static function tanD(_arg1){
return (Math.tan(((_arg1 * 3.141593) / 180)));
}
public static function cosD(_arg1){
return (Math.cos(((_arg1 * 3.141593) / 180)));
}
public static function acosD(_arg1){
return ((Math.acos(_arg1) * 57.29578));
}
public static function to_global(_arg1, _arg2, _arg3){
var _local4:*;
_local4 = {x:_arg2, y:_arg3};
_arg1.localToGlobal(_local4);
return (_local4);
}
public static function countDistance(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return (Math.sqrt(((Math.abs((_arg3 - _arg1)) * Math.abs((_arg3 - _arg1))) + (Math.abs((_arg4 - _arg2)) * Math.abs((_arg4 - _arg2))))));
}
public static function sinD(_arg1){
return (Math.sin(((_arg1 * 3.141593) / 180)));
}
public static function asinD(_arg1){
return ((Math.asin(_arg1) * 57.29578));
}
public static function to_local(_arg1, _arg2, _arg3, _arg4){
_arg4 = {x:_arg2, y:_arg3};
_arg1.globalToLocal(_arg4);
return (_arg4);
}
public static function degreesToRadians(_arg1){
return ((_arg1 * 0.017453));
}
public static function atan2D(_arg1, _arg2){
return ((Math.atan2(_arg1, _arg2) * 57.29578));
}
public static function distance(_arg1, _arg2, _arg3, _arg4){
var _local5:*;
var _local6:*;
_local5 = (_arg3 - _arg1);
_local6 = (_arg4 - _arg2);
return (Math.sqrt(((_local5 * _local5) + (_local6 * _local6))));
}
public static function fixAngle(_arg1){
var _local2:*;
_local2 = (_arg1 % 360);
return ((((_local2 % 360) < 0)) ? (_local2 + 360) : _local2);
}
public static function radiansToDegrees(_arg1){
return ((_arg1 * 57.29578));
}
public static function countMoveLen(_arg1:Object, _arg2:Object, _arg3:Number):Object{
var _local4:Number;
_local4 = ExtMath.angleOfLine(_arg1.x, _arg1.y, _arg2.x, _arg2.y);
return (Point.polar(_arg3, ((_local4 * Math.PI) / 180)));
}
public static function distance2(_arg1, _arg2, _arg3, _arg4){
var _local5:*;
var _local6:*;
_local5 = (_arg3 - _arg1);
_local6 = (_arg4 - _arg2);
return (((_local5 * _local5) + (_local6 * _local6)));
}
public static function angleOfLine(_arg1, _arg2, _arg3, _arg4){
return (ExtMath.atan2D((_arg4 - _arg2), (_arg3 - _arg1)));
}
}
}//package
Section 166
//GameControl (GameControl)
package {
import flash.display.*;
import apeSp.*;
import flash.geom.*;
import manage.*;
import computer.*;
public class GameControl {
public var level:int;
private var planeTime:int;
public var nextLiner:int;
public var body_mc:MovieClip;
public var len:int;
public var lenMax:int;
public var score:int;
private var planeTimeMax:int;
private var cpuTime:Number;
public var nowBack:DisplayObject;
public var nextTime:int;
public var nowMap:DisplayObject;
public var nextMap:DisplayObject;
private var runTime:Number;
public var nextBack:DisplayObject;
public var prevTimeT:int;
public var liner:int;
public static var lineArray:Array = new Array(0, 200, 500, 800);
public function GameControl(){
this.liner = 0;
this.nextLiner = 200;
this.nextTime = 1200;
this.prevTimeT = CommonManage.frameToSeconds(this.nextTime);
Tank.pDieNum = 0;
Tank.peopleSum = 0;
Tank.tankSum = 0;
this.lenMax = 0;
this.level = 1;
trace(("GameManage.Game.myLevel=" + GameManage.Game.gameLevel));
GameManage.Game.gameLevel.text = this.level;
this.score = 0;
GameManage.Game.gameScore.text = this.score;
this.runTime = -30;
this.cpuTime = 20;
this.createMap();
Global.addRun("gameCtrl.run()", run);
this.planeTime = 0;
this.planeTimeMax = ((250 - (this.level * 10)) + CommonManage.rand(20));
}
public function upDateMap(){
var _local1:Point;
var _local2:Point;
var _local3:Road;
var _local4:*;
var _local5:int;
var _local6:BackBuild;
_local1 = CommonManage.to_global(this.nowMap.parent, this.nowMap.x, this.nowMap.y);
if (_local1.x <= -510){
this.nowMap.parent.removeChild(this.nowMap);
this.nowMap = this.nextMap;
_local3 = new Road();
_local3.x = (this.nowMap.x + 999);
_local3.y = 482;
_local3.lou_mc.gotoAndStop((CommonManage.rand(_local3.lou_mc.totalFrames) + 1));
_local3.len.text = (String((this.len + 100)) + "m");
this.len = (this.len + 100);
this.nextMap = GameManage.Game.map_mc.mapArray_mc.addChild(_local3);
_local4 = (CommonManage.rand(2) + 1);
_local5 = 1;
while (_local5 <= _local4) {
this.createBuilding(_local5);
_local5++;
};
_local4 = (CommonManage.rand(3) + 1);
_local5 = 1;
while (_local5 <= _local4) {
this.createCar(_local5);
_local5++;
};
};
_local2 = CommonManage.to_global(this.nowBack.parent, this.nowBack.x, this.nowBack.y);
if (_local2.x <= -510){
this.nowBack.parent.removeChild(this.nowBack);
this.nowBack = this.nextBack;
_local6 = new BackBuild();
_local6.x = (this.nowBack.x + 1000);
_local6.y = 125;
_local6.gotoAndStop((CommonManage.rand(_local6.totalFrames) + 1));
this.nextBack = GameManage.Game.map_mc.backArray_mc.addChild(_local6);
};
}
public function costLenMax(){
var _local1:*;
var _local2:Object;
_local1 = CommonManage.to_global(this.nextMap.parent, this.nextMap.x, this.nextMap.y);
_local2 = CommonManage.getBoundsToCenter(GameManage.car.body_mc, GameManage.car);
this.lenMax = (this.len - int((((_local1.x + 500) - _local2.x) / 10)));
}
public function createOneComputer(_arg1:int){
var _local2:Number;
var _local3:*;
_local2 = 0;
if (this.level <= 3){
if (CommonManage.random100(50)){
_local2 = 0;
} else {
if (CommonManage.random100(60)){
_local2 = 1;
} else {
_local2 = 2;
};
};
} else {
if (this.level <= 7){
if (CommonManage.random100(40)){
_local2 = 1;
} else {
if (CommonManage.random100(40)){
_local2 = 2;
} else {
if (CommonManage.random100(50)){
_local2 = 3;
} else {
_local2 = 0;
};
};
};
} else {
if (CommonManage.random100(30)){
_local2 = 1;
} else {
if (CommonManage.random100(40)){
_local2 = 2;
} else {
if (CommonManage.random100(70)){
_local2 = 3;
} else {
_local2 = 0;
};
};
};
};
};
switch (_local2){
case 0:
_local3 = new Tank0();
_local3.setType(_local2, _arg1);
break;
case 1:
_local3 = new Tank1();
_local3.setType(_local2, _arg1);
break;
case 2:
_local3 = new Tank2();
_local3.setType(_local2, _arg1);
break;
case 3:
_local3 = new Tank3();
_local3.setType(_local2, _arg1);
break;
};
switch (_arg1){
case 1:
_local3.x = (1200 - GameManage.Game.map_mc.x);
break;
case 2:
_local3.x = (-80 - GameManage.Game.map_mc.x);
break;
};
_local3.y = 445;
GameManage.Game.map_mc.car.computerArray_mc.addChild(_local3);
}
public function levelUp(){
this.level++;
GameManage.Game.gameLevel.text = this.level;
GameManage.Game.levelup_mc.gotoAndPlay(2);
}
public function createBuilding(_arg1:int){
var _local2:Building;
switch ((CommonManage.rand(2) + 1)){
case 1:
_local2 = new Building1();
_local2.setType(1);
_local2.gotoAndStop((CommonManage.rand(_local2.totalFrames) + 1));
break;
case 2:
_local2 = new Building2();
_local2.setType(2);
break;
};
_local2.x = ((this.nextMap.x + ((_arg1 - 1) * 600)) + 200);
_local2.y = 408;
GameManage.Game.map_mc.car.bulidArray_mc.addChild(_local2);
}
public function upDateUpLevel(){
this.nextTime--;
if (this.liner >= this.nextLiner){
this.levelUp();
this.nextLiner = (this.nextLiner + (200 + (this.level * 10)));
this.nextTime = 1000;
GameManage.Game.km.text = ((String(GameManage.gameCtrl.liner) + "/") + String(GameManage.gameCtrl.nextLiner));
this.viewTime();
return;
};
this.viewTime();
if (this.nextTime <= 0){
Main.lose();
};
}
public function run(){
this.runTime++;
if (this.runTime >= this.cpuTime){
if (GameManage.Game.map_mc.car.computerArray_mc.numChildren < 15){
this.createOneComputer(1);
this.createOneComputer(2);
};
this.runTime = 0;
this.cpuTime = ((this.runTime + CommonManage.rand(10)) + 30);
};
this.planeTime++;
if (this.planeTime >= this.planeTimeMax){
this.createPlane();
this.planeTime = 0;
if (this.level < 10){
this.planeTimeMax = ((250 - (this.level * 10)) + CommonManage.rand(20));
} else {
this.planeTimeMax = (CommonManage.rand(20) + 130);
};
};
this.upDateUpLevel();
}
public function createMap(){
var _local1:Road;
var _local2:Road;
var _local3:BackBuild;
var _local4:BackBuild;
_local1 = new Road();
_local1.x = 500;
_local1.y = 482;
_local1.len.text = "100m";
this.nowMap = GameManage.Game.map_mc.mapArray_mc.addChild(_local1);
_local2 = new Road();
_local2.x = (this.nowMap.x + 999);
_local2.y = 482;
_local2.lou_mc.gotoAndStop((CommonManage.rand(_local2.lou_mc.totalFrames) + 1));
_local2.len.text = "200m";
this.nextMap = GameManage.Game.map_mc.mapArray_mc.addChild(_local2);
this.len = 200;
_local3 = new BackBuild();
_local3.x = 500;
_local3.y = 125;
_local3.gotoAndStop((CommonManage.rand(_local3.totalFrames) + 1));
this.nowBack = GameManage.Game.map_mc.backArray_mc.addChild(_local3);
_local4 = new BackBuild();
_local4.x = (_local3.x + 1000);
_local4.y = 125;
_local4.gotoAndStop((CommonManage.rand(_local4.totalFrames) + 1));
this.nextBack = GameManage.Game.map_mc.backArray_mc.addChild(_local4);
}
public function createCar(_arg1:int){
var _local2:Building;
switch ((CommonManage.rand(5) + 3)){
case 3:
_local2 = new bcar1();
_local2.setType(3);
break;
case 4:
_local2 = new bcar2();
_local2.setType(4);
break;
case 5:
_local2 = new bcar3();
_local2.setType(5);
break;
case 6:
_local2 = new bcar4();
_local2.setType(6);
break;
case 7:
_local2 = new bcar5();
_local2.setType(7);
break;
};
_local2.x = ((this.nextMap.x + ((_arg1 - 1) * 350)) + 150);
_local2.y = 430;
GameManage.Game.map_mc.car.bulidArray_mc.addChild(_local2);
}
public function addScore(_arg1:int){
this.score = (this.score + _arg1);
GameManage.Game.gameScore.text = this.score;
}
public function createPlane(){
var _local1:Plane;
if (GameManage.Game.map_mc.car.planeArray_mc.numChildren < 1){
_local1 = new Plane();
_local1.setFangxiang((CommonManage.rand(2) + 1));
GameManage.Game.map_mc.car.planeArray_mc.addChild(_local1);
};
}
public function viewTime(){
var _local1:*;
_local1 = CommonManage.frameToSeconds(this.nextTime);
if (this.prevTimeT != _local1){
GameManage.Game.zi_mc.gotoAndPlay(1);
GameManage.Game.zi_mc.zi_mc.zi.text = (String(_local1) + "sec");
this.prevTimeT = _local1;
};
}
}
}//package
Section 167
//gameMain (gameMain)
package {
import flash.display.*;
import ape.*;
import flash.media.*;
import flash.net.*;
import flash.events.*;
import flash.geom.*;
import manage.*;
import flash.utils.*;
import flash.text.*;
import framework.btns.*;
import flash.filters.*;
import flash.system.*;
import flash.ui.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.xml.*;
public dynamic class gameMain extends GameManage {
public var __setPropDict:Dictionary;
public var __id11_:Btn_Menu;
public function gameMain(){
__setPropDict = new Dictionary(true);
super();
addFrameScript(1, frame2, 2, frame3);
}
function frame2(){
GameManage.Game = this;
Global.addRun("game run", run);
APEngine.init((1 / 4));
APEngine.container = map_mc.car;
APEngine.addMasslessForce(new Vector(0, 8));
Global.init(stage);
}
function __setProp___id11___3(){
try {
__id11_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id11_.action = "自定义";
__id11_.toolTip = "";
__id11_.alert = "BACK TO MAIN MENU?";
__id11_.hotKeys = "可输入字符或键值或键名^_^";
try {
__id11_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
public function __pressQ(_arg1:MouseEvent):void{
GameManage.car.pressQ();
viewPress_mc.gotoAndStop(GameManage.car.attackType);
}
function frame3(){
if ((((__setPropDict[__id11_] == undefined)) || (!((int(__setPropDict[__id11_]) == 3))))){
__setPropDict[__id11_] = currentFrame;
__setProp___id11___3();
};
stop();
this.init();
viewPress_mc.mouseEnabled = false;
pressQ_btn.addEventListener(MouseEvent.CLICK, __pressQ);
GameManage.Game.km.text = ((String(GameManage.gameCtrl.liner) + "/") + String(GameManage.gameCtrl.nextLiner));
GameManage.Game.zi_mc.zi_mc.zi.text = (String(GameManage.gameCtrl.prevTimeT) + "sec");
}
public function run():void{
APEngine.step();
APEngine.paint();
}
}
}//package
Section 168
//Global (Global)
package {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
public class Global {
public static var msg:String;
public static var pause:Boolean;
public static var check:Function = function (){
var _local1:*;
trace("未指向任何有效函数");
_local1.kk;
};
public static var prevKeyFlagArr:Array = getArrByValue(0x0100, false);
public static var testBar;
private static var dictObjs:Object = new Object();
public static var checkArr:Array = new Array();
public static var onKeyUp:Function = function (_arg1:int){
};
public static var mainPause:Boolean;
private static var delRunArr:Array = new Array();
public static var checkEvents:Boolean = true;
public static var onKeyDown:Function = function (_arg1:int){
};
private static var runArr:Array = new Array();
private static var addRunArr:Array = new Array();
private static var limitTraceNum:int = 10;
public static var keyCtrlObjArr:Array = new Array();
public static var runTime:Number;
public static var keyFlagArr:Array = getArrByValue(0x0100, false);
public static function delRun(_arg1:Function):void{
delRunArr.push(_arg1);
}
private static function dumpCOAF(_arg1:CheckObj):Boolean{
if ((_arg1.obj is DisplayObject)){
return ((_arg1.obj.root == null));
};
return ((_arg1.obj == undefined));
}
public static function removeEvent(_arg1, _arg2:String, _arg3:Function):void{
var _local4:DictObj;
_arg1.removeEventListener(_arg2, _arg3);
if (checkEvents){
_local4 = dictObjs[_arg2];
if (_local4 == undefined){
return;
};
_local4.removeData(_arg1, _arg3);
if (_local4.total <= 0){
delete dictObjs[_arg2];
};
};
}
private static function runAll(_arg1:Event):void{
var _local2:Number;
var _local3:Function;
var _local4:RunObj;
var _local5:int;
var _local6:Boolean;
var _local7:Boolean;
_local2 = getTimer();
msg = "";
_local5 = 0;
for each (_local4 in runArr) {
if (delRunArr.indexOf(_local4.runF) >= 0){
runArr[_local5] = null;
};
_local5++;
};
runArr = runArr.concat(addRunArr);
delRunArr = new Array();
addRunArr = new Array();
if (mainPause){
updateTestBar();
return;
};
_local5 = 0;
for each (_local6 in keyFlagArr) {
_local7 = prevKeyFlagArr[_local5];
if (((!(_local7)) && (_local6))){
onKeyDown(_local5);
runKeyCtrl("_onKeyDown", _local5);
} else {
if (((_local7) && (!(_local6)))){
onKeyUp(_local5);
runKeyCtrl("_onKeyUp", _local5);
};
};
prevKeyFlagArr[_local5] = _local6;
_local5++;
};
dumpArrByF(runArr, dumpRunArrF);
for each (_local4 in runArr) {
_local4.run();
};
updateTestBar();
runTime = (getTimer() - _local2);
}
public static function init(_arg1:Stage):void{
trace("有空把runArr改成dictionary");
addEvent(_arg1, Event.ENTER_FRAME, runAll, "runAll");
addEvent(_arg1, KeyboardEvent.KEY_DOWN, keyDown, "keyDown");
addEvent(_arg1, KeyboardEvent.KEY_UP, keyUp, "keyUp");
addCheck(Global, "pause");
addCheck(Global, "keyCtrlObjArr");
addCheck(Global, "checkArr");
}
private static function updateTestBar():void{
var _local1:RunObj;
var _local2:CheckObj;
var _local3:*;
if (testBar == null){
return;
};
msg = (msg + "-------------------------------\n");
msg = (msg + "runArr:\n");
msg = (msg + (("runArr.length=" + runArr.length) + "\n"));
for each (_local1 in runArr) {
msg = (msg + (_local1.info + "\n"));
};
msg = (msg + (("耗时" + runTime) + "毫秒\n"));
msg = (msg + "--------------------\n");
dumpArrByF(checkArr, dumpCOAF);
for each (_local2 in checkArr) {
_local3 = _local2.obj[_local2.valName];
if ((_local3 is Array)){
_local3 = _local3.length;
};
msg = (msg + (((((_local2.obj + ",") + _local2.valName) + ",") + _local3) + "\n"));
};
msg = (msg + "--------------------\n");
msg = (msg + getAllEvents());
testBar.showMsg(msg);
}
private static function dumpRunArrF(_arg1:RunObj):Boolean{
return ((((_arg1 == null)) || ((_arg1.times <= 0))));
}
public static function addMsg(_arg1):void{
if (testBar == null){
return;
};
msg = (msg + (_arg1 + "\n"));
}
private static function keyDown(_arg1:KeyboardEvent):void{
keyFlagArr[_arg1.keyCode] = true;
}
public static function addRun(_arg1:String, _arg2:Function, _arg3:int=1, _arg4:int=2147483647, _arg5:Boolean=true):void{
delRun(_arg2);
if (_arg3 >= 1){
} else {
_arg3 = 1;
};
if (_arg4 >= 1){
} else {
_arg4 = int.MAX_VALUE;
};
addRunArr.push(new RunObj(_arg1, _arg2, _arg3, _arg4, _arg5));
}
public static function keyIsDown(_arg1:int):Boolean{
return (keyFlagArr[_arg1]);
}
private static function getArrByValue(_arg1:int, _arg2):Array{
var _local3:Array;
_local3 = new Array(_arg1);
while (--_arg1 >= 0) {
_local3[_arg1] = _arg2;
};
return (_local3);
}
public static function addKeyCtrl(_arg1):void{
keyCtrlObjArr.unshift(_arg1);
}
public static function delCheck(_arg1, _arg2:String):Boolean{
var _local3:int;
var _local4:CheckObj;
_local3 = 0;
for each (_local4 in checkArr) {
if ((((_local4.obj == _arg1)) && ((_local4.valName == _arg2)))){
checkArr[_local3] = null;
return (true);
};
_local3++;
};
return (false);
}
public static function clearAllKeyCtrl():void{
keyCtrlObjArr = new Array();
}
public static function limitTrace(... _args):void{
if (--limitTraceNum >= 0){
trace(_args);
};
}
private static function dumpArr(_arg1:Array):void{
var _local2:int;
_local2 = _arg1.length;
while (--_local2 >= 0) {
if (_arg1[_local2] == undefined){
_arg1.splice(_local2, 1);
};
};
}
private static function dumpArrByF(_arg1:Array, _arg2:Function):void{
var _local3:int;
_local3 = _arg1.length;
while (--_local3 >= 0) {
if (_arg2(_arg1[_local3])){
_arg1.splice(_local3, 1);
};
};
}
public static function debug():void{
check();
}
private static function keyUp(_arg1:KeyboardEvent):void{
keyFlagArr[_arg1.keyCode] = false;
}
public static function clearAllRun():void{
delRunArr = new Array();
addRunArr = new Array();
runArr = new Array();
}
public static function delKeyCtrl():void{
keyCtrlObjArr.shift();
}
private static function runKeyCtrl(_arg1:String, _arg2:int):void{
var obj:*;
var keyFName = _arg1;
var keyCode = _arg2;
for each (obj in keyCtrlObjArr) {
if (obj.root){
try {
var _local6 = obj;
_local6[keyFName](keyCode);
} catch(e) {
};
return;
};
trace(("移除含按键控制的obj:" + obj));
keyCtrlObjArr.shift();
};
}
public static function addCheck(_arg1, _arg2:String):void{
checkArr.push(new CheckObj(_arg1, _arg2));
}
public static function getAllEvents():String{
var _local1:int;
var _local2:String;
var _local3:String;
var _local4:int;
var _local5:String;
var _local6:DictObj;
var _local7:*;
var _local8:DictObjItem;
var _local9:*;
_local1 = 0;
_local2 = "";
for (_local3 in dictObjs) {
_local4 = 0;
_local5 = "";
_local6 = dictObjs[_local3];
for (_local7 in _local6) {
_local5 = (_local5 + ((" " + _local7) + "--"));
_local8 = _local6[_local7];
_local4 = (_local4 + _local8.total);
_local1 = (_local1 + _local8.total);
for (_local9 in _local8) {
_local5 = (_local5 + (_local8[_local9] + " "));
};
_local5 = (_local5 + "\n");
};
_local2 = (_local2 + ((((_local3 + "--") + _local4) + "\n") + _local5));
};
return (((("共有事件个数:" + _local1) + "\n") + _local2));
}
public static function addEvent(_arg1, _arg2:String, _arg3:Function, _arg4:String):void{
var _local5:DictObj;
_arg1.addEventListener(_arg2, _arg3, false, 0, true);
if (checkEvents){
_local5 = dictObjs[_arg2];
if (_local5 == undefined){
_local5 = (dictObjs[_arg2] = new DictObj());
};
_local5.addData(_arg1, _arg3, _arg4);
};
}
}
}//package
import flash.utils.*;
class RunObj {
private var intervalNum:int;
private var interval:int;
public var times:int;
public var info:String;
private var pauseAble:Boolean;
public var runF:Function;
private function RunObj(_arg1:String, _arg2:Function, _arg3:int, _arg4:int, _arg5:Boolean):void{
intervalNum = 0;
info = _arg1;
runF = _arg2;
interval = _arg3;
times = _arg4;
pauseAble = _arg5;
}
public function run():void{
if (((Global.pause) && (pauseAble))){
return;
};
if (++intervalNum >= interval){
intervalNum = 0;
times--;
runF();
};
}
}
class CheckObj {
public var obj;
public var valName:String;
private function CheckObj(_arg1, _arg2:String){
obj = _arg1;
valName = _arg2;
}
}
class DictObj extends Dictionary {
public var total:int;
private function DictObj(){
total = 0;
}
public function addData(_arg1, _arg2:Function, _arg3:String):void{
var _local4:DictObjItem;
_local4 = this[_arg1];
if (_local4 == undefined){
_local4 = (this[_arg1] = new DictObjItem());
total++;
};
if (_local4[_arg2]){
trace(((("重复添加:obj=" + _arg1) + ",listener=") + _arg2));
return;
};
if (_arg3){
_local4[_arg2] = _arg3;
_local4.total++;
} else {
trace(("不要使用布尔值为false的info:" + _arg3));
};
}
public function removeData(_arg1, _arg2:Function):void{
var _local3:DictObjItem;
_local3 = this[_arg1];
if (_local3 == undefined){
trace(("找不到要删的:obj=" + _arg1));
return;
};
if (_local3[_arg2]){
delete _local3[_arg2];
if (--_local3.total <= 0){
delete this[_arg1];
total--;
};
};
}
}
class DictObjItem extends Dictionary {
public var total:int;
private function DictObjItem(){
total = 0;
}
}
Section 169
//GlobalCtrl (GlobalCtrl)
package {
import flash.display.*;
import manage.*;
public class GlobalCtrl {
public static function createBuildBad(_arg1:DisplayObject){
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:Bad;
if (CommonManage.rand(3) == 0){
_local4 = 0;
while (true) {
_local2 = ((_arg1.x + CommonManage.rand(10)) - 5);
_local3 = (CommonManage.rand(290) + 10);
if (GameManage.Game.map_mc.mapArray_mc.hitTestPoint(CommonManage.to_global(_arg1.parent, _arg1.x, _arg1.y).x, _local3, true)){
_local5 = new Bad();
_local5.x = _local2;
_local5.y = _local3;
_local5.gotoAndStop((CommonManage.rand(_local5.totalFrames) + 1));
GameManage.Game.map_mc.car.leihenArray_mc.addChild(_local5);
return;
};
_local4++;
if (_local4 >= 5){
return;
};
};
};
}
public static function createUpFire(_arg1:DisplayObject){
var _local2:Booo;
_local2 = new Booo();
_local2.x = _arg1.x;
_local2.y = _arg1.y;
GameManage.Game.map_mc.car.throwArray_mc.addChild(_local2);
}
public static function createBoooFire(_arg1:DisplayObject){
var _local2:Booo2;
_local2 = new Booo2();
_local2.x = _arg1.x;
_local2.y = (_arg1.y - 10);
GameManage.Game.map_mc.car.throwArray_mc.addChild(_local2);
}
}
}//package
Section 170
//GroundRect (GroundRect)
package {
import apeSp.*;
public dynamic class GroundRect extends Rect {
}
}//package
Section 171
//Main (Main)
package {
import flash.display.*;
import flash.events.*;
import framework.*;
import framework.fadeEffect.*;
import flash.utils.*;
import framework.pages.*;
public class Main extends Sprite {
public var musicNames:String;// = "Main_S"
public var skipToGame:Boolean;// = false
public var soundNames:String;// = "Sound_Roll_Over,Sound_Press"
public static const legalChars:String = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_0123456789";
public static var container:Sprite;
private static var __isFirstTimeMenuAnimation:Boolean = true;
private static var __totalScore:int;
public static var hasReadInstructions:Boolean;
public static var totalLevel:int = 5;
private static var __currScore:int;
public static var stageHei:int;
public static var playerInfo:PlayerInfo = new PlayerInfo();
public static var game_name:String = "";
public static var main:Main;
public static var qualitySetting:QualitySetting;
public static var levelNum:int;
public static var stageWid:int;
public function Main(){
skipToGame = false;
musicNames = "Main_S";
soundNames = "Sound_Roll_Over,Sound_Press";
super();
Global.init(stage);
(root as MovieClip).stop();
main = this;
Global.addEvent(stage, Event.ENTER_FRAME, init, "init");
}
public function set __game_name(_arg1:String):void{
game_name = _arg1;
}
public function set fadeClass(_arg1):void{
var _fadeClass = _arg1;
if ((_fadeClass is String)){
try {
_fadeClass = getDefinitionByName(("framework.fadeEffect." + _fadeClass));
} catch(e) {
_fadeClass = getDefinitionByName(_fadeClass);
};
};
Fade.fadeClass = _fadeClass;
}
public static function set currScore(_arg1:int):void{
__currScore = _arg1;
}
public static function linkToFWG(_arg1:MouseEvent=null):void{
Net.getURL("http://www.freeworldgroup.com");
}
public static function get currScore():int{
return (__currScore);
}
private static function init(_arg1:Event):void{
var StageSelecterClass:*;
var event = _arg1;
trace("初始化main");
try {
stageWid = main.loaderInfo.width;
stageHei = main.loaderInfo.height;
if (game_name.length > 0){
if (!checkLegalStr(game_name, legalChars)){
if (game_name.indexOf(" ") >= 0){
game_name = game_name.replace(/\ /g, "_");
trace(("游戏名称的空格自动替换成下划线,游戏名称=" + game_name));
} else {
throw (new Error("游戏名称只能包含字母,数字和下划线"));
};
};
} else {
throw (new Error("未设置游戏名称"));
};
} catch(e) {
trace(("Main.init(),e=" + e));
return;
};
Global.removeEvent(main.stage, Event.ENTER_FRAME, init);
BasicBtn.onSetAction = function (_arg1:BasicBtn):void{
initBtn(_arg1);
};
main.addChild((container = new Sprite()));
main.addChild(new Fade(stageWid, stageHei));
SoundManage.addMusic(main.musicNames);
SoundManage.addSound(main.soundNames);
SoundManage.playMusic(main.musicNames.split(",")[0], 999999);
try {
StageSelecterClass = getDefinitionByName("framework.StageSelecter");
StageSelecterClass.init(game_name, totalLevel);
StageSelecterClass.onSelectLevel = gotoLevel;
} catch(e) {
trace(("Main.init(),e=" + e));
trace("此游戏没有选关保存系统");
};
trace(((((("初始化main成功,game_name=" + game_name) + ",stageWid=") + stageWid) + ",stageHei=") + stageHei));
initFinished();
}
public static function get isFirstTimeMenuAnimation():Boolean{
return (false);
}
public static function pauseF():void{
if (Global.pause){
return;
};
Global.pause = true;
container.addChild(new PausePan());
}
public static function gotoLose():void{
flipTo(Page_Lose);
}
public static function instPlay():void{
if (hasReadInstructions){
gotoOptions();
} else {
gotoInstructions();
};
}
public static function showSubmitScore():void{
if (totalScore > 0){
Global.pause = true;
container.addChild(new SubmitScore());
} else {
ToolTip.show("Your score is 0 !");
ToolTip.hideDelay();
};
}
public static function gotoInstructions():void{
hasReadInstructions = true;
flipTo(Page_Instructions);
}
public static function initFinished():void{
if (main.skipToGame){
gotoGame();
} else {
gotoMenu();
};
}
public static function initBtn(_arg1:BasicBtn):void{
var btn = _arg1;
btn.playRollOverSound = playRollOverSound;
btn.playPressSound = playPressSound;
switch (btn.action){
case BtnActions.ADD_GAMES_TO_YOUR_SITE:
btn.release = function ():void{
Net.getURL("http://www.freeworldgroup.com/koalafiles.htm");
};
break;
case BtnActions.BACK:
btn.release = (btn.parent as MovieClip).prevFrame;
break;
case BtnActions.COPYRIGHT:
btn.release = linkToFWG;
break;
case BtnActions.CREDITS:
btn.release = gotoCredits;
break;
case BtnActions.DOWNLOAD_GAMES:
btn.release = function ():void{
Net.getURL("http://www.ifungames.com");
};
break;
case BtnActions.INSTRUCTIONS:
btn.release = gotoInstructions;
break;
case BtnActions.MENU:
btn.release = gotoMenu;
break;
case BtnActions.MUSIC:
btn.selected = !(SoundManage.isMusicPlay);
if (SoundManage.isMusicPlay){
btn.toolTip = "Music Off";
} else {
btn.toolTip = "Music On";
};
btn.release = function ():void{
if (SoundManage.isMusicPlay){
SoundManage.stopMusic();
SoundManage.isMusicPlay = false;
this.selected = true;
this.toolTip = "Music On";
} else {
SoundManage.returnMusic();
SoundManage.isMusicPlay = true;
this.selected = false;
this.toolTip = "Music Off";
};
};
break;
case BtnActions.MORE_ONLINE_GAMES:
btn.release = linkToFWG;
break;
case BtnActions.NEXT:
btn.release = (btn.parent as MovieClip).nextFrame;
break;
case BtnActions.NEXT_LEVEL:
btn.release = nextLevel;
break;
case BtnActions.PAUSE:
btn.toolTip = "Pause.[Hot key: P]";
btn.release = pauseF;
break;
case BtnActions.PLAY_GAME:
case BtnActions.PLAY:
case BtnActions.SKIP:
btn.release = instPlay;
break;
case BtnActions.QUALITY:
btn.release = showQuality;
btn.toolTip = "Quality Setting";
break;
case BtnActions.REMOVE:
btn.release = function ():void{
this.parent.parent.removeChild(this.parent);
};
break;
case BtnActions.REPLAY:
btn.release = replay;
break;
case BtnActions.RETRY:
btn.release = retry;
break;
case BtnActions.SOUND:
btn.selected = !(SoundManage.isSoundPlay);
if (SoundManage.isMusicPlay){
btn.toolTip = "Sound Off";
} else {
btn.toolTip = "Sound On";
};
btn.release = function ():void{
if (SoundManage.isSoundPlay){
SoundManage.isSoundPlay = false;
this.selected = true;
this.toolTip = "Sound On";
} else {
SoundManage.isSoundPlay = true;
this.selected = false;
this.toolTip = "Sound Off";
};
};
break;
case BtnActions.SUBMIT:
btn.release = SubmitScore.submit;
break;
case BtnActions.SUBMIT_SCORE:
btn.release = showSubmitScore;
SubmitScore.btnSsArr.push(btn);
break;
case BtnActions.VIEW_HIGHSCORES:
btn.release = function ():void{
Net.getURL(("http://www.freeworldgroup.com/score/index.asp?game=" + game_name));
};
break;
case BtnActions.LOW:
case BtnActions.MEDIUM:
case BtnActions.HIGH:
case BtnActions.BEST:
btn.release = function ():void{
this.stage.quality = this.action;
Main.qualitySetting.update(this.action);
};
break;
};
}
public static function lose():void{
gotoLose();
}
public static function retry():void{
gotoOptions();
}
public static function get totalScore():int{
return (__totalScore);
}
public static function gotoCredits():void{
flipTo(Page_Credits);
}
public static function gotoLevelComplete():void{
flipTo(Page_Level_Complete);
}
public static function playSound(_arg1:String):void{
SoundManage.playSound(_arg1);
}
public static function gotoOptions():void{
gotoGame();
}
public static function showQuality():void{
Global.pause = true;
container.addChild(new QualitySetting());
}
private static function playRollOverSound():void{
SoundManage.playSound("Sound_Roll_Over");
}
public static function reset():void{
currScore = (totalScore = 0);
}
public static function nextLevel():void{
levelNum++;
gotoGame();
}
public static function flipTo(_arg1:Class):void{
var stage:Stage;
var pageClass = _arg1;
Fade.start();
try {
while (container.numChildren > 0) {
container.removeChildAt(0);
};
stage = container.stage;
container.addChild(new (pageClass));
stage.focus = stage;
Global.clearAllRun();
if (pageClass == Page_Game){
stage.quality = "low";
} else {
stage.quality = "high";
};
Global.pause = false;
} catch(e) {
trace(("Main.flipTo(),e=" + e));
trace(("未找到页面:" + pageClass));
};
}
public static function levelComplete():void{
gotoLevelComplete();
}
private static function playPressSound():void{
SoundManage.playSound("Sound_Press");
}
public static function gotoLevel(_arg1:int):void{
levelNum = _arg1;
gotoGame();
}
public static function set totalScore(_arg1:int):void{
__totalScore = _arg1;
}
public static function replay():void{
reset();
gotoOptions();
}
public static function gotoMenu():void{
reset();
flipTo(Page_Menu);
}
public static function win():void{
gotoWin();
}
public static function checkLegalStr(_arg1:String, _arg2:String):Boolean{
var _local3:int;
var _local4:int;
_local3 = _arg1.length;
_local4 = 0;
while (_local4 < _local3) {
if (_arg2.indexOf(_arg1.charAt(_local4)) == -1){
return (false);
};
_local4++;
};
return (true);
}
public static function addScore(_arg1:int):void{
currScore = (currScore + _arg1);
totalScore = (totalScore + _arg1);
}
public static function gotoGame():void{
flipTo(Page_Game);
}
public static function gotoWin():void{
flipTo(Page_Win);
}
}
}//package
Section 172
//Main_S (Main_S)
package {
import flash.media.*;
public dynamic class Main_S extends Sound {
}
}//package
Section 173
//MochiAd (MochiAd)
package {
import flash.display.*;
import flash.net.*;
import flash.events.*;
import flash.utils.*;
import flash.system.*;
public class MochiAd {
public static function getVersion():String{
return ("2.3");
}
public static function showTimedAd(_arg1:Object):void{
trace("[MochiAd] DEPRECATED: showTimedAd was renamed to showInterLevelAd in 2.0");
MochiAd.showInterLevelAd(_arg1);
}
public static function _allowDomains(_arg1:String):String{
var _local2:String;
_local2 = _arg1.split("/")[2].split(":")[0];
Security.allowDomain("*");
Security.allowDomain(_local2);
Security.allowInsecureDomain("*");
Security.allowInsecureDomain(_local2);
return (_local2);
}
public static function 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 f:Function;
var g:Function;
var req:URLRequest;
var v:Object;
var options = _arg1;
DEFAULTS = {server:"http://x.mochiads.com/srv/1/", method:"load", depth:10333, id:"_UNKNOWN_"};
options = MochiAd._parseOptions(options, DEFAULTS);
options.swfv = 9;
options.mav = MochiAd.getVersion();
clip = options.clip;
if (!MochiAd._isNetworkAvailable()){
return (null);
};
try {
if (clip._mochiad_loaded){
return (null);
};
} catch(e:Error) {
throw (new Error("MochiAd requires a clip that is an instance of a dynamic class. If your class extends Sprite or MovieClip, you must make it dynamic."));
};
depth = options.depth;
delete options.depth;
mc = createEmptyMovieClip(clip, "_mochiad", depth);
wh = MochiAd._getRes(options, clip);
options.res = ((wh[0] + "x") + wh[1]);
options.server = (options.server + options.id);
delete options.id;
clip._mochiad_loaded = true;
if (clip.loaderInfo.loaderURL.indexOf("http") == 0){
options.as3_swf = clip.loaderInfo.loaderURL;
};
lv = new URLVariables();
for (k in options) {
v = options[k];
if (!(v is Function)){
lv[k] = v;
};
};
server = lv.server;
delete lv.server;
hostname = _allowDomains(server);
lc = new LocalConnection();
lc.client = mc;
name = ["", Math.floor(new Date().getTime()), Math.floor((Math.random() * 999999))].join("_");
lc.allowDomain("*", "localhost");
lc.allowInsecureDomain("*", "localhost");
lc.connect(name);
mc.lc = lc;
lv.lc = name;
lv.st = getTimer();
loader = new Loader();
f = function (_arg1:Object):void{
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
mc._mochiad_ctr_failed = true;
};
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, f);
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"));
req.contentType = "application/x-www-form-urlencoded";
req.method = URLRequestMethod.POST;
req.data = lv;
loader.load(req);
mc.addChild(loader);
mc._mochiad_ctr = loader;
return (mc);
}
public static function sendHighScore(_arg1:Object, _arg2:Object, _arg3:Object=null):Boolean{
var _local4:MovieClip;
_local4 = MochiAd._loadCommunicator({clip:_arg1.clip, id:_arg1.id});
if (!_local4){
return (false);
};
_local4.doSend(["sendHighScore", _arg1], _arg2, _arg3);
return (true);
}
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 _isNetworkAvailable():Boolean{
return (!((Security.sandboxType == "localWithFile")));
}
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 unload(_arg1:Object):Boolean{
if (((_arg1.clip) && (_arg1.clip._mochiad))){
_arg1 = _arg1.clip;
};
if (!_arg1._mochiad){
return (false);
};
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");
}};
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.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);
};
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 = _local1.loaderInfo.bytesTotal;
if ((((_local4 > 0)) || (("number" == "undefined")))){
chk.showing = true;
chk.started = getTimer();
} else {
if (_local2 > chk.ad_timeout){
options.ad_failed();
_local3 = true;
};
};
};
if (this.parent._mochiad_ctr_failed){
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 _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 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 _loadCommunicator(_arg1:Object):MovieClip{
var DEFAULTS:Object;
var clip:Object;
var clipname:String;
var server:String;
var depth:Number;
var mc:MovieClip;
var lv:URLVariables;
var k:String;
var lc:LocalConnection;
var name:String;
var req:URLRequest;
var loader:Loader;
var options = _arg1;
DEFAULTS = {com_server:"http://x.mochiads.com/com/1/", method:"loadCommunicator", depth:10337, id:"_UNKNOWN_"};
options = MochiAd._parseOptions(options, DEFAULTS);
options.swfv = 9;
options.mav = MochiAd.getVersion();
clip = options.clip;
clipname = ("_mochiad_com_" + options.id);
if (!MochiAd._isNetworkAvailable()){
return (null);
};
if (clip[clipname]){
return (clip[clipname]);
};
server = (options.com_server + options.id);
MochiAd._allowDomains(server);
delete options.id;
delete options.com_server;
depth = options.depth;
delete options.depth;
mc = createEmptyMovieClip(clip, clipname, depth);
lv = new URLVariables();
for (k in options) {
lv[k] = options[k];
};
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.name = name;
mc.lc = lc;
lv.lc = name;
mc._id = 0;
mc._queue = [];
mc.rpcResult = function (_arg1:Object):void{
var _local3:Array;
var _local4:Array;
var _local5:Number;
var _local6:Object;
var _local7:Object;
_arg1 = parseInt(_arg1.toString());
_local3 = mc._callbacks[_arg1];
if (typeof(_local3) == "undefined"){
return;
};
delete mc._callbacks[_arg1];
_local4 = [];
_local5 = 2;
while (_local5 < _local3.length) {
_local4.push(_local3[_local5]);
_local5++;
};
_local5 = 1;
while (_local5 < arguments.length) {
_local4.push(arguments[_local5]);
_local5++;
};
_local6 = _local3[1];
_local7 = _local3[0];
if (((_local7) && ((typeof(_local6) == "string")))){
_local6 = _local7[_local6];
};
if (typeof(_local6) == "function"){
_local6.apply(_local7, _local4);
};
};
mc._didConnect = function (_arg1:String):void{
var _local2:Array;
var _local3:Function;
var _local4:Number;
var _local5:Array;
mc._endpoint = _arg1;
_local2 = mc._queue;
delete mc._queue;
_local3 = mc.doSend;
_local4 = 0;
while (_local4 < _local2.length) {
_local5 = _local2[_local4];
_local3.apply(this, _local5);
_local4++;
};
};
mc.doSend = function (_arg1:Array, _arg2:Object, _arg3:Object):void{
var _local5:Number;
var _local6:LocalConnection;
var _local7:Array;
var _local8:Number;
if (mc._endpoint == null){
_local7 = [];
_local8 = 0;
while (_local8 < arguments.length) {
_local7.push(arguments[_local8]);
_local8++;
};
mc._queue.push(_local7);
return;
};
mc._id = (mc._id + 1);
_local5 = mc._id;
mc._callbacks[_local5] = [_arg2, ((_arg3) || (_arg2))];
_local6 = new LocalConnection();
_local6.send(mc._endpoint, "rpc", _local5, _arg1);
};
mc._callbacks = {};
mc._callbacks[0] = [mc, "_didConnect"];
lv.st = getTimer();
req = new URLRequest((server + ".swf"));
req.contentType = "application/x-www-form-urlencoded";
req.method = URLRequestMethod.POST;
req.data = lv;
loader = new Loader();
loader.load(req);
mc.addChild(loader);
mc._mochiad_com = loader;
return (mc);
}
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 r:MovieClip;
var options = _arg1;
DEFAULTS = {ad_timeout:3000, fadeout_time:250, regpt:"o", method:"showPreloaderAd", color:0xFF8A00, background:16777161, outline:13994812, 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");
}};
options = MochiAd._parseOptions(options, DEFAULTS);
if ("5cc6f7dfb67f2f08341c831480f7c2a7".length == 0){
options.ad_started();
options.ad_finished();
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);
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.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;
};
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);
if (!chk.showing){
_local11 = _local2.loaderInfo.bytesTotal;
if ((((_local11 > 0)) || (("number" == "undefined")))){
chk.showing = true;
chk.started = getTimer();
} else {
if (_local3 > chk.ad_timeout){
options.ad_failed();
_local4 = true;
};
};
};
if (this.parent._mochiad_ctr_failed){
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 fetchHighScores(_arg1:Object, _arg2:Object, _arg3:Object=null):Boolean{
var _local4:MovieClip;
_local4 = MochiAd._loadCommunicator({clip:_arg1.clip, id:_arg1.id});
if (!_local4){
return (false);
};
_local4.doSend(["fetchHighScores", _arg1], _arg2, _arg3);
return (true);
}
public static function doOnEnterFrame(_arg1:MovieClip):void{
var f:Function;
var mc = _arg1;
f = function (_arg1:Object):void{
if (((("onEnterFrame" in mc)) && (mc.onEnterFrame))){
mc.onEnterFrame();
} else {
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
};
};
mc.addEventListener(Event.ENTER_FRAME, f);
}
}
}//package
Section 174
//Net (Net)
package {
import flash.net.*;
import flash.events.*;
public class Net {
private static var loader:URLLoader;
private static var request:URLRequest;
public static function sendData(_arg1:URLVariables, _arg2:String, _arg3:Function, _arg4:Function):void{
request = new URLRequest(_arg2);
request.data = _arg1;
request.method = URLRequestMethod.POST;
trace(((("sendToURL: " + request.url) + "?") + request.data));
sendToURL(request);
loader = new URLLoader();
loader.addEventListener(Event.COMPLETE, _arg3, false, 0, true);
loader.addEventListener(IOErrorEvent.IO_ERROR, _arg4, false, 0, true);
loader.load(request);
}
public static function getURL(_arg1:String):void{
var url = _arg1;
try {
navigateToURL(new URLRequest(url), "_blank");
} catch(e) {
trace(("Net.getURL:e=" + e));
};
}
}
}//package
Section 175
//PeopleLife1 (PeopleLife1)
package {
import computer.*;
public dynamic class PeopleLife1 extends PeopleLife {
public function PeopleLife1(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 176
//PeopleLife2 (PeopleLife2)
package {
import computer.*;
public dynamic class PeopleLife2 extends PeopleLife {
public function PeopleLife2(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 177
//Road (Road)
package {
import flash.display.*;
import flash.text.*;
public dynamic class Road extends MovieClip {
public var len:TextField;
public var lou_mc:MovieClip;
}
}//package
Section 178
//ScreenShake (ScreenShake)
package {
import flash.display.*;
import flash.utils.*;
public final class ScreenShake {
private static var dict:Dictionary = new Dictionary();
public static function shake(_arg1:DisplayObject, _arg2=5, _arg3:Boolean=false):void{
if (dict[_arg1] == undefined){
dict[_arg1] = new ShakeObj(_arg1);
};
dict[_arg1].shake(_arg2);
dict[_arg1].onShakeFinished = deleteData;
}
private static function deleteData(_arg1:DisplayObject):void{
delete dict[_arg1];
}
}
}//package
import flash.display.*;
import flash.events.*;
class ShakeObj {
private var y:Number;
private var r:Number;
private var mcY0:Number;
private var isShakeing:Boolean;
private var mcX0:Number;
private var u:Number;
private var dspObj:DisplayObject;
private var multShakeAble:Boolean;
private var x:Number;
public var onShakeFinished:Function;
private function ShakeObj(_arg1:DisplayObject){
dspObj = _arg1;
mcX0 = dspObj.x;
mcY0 = dspObj.y;
}
public function shake(_arg1=5, _arg2:Boolean=true):void{
var _local3:Number;
var _local4:String;
if (((!(multShakeAble)) && (isShakeing))){
return;
};
isShakeing = true;
if ((_arg1 is Number)){
r = _arg1;
} else {
for (_local4 in _arg1) {
this[_local4] = _arg1[_local4];
};
};
_local3 = (Math.random() * (Math.PI * 2));
if (isNaN(r)){
r = 5;
};
if (isNaN(x)){
x = (r * Math.cos(_local3));
};
if (isNaN(y)){
y = (r * Math.sin(_local3));
};
if (isNaN(u)){
u = 0.8;
};
if (u < 1){
u = (u + 1);
};
multShakeAble = _arg2;
dspObj.removeEventListener(Event.ENTER_FRAME, shakeRun);
dspObj.addEventListener(Event.ENTER_FRAME, shakeRun, false, 0, true);
}
private function shakeRun(_arg1:Event):void{
x = (x - (x * u));
y = (y - (y * u));
dspObj.x = (mcX0 + x);
dspObj.y = (mcY0 + y);
if (((x * x) + (y * y)) < 2){
dspObj.x = mcX0;
dspObj.y = mcY0;
dspObj.removeEventListener(Event.ENTER_FRAME, shakeRun);
isShakeing = false;
onShakeFinished(dspObj);
};
}
}
Section 179
//SndShortLaser (SndShortLaser)
package {
import flash.media.*;
public dynamic class SndShortLaser extends Sound {
}
}//package
Section 180
//Tank0 (Tank0)
package {
import computer.*;
public dynamic class Tank0 extends Tank {
}
}//package
Section 181
//Tank1 (Tank1)
package {
import computer.*;
public dynamic class Tank1 extends Tank {
}
}//package
Section 182
//Tank2 (Tank2)
package {
import computer.*;
public dynamic class Tank2 extends Tank {
}
}//package
Section 183
//Tank3 (Tank3)
package {
import computer.*;
public dynamic class Tank3 extends Tank {
}
}//package
Section 184
//TankFire1 (TankFire1)
package {
import computer.*;
public dynamic class TankFire1 extends TankFire {
public function TankFire1(){
addFrameScript(0, frame1, 17, frame18);
}
function frame18(){
this.die();
}
function frame1(){
stop();
}
}
}//package
Section 185
//TankFire2 (TankFire2)
package {
import computer.*;
public dynamic class TankFire2 extends TankFire2 {
public function TankFire2(){
addFrameScript(0, frame1, 17, frame18);
}
function frame18(){
this.die();
}
function frame1(){
stop();
}
}
}//package
Section 186
//ThrowTank (ThrowTank)
package {
import flash.display.*;
import manage.*;
public class ThrowTank extends MovieClip {
private var myType:int;
private var tarObject:Object;
private var downSpeed:Number;
public function ThrowTank(){
addFrameScript(0, frame1, 3, frame4);
this.downSpeed = 1;
Global.addRun((("throw_" + this.name) + ".run()"), run);
}
public function fire(){
var _local1:int;
var _local2:PeopleLife2;
_local1 = 0;
while (_local1 < GameManage.Game.map_mc.car.computerArray_mc.numChildren) {
if (GameManage.Game.map_mc.car.computerArray_mc.getChildAt(_local1).hitTestObject(this)){
GameManage.Game.map_mc.car.computerArray_mc.getChildAt(_local1).hitMy(350);
};
_local1++;
};
GlobalCtrl.createUpFire(this);
_local2 = new PeopleLife2();
_local2.x = this.x;
_local2.y = this.y;
_local2.gotoAndStop((CommonManage.rand(_local2.totalFrames) + 1));
GameManage.Game.map_mc.car.dieArray_mc.addChild(_local2);
if (parent){
Global.delRun(run);
parent.removeChild(this);
};
}
public function setObject(_arg1:Number, _arg2:Number){
this.tarObject = new Object();
this.tarObject.x = _arg1;
this.tarObject.y = _arg2;
}
function frame1(){
stop();
}
function frame4(){
stop();
}
public function run(){
var _local1:*;
this.x = (this.x + this.tarObject.x);
this.y = (this.y + this.tarObject.y);
this.y = (this.y + this.downSpeed);
this.downSpeed = (this.downSpeed + 0.4);
this.rotation = (this.rotation + 10);
_local1 = CommonManage.to_global(this.parent, this.x, this.y);
if (this.y >= 450){
this.fire();
};
}
public function setType(_arg1:Number){
this.myType = _arg1;
this.gotoAndStop(this.myType);
}
}
}//package
Section 187
//ValueBar (ValueBar)
package {
import flash.display.*;
public class ValueBar extends Sprite {
public var bar:MovieClip;
public var maxValue:Number;
private var __value:Number;
public var wid0:Number;
public function ValueBar(_arg1:Number=0, _arg2:Number=100){
wid0 = bar.width;
value = _arg1;
maxValue = _arg2;
}
public function get value():Number{
return (__value);
}
public function set value(_arg1:Number):void{
__value = _arg1;
if (isNaN(__value)){
__value = 1;
};
if (__value < 1){
__value = 1;
} else {
if (__value > maxValue){
__value = maxValue;
};
};
bar.width = ((__value / maxValue) * wid0);
}
}
}//package
Section 188
//za_s (za_s)
package {
import flash.media.*;
public dynamic class za_s extends Sound {
}
}//package
Section 189
//地面 (地é¢)
package {
import apeSp.*;
public dynamic class 地面 extends GroupSp {
public var __id8_:GroundRect;
public var __id9_:GroundRect;
public function 地面(){
__setProp___id9___1();
__setProp___id8___1();
}
function __setProp___id8___1(){
try {
__id8_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id8_.elasticity = 0.3;
__id8_.movable = true;
__id8_.fixed = true;
__id8_.mass = 1;
__id8_.friction = 0;
try {
__id8_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp___id9___1(){
try {
__id9_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id9_.elasticity = 0.3;
__id9_.movable = true;
__id9_.fixed = true;
__id9_.mass = 1;
__id9_.friction = 0;
try {
__id9_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
}
}//package
Section 190
//车身 (车身)
package {
import apeSp.*;
public dynamic class 车身 extends Spring {
}
}//package
Section 191
//轮子 (è½®å)
package {
import apeSp.*;
public dynamic class 轮子 extends Wheel {
}
}//package
Section 192
//连接 (连接)
package {
import apeSp.*;
public dynamic class 连接 extends Spring {
}
}//package
Section 193
//连接2 (连接2)
package {
import apeSp.*;
public dynamic class 连接2 extends Spring {
}
}//package
Section 194
//连接3 (连接3)
package {
import apeSp.*;
public dynamic class 连接3 extends Spring {
}
}//package
Section 195
//锤子 (锤å)
package {
import apeSp.*;
public dynamic class 锤子 extends Circle {
}
}//package