initial commit, kind of working.

This commit is contained in:
2026-10-10 15:50:17 -06:00
commit 4db96b0bae
1041 changed files with 51423 additions and 0 deletions
@@ -0,0 +1,94 @@
package org.flixel
{
public class FlxBasic
{
internal static var _ACTIVECOUNT:uint;
internal static var _VISIBLECOUNT:uint;
public var ID:int;
public var exists:Boolean;
public var active:Boolean;
public var visible:Boolean;
public var alive:Boolean;
public var cameras:Array;
public var ignoreDrawDebug:Boolean;
public function FlxBasic()
{
super();
this.ID = -1;
this.exists = true;
this.active = true;
this.visible = true;
this.alive = true;
this.ignoreDrawDebug = false;
}
public function destroy() : void
{
}
public function preUpdate() : void
{
++_ACTIVECOUNT;
}
public function update() : void
{
}
public function postUpdate() : void
{
}
public function draw() : void
{
var _loc1_:FlxCamera = null;
if(this.cameras == null)
{
this.cameras = FlxG.cameras;
}
var _loc2_:uint = 0;
var _loc3_:uint = this.cameras.length;
while(_loc2_ < _loc3_)
{
_loc1_ = this.cameras[_loc2_++];
++_VISIBLECOUNT;
if(FlxG.visualDebug && !this.ignoreDrawDebug)
{
this.drawDebug(_loc1_);
}
}
}
public function drawDebug(param1:FlxCamera = null) : void
{
}
public function kill() : void
{
this.alive = false;
this.exists = false;
}
public function revive() : void
{
this.alive = true;
this.exists = true;
}
public function toString() : String
{
return FlxU.getClassName(this,true);
}
}
}
@@ -0,0 +1,111 @@
package org.flixel
{
import flash.display.BitmapData;
import flash.geom.Rectangle;
public class FlxBitmapFont
{
private var imgDefaultFont:Class = FlxBitmapFont_imgDefaultFont;
public var rects:Array;
public var horizontalPadding:int;
public var verticalPadding:int;
public var pixels:BitmapData;
public var height:uint;
private var _alphabet:String;
public function FlxBitmapFont(param1:Class = null, param2:uint = 0, param3:uint = 5, param4:int = 1, param5:int = 5, param6:String = " !\"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~")
{
var _loc8_:uint = 0;
var _loc11_:uint = 0;
var _loc12_:uint = 0;
super();
if(param1 == null)
{
param1 = this.imgDefaultFont;
}
this.pixels = FlxG.addBitmap(param1);
this.height = param3;
this.verticalPadding = param5;
this.horizontalPadding = param4;
this._alphabet = param6;
this.rects = new Array();
var _loc7_:uint = this.pixels.getPixel(0,0);
if(param2 == 0)
{
_loc8_ = 1;
}
else
{
_loc8_ = 0;
}
var _loc9_:uint = 0;
var _loc10_:Number = 0;
if(param2 == 0)
{
_loc12_ = 0;
loop1:
while(_loc12_ < int(this.pixels.height / this.height))
{
_loc11_ = 0;
while(true)
{
if(_loc11_ >= this.pixels.width)
{
_loc8_ += this.height + 1;
_loc9_ = 0;
_loc12_++;
continue loop1;
}
if(this.pixels.getPixel(_loc11_,_loc8_ - 1) == _loc7_)
{
this.rects[this._alphabet.charCodeAt(_loc10_ - 1)] = new Rectangle(_loc9_,_loc8_,_loc11_ - _loc9_,this.height);
_loc10_++;
_loc9_ = _loc11_ + 1;
}
if(_loc10_ > this._alphabet.length)
{
break;
}
_loc11_++;
}
return;
}
}
else
{
_loc12_ = 0;
loop0:
while(_loc12_ < int(this.pixels.height / this.height))
{
_loc11_ = 0;
while(true)
{
if(_loc11_ >= this.pixels.width / param2)
{
_loc8_ += this.height;
_loc9_ = 0;
_loc12_++;
continue loop0;
}
this.rects[this._alphabet.charCodeAt(_loc10_ - 1)] = new Rectangle(_loc9_,_loc8_,param2,this.height);
_loc9_ = _loc11_ * param2;
if(++_loc10_ > this._alphabet.length)
{
break;
}
_loc11_++;
}
return;
}
}
}
}
}
@@ -0,0 +1,15 @@
package org.flixel
{
import mx.core.BitmapAsset;
[Embed(source="/_assets/176_org.flixel.FlxBitmapFont_imgDefaultFont.png")]
public class FlxBitmapFont_imgDefaultFont extends BitmapAsset
{
public function FlxBitmapFont_imgDefaultFont()
{
super();
}
}
}
@@ -0,0 +1,359 @@
package org.flixel
{
import flash.display.BitmapData;
import flash.geom.ColorTransform;
import flash.geom.Point;
import flash.geom.Rectangle;
public class FlxBitmapText extends FlxObject
{
protected static var _defaultFont:FlxBitmapFont;
protected var _pixels:BitmapData;
protected var _p:Point;
protected var _frect:Rectangle;
protected var _cTransform:ColorTransform = new ColorTransform();
protected var _font:FlxBitmapFont;
protected var _text:String;
protected var _alignment:String;
protected var _overrideWidth:int;
protected var _colorFont:Boolean;
protected var _lineWrap:Boolean;
protected var _splitLines:Array;
protected var _lineWidths:Array;
protected var _debugRender:Boolean = false;
public var truewidth:int;
public function FlxBitmapText(param1:int, param2:int, param3:FlxBitmapFont, param4:String = " ", param5:String = "left", param6:Number = 0, param7:Boolean = false)
{
if(param3 == null)
{
param3 = _defaultFont ? _defaultFont : new FlxBitmapFont();
}
this._font = param3;
this._alignment = param5.toLowerCase();
super();
immovable = true;
x = param1;
y = param2;
width = param6;
this.truewidth = param6;
this._cTransform.alphaMultiplier = 1;
this._lineWrap = true;
this._p = new Point();
this._colorFont = param7;
this.text = param4;
}
public function get lines() : Array
{
return this._splitLines;
}
public function calcFrame() : void
{
var _loc1_:uint = 0;
var _loc2_:uint = 0;
var _loc3_:uint = 0;
if(this._pixels)
{
this._pixels.dispose();
}
this._pixels = new BitmapData(width,height,true,0);
var _loc4_:uint = 0;
_loc1_ = 0;
while(_loc1_ < this._splitLines.length)
{
switch(this._alignment)
{
case "left":
_loc3_ = 0;
break;
case "center":
_loc3_ = uint(int((width - this._lineWidths[_loc1_]) / 2));
break;
case "right":
_loc3_ = width - this._lineWidths[_loc1_];
}
_loc2_ = 0;
while(_loc2_ < this._splitLines[_loc1_].length)
{
if(this._font.rects[this._splitLines[_loc1_].charCodeAt(_loc2_)])
{
this._p.x = _loc3_ + (this.overrideWidth ? Math.floor((this.overrideWidth - this._font.rects[this._splitLines[_loc1_].charCodeAt(_loc2_)].width) / 2) : 0);
this._p.y = _loc4_;
this._pixels.copyPixels(this._font.pixels,this._font.rects[this._splitLines[_loc1_].charCodeAt(_loc2_)],this._p,null,null,true);
_loc3_ += (this.overrideWidth ? this.overrideWidth : this._font.rects[this._splitLines[_loc1_].charCodeAt(_loc2_)].width) + this._font.horizontalPadding;
}
_loc2_++;
}
_loc4_ += this._font.height + this._font.verticalPadding;
_loc1_++;
}
this._frect = new Rectangle(0,0,width,height);
this._pixels.colorTransform(this._frect,this._cTransform);
}
protected function charWidth(param1:uint) : int
{
if(this._font.rects[param1] == null)
{
return 0;
}
return (this.overrideWidth ? this.overrideWidth : this._font.rects[param1].width) + this._font.horizontalPadding;
}
public function splitLines(param1:String, param2:int) : Array
{
var _loc3_:Array = null;
var _loc4_:String = null;
var _loc5_:int = 0;
var _loc6_:String = null;
var _loc7_:int = 0;
var _loc8_:int = 0;
var _loc9_:int = 0;
param1 += " ";
if(this._lineWrap && width > 0)
{
_loc3_ = new Array();
_loc4_ = "";
_loc5_ = 0;
_loc6_ = "";
_loc7_ = 0;
_loc8_ = 0;
while(_loc8_ < param1.length)
{
_loc9_ = param1.charCodeAt(_loc8_);
if(_loc9_ == 32)
{
_loc4_.replace(/^\s+|\s+$/g,"");
if(_loc4_.length)
{
if(_loc7_ + _loc5_ >= param2)
{
_loc3_.push(_loc6_);
_loc6_ = _loc4_;
_loc7_ = _loc5_;
}
else
{
_loc6_ += (_loc6_.length ? " " : "") + _loc4_;
_loc7_ += _loc5_ + (_loc6_.length ? this.charWidth(32) : 0);
}
}
_loc4_ = "";
_loc5_ = 0;
}
else if(_loc9_ == 10)
{
_loc3_.push(_loc6_ + " " + _loc4_);
_loc6_ = "";
_loc7_ = 0;
_loc4_ = "";
_loc5_ = 0;
}
else
{
_loc4_ += String.fromCharCode(_loc9_);
_loc5_ += this.charWidth(_loc9_) + this._font.horizontalPadding;
}
_loc8_++;
}
if(_loc4_.length)
{
_loc3_.push(_loc6_);
_loc6_ = _loc4_;
}
if(_loc6_.length)
{
_loc3_.push(_loc6_);
}
}
else
{
_loc3_ = this._text.split("\n");
}
return _loc3_;
}
protected function calcLineWidths() : void
{
var _loc2_:int = 0;
height = 0;
this._lineWidths = new Array();
var _loc1_:int = 0;
while(_loc1_ < this._splitLines.length)
{
this._lineWidths[_loc1_] = 0;
_loc2_ = 0;
while(_loc2_ < this._splitLines[_loc1_].length)
{
if(this._font.rects[this._splitLines[_loc1_].charCodeAt(_loc2_)])
{
this._lineWidths[_loc1_] += this.charWidth(this._splitLines[_loc1_].charCodeAt(_loc2_));
}
_loc2_++;
}
this._lineWidths[_loc1_] -= this._font.horizontalPadding;
if(this._lineWidths[_loc1_] > width)
{
width = this._lineWidths[_loc1_];
}
height += this._font.height + this._font.verticalPadding;
_loc1_++;
}
height -= this._font.verticalPadding;
if(width < 1 || height < 1)
{
width = 1;
height = 1;
}
}
override public function draw() : void
{
super.draw();
getScreenXY(_point);
if(this._debugRender)
{
FlxG.camera.buffer.fillRect(new Rectangle(_point.x,_point.y,width,height),4278255360);
FlxG.camera.buffer.fillRect(new Rectangle(_point.x + 1,_point.y + 1,width - 2,height - 2),0);
}
this._p.x = _point.x;
this._p.y = _point.y;
FlxG.camera.buffer.copyPixels(this._pixels,this._frect,this._p,null,null,true);
}
public function set text(param1:String) : void
{
width = this.truewidth;
this._text = param1;
this._splitLines = this.splitLines(this._text,width);
this.calcLineWidths();
this.calcFrame();
}
public function get text() : String
{
return this._text;
}
public function set overrideWidth(param1:int) : void
{
this._overrideWidth = param1;
}
public function get overrideWidth() : int
{
return this._overrideWidth;
}
public function set lineWrap(param1:Boolean) : void
{
this._lineWrap = param1;
}
public function get lineWrap() : Boolean
{
return this._lineWrap;
}
public function set alignment(param1:String) : void
{
this._alignment = param1.toLowerCase();
this.calcFrame();
}
public function get alignment() : String
{
return this._alignment;
}
public function set color(param1:uint) : void
{
this._cTransform.color = param1;
this.calcFrame();
}
public function get color() : uint
{
return this._cTransform.color;
}
public function set debugRender(param1:Boolean) : void
{
this._debugRender = param1;
}
public function set colorFont(param1:Boolean) : void
{
this._colorFont = param1;
this.calcFrame();
}
public function get colorFont() : Boolean
{
return this._colorFont;
}
public function set alpha(param1:Number) : void
{
if(param1 > 1)
{
param1 = 1;
}
if(param1 < 0)
{
param1 = 0;
}
if(param1 == this._cTransform.alphaMultiplier)
{
return;
}
this._cTransform.alphaMultiplier = param1;
this.calcFrame();
}
public function get alpha() : Number
{
return this._cTransform.alphaMultiplier;
}
public function set font(param1:FlxBitmapFont) : void
{
if(param1 == null)
{
param1 = _defaultFont ? _defaultFont : new FlxBitmapFont();
}
this._font = param1;
this.calcFrame();
}
public function get font() : FlxBitmapFont
{
return this._font;
}
override public function destroy() : void
{
super.destroy();
this._font = null;
this._pixels.dispose();
}
}
}
@@ -0,0 +1,542 @@
package org.flixel
{
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.display.Sprite;
import flash.geom.ColorTransform;
import flash.geom.Point;
import flash.geom.Rectangle;
public class FlxCamera extends FlxBasic
{
public static var defaultZoom:Number;
public static const STYLE_LOCKON:uint = 0;
public static const STYLE_PLATFORMER:uint = 1;
public static const STYLE_TOPDOWN:uint = 2;
public static const STYLE_TOPDOWN_TIGHT:uint = 3;
public static const STYLE_SCREEN_BY_SCREEN:uint = 4;
public static const SHAKE_BOTH_AXES:uint = 0;
public static const SHAKE_HORIZONTAL_ONLY:uint = 1;
public static const SHAKE_VERTICAL_ONLY:uint = 2;
public var x:Number;
public var y:Number;
public var width:uint;
public var height:uint;
public var style:uint;
public var target:FlxObject;
public var deadzone:FlxRect;
public var bounds:FlxRect;
public var scroll:FlxPoint;
public var buffer:BitmapData;
public var bgColor:uint;
public var screen:FlxSprite;
protected var _zoom:Number;
protected var _point:FlxPoint;
protected var _color:uint;
protected var _flashBitmap:Bitmap;
internal var _flashSprite:Sprite;
internal var _flashOffsetX:Number;
internal var _flashOffsetY:Number;
protected var _flashRect:Rectangle;
protected var _flashPoint:Point;
protected var _fxFlashColor:uint;
protected var _fxFlashDuration:Number;
protected var _fxFlashComplete:Function;
protected var _fxFlashAlpha:Number;
protected var _fxFadeColor:uint;
protected var _fxFadeDuration:Number;
protected var _fxFadeComplete:Function;
protected var _fxFadeAlpha:Number;
protected var _fxShakeIntensity:Number;
protected var _fxShakeDuration:Number;
protected var _fxShakeComplete:Function;
protected var _fxShakeOffset:FlxPoint;
protected var _fxShakeDirection:uint;
protected var _fill:BitmapData;
public function FlxCamera(param1:int, param2:int, param3:int, param4:int, param5:Number = 0)
{
super();
this.x = param1;
this.y = param2;
this.width = param3;
this.height = param4;
this.target = null;
this.deadzone = null;
this.scroll = new FlxPoint();
this._point = new FlxPoint();
this.bounds = null;
this.screen = new FlxSprite();
this.screen.makeGraphic(this.width,this.height,0,true);
this.screen.setOriginToCorner();
this.buffer = this.screen.pixels;
this.bgColor = FlxG.bgColor;
this._color = 16777215;
this._flashBitmap = new Bitmap(this.buffer);
this._flashBitmap.x = -this.width * 0.5;
this._flashBitmap.y = -this.height * 0.5;
this._flashSprite = new Sprite();
this.zoom = param5;
this._flashOffsetX = this.width * 0.5 * this.zoom;
this._flashOffsetY = this.height * 0.5 * this.zoom;
this._flashSprite.x = this.x + this._flashOffsetX;
this._flashSprite.y = this.y + this._flashOffsetY;
this._flashSprite.addChild(this._flashBitmap);
this._flashRect = new Rectangle(0,0,this.width,this.height);
this._flashPoint = new Point();
this._fxFlashColor = 0;
this._fxFlashDuration = 0;
this._fxFlashComplete = null;
this._fxFlashAlpha = 0;
this._fxFadeColor = 0;
this._fxFadeDuration = 0;
this._fxFadeComplete = null;
this._fxFadeAlpha = 0;
this._fxShakeIntensity = 0;
this._fxShakeDuration = 0;
this._fxShakeComplete = null;
this._fxShakeOffset = new FlxPoint();
this._fxShakeDirection = 0;
this._fill = new BitmapData(this.width,this.height,true,0);
}
override public function destroy() : void
{
this.screen.destroy();
this.screen = null;
this.target = null;
this.scroll = null;
this.deadzone = null;
this.bounds = null;
this.buffer = null;
this._flashBitmap = null;
this._flashRect = null;
this._flashPoint = null;
this._fxFlashComplete = null;
this._fxFadeComplete = null;
this._fxShakeComplete = null;
this._fxShakeOffset = null;
this._fill = null;
}
override public function update() : void
{
var _loc1_:Number = NaN;
var _loc2_:Number = NaN;
var _loc3_:Number = NaN;
if(this.target != null)
{
if(this.deadzone == null)
{
this.focusOn(this.target.getMidpoint(this._point));
}
else
{
_loc2_ = FlxU.ceil(this.target.x + (this.target.x > 0 ? 1e-7 : -1e-7));
_loc3_ = FlxU.ceil(this.target.y + (this.target.y > 0 ? 1e-7 : -1e-7));
if(this.style == STYLE_SCREEN_BY_SCREEN)
{
if(_loc2_ > this.scroll.x + this.width)
{
this.scroll.x += this.width;
}
else if(_loc2_ < this.scroll.x)
{
this.scroll.x -= this.width;
}
if(_loc3_ > this.scroll.y + this.height)
{
this.scroll.y += this.height;
}
else if(_loc3_ < this.scroll.y)
{
this.scroll.y -= this.height;
}
}
else
{
_loc1_ = _loc2_ - this.deadzone.x;
if(this.scroll.x > _loc1_)
{
this.scroll.x = _loc1_;
}
_loc1_ = _loc2_ + this.target.width - this.deadzone.x - this.deadzone.width;
if(this.scroll.x < _loc1_)
{
this.scroll.x = _loc1_;
}
_loc1_ = _loc3_ - this.deadzone.y;
if(this.scroll.y > _loc1_)
{
this.scroll.y = _loc1_;
}
_loc1_ = _loc3_ + this.target.height - this.deadzone.y - this.deadzone.height;
if(this.scroll.y < _loc1_)
{
this.scroll.y = _loc1_;
}
}
}
}
if(this.bounds != null)
{
if(this.scroll.x < this.bounds.left)
{
this.scroll.x = this.bounds.left;
}
if(this.scroll.x > this.bounds.right - this.width)
{
this.scroll.x = this.bounds.right - this.width;
}
if(this.scroll.y < this.bounds.top)
{
this.scroll.y = this.bounds.top;
}
if(this.scroll.y > this.bounds.bottom - this.height)
{
this.scroll.y = this.bounds.bottom - this.height;
}
}
if(this._fxFlashAlpha > 0)
{
this._fxFlashAlpha -= FlxG.elapsed / this._fxFlashDuration;
if(this._fxFlashAlpha <= 0 && this._fxFlashComplete != null)
{
this._fxFlashComplete();
}
}
if(this._fxFadeAlpha > 0 && this._fxFadeAlpha < 1)
{
this._fxFadeAlpha += FlxG.elapsed / this._fxFadeDuration;
if(this._fxFadeAlpha >= 1)
{
this._fxFadeAlpha = 1;
if(this._fxFadeComplete != null)
{
this._fxFadeComplete();
}
}
}
if(this._fxShakeDuration > 0)
{
this._fxShakeDuration -= FlxG.elapsed;
if(this._fxShakeDuration <= 0)
{
this._fxShakeOffset.make();
if(this._fxShakeComplete != null)
{
this._fxShakeComplete();
}
}
else
{
if(this._fxShakeDirection == SHAKE_BOTH_AXES || this._fxShakeDirection == SHAKE_HORIZONTAL_ONLY)
{
this._fxShakeOffset.x = (FlxG.random() * this._fxShakeIntensity * this.width * 2 - this._fxShakeIntensity * this.width) * this._zoom;
}
if(this._fxShakeDirection == SHAKE_BOTH_AXES || this._fxShakeDirection == SHAKE_VERTICAL_ONLY)
{
this._fxShakeOffset.y = (FlxG.random() * this._fxShakeIntensity * this.height * 2 - this._fxShakeIntensity * this.height) * this._zoom;
}
}
}
}
public function follow(param1:FlxObject, param2:uint = 0) : void
{
var _loc3_:Number = NaN;
var _loc4_:Number = NaN;
var _loc5_:Number = NaN;
this.style = param2;
this.target = param1;
if(param1 == null)
{
return;
}
switch(param2)
{
case STYLE_PLATFORMER:
_loc4_ = this.width / 8;
_loc5_ = this.height / 3;
this.deadzone = new FlxRect((this.width - _loc4_) / 2,(this.height - _loc5_) / 2 - _loc5_ * 0.25,_loc4_,_loc5_);
break;
case STYLE_TOPDOWN:
_loc3_ = FlxU.max(this.width,this.height) / 4;
this.deadzone = new FlxRect((this.width - _loc3_) / 2,(this.height - _loc3_) / 2,_loc3_,_loc3_);
break;
case STYLE_TOPDOWN_TIGHT:
_loc3_ = FlxU.max(this.width,this.height) / 8;
this.deadzone = new FlxRect((this.width - _loc3_) / 2,(this.height - _loc3_) / 2,_loc3_,_loc3_);
break;
case STYLE_LOCKON:
_loc4_ = this.target.width;
_loc5_ = this.target.height;
this.deadzone = new FlxRect((this.width - _loc4_) / 2,(this.height - _loc5_) / 2 - _loc5_ * 0.25,_loc4_,_loc5_);
break;
case STYLE_SCREEN_BY_SCREEN:
this.deadzone = new FlxRect(0,0,this.width,this.height);
break;
default:
this.deadzone = null;
}
}
public function focusOn(param1:FlxPoint) : void
{
param1.x += param1.x > 0 ? 1e-7 : -1e-7;
param1.y += param1.y > 0 ? 1e-7 : -1e-7;
this.scroll.make(param1.x - this.width * 0.5,param1.y - this.height * 0.5);
}
public function setBounds(param1:Number = 0, param2:Number = 0, param3:Number = 0, param4:Number = 0, param5:Boolean = false) : void
{
if(this.bounds == null)
{
this.bounds = new FlxRect();
}
this.bounds.make(param1,param2,param3,param4);
if(param5)
{
FlxG.worldBounds.copyFrom(this.bounds);
}
this.update();
}
public function flash(param1:uint = 4294967295, param2:Number = 1, param3:Function = null, param4:Boolean = false) : void
{
if(!param4 && this._fxFlashAlpha > 0)
{
return;
}
this._fxFlashColor = param1;
if(param2 <= 0)
{
param2 = Number.MIN_VALUE;
}
this._fxFlashDuration = param2;
this._fxFlashComplete = param3;
this._fxFlashAlpha = 1;
}
public function fade(param1:uint = 4278190080, param2:Number = 1, param3:Function = null, param4:Boolean = false) : void
{
if(!param4 && this._fxFadeAlpha > 0)
{
return;
}
this._fxFadeColor = param1;
if(param2 <= 0)
{
param2 = Number.MIN_VALUE;
}
this._fxFadeDuration = param2;
this._fxFadeComplete = param3;
this._fxFadeAlpha = Number.MIN_VALUE;
}
public function shake(param1:Number = 0.05, param2:Number = 0.5, param3:Function = null, param4:Boolean = true, param5:uint = 0) : void
{
if(!param4 && (this._fxShakeOffset.x != 0 || this._fxShakeOffset.y != 0))
{
return;
}
this._fxShakeIntensity = param1;
this._fxShakeDuration = param2;
this._fxShakeComplete = param3;
this._fxShakeDirection = param5;
this._fxShakeOffset.make();
}
public function stopFX() : void
{
this._fxFlashAlpha = 0;
this._fxFadeAlpha = 0;
this._fxShakeDuration = 0;
this._flashSprite.x = this.x + this.width * 0.5;
this._flashSprite.y = this.y + this.height * 0.5;
}
public function copyFrom(param1:FlxCamera) : FlxCamera
{
if(param1.bounds == null)
{
this.bounds = null;
}
else
{
if(this.bounds == null)
{
this.bounds = new FlxRect();
}
this.bounds.copyFrom(param1.bounds);
}
this.target = param1.target;
if(this.target != null)
{
if(param1.deadzone == null)
{
this.deadzone = null;
}
else
{
if(this.deadzone == null)
{
this.deadzone = new FlxRect();
}
this.deadzone.copyFrom(param1.deadzone);
}
}
return this;
}
public function get zoom() : Number
{
return this._zoom;
}
public function set zoom(param1:Number) : void
{
if(param1 == 0)
{
this._zoom = defaultZoom;
}
else
{
this._zoom = param1;
}
this.setScale(this._zoom,this._zoom);
}
public function get alpha() : Number
{
return this._flashBitmap.alpha;
}
public function set alpha(param1:Number) : void
{
this._flashBitmap.alpha = param1;
}
public function get angle() : Number
{
return this._flashSprite.rotation;
}
public function set angle(param1:Number) : void
{
this._flashSprite.rotation = param1;
}
public function get color() : uint
{
return this._color;
}
public function set color(param1:uint) : void
{
this._color = param1;
var _loc2_:ColorTransform = this._flashBitmap.transform.colorTransform;
_loc2_.redMultiplier = (this._color >> 16) * 0.00392;
_loc2_.greenMultiplier = (this._color >> 8 & 0xFF) * 0.00392;
_loc2_.blueMultiplier = (this._color & 0xFF) * 0.00392;
this._flashBitmap.transform.colorTransform = _loc2_;
}
public function get antialiasing() : Boolean
{
return this._flashBitmap.smoothing;
}
public function set antialiasing(param1:Boolean) : void
{
this._flashBitmap.smoothing = param1;
}
public function getScale() : FlxPoint
{
return this._point.make(this._flashSprite.scaleX,this._flashSprite.scaleY);
}
public function setScale(param1:Number, param2:Number) : void
{
this._flashSprite.scaleX = param1;
this._flashSprite.scaleY = param2;
}
public function getContainerSprite() : Sprite
{
return this._flashSprite;
}
public function fill(param1:uint, param2:Boolean = true) : void
{
this._fill.fillRect(this._flashRect,param1);
this.buffer.copyPixels(this._fill,this._flashRect,this._flashPoint,null,null,param2);
}
internal function drawFX() : void
{
var _loc1_:Number = NaN;
if(this._fxFlashAlpha > 0)
{
_loc1_ = this._fxFlashColor >> 24;
this.fill((uint((_loc1_ <= 0 ? 255 : _loc1_) * this._fxFlashAlpha) << 24) + (this._fxFlashColor & 0xFFFFFF));
}
if(this._fxFadeAlpha > 0)
{
_loc1_ = this._fxFadeColor >> 24;
this.fill((uint((_loc1_ <= 0 ? 255 : _loc1_) * this._fxFadeAlpha) << 24) + (this._fxFadeColor & 0xFFFFFF));
}
if(this._fxShakeOffset.x != 0 || this._fxShakeOffset.y != 0)
{
this._flashSprite.x = this.x + this._flashOffsetX + this._fxShakeOffset.x;
this._flashSprite.y = this.y + this._flashOffsetY + this._fxShakeOffset.y;
}
}
}
}
@@ -0,0 +1,275 @@
package org.flixel
{
public class FlxEmitter extends FlxGroup
{
public var x:Number;
public var y:Number;
public var width:Number;
public var height:Number;
public var minParticleSpeed:FlxPoint;
public var maxParticleSpeed:FlxPoint;
public var particleDrag:FlxPoint;
public var minRotation:Number;
public var maxRotation:Number;
public var gravity:Number;
public var on:Boolean;
public var frequency:Number;
public var lifespan:Number;
public var bounce:Number;
public var particleClass:Class;
protected var _quantity:uint;
protected var _explode:Boolean;
protected var _timer:Number;
protected var _counter:uint;
protected var _point:FlxPoint;
public function FlxEmitter(param1:Number = 0, param2:Number = 0, param3:Number = 0)
{
super(param3);
this.x = param1;
this.y = param2;
this.width = 0;
this.height = 0;
this.minParticleSpeed = new FlxPoint(-100,-100);
this.maxParticleSpeed = new FlxPoint(100,100);
this.minRotation = -360;
this.maxRotation = 360;
this.gravity = 0;
this.particleClass = null;
this.particleDrag = new FlxPoint();
this.frequency = 0.1;
this.lifespan = 3;
this.bounce = 0;
this._quantity = 0;
this._counter = 0;
this._explode = true;
this.on = false;
this._point = new FlxPoint();
}
override public function destroy() : void
{
this.minParticleSpeed = null;
this.maxParticleSpeed = null;
this.particleDrag = null;
this.particleClass = null;
this._point = null;
super.destroy();
}
public function makeParticles(param1:Class, param2:uint = 50, param3:uint = 16, param4:Boolean = false, param5:Number = 0.8) : FlxEmitter
{
var _loc7_:uint = 0;
var _loc8_:FlxParticle = null;
var _loc10_:FlxSprite = null;
maxSize = param2;
var _loc6_:uint = 1;
if(param4)
{
_loc10_ = new FlxSprite();
_loc10_.loadGraphic(param1,true);
_loc6_ = _loc10_.frames;
_loc10_.destroy();
}
var _loc9_:uint = 0;
while(_loc9_ < param2)
{
if(this.particleClass == null)
{
_loc8_ = new FlxParticle();
}
else
{
_loc8_ = new this.particleClass();
}
if(param4)
{
_loc7_ = FlxG.random() * _loc6_;
if(param3 > 0)
{
_loc8_.loadRotatedGraphic(param1,param3,_loc7_);
}
else
{
_loc8_.loadGraphic(param1,true);
_loc8_.frame = _loc7_;
}
}
else if(param3 > 0)
{
_loc8_.loadRotatedGraphic(param1,param3);
}
else
{
_loc8_.loadGraphic(param1);
}
if(param5 > 0)
{
_loc8_.width *= param5;
_loc8_.height *= param5;
_loc8_.centerOffsets();
}
else
{
_loc8_.allowCollisions = FlxObject.NONE;
}
_loc8_.exists = false;
add(_loc8_);
_loc9_++;
}
return this;
}
override public function update() : void
{
var _loc1_:uint = 0;
var _loc2_:uint = 0;
if(this.on)
{
if(this._explode)
{
this.on = false;
_loc1_ = 0;
_loc2_ = this._quantity;
if(_loc2_ <= 0 || _loc2_ > members.length)
{
_loc2_ = members.length;
}
while(_loc1_ < _loc2_)
{
this.emitParticle();
_loc1_++;
}
this._quantity = 0;
}
else
{
this._timer += FlxG.elapsed;
while(this.frequency > 0 && this._timer > this.frequency && this.on)
{
this._timer -= this.frequency;
this.emitParticle();
if(this._quantity > 0 && ++this._counter >= this._quantity)
{
this.on = false;
this._quantity = 0;
}
}
}
}
super.update();
}
override public function kill() : void
{
this.on = false;
super.kill();
}
public function start(param1:Boolean = true, param2:Number = 0, param3:Number = 0.1, param4:uint = 0) : void
{
revive();
visible = true;
this.on = true;
this._explode = param1;
this.lifespan = param2;
this.frequency = param3;
this._quantity += param4;
this._counter = 0;
this._timer = 0;
}
public function emitParticle() : void
{
var _loc1_:FlxParticle = recycle(FlxParticle) as FlxParticle;
_loc1_.lifespan = this.lifespan + Math.random() / 2;
_loc1_.elasticity = this.bounce;
_loc1_.reset(this.x - (_loc1_.width >> 1) + FlxG.random() * this.width,this.y - (_loc1_.height >> 1) + FlxG.random() * this.height);
_loc1_.visible = true;
if(this.minParticleSpeed.x != this.maxParticleSpeed.x)
{
_loc1_.velocity.x = this.minParticleSpeed.x + FlxG.random() * (this.maxParticleSpeed.x - this.minParticleSpeed.x);
}
else
{
_loc1_.velocity.x = this.minParticleSpeed.x;
}
if(this.minParticleSpeed.y != this.maxParticleSpeed.y)
{
_loc1_.velocity.y = this.minParticleSpeed.y + FlxG.random() * (this.maxParticleSpeed.y - this.minParticleSpeed.y);
}
else
{
_loc1_.velocity.y = this.minParticleSpeed.y;
}
_loc1_.acceleration.y = this.gravity;
if(this.minRotation != this.maxRotation)
{
_loc1_.angularVelocity = this.minRotation + FlxG.random() * (this.maxRotation - this.minRotation);
}
else
{
_loc1_.angularVelocity = this.minRotation;
}
if(_loc1_.angularVelocity != 0)
{
_loc1_.angle = FlxG.random() * 360 - 180;
}
_loc1_.drag.x = this.particleDrag.x;
_loc1_.drag.y = this.particleDrag.y;
_loc1_.onEmit();
}
public function setSize(param1:uint, param2:uint) : void
{
this.width = param1;
this.height = param2;
}
public function setXSpeed(param1:Number = 0, param2:Number = 0) : void
{
this.minParticleSpeed.x = param1;
this.maxParticleSpeed.x = param2;
}
public function setYSpeed(param1:Number = 0, param2:Number = 0) : void
{
this.minParticleSpeed.y = param1;
this.maxParticleSpeed.y = param2;
}
public function setRotation(param1:Number = 0, param2:Number = 0) : void
{
this.minRotation = param1;
this.maxRotation = param2;
}
public function at(param1:FlxObject) : void
{
param1.getMidpoint(this._point);
this.x = this._point.x - (this.width >> 1);
this.y = this._point.y - (this.height >> 1);
}
}
}
@@ -0,0 +1,894 @@
package org.flixel
{
import flash.display.BitmapData;
import flash.display.DisplayObject;
import flash.display.Graphics;
import flash.display.Sprite;
import flash.display.Stage;
import flash.geom.Matrix;
import flash.geom.Rectangle;
import org.flixel.plugin.DebugPathDisplay;
import org.flixel.plugin.TimerManager;
import org.flixel.system.FlxQuadTree;
import org.flixel.system.input.*;
public class FlxG
{
internal static var _game:FlxGame;
public static var paused:Boolean;
public static var debug:Boolean;
public static var elapsed:Number;
public static var timeScale:Number;
public static var width:uint;
public static var height:uint;
public static var worldBounds:FlxRect;
public static var worldDivisions:uint;
public static var visualDebug:Boolean;
public static var mobile:Boolean;
public static var globalSeed:Number;
public static var levels:Array;
public static var level:int;
public static var scores:Array;
public static var score:int;
public static var saves:Array;
public static var save:int;
public static var mouse:Mouse;
public static var keys:Keyboard;
public static var music:FlxSound;
public static var sounds:FlxGroup;
public static var mute:Boolean;
protected static var _volume:Number;
public static var cameras:Array;
public static var camera:FlxCamera;
public static var useBufferLocking:Boolean;
protected static var _cameraRect:Rectangle;
public static var plugins:Array;
public static var volumeHandler:Function;
public static var flashGfxSprite:Sprite;
public static var flashGfx:Graphics;
protected static var _cache:Object;
public static var LIBRARY_NAME:String = "flixel";
public static var LIBRARY_MAJOR_VERSION:uint = 2;
public static var LIBRARY_MINOR_VERSION:uint = 53;
public static const DEBUGGER_STANDARD:uint = 0;
public static const DEBUGGER_MICRO:uint = 1;
public static const DEBUGGER_BIG:uint = 2;
public static const DEBUGGER_TOP:uint = 3;
public static const DEBUGGER_LEFT:uint = 4;
public static const DEBUGGER_RIGHT:uint = 5;
public static const RED:uint = 4294901778;
public static const GREEN:uint = 4278252069;
public static const BLUE:uint = 4278227177;
public static const PINK:uint = 4293926655;
public static const WHITE:uint = 4294967295;
public static const BLACK:uint = 4278190080;
public function FlxG()
{
super();
}
public static function getLibraryName() : String
{
return FlxG.LIBRARY_NAME + " v" + FlxG.LIBRARY_MAJOR_VERSION + "." + FlxG.LIBRARY_MINOR_VERSION;
}
public static function log(param1:Object) : void
{
if(_game != null && _game._debugger != null)
{
_game._debugger.log.add(param1 == null ? "ERROR: null object" : param1.toString());
}
}
public static function watch(param1:Object, param2:String, param3:String = null) : void
{
if(_game != null && _game._debugger != null)
{
_game._debugger.watch.add(param1,param2,param3);
}
}
public static function unwatch(param1:Object, param2:String = null) : void
{
if(_game != null && _game._debugger != null)
{
_game._debugger.watch.remove(param1,param2);
}
}
public static function get framerate() : Number
{
return 1000 / _game._step;
}
public static function set framerate(param1:Number) : void
{
_game._step = 1000 / param1;
if(_game._maxAccumulation < _game._step)
{
_game._maxAccumulation = _game._step;
}
}
public static function get flashFramerate() : Number
{
if(_game.root != null)
{
return _game.stage.frameRate;
}
return 0;
}
public static function set flashFramerate(param1:Number) : void
{
_game._flashFramerate = param1;
if(_game.root != null)
{
_game.stage.frameRate = _game._flashFramerate;
}
_game._maxAccumulation = 2000 / _game._flashFramerate - 1;
if(_game._maxAccumulation < _game._step)
{
_game._maxAccumulation = _game._step;
}
}
public static function random() : Number
{
return globalSeed = FlxU.srand(globalSeed);
}
public static function shuffle(param1:Array, param2:uint) : Array
{
var _loc4_:uint = 0;
var _loc5_:uint = 0;
var _loc6_:Object = null;
var _loc3_:uint = 0;
while(_loc3_ < param2)
{
_loc4_ = FlxG.random() * param1.length;
_loc5_ = FlxG.random() * param1.length;
_loc6_ = param1[_loc5_];
param1[_loc5_] = param1[_loc4_];
param1[_loc4_] = _loc6_;
_loc3_++;
}
return param1;
}
public static function getRandom(param1:Array) : Object
{
var _loc2_:uint = 0;
if(param1 != null)
{
_loc2_ = param1.length;
if(_loc2_ > 0)
{
return param1[uint(FlxG.random() * _loc2_)];
}
}
return null;
}
public static function loadReplay(param1:String, param2:FlxState = null, param3:Array = null, param4:Number = 0, param5:Function = null) : void
{
_game._replay.load(param1);
if(param2 == null)
{
FlxG.resetGame();
}
else
{
FlxG.switchState(param2);
}
_game._replayCancelKeys = param3;
_game._replayTimer = param4 * 1000;
_game._replayCallback = param5;
_game._replayRequested = true;
}
public static function reloadReplay(param1:Boolean = true) : void
{
if(param1)
{
FlxG.resetGame();
}
else
{
FlxG.resetState();
}
if(_game._replay.frameCount > 0)
{
_game._replayRequested = true;
}
}
public static function stopReplay() : void
{
_game._replaying = false;
if(_game._debugger != null)
{
_game._debugger.vcr.stopped();
}
resetInput();
}
public static function recordReplay(param1:Boolean = true) : void
{
if(param1)
{
FlxG.resetGame();
}
else
{
FlxG.resetState();
}
_game._recordingRequested = true;
}
public static function stopRecording() : String
{
_game._recording = false;
if(_game._debugger != null)
{
_game._debugger.vcr.stopped();
}
return _game._replay.save();
}
public static function resetState() : void
{
_game._requestedState = new (FlxU.getClass(FlxU.getClassName(_game._state,false)))();
}
public static function resetGame() : void
{
_game._requestedReset = true;
}
public static function resetInput() : void
{
keys.reset();
mouse.reset();
}
public static function playMusic(param1:Class, param2:Number = 1, param3:Number = 0) : void
{
if(music == null)
{
music = new FlxSound();
}
else if(music.active)
{
music.stop();
}
music.loadEmbedded(param1,true);
music.volume = param2;
music.survive = true;
music.play(param3);
}
public static function play(param1:Class, param2:Number = 1, param3:Boolean = false) : FlxSound
{
var _loc4_:FlxSound = sounds.recycle(FlxSound) as FlxSound;
_loc4_.loadEmbedded(param1,param3);
_loc4_.volume = param2;
_loc4_.play();
return _loc4_;
}
public static function stream(param1:String, param2:Number = 1, param3:Boolean = false) : FlxSound
{
var _loc4_:FlxSound = sounds.recycle(FlxSound) as FlxSound;
_loc4_.loadStream(param1,param3);
_loc4_.volume = param2;
_loc4_.play();
return _loc4_;
}
public static function get volume() : Number
{
return _volume;
}
public static function set volume(param1:Number) : void
{
_volume = param1;
if(_volume < 0)
{
_volume = 0;
}
else if(_volume > 1)
{
_volume = 1;
}
if(volumeHandler != null)
{
volumeHandler(FlxG.mute ? 0 : _volume);
}
}
internal static function destroySounds(param1:Boolean = false) : void
{
var _loc3_:FlxSound = null;
if(music != null && (param1 || !music.survive))
{
music.destroy();
music = null;
}
var _loc2_:uint = 0;
var _loc4_:uint = sounds.members.length;
while(_loc2_ < _loc4_)
{
_loc3_ = sounds.members[_loc2_++] as FlxSound;
if(_loc3_ != null && (param1 || !_loc3_.survive))
{
_loc3_.destroy();
}
}
}
internal static function updateSounds() : void
{
if(music != null && music.active)
{
music.update();
}
if(sounds != null && sounds.active)
{
sounds.update();
}
}
public static function pauseSounds() : void
{
var _loc2_:FlxSound = null;
if(music != null && music.exists && music.active)
{
music.pause();
}
var _loc1_:uint = 0;
var _loc3_:uint = sounds.members.length;
while(_loc1_ < _loc3_)
{
_loc2_ = sounds.members[_loc1_++] as FlxSound;
if(_loc2_ != null && _loc2_.exists && _loc2_.active)
{
_loc2_.pause();
}
}
}
public static function playSounds() : void
{
var _loc2_:FlxSound = null;
if(music != null && music.exists)
{
music.play();
}
var _loc1_:uint = 0;
var _loc3_:uint = sounds.members.length;
while(_loc1_ < _loc3_)
{
_loc2_ = sounds.members[_loc1_++] as FlxSound;
if(_loc2_ != null && _loc2_.exists)
{
_loc2_.play();
}
}
}
public static function checkBitmapCache(param1:String) : Boolean
{
return _cache[param1] != undefined && _cache[param1] != null;
}
public static function createBitmap(param1:uint, param2:uint, param3:uint, param4:Boolean = false, param5:String = null) : BitmapData
{
var _loc6_:uint = 0;
var _loc7_:String = null;
if(param5 == null)
{
param5 = param1 + "x" + param2 + ":" + param3;
if(param4 && checkBitmapCache(param5))
{
_loc6_ = 0;
do
{
_loc7_ = param5 + _loc6_++;
}
while(checkBitmapCache(_loc7_));
param5 = _loc7_;
}
}
if(!checkBitmapCache(param5))
{
_cache[param5] = new BitmapData(param1,param2,true,param3);
}
return _cache[param5];
}
public static function addBitmap(param1:Class, param2:Boolean = false, param3:Boolean = false, param4:String = null) : BitmapData
{
var _loc7_:uint = 0;
var _loc8_:String = null;
var _loc9_:BitmapData = null;
var _loc10_:Matrix = null;
var _loc5_:Boolean = false;
if(param4 == null)
{
param4 = String(param1) + (param2 ? "_REVERSE_" : "");
if(param3 && checkBitmapCache(param4))
{
_loc7_ = 0;
do
{
_loc8_ = param4 + _loc7_++;
}
while(checkBitmapCache(_loc8_));
param4 = _loc8_;
}
}
if(!checkBitmapCache(param4))
{
_cache[param4] = new param1().bitmapData;
if(param2)
{
_loc5_ = true;
}
}
var _loc6_:BitmapData = _cache[param4];
if(!_loc5_ && param2 && _loc6_.width == new param1().bitmapData.width)
{
_loc5_ = true;
}
if(_loc5_)
{
_loc9_ = new BitmapData(_loc6_.width << 1,_loc6_.height,true,0);
_loc9_.draw(_loc6_);
_loc10_ = new Matrix();
_loc10_.scale(-1,1);
_loc10_.translate(_loc9_.width,0);
_loc9_.draw(_loc6_,_loc10_);
_loc6_ = _loc9_;
}
return _loc6_;
}
public static function clearBitmapCache() : void
{
_cache = new Object();
}
public static function get stage() : Stage
{
if(_game.root != null)
{
return _game.stage;
}
return null;
}
public static function get root() : DisplayObject
{
return _game.root;
}
public static function get state() : FlxState
{
return _game._state;
}
public static function switchState(param1:FlxState) : void
{
_game._requestedState = param1;
}
public static function setDebuggerLayout(param1:uint) : void
{
if(_game._debugger != null)
{
_game._debugger.setLayout(param1);
}
}
public static function resetDebuggerLayout() : void
{
if(_game._debugger != null)
{
_game._debugger.resetLayout();
}
}
public static function addCamera(param1:FlxCamera) : FlxCamera
{
FlxG._game.addChildAt(param1._flashSprite,FlxG._game.getChildIndex(FlxG._game._mouse));
FlxG.cameras.push(param1);
return param1;
}
public static function removeCamera(param1:FlxCamera, param2:Boolean = true) : void
{
var Camera:FlxCamera = param1;
var Destroy:Boolean = param2;
try
{
FlxG._game.removeChild(Camera._flashSprite);
}
catch(E:Error)
{
FlxG.log("Error removing camera, not part of game.");
}
if(Destroy)
{
Camera.destroy();
}
}
public static function resetCameras(param1:FlxCamera = null) : void
{
var _loc2_:FlxCamera = null;
var _loc3_:uint = 0;
var _loc4_:uint = cameras.length;
while(_loc3_ < _loc4_)
{
_loc2_ = FlxG.cameras[_loc3_++] as FlxCamera;
FlxG._game.removeChild(_loc2_._flashSprite);
_loc2_.destroy();
}
FlxG.cameras.length = 0;
if(param1 == null)
{
param1 = new FlxCamera(0,0,FlxG.width,FlxG.height);
}
FlxG.camera = FlxG.addCamera(param1);
}
public static function flash(param1:uint = 4294967295, param2:Number = 1, param3:Function = null, param4:Boolean = false) : void
{
var _loc5_:uint = 0;
var _loc6_:uint = FlxG.cameras.length;
while(_loc5_ < _loc6_)
{
(FlxG.cameras[_loc5_++] as FlxCamera).flash(param1,param2,param3,param4);
}
}
public static function fade(param1:uint = 4294967295, param2:Number = 1, param3:Function = null, param4:Boolean = false) : void
{
var _loc5_:uint = 0;
var _loc6_:uint = FlxG.cameras.length;
while(_loc5_ < _loc6_)
{
(FlxG.cameras[_loc5_++] as FlxCamera).fade(param1,param2,param3,param4);
}
}
public static function shake(param1:Number = 0.05, param2:Number = 0.5, param3:Function = null, param4:Boolean = true, param5:uint = 0) : void
{
var _loc6_:uint = 0;
var _loc7_:uint = FlxG.cameras.length;
while(_loc6_ < _loc7_)
{
(FlxG.cameras[_loc6_++] as FlxCamera).shake(param1,param2,param3,param4,param5);
}
}
public static function get bgColor() : uint
{
if(FlxG.camera == null)
{
return 4278190080;
}
return FlxG.camera.bgColor;
}
public static function set bgColor(param1:uint) : void
{
var _loc2_:uint = 0;
var _loc3_:uint = FlxG.cameras.length;
while(_loc2_ < _loc3_)
{
(FlxG.cameras[_loc2_++] as FlxCamera).bgColor = param1;
}
}
public static function overlap(param1:FlxBasic = null, param2:FlxBasic = null, param3:Function = null, param4:Function = null) : Boolean
{
if(param1 == null)
{
param1 = FlxG.state;
}
if(param2 === param1)
{
param2 = null;
}
FlxQuadTree.divisions = FlxG.worldDivisions;
var _loc5_:FlxQuadTree = new FlxQuadTree(FlxG.worldBounds.x,FlxG.worldBounds.y,FlxG.worldBounds.width,FlxG.worldBounds.height);
_loc5_.load(param1,param2,param3,param4);
var _loc6_:Boolean = _loc5_.execute();
_loc5_.destroy();
return _loc6_;
}
public static function collide(param1:FlxBasic = null, param2:FlxBasic = null, param3:Function = null) : Boolean
{
return overlap(param1,param2,param3,FlxObject.separate);
}
public static function addPlugin(param1:FlxBasic) : FlxBasic
{
var _loc2_:Array = FlxG.plugins;
var _loc3_:uint = 0;
var _loc4_:uint = _loc2_.length;
while(_loc3_ < _loc4_)
{
if(_loc2_[_loc3_++].toString() == param1.toString())
{
return param1;
}
}
_loc2_.push(param1);
return param1;
}
public static function getPlugin(param1:Class) : FlxBasic
{
var _loc2_:Array = FlxG.plugins;
var _loc3_:uint = 0;
var _loc4_:uint = _loc2_.length;
while(_loc3_ < _loc4_)
{
if(_loc2_[_loc3_] is param1)
{
return plugins[_loc3_];
}
_loc3_++;
}
return null;
}
public static function removePlugin(param1:FlxBasic) : FlxBasic
{
var _loc2_:Array = FlxG.plugins;
var _loc3_:* = int(_loc2_.length - 1);
while(_loc3_ >= 0)
{
if(_loc2_[_loc3_] == param1)
{
_loc2_.splice(_loc3_,1);
}
_loc3_--;
}
return param1;
}
public static function removePluginType(param1:Class) : Boolean
{
var _loc2_:Boolean = false;
var _loc3_:Array = FlxG.plugins;
var _loc4_:* = int(_loc3_.length - 1);
while(_loc4_ >= 0)
{
if(_loc3_[_loc4_] is param1)
{
_loc3_.splice(_loc4_,1);
_loc2_ = true;
}
_loc4_--;
}
return _loc2_;
}
internal static function init(param1:FlxGame, param2:uint, param3:uint, param4:Number) : void
{
FlxG._game = param1;
FlxG.width = param2;
FlxG.height = param3;
FlxG.mute = false;
FlxG._volume = 0.5;
FlxG.sounds = new FlxGroup();
FlxG.volumeHandler = null;
FlxG.clearBitmapCache();
if(flashGfxSprite == null)
{
flashGfxSprite = new Sprite();
flashGfx = flashGfxSprite.graphics;
}
FlxCamera.defaultZoom = param4;
FlxG._cameraRect = new Rectangle();
FlxG.cameras = new Array();
useBufferLocking = false;
plugins = new Array();
addPlugin(new DebugPathDisplay());
addPlugin(new TimerManager());
FlxG.mouse = new Mouse(FlxG._game._mouse);
FlxG.keys = new Keyboard();
FlxG.mobile = false;
FlxG.levels = new Array();
FlxG.scores = new Array();
FlxG.visualDebug = false;
}
public static function get game() : FlxGame
{
return _game;
}
internal static function reset() : void
{
FlxG.clearBitmapCache();
FlxG.resetInput();
FlxG.destroySounds(true);
FlxG.levels.length = 0;
FlxG.scores.length = 0;
FlxG.level = 0;
FlxG.score = 0;
FlxG.paused = false;
FlxG.timeScale = 1;
FlxG.elapsed = 0;
FlxG.globalSeed = Math.random();
FlxG.worldBounds = new FlxRect(-10,-10,FlxG.width + 20,FlxG.height + 20);
FlxG.worldDivisions = 6;
var _loc1_:DebugPathDisplay = FlxG.getPlugin(DebugPathDisplay) as DebugPathDisplay;
if(_loc1_ != null)
{
_loc1_.clear();
}
}
internal static function updateInput() : void
{
FlxG.keys.update();
if(!_game._debuggerUp || !_game._debugger.hasMouse)
{
FlxG.mouse.update(FlxG._game.mouseX,FlxG._game.mouseY);
}
}
internal static function lockCameras() : void
{
var _loc1_:FlxCamera = null;
var _loc2_:Array = FlxG.cameras;
var _loc3_:uint = 0;
var _loc4_:uint = _loc2_.length;
while(_loc3_ < _loc4_)
{
_loc1_ = _loc2_[_loc3_++] as FlxCamera;
if(!(_loc1_ == null || !_loc1_.exists || !_loc1_.visible))
{
if(useBufferLocking)
{
_loc1_.buffer.lock();
}
_loc1_.fill(0);
_loc1_.screen.dirty = true;
}
}
}
internal static function unlockCameras() : void
{
var _loc1_:FlxCamera = null;
var _loc2_:Array = FlxG.cameras;
var _loc3_:uint = 0;
var _loc4_:uint = _loc2_.length;
while(_loc3_ < _loc4_)
{
_loc1_ = _loc2_[_loc3_++] as FlxCamera;
if(!(_loc1_ == null || !_loc1_.exists || !_loc1_.visible))
{
_loc1_.drawFX();
if(useBufferLocking)
{
_loc1_.buffer.unlock();
}
}
}
}
internal static function updateCameras() : void
{
var _loc1_:FlxCamera = null;
var _loc2_:Array = FlxG.cameras;
var _loc3_:uint = 0;
var _loc4_:uint = _loc2_.length;
while(_loc3_ < _loc4_)
{
_loc1_ = _loc2_[_loc3_++] as FlxCamera;
if(_loc1_ != null && _loc1_.exists)
{
if(_loc1_.active)
{
_loc1_.update();
}
_loc1_._flashSprite.x = _loc1_.x + _loc1_._flashOffsetX;
_loc1_._flashSprite.y = _loc1_.y + _loc1_._flashOffsetY;
_loc1_._flashSprite.visible = _loc1_.visible;
}
}
}
internal static function updatePlugins() : void
{
var _loc1_:FlxBasic = null;
var _loc2_:Array = FlxG.plugins;
var _loc3_:uint = 0;
var _loc4_:uint = _loc2_.length;
while(_loc3_ < _loc4_)
{
_loc1_ = _loc2_[_loc3_++] as FlxBasic;
if(_loc1_.exists && _loc1_.active)
{
_loc1_.update();
}
}
}
internal static function drawPlugins() : void
{
var _loc1_:FlxBasic = null;
var _loc2_:Array = FlxG.plugins;
var _loc3_:uint = 0;
var _loc4_:uint = _loc2_.length;
while(_loc3_ < _loc4_)
{
_loc1_ = _loc2_[_loc3_++] as FlxBasic;
if(_loc1_.exists && _loc1_.visible)
{
_loc1_.draw();
}
}
}
}
}
@@ -0,0 +1,627 @@
package org.flixel
{
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.display.Graphics;
import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.events.*;
import flash.text.AntiAliasType;
import flash.text.GridFitType;
import flash.text.TextField;
import flash.text.TextFormat;
import flash.ui.Mouse;
import flash.utils.getTimer;
import org.flixel.plugin.TimerManager;
import org.flixel.system.FlxDebugger;
import org.flixel.system.FlxReplay;
public class FlxGame extends Sprite
{
protected var junk:String = "FlxGame_junk";
protected var SndBeep:Class = FlxGame_SndBeep;
protected var ImgLogo:Class = FlxGame_ImgLogo;
public var useSoundHotKeys:Boolean;
public var forceDebugger:Boolean;
internal var _state:FlxState;
internal var _mouse:Sprite;
protected var _iState:Class;
protected var _created:Boolean;
protected var _total:uint;
protected var _accumulator:int;
protected var _lostFocus:Boolean;
internal var _step:uint;
internal var _flashFramerate:uint;
internal var _maxAccumulation:uint;
internal var _requestedState:FlxState;
internal var _requestedReset:Boolean;
protected var _focus:Sprite;
protected var _soundTray:Sprite;
protected var _soundTrayTimer:Number;
protected var _soundTrayBars:Array;
internal var _debugger:FlxDebugger;
internal var _debuggerUp:Boolean;
internal var _replay:FlxReplay;
internal var _replayRequested:Boolean;
internal var _recordingRequested:Boolean;
internal var _replaying:Boolean;
internal var _recording:Boolean;
internal var _replayCancelKeys:Array;
internal var _replayTimer:int;
internal var _replayCallback:Function;
public function FlxGame(param1:uint, param2:uint, param3:Class, param4:Number = 1, param5:uint = 60, param6:uint = 30)
{
super();
Mouse.hide();
this._lostFocus = false;
this._focus = new Sprite();
this._focus.visible = false;
this._soundTray = new Sprite();
this._mouse = new Sprite();
FlxG.init(this,param1,param2,param4);
FlxG.framerate = param5;
FlxG.flashFramerate = param6;
this._accumulator = this._step;
this._total = 0;
this._state = null;
this.useSoundHotKeys = true;
this.forceDebugger = false;
this._debuggerUp = false;
this._replay = new FlxReplay();
this._replayRequested = false;
this._recordingRequested = false;
this._replaying = false;
this._recording = false;
this._iState = param3;
this._requestedState = null;
this._requestedReset = true;
this._created = false;
addEventListener(Event.ENTER_FRAME,this.create);
}
internal function showSoundTray(param1:Boolean = false) : void
{
if(!param1)
{
FlxG.play(this.SndBeep);
}
this._soundTrayTimer = 1;
this._soundTray.y = 0;
this._soundTray.visible = true;
var _loc2_:uint = Math.round(FlxG.volume * 10);
if(FlxG.mute)
{
_loc2_ = 0;
}
var _loc3_:uint = 0;
while(_loc3_ < this._soundTrayBars.length)
{
if(_loc3_ < _loc2_)
{
this._soundTrayBars[_loc3_].alpha = 1;
}
else
{
this._soundTrayBars[_loc3_].alpha = 0.5;
}
_loc3_++;
}
}
protected function onKeyUp(param1:KeyboardEvent) : void
{
if(this._debuggerUp && this._debugger.watch.editing)
{
return;
}
if(!FlxG.mobile)
{
if(this._debugger != null && (param1.keyCode == 192 || param1.keyCode == 220) && FlxG.keys.SHIFT && FlxG.keys.CONTROL)
{
this._debugger.visible = !this._debugger.visible;
this._debuggerUp = this._debugger.visible;
if(this._debugger.visible)
{
Mouse.show();
}
else
{
Mouse.hide();
}
return;
}
}
if(this._replaying)
{
return;
}
FlxG.keys.handleKeyUp(param1);
}
protected function onKeyDown(param1:KeyboardEvent) : void
{
var _loc2_:Boolean = false;
var _loc3_:String = null;
var _loc4_:uint = 0;
var _loc5_:uint = 0;
if(this._debuggerUp && this._debugger.watch.editing)
{
return;
}
if(this._replaying && this._replayCancelKeys != null && this._debugger == null && param1.keyCode != 192 && param1.keyCode != 220)
{
_loc2_ = false;
_loc4_ = 0;
_loc5_ = this._replayCancelKeys.length;
while(_loc4_ < _loc5_)
{
_loc3_ = this._replayCancelKeys[_loc4_++];
if(_loc3_ == "ANY" || FlxG.keys.getKeyCode(_loc3_) == param1.keyCode)
{
if(this._replayCallback != null)
{
this._replayCallback();
this._replayCallback = null;
}
else
{
FlxG.stopReplay();
}
break;
}
}
return;
}
FlxG.keys.handleKeyDown(param1);
}
protected function onMouseDown(param1:MouseEvent) : void
{
var _loc2_:String = null;
var _loc3_:uint = 0;
var _loc4_:uint = 0;
if(this._debuggerUp)
{
if(this._debugger.hasMouse)
{
return;
}
if(this._debugger.watch.editing)
{
this._debugger.watch.submit();
}
}
if(this._replaying && this._replayCancelKeys != null)
{
_loc3_ = 0;
_loc4_ = this._replayCancelKeys.length;
while(_loc3_ < _loc4_)
{
_loc2_ = this._replayCancelKeys[_loc3_++] as String;
if(_loc2_ == "MOUSE" || _loc2_ == "ANY")
{
if(this._replayCallback != null)
{
this._replayCallback();
this._replayCallback = null;
}
else
{
FlxG.stopReplay();
}
break;
}
}
return;
}
FlxG.mouse.handleMouseDown(param1);
}
protected function onMouseUp(param1:MouseEvent) : void
{
if(this._debuggerUp && this._debugger.hasMouse || this._replaying)
{
return;
}
FlxG.mouse.handleMouseUp(param1);
}
protected function onMouseWheel(param1:MouseEvent) : void
{
if(this._debuggerUp && this._debugger.hasMouse || this._replaying)
{
return;
}
FlxG.mouse.handleMouseWheel(param1);
}
protected function onFocus(param1:Event = null) : void
{
if(!this._debuggerUp)
{
Mouse.hide();
}
FlxG.resetInput();
this._lostFocus = this._focus.visible = false;
stage.frameRate = this._flashFramerate;
FlxG.playSounds();
}
protected function onFocusLost(param1:Event = null) : void
{
if(x != 0 || y != 0)
{
x = 0;
y = 0;
}
Mouse.show();
this._lostFocus = this._focus.visible = true;
stage.frameRate = 10;
FlxG.pauseSounds();
}
protected function onEnterFrame(param1:Event = null) : void
{
var _loc2_:uint = uint(getTimer());
var _loc3_:uint = _loc2_ - this._total;
this._total = _loc2_;
this.updateSoundTray(_loc3_);
if(!this._lostFocus)
{
if(this._debugger != null && this._debugger.vcr.paused)
{
if(this._debugger.vcr.stepRequested)
{
this._debugger.vcr.stepRequested = false;
this.step();
}
}
else
{
this._accumulator += _loc3_;
if(this._accumulator > this._maxAccumulation)
{
this._accumulator = this._maxAccumulation;
}
while(this._accumulator > this._step)
{
this.step();
this._accumulator -= this._step;
}
}
FlxBasic._VISIBLECOUNT = 0;
this.draw();
if(this._debuggerUp)
{
this._debugger.perf.flash(_loc3_);
this._debugger.perf.visibleObjects(FlxBasic._VISIBLECOUNT);
this._debugger.perf.update();
this._debugger.watch.update();
}
}
}
protected function switchState() : void
{
FlxG.resetCameras();
FlxG.resetInput();
FlxG.destroySounds();
FlxG.clearBitmapCache();
if(this._debugger != null)
{
this._debugger.watch.removeAll();
}
var _loc1_:TimerManager = FlxTimer.manager;
if(_loc1_ != null)
{
_loc1_.clear();
}
if(this._state != null)
{
this._state.destroy();
}
this._state = this._requestedState;
this._state.create();
}
protected function step() : void
{
if(this._requestedReset)
{
this._requestedReset = false;
this._requestedState = new this._iState();
this._replayTimer = 0;
this._replayCancelKeys = null;
FlxG.reset();
}
if(this._recordingRequested)
{
this._recordingRequested = false;
this._replay.create(FlxG.globalSeed);
this._recording = true;
if(this._debugger != null)
{
this._debugger.vcr.recording();
FlxG.log("FLIXEL: starting new flixel gameplay record.");
}
}
else if(this._replayRequested)
{
this._replayRequested = false;
this._replay.rewind();
FlxG.globalSeed = this._replay.seed;
if(this._debugger != null)
{
this._debugger.vcr.playing();
}
this._replaying = true;
}
if(this._state != this._requestedState)
{
this.switchState();
}
FlxBasic._ACTIVECOUNT = 0;
if(this._replaying)
{
this._replay.playNextFrame();
if(this._replayTimer > 0)
{
this._replayTimer -= this._step;
if(this._replayTimer <= 0)
{
if(this._replayCallback != null)
{
this._replayCallback();
this._replayCallback = null;
}
else
{
FlxG.stopReplay();
}
}
}
if(this._replaying && this._replay.finished)
{
FlxG.stopReplay();
if(this._replayCallback != null)
{
this._replayCallback();
this._replayCallback = null;
}
}
if(this._debugger != null)
{
this._debugger.vcr.updateRuntime(this._step);
}
}
else
{
FlxG.updateInput();
}
if(this._recording)
{
this._replay.recordFrame();
if(this._debugger != null)
{
this._debugger.vcr.updateRuntime(this._step);
}
}
this.update();
FlxG.mouse.wheel = 0;
if(this._debuggerUp)
{
this._debugger.perf.activeObjects(FlxBasic._ACTIVECOUNT);
}
}
protected function updateSoundTray(param1:Number) : void
{
var _loc2_:FlxSave = null;
if(this._soundTray != null)
{
if(this._soundTrayTimer > 0)
{
this._soundTrayTimer -= param1 / 1000;
}
else if(this._soundTray.y > -this._soundTray.height)
{
this._soundTray.y -= param1 / 1000 * FlxG.height * 2;
if(this._soundTray.y <= -this._soundTray.height)
{
this._soundTray.visible = false;
_loc2_ = new FlxSave();
if(_loc2_.bind("flixel"))
{
if(_loc2_.data.sound == null)
{
_loc2_.data.sound = new Object();
}
_loc2_.data.sound.mute = FlxG.mute;
_loc2_.data.sound.volume = FlxG.volume;
_loc2_.close();
}
}
}
}
}
protected function update() : void
{
var _loc1_:uint = uint(getTimer());
FlxG.elapsed = FlxG.timeScale * (this._step / 1000);
FlxG.updateSounds();
FlxG.updatePlugins();
this._state.update();
FlxG.updateCameras();
if(this._debuggerUp)
{
this._debugger.perf.flixelUpdate(getTimer() - _loc1_);
}
}
protected function draw() : void
{
var _loc1_:uint = uint(getTimer());
FlxG.lockCameras();
this._state.draw();
FlxG.drawPlugins();
FlxG.unlockCameras();
if(this._debuggerUp)
{
this._debugger.perf.flixelDraw(getTimer() - _loc1_);
}
}
protected function create(param1:Event) : void
{
if(root == null)
{
return;
}
removeEventListener(Event.ENTER_FRAME,this.create);
this._total = getTimer();
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
stage.frameRate = this._flashFramerate;
stage.addEventListener(MouseEvent.MOUSE_DOWN,this.onMouseDown);
stage.addEventListener(MouseEvent.MOUSE_UP,this.onMouseUp);
stage.addEventListener(MouseEvent.MOUSE_WHEEL,this.onMouseWheel);
stage.addEventListener(KeyboardEvent.KEY_DOWN,this.onKeyDown);
stage.addEventListener(KeyboardEvent.KEY_UP,this.onKeyUp);
addChild(this._mouse);
if(!FlxG.mobile)
{
if(FlxG.debug || this.forceDebugger || true)
{
this._debugger = new FlxDebugger(FlxG.width * FlxCamera.defaultZoom,FlxG.height * FlxCamera.defaultZoom);
addChild(this._debugger);
}
this.createSoundTray();
stage.addEventListener(Event.DEACTIVATE,this.onFocusLost);
stage.addEventListener(Event.ACTIVATE,this.onFocus);
this.createFocusScreen();
}
addEventListener(Event.ENTER_FRAME,this.onEnterFrame);
}
protected function createSoundTray() : void
{
this._soundTray.visible = false;
this._soundTray.scaleX = 2;
this._soundTray.scaleY = 2;
var _loc1_:Bitmap = new Bitmap(new BitmapData(80,30,true,2130706432));
this._soundTray.x = FlxG.width / 2 * FlxCamera.defaultZoom - _loc1_.width / 2 * this._soundTray.scaleX;
this._soundTray.addChild(_loc1_);
var _loc2_:TextField = new TextField();
_loc2_.width = _loc1_.width;
_loc2_.height = _loc1_.height;
_loc2_.multiline = true;
_loc2_.wordWrap = true;
_loc2_.selectable = false;
_loc2_.embedFonts = true;
_loc2_.antiAliasType = AntiAliasType.NORMAL;
_loc2_.gridFitType = GridFitType.PIXEL;
_loc2_.defaultTextFormat = new TextFormat("system",8,16777215,null,null,null,null,null,"center");
this._soundTray.addChild(_loc2_);
_loc2_.text = "VOLUME";
_loc2_.y = 16;
var _loc3_:uint = 10;
var _loc4_:uint = 14;
this._soundTrayBars = new Array();
var _loc5_:uint = 0;
while(_loc5_ < 10)
{
_loc1_ = new Bitmap(new BitmapData(4,++_loc5_,false,16777215));
_loc1_.x = _loc3_;
_loc1_.y = _loc4_;
this._soundTrayBars.push(this._soundTray.addChild(_loc1_));
_loc3_ += 6;
_loc4_--;
}
this._soundTray.y = -this._soundTray.height;
this._soundTray.visible = false;
addChild(this._soundTray);
var _loc6_:FlxSave = new FlxSave();
if(_loc6_.bind("flixel") && _loc6_.data.sound != null)
{
if(_loc6_.data.sound.volume != null)
{
FlxG.volume = _loc6_.data.sound.volume;
}
if(_loc6_.data.sound.mute != null)
{
FlxG.mute = _loc6_.data.sound.mute;
}
_loc6_.destroy();
}
}
protected function createFocusScreen() : void
{
var _loc1_:Graphics = this._focus.graphics;
var _loc2_:uint = FlxG.width * FlxCamera.defaultZoom;
var _loc3_:uint = FlxG.height * FlxCamera.defaultZoom;
_loc1_.moveTo(0,0);
_loc1_.beginFill(0,0.5);
_loc1_.lineTo(_loc2_,0);
_loc1_.lineTo(_loc2_,_loc3_);
_loc1_.lineTo(0,_loc3_);
_loc1_.lineTo(0,0);
_loc1_.endFill();
var _loc4_:uint = _loc2_ / 2;
var _loc5_:uint = _loc3_ / 2;
var _loc6_:uint = FlxU.min(_loc4_,_loc5_) / 3;
_loc1_.moveTo(_loc4_ - _loc6_,_loc5_ - _loc6_);
_loc1_.beginFill(16777215,0.65);
_loc1_.lineTo(_loc4_ + _loc6_,_loc5_);
_loc1_.lineTo(_loc4_ - _loc6_,_loc5_ + _loc6_);
_loc1_.lineTo(_loc4_ - _loc6_,_loc5_ - _loc6_);
_loc1_.endFill();
var _loc7_:Bitmap = new this.ImgLogo();
_loc7_.scaleX = int(_loc6_ / 10);
if(_loc7_.scaleX < 1)
{
_loc7_.scaleX = 1;
}
_loc7_.scaleY = _loc7_.scaleX;
_loc7_.x -= _loc7_.scaleX;
_loc7_.alpha = 0.35;
this._focus.addChild(_loc7_);
addChild(this._focus);
}
}
}
@@ -0,0 +1,15 @@
package org.flixel
{
import mx.core.BitmapAsset;
[Embed(source="/_assets/166_org.flixel.FlxGame_ImgLogo.png")]
public class FlxGame_ImgLogo extends BitmapAsset
{
public function FlxGame_ImgLogo()
{
super();
}
}
}
@@ -0,0 +1,15 @@
package org.flixel
{
import mx.core.SoundAsset;
[Embed(source="/_assets/1_org.flixel.FlxGame_SndBeep_org.flixel.FlxGame_SndBeep.mp3")]
public class FlxGame_SndBeep extends SoundAsset
{
public function FlxGame_SndBeep()
{
super();
}
}
}
@@ -0,0 +1,24 @@
package org.flixel
{
import mx.core.FontAsset;
[Embed(source="/_assets/280_org.flixel.FlxGame_junk_system.ttf",
fontName="system",
fontFamily="Nokia Cellphone FC",
mimeType="application/x-font",
fontWeight="normal",
fontStyle="normal",
unicodeRange="U+0020-007E,U+00A0-00A1,U+00A3-00A7,U+00BA-00BA,U+00BF-00CF,U+00D1-00D6,U+00D8-00DD,U+00DF-00EF,U+00F1-00F6,U+00F8-00FD,U+00FF-00FF,U+011E-011F,U+0161-0161,U+0178-0178,U+02C6-02C6,U+2019-2019,U+20AC-20AC",
advancedAntiAliasing="true",
embedAsCFF="false"
)]
public class FlxGame_junk extends FontAsset
{
public function FlxGame_junk()
{
super();
}
}
}
@@ -0,0 +1,434 @@
package org.flixel
{
public class FlxGroup extends FlxBasic
{
public static const ASCENDING:int = -1;
public static const DESCENDING:int = 1;
public var members:Array;
public var length:Number;
protected var _maxSize:uint;
protected var _marker:uint;
protected var _sortIndex:String;
protected var _sortOrder:int;
public function FlxGroup(param1:uint = 0)
{
super();
this.members = new Array();
this.length = 0;
this._maxSize = param1;
this._marker = 0;
this._sortIndex = null;
}
override public function destroy() : void
{
var _loc1_:FlxBasic = null;
var _loc2_:uint = 0;
if(this.members != null)
{
_loc2_ = 0;
while(_loc2_ < this.length)
{
_loc1_ = this.members[_loc2_++] as FlxBasic;
if(_loc1_ != null)
{
_loc1_.destroy();
}
}
this.members.length = 0;
this.members = null;
}
this._sortIndex = null;
}
override public function preUpdate() : void
{
}
override public function update() : void
{
var _loc1_:FlxBasic = null;
var _loc2_:uint = 0;
while(_loc2_ < this.length)
{
_loc1_ = this.members[_loc2_++] as FlxBasic;
if(_loc1_ != null && _loc1_.exists && _loc1_.active)
{
_loc1_.preUpdate();
_loc1_.update();
_loc1_.postUpdate();
}
}
}
override public function draw() : void
{
var _loc1_:FlxBasic = null;
var _loc2_:uint = 0;
while(_loc2_ < this.length)
{
_loc1_ = this.members[_loc2_++] as FlxBasic;
if(_loc1_ != null && _loc1_.exists && _loc1_.visible)
{
_loc1_.draw();
}
}
}
public function get maxSize() : uint
{
return this._maxSize;
}
public function set maxSize(param1:uint) : void
{
var _loc2_:FlxBasic = null;
this._maxSize = param1;
if(this._marker >= this._maxSize)
{
this._marker = 0;
}
if(this._maxSize == 0 || this.members == null || this._maxSize >= this.members.length)
{
return;
}
var _loc3_:uint = this._maxSize;
var _loc4_:uint = this.members.length;
while(_loc3_ < _loc4_)
{
_loc2_ = this.members[_loc3_++] as FlxBasic;
if(_loc2_ != null)
{
_loc2_.destroy();
}
}
this.length = this.members.length = this._maxSize;
}
public function add(param1:FlxBasic) : FlxBasic
{
if(this.members.indexOf(param1) >= 0)
{
return param1;
}
var _loc2_:uint = 0;
var _loc3_:uint = this.members.length;
while(_loc2_ < _loc3_)
{
if(this.members[_loc2_] == null)
{
this.members[_loc2_] = param1;
if(_loc2_ >= this.length)
{
this.length = _loc2_ + 1;
}
return param1;
}
_loc2_++;
}
if(this._maxSize > 0)
{
if(this.members.length >= this._maxSize)
{
return param1;
}
if(this.members.length * 2 <= this._maxSize)
{
this.members.length *= 2;
}
else
{
this.members.length = this._maxSize;
}
}
else
{
this.members.length *= 2;
}
this.members[_loc2_] = param1;
this.length = _loc2_ + 1;
return param1;
}
public function recycle(param1:Class = null) : FlxBasic
{
var _loc2_:FlxBasic = null;
if(this._maxSize > 0)
{
if(this.length < this._maxSize)
{
if(param1 == null)
{
return null;
}
return this.add(new param1() as FlxBasic);
}
_loc2_ = this.members[this._marker++];
if(this._marker >= this._maxSize)
{
this._marker = 0;
}
return _loc2_;
}
_loc2_ = this.getFirstAvailable(param1);
if(_loc2_ != null)
{
return _loc2_;
}
if(param1 == null)
{
return null;
}
return this.add(new param1() as FlxBasic);
}
public function remove(param1:FlxBasic, param2:Boolean = false) : FlxBasic
{
var _loc3_:int = this.members.indexOf(param1);
if(_loc3_ < 0 || _loc3_ >= this.members.length)
{
return null;
}
if(param2)
{
this.members.splice(_loc3_,1);
--this.length;
}
else
{
this.members[_loc3_] = null;
}
return param1;
}
public function replace(param1:FlxBasic, param2:FlxBasic) : FlxBasic
{
var _loc3_:int = this.members.indexOf(param1);
if(_loc3_ < 0 || _loc3_ >= this.members.length)
{
return null;
}
this.members[_loc3_] = param2;
return param2;
}
public function sort(param1:String = "y", param2:int = -1) : void
{
this._sortIndex = param1;
this._sortOrder = param2;
this.members.sort(this.sortHandler);
}
public function setAll(param1:String, param2:Object, param3:Boolean = true) : void
{
var _loc4_:FlxBasic = null;
var _loc5_:uint = 0;
while(_loc5_ < this.length)
{
_loc4_ = this.members[_loc5_++] as FlxBasic;
if(_loc4_ != null)
{
if(param3 && _loc4_ is FlxGroup)
{
(_loc4_ as FlxGroup).setAll(param1,param2,param3);
}
else
{
_loc4_[param1] = param2;
}
}
}
}
public function callAll(param1:String, param2:Boolean = true) : void
{
var _loc3_:FlxBasic = null;
var _loc4_:uint = 0;
while(_loc4_ < this.length)
{
_loc3_ = this.members[_loc4_++] as FlxBasic;
if(_loc3_ != null)
{
if(param2 && _loc3_ is FlxGroup)
{
(_loc3_ as FlxGroup).callAll(param1,param2);
}
else
{
_loc3_[param1]();
}
}
}
}
public function getFirstAvailable(param1:Class = null) : FlxBasic
{
var _loc2_:FlxBasic = null;
var _loc3_:uint = 0;
while(_loc3_ < this.length)
{
_loc2_ = this.members[_loc3_++] as FlxBasic;
if(_loc2_ != null && !_loc2_.exists && (param1 == null || _loc2_ is param1))
{
return _loc2_;
}
}
return null;
}
public function getFirstNull() : int
{
var _loc1_:FlxBasic = null;
var _loc2_:uint = 0;
var _loc3_:uint = this.members.length;
while(_loc2_ < _loc3_)
{
if(this.members[_loc2_] == null)
{
return _loc2_;
}
_loc2_++;
}
return -1;
}
public function getFirstExtant() : FlxBasic
{
var _loc1_:FlxBasic = null;
var _loc2_:uint = 0;
while(_loc2_ < this.length)
{
_loc1_ = this.members[_loc2_++] as FlxBasic;
if(_loc1_ != null && _loc1_.exists)
{
return _loc1_;
}
}
return null;
}
public function getFirstAlive() : FlxBasic
{
var _loc1_:FlxBasic = null;
var _loc2_:uint = 0;
while(_loc2_ < this.length)
{
_loc1_ = this.members[_loc2_++] as FlxBasic;
if(_loc1_ != null && _loc1_.exists && _loc1_.alive)
{
return _loc1_;
}
}
return null;
}
public function getFirstDead() : FlxBasic
{
var _loc1_:FlxBasic = null;
var _loc2_:uint = 0;
while(_loc2_ < this.length)
{
_loc1_ = this.members[_loc2_++] as FlxBasic;
if(_loc1_ != null && !_loc1_.alive)
{
return _loc1_;
}
}
return null;
}
public function countLiving() : int
{
var _loc2_:FlxBasic = null;
var _loc1_:int = -1;
var _loc3_:uint = 0;
while(_loc3_ < this.length)
{
_loc2_ = this.members[_loc3_++] as FlxBasic;
if(_loc2_ != null)
{
if(_loc1_ < 0)
{
_loc1_ = 0;
}
if(_loc2_.exists && _loc2_.alive)
{
_loc1_++;
}
}
}
return _loc1_;
}
public function countDead() : int
{
var _loc2_:FlxBasic = null;
var _loc1_:int = -1;
var _loc3_:uint = 0;
while(_loc3_ < this.length)
{
_loc2_ = this.members[_loc3_++] as FlxBasic;
if(_loc2_ != null)
{
if(_loc1_ < 0)
{
_loc1_ = 0;
}
if(!_loc2_.alive)
{
_loc1_++;
}
}
}
return _loc1_;
}
public function getRandom() : FlxBasic
{
return FlxG.getRandom(this.members) as FlxBasic;
}
public function clear() : void
{
this.length = this.members.length = 0;
}
override public function kill() : void
{
var _loc1_:FlxBasic = null;
var _loc2_:uint = 0;
while(_loc2_ < this.length)
{
_loc1_ = this.members[_loc2_++] as FlxBasic;
if(_loc1_ != null && _loc1_.exists)
{
_loc1_.kill();
}
}
super.kill();
}
protected function sortHandler(param1:FlxBasic, param2:FlxBasic) : int
{
if(param1[this._sortIndex] < param2[this._sortIndex])
{
return this._sortOrder;
}
if(param1[this._sortIndex] > param2[this._sortIndex])
{
return -this._sortOrder;
}
return 0;
}
}
}
@@ -0,0 +1,883 @@
package org.flixel
{
import flash.display.Graphics;
public class FlxObject extends FlxBasic
{
public static const LEFT:uint = 1;
public static const RIGHT:uint = 16;
public static const UP:uint = 256;
public static const DOWN:uint = 4096;
public static const NONE:uint = 0;
public static const CEILING:uint = UP;
public static const FLOOR:uint = DOWN;
public static const WALL:uint = LEFT | RIGHT;
public static const ANY:uint = LEFT | RIGHT | UP | DOWN;
public static const OVERLAP_BIAS:Number = 4;
public static const PATH_FORWARD:uint = 0;
public static const PATH_BACKWARD:uint = 1;
public static const PATH_LOOP_FORWARD:uint = 16;
public static const PATH_LOOP_BACKWARD:uint = 256;
public static const PATH_YOYO:uint = 4096;
public static const PATH_HORIZONTAL_ONLY:uint = 65536;
public static const PATH_VERTICAL_ONLY:uint = 1048576;
protected static const _pZero:FlxPoint = new FlxPoint();
public var x:Number;
public var y:Number;
public var width:Number;
public var height:Number;
public var immovable:Boolean;
public var velocity:FlxPoint;
public var mass:Number;
public var elasticity:Number;
public var acceleration:FlxPoint;
public var drag:FlxPoint;
public var maxVelocity:FlxPoint;
public var angle:Number;
public var angularVelocity:Number;
public var angularAcceleration:Number;
public var angularDrag:Number;
public var maxAngular:Number;
public var scrollFactor:FlxPoint;
protected var _flicker:Boolean;
protected var _flickerTimer:Number;
public var health:Number;
protected var _point:FlxPoint;
protected var _rect:FlxRect;
public var moves:Boolean;
public var touching:uint;
public var wasTouching:uint;
public var allowCollisions:uint;
public var last:FlxPoint;
public var path:FlxPath;
public var pathSpeed:Number;
public var pathAngle:Number;
protected var _pathNodeIndex:int;
protected var _pathMode:uint;
protected var _pathInc:int;
protected var _pathRotate:Boolean;
public function FlxObject(param1:Number = 0, param2:Number = 0, param3:Number = 0, param4:Number = 0)
{
super();
this.x = param1;
this.y = param2;
this.last = new FlxPoint(this.x,this.y);
this.width = param3;
this.height = param4;
this.mass = 1;
this.elasticity = 0;
this.immovable = false;
this.moves = true;
this.touching = NONE;
this.wasTouching = NONE;
this.allowCollisions = ANY;
this.velocity = new FlxPoint();
this.acceleration = new FlxPoint();
this.drag = new FlxPoint();
this.maxVelocity = new FlxPoint(10000,10000);
this.angle = 0;
this.angularVelocity = 0;
this.angularAcceleration = 0;
this.angularDrag = 0;
this.maxAngular = 10000;
this.scrollFactor = new FlxPoint(1,1);
this._flicker = false;
this._flickerTimer = 0;
this._point = new FlxPoint();
this._rect = new FlxRect();
this.path = null;
this.pathSpeed = 0;
this.pathAngle = 0;
}
public static function separate(param1:FlxObject, param2:FlxObject) : Boolean
{
var _loc3_:Boolean = separateX(param1,param2);
var _loc4_:Boolean = separateY(param1,param2);
return _loc3_ || _loc4_;
}
public static function separateX(param1:FlxObject, param2:FlxObject) : Boolean
{
var _loc8_:Number = NaN;
var _loc9_:Number = NaN;
var _loc10_:FlxRect = null;
var _loc11_:FlxRect = null;
var _loc12_:Number = NaN;
var _loc13_:Number = NaN;
var _loc14_:Number = NaN;
var _loc15_:Number = NaN;
var _loc16_:Number = NaN;
var _loc17_:Number = NaN;
var _loc3_:Boolean = param1.immovable;
var _loc4_:Boolean = param2.immovable;
if(_loc3_ && _loc4_)
{
return false;
}
if(param1 is FlxTilemap)
{
return (param1 as FlxTilemap).overlapsWithCallback(param2,separateX);
}
if(param2 is FlxTilemap)
{
return (param2 as FlxTilemap).overlapsWithCallback(param1,separateX,true);
}
var _loc5_:Number = 0;
var _loc6_:Number = param1.x - param1.last.x;
var _loc7_:Number = param2.x - param2.last.x;
if(_loc6_ != _loc7_)
{
_loc8_ = _loc6_ > 0 ? _loc6_ : -_loc6_;
_loc9_ = _loc7_ > 0 ? _loc7_ : -_loc7_;
_loc10_ = new FlxRect(param1.x - (_loc6_ > 0 ? _loc6_ : 0),param1.last.y,param1.width + (_loc6_ > 0 ? _loc6_ : -_loc6_),param1.height);
_loc11_ = new FlxRect(param2.x - (_loc7_ > 0 ? _loc7_ : 0),param2.last.y,param2.width + (_loc7_ > 0 ? _loc7_ : -_loc7_),param2.height);
if(_loc10_.x + _loc10_.width > _loc11_.x && _loc10_.x < _loc11_.x + _loc11_.width && _loc10_.y + _loc10_.height > _loc11_.y && _loc10_.y < _loc11_.y + _loc11_.height)
{
_loc12_ = _loc8_ + _loc9_ + OVERLAP_BIAS;
if(_loc6_ > _loc7_)
{
_loc5_ = param1.x + param1.width - param2.x;
if(_loc5_ > _loc12_ || !(param1.allowCollisions & RIGHT) || !(param2.allowCollisions & LEFT))
{
_loc5_ = 0;
}
else
{
param1.touching |= RIGHT;
param2.touching |= LEFT;
}
}
else if(_loc6_ < _loc7_)
{
_loc5_ = param1.x - param2.width - param2.x;
if(-_loc5_ > _loc12_ || !(param1.allowCollisions & LEFT) || !(param2.allowCollisions & RIGHT))
{
_loc5_ = 0;
}
else
{
param1.touching |= LEFT;
param2.touching |= RIGHT;
}
}
}
}
if(_loc5_ != 0)
{
_loc13_ = param1.velocity.x;
_loc14_ = param2.velocity.x;
if(!_loc3_ && !_loc4_)
{
_loc5_ *= 0.5;
param1.x -= _loc5_;
param2.x += _loc5_;
_loc15_ = Math.sqrt(_loc14_ * _loc14_ * param2.mass / param1.mass) * (_loc14_ > 0 ? 1 : -1);
_loc16_ = Math.sqrt(_loc13_ * _loc13_ * param1.mass / param2.mass) * (_loc13_ > 0 ? 1 : -1);
_loc17_ = (_loc15_ + _loc16_) * 0.5;
_loc15_ -= _loc17_;
_loc16_ -= _loc17_;
param1.velocity.x = _loc17_ + _loc15_ * param1.elasticity;
param2.velocity.x = _loc17_ + _loc16_ * param2.elasticity;
}
else if(!_loc3_)
{
param1.x -= _loc5_;
param1.velocity.x = _loc14_ - _loc13_ * param1.elasticity;
}
else if(!_loc4_)
{
param2.x += _loc5_;
param2.velocity.x = _loc13_ - _loc14_ * param2.elasticity;
}
return true;
}
return false;
}
public static function separateY(param1:FlxObject, param2:FlxObject) : Boolean
{
var _loc8_:Number = NaN;
var _loc9_:Number = NaN;
var _loc10_:FlxRect = null;
var _loc11_:FlxRect = null;
var _loc12_:Number = NaN;
var _loc13_:Number = NaN;
var _loc14_:Number = NaN;
var _loc15_:Number = NaN;
var _loc16_:Number = NaN;
var _loc17_:Number = NaN;
var _loc3_:Boolean = param1.immovable;
var _loc4_:Boolean = param2.immovable;
if(_loc3_ && _loc4_)
{
return false;
}
if(param1 is FlxTilemap)
{
return (param1 as FlxTilemap).overlapsWithCallback(param2,separateY);
}
if(param2 is FlxTilemap)
{
return (param2 as FlxTilemap).overlapsWithCallback(param1,separateY,true);
}
var _loc5_:Number = 0;
var _loc6_:Number = param1.y - param1.last.y;
var _loc7_:Number = param2.y - param2.last.y;
if(_loc6_ != _loc7_)
{
_loc8_ = _loc6_ > 0 ? _loc6_ : -_loc6_;
_loc9_ = _loc7_ > 0 ? _loc7_ : -_loc7_;
_loc10_ = new FlxRect(param1.x,param1.y - (_loc6_ > 0 ? _loc6_ : 0),param1.width,param1.height + _loc8_);
_loc11_ = new FlxRect(param2.x,param2.y - (_loc7_ > 0 ? _loc7_ : 0),param2.width,param2.height + _loc9_);
if(_loc10_.x + _loc10_.width > _loc11_.x && _loc10_.x < _loc11_.x + _loc11_.width && _loc10_.y + _loc10_.height > _loc11_.y && _loc10_.y < _loc11_.y + _loc11_.height)
{
_loc12_ = _loc8_ + _loc9_ + OVERLAP_BIAS;
if(_loc6_ > _loc7_)
{
_loc5_ = param1.y + param1.height - param2.y;
if(_loc5_ > _loc12_ || !(param1.allowCollisions & DOWN) || !(param2.allowCollisions & UP))
{
_loc5_ = 0;
}
else
{
param1.touching |= DOWN;
param2.touching |= UP;
}
}
else if(_loc6_ < _loc7_)
{
_loc5_ = param1.y - param2.height - param2.y;
if(-_loc5_ > _loc12_ || !(param1.allowCollisions & UP) || !(param2.allowCollisions & DOWN))
{
_loc5_ = 0;
}
else
{
param1.touching |= UP;
param2.touching |= DOWN;
}
}
}
}
if(_loc5_ != 0)
{
_loc13_ = param1.velocity.y;
_loc14_ = param2.velocity.y;
if(!_loc3_ && !_loc4_)
{
_loc5_ *= 0.5;
param1.y -= _loc5_;
param2.y += _loc5_;
_loc15_ = Math.sqrt(_loc14_ * _loc14_ * param2.mass / param1.mass) * (_loc14_ > 0 ? 1 : -1);
_loc16_ = Math.sqrt(_loc13_ * _loc13_ * param1.mass / param2.mass) * (_loc13_ > 0 ? 1 : -1);
_loc17_ = (_loc15_ + _loc16_) * 0.5;
_loc15_ -= _loc17_;
_loc16_ -= _loc17_;
param1.velocity.y = _loc17_ + _loc15_ * param1.elasticity;
param2.velocity.y = _loc17_ + _loc16_ * param2.elasticity;
}
else if(!_loc3_)
{
param1.y -= _loc5_;
param1.velocity.y = _loc14_ - _loc13_ * param1.elasticity;
if(param2.active && param2.moves && _loc6_ > _loc7_)
{
param1.x += param2.x - param2.last.x;
}
}
else if(!_loc4_)
{
param2.y += _loc5_;
param2.velocity.y = _loc13_ - _loc14_ * param2.elasticity;
if(param1.active && param1.moves && _loc6_ < _loc7_)
{
param2.x += param1.x - param1.last.x;
}
}
return true;
}
return false;
}
override public function destroy() : void
{
this.velocity = null;
this.acceleration = null;
this.drag = null;
this.maxVelocity = null;
this.scrollFactor = null;
this._point = null;
this._rect = null;
this.last = null;
cameras = null;
if(this.path != null)
{
this.path.destroy();
}
this.path = null;
}
override public function preUpdate() : void
{
++_ACTIVECOUNT;
if(this._flickerTimer != 0)
{
if(this._flickerTimer > 0)
{
this._flickerTimer -= FlxG.elapsed;
if(this._flickerTimer <= 0)
{
this._flickerTimer = 0;
this._flicker = false;
}
}
}
this.last.x = this.x;
this.last.y = this.y;
if(this.path != null && this.pathSpeed != 0 && this.path.nodes[this._pathNodeIndex] != null)
{
this.updatePathMotion();
}
}
override public function postUpdate() : void
{
if(this.moves)
{
this.updateMotion();
}
this.wasTouching = this.touching;
this.touching = NONE;
}
protected function updateMotion() : void
{
var _loc1_:Number = NaN;
var _loc2_:Number = NaN;
_loc2_ = (FlxU.computeVelocity(this.angularVelocity,this.angularAcceleration,this.angularDrag,this.maxAngular) - this.angularVelocity) / 2;
this.angularVelocity += _loc2_;
this.angle += this.angularVelocity * FlxG.elapsed;
this.angularVelocity += _loc2_;
_loc2_ = (FlxU.computeVelocity(this.velocity.x,this.acceleration.x,this.drag.x,this.maxVelocity.x) - this.velocity.x) / 2;
this.velocity.x += _loc2_;
_loc1_ = this.velocity.x * FlxG.elapsed;
this.velocity.x += _loc2_;
this.x += _loc1_;
_loc2_ = (FlxU.computeVelocity(this.velocity.y,this.acceleration.y,this.drag.y,this.maxVelocity.y) - this.velocity.y) / 2;
this.velocity.y += _loc2_;
_loc1_ = this.velocity.y * FlxG.elapsed;
this.velocity.y += _loc2_;
this.y += _loc1_;
}
override public function draw() : void
{
var _loc1_:FlxCamera = null;
if(cameras == null)
{
cameras = FlxG.cameras;
}
var _loc2_:uint = 0;
var _loc3_:uint = cameras.length;
while(_loc2_ < _loc3_)
{
_loc1_ = cameras[_loc2_++];
if(this.onScreen(_loc1_))
{
++_VISIBLECOUNT;
if(FlxG.visualDebug && !ignoreDrawDebug)
{
this.drawDebug(_loc1_);
}
}
}
}
override public function drawDebug(param1:FlxCamera = null) : void
{
var _loc7_:uint = 0;
if(param1 == null)
{
param1 = FlxG.camera;
}
var _loc2_:Number = this.x - int(param1.scroll.x * this.scrollFactor.x);
var _loc3_:Number = this.y - int(param1.scroll.y * this.scrollFactor.y);
_loc2_ = int(_loc2_ + (_loc2_ > 0 ? 1e-7 : -1e-7));
_loc3_ = int(_loc3_ + (_loc3_ > 0 ? 1e-7 : -1e-7));
var _loc4_:int = this.width != int(this.width) ? int(this.width) : int(this.width - 1);
var _loc5_:int = this.height != int(this.height) ? int(this.height) : int(this.height - 1);
var _loc6_:Graphics = FlxG.flashGfx;
_loc6_.clear();
_loc6_.moveTo(_loc2_,_loc3_);
if(this.allowCollisions)
{
if(this.allowCollisions != ANY)
{
_loc7_ = FlxG.PINK;
}
if(this.immovable)
{
_loc7_ = FlxG.GREEN;
}
else
{
_loc7_ = FlxG.RED;
}
}
else
{
_loc7_ = FlxG.BLUE;
}
_loc6_.lineStyle(1,_loc7_,0.5);
_loc6_.lineTo(_loc2_ + _loc4_,_loc3_);
_loc6_.lineTo(_loc2_ + _loc4_,_loc3_ + _loc5_);
_loc6_.lineTo(_loc2_,_loc3_ + _loc5_);
_loc6_.lineTo(_loc2_,_loc3_);
param1.buffer.draw(FlxG.flashGfxSprite);
}
public function followPath(param1:FlxPath, param2:Number = 100, param3:uint = 0, param4:Boolean = false) : void
{
if(param1.nodes.length <= 0)
{
FlxG.log("WARNING: Paths need at least one node in them to be followed.");
return;
}
this.path = param1;
this.pathSpeed = FlxU.abs(param2);
this._pathMode = param3;
this._pathRotate = param4;
if(this._pathMode == PATH_BACKWARD || this._pathMode == PATH_LOOP_BACKWARD)
{
this._pathNodeIndex = this.path.nodes.length - 1;
this._pathInc = -1;
}
else
{
this._pathNodeIndex = 0;
this._pathInc = 1;
}
}
public function stopFollowingPath(param1:Boolean = false) : void
{
this.pathSpeed = 0;
if(param1 && this.path != null)
{
this.path.destroy();
this.path = null;
}
}
protected function advancePath(param1:Boolean = true) : FlxPoint
{
var _loc2_:FlxPoint = null;
if(param1)
{
_loc2_ = this.path.nodes[this._pathNodeIndex];
if(_loc2_ != null)
{
if((this._pathMode & PATH_VERTICAL_ONLY) == 0)
{
this.x = _loc2_.x - this.width * 0.5;
}
if((this._pathMode & PATH_HORIZONTAL_ONLY) == 0)
{
this.y = _loc2_.y - this.height * 0.5;
}
}
}
this._pathNodeIndex += this._pathInc;
if((this._pathMode & PATH_BACKWARD) > 0)
{
if(this._pathNodeIndex < 0)
{
this._pathNodeIndex = 0;
this.pathSpeed = 0;
}
}
else if((this._pathMode & PATH_LOOP_FORWARD) > 0)
{
if(this._pathNodeIndex >= this.path.nodes.length)
{
this._pathNodeIndex = 0;
}
}
else if((this._pathMode & PATH_LOOP_BACKWARD) > 0)
{
if(this._pathNodeIndex < 0)
{
this._pathNodeIndex = this.path.nodes.length - 1;
if(this._pathNodeIndex < 0)
{
this._pathNodeIndex = 0;
}
}
}
else if((this._pathMode & PATH_YOYO) > 0)
{
if(this._pathInc > 0)
{
if(this._pathNodeIndex >= this.path.nodes.length)
{
this._pathNodeIndex = this.path.nodes.length - 2;
if(this._pathNodeIndex < 0)
{
this._pathNodeIndex = 0;
}
this._pathInc = -this._pathInc;
}
}
else if(this._pathNodeIndex < 0)
{
this._pathNodeIndex = 1;
if(this._pathNodeIndex >= this.path.nodes.length)
{
this._pathNodeIndex = this.path.nodes.length - 1;
}
if(this._pathNodeIndex < 0)
{
this._pathNodeIndex = 0;
}
this._pathInc = -this._pathInc;
}
}
else if(this._pathNodeIndex >= this.path.nodes.length)
{
this._pathNodeIndex = this.path.nodes.length - 1;
this.pathSpeed = 0;
}
return this.path.nodes[this._pathNodeIndex];
}
protected function updatePathMotion() : void
{
this._point.x = this.x + this.width * 0.5;
this._point.y = this.y + this.height * 0.5;
var _loc1_:FlxPoint = this.path.nodes[this._pathNodeIndex];
var _loc2_:Number = _loc1_.x - this._point.x;
var _loc3_:Number = _loc1_.y - this._point.y;
var _loc4_:Boolean = (this._pathMode & PATH_HORIZONTAL_ONLY) > 0;
var _loc5_:Boolean = (this._pathMode & PATH_VERTICAL_ONLY) > 0;
if(_loc4_)
{
if((_loc2_ > 0 ? _loc2_ : -_loc2_) < this.pathSpeed * FlxG.elapsed)
{
_loc1_ = this.advancePath();
}
}
else if(_loc5_)
{
if((_loc3_ > 0 ? _loc3_ : -_loc3_) < this.pathSpeed * FlxG.elapsed)
{
_loc1_ = this.advancePath();
}
}
else if(Math.sqrt(_loc2_ * _loc2_ + _loc3_ * _loc3_) < this.pathSpeed * FlxG.elapsed)
{
_loc1_ = this.advancePath();
}
if(this.pathSpeed != 0)
{
this._point.x = this.x + this.width * 0.5;
this._point.y = this.y + this.height * 0.5;
if(_loc4_ || this._point.y == _loc1_.y)
{
this.velocity.x = this._point.x < _loc1_.x ? this.pathSpeed : -this.pathSpeed;
if(this.velocity.x < 0)
{
this.pathAngle = -90;
}
else
{
this.pathAngle = 90;
}
if(!_loc4_)
{
this.velocity.y = 0;
}
}
else if(_loc5_ || this._point.x == _loc1_.x)
{
this.velocity.y = this._point.y < _loc1_.y ? this.pathSpeed : -this.pathSpeed;
if(this.velocity.y < 0)
{
this.pathAngle = 0;
}
else
{
this.pathAngle = 180;
}
if(!_loc5_)
{
this.velocity.x = 0;
}
}
else
{
this.pathAngle = FlxU.getAngle(this._point,_loc1_);
FlxU.rotatePoint(0,this.pathSpeed,0,0,this.pathAngle,this.velocity);
if(this._pathRotate)
{
this.angularVelocity = 0;
this.angularAcceleration = 0;
this.angle = this.pathAngle;
}
}
}
}
public function overlaps(param1:FlxBasic, param2:Boolean = false, param3:FlxCamera = null) : Boolean
{
var _loc6_:Boolean = false;
var _loc7_:uint = 0;
var _loc8_:Array = null;
if(param1 is FlxGroup)
{
_loc6_ = false;
_loc7_ = 0;
_loc8_ = (param1 as FlxGroup).members;
while(_loc7_ < length)
{
if(this.overlaps(_loc8_[_loc7_++],param2,param3))
{
_loc6_ = true;
}
}
return _loc6_;
}
if(param1 is FlxTilemap)
{
return (param1 as FlxTilemap).overlaps(this,param2,param3);
}
var _loc4_:FlxObject = param1 as FlxObject;
if(!param2)
{
return _loc4_.x + _loc4_.width > this.x && _loc4_.x < this.x + this.width && _loc4_.y + _loc4_.height > this.y && _loc4_.y < this.y + this.height;
}
if(param3 == null)
{
param3 = FlxG.camera;
}
var _loc5_:FlxPoint = _loc4_.getScreenXY(null,param3);
this.getScreenXY(this._point,param3);
return _loc5_.x + _loc4_.width > this._point.x && _loc5_.x < this._point.x + this.width && _loc5_.y + _loc4_.height > this._point.y && _loc5_.y < this._point.y + this.height;
}
public function overlapsAt(param1:Number, param2:Number, param3:FlxBasic, param4:Boolean = false, param5:FlxCamera = null) : Boolean
{
var _loc8_:Boolean = false;
var _loc9_:FlxBasic = null;
var _loc10_:uint = 0;
var _loc11_:Array = null;
var _loc12_:FlxTilemap = null;
if(param3 is FlxGroup)
{
_loc8_ = false;
_loc10_ = 0;
_loc11_ = (param3 as FlxGroup).members;
while(_loc10_ < length)
{
if(this.overlapsAt(param1,param2,_loc11_[_loc10_++],param4,param5))
{
_loc8_ = true;
}
}
return _loc8_;
}
if(param3 is FlxTilemap)
{
_loc12_ = param3 as FlxTilemap;
return _loc12_.overlapsAt(_loc12_.x - (param1 - this.x),_loc12_.y - (param2 - this.y),this,param4,param5);
}
var _loc6_:FlxObject = param3 as FlxObject;
if(!param4)
{
return _loc6_.x + _loc6_.width > param1 && _loc6_.x < param1 + this.width && _loc6_.y + _loc6_.height > param2 && _loc6_.y < param2 + this.height;
}
if(param5 == null)
{
param5 = FlxG.camera;
}
var _loc7_:FlxPoint = _loc6_.getScreenXY(null,param5);
this._point.x = param1 - int(param5.scroll.x * this.scrollFactor.x);
this._point.y = param2 - int(param5.scroll.y * this.scrollFactor.y);
this._point.x += this._point.x > 0 ? 1e-7 : -1e-7;
this._point.y += this._point.y > 0 ? 1e-7 : -1e-7;
return _loc7_.x + _loc6_.width > this._point.x && _loc7_.x < this._point.x + this.width && _loc7_.y + _loc6_.height > this._point.y && _loc7_.y < this._point.y + this.height;
}
public function overlapsPoint(param1:FlxPoint, param2:Boolean = false, param3:FlxCamera = null) : Boolean
{
if(!param2)
{
return param1.x > this.x && param1.x < this.x + this.width && param1.y > this.y && param1.y < this.y + this.height;
}
if(param3 == null)
{
param3 = FlxG.camera;
}
var _loc4_:Number = param1.x - param3.scroll.x;
var _loc5_:Number = param1.y - param3.scroll.y;
this.getScreenXY(this._point,param3);
return _loc4_ > this._point.x && _loc4_ < this._point.x + this.width && _loc5_ > this._point.y && _loc5_ < this._point.y + this.height;
}
public function onScreen(param1:FlxCamera = null) : Boolean
{
if(param1 == null)
{
param1 = FlxG.camera;
}
this.getScreenXY(this._point,param1);
return this._point.x + this.width > 0 && this._point.x < param1.width && this._point.y + this.height > 0 && this._point.y < param1.height;
}
public function getScreenXY(param1:FlxPoint = null, param2:FlxCamera = null) : FlxPoint
{
if(param1 == null)
{
param1 = new FlxPoint();
}
if(param2 == null)
{
param2 = FlxG.camera;
}
param1.x = this.x - int(param2.scroll.x * this.scrollFactor.x);
param1.y = this.y - int(param2.scroll.y * this.scrollFactor.y);
param1.x += param1.x > 0 ? 1e-7 : -1e-7;
param1.y += param1.y > 0 ? 1e-7 : -1e-7;
return param1;
}
public function flicker(param1:Number = 1) : void
{
this._flickerTimer = param1;
if(this._flickerTimer == 0)
{
this._flicker = false;
}
}
public function get flickering() : Boolean
{
return this._flickerTimer != 0;
}
public function get solid() : Boolean
{
return (this.allowCollisions & ANY) > NONE;
}
public function set solid(param1:Boolean) : void
{
if(param1)
{
this.allowCollisions = ANY;
}
else
{
this.allowCollisions = NONE;
}
}
public function getMidpoint(param1:FlxPoint = null) : FlxPoint
{
if(param1 == null)
{
param1 = new FlxPoint();
}
param1.x = this.x + this.width * 0.5;
param1.y = this.y + this.height * 0.5;
return param1;
}
public function reset(param1:Number, param2:Number) : void
{
revive();
this.touching = NONE;
this.wasTouching = NONE;
this.x = param1;
this.y = param2;
this.last.x = this.x;
this.last.y = this.y;
this.velocity.x = 0;
this.velocity.y = 0;
}
public function isTouching(param1:uint) : Boolean
{
return (this.touching & param1) > NONE;
}
public function justTouched(param1:uint) : Boolean
{
return (this.touching & param1) > NONE && (this.wasTouching & param1) <= NONE;
}
public function hurt(param1:Number) : void
{
this.health -= param1;
if(this.health <= 0)
{
kill();
}
}
}
}
@@ -0,0 +1,68 @@
package org.flixel
{
public class FlxParticle extends FlxSprite
{
public var lifespan:Number;
public var friction:Number;
public function FlxParticle()
{
super();
this.lifespan = 0;
this.friction = 500;
}
override public function update() : void
{
if(this.lifespan <= 0)
{
return;
}
this.lifespan -= FlxG.elapsed;
if(this.lifespan <= 0)
{
kill();
}
if(touching)
{
if(angularVelocity != 0)
{
angularVelocity = -angularVelocity;
}
}
if(acceleration.y > 0)
{
if(touching & FLOOR)
{
drag.x = this.friction;
if(!(wasTouching & FLOOR))
{
if(velocity.y < -elasticity * 10)
{
if(angularVelocity != 0)
{
angularVelocity *= -elasticity;
}
}
else
{
velocity.y = 0;
angularVelocity = 0;
}
}
}
else
{
drag.x = 0;
}
}
}
public function onEmit() : void
{
}
}
}
@@ -0,0 +1,211 @@
package org.flixel
{
import flash.display.Graphics;
import org.flixel.plugin.DebugPathDisplay;
public class FlxPath
{
public var nodes:Array;
public var debugColor:uint;
public var debugScrollFactor:FlxPoint;
public var ignoreDrawDebug:Boolean;
protected var _point:FlxPoint;
public function FlxPath(param1:Array = null)
{
super();
if(param1 == null)
{
this.nodes = new Array();
}
else
{
this.nodes = param1;
}
this._point = new FlxPoint();
this.debugScrollFactor = new FlxPoint(1,1);
this.debugColor = 16777215;
this.ignoreDrawDebug = false;
var _loc2_:DebugPathDisplay = manager;
if(_loc2_ != null)
{
_loc2_.add(this);
}
}
public static function get manager() : DebugPathDisplay
{
return FlxG.getPlugin(DebugPathDisplay) as DebugPathDisplay;
}
public function destroy() : void
{
var _loc1_:DebugPathDisplay = manager;
if(_loc1_ != null)
{
_loc1_.remove(this);
}
this.debugScrollFactor = null;
this._point = null;
this.nodes = null;
}
public function add(param1:Number, param2:Number) : void
{
this.nodes.push(new FlxPoint(param1,param2));
}
public function addAt(param1:Number, param2:Number, param3:uint) : void
{
if(param3 > this.nodes.length)
{
param3 = this.nodes.length;
}
this.nodes.splice(param3,0,new FlxPoint(param1,param2));
}
public function addPoint(param1:FlxPoint, param2:Boolean = false) : void
{
if(param2)
{
this.nodes.push(param1);
}
else
{
this.nodes.push(new FlxPoint(param1.x,param1.y));
}
}
public function addPointAt(param1:FlxPoint, param2:uint, param3:Boolean = false) : void
{
if(param2 > this.nodes.length)
{
param2 = this.nodes.length;
}
if(param3)
{
this.nodes.splice(param2,0,param1);
}
else
{
this.nodes.splice(param2,0,new FlxPoint(param1.x,param1.y));
}
}
public function remove(param1:FlxPoint) : FlxPoint
{
var _loc2_:int = this.nodes.indexOf(param1);
if(_loc2_ >= 0)
{
return this.nodes.splice(_loc2_,1)[0];
}
return null;
}
public function removeAt(param1:uint) : FlxPoint
{
if(this.nodes.length <= 0)
{
return null;
}
if(param1 >= this.nodes.length)
{
param1 = this.nodes.length - 1;
}
return this.nodes.splice(param1,1)[0];
}
public function head() : FlxPoint
{
if(this.nodes.length > 0)
{
return this.nodes[0];
}
return null;
}
public function tail() : FlxPoint
{
if(this.nodes.length > 0)
{
return this.nodes[this.nodes.length - 1];
}
return null;
}
public function drawDebug(param1:FlxCamera = null) : void
{
var _loc3_:FlxPoint = null;
var _loc4_:FlxPoint = null;
var _loc7_:uint = 0;
var _loc8_:uint = 0;
var _loc9_:Number = NaN;
if(this.nodes.length <= 0)
{
return;
}
if(param1 == null)
{
param1 = FlxG.camera;
}
var _loc2_:Graphics = FlxG.flashGfx;
_loc2_.clear();
var _loc5_:uint = 0;
var _loc6_:uint = this.nodes.length;
while(_loc5_ < _loc6_)
{
_loc3_ = this.nodes[_loc5_] as FlxPoint;
this._point.x = _loc3_.x - int(param1.scroll.x * this.debugScrollFactor.x);
this._point.y = _loc3_.y - int(param1.scroll.y * this.debugScrollFactor.y);
this._point.x = int(this._point.x + (this._point.x > 0 ? 1e-7 : -1e-7));
this._point.y = int(this._point.y + (this._point.y > 0 ? 1e-7 : -1e-7));
_loc7_ = 2;
if(_loc5_ == 0 || _loc5_ == _loc6_ - 1)
{
_loc7_ *= 2;
}
_loc8_ = this.debugColor;
if(_loc6_ > 1)
{
if(_loc5_ == 0)
{
_loc8_ = FlxG.GREEN;
}
else if(_loc5_ == _loc6_ - 1)
{
_loc8_ = FlxG.RED;
}
}
_loc2_.beginFill(_loc8_,0.5);
_loc2_.lineStyle();
_loc2_.drawRect(this._point.x - _loc7_ * 0.5,this._point.y - _loc7_ * 0.5,_loc7_,_loc7_);
_loc2_.endFill();
_loc9_ = 0.3;
if(_loc5_ < _loc6_ - 1)
{
_loc4_ = this.nodes[_loc5_ + 1];
}
else
{
_loc4_ = this.nodes[0];
_loc9_ = 0.15;
}
_loc2_.moveTo(this._point.x,this._point.y);
_loc2_.lineStyle(1,this.debugColor,_loc9_);
this._point.x = _loc4_.x - int(param1.scroll.x * this.debugScrollFactor.x);
this._point.y = _loc4_.y - int(param1.scroll.y * this.debugScrollFactor.y);
this._point.x = int(this._point.x + (this._point.x > 0 ? 1e-7 : -1e-7));
this._point.y = int(this._point.y + (this._point.y > 0 ? 1e-7 : -1e-7));
_loc2_.lineTo(this._point.x,this._point.y);
_loc5_++;
}
param1.buffer.draw(FlxG.flashGfxSprite);
}
}
}
@@ -0,0 +1,55 @@
package org.flixel
{
import flash.geom.Point;
public class FlxPoint
{
public var x:Number;
public var y:Number;
public function FlxPoint(param1:Number = 0, param2:Number = 0)
{
super();
this.x = param1;
this.y = param2;
}
public function make(param1:Number = 0, param2:Number = 0) : FlxPoint
{
this.x = param1;
this.y = param2;
return this;
}
public function copyFrom(param1:FlxPoint) : FlxPoint
{
this.x = param1.x;
this.y = param1.y;
return this;
}
public function copyTo(param1:FlxPoint) : FlxPoint
{
param1.x = this.x;
param1.y = this.y;
return param1;
}
public function copyFromFlash(param1:Point) : FlxPoint
{
this.x = param1.x;
this.y = param1.y;
return this;
}
public function copyToFlash(param1:Point) : Point
{
param1.x = this.x;
param1.y = this.y;
return param1;
}
}
}
@@ -0,0 +1,96 @@
package org.flixel
{
import flash.geom.Rectangle;
public class FlxRect
{
public var x:Number;
public var y:Number;
public var width:Number;
public var height:Number;
public function FlxRect(param1:Number = 0, param2:Number = 0, param3:Number = 0, param4:Number = 0)
{
super();
this.x = param1;
this.y = param2;
this.width = param3;
this.height = param4;
}
public function get left() : Number
{
return this.x;
}
public function get right() : Number
{
return this.x + this.width;
}
public function get top() : Number
{
return this.y;
}
public function get bottom() : Number
{
return this.y + this.height;
}
public function make(param1:Number = 0, param2:Number = 0, param3:Number = 0, param4:Number = 0) : FlxRect
{
this.x = param1;
this.y = param2;
this.width = param3;
this.height = param4;
return this;
}
public function copyFrom(param1:FlxRect) : FlxRect
{
this.x = param1.x;
this.y = param1.y;
this.width = param1.width;
this.height = param1.height;
return this;
}
public function copyTo(param1:FlxRect) : FlxRect
{
param1.x = this.x;
param1.y = this.y;
param1.width = this.width;
param1.height = this.height;
return param1;
}
public function copyFromFlash(param1:Rectangle) : FlxRect
{
this.x = param1.x;
this.y = param1.y;
this.width = param1.width;
this.height = param1.height;
return this;
}
public function copyToFlash(param1:Rectangle) : Rectangle
{
param1.x = this.x;
param1.y = this.y;
param1.width = this.width;
param1.height = this.height;
return param1;
}
public function overlaps(param1:FlxRect) : Boolean
{
return param1.x + param1.width > this.x && param1.x < this.x + this.width && param1.y + param1.height > this.y && param1.y < this.y + this.height;
}
}
}
@@ -0,0 +1,140 @@
package org.flixel
{
import flash.events.NetStatusEvent;
import flash.net.SharedObject;
import flash.net.SharedObjectFlushStatus;
public class FlxSave
{
protected static var SUCCESS:uint = 0;
protected static var PENDING:uint = 1;
protected static var ERROR:uint = 2;
public var data:Object;
public var name:String;
protected var _sharedObject:SharedObject;
protected var _onComplete:Function;
protected var _closeRequested:Boolean;
public function FlxSave()
{
super();
this.destroy();
}
public function destroy() : void
{
this._sharedObject = null;
this.name = null;
this.data = null;
this._onComplete = null;
this._closeRequested = false;
}
public function bind(param1:String) : Boolean
{
var Name:String = param1;
this.destroy();
this.name = Name;
try
{
this._sharedObject = SharedObject.getLocal(this.name);
}
catch(e:Error)
{
FlxG.log("ERROR: There was a problem binding to\nthe shared object data from FlxSave.");
destroy();
return false;
}
this.data = this._sharedObject.data;
return true;
}
public function close(param1:uint = 0, param2:Function = null) : Boolean
{
this._closeRequested = true;
return this.flush(param1,param2);
}
public function flush(param1:uint = 0, param2:Function = null) : Boolean
{
var result:String;
var MinFileSize:uint = param1;
var OnComplete:Function = param2;
if(!this.checkBinding())
{
return false;
}
this._onComplete = OnComplete;
result = null;
try
{
result = this._sharedObject.flush(MinFileSize);
}
catch(e:Error)
{
return onDone(ERROR);
}
if(result == SharedObjectFlushStatus.PENDING)
{
this._sharedObject.addEventListener(NetStatusEvent.NET_STATUS,this.onFlushStatus);
}
return this.onDone(result == SharedObjectFlushStatus.FLUSHED ? SUCCESS : PENDING);
}
public function erase() : Boolean
{
if(!this.checkBinding())
{
return false;
}
this._sharedObject.clear();
return true;
}
protected function onFlushStatus(param1:NetStatusEvent) : void
{
this._sharedObject.removeEventListener(NetStatusEvent.NET_STATUS,this.onFlushStatus);
this.onDone(param1.info.code == "SharedObject.Flush.Success" ? SUCCESS : ERROR);
}
protected function onDone(param1:uint) : Boolean
{
switch(param1)
{
case PENDING:
FlxG.log("FLIXEL: FlxSave is requesting extra storage space.");
break;
case ERROR:
FlxG.log("ERROR: There was a problem flushing\nthe shared object data from FlxSave.");
}
if(this._onComplete != null)
{
this._onComplete(param1 == SUCCESS);
}
if(this._closeRequested)
{
this.destroy();
}
return param1 == SUCCESS;
}
protected function checkBinding() : Boolean
{
if(this._sharedObject == null)
{
FlxG.log("FLIXEL: You must call FlxSave.bind()\nbefore you can read or write data.");
return false;
}
return true;
}
}
}
@@ -0,0 +1,395 @@
package org.flixel
{
import flash.events.Event;
import flash.media.Sound;
import flash.media.SoundChannel;
import flash.media.SoundTransform;
import flash.net.URLRequest;
public class FlxSound extends FlxBasic
{
public var x:Number;
public var y:Number;
public var survive:Boolean;
public var name:String;
public var artist:String;
public var amplitude:Number;
public var amplitudeLeft:Number;
public var amplitudeRight:Number;
protected var _sound:Sound;
protected var _channel:SoundChannel;
protected var _transform:SoundTransform;
protected var _position:Number;
protected var _volume:Number;
protected var _volumeAdjust:Number;
protected var _looped:Boolean;
protected var _target:FlxObject;
protected var _radius:Number;
protected var _pan:Boolean;
protected var _fadeOutTimer:Number;
protected var _fadeOutTotal:Number;
protected var _pauseOnFadeOut:Boolean;
protected var _fadeInTimer:Number;
protected var _fadeInTotal:Number;
public function FlxSound()
{
super();
this.createSound();
}
protected function createSound() : void
{
this.destroy();
this.x = 0;
this.y = 0;
if(this._transform == null)
{
this._transform = new SoundTransform();
}
this._transform.pan = 0;
this._sound = null;
this._position = 0;
this._volume = 1;
this._volumeAdjust = 1;
this._looped = false;
this._target = null;
this._radius = 0;
this._pan = false;
this._fadeOutTimer = 0;
this._fadeOutTotal = 0;
this._pauseOnFadeOut = false;
this._fadeInTimer = 0;
this._fadeInTotal = 0;
exists = false;
active = false;
visible = false;
this.name = null;
this.artist = null;
this.amplitude = 0;
this.amplitudeLeft = 0;
this.amplitudeRight = 0;
}
override public function destroy() : void
{
this.stop();
this._transform = null;
this._sound = null;
this._target = null;
this.name = null;
this.artist = null;
super.destroy();
}
override public function update() : void
{
var _loc3_:Number = NaN;
if(this._position != 0)
{
return;
}
var _loc1_:Number = 1;
var _loc2_:Number = 1;
if(this._target != null)
{
_loc1_ = FlxU.getDistance(new FlxPoint(this._target.x,this._target.y),new FlxPoint(this.x,this.y)) / this._radius;
if(_loc1_ < 0)
{
_loc1_ = 0;
}
if(_loc1_ > 1)
{
_loc1_ = 1;
}
if(this._pan)
{
_loc3_ = (this._target.x - this.x) / this._radius;
if(_loc3_ < -1)
{
_loc3_ = -1;
}
else if(_loc3_ > 1)
{
_loc3_ = 1;
}
this._transform.pan = _loc3_;
}
}
if(this._fadeOutTimer > 0)
{
this._fadeOutTimer -= FlxG.elapsed;
if(this._fadeOutTimer <= 0)
{
if(this._pauseOnFadeOut)
{
this.pause();
}
else
{
this.stop();
}
}
_loc2_ = this._fadeOutTimer / this._fadeOutTotal;
if(_loc2_ < 0)
{
_loc2_ = 0;
}
}
else if(this._fadeInTimer > 0)
{
this._fadeInTimer -= FlxG.elapsed;
_loc2_ = this._fadeInTimer / this._fadeInTotal;
if(_loc2_ < 0)
{
_loc2_ = 0;
}
_loc2_ = 1 - _loc2_;
}
this._volumeAdjust = _loc1_ * _loc2_;
this.updateTransform();
if(this._transform.volume > 0 && this._channel != null)
{
this.amplitudeLeft = this._channel.leftPeak / this._transform.volume;
this.amplitudeRight = this._channel.rightPeak / this._transform.volume;
this.amplitude = (this.amplitudeLeft + this.amplitudeRight) * 0.5;
}
}
public function loadEmbedded(param1:Class, param2:Boolean = false) : FlxSound
{
this.stop();
this.createSound();
this._sound = new param1();
this._looped = param2;
this.updateTransform();
exists = true;
return this;
}
public function loadStream(param1:String, param2:Boolean = false) : FlxSound
{
this.stop();
this.createSound();
this._sound = new Sound();
this._sound.addEventListener(Event.ID3,this.gotID3);
this._sound.load(new URLRequest(param1));
this._looped = param2;
this.updateTransform();
exists = true;
return this;
}
public function proximity(param1:Number, param2:Number, param3:FlxObject, param4:Number, param5:Boolean = true) : FlxSound
{
this.x = param1;
this.y = param2;
this._target = param3;
this._radius = param4;
this._pan = param5;
return this;
}
public function play(param1:Number = 0) : void
{
if(this._position < 0)
{
return;
}
if(this._looped)
{
if(this._position == 0)
{
if(this._channel == null)
{
this._channel = this._sound.play(param1,9999,this._transform);
}
if(this._channel == null)
{
exists = false;
}
}
else
{
this._channel = this._sound.play(this._position,0,this._transform);
if(this._channel == null)
{
exists = false;
}
else
{
this._channel.addEventListener(Event.SOUND_COMPLETE,this.looped);
}
}
}
else if(this._position == 0)
{
if(this._channel == null)
{
this._channel = this._sound.play(0,0,this._transform);
if(this._channel == null)
{
exists = false;
}
else
{
this._channel.addEventListener(Event.SOUND_COMPLETE,this.stopped);
}
}
}
else
{
this._channel = this._sound.play(this._position,0,this._transform);
if(this._channel == null)
{
exists = false;
}
}
active = this._channel != null;
this._position = 0;
}
public function pause() : void
{
if(this._channel == null)
{
this._position = -1;
return;
}
this._position = this._channel.position;
this._channel.stop();
if(this._looped)
{
while(this._position >= this._sound.length)
{
this._position -= this._sound.length;
}
}
this._channel = null;
active = false;
}
public function stop() : void
{
this._position = 0;
if(this._channel != null)
{
this._channel.stop();
this.stopped();
}
}
public function fadeOut(param1:Number, param2:Boolean = false) : void
{
this._pauseOnFadeOut = param2;
this._fadeInTimer = 0;
this._fadeOutTimer = param1;
this._fadeOutTotal = this._fadeOutTimer;
}
public function fadeIn(param1:Number) : void
{
this._fadeOutTimer = 0;
this._fadeInTimer = param1;
this._fadeInTotal = this._fadeInTimer;
this.play();
}
public function get volume() : Number
{
return this._volume;
}
public function set volume(param1:Number) : void
{
this._volume = param1;
if(this._volume < 0)
{
this._volume = 0;
}
else if(this._volume > 1)
{
this._volume = 1;
}
this.updateTransform();
}
public function getActualVolume() : Number
{
return this._volume * this._volumeAdjust;
}
internal function updateTransform() : void
{
this._transform.volume = (FlxG.mute ? 0 : 1) * FlxG.volume * this._volume * this._volumeAdjust;
if(this._channel != null)
{
this._channel.soundTransform = this._transform;
}
}
protected function looped(param1:Event = null) : void
{
if(this._channel == null)
{
return;
}
this._channel.removeEventListener(Event.SOUND_COMPLETE,this.looped);
this._channel = null;
this.play();
}
protected function stopped(param1:Event = null) : void
{
if(!this._looped)
{
this._channel.removeEventListener(Event.SOUND_COMPLETE,this.stopped);
}
else
{
this._channel.removeEventListener(Event.SOUND_COMPLETE,this.looped);
}
this._channel = null;
exists = false;
active = false;
}
protected function gotID3(param1:Event = null) : void
{
FlxG.log("got ID3 info!");
if(this._sound.id3.songName.length > 0)
{
this.name = this._sound.id3.songName;
}
if(this._sound.id3.artist.length > 0)
{
this.artist = this._sound.id3.artist;
}
this._sound.removeEventListener(Event.ID3,this.gotID3);
}
}
}
@@ -0,0 +1,733 @@
package org.flixel
{
import flash.display.BitmapData;
import flash.display.Graphics;
import flash.geom.ColorTransform;
import flash.geom.Matrix;
import flash.geom.Point;
import flash.geom.Rectangle;
import org.flixel.system.FlxAnim;
public class FlxSprite extends FlxObject
{
protected var ImgDefault:Class = FlxSprite_ImgDefault;
public var origin:FlxPoint;
public var offset:FlxPoint;
public var scale:FlxPoint;
public var blend:String;
public var antialiasing:Boolean;
public var finished:Boolean;
public var frameWidth:uint;
public var frameHeight:uint;
public var frames:uint;
public var framePixels:BitmapData;
public var dirty:Boolean;
protected var _animations:Array;
protected var _flipped:uint;
protected var _curAnim:FlxAnim;
protected var _curFrame:uint;
protected var _curIndex:uint;
protected var _frameTimer:Number;
protected var _callback:Function;
protected var _facing:uint;
protected var _alpha:Number;
protected var _color:uint;
protected var _bakedRotation:Number;
protected var _pixels:BitmapData;
protected var _flashPoint:Point;
protected var _flashRect:Rectangle;
protected var _flashRect2:Rectangle;
protected var _flashPointZero:Point;
protected var _colorTransform:ColorTransform;
protected var _matrix:Matrix;
public function FlxSprite(param1:Number = 0, param2:Number = 0, param3:Class = null)
{
super(param1,param2);
health = 1;
this._flashPoint = new Point();
this._flashRect = new Rectangle();
this._flashRect2 = new Rectangle();
this._flashPointZero = new Point();
this.offset = new FlxPoint();
this.origin = new FlxPoint();
this.scale = new FlxPoint(1,1);
this._alpha = 1;
this._color = 16777215;
this.blend = null;
this.antialiasing = false;
cameras = null;
this.finished = false;
this._facing = RIGHT;
this._animations = new Array();
this._flipped = 0;
this._curAnim = null;
this._curFrame = 0;
this._curIndex = 0;
this._frameTimer = 0;
this._matrix = new Matrix();
this._callback = null;
if(param3 == null)
{
param3 = this.ImgDefault;
}
this.loadGraphic(param3);
}
override public function destroy() : void
{
var _loc1_:FlxAnim = null;
var _loc2_:uint = 0;
var _loc3_:uint = 0;
if(this._animations != null)
{
_loc2_ = 0;
_loc3_ = this._animations.length;
while(_loc2_ < _loc3_)
{
_loc1_ = this._animations[_loc2_++];
if(_loc1_ != null)
{
_loc1_.destroy();
}
}
this._animations = null;
}
this._flashPoint = null;
this._flashRect = null;
this._flashRect2 = null;
this._flashPointZero = null;
this.offset = null;
this.origin = null;
this.scale = null;
this._curAnim = null;
this._matrix = null;
this._callback = null;
this.framePixels = null;
}
public function loadGraphic(param1:Class, param2:Boolean = false, param3:Boolean = false, param4:uint = 0, param5:uint = 0, param6:Boolean = false) : FlxSprite
{
this._bakedRotation = 0;
this._pixels = FlxG.addBitmap(param1,param3,param6);
if(param3)
{
this._flipped = this._pixels.width >> 1;
}
else
{
this._flipped = 0;
}
if(param4 == 0)
{
if(param2)
{
param4 = uint(this._pixels.height);
}
else if(this._flipped > 0)
{
param4 = this._pixels.width * 0.5;
}
else
{
param4 = uint(this._pixels.width);
}
}
width = this.frameWidth = param4;
if(param5 == 0)
{
if(param2)
{
param5 = width;
}
else
{
param5 = uint(this._pixels.height);
}
}
height = this.frameHeight = param5;
this.resetHelpers();
return this;
}
public function loadRotatedGraphic(param1:Class, param2:uint = 16, param3:int = -1, param4:Boolean = false, param5:Boolean = false) : FlxSprite
{
var _loc12_:BitmapData = null;
var _loc13_:uint = 0;
var _loc14_:uint = 0;
var _loc15_:uint = 0;
var _loc16_:uint = 0;
var _loc17_:uint = 0;
var _loc18_:Number = NaN;
var _loc19_:uint = 0;
var _loc20_:uint = 0;
var _loc21_:uint = 0;
var _loc22_:uint = 0;
var _loc6_:uint = Math.sqrt(param2);
var _loc7_:BitmapData = FlxG.addBitmap(param1);
if(param3 >= 0)
{
_loc12_ = _loc7_;
_loc7_ = new BitmapData(_loc12_.height,_loc12_.height);
_loc13_ = param3 * _loc7_.width;
_loc14_ = 0;
_loc15_ = uint(_loc12_.width);
if(_loc13_ >= _loc15_)
{
_loc14_ = uint(_loc13_ / _loc15_) * _loc7_.height;
_loc13_ %= _loc15_;
}
this._flashRect.x = _loc13_;
this._flashRect.y = _loc14_;
this._flashRect.width = _loc7_.width;
this._flashRect.height = _loc7_.height;
_loc7_.copyPixels(_loc12_,this._flashRect,this._flashPointZero);
}
var _loc8_:uint = uint(_loc7_.width);
if(_loc7_.height > _loc8_)
{
_loc8_ = uint(_loc7_.height);
}
if(param5)
{
_loc8_ *= 1.5;
}
var _loc9_:uint = FlxU.ceil(param2 / _loc6_);
width = _loc8_ * _loc9_;
height = _loc8_ * _loc6_;
var _loc10_:String = String(param1) + ":" + param3 + ":" + width + "x" + height;
var _loc11_:Boolean = FlxG.checkBitmapCache(_loc10_);
this._pixels = FlxG.createBitmap(width,height,0,true,_loc10_);
width = this.frameWidth = this._pixels.width;
height = this.frameHeight = this._pixels.height;
this._bakedRotation = 360 / param2;
if(!_loc11_)
{
_loc16_ = 0;
_loc18_ = 0;
_loc19_ = _loc7_.width * 0.5;
_loc20_ = _loc7_.height * 0.5;
_loc21_ = _loc8_ * 0.5;
_loc22_ = _loc8_ * 0.5;
while(_loc16_ < _loc6_)
{
_loc17_ = 0;
while(_loc17_ < _loc9_)
{
this._matrix.identity();
this._matrix.translate(-_loc19_,-_loc20_);
this._matrix.rotate(_loc18_ * 0.017453293);
this._matrix.translate(_loc8_ * _loc17_ + _loc21_,_loc22_);
_loc18_ += this._bakedRotation;
this._pixels.draw(_loc7_,this._matrix,null,null,null,param4);
_loc17_++;
}
_loc22_ += _loc8_;
_loc16_++;
}
}
this.frameWidth = this.frameHeight = width = height = _loc8_;
this.resetHelpers();
if(param5)
{
width = _loc7_.width;
height = _loc7_.height;
this.centerOffsets();
}
return this;
}
public function makeGraphic(param1:uint, param2:uint, param3:uint = 4294967295, param4:Boolean = false, param5:String = null) : FlxSprite
{
this._bakedRotation = 0;
this._pixels = FlxG.createBitmap(param1,param2,param3,param4,param5);
width = this.frameWidth = this._pixels.width;
height = this.frameHeight = this._pixels.height;
this.resetHelpers();
return this;
}
protected function resetHelpers() : void
{
this._flashRect.x = 0;
this._flashRect.y = 0;
this._flashRect.width = this.frameWidth;
this._flashRect.height = this.frameHeight;
this._flashRect2.x = 0;
this._flashRect2.y = 0;
this._flashRect2.width = this._pixels.width;
this._flashRect2.height = this._pixels.height;
if(this.framePixels == null || this.framePixels.width != width || this.framePixels.height != height)
{
this.framePixels = new BitmapData(width,height);
}
this.origin.make(this.frameWidth * 0.5,this.frameHeight * 0.5);
this.framePixels.copyPixels(this._pixels,this._flashRect,this._flashPointZero);
this.frames = this._flashRect2.width / this._flashRect.width * (this._flashRect2.height / this._flashRect.height);
if(this._colorTransform != null)
{
this.framePixels.colorTransform(this._flashRect,this._colorTransform);
}
this._curIndex = 0;
}
override public function postUpdate() : void
{
super.postUpdate();
this.updateAnimation();
}
override public function draw() : void
{
var _loc1_:FlxCamera = null;
if(_flickerTimer != 0)
{
_flicker = !_flicker;
if(_flicker)
{
return;
}
}
if(this.dirty)
{
this.calcFrame();
}
if(cameras == null)
{
cameras = FlxG.cameras;
}
var _loc2_:uint = 0;
var _loc3_:uint = cameras.length;
while(_loc2_ < _loc3_)
{
_loc1_ = cameras[_loc2_++];
if(this.onScreen(_loc1_))
{
_point.x = x - int(_loc1_.scroll.x * scrollFactor.x) - this.offset.x;
_point.y = y - int(_loc1_.scroll.y * scrollFactor.y) - this.offset.y;
_point.x += _point.x > 0 ? 1e-7 : -1e-7;
_point.y += _point.y > 0 ? 1e-7 : -1e-7;
if((angle == 0 || this._bakedRotation > 0) && this.scale.x == 1 && this.scale.y == 1 && this.blend == null)
{
this._flashPoint.x = _point.x;
this._flashPoint.y = _point.y;
_loc1_.buffer.copyPixels(this.framePixels,this._flashRect,this._flashPoint,null,null,true);
}
else
{
this._matrix.identity();
this._matrix.translate(-this.origin.x,-this.origin.y);
this._matrix.scale(this.scale.x,this.scale.y);
if(angle != 0 && this._bakedRotation <= 0)
{
this._matrix.rotate(angle * 0.017453293);
}
this._matrix.translate(_point.x + this.origin.x,_point.y + this.origin.y);
_loc1_.buffer.draw(this.framePixels,this._matrix,null,this.blend,null,this.antialiasing);
}
++_VISIBLECOUNT;
if(FlxG.visualDebug && !ignoreDrawDebug)
{
drawDebug(_loc1_);
}
}
}
}
public function stamp(param1:FlxSprite, param2:int = 0, param3:int = 0) : void
{
param1.drawFrame();
var _loc4_:BitmapData = param1.framePixels;
if((param1.angle == 0 || param1._bakedRotation > 0) && param1.scale.x == 1 && param1.scale.y == 1 && param1.blend == null)
{
this._flashPoint.x = param2;
this._flashPoint.y = param3;
this._flashRect2.width = _loc4_.width;
this._flashRect2.height = _loc4_.height;
this._pixels.copyPixels(_loc4_,this._flashRect2,this._flashPoint,null,null,true);
this._flashRect2.width = this._pixels.width;
this._flashRect2.height = this._pixels.height;
this.calcFrame();
return;
}
this._matrix.identity();
this._matrix.translate(-param1.origin.x,-param1.origin.y);
this._matrix.scale(param1.scale.x,param1.scale.y);
if(param1.angle != 0)
{
this._matrix.rotate(param1.angle * 0.017453293);
}
this._matrix.translate(param2 + param1.origin.x,param3 + param1.origin.y);
this._pixels.draw(_loc4_,this._matrix,null,param1.blend,null,param1.antialiasing);
this.calcFrame();
}
public function drawLine(param1:Number, param2:Number, param3:Number, param4:Number, param5:uint, param6:uint = 1) : void
{
var _loc7_:Graphics = FlxG.flashGfx;
_loc7_.clear();
_loc7_.moveTo(param1,param2);
var _loc8_:Number = Number(param5 >> 24 & 0xFF) / 255;
if(_loc8_ <= 0)
{
_loc8_ = 1;
}
_loc7_.lineStyle(param6,param5,_loc8_);
_loc7_.lineTo(param3,param4);
this._pixels.draw(FlxG.flashGfxSprite);
this.dirty = true;
}
public function fill(param1:uint) : void
{
this._pixels.fillRect(this._flashRect2,param1);
if(this._pixels != this.framePixels)
{
this.dirty = true;
}
}
protected function updateAnimation() : void
{
var _loc1_:uint = 0;
var _loc2_:int = 0;
if(this._bakedRotation > 0)
{
_loc1_ = this._curIndex;
_loc2_ = angle % 360;
if(_loc2_ < 0)
{
_loc2_ += 360;
}
this._curIndex = _loc2_ / this._bakedRotation + 0.5;
if(_loc1_ != this._curIndex)
{
this.dirty = true;
}
}
else if(this._curAnim != null && this._curAnim.delay > 0 && (this._curAnim.looped || !this.finished))
{
this._frameTimer += FlxG.elapsed;
while(this._frameTimer > this._curAnim.delay)
{
this._frameTimer -= this._curAnim.delay;
if(this._curFrame == this._curAnim.frames.length - 1)
{
if(this._curAnim.looped)
{
this._curFrame = 0;
}
this.finished = true;
}
else
{
++this._curFrame;
}
this._curIndex = this._curAnim.frames[this._curFrame];
this.dirty = true;
}
}
if(this.dirty)
{
this.calcFrame();
}
}
public function drawFrame(param1:Boolean = false) : void
{
if(param1 || this.dirty)
{
this.calcFrame();
}
}
public function addAnimation(param1:String, param2:Array, param3:Number = 0, param4:Boolean = true) : void
{
this._animations.push(new FlxAnim(param1,param2,param3,param4));
}
public function addAnimationCallback(param1:Function) : void
{
this._callback = param1;
}
public function play(param1:String, param2:Boolean = false) : void
{
if(!param2 && this._curAnim != null && param1 == this._curAnim.name && (this._curAnim.looped || !this.finished))
{
return;
}
this._curFrame = 0;
this._curIndex = 0;
this._frameTimer = 0;
var _loc3_:uint = 0;
var _loc4_:uint = this._animations.length;
while(_loc3_ < _loc4_)
{
if(this._animations[_loc3_].name == param1)
{
this._curAnim = this._animations[_loc3_];
if(this._curAnim.delay <= 0)
{
this.finished = true;
}
else
{
this.finished = false;
}
this._curIndex = this._curAnim.frames[this._curFrame];
this.dirty = true;
return;
}
_loc3_++;
}
FlxG.log("WARNING: No animation called \"" + param1 + "\"");
}
public function randomFrame() : void
{
this._curAnim = null;
this._curIndex = int(FlxG.random() * (this._pixels.width / this.frameWidth));
this.dirty = true;
}
public function setOriginToCorner() : void
{
this.origin.x = this.origin.y = 0;
}
public function centerOffsets(param1:Boolean = false) : void
{
this.offset.x = (this.frameWidth - width) * 0.5;
this.offset.y = (this.frameHeight - height) * 0.5;
if(param1)
{
x += this.offset.x;
y += this.offset.y;
}
}
public function replaceColor(param1:uint, param2:uint, param3:Boolean = false) : Array
{
var _loc6_:uint = 0;
var _loc4_:Array = null;
if(param3)
{
_loc4_ = new Array();
}
var _loc5_:uint = 0;
var _loc7_:uint = uint(this._pixels.height);
var _loc8_:uint = uint(this._pixels.width);
while(_loc5_ < _loc7_)
{
_loc6_ = 0;
while(_loc6_ < _loc8_)
{
if(this._pixels.getPixel32(_loc6_,_loc5_) == param1)
{
this._pixels.setPixel32(_loc6_,_loc5_,param2);
if(param3)
{
_loc4_.push(new FlxPoint(_loc6_,_loc5_));
}
this.dirty = true;
}
_loc6_++;
}
_loc5_++;
}
return _loc4_;
}
public function get pixels() : BitmapData
{
return this._pixels;
}
public function set pixels(param1:BitmapData) : void
{
this._pixels = param1;
width = this.frameWidth = this._pixels.width;
height = this.frameHeight = this._pixels.height;
this.resetHelpers();
}
public function get facing() : uint
{
return this._facing;
}
public function set facing(param1:uint) : void
{
if(this._facing != param1)
{
this.dirty = true;
}
this._facing = param1;
}
public function get alpha() : Number
{
return this._alpha;
}
public function set alpha(param1:Number) : void
{
if(param1 > 1)
{
param1 = 1;
}
if(param1 < 0)
{
param1 = 0;
}
if(param1 == this._alpha)
{
return;
}
this._alpha = param1;
if(this._alpha != 1 || this._color != 16777215)
{
this._colorTransform = new ColorTransform((this._color >> 16) * 0.00392,(this._color >> 8 & 0xFF) * 0.00392,(this._color & 0xFF) * 0.00392,this._alpha);
}
else
{
this._colorTransform = null;
}
this.dirty = true;
}
public function get color() : uint
{
return this._color;
}
public function set color(param1:uint) : void
{
param1 &= 16777215;
if(this._color == param1)
{
return;
}
this._color = param1;
if(this._alpha != 1 || this._color != 16777215)
{
this._colorTransform = new ColorTransform((this._color >> 16) * 0.00392,(this._color >> 8 & 0xFF) * 0.00392,(this._color & 0xFF) * 0.00392,this._alpha);
}
else
{
this._colorTransform = null;
}
this.dirty = true;
}
public function get frame() : uint
{
return this._curIndex;
}
public function set frame(param1:uint) : void
{
this._curAnim = null;
this._curIndex = param1;
this.dirty = true;
}
override public function onScreen(param1:FlxCamera = null) : Boolean
{
if(param1 == null)
{
param1 = FlxG.camera;
}
getScreenXY(_point,param1);
_point.x -= this.offset.x;
_point.y -= this.offset.y;
if((angle == 0 || this._bakedRotation > 0) && this.scale.x == 1 && this.scale.y == 1)
{
return _point.x + this.frameWidth > 0 && _point.x < param1.width && _point.y + this.frameHeight > 0 && _point.y < param1.height;
}
var _loc2_:Number = this.frameWidth / 2;
var _loc3_:Number = this.frameHeight / 2;
var _loc4_:Number = this.scale.x > 0 ? this.scale.x : -this.scale.x;
var _loc5_:Number = this.scale.y > 0 ? this.scale.y : -this.scale.y;
var _loc6_:Number = Math.sqrt(_loc2_ * _loc2_ + _loc3_ * _loc3_) * (_loc4_ >= _loc5_ ? _loc4_ : _loc5_);
_point.x += _loc2_;
_point.y += _loc3_;
return _point.x + _loc6_ > 0 && _point.x - _loc6_ < param1.width && _point.y + _loc6_ > 0 && _point.y - _loc6_ < param1.height;
}
public function pixelsOverlapPoint(param1:FlxPoint, param2:uint = 255, param3:FlxCamera = null) : Boolean
{
if(param3 == null)
{
param3 = FlxG.camera;
}
getScreenXY(_point,param3);
_point.x -= this.offset.x;
_point.y -= this.offset.y;
this._flashPoint.x = param1.x - param3.scroll.x - _point.x;
this._flashPoint.y = param1.y - param3.scroll.y - _point.y;
return this.framePixels.hitTest(this._flashPointZero,param2,this._flashPoint);
}
protected function calcFrame() : void
{
var _loc1_:uint = this._curIndex * this.frameWidth;
var _loc2_:uint = 0;
var _loc3_:uint = this._flipped ? this._flipped : uint(this._pixels.width);
if(_loc1_ >= _loc3_)
{
_loc2_ = uint(_loc1_ / _loc3_) * this.frameHeight;
_loc1_ %= _loc3_;
}
if(Boolean(this._flipped) && this._facing == LEFT)
{
_loc1_ = (this._flipped << 1) - _loc1_ - this.frameWidth;
}
this._flashRect.x = _loc1_;
this._flashRect.y = _loc2_;
this.framePixels.copyPixels(this._pixels,this._flashRect,this._flashPointZero);
this._flashRect.x = this._flashRect.y = 0;
if(this._colorTransform != null)
{
this.framePixels.colorTransform(this._flashRect,this._colorTransform);
}
if(this._callback != null)
{
this._callback(this._curAnim != null ? this._curAnim.name : null,this._curFrame,this._curIndex);
}
this.dirty = false;
}
}
}
@@ -0,0 +1,15 @@
package org.flixel
{
import mx.core.BitmapAsset;
[Embed(source="/_assets/70_org.flixel.FlxSprite_ImgDefault.png")]
public class FlxSprite_ImgDefault extends BitmapAsset
{
public function FlxSprite_ImgDefault()
{
super();
}
}
}
@@ -0,0 +1,21 @@
package org.flixel
{
public class FlxState extends FlxGroup
{
public function FlxState()
{
super();
}
public function create() : void
{
}
override public function update() : void
{
super.update();
}
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,15 @@
package org.flixel
{
import mx.core.BitmapAsset;
[Embed(source="/_assets/245_org.flixel.FlxTilemap_ImgAuto.png")]
public class FlxTilemap_ImgAuto extends BitmapAsset
{
public function FlxTilemap_ImgAuto()
{
super();
}
}
}
@@ -0,0 +1,15 @@
package org.flixel
{
import mx.core.BitmapAsset;
[Embed(source="/_assets/153_org.flixel.FlxTilemap_ImgAutoAlt.png")]
public class FlxTilemap_ImgAutoAlt extends BitmapAsset
{
public function FlxTilemap_ImgAutoAlt()
{
super();
}
}
}
@@ -0,0 +1,106 @@
package org.flixel
{
import org.flixel.plugin.TimerManager;
public class FlxTimer
{
public var time:Number;
public var loops:uint;
public var paused:Boolean;
public var finished:Boolean;
protected var _callback:Function;
protected var _timeCounter:Number;
protected var _loopsCounter:uint;
public function FlxTimer()
{
super();
this.time = 0;
this.loops = 0;
this._callback = null;
this._timeCounter = 0;
this._loopsCounter = 0;
this.paused = false;
this.finished = false;
}
public static function get manager() : TimerManager
{
return FlxG.getPlugin(TimerManager) as TimerManager;
}
public function destroy() : void
{
this.stop();
this._callback = null;
}
public function update() : void
{
this._timeCounter += FlxG.elapsed;
while(this._timeCounter >= this.time && !this.paused && !this.finished)
{
this._timeCounter -= this.time;
++this._loopsCounter;
if(this.loops > 0 && this._loopsCounter >= this.loops)
{
this.stop();
}
if(this._callback != null)
{
this._callback(this);
}
}
}
public function start(param1:Number = 1, param2:uint = 1, param3:Function = null) : FlxTimer
{
var _loc4_:TimerManager = manager;
if(_loc4_ != null)
{
_loc4_.add(this);
}
if(this.paused)
{
this.paused = false;
return this;
}
this.paused = false;
this.finished = false;
this.time = param1;
this.loops = param2;
this._callback = param3;
this._timeCounter = 0;
this._loopsCounter = 0;
return this;
}
public function stop() : void
{
this.finished = true;
var _loc1_:TimerManager = manager;
if(_loc1_ != null)
{
_loc1_.remove(this);
}
}
public function get timeLeft() : Number
{
return this.time - this._timeCounter;
}
public function get loopsLeft() : int
{
return this.loops - this._loopsCounter;
}
}
}
@@ -0,0 +1,500 @@
package org.flixel
{
import flash.net.URLRequest;
import flash.net.navigateToURL;
import flash.utils.getDefinitionByName;
import flash.utils.getQualifiedClassName;
import flash.utils.getTimer;
public class FlxU
{
public function FlxU()
{
super();
}
public static function openURL(param1:String) : void
{
navigateToURL(new URLRequest(param1),"_blank");
}
public static function abs(param1:Number) : Number
{
return param1 > 0 ? param1 : -param1;
}
public static function floor(param1:Number) : Number
{
var _loc2_:Number = int(param1);
return param1 > 0 ? _loc2_ : (_loc2_ != param1 ? _loc2_ - 1 : _loc2_);
}
public static function ceil(param1:Number) : Number
{
var _loc2_:Number = int(param1);
return param1 > 0 ? (_loc2_ != param1 ? _loc2_ + 1 : _loc2_) : _loc2_;
}
public static function round(param1:Number) : Number
{
var _loc2_:Number = int(param1 + (param1 > 0 ? 0.5 : -0.5));
return param1 > 0 ? _loc2_ : (_loc2_ != param1 ? _loc2_ - 1 : _loc2_);
}
public static function min(param1:Number, param2:Number) : Number
{
return param1 <= param2 ? param1 : param2;
}
public static function max(param1:Number, param2:Number) : Number
{
return param1 >= param2 ? param1 : param2;
}
public static function bound(param1:Number, param2:Number, param3:Number) : Number
{
var _loc4_:Number = param1 < param2 ? param2 : param1;
return _loc4_ > param3 ? param3 : _loc4_;
}
public static function srand(param1:Number) : Number
{
return 69621 * int(param1 * 2147483647) % 2147483647 / 2147483647;
}
public static function shuffle(param1:Array, param2:uint) : Array
{
var _loc4_:uint = 0;
var _loc5_:uint = 0;
var _loc6_:Object = null;
var _loc3_:uint = 0;
while(_loc3_ < param2)
{
_loc4_ = Math.random() * param1.length;
_loc5_ = Math.random() * param1.length;
_loc6_ = param1[_loc5_];
param1[_loc5_] = param1[_loc4_];
param1[_loc4_] = _loc6_;
_loc3_++;
}
return param1;
}
public static function getRandom(param1:Array) : Object
{
var _loc2_:uint = 0;
if(param1 != null)
{
_loc2_ = param1.length;
if(_loc2_ > 0)
{
return param1[uint(Math.random() * _loc2_)];
}
}
return null;
}
public static function getTicks() : uint
{
return getTimer();
}
public static function formatTicks(param1:uint, param2:uint) : String
{
return (param2 - param1) / 1000 + "s";
}
public static function makeColor(param1:uint, param2:uint, param3:uint, param4:Number = 1) : uint
{
return ((param4 > 1 ? param4 : param4 * 255) & 0xFF) << 24 | (param1 & 0xFF) << 16 | (param2 & 0xFF) << 8 | param3 & 0xFF;
}
public static function makeColorFromHSB(param1:Number, param2:Number, param3:Number, param4:Number = 1) : uint
{
var _loc5_:Number = NaN;
var _loc6_:Number = NaN;
var _loc7_:Number = NaN;
var _loc8_:int = 0;
var _loc9_:Number = NaN;
var _loc10_:Number = NaN;
var _loc11_:Number = NaN;
var _loc12_:Number = NaN;
if(param2 == 0)
{
_loc5_ = param3;
_loc6_ = param3;
_loc7_ = param3;
}
else
{
if(param1 == 360)
{
param1 = 0;
}
_loc8_ = param1 / 60;
_loc9_ = param1 / 60 - _loc8_;
_loc10_ = param3 * (1 - param2);
_loc11_ = param3 * (1 - param2 * _loc9_);
_loc12_ = param3 * (1 - param2 * (1 - _loc9_));
switch(_loc8_)
{
case 0:
_loc5_ = param3;
_loc6_ = _loc12_;
_loc7_ = _loc10_;
break;
case 1:
_loc5_ = _loc11_;
_loc6_ = param3;
_loc7_ = _loc10_;
break;
case 2:
_loc5_ = _loc10_;
_loc6_ = param3;
_loc7_ = _loc12_;
break;
case 3:
_loc5_ = _loc10_;
_loc6_ = _loc11_;
_loc7_ = param3;
break;
case 4:
_loc5_ = _loc12_;
_loc6_ = _loc10_;
_loc7_ = param3;
break;
case 5:
_loc5_ = param3;
_loc6_ = _loc10_;
_loc7_ = _loc11_;
break;
default:
_loc5_ = 0;
_loc6_ = 0;
_loc7_ = 0;
}
}
return ((param4 > 1 ? param4 : param4 * 255) & 0xFF) << 24 | uint(_loc5_ * 255) << 16 | uint(_loc6_ * 255) << 8 | uint(_loc7_ * 255);
}
public static function getRGBA(param1:uint, param2:Array = null) : Array
{
if(param2 == null)
{
param2 = new Array();
}
param2[0] = param1 >> 16 & 0xFF;
param2[1] = param1 >> 8 & 0xFF;
param2[2] = param1 & 0xFF;
param2[3] = Number(param1 >> 24 & 0xFF) / 255;
return param2;
}
public static function getHSB(param1:uint, param2:Array = null) : Array
{
if(param2 == null)
{
param2 = new Array();
}
var _loc3_:Number = Number(param1 >> 16 & 0xFF) / 255;
var _loc4_:Number = Number(param1 >> 8 & 0xFF) / 255;
var _loc5_:Number = Number(param1 & 0xFF) / 255;
var _loc6_:Number = _loc3_ > _loc4_ ? _loc3_ : _loc4_;
var _loc7_:Number = _loc6_ > _loc5_ ? _loc6_ : _loc5_;
_loc6_ = _loc3_ > _loc4_ ? _loc4_ : _loc3_;
var _loc8_:Number = _loc6_ > _loc5_ ? _loc5_ : _loc6_;
var _loc9_:Number = _loc7_ - _loc8_;
param2[2] = _loc7_;
param2[1] = 0;
param2[0] = 0;
if(_loc7_ != 0)
{
param2[1] = _loc9_ / _loc7_;
}
if(param2[1] != 0)
{
if(_loc3_ == _loc7_)
{
param2[0] = (_loc4_ - _loc5_) / _loc9_;
}
else if(_loc4_ == _loc7_)
{
param2[0] = 2 + (_loc5_ - _loc3_) / _loc9_;
}
else if(_loc5_ == _loc7_)
{
param2[0] = 4 + (_loc3_ - _loc4_) / _loc9_;
}
param2[0] *= 60;
if(param2[0] < 0)
{
param2[0] += 360;
}
}
param2[3] = Number(param1 >> 24 & 0xFF) / 255;
return param2;
}
public static function formatTime(param1:Number, param2:Boolean = false) : String
{
var _loc3_:String = int(param1 / 60) + ":";
var _loc4_:int = int(param1) % 60;
if(_loc4_ < 10)
{
_loc3_ += "0";
}
_loc3_ += _loc4_;
if(param2)
{
_loc3_ += ".";
_loc4_ = (param1 - int(param1)) * 100;
if(_loc4_ < 10)
{
_loc3_ += "0";
}
_loc3_ += _loc4_;
}
return _loc3_;
}
public static function formatArray(param1:Array) : String
{
if(param1 == null || param1.length <= 0)
{
return "";
}
var _loc2_:String = param1[0].toString();
var _loc3_:uint = 0;
var _loc4_:uint = param1.length;
while(_loc3_ < _loc4_)
{
_loc2_ += ", " + param1[_loc3_++].toString();
}
return _loc2_;
}
public static function formatMoney(param1:Number, param2:Boolean = true, param3:Boolean = true) : String
{
var _loc4_:int = 0;
var _loc5_:int = param1;
var _loc6_:String = "";
var _loc7_:String = "";
var _loc8_:String = "";
while(_loc5_ > 0)
{
if(_loc6_.length > 0 && _loc7_.length <= 0)
{
if(param3)
{
_loc7_ = ",";
}
else
{
_loc7_ = ".";
}
}
_loc8_ = "";
_loc4_ = _loc5_ - int(_loc5_ / 1000) * 1000;
_loc5_ /= 1000;
if(_loc5_ > 0)
{
if(_loc4_ < 100)
{
_loc8_ += "0";
}
if(_loc4_ < 10)
{
_loc8_ += "0";
}
}
_loc6_ = _loc8_ + _loc4_ + _loc7_ + _loc6_;
}
if(param2)
{
_loc5_ = int(param1 * 100) - int(param1) * 100;
_loc6_ += (param3 ? "." : ",") + _loc5_;
if(_loc5_ < 10)
{
_loc6_ += "0";
}
}
return _loc6_;
}
public static function getClassName(param1:Object, param2:Boolean = false) : String
{
var _loc3_:String = getQualifiedClassName(param1);
_loc3_ = _loc3_.replace("::",".");
if(param2)
{
_loc3_ = _loc3_.substr(_loc3_.lastIndexOf(".") + 1);
}
return _loc3_;
}
public static function compareClassNames(param1:Object, param2:Object) : Boolean
{
return getQualifiedClassName(param1) == getQualifiedClassName(param2);
}
public static function getClass(param1:String) : Class
{
return getDefinitionByName(param1) as Class;
}
public static function computeVelocity(param1:Number, param2:Number = 0, param3:Number = 0, param4:Number = 10000) : Number
{
var _loc5_:Number = NaN;
if(param2 != 0)
{
param1 += param2 * FlxG.elapsed;
}
else if(param3 != 0)
{
_loc5_ = param3 * FlxG.elapsed;
if(param1 - _loc5_ > 0)
{
param1 -= _loc5_;
}
else if(param1 + _loc5_ < 0)
{
param1 += _loc5_;
}
else
{
param1 = 0;
}
}
if(param1 != 0 && param4 != 10000)
{
if(param1 > param4)
{
param1 = param4;
}
else if(param1 < -param4)
{
param1 = -param4;
}
}
return param1;
}
public static function rotatePoint(param1:Number, param2:Number, param3:Number, param4:Number, param5:Number, param6:FlxPoint = null) : FlxPoint
{
var _loc7_:Number = 0;
var _loc8_:Number = 0;
var _loc9_:Number = param5 * -0.017453293;
while(_loc9_ < -3.14159265)
{
_loc9_ += 6.28318531;
}
while(_loc9_ > 3.14159265)
{
_loc9_ -= 6.28318531;
}
if(_loc9_ < 0)
{
_loc7_ = 1.27323954 * _loc9_ + 0.405284735 * _loc9_ * _loc9_;
if(_loc7_ < 0)
{
_loc7_ = 0.225 * (_loc7_ * -_loc7_ - _loc7_) + _loc7_;
}
else
{
_loc7_ = 0.225 * (_loc7_ * _loc7_ - _loc7_) + _loc7_;
}
}
else
{
_loc7_ = 1.27323954 * _loc9_ - 0.405284735 * _loc9_ * _loc9_;
if(_loc7_ < 0)
{
_loc7_ = 0.225 * (_loc7_ * -_loc7_ - _loc7_) + _loc7_;
}
else
{
_loc7_ = 0.225 * (_loc7_ * _loc7_ - _loc7_) + _loc7_;
}
}
_loc9_ += 1.57079632;
if(_loc9_ > 3.14159265)
{
_loc9_ -= 6.28318531;
}
if(_loc9_ < 0)
{
_loc8_ = 1.27323954 * _loc9_ + 0.405284735 * _loc9_ * _loc9_;
if(_loc8_ < 0)
{
_loc8_ = 0.225 * (_loc8_ * -_loc8_ - _loc8_) + _loc8_;
}
else
{
_loc8_ = 0.225 * (_loc8_ * _loc8_ - _loc8_) + _loc8_;
}
}
else
{
_loc8_ = 1.27323954 * _loc9_ - 0.405284735 * _loc9_ * _loc9_;
if(_loc8_ < 0)
{
_loc8_ = 0.225 * (_loc8_ * -_loc8_ - _loc8_) + _loc8_;
}
else
{
_loc8_ = 0.225 * (_loc8_ * _loc8_ - _loc8_) + _loc8_;
}
}
var _loc10_:Number = param1 - param3;
var _loc11_:Number = param4 + param2;
if(param6 == null)
{
param6 = new FlxPoint();
}
param6.x = param3 + _loc8_ * _loc10_ - _loc7_ * _loc11_;
param6.y = param4 - _loc7_ * _loc10_ - _loc8_ * _loc11_;
return param6;
}
public static function getAngle(param1:FlxPoint, param2:FlxPoint) : Number
{
var _loc3_:Number = param2.x - param1.x;
var _loc4_:Number = param2.y - param1.y;
if(_loc3_ == 0 && _loc4_ == 0)
{
return 0;
}
var _loc5_:Number = 3.14159265358979 * 0.25;
var _loc6_:Number = 3 * _loc5_;
var _loc7_:Number = _loc4_ < 0 ? -_loc4_ : _loc4_;
var _loc8_:Number = 0;
if(_loc3_ >= 0)
{
_loc8_ = _loc5_ - _loc5_ * ((_loc3_ - _loc7_) / (_loc3_ + _loc7_));
}
else
{
_loc8_ = _loc6_ - _loc5_ * ((_loc3_ + _loc7_) / (_loc7_ - _loc3_));
}
_loc8_ = (_loc4_ < 0 ? -_loc8_ : _loc8_) * 57.2957795130823;
if(_loc8_ > 90)
{
_loc8_ -= 270;
}
else
{
_loc8_ += 90;
}
return _loc8_;
}
public static function getDistance(param1:FlxPoint, param2:FlxPoint) : Number
{
var _loc3_:Number = param1.x - param2.x;
var _loc4_:Number = param1.y - param2.y;
return Math.sqrt(_loc3_ * _loc3_ + _loc4_ * _loc4_);
}
}
}
@@ -0,0 +1,90 @@
package org.flixel.plugin
{
import org.flixel.*;
public class DebugPathDisplay extends FlxBasic
{
protected var _paths:Array;
public function DebugPathDisplay()
{
super();
this._paths = new Array();
active = false;
}
override public function destroy() : void
{
super.destroy();
this.clear();
this._paths = null;
}
override public function draw() : void
{
if(!FlxG.visualDebug || ignoreDrawDebug)
{
return;
}
if(cameras == null)
{
cameras = FlxG.cameras;
}
var _loc1_:uint = 0;
var _loc2_:uint = cameras.length;
while(_loc1_ < _loc2_)
{
this.drawDebug(cameras[_loc1_++]);
}
}
override public function drawDebug(param1:FlxCamera = null) : void
{
var _loc3_:FlxPath = null;
if(param1 == null)
{
param1 = FlxG.camera;
}
var _loc2_:* = int(this._paths.length - 1);
while(_loc2_ >= 0)
{
_loc3_ = this._paths[_loc2_--] as FlxPath;
if(_loc3_ != null && !_loc3_.ignoreDrawDebug)
{
_loc3_.drawDebug(param1);
}
}
}
public function add(param1:FlxPath) : void
{
this._paths.push(param1);
}
public function remove(param1:FlxPath) : void
{
var _loc2_:int = this._paths.indexOf(param1);
if(_loc2_ >= 0)
{
this._paths.splice(_loc2_,1);
}
}
public function clear() : void
{
var _loc2_:FlxPath = null;
var _loc1_:* = int(this._paths.length - 1);
while(_loc1_ >= 0)
{
_loc2_ = this._paths[_loc1_--] as FlxPath;
if(_loc2_ != null)
{
_loc2_.destroy();
}
}
this._paths.length = 0;
}
}
}
@@ -0,0 +1,67 @@
package org.flixel.plugin
{
import org.flixel.*;
public class TimerManager extends FlxBasic
{
protected var _timers:Array;
public function TimerManager()
{
super();
this._timers = new Array();
visible = false;
}
override public function destroy() : void
{
this.clear();
this._timers = null;
}
override public function update() : void
{
var _loc2_:FlxTimer = null;
var _loc1_:* = int(this._timers.length - 1);
while(_loc1_ >= 0)
{
_loc2_ = this._timers[_loc1_--] as FlxTimer;
if(_loc2_ != null && !_loc2_.paused && !_loc2_.finished && _loc2_.time > 0)
{
_loc2_.update();
}
}
}
public function add(param1:FlxTimer) : void
{
this._timers.push(param1);
}
public function remove(param1:FlxTimer) : void
{
var _loc2_:int = this._timers.indexOf(param1);
if(_loc2_ >= 0)
{
this._timers.splice(_loc2_,1);
}
}
public function clear() : void
{
var _loc2_:FlxTimer = null;
var _loc1_:* = int(this._timers.length - 1);
while(_loc1_ >= 0)
{
_loc2_ = this._timers[_loc1_--] as FlxTimer;
if(_loc2_ != null)
{
_loc2_.destroy();
}
}
this._timers.length = 0;
}
}
}
@@ -0,0 +1,33 @@
package org.flixel.system
{
public class FlxAnim
{
public var name:String;
public var delay:Number;
public var frames:Array;
public var looped:Boolean;
public function FlxAnim(param1:String, param2:Array, param3:Number = 0, param4:Boolean = true)
{
super();
this.name = param1;
this.delay = 0;
if(param3 > 0)
{
this.delay = 1 / param3;
}
this.frames = param2;
this.looped = param4;
}
public function destroy() : void
{
this.frames = null;
}
}
}
@@ -0,0 +1,173 @@
package org.flixel.system
{
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.display.Sprite;
import flash.events.MouseEvent;
import flash.geom.Point;
import flash.geom.Rectangle;
import flash.text.TextField;
import flash.text.TextFormat;
import org.flixel.FlxG;
import org.flixel.system.debug.Log;
import org.flixel.system.debug.Perf;
import org.flixel.system.debug.VCR;
import org.flixel.system.debug.Vis;
import org.flixel.system.debug.Watch;
public class FlxDebugger extends Sprite
{
public var perf:Perf;
public var log:Log;
public var watch:Watch;
public var vcr:VCR;
public var vis:Vis;
public var hasMouse:Boolean;
protected var _layout:uint;
protected var _screen:Point;
protected var _gutter:uint;
public function FlxDebugger(param1:Number, param2:Number)
{
super();
visible = false;
this.hasMouse = false;
this._screen = new Point(param1,param2);
addChild(new Bitmap(new BitmapData(param1,15,true,2130706432)));
var _loc3_:TextField = new TextField();
_loc3_.x = 2;
_loc3_.width = 160;
_loc3_.height = 16;
_loc3_.selectable = false;
_loc3_.multiline = false;
_loc3_.defaultTextFormat = new TextFormat("Courier",12,16777215);
var _loc4_:String = FlxG.getLibraryName();
if(FlxG.debug)
{
_loc4_ += " [debug]";
}
else
{
_loc4_ += " [release]";
}
_loc3_.text = _loc4_;
addChild(_loc3_);
this._gutter = 8;
var _loc5_:Rectangle = new Rectangle(this._gutter,15 + this._gutter / 2,this._screen.x - this._gutter * 2,this._screen.y - this._gutter * 1.5 - 15);
this.log = new Log("log",0,0,true,_loc5_);
addChild(this.log);
this.watch = new Watch("watch",0,0,true,_loc5_);
addChild(this.watch);
this.perf = new Perf("stats",0,0,false,_loc5_);
addChild(this.perf);
this.vcr = new VCR();
this.vcr.x = (param1 - this.vcr.width / 2) / 2;
this.vcr.y = 2;
addChild(this.vcr);
this.vis = new Vis();
this.vis.x = param1 - this.vis.width - 4;
this.vis.y = 2;
addChild(this.vis);
this.setLayout(FlxG.DEBUGGER_STANDARD);
addEventListener(MouseEvent.MOUSE_OVER,this.onMouseOver);
addEventListener(MouseEvent.MOUSE_OUT,this.onMouseOut);
}
public function destroy() : void
{
this._screen = null;
removeChild(this.log);
this.log.destroy();
this.log = null;
removeChild(this.watch);
this.watch.destroy();
this.watch = null;
removeChild(this.perf);
this.perf.destroy();
this.perf = null;
removeChild(this.vcr);
this.vcr.destroy();
this.vcr = null;
removeChild(this.vis);
this.vis.destroy();
this.vis = null;
removeEventListener(MouseEvent.MOUSE_OVER,this.onMouseOver);
removeEventListener(MouseEvent.MOUSE_OUT,this.onMouseOut);
}
protected function onMouseOver(param1:MouseEvent = null) : void
{
this.hasMouse = true;
}
protected function onMouseOut(param1:MouseEvent = null) : void
{
this.hasMouse = false;
}
public function setLayout(param1:uint) : void
{
this._layout = param1;
this.resetLayout();
}
public function resetLayout() : void
{
switch(this._layout)
{
case FlxG.DEBUGGER_MICRO:
this.log.resize(this._screen.x / 4,68);
this.log.reposition(0,this._screen.y);
this.watch.resize(this._screen.x / 4,68);
this.watch.reposition(this._screen.x,this._screen.y);
this.perf.reposition(this._screen.x,0);
break;
case FlxG.DEBUGGER_BIG:
this.log.resize((this._screen.x - this._gutter * 3) / 2,this._screen.y / 2);
this.log.reposition(0,this._screen.y);
this.watch.resize((this._screen.x - this._gutter * 3) / 2,this._screen.y / 2);
this.watch.reposition(this._screen.x,this._screen.y);
this.perf.reposition(this._screen.x,0);
break;
case FlxG.DEBUGGER_TOP:
this.log.resize((this._screen.x - this._gutter * 3) / 2,this._screen.y / 4);
this.log.reposition(0,0);
this.watch.resize((this._screen.x - this._gutter * 3) / 2,this._screen.y / 4);
this.watch.reposition(this._screen.x,0);
this.perf.reposition(this._screen.x,this._screen.y);
break;
case FlxG.DEBUGGER_LEFT:
this.log.resize(this._screen.x / 3,(this._screen.y - 15 - this._gutter * 2.5) / 2);
this.log.reposition(0,0);
this.watch.resize(this._screen.x / 3,(this._screen.y - 15 - this._gutter * 2.5) / 2);
this.watch.reposition(0,this._screen.y);
this.perf.reposition(this._screen.x,0);
break;
case FlxG.DEBUGGER_RIGHT:
this.log.resize(this._screen.x / 3,(this._screen.y - 15 - this._gutter * 2.5) / 2);
this.log.reposition(this._screen.x,0);
this.watch.resize(this._screen.x / 3,(this._screen.y - 15 - this._gutter * 2.5) / 2);
this.watch.reposition(this._screen.x,this._screen.y);
this.perf.reposition(0,0);
break;
case FlxG.DEBUGGER_STANDARD:
default:
this.log.resize((this._screen.x - this._gutter * 3) / 2,this._screen.y / 4);
this.log.reposition(0,this._screen.y);
this.watch.resize((this._screen.x - this._gutter * 3) / 2,this._screen.y / 4);
this.watch.reposition(this._screen.x,this._screen.y);
this.perf.reposition(this._screen.x,0);
}
}
}
}
@@ -0,0 +1,30 @@
package org.flixel.system
{
import org.flixel.FlxObject;
public class FlxList
{
public var object:FlxObject;
public var next:FlxList;
public function FlxList()
{
super();
this.object = null;
this.next = null;
}
public function destroy() : void
{
this.object = null;
if(this.next != null)
{
this.next.destroy();
}
this.next = null;
}
}
}
@@ -0,0 +1,468 @@
package org.flixel.system
{
import org.flixel.FlxBasic;
import org.flixel.FlxGroup;
import org.flixel.FlxObject;
import org.flixel.FlxRect;
public class FlxQuadTree extends FlxRect
{
public static var divisions:uint;
protected static var _min:uint;
protected static var _object:FlxObject;
protected static var _objectLeftEdge:Number;
protected static var _objectTopEdge:Number;
protected static var _objectRightEdge:Number;
protected static var _objectBottomEdge:Number;
protected static var _list:uint;
protected static var _useBothLists:Boolean;
protected static var _processingCallback:Function;
protected static var _notifyCallback:Function;
protected static var _iterator:FlxList;
protected static var _objectHullX:Number;
protected static var _objectHullY:Number;
protected static var _objectHullWidth:Number;
protected static var _objectHullHeight:Number;
protected static var _checkObjectHullX:Number;
protected static var _checkObjectHullY:Number;
protected static var _checkObjectHullWidth:Number;
protected static var _checkObjectHullHeight:Number;
public static const A_LIST:uint = 0;
public static const B_LIST:uint = 1;
protected var _canSubdivide:Boolean;
protected var _headA:FlxList;
protected var _tailA:FlxList;
protected var _headB:FlxList;
protected var _tailB:FlxList;
protected var _northWestTree:FlxQuadTree;
protected var _northEastTree:FlxQuadTree;
protected var _southEastTree:FlxQuadTree;
protected var _southWestTree:FlxQuadTree;
protected var _leftEdge:Number;
protected var _rightEdge:Number;
protected var _topEdge:Number;
protected var _bottomEdge:Number;
protected var _halfWidth:Number;
protected var _halfHeight:Number;
protected var _midpointX:Number;
protected var _midpointY:Number;
public function FlxQuadTree(param1:Number, param2:Number, param3:Number, param4:Number, param5:FlxQuadTree = null)
{
var _loc6_:FlxList = null;
var _loc7_:FlxList = null;
super(param1,param2,param3,param4);
this._headA = this._tailA = new FlxList();
this._headB = this._tailB = new FlxList();
if(param5 != null)
{
if(param5._headA.object != null)
{
_loc6_ = param5._headA;
while(_loc6_ != null)
{
if(this._tailA.object != null)
{
_loc7_ = this._tailA;
this._tailA = new FlxList();
_loc7_.next = this._tailA;
}
this._tailA.object = _loc6_.object;
_loc6_ = _loc6_.next;
}
}
if(param5._headB.object != null)
{
_loc6_ = param5._headB;
while(_loc6_ != null)
{
if(this._tailB.object != null)
{
_loc7_ = this._tailB;
this._tailB = new FlxList();
_loc7_.next = this._tailB;
}
this._tailB.object = _loc6_.object;
_loc6_ = _loc6_.next;
}
}
}
else
{
_min = (width + height) / (2 * divisions);
}
this._canSubdivide = width > _min || height > _min;
this._northWestTree = null;
this._northEastTree = null;
this._southEastTree = null;
this._southWestTree = null;
this._leftEdge = x;
this._rightEdge = x + width;
this._halfWidth = width / 2;
this._midpointX = this._leftEdge + this._halfWidth;
this._topEdge = y;
this._bottomEdge = y + height;
this._halfHeight = height / 2;
this._midpointY = this._topEdge + this._halfHeight;
}
public function destroy() : void
{
this._headA.destroy();
this._headA = null;
this._tailA.destroy();
this._tailA = null;
this._headB.destroy();
this._headB = null;
this._tailB.destroy();
this._tailB = null;
if(this._northWestTree != null)
{
this._northWestTree.destroy();
}
this._northWestTree = null;
if(this._northEastTree != null)
{
this._northEastTree.destroy();
}
this._northEastTree = null;
if(this._southEastTree != null)
{
this._southEastTree.destroy();
}
this._southEastTree = null;
if(this._southWestTree != null)
{
this._southWestTree.destroy();
}
this._southWestTree = null;
_object = null;
_processingCallback = null;
_notifyCallback = null;
}
public function load(param1:FlxBasic, param2:FlxBasic = null, param3:Function = null, param4:Function = null) : void
{
this.add(param1,A_LIST);
if(param2 != null)
{
this.add(param2,B_LIST);
_useBothLists = true;
}
else
{
_useBothLists = false;
}
_notifyCallback = param3;
_processingCallback = param4;
}
public function add(param1:FlxBasic, param2:uint) : void
{
var _loc3_:uint = 0;
var _loc4_:FlxBasic = null;
var _loc5_:Array = null;
var _loc6_:uint = 0;
_list = param2;
if(param1 is FlxGroup)
{
_loc3_ = 0;
_loc5_ = (param1 as FlxGroup).members;
_loc6_ = _loc5_.length;
while(_loc3_ < _loc6_)
{
_loc4_ = _loc5_[_loc3_++] as FlxBasic;
if(_loc4_ != null && _loc4_.exists)
{
if(_loc4_ is FlxGroup)
{
this.add(_loc4_,param2);
}
else if(_loc4_ is FlxObject)
{
_object = _loc4_ as FlxObject;
if(_object.exists && Boolean(_object.allowCollisions))
{
_objectLeftEdge = _object.x;
_objectTopEdge = _object.y;
_objectRightEdge = _object.x + _object.width;
_objectBottomEdge = _object.y + _object.height;
this.addObject();
}
}
}
}
}
else
{
_object = param1 as FlxObject;
if(_object.exists && Boolean(_object.allowCollisions))
{
_objectLeftEdge = _object.x;
_objectTopEdge = _object.y;
_objectRightEdge = _object.x + _object.width;
_objectBottomEdge = _object.y + _object.height;
this.addObject();
}
}
}
protected function addObject() : void
{
if(!this._canSubdivide || this._leftEdge >= _objectLeftEdge && this._rightEdge <= _objectRightEdge && this._topEdge >= _objectTopEdge && this._bottomEdge <= _objectBottomEdge)
{
this.addToList();
return;
}
if(_objectLeftEdge > this._leftEdge && _objectRightEdge < this._midpointX)
{
if(_objectTopEdge > this._topEdge && _objectBottomEdge < this._midpointY)
{
if(this._northWestTree == null)
{
this._northWestTree = new FlxQuadTree(this._leftEdge,this._topEdge,this._halfWidth,this._halfHeight,this);
}
this._northWestTree.addObject();
return;
}
if(_objectTopEdge > this._midpointY && _objectBottomEdge < this._bottomEdge)
{
if(this._southWestTree == null)
{
this._southWestTree = new FlxQuadTree(this._leftEdge,this._midpointY,this._halfWidth,this._halfHeight,this);
}
this._southWestTree.addObject();
return;
}
}
if(_objectLeftEdge > this._midpointX && _objectRightEdge < this._rightEdge)
{
if(_objectTopEdge > this._topEdge && _objectBottomEdge < this._midpointY)
{
if(this._northEastTree == null)
{
this._northEastTree = new FlxQuadTree(this._midpointX,this._topEdge,this._halfWidth,this._halfHeight,this);
}
this._northEastTree.addObject();
return;
}
if(_objectTopEdge > this._midpointY && _objectBottomEdge < this._bottomEdge)
{
if(this._southEastTree == null)
{
this._southEastTree = new FlxQuadTree(this._midpointX,this._midpointY,this._halfWidth,this._halfHeight,this);
}
this._southEastTree.addObject();
return;
}
}
if(_objectRightEdge > this._leftEdge && _objectLeftEdge < this._midpointX && _objectBottomEdge > this._topEdge && _objectTopEdge < this._midpointY)
{
if(this._northWestTree == null)
{
this._northWestTree = new FlxQuadTree(this._leftEdge,this._topEdge,this._halfWidth,this._halfHeight,this);
}
this._northWestTree.addObject();
}
if(_objectRightEdge > this._midpointX && _objectLeftEdge < this._rightEdge && _objectBottomEdge > this._topEdge && _objectTopEdge < this._midpointY)
{
if(this._northEastTree == null)
{
this._northEastTree = new FlxQuadTree(this._midpointX,this._topEdge,this._halfWidth,this._halfHeight,this);
}
this._northEastTree.addObject();
}
if(_objectRightEdge > this._midpointX && _objectLeftEdge < this._rightEdge && _objectBottomEdge > this._midpointY && _objectTopEdge < this._bottomEdge)
{
if(this._southEastTree == null)
{
this._southEastTree = new FlxQuadTree(this._midpointX,this._midpointY,this._halfWidth,this._halfHeight,this);
}
this._southEastTree.addObject();
}
if(_objectRightEdge > this._leftEdge && _objectLeftEdge < this._midpointX && _objectBottomEdge > this._midpointY && _objectTopEdge < this._bottomEdge)
{
if(this._southWestTree == null)
{
this._southWestTree = new FlxQuadTree(this._leftEdge,this._midpointY,this._halfWidth,this._halfHeight,this);
}
this._southWestTree.addObject();
}
}
protected function addToList() : void
{
var _loc1_:FlxList = null;
if(_list == A_LIST)
{
if(this._tailA.object != null)
{
_loc1_ = this._tailA;
this._tailA = new FlxList();
_loc1_.next = this._tailA;
}
this._tailA.object = _object;
}
else
{
if(this._tailB.object != null)
{
_loc1_ = this._tailB;
this._tailB = new FlxList();
_loc1_.next = this._tailB;
}
this._tailB.object = _object;
}
if(!this._canSubdivide)
{
return;
}
if(this._northWestTree != null)
{
this._northWestTree.addToList();
}
if(this._northEastTree != null)
{
this._northEastTree.addToList();
}
if(this._southEastTree != null)
{
this._southEastTree.addToList();
}
if(this._southWestTree != null)
{
this._southWestTree.addToList();
}
}
public function execute() : Boolean
{
var _loc2_:FlxList = null;
var _loc1_:Boolean = false;
if(this._headA.object != null)
{
_loc2_ = this._headA;
while(_loc2_ != null)
{
_object = _loc2_.object;
if(_useBothLists)
{
_iterator = this._headB;
}
else
{
_iterator = _loc2_.next;
}
if(_object.exists && _object.allowCollisions > 0 && _iterator != null && _iterator.object != null && _iterator.object.exists && this.overlapNode())
{
_loc1_ = true;
}
_loc2_ = _loc2_.next;
}
}
if(this._northWestTree != null && this._northWestTree.execute())
{
_loc1_ = true;
}
if(this._northEastTree != null && this._northEastTree.execute())
{
_loc1_ = true;
}
if(this._southEastTree != null && this._southEastTree.execute())
{
_loc1_ = true;
}
if(this._southWestTree != null && this._southWestTree.execute())
{
_loc1_ = true;
}
return _loc1_;
}
protected function overlapNode() : Boolean
{
var _loc2_:FlxObject = null;
var _loc1_:Boolean = false;
while(_iterator != null)
{
if(!_object.exists || _object.allowCollisions <= 0)
{
break;
}
_loc2_ = _iterator.object;
if(_object === _loc2_ || !_loc2_.exists || _loc2_.allowCollisions <= 0)
{
_iterator = _iterator.next;
}
else
{
_objectHullX = _object.x < _object.last.x ? _object.x : _object.last.x;
_objectHullY = _object.y < _object.last.y ? _object.y : _object.last.y;
_objectHullWidth = _object.x - _object.last.x;
_objectHullWidth = _object.width + (_objectHullWidth > 0 ? _objectHullWidth : -_objectHullWidth);
_objectHullHeight = _object.y - _object.last.y;
_objectHullHeight = _object.height + (_objectHullHeight > 0 ? _objectHullHeight : -_objectHullHeight);
_checkObjectHullX = _loc2_.x < _loc2_.last.x ? _loc2_.x : _loc2_.last.x;
_checkObjectHullY = _loc2_.y < _loc2_.last.y ? _loc2_.y : _loc2_.last.y;
_checkObjectHullWidth = _loc2_.x - _loc2_.last.x;
_checkObjectHullWidth = _loc2_.width + (_checkObjectHullWidth > 0 ? _checkObjectHullWidth : -_checkObjectHullWidth);
_checkObjectHullHeight = _loc2_.y - _loc2_.last.y;
_checkObjectHullHeight = _loc2_.height + (_checkObjectHullHeight > 0 ? _checkObjectHullHeight : -_checkObjectHullHeight);
if(_objectHullX + _objectHullWidth > _checkObjectHullX && _objectHullX < _checkObjectHullX + _checkObjectHullWidth && _objectHullY + _objectHullHeight > _checkObjectHullY && _objectHullY < _checkObjectHullY + _checkObjectHullHeight)
{
if(_processingCallback == null || Boolean(_processingCallback(_object,_loc2_)))
{
_loc1_ = true;
}
if(_loc1_ && _notifyCallback != null)
{
_notifyCallback(_object,_loc2_);
}
}
_iterator = _iterator.next;
}
}
return _loc1_;
}
}
}
@@ -0,0 +1,153 @@
package org.flixel.system
{
import org.flixel.FlxG;
import org.flixel.system.replay.FrameRecord;
import org.flixel.system.replay.MouseRecord;
public class FlxReplay
{
public var seed:Number;
public var frame:int;
public var frameCount:int;
public var finished:Boolean;
protected var _frames:Array;
protected var _capacity:int;
protected var _marker:int;
public function FlxReplay()
{
super();
this.seed = 0;
this.frame = 0;
this.frameCount = 0;
this.finished = false;
this._frames = null;
this._capacity = 0;
this._marker = 0;
}
public function destroy() : void
{
if(this._frames == null)
{
return;
}
var _loc1_:* = int(this.frameCount - 1);
while(_loc1_ >= 0)
{
(this._frames[_loc1_--] as FrameRecord).destroy();
}
this._frames = null;
}
public function create(param1:Number) : void
{
this.destroy();
this.init();
this.seed = param1;
this.rewind();
}
public function load(param1:String) : void
{
var _loc3_:String = null;
this.init();
var _loc2_:Array = param1.split("\n");
this.seed = Number(_loc2_[0]);
var _loc4_:uint = 1;
var _loc5_:uint = _loc2_.length;
while(_loc4_ < _loc5_)
{
_loc3_ = _loc2_[_loc4_++] as String;
if(_loc3_.length > 3)
{
var _loc6_:Number;
this._frames[_loc6_ = this.frameCount++] = new FrameRecord().load(_loc3_);
if(this.frameCount >= this._capacity)
{
this._capacity *= 2;
this._frames.length = this._capacity;
}
}
}
this.rewind();
}
protected function init() : void
{
this._capacity = 100;
this._frames = new Array(this._capacity);
this.frameCount = 0;
}
public function save() : String
{
if(this.frameCount <= 0)
{
return null;
}
var _loc1_:String = this.seed + "\n";
var _loc2_:uint = 0;
while(_loc2_ < this.frameCount)
{
_loc1_ += this._frames[_loc2_++].save() + "\n";
}
return _loc1_;
}
public function recordFrame() : void
{
var _loc1_:Array = FlxG.keys.record();
var _loc2_:MouseRecord = FlxG.mouse.record();
if(_loc1_ == null && _loc2_ == null)
{
++this.frame;
return;
}
this._frames[this.frameCount++] = new FrameRecord().create(this.frame++,_loc1_,_loc2_);
if(this.frameCount >= this._capacity)
{
this._capacity *= 2;
this._frames.length = this._capacity;
}
}
public function playNextFrame() : void
{
FlxG.resetInput();
if(this._marker >= this.frameCount)
{
this.finished = true;
return;
}
if((this._frames[this._marker] as FrameRecord).frame != this.frame++)
{
return;
}
var _loc1_:FrameRecord = this._frames[this._marker++];
if(_loc1_.keys != null)
{
FlxG.keys.playback(_loc1_.keys);
}
if(_loc1_.mouse != null)
{
FlxG.mouse.playback(_loc1_.mouse);
}
}
public function rewind() : void
{
this._marker = 0;
this.frame = 0;
this.finished = false;
}
}
}
@@ -0,0 +1,41 @@
package org.flixel.system
{
import org.flixel.FlxObject;
import org.flixel.FlxTilemap;
public class FlxTile extends FlxObject
{
public var callback:Function;
public var filter:Class;
public var tilemap:FlxTilemap;
public var index:uint;
public var mapIndex:uint;
public function FlxTile(param1:FlxTilemap, param2:uint, param3:Number, param4:Number, param5:Boolean, param6:uint)
{
super(0,0,param3,param4);
immovable = true;
moves = false;
this.callback = null;
this.filter = null;
this.tilemap = param1;
this.index = param2;
visible = param5;
allowCollisions = param6;
this.mapIndex = 0;
}
override public function destroy() : void
{
super.destroy();
this.callback = null;
this.tilemap = null;
}
}
}
@@ -0,0 +1,76 @@
package org.flixel.system
{
import flash.display.BitmapData;
import flash.geom.Point;
import flash.geom.Rectangle;
import org.flixel.FlxCamera;
import org.flixel.FlxG;
import org.flixel.FlxU;
public class FlxTilemapBuffer
{
public var x:Number;
public var y:Number;
public var width:Number;
public var height:Number;
public var dirty:Boolean;
public var rows:uint;
public var columns:uint;
protected var _pixels:BitmapData;
protected var _flashRect:Rectangle;
public function FlxTilemapBuffer(param1:Number, param2:Number, param3:uint, param4:uint, param5:FlxCamera = null)
{
super();
if(param5 == null)
{
param5 = FlxG.camera;
}
this.columns = FlxU.ceil(param5.width / param1) + 1;
if(this.columns > param3)
{
this.columns = param3;
}
this.rows = FlxU.ceil(param5.height / param2) + 1;
if(this.rows > param4)
{
this.rows = param4;
}
this._pixels = new BitmapData(this.columns * param1,this.rows * param2,true,0);
this.width = this._pixels.width;
this.height = this._pixels.height;
this._flashRect = new Rectangle(0,0,this.width,this.height);
this.dirty = true;
}
public function destroy() : void
{
this._pixels = null;
}
public function fill(param1:uint = 0) : void
{
this._pixels.fillRect(this._flashRect,param1);
}
public function get pixels() : BitmapData
{
return this._pixels;
}
public function draw(param1:FlxCamera, param2:Point) : void
{
param1.buffer.copyPixels(this._pixels,this._flashRect,param2,null,null,true);
}
}
}
@@ -0,0 +1,234 @@
package org.flixel.system
{
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.display.Sprite;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.geom.Point;
import flash.geom.Rectangle;
import flash.text.TextField;
import flash.text.TextFormat;
import org.flixel.FlxU;
public class FlxWindow extends Sprite
{
protected var ImgHandle:Class = FlxWindow_ImgHandle;
public var minSize:Point;
public var maxSize:Point;
protected var _width:uint;
protected var _height:uint;
protected var _bounds:Rectangle;
protected var _background:Bitmap;
protected var _header:Bitmap;
protected var _shadow:Bitmap;
protected var _title:TextField;
protected var _handle:Bitmap;
protected var _overHeader:Boolean;
protected var _overHandle:Boolean;
protected var _drag:Point;
protected var _dragging:Boolean;
protected var _resizing:Boolean;
protected var _resizable:Boolean;
public function FlxWindow(param1:String, param2:Number, param3:Number, param4:Boolean = true, param5:Rectangle = null, param6:uint = 2139062143, param7:uint = 2130706432)
{
super();
this._width = param2;
this._height = param3;
this._bounds = param5;
this.minSize = new Point(50,30);
if(this._bounds != null)
{
this.maxSize = new Point(this._bounds.width,this._bounds.height);
}
else
{
this.maxSize = new Point(Number.MAX_VALUE,Number.MAX_VALUE);
}
this._drag = new Point();
this._resizable = param4;
this._shadow = new Bitmap(new BitmapData(1,2,true,4278190080));
addChild(this._shadow);
this._background = new Bitmap(new BitmapData(1,1,true,param6));
this._background.y = 15;
addChild(this._background);
this._header = new Bitmap(new BitmapData(1,15,true,param7));
addChild(this._header);
this._title = new TextField();
this._title.x = 2;
this._title.height = 16;
this._title.selectable = false;
this._title.multiline = false;
this._title.defaultTextFormat = new TextFormat("Courier",12,16777215);
this._title.text = param1;
addChild(this._title);
if(this._resizable)
{
this._handle = new this.ImgHandle();
addChild(this._handle);
}
if(this._width != 0 || this._height != 0)
{
this.updateSize();
}
this.bound();
addEventListener(Event.ENTER_FRAME,this.init);
}
public function destroy() : void
{
this.minSize = null;
this.maxSize = null;
this._bounds = null;
removeChild(this._shadow);
this._shadow = null;
removeChild(this._background);
this._background = null;
removeChild(this._header);
this._header = null;
removeChild(this._title);
this._title = null;
if(this._handle != null)
{
removeChild(this._handle);
}
this._handle = null;
this._drag = null;
}
public function resize(param1:Number, param2:Number) : void
{
this._width = param1;
this._height = param2;
this.updateSize();
}
public function reposition(param1:Number, param2:Number) : void
{
x = param1;
y = param2;
this.bound();
}
protected function init(param1:Event = null) : void
{
if(root == null)
{
return;
}
removeEventListener(Event.ENTER_FRAME,this.init);
stage.addEventListener(MouseEvent.MOUSE_MOVE,this.onMouseMove);
stage.addEventListener(MouseEvent.MOUSE_DOWN,this.onMouseDown);
stage.addEventListener(MouseEvent.MOUSE_UP,this.onMouseUp);
}
protected function onMouseMove(param1:MouseEvent = null) : void
{
if(this._dragging)
{
this._overHeader = true;
this.reposition(parent.mouseX - this._drag.x,parent.mouseY - this._drag.y);
}
else if(this._resizing)
{
this._overHandle = true;
this.resize(mouseX - this._drag.x,mouseY - this._drag.y);
}
else if(mouseX >= 0 && mouseX <= this._width && mouseY >= 0 && mouseY <= this._height)
{
this._overHeader = mouseX <= this._header.width && mouseY <= this._header.height;
if(this._resizable)
{
this._overHandle = mouseX >= this._width - this._handle.width && mouseY >= this._height - this._handle.height;
}
}
else
{
this._overHandle = this._overHeader = false;
}
this.updateGUI();
}
protected function onMouseDown(param1:MouseEvent = null) : void
{
if(this._overHeader)
{
this._dragging = true;
this._drag.x = mouseX;
this._drag.y = mouseY;
}
else if(this._overHandle)
{
this._resizing = true;
this._drag.x = this._width - mouseX;
this._drag.y = this._height - mouseY;
}
}
protected function onMouseUp(param1:MouseEvent = null) : void
{
this._dragging = false;
this._resizing = false;
}
protected function bound() : void
{
if(this._bounds != null)
{
x = FlxU.bound(x,this._bounds.left,this._bounds.right - this._width);
y = FlxU.bound(y,this._bounds.top,this._bounds.bottom - this._height);
}
}
protected function updateSize() : void
{
this._width = FlxU.bound(this._width,this.minSize.x,this.maxSize.x);
this._height = FlxU.bound(this._height,this.minSize.y,this.maxSize.y);
this._header.scaleX = this._width;
this._background.scaleX = this._width;
this._background.scaleY = this._height - 15;
this._shadow.scaleX = this._width;
this._shadow.y = this._height;
this._title.width = this._width - 4;
if(this._resizable)
{
this._handle.x = this._width - this._handle.width;
this._handle.y = this._height - this._handle.height;
}
}
protected function updateGUI() : void
{
if(this._overHeader || this._overHandle)
{
if(this._title.alpha != 1)
{
this._title.alpha = 1;
}
}
else if(this._title.alpha != 0.65)
{
this._title.alpha = 0.65;
}
}
}
}
@@ -0,0 +1,15 @@
package org.flixel.system
{
import mx.core.BitmapAsset;
[Embed(source="/_assets/110_org.flixel.system.FlxWindow_ImgHandle.png")]
public class FlxWindow_ImgHandle extends BitmapAsset
{
public function FlxWindow_ImgHandle()
{
super();
}
}
}
@@ -0,0 +1,75 @@
package org.flixel.system.debug
{
import flash.geom.Rectangle;
import flash.text.TextField;
import flash.text.TextFormat;
import org.flixel.system.FlxWindow;
public class Log extends FlxWindow
{
protected static const MAX_LOG_LINES:uint = 200;
protected var _text:TextField;
protected var _lines:Array;
public function Log(param1:String, param2:Number, param3:Number, param4:Boolean = true, param5:Rectangle = null, param6:uint = 2139062143, param7:uint = 2130706432)
{
super(param1,param2,param3,param4,param5,param6,param7);
this._text = new TextField();
this._text.x = 2;
this._text.y = 15;
this._text.multiline = true;
this._text.wordWrap = true;
this._text.selectable = true;
this._text.defaultTextFormat = new TextFormat("Courier",12,16777215);
addChild(this._text);
this._lines = new Array();
}
override public function destroy() : void
{
removeChild(this._text);
this._text = null;
this._lines = null;
super.destroy();
}
public function add(param1:String) : void
{
var _loc2_:String = null;
var _loc3_:uint = 0;
if(this._lines.length <= 0)
{
this._text.text = "";
}
this._lines.push(param1);
if(this._lines.length > MAX_LOG_LINES)
{
this._lines.shift();
_loc2_ = "";
_loc3_ = 0;
while(_loc3_ < this._lines.length)
{
_loc2_ += this._lines[_loc3_] + "\n";
_loc3_++;
}
this._text.text = _loc2_;
}
else
{
this._text.appendText(param1 + "\n");
}
this._text.scrollV = this._text.height;
}
override protected function updateSize() : void
{
super.updateSize();
this._text.width = _width - 10;
this._text.height = _height - 15;
}
}
}
@@ -0,0 +1,176 @@
package org.flixel.system.debug
{
import flash.geom.Rectangle;
import flash.system.System;
import flash.text.TextField;
import flash.text.TextFormat;
import flash.utils.getTimer;
import org.flixel.FlxG;
import org.flixel.system.FlxWindow;
public class Perf extends FlxWindow
{
protected var _text:TextField;
protected var _lastTime:int;
protected var _updateTimer:int;
protected var _flixelUpdate:Array;
protected var _flixelUpdateMarker:uint;
protected var _flixelDraw:Array;
protected var _flixelDrawMarker:uint;
protected var _flash:Array;
protected var _flashMarker:uint;
protected var _activeObject:Array;
protected var _objectMarker:uint;
protected var _visibleObject:Array;
protected var _visibleObjectMarker:uint;
public function Perf(param1:String, param2:Number, param3:Number, param4:Boolean = true, param5:Rectangle = null, param6:uint = 2139062143, param7:uint = 2130706432)
{
super(param1,param2,param3,param4,param5,param6,param7);
resize(90,66);
this._lastTime = 0;
this._updateTimer = 0;
this._text = new TextField();
this._text.width = _width;
this._text.x = 2;
this._text.y = 15;
this._text.multiline = true;
this._text.wordWrap = true;
this._text.selectable = true;
this._text.defaultTextFormat = new TextFormat("Courier",12,16777215);
addChild(this._text);
this._flixelUpdate = new Array(32);
this._flixelUpdateMarker = 0;
this._flixelDraw = new Array(32);
this._flixelDrawMarker = 0;
this._flash = new Array(32);
this._flashMarker = 0;
this._activeObject = new Array(32);
this._objectMarker = 0;
this._visibleObject = new Array(32);
this._visibleObjectMarker = 0;
}
override public function destroy() : void
{
removeChild(this._text);
this._text = null;
this._flixelUpdate = null;
this._flixelDraw = null;
this._flash = null;
this._activeObject = null;
this._visibleObject = null;
super.destroy();
}
public function update() : void
{
var _loc4_:uint = 0;
var _loc5_:String = null;
var _loc6_:Number = NaN;
var _loc7_:uint = 0;
var _loc8_:uint = 0;
var _loc9_:uint = 0;
var _loc10_:uint = 0;
var _loc11_:uint = 0;
var _loc1_:int = getTimer();
var _loc2_:int = _loc1_ - this._lastTime;
var _loc3_:uint = 500;
if(_loc2_ > _loc3_)
{
_loc2_ = int(_loc3_);
}
this._lastTime = _loc1_;
this._updateTimer += _loc2_;
if(this._updateTimer > _loc3_)
{
_loc5_ = "";
_loc6_ = 0;
_loc4_ = 0;
while(_loc4_ < this._flashMarker)
{
_loc6_ += this._flash[_loc4_++];
}
_loc6_ /= this._flashMarker;
_loc5_ += uint(1 / (_loc6_ / 1000)) + "/" + FlxG.flashFramerate + "fps\n";
_loc5_ = _loc5_ + (Number((System.totalMemory * 9.54e-7).toFixed(2)) + "MB\n");
_loc7_ = 0;
_loc4_ = 0;
while(_loc4_ < this._flixelUpdateMarker)
{
_loc7_ += this._flixelUpdate[_loc4_++];
}
_loc8_ = 0;
_loc9_ = 0;
_loc4_ = 0;
while(_loc4_ < this._objectMarker)
{
_loc8_ += this._activeObject[_loc4_];
_loc11_ += this._visibleObject[_loc4_++];
}
_loc8_ /= this._objectMarker;
_loc5_ += "U:" + _loc8_ + " " + uint(_loc7_ / this._flixelDrawMarker) + "ms\n";
_loc10_ = 0;
_loc4_ = 0;
while(_loc4_ < this._flixelDrawMarker)
{
_loc10_ += this._flixelDraw[_loc4_++];
}
_loc11_ = 0;
_loc4_ = 0;
while(_loc4_ < this._visibleObjectMarker)
{
_loc11_ += this._visibleObject[_loc4_++];
}
_loc11_ /= this._visibleObjectMarker;
_loc5_ += "D:" + _loc11_ + " " + uint(_loc10_ / this._flixelDrawMarker) + "ms";
this._text.text = _loc5_;
this._flixelUpdateMarker = 0;
this._flixelDrawMarker = 0;
this._flashMarker = 0;
this._objectMarker = 0;
this._visibleObjectMarker = 0;
this._updateTimer -= _loc3_;
}
}
public function flixelUpdate(param1:int) : void
{
this._flixelUpdate[this._flixelUpdateMarker++] = param1;
}
public function flixelDraw(param1:int) : void
{
this._flixelDraw[this._flixelDrawMarker++] = param1;
}
public function flash(param1:int) : void
{
this._flash[this._flashMarker++] = param1;
}
public function activeObjects(param1:int) : void
{
this._activeObject[this._objectMarker++] = param1;
}
public function visibleObjects(param1:int) : void
{
this._visibleObject[this._visibleObjectMarker++] = param1;
}
}
}
@@ -0,0 +1,490 @@
package org.flixel.system.debug
{
import flash.display.Bitmap;
import flash.display.Sprite;
import flash.events.Event;
import flash.events.IOErrorEvent;
import flash.events.MouseEvent;
import flash.net.FileFilter;
import flash.net.FileReference;
import flash.text.TextField;
import flash.text.TextFormat;
import flash.utils.ByteArray;
import org.flixel.FlxG;
import org.flixel.FlxU;
public class VCR extends Sprite
{
protected static const FILE_TYPES:Array = [new FileFilter("Flixel Game Recording","*.fgr")];
protected static const DEFAULT_FILE_NAME:String = "replay.fgr";
protected var ImgOpen:Class = VCR_ImgOpen;
protected var ImgRecordOff:Class = VCR_ImgRecordOff;
protected var ImgRecordOn:Class = VCR_ImgRecordOn;
protected var ImgStop:Class = VCR_ImgStop;
protected var ImgFlixel:Class = VCR_ImgFlixel;
protected var ImgRestart:Class = VCR_ImgRestart;
protected var ImgPause:Class = VCR_ImgPause;
protected var ImgPlay:Class = VCR_ImgPlay;
protected var ImgStep:Class = VCR_ImgStep;
public var paused:Boolean;
public var stepRequested:Boolean;
protected var _open:Bitmap;
protected var _recordOff:Bitmap;
protected var _recordOn:Bitmap;
protected var _stop:Bitmap;
protected var _flixel:Bitmap;
protected var _restart:Bitmap;
protected var _pause:Bitmap;
protected var _play:Bitmap;
protected var _step:Bitmap;
protected var _overOpen:Boolean;
protected var _overRecord:Boolean;
protected var _overRestart:Boolean;
protected var _overPause:Boolean;
protected var _overStep:Boolean;
protected var _pressingOpen:Boolean;
protected var _pressingRecord:Boolean;
protected var _pressingRestart:Boolean;
protected var _pressingPause:Boolean;
protected var _pressingStep:Boolean;
protected var _file:FileReference;
protected var _runtimeDisplay:TextField;
protected var _runtime:uint;
public function VCR()
{
super();
var _loc1_:uint = 7;
this._open = new this.ImgOpen();
addChild(this._open);
this._recordOff = new this.ImgRecordOff();
this._recordOff.x = this._open.x + this._open.width + _loc1_;
addChild(this._recordOff);
this._recordOn = new this.ImgRecordOn();
this._recordOn.x = this._recordOff.x;
this._recordOn.visible = false;
addChild(this._recordOn);
this._stop = new this.ImgStop();
this._stop.x = this._recordOff.x;
this._stop.visible = false;
addChild(this._stop);
this._flixel = new this.ImgFlixel();
this._flixel.x = this._recordOff.x + this._recordOff.width + _loc1_;
addChild(this._flixel);
this._restart = new this.ImgRestart();
this._restart.x = this._flixel.x + this._flixel.width + _loc1_;
addChild(this._restart);
this._pause = new this.ImgPause();
this._pause.x = this._restart.x + this._restart.width + _loc1_;
addChild(this._pause);
this._play = new this.ImgPlay();
this._play.x = this._pause.x;
this._play.visible = false;
addChild(this._play);
this._step = new this.ImgStep();
this._step.x = this._pause.x + this._pause.width + _loc1_;
addChild(this._step);
this._runtimeDisplay = new TextField();
this._runtimeDisplay.width = width;
this._runtimeDisplay.x = width;
this._runtimeDisplay.y = -2;
this._runtimeDisplay.multiline = false;
this._runtimeDisplay.wordWrap = false;
this._runtimeDisplay.selectable = false;
this._runtimeDisplay.defaultTextFormat = new TextFormat("Courier",12,16777215,null,null,null,null,null,"center");
this._runtimeDisplay.visible = false;
addChild(this._runtimeDisplay);
this._runtime = 0;
this.stepRequested = false;
this._file = null;
this.unpress();
this.checkOver();
this.updateGUI();
addEventListener(Event.ENTER_FRAME,this.init);
}
public function destroy() : void
{
this._file = null;
removeChild(this._open);
this._open = null;
removeChild(this._recordOff);
this._recordOff = null;
removeChild(this._recordOn);
this._recordOn = null;
removeChild(this._stop);
this._stop = null;
removeChild(this._flixel);
this._flixel = null;
removeChild(this._restart);
this._restart = null;
removeChild(this._pause);
this._pause = null;
removeChild(this._play);
this._play = null;
removeChild(this._step);
this._step = null;
stage.removeEventListener(MouseEvent.MOUSE_MOVE,this.onMouseMove);
stage.removeEventListener(MouseEvent.MOUSE_DOWN,this.onMouseDown);
stage.removeEventListener(MouseEvent.MOUSE_UP,this.onMouseUp);
}
public function recording() : void
{
this._stop.visible = false;
this._recordOff.visible = false;
this._recordOn.visible = true;
}
public function stopped() : void
{
this._stop.visible = false;
this._recordOn.visible = false;
this._recordOff.visible = true;
}
public function playing() : void
{
this._recordOff.visible = false;
this._recordOn.visible = false;
this._stop.visible = true;
}
public function updateRuntime(param1:uint) : void
{
this._runtime += param1;
this._runtimeDisplay.text = FlxU.formatTime(this._runtime / 1000,true);
if(!this._runtimeDisplay.visible)
{
this._runtimeDisplay.visible = true;
}
}
public function onOpen() : void
{
this._file = new FileReference();
this._file.addEventListener(Event.SELECT,this.onOpenSelect);
this._file.addEventListener(Event.CANCEL,this.onOpenCancel);
this._file.browse(FILE_TYPES);
}
protected function onOpenSelect(param1:Event = null) : void
{
this._file.removeEventListener(Event.SELECT,this.onOpenSelect);
this._file.removeEventListener(Event.CANCEL,this.onOpenCancel);
this._file.addEventListener(Event.COMPLETE,this.onOpenComplete);
this._file.addEventListener(IOErrorEvent.IO_ERROR,this.onOpenError);
this._file.load();
}
protected function onOpenComplete(param1:Event = null) : void
{
this._file.removeEventListener(Event.COMPLETE,this.onOpenComplete);
this._file.removeEventListener(IOErrorEvent.IO_ERROR,this.onOpenError);
var _loc2_:String = null;
var _loc3_:ByteArray = this._file.data;
if(_loc3_ != null)
{
_loc2_ = _loc3_.readUTFBytes(_loc3_.bytesAvailable);
}
this._file = null;
if(_loc2_ == null || _loc2_.length <= 0)
{
return FlxG.log("ERROR: Empty flixel gameplay record.");
}
FlxG.loadReplay(_loc2_);
}
protected function onOpenCancel(param1:Event = null) : void
{
this._file.removeEventListener(Event.SELECT,this.onOpenSelect);
this._file.removeEventListener(Event.CANCEL,this.onOpenCancel);
this._file = null;
}
protected function onOpenError(param1:Event = null) : void
{
this._file.removeEventListener(Event.COMPLETE,this.onOpenComplete);
this._file.removeEventListener(IOErrorEvent.IO_ERROR,this.onOpenError);
this._file = null;
FlxG.log("ERROR: Unable to open flixel gameplay record.");
}
public function onRecord(param1:Boolean = false) : void
{
if(this._play.visible)
{
this.onPlay();
}
FlxG.recordReplay(param1);
}
public function stopRecording() : void
{
var _loc1_:String = FlxG.stopRecording();
if(_loc1_ != null && _loc1_.length > 0)
{
this._file = new FileReference();
this._file.addEventListener(Event.COMPLETE,this.onSaveComplete);
this._file.addEventListener(Event.CANCEL,this.onSaveCancel);
this._file.addEventListener(IOErrorEvent.IO_ERROR,this.onSaveError);
this._file.save(_loc1_,DEFAULT_FILE_NAME);
}
}
protected function onSaveComplete(param1:Event = null) : void
{
this._file.removeEventListener(Event.COMPLETE,this.onSaveComplete);
this._file.removeEventListener(Event.CANCEL,this.onSaveCancel);
this._file.removeEventListener(IOErrorEvent.IO_ERROR,this.onSaveError);
this._file = null;
FlxG.log("FLIXEL: successfully saved flixel gameplay record.");
}
protected function onSaveCancel(param1:Event = null) : void
{
this._file.removeEventListener(Event.COMPLETE,this.onSaveComplete);
this._file.removeEventListener(Event.CANCEL,this.onSaveCancel);
this._file.removeEventListener(IOErrorEvent.IO_ERROR,this.onSaveError);
this._file = null;
}
protected function onSaveError(param1:Event = null) : void
{
this._file.removeEventListener(Event.COMPLETE,this.onSaveComplete);
this._file.removeEventListener(Event.CANCEL,this.onSaveCancel);
this._file.removeEventListener(IOErrorEvent.IO_ERROR,this.onSaveError);
this._file = null;
FlxG.log("ERROR: problem saving flixel gameplay record.");
}
public function onStop() : void
{
FlxG.stopReplay();
}
public function onRestart(param1:Boolean = false) : void
{
if(FlxG.reloadReplay(param1))
{
this._recordOff.visible = false;
this._recordOn.visible = false;
this._stop.visible = true;
}
}
public function onPause() : void
{
this.paused = true;
this._pause.visible = false;
this._play.visible = true;
}
public function onPlay() : void
{
this.paused = false;
this._play.visible = false;
this._pause.visible = true;
}
public function onStep() : void
{
if(!this.paused)
{
this.onPause();
}
this.stepRequested = true;
}
protected function init(param1:Event = null) : void
{
if(root == null)
{
return;
}
removeEventListener(Event.ENTER_FRAME,this.init);
stage.addEventListener(MouseEvent.MOUSE_MOVE,this.onMouseMove);
stage.addEventListener(MouseEvent.MOUSE_DOWN,this.onMouseDown);
stage.addEventListener(MouseEvent.MOUSE_UP,this.onMouseUp);
}
protected function onMouseMove(param1:MouseEvent = null) : void
{
if(!this.checkOver())
{
this.unpress();
}
this.updateGUI();
}
protected function onMouseDown(param1:MouseEvent = null) : void
{
this.unpress();
if(this._overOpen)
{
this._pressingOpen = true;
}
if(this._overRecord)
{
this._pressingRecord = true;
}
if(this._overRestart)
{
this._pressingRestart = true;
}
if(this._overPause)
{
this._pressingPause = true;
}
if(this._overStep)
{
this._pressingStep = true;
}
}
protected function onMouseUp(param1:MouseEvent = null) : void
{
if(this._overOpen && this._pressingOpen)
{
this.onOpen();
}
else if(this._overRecord && this._pressingRecord)
{
if(this._stop.visible)
{
this.onStop();
}
else if(this._recordOn.visible)
{
this.stopRecording();
}
else
{
this.onRecord(!param1.altKey);
}
}
else if(this._overRestart && this._pressingRestart)
{
this.onRestart(!param1.altKey);
}
else if(this._overPause && this._pressingPause)
{
if(this._play.visible)
{
this.onPlay();
}
else
{
this.onPause();
}
}
else if(this._overStep && this._pressingStep)
{
this.onStep();
}
this.unpress();
this.checkOver();
this.updateGUI();
}
protected function checkOver() : Boolean
{
return false;
}
protected function unpress() : void
{
this._pressingOpen = false;
this._pressingRecord = false;
this._pressingRestart = false;
this._pressingPause = false;
this._pressingStep = false;
}
protected function updateGUI() : void
{
if(this._recordOn.visible)
{
this._open.alpha = this._restart.alpha = this._pause.alpha = this._step.alpha = 0.35;
this._recordOn.alpha = 1;
return;
}
if(this._overOpen && this._open.alpha != 1)
{
this._open.alpha = 1;
}
else if(!this._overOpen && this._open.alpha != 0.8)
{
this._open.alpha = 0.8;
}
if(this._overRecord && this._recordOff.alpha != 1)
{
this._recordOff.alpha = this._recordOn.alpha = this._stop.alpha = 1;
}
else if(!this._overRecord && this._recordOff.alpha != 0.8)
{
this._recordOff.alpha = this._recordOn.alpha = this._stop.alpha = 0.8;
}
if(this._overRestart && this._restart.alpha != 1)
{
this._restart.alpha = 1;
}
else if(!this._overRestart && this._restart.alpha != 0.8)
{
this._restart.alpha = 0.8;
}
if(this._overPause && this._pause.alpha != 1)
{
this._pause.alpha = this._play.alpha = 1;
}
else if(!this._overPause && this._pause.alpha != 0.8)
{
this._pause.alpha = this._play.alpha = 0.8;
}
if(this._overStep && this._step.alpha != 1)
{
this._step.alpha = 1;
}
else if(!this._overStep && this._step.alpha != 0.8)
{
this._step.alpha = 0.8;
}
}
}
}
@@ -0,0 +1,15 @@
package org.flixel.system.debug
{
import mx.core.BitmapAsset;
[Embed(source="/_assets/108_org.flixel.system.debug.VCR_ImgFlixel.png")]
public class VCR_ImgFlixel extends BitmapAsset
{
public function VCR_ImgFlixel()
{
super();
}
}
}
@@ -0,0 +1,15 @@
package org.flixel.system.debug
{
import mx.core.BitmapAsset;
[Embed(source="/_assets/157_org.flixel.system.debug.VCR_ImgOpen.png")]
public class VCR_ImgOpen extends BitmapAsset
{
public function VCR_ImgOpen()
{
super();
}
}
}
@@ -0,0 +1,15 @@
package org.flixel.system.debug
{
import mx.core.BitmapAsset;
[Embed(source="/_assets/251_org.flixel.system.debug.VCR_ImgPause.png")]
public class VCR_ImgPause extends BitmapAsset
{
public function VCR_ImgPause()
{
super();
}
}
}
@@ -0,0 +1,15 @@
package org.flixel.system.debug
{
import mx.core.BitmapAsset;
[Embed(source="/_assets/86_org.flixel.system.debug.VCR_ImgPlay.png")]
public class VCR_ImgPlay extends BitmapAsset
{
public function VCR_ImgPlay()
{
super();
}
}
}
@@ -0,0 +1,15 @@
package org.flixel.system.debug
{
import mx.core.BitmapAsset;
[Embed(source="/_assets/71_org.flixel.system.debug.VCR_ImgRecordOff.png")]
public class VCR_ImgRecordOff extends BitmapAsset
{
public function VCR_ImgRecordOff()
{
super();
}
}
}
@@ -0,0 +1,15 @@
package org.flixel.system.debug
{
import mx.core.BitmapAsset;
[Embed(source="/_assets/286_org.flixel.system.debug.VCR_ImgRecordOn.png")]
public class VCR_ImgRecordOn extends BitmapAsset
{
public function VCR_ImgRecordOn()
{
super();
}
}
}
@@ -0,0 +1,15 @@
package org.flixel.system.debug
{
import mx.core.BitmapAsset;
[Embed(source="/_assets/301_org.flixel.system.debug.VCR_ImgRestart.png")]
public class VCR_ImgRestart extends BitmapAsset
{
public function VCR_ImgRestart()
{
super();
}
}
}
@@ -0,0 +1,15 @@
package org.flixel.system.debug
{
import mx.core.BitmapAsset;
[Embed(source="/_assets/113_org.flixel.system.debug.VCR_ImgStep.png")]
public class VCR_ImgStep extends BitmapAsset
{
public function VCR_ImgStep()
{
super();
}
}
}
@@ -0,0 +1,15 @@
package org.flixel.system.debug
{
import mx.core.BitmapAsset;
[Embed(source="/_assets/272_org.flixel.system.debug.VCR_ImgStop.png")]
public class VCR_ImgStop extends BitmapAsset
{
public function VCR_ImgStop()
{
super();
}
}
}
@@ -0,0 +1,129 @@
package org.flixel.system.debug
{
import flash.display.Bitmap;
import flash.display.Sprite;
import flash.events.Event;
import flash.events.MouseEvent;
import org.flixel.FlxG;
public class Vis extends Sprite
{
protected var ImgBounds:Class = Vis_ImgBounds;
protected var _bounds:Bitmap;
protected var _overBounds:Boolean;
protected var _pressingBounds:Boolean;
public function Vis()
{
super();
var _loc1_:uint = 7;
this._bounds = new this.ImgBounds();
addChild(this._bounds);
this.unpress();
this.checkOver();
this.updateGUI();
addEventListener(Event.ENTER_FRAME,this.init);
}
public function destroy() : void
{
removeChild(this._bounds);
this._bounds = null;
stage.removeEventListener(MouseEvent.MOUSE_MOVE,this.onMouseMove);
stage.removeEventListener(MouseEvent.MOUSE_DOWN,this.onMouseDown);
stage.removeEventListener(MouseEvent.MOUSE_UP,this.onMouseUp);
}
public function onBounds() : void
{
}
protected function init(param1:Event = null) : void
{
if(root == null)
{
return;
}
removeEventListener(Event.ENTER_FRAME,this.init);
stage.addEventListener(MouseEvent.MOUSE_MOVE,this.onMouseMove);
stage.addEventListener(MouseEvent.MOUSE_DOWN,this.onMouseDown);
stage.addEventListener(MouseEvent.MOUSE_UP,this.onMouseUp);
}
protected function onMouseMove(param1:MouseEvent = null) : void
{
if(!this.checkOver())
{
this.unpress();
}
this.updateGUI();
}
protected function onMouseDown(param1:MouseEvent = null) : void
{
this.unpress();
if(this._overBounds)
{
this._pressingBounds = true;
}
}
protected function onMouseUp(param1:MouseEvent = null) : void
{
if(this._overBounds && this._pressingBounds)
{
this.onBounds();
}
this.unpress();
this.checkOver();
this.updateGUI();
}
protected function checkOver() : Boolean
{
this._overBounds = false;
if(mouseX < 0 || mouseX > width || mouseY < 0 || mouseY > height)
{
return false;
}
if(mouseX > this._bounds.x || mouseX < this._bounds.x + this._bounds.width)
{
this._overBounds = true;
}
return true;
}
protected function unpress() : void
{
this._pressingBounds = false;
}
protected function updateGUI() : void
{
if(FlxG.visualDebug)
{
if(this._overBounds && this._bounds.alpha != 1)
{
this._bounds.alpha = 1;
}
else if(!this._overBounds && this._bounds.alpha != 0.9)
{
this._bounds.alpha = 0.9;
}
}
else if(this._overBounds && this._bounds.alpha != 0.6)
{
this._bounds.alpha = 0.6;
}
else if(!this._overBounds && this._bounds.alpha != 0.5)
{
this._bounds.alpha = 0.5;
}
}
}
}
@@ -0,0 +1,15 @@
package org.flixel.system.debug
{
import mx.core.BitmapAsset;
[Embed(source="/_assets/222_org.flixel.system.debug.Vis_ImgBounds.png")]
public class Vis_ImgBounds extends BitmapAsset
{
public function Vis_ImgBounds()
{
super();
}
}
}
@@ -0,0 +1,162 @@
package org.flixel.system.debug
{
import flash.display.Sprite;
import flash.geom.Rectangle;
import org.flixel.system.FlxWindow;
public class Watch extends FlxWindow
{
protected static const MAX_LOG_LINES:uint = 1024;
protected static const LINE_HEIGHT:uint = 15;
public var editing:Boolean;
protected var _names:Sprite;
protected var _values:Sprite;
protected var _watching:Array;
public function Watch(param1:String, param2:Number, param3:Number, param4:Boolean = true, param5:Rectangle = null, param6:uint = 2139062143, param7:uint = 2130706432)
{
super(param1,param2,param3,param4,param5,param6,param7);
this._names = new Sprite();
this._names.x = 2;
this._names.y = 15;
addChild(this._names);
this._values = new Sprite();
this._values.x = 2;
this._values.y = 15;
addChild(this._values);
this._watching = new Array();
this.editing = false;
this.removeAll();
}
override public function destroy() : void
{
removeChild(this._names);
this._names = null;
removeChild(this._values);
this._values = null;
var _loc1_:* = 0;
var _loc2_:uint = this._watching.length;
while(_loc1_ < _loc2_)
{
(this._watching[_loc1_++] as WatchEntry).destroy();
}
this._watching = null;
super.destroy();
}
public function add(param1:Object, param2:String, param3:String = null) : void
{
var _loc4_:WatchEntry = null;
var _loc5_:* = 0;
var _loc6_:uint = this._watching.length;
while(_loc5_ < _loc6_)
{
_loc4_ = this._watching[_loc5_++] as WatchEntry;
if(_loc4_.object == param1 && _loc4_.field == param2)
{
return;
}
}
_loc4_ = new WatchEntry(this._watching.length * LINE_HEIGHT,_width / 2,_width / 2 - 10,param1,param2,param3);
this._names.addChild(_loc4_.nameDisplay);
this._values.addChild(_loc4_.valueDisplay);
this._watching.push(_loc4_);
}
public function remove(param1:Object, param2:String = null) : void
{
var _loc3_:WatchEntry = null;
var _loc4_:* = int(this._watching.length - 1);
while(_loc4_ >= 0)
{
_loc3_ = this._watching[_loc4_];
if(_loc3_.object == param1 && (param2 == null || _loc3_.field == param2))
{
this._watching.splice(_loc4_,1);
this._names.removeChild(_loc3_.nameDisplay);
this._values.removeChild(_loc3_.valueDisplay);
_loc3_.destroy();
}
_loc4_--;
}
_loc3_ = null;
_loc4_ = 0;
var _loc5_:uint = this._watching.length;
while(_loc4_ < _loc5_)
{
(this._watching[_loc4_] as WatchEntry).setY(_loc4_ * LINE_HEIGHT);
_loc4_++;
}
}
public function removeAll() : void
{
var _loc1_:WatchEntry = null;
var _loc2_:int = 0;
var _loc3_:uint = this._watching.length;
while(_loc2_ < _loc3_)
{
_loc1_ = this._watching.pop();
this._names.removeChild(_loc1_.nameDisplay);
this._values.removeChild(_loc1_.valueDisplay);
_loc1_.destroy();
_loc2_++;
}
this._watching.length = 0;
}
public function update() : void
{
this.editing = false;
var _loc1_:uint = 0;
var _loc2_:uint = this._watching.length;
while(_loc1_ < _loc2_)
{
if(!(this._watching[_loc1_++] as WatchEntry).updateValue())
{
this.editing = true;
}
}
}
public function submit() : void
{
var _loc3_:WatchEntry = null;
var _loc1_:uint = 0;
var _loc2_:uint = this._watching.length;
while(_loc1_ < _loc2_)
{
_loc3_ = this._watching[_loc1_++] as WatchEntry;
if(_loc3_.editing)
{
_loc3_.submit();
}
}
this.editing = false;
}
override protected function updateSize() : void
{
if(_height < this._watching.length * LINE_HEIGHT + 17)
{
_height = this._watching.length * LINE_HEIGHT + 17;
}
super.updateSize();
this._values.x = _width / 2 + 2;
var _loc1_:* = 0;
var _loc2_:uint = this._watching.length;
while(_loc1_ < _loc2_)
{
(this._watching[_loc1_++] as WatchEntry).updateWidth(_width / 2,_width / 2 - 10);
}
}
}
}
@@ -0,0 +1,152 @@
package org.flixel.system.debug
{
import flash.events.KeyboardEvent;
import flash.events.MouseEvent;
import flash.text.TextField;
import flash.text.TextFieldType;
import flash.text.TextFormat;
import org.flixel.FlxU;
public class WatchEntry
{
public var object:Object;
public var field:String;
public var custom:String;
public var nameDisplay:TextField;
public var valueDisplay:TextField;
public var editing:Boolean;
public var oldValue:Object;
protected var _whiteText:TextFormat;
protected var _blackText:TextFormat;
public function WatchEntry(param1:Number, param2:Number, param3:Number, param4:Object, param5:String, param6:String = null)
{
super();
this.editing = false;
this.object = param4;
this.field = param5;
this.custom = param6;
this._whiteText = new TextFormat("Courier",12,16777215);
this._blackText = new TextFormat("Courier",12,0);
this.nameDisplay = new TextField();
this.nameDisplay.y = param1;
this.nameDisplay.multiline = false;
this.nameDisplay.selectable = true;
this.nameDisplay.defaultTextFormat = this._whiteText;
this.valueDisplay = new TextField();
this.valueDisplay.y = param1;
this.valueDisplay.height = 15;
this.valueDisplay.multiline = false;
this.valueDisplay.selectable = true;
this.valueDisplay.doubleClickEnabled = true;
this.valueDisplay.addEventListener(KeyboardEvent.KEY_UP,this.onKeyUp);
this.valueDisplay.addEventListener(MouseEvent.MOUSE_UP,this.onMouseUp);
this.valueDisplay.background = false;
this.valueDisplay.backgroundColor = 16777215;
this.valueDisplay.defaultTextFormat = this._whiteText;
this.updateWidth(param2,param3);
}
public function destroy() : void
{
this.object = null;
this.oldValue = null;
this.nameDisplay = null;
this.field = null;
this.custom = null;
this.valueDisplay.removeEventListener(MouseEvent.MOUSE_UP,this.onMouseUp);
this.valueDisplay.removeEventListener(KeyboardEvent.KEY_UP,this.onKeyUp);
this.valueDisplay = null;
}
public function setY(param1:Number) : void
{
this.nameDisplay.y = param1;
this.valueDisplay.y = param1;
}
public function updateWidth(param1:Number, param2:Number) : void
{
this.nameDisplay.width = param1;
this.valueDisplay.width = param2;
if(this.custom != null)
{
this.nameDisplay.text = this.custom;
}
else
{
this.nameDisplay.text = "";
if(param1 > 120)
{
this.nameDisplay.appendText(FlxU.getClassName(this.object,param1 < 240) + ".");
}
this.nameDisplay.appendText(this.field);
}
}
public function updateValue() : Boolean
{
if(this.editing)
{
return false;
}
this.valueDisplay.text = this.object[this.field].toString();
return true;
}
public function onMouseUp(param1:MouseEvent) : void
{
this.editing = true;
this.oldValue = this.object[this.field];
this.valueDisplay.type = TextFieldType.INPUT;
this.valueDisplay.setTextFormat(this._blackText);
this.valueDisplay.background = true;
}
public function onKeyUp(param1:KeyboardEvent) : void
{
if(param1.keyCode == 13 || param1.keyCode == 9 || param1.keyCode == 27)
{
if(param1.keyCode == 27)
{
this.cancel();
}
else
{
this.submit();
}
}
}
public function cancel() : void
{
this.valueDisplay.text = this.oldValue.toString();
this.doneEditing();
}
public function submit() : void
{
this.object[this.field] = this.valueDisplay.text;
this.doneEditing();
}
protected function doneEditing() : void
{
this.valueDisplay.type = TextFieldType.DYNAMIC;
this.valueDisplay.setTextFormat(this._whiteText);
this.valueDisplay.defaultTextFormat = this._whiteText;
this.valueDisplay.background = false;
this.editing = false;
}
}
}
@@ -0,0 +1,155 @@
package org.flixel.system.input
{
public class Input
{
internal var _lookup:Object;
internal var _map:Array;
internal const _total:uint = 256;
public function Input()
{
super();
this._lookup = new Object();
this._map = new Array(this._total);
}
public function update() : void
{
var _loc2_:Object = null;
var _loc1_:uint = 0;
while(_loc1_ < this._total)
{
_loc2_ = this._map[_loc1_++];
if(_loc2_ != null)
{
if(_loc2_.last == -1 && _loc2_.current == -1)
{
_loc2_.current = 0;
}
else if(_loc2_.last == 2 && _loc2_.current == 2)
{
_loc2_.current = 1;
}
_loc2_.last = _loc2_.current;
}
}
}
public function reset() : void
{
var _loc2_:Object = null;
var _loc1_:uint = 0;
while(_loc1_ < this._total)
{
_loc2_ = this._map[_loc1_++];
if(_loc2_ != null)
{
this[_loc2_.name] = false;
_loc2_.current = 0;
_loc2_.last = 0;
}
}
}
public function pressed(param1:String) : Boolean
{
return this[param1];
}
public function justPressed(param1:String) : Boolean
{
return this._map[this._lookup[param1]].current == 2;
}
public function unJustPressed(param1:String) : void
{
this._map[this._lookup[param1]].current = 1;
}
public function justReleased(param1:String) : Boolean
{
return this._map[this._lookup[param1]].current == -1;
}
public function record() : Array
{
var _loc3_:Object = null;
var _loc1_:Array = null;
var _loc2_:uint = 0;
while(_loc2_ < this._total)
{
_loc3_ = this._map[_loc2_++];
if(!(_loc3_ == null || _loc3_.current == 0))
{
if(_loc1_ == null)
{
_loc1_ = new Array();
}
_loc1_.push({
"code":_loc2_ - 1,
"value":_loc3_.current
});
}
}
return _loc1_;
}
public function playback(param1:Array) : void
{
var _loc4_:Object = null;
var _loc5_:Object = null;
var _loc2_:uint = 0;
var _loc3_:uint = param1.length;
while(_loc2_ < _loc3_)
{
_loc4_ = param1[_loc2_++];
_loc5_ = this._map[_loc4_.code];
_loc5_.current = _loc4_.value;
if(_loc4_.value > 0)
{
this[_loc5_.name] = true;
}
}
}
public function getKeyCode(param1:String) : int
{
return this._lookup[param1];
}
public function any() : Boolean
{
var _loc2_:Object = null;
var _loc1_:uint = 0;
while(_loc1_ < this._total)
{
_loc2_ = this._map[_loc1_++];
if(_loc2_ != null && _loc2_.current > 0)
{
return true;
}
}
return false;
}
protected function addKey(param1:String, param2:uint) : void
{
this._lookup[param1] = param2;
this._map[param2] = {
"name":param1,
"current":0,
"last":0
};
}
public function destroy() : void
{
this._lookup = null;
this._map = null;
}
}
}
@@ -0,0 +1,298 @@
package org.flixel.system.input
{
import flash.events.KeyboardEvent;
public class Keyboard extends Input
{
public var ESCAPE:Boolean;
public var F1:Boolean;
public var F2:Boolean;
public var F3:Boolean;
public var F4:Boolean;
public var F5:Boolean;
public var F6:Boolean;
public var F7:Boolean;
public var F8:Boolean;
public var F9:Boolean;
public var F10:Boolean;
public var F11:Boolean;
public var F12:Boolean;
public var ONE:Boolean;
public var TWO:Boolean;
public var THREE:Boolean;
public var FOUR:Boolean;
public var FIVE:Boolean;
public var SIX:Boolean;
public var SEVEN:Boolean;
public var EIGHT:Boolean;
public var NINE:Boolean;
public var ZERO:Boolean;
public var NUMPADONE:Boolean;
public var NUMPADTWO:Boolean;
public var NUMPADTHREE:Boolean;
public var NUMPADFOUR:Boolean;
public var NUMPADFIVE:Boolean;
public var NUMPADSIX:Boolean;
public var NUMPADSEVEN:Boolean;
public var NUMPADEIGHT:Boolean;
public var NUMPADNINE:Boolean;
public var NUMPADZERO:Boolean;
public var PAGEUP:Boolean;
public var PAGEDOWN:Boolean;
public var HOME:Boolean;
public var END:Boolean;
public var INSERT:Boolean;
public var MINUS:Boolean;
public var NUMPADMINUS:Boolean;
public var PLUS:Boolean;
public var NUMPADPLUS:Boolean;
public var DELETE:Boolean;
public var BACKSPACE:Boolean;
public var TAB:Boolean;
public var Q:Boolean;
public var W:Boolean;
public var E:Boolean;
public var R:Boolean;
public var T:Boolean;
public var Y:Boolean;
public var U:Boolean;
public var I:Boolean;
public var O:Boolean;
public var P:Boolean;
public var LBRACKET:Boolean;
public var RBRACKET:Boolean;
public var BACKSLASH:Boolean;
public var CAPSLOCK:Boolean;
public var A:Boolean;
public var S:Boolean;
public var D:Boolean;
public var F:Boolean;
public var G:Boolean;
public var H:Boolean;
public var J:Boolean;
public var K:Boolean;
public var L:Boolean;
public var SEMICOLON:Boolean;
public var QUOTE:Boolean;
public var ENTER:Boolean;
public var SHIFT:Boolean;
public var Z:Boolean;
public var X:Boolean;
public var C:Boolean;
public var V:Boolean;
public var B:Boolean;
public var N:Boolean;
public var M:Boolean;
public var COMMA:Boolean;
public var PERIOD:Boolean;
public var NUMPADPERIOD:Boolean;
public var SLASH:Boolean;
public var NUMPADSLASH:Boolean;
public var CONTROL:Boolean;
public var ALT:Boolean;
public var SPACE:Boolean;
public var UP:Boolean;
public var DOWN:Boolean;
public var LEFT:Boolean;
public var RIGHT:Boolean;
public function Keyboard()
{
var _loc1_:uint = 0;
super();
_loc1_ = 65;
while(_loc1_ <= 90)
{
addKey(String.fromCharCode(_loc1_),_loc1_++);
}
_loc1_ = 48;
addKey("ZERO",_loc1_++);
addKey("ONE",_loc1_++);
addKey("TWO",_loc1_++);
addKey("THREE",_loc1_++);
addKey("FOUR",_loc1_++);
addKey("FIVE",_loc1_++);
addKey("SIX",_loc1_++);
addKey("SEVEN",_loc1_++);
addKey("EIGHT",_loc1_++);
addKey("NINE",_loc1_++);
_loc1_ = 96;
addKey("NUMPADZERO",_loc1_++);
addKey("NUMPADONE",_loc1_++);
addKey("NUMPADTWO",_loc1_++);
addKey("NUMPADTHREE",_loc1_++);
addKey("NUMPADFOUR",_loc1_++);
addKey("NUMPADFIVE",_loc1_++);
addKey("NUMPADSIX",_loc1_++);
addKey("NUMPADSEVEN",_loc1_++);
addKey("NUMPADEIGHT",_loc1_++);
addKey("NUMPADNINE",_loc1_++);
addKey("PAGEUP",33);
addKey("PAGEDOWN",34);
addKey("HOME",36);
addKey("END",35);
addKey("INSERT",45);
_loc1_ = 1;
while(_loc1_ <= 12)
{
addKey("F" + _loc1_,111 + _loc1_++);
}
addKey("ESCAPE",27);
addKey("MINUS",189);
addKey("NUMPADMINUS",109);
addKey("PLUS",187);
addKey("NUMPADPLUS",107);
addKey("DELETE",46);
addKey("BACKSPACE",8);
addKey("LBRACKET",219);
addKey("RBRACKET",221);
addKey("BACKSLASH",220);
addKey("CAPSLOCK",20);
addKey("SEMICOLON",186);
addKey("QUOTE",222);
addKey("ENTER",13);
addKey("SHIFT",16);
addKey("COMMA",188);
addKey("PERIOD",190);
addKey("NUMPADPERIOD",110);
addKey("SLASH",191);
addKey("NUMPADSLASH",191);
addKey("CONTROL",17);
addKey("ALT",18);
addKey("SPACE",32);
addKey("UP",38);
addKey("DOWN",40);
addKey("LEFT",37);
addKey("RIGHT",39);
addKey("TAB",9);
}
public function handleKeyDown(param1:KeyboardEvent) : void
{
var _loc2_:Object = _map[param1.keyCode];
if(_loc2_ == null)
{
return;
}
if(_loc2_.current > 0)
{
_loc2_.current = 1;
}
else
{
_loc2_.current = 2;
}
this[_loc2_.name] = true;
}
public function handleKeyUp(param1:KeyboardEvent) : void
{
var _loc2_:Object = _map[param1.keyCode];
if(_loc2_ == null)
{
return;
}
if(_loc2_.current > 0)
{
_loc2_.current = -1;
}
else
{
_loc2_.current = 0;
}
this[_loc2_.name] = false;
}
}
}
@@ -0,0 +1,243 @@
package org.flixel.system.input
{
import flash.display.Bitmap;
import flash.display.Sprite;
import flash.events.MouseEvent;
import org.flixel.FlxCamera;
import org.flixel.FlxG;
import org.flixel.FlxPoint;
import org.flixel.system.replay.MouseRecord;
public class Mouse extends FlxPoint
{
protected var ImgDefaultCursor:Class = Mouse_ImgDefaultCursor;
public var wheel:int;
public var screenX:int;
public var screenY:int;
protected var _current:int;
protected var _last:int;
protected var _cursorContainer:Sprite;
protected var _cursor:Bitmap;
protected var _lastX:int;
protected var _lastY:int;
protected var _lastWheel:int;
protected var _point:FlxPoint;
protected var _screenPosition:FlxPoint;
public function Mouse(param1:Sprite)
{
super();
this._cursorContainer = param1;
this._lastX = this.screenX = 0;
this._lastY = this.screenY = 0;
this._lastWheel = this.wheel = 0;
this._current = 0;
this._last = 0;
this._cursor = null;
this._point = new FlxPoint();
this._screenPosition = new FlxPoint();
}
public function destroy() : void
{
this._cursorContainer = null;
this._cursor = null;
this._point = null;
this._screenPosition = null;
}
public function show(param1:Class = null, param2:Number = 1, param3:int = 0, param4:int = 0) : void
{
this._cursorContainer.visible = true;
if(param1 != null)
{
this.load(param1,param2,param3,param4);
}
else if(this._cursor == null)
{
this.load();
}
}
public function hide() : void
{
this._cursorContainer.visible = false;
}
public function get visible() : Boolean
{
return this._cursorContainer.visible;
}
public function load(param1:Class = null, param2:Number = 1, param3:int = 0, param4:int = 0) : void
{
if(this._cursor != null)
{
this._cursorContainer.removeChild(this._cursor);
}
if(param1 == null)
{
param1 = this.ImgDefaultCursor;
}
this._cursor = new param1();
this._cursor.x = param3;
this._cursor.y = param4;
this._cursor.scaleX = param2;
this._cursor.scaleY = param2;
this._cursorContainer.addChild(this._cursor);
}
public function unload() : void
{
if(this._cursor != null)
{
if(this._cursorContainer.visible)
{
this.load();
}
else
{
this._cursorContainer.removeChild(this._cursor);
this._cursor = null;
}
}
}
public function update(param1:int, param2:int) : void
{
this._screenPosition.make(param1,param2);
this.getScreenPosition(null,this._point);
this.screenX = this._point.x;
this.screenY = this._point.y;
this.updateCursor();
if(this._last == -1 && this._current == -1)
{
this._current = 0;
}
else if(this._last == 2 && this._current == 2)
{
this._current = 1;
}
this._last = this._current;
}
protected function updateCursor() : void
{
this.getWorldPosition(null,this);
this._cursorContainer.x = this._screenPosition.x;
this._cursorContainer.y = this._screenPosition.y;
}
public function getWorldPosition(param1:FlxCamera = null, param2:FlxPoint = null) : FlxPoint
{
if(param1 == null)
{
param1 = FlxG.camera;
}
if(param2 == null)
{
param2 = new FlxPoint();
}
this.getScreenPosition(param1,this._point);
return param2.make(this._point.x + param1.scroll.x,this._point.y + param1.scroll.y);
}
public function getScreenPosition(param1:FlxCamera = null, param2:FlxPoint = null) : FlxPoint
{
if(param1 == null)
{
param1 = FlxG.camera;
}
if(param2 == null)
{
param2 = new FlxPoint();
}
return param2.make(this._screenPosition.x / param1.zoom,this._screenPosition.y / param1.zoom);
}
public function reset() : void
{
this._current = 0;
this._last = 0;
}
public function pressed() : Boolean
{
return this._current > 0;
}
public function justPressed() : Boolean
{
return this._current == 2;
}
public function justReleased() : Boolean
{
return this._current == -1;
}
public function handleMouseDown(param1:MouseEvent) : void
{
if(this._current > 0)
{
this._current = 1;
}
else
{
this._current = 2;
}
}
public function handleMouseUp(param1:MouseEvent) : void
{
if(this._current > 0)
{
this._current = -1;
}
else
{
this._current = 0;
}
}
public function handleMouseWheel(param1:MouseEvent) : void
{
this.wheel = param1.delta;
}
public function record() : MouseRecord
{
if(this._lastX == this.screenX && this._lastY == this.screenY && this._current == 0 && this._lastWheel == this.wheel)
{
return null;
}
this._lastX = this.screenX;
this._lastY = this.screenY;
this._lastWheel = this.wheel;
return new MouseRecord(this.screenX,this.screenY,this._current,this.wheel);
}
public function playback(param1:MouseRecord) : void
{
this.screenX = param1.x;
this.screenY = param1.y;
this._current = param1.button;
this.wheel = param1.wheel;
this.updateCursor();
}
}
}
@@ -0,0 +1,15 @@
package org.flixel.system.input
{
import mx.core.BitmapAsset;
[Embed(source="/_assets/181_org.flixel.system.input.Mouse_ImgDefaultCursor.png")]
public class Mouse_ImgDefaultCursor extends BitmapAsset
{
public function Mouse_ImgDefaultCursor()
{
super();
}
}
}
@@ -0,0 +1,105 @@
package org.flixel.system.replay
{
public class FrameRecord
{
public var frame:int;
public var keys:Array;
public var mouse:MouseRecord;
public function FrameRecord()
{
super();
this.frame = 0;
this.keys = null;
this.mouse = null;
}
public function create(param1:Number, param2:Array = null, param3:MouseRecord = null) : FrameRecord
{
this.frame = param1;
this.keys = param2;
this.mouse = param3;
return this;
}
public function destroy() : void
{
this.keys = null;
this.mouse = null;
}
public function save() : String
{
var _loc2_:Object = null;
var _loc3_:uint = 0;
var _loc4_:uint = 0;
var _loc1_:String = this.frame + "k";
if(this.keys != null)
{
_loc3_ = 0;
_loc4_ = this.keys.length;
while(_loc3_ < _loc4_)
{
if(_loc3_ > 0)
{
_loc1_ += ",";
}
_loc2_ = this.keys[_loc3_++];
_loc1_ += _loc2_.code + ":" + _loc2_.value;
}
}
_loc1_ += "m";
if(this.mouse != null)
{
_loc1_ += this.mouse.x + "," + this.mouse.y + "," + this.mouse.button + "," + this.mouse.wheel;
}
return _loc1_;
}
public function load(param1:String) : FrameRecord
{
var _loc2_:uint = 0;
var _loc3_:uint = 0;
var _loc7_:Array = null;
var _loc4_:Array = param1.split("k");
this.frame = int(_loc4_[0] as String);
_loc4_ = (_loc4_[1] as String).split("m");
var _loc5_:String = _loc4_[0];
var _loc6_:String = _loc4_[1];
if(_loc5_.length > 0)
{
_loc4_ = _loc5_.split(",");
_loc2_ = 0;
_loc3_ = _loc4_.length;
while(_loc2_ < _loc3_)
{
_loc7_ = (_loc4_[_loc2_++] as String).split(":");
if(_loc7_.length == 2)
{
if(this.keys == null)
{
this.keys = new Array();
}
this.keys.push({
"code":int(_loc7_[0] as String),
"value":int(_loc7_[1] as String)
});
}
}
}
if(_loc6_.length > 0)
{
_loc4_ = _loc6_.split(",");
if(_loc4_.length >= 4)
{
this.mouse = new MouseRecord(int(_loc4_[0] as String),int(_loc4_[1] as String),int(_loc4_[2] as String),int(_loc4_[3] as String));
}
}
return this;
}
}
}
@@ -0,0 +1,24 @@
package org.flixel.system.replay
{
public class MouseRecord
{
public var x:int;
public var y:int;
public var button:int;
public var wheel:int;
public function MouseRecord(param1:int, param2:int, param3:int, param4:int)
{
super();
this.x = param1;
this.y = param2;
this.button = param3;
this.wheel = param4;
}
}
}