Section 1
//BitmapAsset (mx.core.BitmapAsset)
package mx.core {
import flash.display.*;
public class BitmapAsset extends FlexBitmap implements IFlexAsset, IFlexDisplayObject {
mx_internal static const VERSION:String = "3.3.0.4852";
public function BitmapAsset(_arg1:BitmapData=null, _arg2:String="auto", _arg3:Boolean=false){
super(_arg1, _arg2, _arg3);
}
public function get measuredWidth():Number{
if (bitmapData){
return (bitmapData.width);
};
return (0);
}
public function get measuredHeight():Number{
if (bitmapData){
return (bitmapData.height);
};
return (0);
}
public function setActualSize(_arg1:Number, _arg2:Number):void{
width = _arg1;
height = _arg2;
}
public function move(_arg1:Number, _arg2:Number):void{
this.x = _arg1;
this.y = _arg2;
}
}
}//package mx.core
Section 2
//FlexBitmap (mx.core.FlexBitmap)
package mx.core {
import flash.display.*;
import mx.utils.*;
public class FlexBitmap extends Bitmap {
mx_internal static const VERSION:String = "3.3.0.4852";
public function FlexBitmap(_arg1:BitmapData=null, _arg2:String="auto", _arg3:Boolean=false){
var bitmapData = _arg1;
var pixelSnapping = _arg2;
var smoothing = _arg3;
super(bitmapData, pixelSnapping, smoothing);
try {
name = NameUtil.createUniqueName(this);
} catch(e:Error) {
};
}
override public function toString():String{
return (NameUtil.displayObjectToString(this));
}
}
}//package mx.core
Section 3
//FontAsset (mx.core.FontAsset)
package mx.core {
import flash.text.*;
public class FontAsset extends Font implements IFlexAsset {
mx_internal static const VERSION:String = "3.3.0.4852";
}
}//package mx.core
Section 4
//IFlexAsset (mx.core.IFlexAsset)
package mx.core {
public interface IFlexAsset {
}
}//package mx.core
Section 5
//IFlexDisplayObject (mx.core.IFlexDisplayObject)
package mx.core {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.accessibility.*;
public interface IFlexDisplayObject extends IBitmapDrawable, IEventDispatcher {
function get visible():Boolean;
function get rotation():Number;
function localToGlobal(_arg1:Point):Point;
function get name():String;
function set width(_arg1:Number):void;
function get measuredHeight():Number;
function get blendMode():String;
function get scale9Grid():Rectangle;
function set name(_arg1:String):void;
function set scaleX(_arg1:Number):void;
function set scaleY(_arg1:Number):void;
function get measuredWidth():Number;
function get accessibilityProperties():AccessibilityProperties;
function set scrollRect(_arg1:Rectangle):void;
function get cacheAsBitmap():Boolean;
function globalToLocal(_arg1:Point):Point;
function get height():Number;
function set blendMode(_arg1:String):void;
function get parent():DisplayObjectContainer;
function getBounds(_arg1:DisplayObject):Rectangle;
function get opaqueBackground():Object;
function set scale9Grid(_arg1:Rectangle):void;
function setActualSize(_arg1:Number, _arg2:Number):void;
function set alpha(_arg1:Number):void;
function set accessibilityProperties(_arg1:AccessibilityProperties):void;
function get width():Number;
function hitTestPoint(_arg1:Number, _arg2:Number, _arg3:Boolean=false):Boolean;
function set cacheAsBitmap(_arg1:Boolean):void;
function get scaleX():Number;
function get scaleY():Number;
function get scrollRect():Rectangle;
function get mouseX():Number;
function get mouseY():Number;
function set height(_arg1:Number):void;
function set mask(_arg1:DisplayObject):void;
function getRect(_arg1:DisplayObject):Rectangle;
function get alpha():Number;
function set transform(_arg1:Transform):void;
function move(_arg1:Number, _arg2:Number):void;
function get loaderInfo():LoaderInfo;
function get root():DisplayObject;
function hitTestObject(_arg1:DisplayObject):Boolean;
function set opaqueBackground(_arg1:Object):void;
function set visible(_arg1:Boolean):void;
function get mask():DisplayObject;
function set x(_arg1:Number):void;
function set y(_arg1:Number):void;
function get transform():Transform;
function set filters(_arg1:Array):void;
function get x():Number;
function get y():Number;
function get filters():Array;
function set rotation(_arg1:Number):void;
function get stage():Stage;
}
}//package mx.core
Section 6
//IRepeaterClient (mx.core.IRepeaterClient)
package mx.core {
public interface IRepeaterClient {
function get instanceIndices():Array;
function set instanceIndices(_arg1:Array):void;
function get isDocument():Boolean;
function set repeaters(_arg1:Array):void;
function initializeRepeaterArrays(_arg1:IRepeaterClient):void;
function get repeaters():Array;
function set repeaterIndices(_arg1:Array):void;
function get repeaterIndices():Array;
}
}//package mx.core
Section 7
//mx_internal (mx.core.mx_internal)
package mx.core {
public namespace mx_internal = "http://www.adobe.com/2006/flex/mx/internal";
}//package mx.core
Section 8
//SoundAsset (mx.core.SoundAsset)
package mx.core {
import flash.media.*;
public class SoundAsset extends Sound implements IFlexAsset {
mx_internal static const VERSION:String = "3.3.0.4852";
}
}//package mx.core
Section 9
//NameUtil (mx.utils.NameUtil)
package mx.utils {
import flash.display.*;
import mx.core.*;
import flash.utils.*;
public class NameUtil {
mx_internal static const VERSION:String = "3.3.0.4852";
private static var counter:int = 0;
public static function displayObjectToString(_arg1:DisplayObject):String{
var result:String;
var o:DisplayObject;
var s:String;
var indices:Array;
var displayObject = _arg1;
try {
o = displayObject;
while (o != null) {
if (((((o.parent) && (o.stage))) && ((o.parent == o.stage)))){
break;
};
s = o.name;
if ((o is IRepeaterClient)){
indices = IRepeaterClient(o).instanceIndices;
if (indices){
s = (s + (("[" + indices.join("][")) + "]"));
};
};
result = ((result == null)) ? s : ((s + ".") + result);
o = o.parent;
};
} catch(e:SecurityError) {
};
return (result);
}
public static function createUniqueName(_arg1:Object):String{
if (!_arg1){
return (null);
};
var _local2:String = getQualifiedClassName(_arg1);
var _local3:int = _local2.indexOf("::");
if (_local3 != -1){
_local2 = _local2.substr((_local3 + 2));
};
var _local4:int = _local2.charCodeAt((_local2.length - 1));
if ((((_local4 >= 48)) && ((_local4 <= 57)))){
_local2 = (_local2 + "_");
};
return ((_local2 + counter++));
}
}
}//package mx.utils
Section 10
//FlxAnim (org.flixel.data.FlxAnim)
package org.flixel.data {
public class FlxAnim {
public var delay:Number;
public var frames:Array;
public var looped:Boolean;
public var name:String;
public function FlxAnim(_arg1:String, _arg2:Array, _arg3:Number=0, _arg4:Boolean=true){
name = _arg1;
delay = 0;
if (_arg3 > 0){
delay = (1 / _arg3);
};
frames = _arg2;
looped = _arg4;
}
}
}//package org.flixel.data
Section 11
//FlxConsole (org.flixel.data.FlxConsole)
package org.flixel.data {
import org.flixel.*;
import flash.display.*;
import flash.text.*;
public class FlxConsole extends Sprite {
protected const MAX_CONSOLE_LINES:uint = 0x0100;
protected var _lines:Array;
public var lastElapsed:Number;
protected var _text:TextField;
protected var _fpsUpdate:Boolean;
protected var _console:Sprite;
protected var _Y:Number;
protected var _curFPS:uint;
protected var _fps:Array;
protected var _bx:int;
protected var _by:int;
protected var _fpsDisplay:TextField;
protected var _YT:Number;
protected var _byt:int;
public function FlxConsole(_arg1:uint, _arg2:uint, _arg3:uint){
visible = false;
x = (_arg1 * _arg3);
_by = (_arg2 * _arg3);
_byt = (_by - (FlxG.height * _arg3));
_YT = (_Y = (y = _byt));
var _local4:Bitmap = new Bitmap(new BitmapData((FlxG.width * _arg3), (FlxG.height * _arg3), true, 2130706432));
addChild(_local4);
_fps = new Array(8);
_curFPS = 0;
_fpsUpdate = true;
_text = new TextField();
_text.width = _local4.width;
_text.height = _local4.height;
_text.multiline = true;
_text.wordWrap = true;
_text.embedFonts = true;
_text.antiAliasType = AntiAliasType.NORMAL;
_text.gridFitType = GridFitType.PIXEL;
_text.defaultTextFormat = new TextFormat("system", 8, 0xFFFFFF);
addChild(_text);
_fpsDisplay = new TextField();
_fpsDisplay.width = _local4.width;
_fpsDisplay.height = 20;
_fpsDisplay.multiline = true;
_fpsDisplay.wordWrap = true;
_fpsDisplay.embedFonts = true;
_fpsDisplay.antiAliasType = AntiAliasType.NORMAL;
_fpsDisplay.gridFitType = GridFitType.PIXEL;
_fpsDisplay.defaultTextFormat = new TextFormat("system", 16, 0xFFFFFF, true, null, null, null, null, "right");
addChild(_fpsDisplay);
_lines = new Array();
}
public function log(_arg1:String):void{
var _local2:String;
var _local3:uint;
if (_arg1 == null){
_arg1 = "NULL";
};
trace(_arg1);
_lines.push(_arg1);
if (_lines.length > MAX_CONSOLE_LINES){
_lines.shift();
_local2 = "";
_local3 = 0;
while (_local3 < _lines.length) {
_local2 = (_local2 + (_lines[_local3] + "\n"));
_local3++;
};
_text.text = _local2;
} else {
_text.appendText((_arg1 + "\n"));
};
_text.scrollV = _text.height;
}
public function update():void{
var _local1:uint;
var _local2:uint;
if (visible){
_fps[_curFPS] = (1 / lastElapsed);
if (++_curFPS >= _fps.length){
_curFPS = 0;
};
_fpsUpdate = !(_fpsUpdate);
if (_fpsUpdate){
_local1 = 0;
_local2 = 0;
while (_local2 < _fps.length) {
_local1 = (_local1 + _fps[_local2]);
_local2++;
};
_fpsDisplay.text = (Math.floor((_local1 / _fps.length)) + " fps");
};
};
if (_Y < _YT){
_Y = (_Y + ((FlxG.height * 10) * FlxG.elapsed));
} else {
if (_Y > _YT){
_Y = (_Y - ((FlxG.height * 10) * FlxG.elapsed));
};
};
if (_Y > _by){
_Y = _by;
} else {
if (_Y < _byt){
_Y = _byt;
visible = false;
};
};
y = Math.floor(_Y);
}
public function toggle():void{
if (_YT == _by){
_YT = _byt;
} else {
_YT = _by;
visible = true;
};
}
}
}//package org.flixel.data
Section 12
//FlxFade (org.flixel.data.FlxFade)
package org.flixel.data {
import org.flixel.*;
public class FlxFade extends FlxSprite {
protected var _delay:Number;
protected var _complete:Function;
public function FlxFade(){
createGraphic(FlxG.width, FlxG.height, 0, true);
scrollFactor.x = 0;
scrollFactor.y = 0;
exists = false;
}
override public function update():void{
alpha = (alpha + (FlxG.elapsed / _delay));
if (alpha >= 1){
alpha = 1;
if (_complete != null){
_complete();
};
};
}
public function start(_arg1:uint=4278190080, _arg2:Number=1, _arg3:Function=null, _arg4:Boolean=false):void{
if (((!(_arg4)) && (exists))){
return;
};
fill(_arg1);
_delay = _arg2;
_complete = _arg3;
alpha = 0;
exists = true;
}
public function stop():void{
exists = false;
}
}
}//package org.flixel.data
Section 13
//FlxFlash (org.flixel.data.FlxFlash)
package org.flixel.data {
import org.flixel.*;
public class FlxFlash extends FlxSprite {
protected var _delay:Number;
protected var _complete:Function;
public function FlxFlash(){
createGraphic(FlxG.width, FlxG.height, 0, true);
scrollFactor.x = 0;
scrollFactor.y = 0;
exists = false;
}
override public function update():void{
alpha = (alpha - (FlxG.elapsed / _delay));
if (alpha <= 0){
exists = false;
if (_complete != null){
_complete();
};
};
}
public function start(_arg1:uint=4294967295, _arg2:Number=1, _arg3:Function=null, _arg4:Boolean=false):void{
if (((!(_arg4)) && (exists))){
return;
};
fill(_arg1);
_delay = _arg2;
_complete = _arg3;
alpha = 1;
exists = true;
}
public function stop():void{
exists = false;
}
}
}//package org.flixel.data
Section 14
//FlxKeyboard (org.flixel.data.FlxKeyboard)
package org.flixel.data {
import flash.events.*;
public class FlxKeyboard {
protected const _t:uint = 0x0100;
public var RIGHT:Boolean;
public var LEFT:Boolean;
public var FOUR:Boolean;
public var TWO:Boolean;
public var CONTROL:Boolean;
public var A:Boolean;
public var B:Boolean;
public var C:Boolean;
public var D:Boolean;
public var E:Boolean;
public var ONE:Boolean;
public var G:Boolean;
public var H:Boolean;
public var I:Boolean;
public var J:Boolean;
public var K:Boolean;
public var F:Boolean;
public var N:Boolean;
public var O:Boolean;
public var Q:Boolean;
public var R:Boolean;
public var S:Boolean;
public var T:Boolean;
public var U:Boolean;
public var MINUS:Boolean;
public var Y:Boolean;
public var L:Boolean;
public var Z:Boolean;
public var QUOTE:Boolean;
public var V:Boolean;
public var X:Boolean;
public var P:Boolean;
public var SHIFT:Boolean;
public var SLASH:Boolean;
public var BACKSPACE:Boolean;
public var EIGHT:Boolean;
public var W:Boolean;
public var M:Boolean;
public var THREE:Boolean;
public var ESCAPE:Boolean;
public var SEMICOLON:Boolean;
public var CAPSLOCK:Boolean;
protected var _lookup:Object;
public var PLUS:Boolean;
protected var _map:Array;
public var ZERO:Boolean;
public var DOWN: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 NINE:Boolean;
public var F9:Boolean;
public var ALT:Boolean;
public var F8:Boolean;
public var DELETE:Boolean;
public var LBRACKET:Boolean;
public var UP:Boolean;
public var ENTER:Boolean;
public var FIVE:Boolean;
public var SIX:Boolean;
public var COMMA:Boolean;
public var PERIOD:Boolean;
public var BACKSLASH:Boolean;
public var F10:Boolean;
public var F11:Boolean;
public var F12:Boolean;
public var SEVEN:Boolean;
public var SPACE:Boolean;
public var RBRACKET:Boolean;
public function FlxKeyboard(){
var _local1:uint;
_lookup = new Object();
_map = new Array(_t);
_local1 = 65;
while (_local1 <= 90) {
addKey(String.fromCharCode(_local1), _local1);
_local1++;
};
_local1 = 48;
var _temp1 = _local1;
_local1 = (_local1 + 1);
addKey("ZERO", _temp1);
var _temp2 = _local1;
_local1 = (_local1 + 1);
addKey("ONE", _temp2);
var _temp3 = _local1;
_local1 = (_local1 + 1);
addKey("TWO", _temp3);
var _temp4 = _local1;
_local1 = (_local1 + 1);
addKey("THREE", _temp4);
var _temp5 = _local1;
_local1 = (_local1 + 1);
addKey("FOUR", _temp5);
var _temp6 = _local1;
_local1 = (_local1 + 1);
addKey("FIVE", _temp6);
var _temp7 = _local1;
_local1 = (_local1 + 1);
addKey("SIX", _temp7);
var _temp8 = _local1;
_local1 = (_local1 + 1);
addKey("SEVEN", _temp8);
var _temp9 = _local1;
_local1 = (_local1 + 1);
addKey("EIGHT", _temp9);
var _temp10 = _local1;
_local1 = (_local1 + 1);
addKey("NINE", _temp10);
_local1 = 1;
while (_local1 <= 12) {
addKey(("F" + _local1), (111 + _local1));
_local1++;
};
addKey("ESCAPE", 27);
addKey("MINUS", 189);
addKey("PLUS", 187);
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("SLASH", 191);
addKey("CONTROL", 17);
addKey("ALT", 18);
addKey("SPACE", 32);
addKey("UP", 38);
addKey("DOWN", 40);
addKey("LEFT", 37);
addKey("RIGHT", 39);
}
public function handleKeyUp(_arg1:KeyboardEvent):void{
var _local2:Object = _map[_arg1.keyCode];
if (_local2 == null){
return;
};
if (_local2.current > 0){
_local2.current = -1;
} else {
_local2.current = 0;
};
this[_local2.name] = false;
}
public function pressed(_arg1:String):Boolean{
return (this[_arg1]);
}
public function justReleased(_arg1:String):Boolean{
return ((_map[_lookup[_arg1]].current == -1));
}
public function handleKeyDown(_arg1:KeyboardEvent):void{
var _local2:Object = _map[_arg1.keyCode];
if (_local2 == null){
return;
};
if (_local2.current > 0){
_local2.current = 1;
} else {
_local2.current = 2;
};
this[_local2.name] = true;
}
public function reset():void{
var _local2:Object;
var _local1:uint;
while (_local1 < _t) {
if (_map[_local1] == null){
} else {
_local2 = _map[_local1];
this[_local2.name] = false;
_local2.current = 0;
_local2.last = 0;
};
_local1++;
};
}
public function justPressed(_arg1:String):Boolean{
return ((_map[_lookup[_arg1]].current == 2));
}
public function update():void{
var _local2:Object;
var _local1:uint;
while (_local1 < _t) {
if (_map[_local1] == null){
} else {
_local2 = _map[_local1];
if ((((_local2.last == -1)) && ((_local2.current == -1)))){
_local2.current = 0;
} else {
if ((((_local2.last == 2)) && ((_local2.current == 2)))){
_local2.current = 1;
};
};
_local2.last = _local2.current;
};
_local1++;
};
}
protected function addKey(_arg1:String, _arg2:uint):void{
_lookup[_arg1] = _arg2;
_map[_arg2] = {name:_arg1, current:0, last:0};
}
}
}//package org.flixel.data
Section 15
//FlxKong (org.flixel.data.FlxKong)
package org.flixel.data {
import flash.events.*;
import flash.display.*;
import flash.net.*;
public class FlxKong extends Sprite {
public var API;
public function FlxKong(){
API = null;
}
public function init():void{
var _local1:Object = LoaderInfo(root.loaderInfo).parameters;
var _local2:String = ((_local1.api_path) || ("http://www.kongregate.com/flash/API_AS3_Local.swf"));
var _local3:URLRequest = new URLRequest(_local2);
var _local4:Loader = new Loader();
_local4.contentLoaderInfo.addEventListener(Event.COMPLETE, APILoaded);
_local4.load(_local3);
this.addChild(_local4);
}
protected function APILoaded(_arg1:Event):void{
API = _arg1.target.content;
API.services.connect();
}
}
}//package org.flixel.data
Section 16
//FlxList (org.flixel.data.FlxList)
package org.flixel.data {
import org.flixel.*;
public class FlxList {
public var next:FlxList;
public var object:FlxObject;
public function FlxList(){
object = null;
next = null;
}
}
}//package org.flixel.data
Section 17
//FlxMouse (org.flixel.data.FlxMouse)
package org.flixel.data {
import org.flixel.*;
import flash.events.*;
public class FlxMouse {
protected var ImgDefaultCursor:Class;
protected var _out:Boolean;
public var cursor:FlxSprite;
public var screenY:int;
protected var _last:int;
public var x:int;
public var y:int;
protected var _current:int;
public var screenX:int;
public function FlxMouse(){
ImgDefaultCursor = FlxMouse_ImgDefaultCursor;
super();
x = 0;
y = 0;
screenX = 0;
screenY = 0;
_current = 0;
_last = 0;
cursor = null;
_out = false;
}
public function hide():void{
if (cursor != null){
cursor.visible = false;
_out = false;
};
}
public function update(_arg1:int, _arg2:int, _arg3:Number, _arg4:Number):void{
screenX = _arg1;
screenY = _arg2;
x = (screenX - FlxU.floor(_arg3));
y = (screenY - FlxU.floor(_arg4));
if (cursor != null){
cursor.x = x;
cursor.y = y;
};
if ((((_last == -1)) && ((_current == -1)))){
_current = 0;
} else {
if ((((_last == 2)) && ((_current == 2)))){
_current = 1;
};
};
_last = _current;
}
public function reset():void{
_current = 0;
_last = 0;
}
public function justReleased():Boolean{
return ((_current == -1));
}
public function handleMouseOver(_arg1:MouseEvent):void{
if (cursor != null){
cursor.visible = _out;
};
}
public function handleMouseDown(_arg1:MouseEvent):void{
if (_current > 0){
_current = 1;
} else {
_current = 2;
};
}
public function pressed():Boolean{
return ((_current > 0));
}
public function justPressed():Boolean{
return ((_current == 2));
}
public function load(_arg1:Class, _arg2:int=0, _arg3:int=0):void{
if (_arg1 == null){
_arg1 = ImgDefaultCursor;
};
cursor = new FlxSprite(screenX, screenY, _arg1);
cursor.offset.x = _arg2;
cursor.offset.y = _arg3;
}
public function handleMouseUp(_arg1:MouseEvent):void{
if (_current > 0){
_current = -1;
} else {
_current = 0;
};
}
public function handleMouseOut(_arg1:MouseEvent):void{
if (cursor != null){
_out = cursor.visible;
cursor.visible = false;
};
}
public function show(_arg1:Class=null, _arg2:int=0, _arg3:int=0):void{
_out = true;
if (_arg1 != null){
load(_arg1, _arg2, _arg3);
} else {
if (cursor != null){
cursor.visible = true;
} else {
load(null);
};
};
}
public function unload():void{
if (cursor != null){
if (cursor.visible){
load(null);
} else {
cursor = null;
};
};
}
}
}//package org.flixel.data
Section 18
//FlxMouse_ImgDefaultCursor (org.flixel.data.FlxMouse_ImgDefaultCursor)
package org.flixel.data {
import mx.core.*;
public class FlxMouse_ImgDefaultCursor extends BitmapAsset {
}
}//package org.flixel.data
Section 19
//FlxPanel (org.flixel.data.FlxPanel)
package org.flixel.data {
import org.flixel.*;
import flash.ui.*;
public class FlxPanel extends FlxObject {
protected var _close:FlxButton;
protected var _digg:FlxButton;
protected var _gameTitle:String;
protected var _closed:Boolean;
protected var _payPalID:String;
protected var _donate:FlxButton;
private var ImgClose:Class;
protected var _topBar:FlxSprite;
protected var _ty:Number;
protected var _caption:FlxText;
protected var _initialized:Boolean;
protected var _twitter:FlxButton;
protected var _delicious:FlxButton;
protected var _stumble:FlxButton;
private var ImgDelicious:Class;
private var ImgTwitter:Class;
protected var _mainBar:FlxSprite;
protected var _gameURL:String;
private var ImgStumble:Class;
private var ImgReddit:Class;
private var ImgDigg:Class;
protected var _bottomBar:FlxSprite;
protected var _payPalAmount:Number;
protected var _s:Number;
private var ImgDonate:Class;
protected var _reddit:FlxButton;
public function FlxPanel(){
ImgDonate = FlxPanel_ImgDonate;
ImgStumble = FlxPanel_ImgStumble;
ImgDigg = FlxPanel_ImgDigg;
ImgReddit = FlxPanel_ImgReddit;
ImgDelicious = FlxPanel_ImgDelicious;
ImgTwitter = FlxPanel_ImgTwitter;
ImgClose = FlxPanel_ImgClose;
super();
y = -21;
_ty = y;
_closed = false;
_initialized = false;
_topBar = new FlxSprite();
_topBar.createGraphic(FlxG.width, 1, 2147483647);
_topBar.scrollFactor.x = 0;
_topBar.scrollFactor.y = 0;
_mainBar = new FlxSprite();
_mainBar.createGraphic(FlxG.width, 19, 2130706432);
_mainBar.scrollFactor.x = 0;
_mainBar.scrollFactor.y = 0;
_bottomBar = new FlxSprite();
_bottomBar.createGraphic(FlxG.width, 1, 2147483647);
_bottomBar.scrollFactor.x = 0;
_bottomBar.scrollFactor.y = 0;
_donate = new FlxButton(3, 0, onDonate);
_donate.loadGraphic(new FlxSprite(0, 0, ImgDonate));
_donate.scrollFactor.x = 0;
_donate.scrollFactor.y = 0;
_stumble = new FlxButton(((((((FlxG.width / 2) - 6) - 13) - 6) - 13) - 6), 0, onStumble);
_stumble.loadGraphic(new FlxSprite(0, 0, ImgStumble));
_stumble.scrollFactor.x = 0;
_stumble.scrollFactor.y = 0;
_digg = new FlxButton(((((FlxG.width / 2) - 6) - 13) - 6), 0, onDigg);
_digg.loadGraphic(new FlxSprite(0, 0, ImgDigg));
_digg.scrollFactor.x = 0;
_digg.scrollFactor.y = 0;
_reddit = new FlxButton(((FlxG.width / 2) - 6), 0, onReddit);
_reddit.loadGraphic(new FlxSprite(0, 0, ImgReddit));
_reddit.scrollFactor.x = 0;
_reddit.scrollFactor.y = 0;
_delicious = new FlxButton((((FlxG.width / 2) + 7) + 6), 0, onDelicious);
_delicious.loadGraphic(new FlxSprite(0, 0, ImgDelicious));
_delicious.scrollFactor.x = 0;
_delicious.scrollFactor.y = 0;
_twitter = new FlxButton((((((FlxG.width / 2) + 7) + 6) + 12) + 6), 0, onTwitter);
_twitter.loadGraphic(new FlxSprite(0, 0, ImgTwitter));
_twitter.scrollFactor.x = 0;
_twitter.scrollFactor.y = 0;
_caption = new FlxText((FlxG.width / 2), 0, ((FlxG.width / 2) - 19), "");
_caption.alignment = "right";
_caption.scrollFactor.x = 0;
_caption.scrollFactor.y = 0;
_close = new FlxButton((FlxG.width - 16), 0, onClose);
_close.loadGraphic(new FlxSprite(0, 0, ImgClose));
_close.scrollFactor.x = 0;
_close.scrollFactor.y = 0;
hide();
_s = 50;
}
public function onDelicious():void{
FlxU.openURL(((("http://delicious.com/save?v=5&noui&jump=close&url=" + encodeURIComponent(_gameURL)) + "&title=") + encodeURIComponent(_gameTitle)));
}
public function onTwitter():void{
FlxU.openURL(("http://twitter.com/home?status=Playing" + encodeURIComponent((((" " + _gameTitle) + " - ") + _gameURL))));
}
public function setup(_arg1:String, _arg2:Number, _arg3:String, _arg4:String, _arg5:String):void{
_payPalID = _arg1;
if (_payPalID.length <= 0){
_donate.visible = false;
};
_payPalAmount = _arg2;
_gameTitle = _arg3;
_gameURL = _arg4;
_caption.text = _arg5;
_initialized = true;
}
public function onStumble():void{
FlxU.openURL(("http://www.stumbleupon.com/submit?url=" + encodeURIComponent(_gameURL)));
}
override public function render():void{
if (!_initialized){
return;
};
if (_topBar.visible){
_topBar.render();
};
if (_mainBar.visible){
_mainBar.render();
};
if (_bottomBar.visible){
_bottomBar.render();
};
if (_donate.visible){
_donate.render();
};
if (_stumble.visible){
_stumble.render();
};
if (_digg.visible){
_digg.render();
};
if (_reddit.visible){
_reddit.render();
};
if (_delicious.visible){
_delicious.render();
};
if (_twitter.visible){
_twitter.render();
};
if (_caption.visible){
_caption.render();
};
if (_close.visible){
_close.render();
};
}
public function onDigg():void{
FlxU.openURL(((("http://digg.com/submit?url=" + encodeURIComponent(_gameURL)) + "&title=") + encodeURIComponent(_gameTitle)));
}
public function onReddit():void{
FlxU.openURL(("http://www.reddit.com/submit?url=" + encodeURIComponent(_gameURL)));
}
public function onDonate():void{
FlxU.openURL(((((("https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=" + encodeURIComponent(_payPalID)) + "&item_name=") + encodeURIComponent(((_gameTitle + " Contribution (") + _gameURL))) + ")¤cy_code=USD&amount=") + _payPalAmount));
}
override public function update():void{
if (!_initialized){
return;
};
if (_ty != y){
if (y < _ty){
y = (y + (FlxG.elapsed * _s));
if (y > _ty){
y = _ty;
};
} else {
y = (y - (FlxG.elapsed * _s));
if (y < _ty){
y = _ty;
};
};
};
if ((((y <= -21)) || ((y > FlxG.height)))){
visible = false;
};
_topBar.y = y;
_mainBar.y = (y + 1);
_bottomBar.y = (y + 20);
_donate.y = (y + 4);
_stumble.y = (y + 4);
_digg.y = (y + 4);
_reddit.y = (y + 4);
_delicious.y = (y + 5);
_twitter.y = (y + 4);
_caption.y = (y + 4);
_close.y = (y + 4);
if (_donate.active){
_donate.update();
};
if (_stumble.active){
_stumble.update();
};
if (_digg.active){
_digg.update();
};
if (_reddit.active){
_reddit.update();
};
if (_delicious.active){
_delicious.update();
};
if (_twitter.active){
_twitter.update();
};
if (_caption.active){
_caption.update();
};
if (_close.active){
_close.update();
};
}
public function show(_arg1:Boolean=true):void{
if (!_initialized){
FlxG.log("SUPPORT PANEL ERROR: Uninitialized.\nYou forgot to call FlxGame.setupSupportPanel()\nfrom your game constructor.");
return;
};
if (_closed){
return;
};
if (_arg1){
y = -21;
_ty = -1;
} else {
y = FlxG.height;
_ty = (FlxG.height - 20);
};
Mouse.show();
visible = true;
}
public function onClose():void{
_closed = true;
hide();
}
public function hide():void{
if (y < 0){
_ty = -21;
} else {
_ty = FlxG.height;
};
Mouse.hide();
visible = false;
}
}
}//package org.flixel.data
Section 20
//FlxPanel_ImgClose (org.flixel.data.FlxPanel_ImgClose)
package org.flixel.data {
import mx.core.*;
public class FlxPanel_ImgClose extends BitmapAsset {
}
}//package org.flixel.data
Section 21
//FlxPanel_ImgDelicious (org.flixel.data.FlxPanel_ImgDelicious)
package org.flixel.data {
import mx.core.*;
public class FlxPanel_ImgDelicious extends BitmapAsset {
}
}//package org.flixel.data
Section 22
//FlxPanel_ImgDigg (org.flixel.data.FlxPanel_ImgDigg)
package org.flixel.data {
import mx.core.*;
public class FlxPanel_ImgDigg extends BitmapAsset {
}
}//package org.flixel.data
Section 23
//FlxPanel_ImgDonate (org.flixel.data.FlxPanel_ImgDonate)
package org.flixel.data {
import mx.core.*;
public class FlxPanel_ImgDonate extends BitmapAsset {
}
}//package org.flixel.data
Section 24
//FlxPanel_ImgReddit (org.flixel.data.FlxPanel_ImgReddit)
package org.flixel.data {
import mx.core.*;
public class FlxPanel_ImgReddit extends BitmapAsset {
}
}//package org.flixel.data
Section 25
//FlxPanel_ImgStumble (org.flixel.data.FlxPanel_ImgStumble)
package org.flixel.data {
import mx.core.*;
public class FlxPanel_ImgStumble extends BitmapAsset {
}
}//package org.flixel.data
Section 26
//FlxPanel_ImgTwitter (org.flixel.data.FlxPanel_ImgTwitter)
package org.flixel.data {
import mx.core.*;
public class FlxPanel_ImgTwitter extends BitmapAsset {
}
}//package org.flixel.data
Section 27
//FlxPause (org.flixel.data.FlxPause)
package org.flixel.data {
import org.flixel.*;
public class FlxPause extends FlxGroup {
private var ImgKeyP:Class;
private var ImgKey0:Class;
private var ImgKeyPlus:Class;
private var ImgKeyMinus:Class;
public function FlxPause(){
var _local2:uint;
ImgKeyMinus = FlxPause_ImgKeyMinus;
ImgKeyPlus = FlxPause_ImgKeyPlus;
ImgKey0 = FlxPause_ImgKey0;
ImgKeyP = FlxPause_ImgKeyP;
super();
scrollFactor.x = 0;
scrollFactor.y = 0;
var _local1:uint = 80;
_local2 = 92;
x = ((FlxG.width - _local1) / 2);
y = ((FlxG.height - _local2) / 2);
add(new FlxSprite().createGraphic(_local1, _local2, 2852126720, true), true);
(add(new FlxText(0, 0, _local1, "this game is"), true) as FlxText).alignment = "center";
add(new FlxText(0, 10, _local1, "PAUSED").setFormat(null, 16, 0xFFFFFF, "center"), true);
add(new FlxSprite(4, 36, ImgKeyP), true);
add(new FlxText(16, 36, (_local1 - 16), "Pause Game"), true);
add(new FlxSprite(4, 50, ImgKey0), true);
add(new FlxText(16, 50, (_local1 - 16), "Mute Sound"), true);
add(new FlxSprite(4, 64, ImgKeyMinus), true);
add(new FlxText(16, 64, (_local1 - 16), "Sound Down"), true);
add(new FlxSprite(4, 78, ImgKeyPlus), true);
add(new FlxText(16, 78, (_local1 - 16), "Sound Up"), true);
}
}
}//package org.flixel.data
Section 28
//FlxPause_ImgKey0 (org.flixel.data.FlxPause_ImgKey0)
package org.flixel.data {
import mx.core.*;
public class FlxPause_ImgKey0 extends BitmapAsset {
}
}//package org.flixel.data
Section 29
//FlxPause_ImgKeyMinus (org.flixel.data.FlxPause_ImgKeyMinus)
package org.flixel.data {
import mx.core.*;
public class FlxPause_ImgKeyMinus extends BitmapAsset {
}
}//package org.flixel.data
Section 30
//FlxPause_ImgKeyP (org.flixel.data.FlxPause_ImgKeyP)
package org.flixel.data {
import mx.core.*;
public class FlxPause_ImgKeyP extends BitmapAsset {
}
}//package org.flixel.data
Section 31
//FlxPause_ImgKeyPlus (org.flixel.data.FlxPause_ImgKeyPlus)
package org.flixel.data {
import mx.core.*;
public class FlxPause_ImgKeyPlus extends BitmapAsset {
}
}//package org.flixel.data
Section 32
//FlxQuake (org.flixel.data.FlxQuake)
package org.flixel.data {
import org.flixel.*;
public class FlxQuake {
public var y:int;
protected var _timer:Number;
protected var _intensity:Number;
public var x:int;
protected var _zoom:uint;
public function FlxQuake(_arg1:uint){
_zoom = _arg1;
start(0);
}
public function update():void{
if (_timer > 0){
_timer = (_timer - FlxG.elapsed);
if (_timer <= 0){
_timer = 0;
x = 0;
y = 0;
} else {
x = (((((Math.random() * _intensity) * FlxG.width) * 2) - (_intensity * FlxG.width)) * _zoom);
y = (((((Math.random() * _intensity) * FlxG.height) * 2) - (_intensity * FlxG.height)) * _zoom);
};
};
}
public function start(_arg1:Number=0.05, _arg2:Number=0.5):void{
stop();
_intensity = _arg1;
_timer = _arg2;
}
public function stop():void{
x = 0;
y = 0;
_intensity = 0;
_timer = 0;
}
}
}//package org.flixel.data
Section 33
//FlxButton (org.flixel.FlxButton)
package org.flixel {
import flash.events.*;
public class FlxButton extends FlxGroup {
protected var _on:FlxSprite;
protected var _offT:FlxText;
protected var _initialized:Boolean;
protected var _onT:FlxText;
protected var _pressed:Boolean;
protected var _callback:Function;
protected var _off:FlxSprite;
protected var _onToggle:Boolean;
protected var _sf:FlxPoint;
public function FlxButton(_arg1:int, _arg2:int, _arg3:Function){
x = _arg1;
y = _arg2;
width = 100;
height = 20;
_off = new FlxSprite().createGraphic(width, height, 4286545791);
_off.solid = false;
add(_off, true);
_on = new FlxSprite().createGraphic(width, height, 4294967295);
_on.solid = false;
add(_on, true);
_offT = null;
_onT = null;
_callback = _arg3;
_onToggle = false;
_pressed = false;
_initialized = false;
_sf = null;
}
protected function onMouseUp(_arg1:MouseEvent):void{
if (((((((((!(exists)) || (!(visible)))) || (!(active)))) || (!(FlxG.mouse.justReleased())))) || ((_callback == null)))){
return;
};
if (overlapsPoint(FlxG.mouse.screenX, FlxG.mouse.screenY)){
_callback();
};
}
override public function update():void{
if (!_initialized){
if (FlxG.stage != null){
FlxG.stage.addEventListener(MouseEvent.MOUSE_UP, onMouseUp);
_initialized = true;
};
};
super.update();
visibility(false);
if (overlapsPoint(FlxG.mouse.screenX, FlxG.mouse.screenY)){
if (!FlxG.mouse.pressed()){
_pressed = false;
} else {
if (!_pressed){
_pressed = true;
};
};
visibility(!(_pressed));
};
if (_onToggle){
visibility(_off.visible);
};
}
protected function visibility(_arg1:Boolean):void{
if (_arg1){
_off.visible = false;
if (_offT != null){
_offT.visible = false;
};
_on.visible = true;
if (_onT != null){
_onT.visible = true;
};
} else {
_on.visible = false;
if (_onT != null){
_onT.visible = false;
};
_off.visible = true;
if (_offT != null){
_offT.visible = true;
};
};
}
public function get on():Boolean{
return (_onToggle);
}
public function loadGraphic(_arg1:FlxSprite, _arg2:FlxSprite=null):FlxButton{
_off = (replace(_off, _arg1) as FlxSprite);
if (_arg2 == null){
if (_on != _off){
remove(_on);
};
_on = _off;
} else {
_on = (replace(_on, _arg2) as FlxSprite);
};
_on.solid = (_off.solid = false);
_off.scrollFactor = scrollFactor;
_on.scrollFactor = scrollFactor;
width = _off.width;
height = _off.height;
refreshHulls();
return (this);
}
public function loadText(_arg1:FlxText, _arg2:FlxText=null):FlxButton{
if (_arg1 != null){
if (_offT == null){
_offT = _arg1;
add(_offT);
} else {
_offT = (replace(_offT, _arg1) as FlxText);
};
};
if (_arg2 == null){
_onT = _offT;
} else {
if (_onT == null){
_onT = _arg2;
add(_onT);
} else {
_onT = (replace(_onT, _arg2) as FlxText);
};
};
_offT.scrollFactor = scrollFactor;
_onT.scrollFactor = scrollFactor;
return (this);
}
override public function destroy():void{
if (FlxG.stage != null){
FlxG.stage.removeEventListener(MouseEvent.MOUSE_UP, onMouseUp);
};
}
public function set on(_arg1:Boolean):void{
_onToggle = _arg1;
}
}
}//package org.flixel
Section 34
//FlxG (org.flixel.FlxG)
package org.flixel {
import flash.display.*;
import flash.geom.*;
import org.flixel.data.*;
public class FlxG {
public static var panel:FlxPanel;
protected static var _mute:Boolean;
public static var kong:FlxKong;
public static var scores:Array;
public static var music:FlxSound;
public static var height:uint;
protected static var _volume:Number;
public static var buffer:BitmapData;
public static var sounds:Array;
public static var debug:Boolean;
public static var LIBRARY_MINOR_VERSION:uint = 21;
public static var LIBRARY_MAJOR_VERSION:uint = 2;
public static var levels:Array;
public static var fade:FlxFade;
public static var timeScale:Number;
protected static var _cache:Object;
public static var level:int;
public static var elapsed:Number;
public static var score:int;
public static var save:int;
public static var saves:Array;
protected static var _scrollTarget:Point;
public static var mouse:FlxMouse;
public static var followTarget:FlxObject;
public static var followLead:Point;
public static var LIBRARY_NAME:String = "flixel";
public static var width:uint;
public static var followLerp:Number;
public static var scroll:Point;
public static var _game:FlxGame;
public static var quake:FlxQuake;
public static var followMin:Point;
public static var flash:FlxFlash;
public static var followMax:Point;
public static var keys:FlxKeyboard;
protected static var _pause:Boolean;
public static function get stage():Stage{
if (((!((_game._state == null))) && (!((_game._state.parent == null))))){
return (_game._state.parent.stage);
};
return (null);
}
protected static function changeSounds():void{
var _local1:FlxSound;
if (((!((music == null))) && (music.active))){
music.updateTransform();
};
var _local2:uint = sounds.length;
var _local3:uint;
while (_local3 < _local2) {
_local1 = (sounds[_local3] as FlxSound);
if (((!((_local1 == null))) && (_local1.active))){
_local1.updateTransform();
};
_local3++;
};
}
public static function get mute():Boolean{
return (_mute);
}
public static function get volume():Number{
return (_volume);
}
static function doFollow():void{
if (followTarget != null){
_scrollTarget.x = ((((width >> 1) - followTarget.x) - (followTarget.width >> 1)) + (followTarget as FlxSprite).offset.x);
_scrollTarget.y = ((((height >> 1) - followTarget.y) - (followTarget.height >> 1)) + (followTarget as FlxSprite).offset.y);
if (((!((followLead == null))) && ((followTarget is FlxSprite)))){
_scrollTarget.x = (_scrollTarget.x - ((followTarget as FlxSprite).velocity.x * followLead.x));
_scrollTarget.y = (_scrollTarget.y - ((followTarget as FlxSprite).velocity.y * followLead.y));
};
scroll.x = (scroll.x + (((_scrollTarget.x - scroll.x) * followLerp) * FlxG.elapsed));
scroll.y = (scroll.y + (((_scrollTarget.y - scroll.y) * followLerp) * FlxG.elapsed));
if (followMin != null){
if (scroll.x > followMin.x){
scroll.x = followMin.x;
};
if (scroll.y > followMin.y){
scroll.y = followMin.y;
};
};
if (followMax != null){
if (scroll.x < followMax.x){
scroll.x = followMax.x;
};
if (scroll.y < followMax.y){
scroll.y = followMax.y;
};
};
};
}
public static function getMuteValue():uint{
if (_mute){
return (0);
};
return (1);
}
public static function addBitmap(_arg1:Class, _arg2:Boolean=false, _arg3:Boolean=false, _arg4:String=null):BitmapData{
var _local8:uint;
var _local9:String;
var _local10:BitmapData;
var _local11:Matrix;
var _local5:Boolean;
var _local6:String = _arg4;
if (_local6 == null){
_local6 = String(_arg1);
if (((((_arg3) && (!((_cache[_local6] == undefined))))) && (!((_cache[_local6] == null))))){
_local8 = 0;
do {
var _temp1 = _local8;
_local8 = (_local8 + 1);
_local9 = (_local6 + _temp1);
} while (((!((_cache[_local9] == undefined))) && (!((_cache[_local9] == null)))));
_local6 = _local9;
};
};
if (!checkBitmapCache(_local6)){
_cache[_local6] = new (_arg1).bitmapData;
if (_arg2){
_local5 = true;
};
};
var _local7:BitmapData = _cache[_local6];
if (((((!(_local5)) && (_arg2))) && ((_local7.width == new (_arg1).bitmapData.width)))){
_local5 = true;
};
if (_local5){
_local10 = new BitmapData((_local7.width << 1), _local7.height, true, 0);
_local10.draw(_local7);
_local11 = new Matrix();
_local11.scale(-1, 1);
_local11.translate(_local10.width, 0);
_local10.draw(_local7, _local11);
_local7 = _local10;
};
return (_local7);
}
public static function set state(_arg1:FlxState):void{
_game.switchState(_arg1);
}
public static function set mute(_arg1:Boolean):void{
_mute = _arg1;
changeSounds();
}
public static function play(_arg1:Class, _arg2:Number=1, _arg3:Boolean=false):FlxSound{
var _local4:uint = sounds.length;
var _local5:uint;
while (_local5 < _local4) {
if (!(sounds[_local5] as FlxSound).active){
break;
};
_local5++;
};
if (sounds[_local5] == null){
sounds[_local5] = new FlxSound();
};
var _local6:FlxSound = sounds[_local5];
_local6.loadEmbedded(_arg1, _arg3);
_local6.volume = _arg2;
_local6.play();
return (_local6);
}
public static function set volume(_arg1:Number):void{
_volume = _arg1;
if (_volume < 0){
_volume = 0;
} else {
if (_volume > 1){
_volume = 1;
};
};
changeSounds();
}
static function setGameData(_arg1:FlxGame, _arg2:uint, _arg3:uint, _arg4:uint):void{
_game = _arg1;
_cache = new Object();
width = _arg2;
height = _arg3;
_mute = false;
_volume = 0.5;
sounds = new Array();
mouse = new FlxMouse();
keys = new FlxKeyboard();
scroll = null;
_scrollTarget = null;
unfollow();
FlxG.levels = new Array();
FlxG.scores = new Array();
level = 0;
score = 0;
FlxU.seed = NaN;
kong = null;
pause = false;
timeScale = 1;
panel = new FlxPanel();
quake = new FlxQuake(_arg4);
flash = new FlxFlash();
fade = new FlxFade();
FlxU.setWorldBounds();
}
public static function playMusic(_arg1:Class, _arg2:Number=1):void{
if (music == null){
music = new FlxSound();
} else {
if (music.active){
music.stop();
};
};
music.loadEmbedded(_arg1, true);
music.volume = _arg2;
music.survive = true;
music.play();
}
public static function createBitmap(_arg1:uint, _arg2:uint, _arg3:uint, _arg4:Boolean=false, _arg5:String=null):BitmapData{
var _local7:uint;
var _local8:String;
var _local6:String = _arg5;
if (_local6 == null){
_local6 = ((((_arg1 + "x") + _arg2) + ":") + _arg3);
if (((((_arg4) && (!((_cache[_local6] == undefined))))) && (!((_cache[_local6] == null))))){
_local7 = 0;
do {
var _temp1 = _local7;
_local7 = (_local7 + 1);
_local8 = (_local6 + _temp1);
} while (((!((_cache[_local8] == undefined))) && (!((_cache[_local8] == null)))));
_local6 = _local8;
};
};
if (!checkBitmapCache(_local6)){
_cache[_local6] = new BitmapData(_arg1, _arg2, true, _arg3);
};
return (_cache[_local6]);
}
public static function log(_arg1:Object):void{
_game._console.log(((_arg1)==null) ? "ERROR: null object" : _arg1.toString());
}
public static function checkBitmapCache(_arg1:String):Boolean{
return (((!((_cache[_arg1] == undefined))) && (!((_cache[_arg1] == null)))));
}
static function updateSounds():void{
var _local1:FlxSound;
if (((!((music == null))) && (music.active))){
music.update();
};
var _local2:uint = sounds.length;
var _local3:uint;
while (_local3 < _local2) {
_local1 = (sounds[_local3] as FlxSound);
if (((!((_local1 == null))) && (_local1.active))){
_local1.update();
};
_local3++;
};
}
static function updateInput():void{
keys.update();
mouse.update(state.mouseX, state.mouseY, scroll.x, scroll.y);
}
public static function stream(_arg1:String, _arg2:Number=1, _arg3:Boolean=false):FlxSound{
var _local4:uint = sounds.length;
var _local5:uint;
while (_local5 < _local4) {
if (!(sounds[_local5] as FlxSound).active){
break;
};
_local5++;
};
if (sounds[_local5] == null){
sounds[_local5] = new FlxSound();
};
var _local6:FlxSound = sounds[_local5];
_local6.loadStream(_arg1, _arg3);
_local6.volume = _arg2;
_local6.play();
return (_local6);
}
static function unfollow():void{
followTarget = null;
followLead = null;
followLerp = 1;
followMin = null;
followMax = null;
if (scroll == null){
scroll = new Point();
} else {
scroll.x = (scroll.y = 0);
};
if (_scrollTarget == null){
_scrollTarget = new Point();
} else {
_scrollTarget.x = (_scrollTarget.y = 0);
};
}
public static function get state():FlxState{
return (_game._state);
}
protected static function playSounds():void{
var _local1:FlxSound;
if (((!((music == null))) && (music.active))){
music.play();
};
var _local2:uint = sounds.length;
var _local3:uint;
while (_local3 < _local2) {
_local1 = (sounds[_local3] as FlxSound);
if (((!((_local1 == null))) && (_local1.active))){
_local1.play();
};
_local3++;
};
}
public static function followAdjust(_arg1:Number=0, _arg2:Number=0):void{
followLead = new Point(_arg1, _arg2);
}
public static function follow(_arg1:FlxObject, _arg2:Number=1):void{
followTarget = _arg1;
followLerp = _arg2;
_scrollTarget.x = ((((width >> 1) - followTarget.x) - (followTarget.width >> 1)) + (followTarget as FlxSprite).offset.x);
_scrollTarget.y = ((((height >> 1) - followTarget.y) - (followTarget.height >> 1)) + (followTarget as FlxSprite).offset.y);
scroll.x = _scrollTarget.x;
scroll.y = _scrollTarget.y;
doFollow();
}
public static function resetInput():void{
keys.reset();
mouse.reset();
}
public static function followBounds(_arg1:int=0, _arg2:int=0, _arg3:int=0, _arg4:int=0, _arg5:Boolean=true):void{
followMin = new Point(-(_arg1), -(_arg2));
followMax = new Point((-(_arg3) + width), (-(_arg4) + height));
if (followMax.x > followMin.x){
followMax.x = followMin.x;
};
if (followMax.y > followMin.y){
followMax.y = followMin.y;
};
if (_arg5){
FlxU.setWorldBounds(-(_arg1), -(_arg2), (-(_arg1) + _arg3), (-(_arg2) + _arg4));
};
doFollow();
}
protected static function pauseSounds():void{
var _local1:FlxSound;
if (((!((music == null))) && (music.active))){
music.pause();
};
var _local2:uint = sounds.length;
var _local3:uint;
while (_local3 < _local2) {
_local1 = (sounds[_local3] as FlxSound);
if (((!((_local1 == null))) && (_local1.active))){
_local1.pause();
};
_local3++;
};
}
static function destroySounds(_arg1:Boolean=false):void{
var _local2:FlxSound;
if (sounds == null){
return;
};
if (((!((music == null))) && (((_arg1) || (!(music.survive)))))){
music.destroy();
};
var _local3:uint = sounds.length;
var _local4:uint;
while (_local4 < _local3) {
_local2 = (sounds[_local4] as FlxSound);
if (((!((_local2 == null))) && (((_arg1) || (!(_local2.survive)))))){
_local2.destroy();
};
_local4++;
};
}
public static function set pause(_arg1:Boolean):void{
var _local2:Boolean = _pause;
_pause = _arg1;
if (_pause != _local2){
if (_pause){
_game.pauseGame();
pauseSounds();
} else {
_game.unpauseGame();
playSounds();
};
};
}
public static function get pause():Boolean{
return (_pause);
}
}
}//package org.flixel
Section 35
//FlxGame (org.flixel.FlxGame)
package org.flixel {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.text.*;
import org.flixel.data.*;
import flash.ui.*;
import flash.utils.*;
public class FlxGame extends Sprite {
const MAX_ELAPSED:Number = 0.0333;
var _bmpFront:Bitmap;
protected var SndFlixel:Class;
var _state:FlxState;
protected var SndBeep:Class;
var _console:FlxConsole;
var _created:Boolean;
var _zoom:uint;
var _gameXOffset:int;
var _elapsed:Number;
var _flipped:Boolean;
var _total:uint;
var _soundTrayBars:Array;
public var useDefaultHotKeys:Boolean;
protected var junk:String;// = "FlxGame_junk"
var _bmpBack:Bitmap;
var _iState:Class;
var _paused:Boolean;
var _gameYOffset:int;
var _buffer:Sprite;
var _soundTray:Sprite;
var _frame:Class;
var _r:Rectangle;
public var pause:FlxGroup;
var _soundTrayTimer:Number;
public function FlxGame(_arg1:uint, _arg2:uint, _arg3:Class, _arg4:uint=2){
SndBeep = FlxGame_SndBeep;
SndFlixel = FlxGame_SndFlixel;
super();
Mouse.hide();
_zoom = _arg4;
FlxState.bgColor = 4278190080;
FlxG.setGameData(this, _arg1, _arg2, _arg4);
_elapsed = 0;
_total = 0;
pause = new FlxPause();
_state = null;
_iState = _arg3;
useDefaultHotKeys = true;
_frame = null;
_gameXOffset = 0;
_gameYOffset = 0;
_paused = false;
_created = false;
addEventListener(Event.ENTER_FRAME, onEnterFrame);
}
function pauseGame():void{
if (((!((x == 0))) || (!((y == 0))))){
x = 0;
y = 0;
};
if (!_flipped){
_bmpBack.bitmapData.copyPixels(_bmpFront.bitmapData, _r, new Point(0, 0));
} else {
_bmpFront.bitmapData.copyPixels(_bmpBack.bitmapData, _r, new Point(0, 0));
};
Mouse.show();
_paused = true;
stage.frameRate = 10;
}
function unpauseGame():void{
if (!FlxG.panel.visible){
Mouse.hide();
};
FlxG.resetInput();
_paused = false;
stage.frameRate = 60;
}
protected function onFocus(_arg1:Event=null):void{
if (FlxG.pause){
FlxG.pause = false;
};
}
protected function onKeyUp(_arg1:KeyboardEvent):void{
var _local2:int;
var _local3:String;
if ((((_arg1.keyCode == 192)) || ((_arg1.keyCode == 220)))){
_console.toggle();
return;
};
if (useDefaultHotKeys){
_local2 = _arg1.keyCode;
_local3 = String.fromCharCode(_arg1.charCode);
switch (_local2){
case 48:
FlxG.mute = !(FlxG.mute);
showSoundTray();
return;
case 189:
FlxG.mute = false;
FlxG.volume = (FlxG.volume - 0.1);
showSoundTray();
return;
case 187:
FlxG.mute = false;
FlxG.volume = (FlxG.volume + 0.1);
showSoundTray();
return;
case 80:
FlxG.pause = !(FlxG.pause);
default:
break;
};
};
FlxG.keys.handleKeyUp(_arg1);
}
public function switchState(_arg1:FlxState):void{
FlxG.panel.hide();
FlxG.unfollow();
FlxG.resetInput();
FlxG.destroySounds();
FlxG.flash.stop();
FlxG.fade.stop();
FlxG.quake.stop();
_buffer.x = 0;
_buffer.y = 0;
_buffer.addChild(_arg1);
if (_state != null){
_state.destroy();
_buffer.swapChildren(_arg1, _state);
_buffer.removeChild(_state);
};
_state = _arg1;
_state.create();
}
protected function addFrame(_arg1:Class, _arg2:uint, _arg3:uint):FlxGame{
_frame = _arg1;
_gameXOffset = _arg2;
_gameYOffset = _arg3;
return (this);
}
protected function onEnterFrame(_arg1:Event):void{
var _local2:uint;
var _local3:FlxSave;
var _local5:String;
var _local6:String;
var _local7:Bitmap;
var _local8:TextField;
var _local9:uint;
var _local10:uint;
var _local11:Bitmap;
var _local4:uint = getTimer();
_elapsed = ((_local4 - _total) / 1000);
if (_created){
_console.lastElapsed = _elapsed;
};
_total = _local4;
FlxG.elapsed = _elapsed;
if (FlxG.elapsed > MAX_ELAPSED){
FlxG.elapsed = MAX_ELAPSED;
};
FlxG.elapsed = (FlxG.elapsed * FlxG.timeScale);
if (_soundTray != null){
if (_soundTrayTimer > 0){
_soundTrayTimer = (_soundTrayTimer - _elapsed);
} else {
if (_soundTray.y > -(_soundTray.height)){
_soundTray.y = (_soundTray.y - ((_elapsed * FlxG.height) * 2));
if (_soundTray.y <= -(_soundTray.height)){
_soundTray.visible = false;
_local3 = new FlxSave();
if (_local3.bind("flixel")){
if (_local3.data.sound == null){
_local3.data.sound = new Object();
};
_local3.data.mute = FlxG.mute;
_local3.data.volume = FlxG.volume;
_local3.forceSave();
};
};
};
};
};
if (_created){
FlxG.panel.update();
_console.update();
FlxG.updateInput();
FlxG.updateSounds();
if (_paused){
pause.update();
if (_flipped){
FlxG.buffer.copyPixels(_bmpFront.bitmapData, _r, new Point(0, 0));
} else {
FlxG.buffer.copyPixels(_bmpBack.bitmapData, _r, new Point(0, 0));
};
pause.render();
} else {
if (_flipped){
FlxG.buffer = _bmpFront.bitmapData;
} else {
FlxG.buffer = _bmpBack.bitmapData;
};
FlxState.screen.unsafeBind(FlxG.buffer);
_state.preProcess();
FlxG.doFollow();
_state.update();
if (FlxG.flash.exists){
FlxG.flash.update();
};
if (FlxG.fade.exists){
FlxG.fade.update();
};
FlxG.quake.update();
_buffer.x = FlxG.quake.x;
_buffer.y = FlxG.quake.y;
_state.render();
if (FlxG.flash.exists){
FlxG.flash.render();
};
if (FlxG.fade.exists){
FlxG.fade.render();
};
if (FlxG.panel.visible){
FlxG.panel.render();
};
if (FlxG.mouse.cursor != null){
if (FlxG.mouse.cursor.active){
FlxG.mouse.cursor.update();
};
if (FlxG.mouse.cursor.visible){
FlxG.mouse.cursor.render();
};
};
_state.postProcess();
_bmpBack.visible = !((_bmpFront.visible = _flipped));
_flipped = !(_flipped);
};
} else {
if (root != null){
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
stage.frameRate = 60;
_buffer = new Sprite();
_buffer.scaleX = _zoom;
_buffer.scaleY = _zoom;
addChild(_buffer);
_bmpBack = new Bitmap(new BitmapData(FlxG.width, FlxG.height, true, FlxState.bgColor));
_bmpBack.x = _gameXOffset;
_bmpBack.y = _gameYOffset;
_buffer.addChild(_bmpBack);
_bmpFront = new Bitmap(new BitmapData(_bmpBack.width, _bmpBack.height, true, FlxState.bgColor));
_bmpFront.x = _bmpBack.x;
_bmpFront.y = _bmpBack.y;
_buffer.addChild(_bmpFront);
_flipped = false;
_r = new Rectangle(0, 0, _bmpFront.width, _bmpFront.height);
_console = new FlxConsole(_gameXOffset, _gameYOffset, _zoom);
addChild(_console);
_local5 = ((((FlxG.LIBRARY_NAME + " v") + FlxG.LIBRARY_MAJOR_VERSION) + ".") + FlxG.LIBRARY_MINOR_VERSION);
if (FlxG.debug){
_local5 = (_local5 + " [debug]");
} else {
_local5 = (_local5 + " [release]");
};
_local6 = "";
_local2 = 0;
while (_local2 < (_local5.length + 32)) {
_local6 = (_local6 + "-");
_local2++;
};
FlxG.log(_local5);
FlxG.log(_local6);
stage.addEventListener(KeyboardEvent.KEY_DOWN, FlxG.keys.handleKeyDown);
stage.addEventListener(KeyboardEvent.KEY_UP, onKeyUp);
stage.addEventListener(MouseEvent.MOUSE_DOWN, FlxG.mouse.handleMouseDown);
stage.addEventListener(MouseEvent.MOUSE_UP, FlxG.mouse.handleMouseUp);
stage.addEventListener(MouseEvent.MOUSE_OUT, FlxG.mouse.handleMouseOut);
stage.addEventListener(MouseEvent.MOUSE_OVER, FlxG.mouse.handleMouseOver);
stage.addEventListener(Event.DEACTIVATE, onFocusLost);
stage.addEventListener(Event.ACTIVATE, onFocus);
_soundTray = new Sprite();
_soundTray.visible = false;
_soundTray.scaleX = 2;
_soundTray.scaleY = 2;
_local7 = new Bitmap(new BitmapData(80, 30, true, 2130706432));
_soundTray.x = (((_gameXOffset + (FlxG.width / 2)) * _zoom) - ((_local7.width / 2) * _soundTray.scaleX));
_soundTray.addChild(_local7);
_local8 = new TextField();
_local8.width = _local7.width;
_local8.height = _local7.height;
_local8.multiline = true;
_local8.wordWrap = true;
_local8.selectable = false;
_local8.embedFonts = true;
_local8.antiAliasType = AntiAliasType.NORMAL;
_local8.gridFitType = GridFitType.PIXEL;
_local8.defaultTextFormat = new TextFormat("system", 8, 0xFFFFFF, null, null, null, null, null, "center");
_soundTray.addChild(_local8);
_local8.text = "VOLUME";
_local8.y = 16;
_local9 = 10;
_local10 = 14;
_soundTrayBars = new Array();
_local2 = 0;
while (_local2 < 10) {
_local7 = new Bitmap(new BitmapData(4, (_local2 + 1), false, 0xFFFFFF));
_local7.x = _local9;
_local7.y = _local10;
_soundTrayBars.push(_soundTray.addChild(_local7));
_local9 = (_local9 + 6);
_local10--;
_local2++;
};
addChild(_soundTray);
if (_frame != null){
_local11 = new _frame();
_local11.scaleX = _zoom;
_local11.scaleY = _zoom;
addChild(_local11);
};
_local3 = new FlxSave();
if (((_local3.bind("flixel")) && (!((_local3.data.sound == null))))){
if (_local3.data.volume != null){
FlxG.volume = _local3.data.volume;
};
if (_local3.data.mute != null){
FlxG.mute = _local3.data.mute;
};
showSoundTray(true);
};
_created = true;
switchState(new _iState());
};
};
}
public function showSoundTray(_arg1:Boolean=false):void{
if (!_arg1){
FlxG.play(SndBeep);
};
_soundTrayTimer = 1;
_soundTray.y = (_gameYOffset * _zoom);
_soundTray.visible = true;
var _local2:uint = Math.round((FlxG.volume * 10));
if (FlxG.mute){
_local2 = 0;
};
var _local3:uint;
while (_local3 < _soundTrayBars.length) {
if (_local3 < _local2){
_soundTrayBars[_local3].alpha = 1;
} else {
_soundTrayBars[_local3].alpha = 0.5;
};
_local3++;
};
}
protected function onFocusLost(_arg1:Event=null):void{
FlxG.pause = true;
}
}
}//package org.flixel
Section 36
//FlxGame_junk (org.flixel.FlxGame_junk)
package org.flixel {
import mx.core.*;
public class FlxGame_junk extends FontAsset {
}
}//package org.flixel
Section 37
//FlxGame_SndBeep (org.flixel.FlxGame_SndBeep)
package org.flixel {
import mx.core.*;
public class FlxGame_SndBeep extends SoundAsset {
}
}//package org.flixel
Section 38
//FlxGame_SndFlixel (org.flixel.FlxGame_SndFlixel)
package org.flixel {
import mx.core.*;
public class FlxGame_SndFlixel extends SoundAsset {
}
}//package org.flixel
Section 39
//FlxGroup (org.flixel.FlxGroup)
package org.flixel {
public class FlxGroup extends FlxObject {
public var members:Array;
protected var _first:Boolean;
protected var _last:FlxPoint;
public function FlxGroup(){
_group = true;
solid = false;
members = new Array();
_last = new FlxPoint();
_first = true;
}
public function getFirstExtant():FlxObject{
var _local1:FlxObject;
var _local2:uint = members.length;
var _local3:uint;
while (_local3 < _local2) {
_local1 = (members[_local3] as FlxObject);
if (((!((_local1 == null))) && (_local1.exists))){
return (_local1);
};
_local3++;
};
return (null);
}
override public function destroy():void{
destroyMembers();
super.destroy();
}
public function getFirstAlive():FlxObject{
var _local1:FlxObject;
var _local2:uint = members.length;
var _local3:uint;
while (_local3 < _local2) {
_local1 = (members[_local3] as FlxObject);
if (((((!((_local1 == null))) && (_local1.exists))) && (!(_local1.dead)))){
return (_local1);
};
_local3++;
};
return (null);
}
public function remove(_arg1:FlxObject, _arg2:Boolean=false):FlxObject{
var _local3:int = members.indexOf(_arg1);
if ((((_local3 < 0)) || ((_local3 >= members.length)))){
return (null);
};
if (_arg2){
members.splice(_local3, 1);
} else {
members[_local3] = null;
};
return (_arg1);
}
override public function update():void{
saveOldPosition();
updateMotion();
updateMembers();
updateFlickering();
}
public function resetFirstAvail(_arg1:Number=0, _arg2:Number=0):Boolean{
var _local3:FlxObject = getFirstAvail();
if (_local3 == null){
return (false);
};
_local3.reset(_arg1, _arg2);
return (true);
}
override public function reset(_arg1:Number, _arg2:Number):void{
var _local3:Number;
var _local4:Number;
var _local6:FlxObject;
saveOldPosition();
super.reset(_arg1, _arg2);
var _local5:Boolean;
if (((!((x == _last.x))) || (!((y == _last.y))))){
_local5 = true;
_local3 = (x - _last.x);
_local4 = (y - _last.y);
};
var _local7:uint = members.length;
var _local8:uint;
while (_local8 < _local7) {
_local6 = (members[_local8] as FlxObject);
if (((!((_local6 == null))) && (_local6.exists))){
if (_local5){
if (_local6._group){
_local6.reset((_local6.x + _local3), (_local6.y + _local4));
} else {
_local6.x = (_local6.x + _local3);
_local6.y = (_local6.y + _local4);
if (solid){
_local6.colHullX.width = (_local6.colHullX.width + ((_local3)>0) ? _local3 : -(_local3));
if (_local3 < 0){
_local6.colHullX.x = (_local6.colHullX.x + _local3);
};
_local6.colHullY.x = x;
_local6.colHullY.height = (_local6.colHullY.height + ((_local4)>0) ? _local4 : -(_local4));
if (_local4 < 0){
_local6.colHullY.y = (_local6.colHullY.y + _local4);
};
_local6.colVector.x = (_local6.colVector.x + _local3);
_local6.colVector.y = (_local6.colVector.y + _local4);
};
};
};
};
_local8++;
};
}
protected function updateMembers():void{
var _local1:Number;
var _local2:Number;
var _local4:FlxObject;
var _local3:Boolean;
if (((!((x == _last.x))) || (!((y == _last.y))))){
_local3 = true;
_local1 = (x - _last.x);
_local2 = (y - _last.y);
};
var _local5:uint = members.length;
var _local6:uint;
while (_local6 < _local5) {
_local4 = (members[_local6] as FlxObject);
if (((!((_local4 == null))) && (_local4.exists))){
if (_local3){
if (_local4._group){
_local4.reset((_local4.x + _local1), (_local4.y + _local2));
} else {
_local4.x = (_local4.x + _local1);
_local4.y = (_local4.y + _local2);
};
};
if (_local4.active){
_local4.update();
};
if (((_local3) && (_local4.solid))){
_local4.colHullX.width = (_local4.colHullX.width + ((_local1)>0) ? _local1 : -(_local1));
if (_local1 < 0){
_local4.colHullX.x = (_local4.colHullX.x + _local1);
};
_local4.colHullY.x = x;
_local4.colHullY.height = (_local4.colHullY.height + ((_local2)>0) ? _local2 : -(_local2));
if (_local2 < 0){
_local4.colHullY.y = (_local4.colHullY.y + _local2);
};
_local4.colVector.x = (_local4.colVector.x + _local1);
_local4.colVector.y = (_local4.colVector.y + _local2);
};
};
_local6++;
};
}
public function countDead():int{
var _local1:FlxObject;
var _local2 = -1;
var _local3:uint = members.length;
var _local4:uint;
while (_local4 < _local3) {
_local1 = (members[_local4] as FlxObject);
if (_local1 != null){
if (_local2 < 0){
_local2 = 0;
};
if (_local1.dead){
_local2++;
};
};
_local4++;
};
return (_local2);
}
public function getFirstAvail():FlxObject{
var _local1:FlxObject;
var _local2:uint = members.length;
var _local3:uint;
while (_local3 < _local2) {
_local1 = (members[_local3] as FlxObject);
if (((!((_local1 == null))) && (!(_local1.exists)))){
return (_local1);
};
_local3++;
};
return (null);
}
override public function render():void{
renderMembers();
}
public function countLiving():int{
var _local1:FlxObject;
var _local2 = -1;
var _local3:uint = members.length;
var _local4:uint;
while (_local4 < _local3) {
_local1 = (members[_local4] as FlxObject);
if (_local1 != null){
if (_local2 < 0){
_local2 = 0;
};
if (((_local1.exists) && (!(_local1.dead)))){
_local2++;
};
};
_local4++;
};
return (_local2);
}
public function countOnScreen():int{
var _local1:FlxObject;
var _local2 = -1;
var _local3:uint = members.length;
var _local4:uint;
while (_local4 < _local3) {
_local1 = (members[_local4] as FlxObject);
if (_local1 != null){
if (_local2 < 0){
_local2 = 0;
};
if (_local1.onScreen()){
_local2++;
};
};
_local4++;
};
return (_local2);
}
protected function killMembers():void{
var _local1:FlxObject;
var _local2:uint = members.length;
var _local3:uint;
while (_local3 < _local2) {
_local1 = (members[_local3] as FlxObject);
if (_local1 != null){
_local1.kill();
};
_local3++;
};
}
override public function kill():void{
killMembers();
super.kill();
}
public function getFirstNull():int{
var _local1:uint = members.length;
var _local2:uint;
while (_local2 < _local1) {
if (members[_local2] == null){
return (_local2);
};
_local2++;
};
return (-1);
}
protected function renderMembers():void{
var _local1:FlxObject;
var _local2:uint = members.length;
var _local3:uint;
while (_local3 < _local2) {
_local1 = (members[_local3] as FlxObject);
if (((((!((_local1 == null))) && (_local1.exists))) && (_local1.visible))){
_local1.render();
};
_local3++;
};
}
public function add(_arg1:FlxObject, _arg2:Boolean=false):FlxObject{
members.push(_arg1);
if (_arg2){
_arg1.scrollFactor = scrollFactor;
};
return (_arg1);
}
protected function saveOldPosition():void{
if (_first){
_first = false;
_last.x = 0;
_last.y = 0;
return;
};
_last.x = x;
_last.y = y;
}
public function replace(_arg1:FlxObject, _arg2:FlxObject):FlxObject{
var _local3:int = members.indexOf(_arg1);
if ((((_local3 < 0)) || ((_local3 >= members.length)))){
return (null);
};
members[_local3] = _arg2;
return (_arg2);
}
public function getRandom():FlxObject{
var _local1:uint;
var _local2:FlxObject;
var _local3:uint = members.length;
var _local4:uint = uint((FlxU.random() * _local3));
while ((((_local2 == null)) && ((_local1 < members.length)))) {
++_local4;
_local2 = (members[(_local4 % _local3)] as FlxObject);
_local1++;
};
return (_local2);
}
public function getFirstDead():FlxObject{
var _local1:FlxObject;
var _local2:uint = members.length;
var _local3:uint;
while (_local3 < _local2) {
_local1 = (members[_local3] as FlxObject);
if (((!((_local1 == null))) && (_local1.dead))){
return (_local1);
};
_local3++;
};
return (null);
}
protected function destroyMembers():void{
var _local1:FlxObject;
var _local2:uint = members.length;
var _local3:uint;
while (_local3 < _local2) {
_local1 = (members[_local3] as FlxObject);
if (_local1 != null){
_local1.destroy();
};
_local3++;
};
members.length = 0;
}
}
}//package org.flixel
Section 40
//FlxObject (org.flixel.FlxObject)
package org.flixel {
import flash.geom.*;
public class FlxObject extends FlxRect {
public var acceleration:FlxPoint;
public var angularAcceleration:Number;
public var active:Boolean;
public var collideBottom:Boolean;
var _group:Boolean;
protected var _point:FlxPoint;
public var colHullX:FlxRect;
protected var _flickerTimer:Number;
public var colHullY:FlxRect;
protected var _flashPoint:Point;
public var colOffsets:Array;
public var solid:Boolean;
public var origin:FlxPoint;
public var drag:FlxPoint;
public var angularDrag:Number;
public var collideTop:Boolean;
protected var _flicker:Boolean;
protected var _rect:FlxRect;
public var moves:Boolean;
public var angle:Number;
public var thrust:Number;
public var health:Number;
public var velocity:FlxPoint;
public var maxAngular:Number;
public var angularVelocity:Number;
public var maxVelocity:FlxPoint;
public var exists:Boolean;
public var collideLeft:Boolean;
public var colVector:FlxPoint;
public var maxThrust:Number;
public var onFloor:Boolean;
public var dead:Boolean;
public var fixed:Boolean;
public var visible:Boolean;
public var scrollFactor:FlxPoint;
public var collideRight:Boolean;
protected static const _pZero:FlxPoint = new FlxPoint();
public function FlxObject(_arg1:Number=0, _arg2:Number=0, _arg3:Number=0, _arg4:Number=0){
super(_arg1, _arg2, _arg3, _arg4);
exists = true;
active = true;
visible = true;
solid = true;
fixed = false;
moves = true;
collideLeft = true;
collideRight = true;
collideTop = true;
collideBottom = true;
origin = new FlxPoint();
velocity = new FlxPoint();
acceleration = new FlxPoint();
drag = new FlxPoint();
maxVelocity = new FlxPoint(10000, 10000);
angle = 0;
angularVelocity = 0;
angularAcceleration = 0;
angularDrag = 0;
maxAngular = 10000;
thrust = 0;
scrollFactor = new FlxPoint(1, 1);
_flicker = false;
_flickerTimer = -1;
health = 1;
dead = false;
_point = new FlxPoint();
_rect = new FlxRect();
_flashPoint = new Point();
colHullX = new FlxRect();
colHullY = new FlxRect();
colVector = new FlxPoint();
colOffsets = new Array(new FlxPoint());
_group = false;
}
public function onScreen():Boolean{
getScreenXY(_point);
if (((((((((_point.x + width) < 0)) || ((_point.x > FlxG.width)))) || (((_point.y + height) < 0)))) || ((_point.y > FlxG.height)))){
return (false);
};
return (true);
}
public function kill():void{
exists = false;
dead = true;
}
protected function updateFlickering():void{
if (flickering()){
if (_flickerTimer > 0){
_flickerTimer = (_flickerTimer - FlxG.elapsed);
if (_flickerTimer == 0){
_flickerTimer = -1;
};
};
if (_flickerTimer < 0){
flicker(-1);
} else {
_flicker = !(_flicker);
visible = !(_flicker);
};
};
}
public function render():void{
}
public function hitBottom(_arg1:FlxObject, _arg2:Number):void{
onFloor = true;
if (!fixed){
velocity.y = _arg2;
};
}
public function overlaps(_arg1:FlxObject):Boolean{
var _local10:FlxSprite;
var _local11:FlxSprite;
getScreenXY(_point);
var _local2:Number = _point.x;
var _local3:Number = _point.y;
var _local4:Number = width;
var _local5:Number = height;
if ((this is FlxSprite)){
_local10 = (this as FlxSprite);
_local4 = _local10.frameWidth;
_local5 = _local10.frameHeight;
};
_arg1.getScreenXY(_point);
var _local6:Number = _point.x;
var _local7:Number = _point.y;
var _local8:Number = _arg1.width;
var _local9:Number = _arg1.height;
if ((_arg1 is FlxSprite)){
_local11 = (_arg1 as FlxSprite);
_local8 = _local11.frameWidth;
_local9 = _local11.frameHeight;
};
if ((((((((_local6 <= (_local2 - _local8))) || ((_local6 >= (_local2 + _local4))))) || ((_local7 <= (_local3 - _local9))))) || ((_local7 >= (_local3 + _local5))))){
return (false);
};
return (true);
}
public function overlapsPoint(_arg1:Number, _arg2:Number, _arg3:Boolean=false):Boolean{
getScreenXY(_point);
if ((((((((_arg1 <= _point.x)) || ((_arg1 >= (_point.x + width))))) || ((_arg2 <= _point.y)))) || ((_arg2 >= (_point.y + height))))){
return (false);
};
return (true);
}
public function hurt(_arg1:Number):void{
if ((health = (health - _arg1)) <= 0){
kill();
};
}
public function refreshHulls():void{
colHullX.x = x;
colHullX.y = y;
colHullX.width = width;
colHullX.height = height;
colHullY.x = x;
colHullY.y = y;
colHullY.width = width;
colHullY.height = height;
}
public function preCollide(_arg1:FlxObject):void{
}
public function hitLeft(_arg1:FlxObject, _arg2:Number):void{
if (!fixed){
velocity.x = _arg2;
};
}
public function collide(_arg1:FlxObject=null):Boolean{
return (FlxU.collide(this, ((_arg1)==null) ? this : _arg1));
}
public function reset(_arg1:Number, _arg2:Number):void{
x = _arg1;
y = _arg2;
exists = true;
dead = false;
}
public function update():void{
updateMotion();
updateFlickering();
}
public function hitTop(_arg1:FlxObject, _arg2:Number):void{
if (!fixed){
velocity.y = _arg2;
};
}
protected function updateMotion():void{
var _local1:FlxPoint;
var _local4:FlxPoint;
var _local5:Number;
if (!moves){
return;
};
if (solid){
refreshHulls();
};
onFloor = false;
angle = (angle + ((angularVelocity = FlxU.computeVelocity(angularVelocity, angularAcceleration, angularDrag, maxAngular)) * FlxG.elapsed));
if (thrust != 0){
_local1 = FlxU.rotatePoint(-(thrust), 0, 0, 0, angle);
_local4 = FlxU.rotatePoint(-(maxThrust), 0, 0, 0, angle);
_local5 = ((_local4.x)>0) ? _local4.x : -(_local4.x);
if (_local5 > ((_local4.y)>0) ? _local4.y : -(_local4.y)){
_local4.y = _local5;
} else {
_local5 = ((_local4.y)>0) ? _local4.y : -(_local4.y);
};
maxVelocity.x = (maxVelocity.y = ((_local5)>0) ? _local5 : -(_local5));
} else {
_local1 = _pZero;
};
velocity.x = FlxU.computeVelocity(velocity.x, (acceleration.x + _local1.x), drag.x, maxVelocity.x);
velocity.y = FlxU.computeVelocity(velocity.y, (acceleration.y + _local1.y), drag.y, maxVelocity.y);
var _local2:Number = (velocity.x * FlxG.elapsed);
var _local3:Number = (velocity.y * FlxG.elapsed);
x = (x + _local2);
y = (y + _local3);
if (!solid){
return;
};
colVector.x = _local2;
colVector.y = _local3;
colHullX.width = (colHullX.width + ((colVector.x)>0) ? colVector.x : -(colVector.x));
if (colVector.x < 0){
colHullX.x = (colHullX.x + colVector.x);
};
colHullY.x = x;
colHullY.height = (colHullY.height + ((colVector.y)>0) ? colVector.y : -(colVector.y));
if (colVector.y < 0){
colHullY.y = (colHullY.y + colVector.y);
};
}
public function flickering():Boolean{
return ((_flickerTimer >= 0));
}
public function hitRight(_arg1:FlxObject, _arg2:Number):void{
hitLeft(_arg1, _arg2);
}
public function destroy():void{
}
public function getScreenXY(_arg1:FlxPoint=null):FlxPoint{
if (_arg1 == null){
_arg1 = new FlxPoint();
};
_arg1.x = (FlxU.floor((x + FlxU.roundingError)) + FlxU.floor((FlxG.scroll.x * scrollFactor.x)));
_arg1.y = (FlxU.floor((y + FlxU.roundingError)) + FlxU.floor((FlxG.scroll.y * scrollFactor.y)));
return (_arg1);
}
public function flicker(_arg1:Number=1):void{
_flickerTimer = _arg1;
if (_flickerTimer < 0){
_flicker = false;
visible = true;
};
}
}
}//package org.flixel
Section 41
//FlxPoint (org.flixel.FlxPoint)
package org.flixel {
public class FlxPoint {
public var x:Number;
public var y:Number;
public function FlxPoint(_arg1:Number=0, _arg2:Number=0){
x = _arg1;
y = _arg2;
}
public function toString():String{
return (FlxU.getClassName(this, true));
}
}
}//package org.flixel
Section 42
//FlxQuadTree (org.flixel.FlxQuadTree)
package org.flixel {
import org.flixel.data.*;
public class FlxQuadTree extends FlxRect {
protected var _sw:FlxQuadTree;
protected var _mx:Number;
protected var _my:Number;
protected var _ne:FlxQuadTree;
protected var _hh:Number;
protected var _headA:FlxList;
protected var _headB:FlxList;
protected var _canSubdivide:Boolean;
protected var _l:Number;
protected var _hw:Number;
protected var _nw:FlxQuadTree;
protected var _se:FlxQuadTree;
protected var _tailA:FlxList;
protected var _r:Number;
protected var _t:Number;
protected var _tailB:FlxList;
protected var _b:Number;
public static const A_LIST:uint = 0;
public static const MIN:Number = 48;
public static const B_LIST:uint = 1;
protected static var _ot:Number;
protected static var _or:Number;
protected static var _o:FlxObject;
protected static var _oa:uint;
protected static var _oc:Function;
protected static var _ob:Number;
protected static var _ol:Number;
public function FlxQuadTree(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:FlxQuadTree=null){
var _local6:FlxList;
var _local7:FlxList;
super(_arg1, _arg2, _arg3, _arg4);
_canSubdivide = (((_arg3 > MIN)) || ((_arg4 > MIN)));
_headA = (_tailA = new FlxList());
_headB = (_tailB = new FlxList());
if (_arg5){
if (_arg5._headA.object != null){
_local6 = _arg5._headA;
while (_local6 != null) {
if (_tailA.object != null){
_local7 = _tailA;
_tailA = new FlxList();
_local7.next = _tailA;
};
_tailA.object = _local6.object;
_local6 = _local6.next;
};
};
if (_arg5._headB.object != null){
_local6 = _arg5._headB;
while (_local6 != null) {
if (_tailB.object != null){
_local7 = _tailB;
_tailB = new FlxList();
_local7.next = _tailB;
};
_tailB.object = _local6.object;
_local6 = _local6.next;
};
};
};
_nw = null;
_ne = null;
_se = null;
_sw = null;
_l = x;
_r = (x + width);
_hw = (width / 2);
_mx = (_l + _hw);
_t = y;
_b = (y + height);
_hh = (height / 2);
_my = (_t + _hh);
}
protected function addObject():void{
if (((!(_canSubdivide)) || ((((((((_l >= _ol)) && ((_r <= _or)))) && ((_t >= _ot)))) && ((_b <= _ob)))))){
addToList();
return;
};
if ((((_ol > _l)) && ((_or < _mx)))){
if ((((_ot > _t)) && ((_ob < _my)))){
if (_nw == null){
_nw = new FlxQuadTree(_l, _t, _hw, _hh, this);
};
_nw.addObject();
return;
};
if ((((_ot > _my)) && ((_ob < _b)))){
if (_sw == null){
_sw = new FlxQuadTree(_l, _my, _hw, _hh, this);
};
_sw.addObject();
return;
};
};
if ((((_ol > _mx)) && ((_or < _r)))){
if ((((_ot > _t)) && ((_ob < _my)))){
if (_ne == null){
_ne = new FlxQuadTree(_mx, _t, _hw, _hh, this);
};
_ne.addObject();
return;
};
if ((((_ot > _my)) && ((_ob < _b)))){
if (_se == null){
_se = new FlxQuadTree(_mx, _my, _hw, _hh, this);
};
_se.addObject();
return;
};
};
if ((((((((_or > _l)) && ((_ol < _mx)))) && ((_ob > _t)))) && ((_ot < _my)))){
if (_nw == null){
_nw = new FlxQuadTree(_l, _t, _hw, _hh, this);
};
_nw.addObject();
};
if ((((((((_or > _mx)) && ((_ol < _r)))) && ((_ob > _t)))) && ((_ot < _my)))){
if (_ne == null){
_ne = new FlxQuadTree(_mx, _t, _hw, _hh, this);
};
_ne.addObject();
};
if ((((((((_or > _mx)) && ((_ol < _r)))) && ((_ob > _my)))) && ((_ot < _b)))){
if (_se == null){
_se = new FlxQuadTree(_mx, _my, _hw, _hh, this);
};
_se.addObject();
};
if ((((((((_or > _l)) && ((_ol < _mx)))) && ((_ob > _my)))) && ((_ot < _b)))){
if (_sw == null){
_sw = new FlxQuadTree(_l, _my, _hw, _hh, this);
};
_sw.addObject();
};
}
protected function addToList():void{
var _local1:FlxList;
if (_oa == A_LIST){
if (_tailA.object != null){
_local1 = _tailA;
_tailA = new FlxList();
_local1.next = _tailA;
};
_tailA.object = _o;
} else {
if (_tailB.object != null){
_local1 = _tailB;
_tailB = new FlxList();
_local1.next = _tailB;
};
_tailB.object = _o;
};
if (!_canSubdivide){
return;
};
if (_nw != null){
_nw.addToList();
};
if (_ne != null){
_ne.addToList();
};
if (_se != null){
_se.addToList();
};
if (_sw != null){
_sw.addToList();
};
}
public function overlap(_arg1:Boolean=true, _arg2:Function=null):Boolean{
var _local4:FlxList;
_oc = _arg2;
var _local3:Boolean;
if (_arg1){
_oa = B_LIST;
if (_headA.object != null){
_local4 = _headA;
while (_local4 != null) {
_o = _local4.object;
if (((((_o.exists) && (_o.solid))) && (overlapNode()))){
_local3 = true;
};
_local4 = _local4.next;
};
};
_oa = A_LIST;
if (_headB.object != null){
_local4 = _headB;
while (_local4 != null) {
_o = _local4.object;
if (((_o.exists) && (_o.solid))){
if (((!((_nw == null))) && (_nw.overlapNode()))){
_local3 = true;
};
if (((!((_ne == null))) && (_ne.overlapNode()))){
_local3 = true;
};
if (((!((_se == null))) && (_se.overlapNode()))){
_local3 = true;
};
if (((!((_sw == null))) && (_sw.overlapNode()))){
_local3 = true;
};
};
_local4 = _local4.next;
};
};
} else {
if (_headA.object != null){
_local4 = _headA;
while (_local4 != null) {
_o = _local4.object;
if (((((_o.exists) && (_o.solid))) && (overlapNode(_local4.next)))){
_local3 = true;
};
_local4 = _local4.next;
};
};
};
if (((!((_nw == null))) && (_nw.overlap(_arg1, _oc)))){
_local3 = true;
};
if (((!((_ne == null))) && (_ne.overlap(_arg1, _oc)))){
_local3 = true;
};
if (((!((_se == null))) && (_se.overlap(_arg1, _oc)))){
_local3 = true;
};
if (((!((_sw == null))) && (_sw.overlap(_arg1, _oc)))){
_local3 = true;
};
return (_local3);
}
public function add(_arg1:FlxObject, _arg2:uint):void{
var _local3:FlxObject;
var _local4:Array;
var _local5:uint;
var _local6:uint;
_oa = _arg2;
if (_arg1._group){
_local4 = (_arg1 as FlxGroup).members;
_local5 = _local4.length;
_local6 = 0;
while (_local6 < _local5) {
_local3 = (_local4[_local6] as FlxObject);
if (((!((_local3 == null))) && (_local3.exists))){
if (_local3._group){
add(_local3, _arg2);
} else {
if (_local3.solid){
_o = _local3;
_ol = _o.x;
_ot = _o.y;
_or = (_o.x + _o.width);
_ob = (_o.y + _o.height);
addObject();
};
};
};
_local6++;
};
};
if (_arg1.solid){
_o = _arg1;
_ol = _o.x;
_ot = _o.y;
_or = (_o.x + _o.width);
_ob = (_o.y + _o.height);
addObject();
};
}
protected function overlapNode(_arg1:FlxList=null):Boolean{
var _local3:FlxObject;
var _local2:Boolean;
var _local4:FlxList = _arg1;
if (_local4 == null){
if (_oa == A_LIST){
_local4 = _headA;
} else {
_local4 = _headB;
};
};
if (_local4.object != null){
while (_local4 != null) {
_local3 = _local4.object;
if ((((((((((((((((((_o === _local3)) || (!(_local3.exists)))) || (!(_o.exists)))) || (!(_local3.solid)))) || (!(_o.solid)))) || (((_o.x + _o.width) < (_local3.x + FlxU.roundingError))))) || (((_o.x + FlxU.roundingError) > (_local3.x + _local3.width))))) || (((_o.y + _o.height) < (_local3.y + FlxU.roundingError))))) || (((_o.y + FlxU.roundingError) > (_local3.y + _local3.height))))){
_local4 = _local4.next;
} else {
if (_oc == null){
_o.kill();
_local3.kill();
_local2 = true;
} else {
if (_oc(_o, _local3)){
_local2 = true;
};
};
_local4 = _local4.next;
};
};
};
return (_local2);
}
}
}//package org.flixel
Section 43
//FlxRect (org.flixel.FlxRect)
package org.flixel {
public class FlxRect extends FlxPoint {
public var width:Number;
public var height:Number;
public function FlxRect(_arg1:Number=0, _arg2:Number=0, _arg3:Number=0, _arg4:Number=0){
super(_arg1, _arg2);
width = _arg3;
height = _arg4;
}
public function get bottom():Number{
return ((y + height));
}
public function get top():Number{
return (y);
}
public function get left():Number{
return (x);
}
public function get right():Number{
return ((x + width));
}
}
}//package org.flixel
Section 44
//FlxSave (org.flixel.FlxSave)
package org.flixel {
import flash.net.*;
public class FlxSave {
protected var _so:SharedObject;
public var data:Object;
public var name:String;
public function FlxSave(){
name = null;
_so = null;
data = null;
}
public function read(_arg1:String):Object{
if (_so == null){
FlxG.log("WARNING: You must call FlxSave.bind()\nbefore calling FlxSave.read().");
return (null);
};
return (data[_arg1]);
}
public function forceSave(_arg1:uint=0):Boolean{
var MinFileSize = _arg1;
if (_so == null){
FlxG.log("WARNING: You must call FlxSave.bind()\nbefore calling FlxSave.forceSave().");
return (false);
};
var status:Object;
try {
status = _so.flush(MinFileSize);
} catch(e:Error) {
FlxG.log("WARNING: There was a problem flushing\nthe shared object data from FlxSave.");
return (false);
};
return ((status == SharedObjectFlushStatus.FLUSHED));
}
public function bind(_arg1:String):Boolean{
var Name = _arg1;
name = null;
_so = null;
data = null;
name = Name;
try {
_so = SharedObject.getLocal(name);
} catch(e:Error) {
FlxG.log("WARNING: There was a problem binding to\nthe shared object data from FlxSave.");
name = null;
_so = null;
data = null;
return (false);
};
data = _so.data;
return (true);
}
public function erase(_arg1:uint=0):Boolean{
if (_so == null){
FlxG.log("WARNING: You must call FlxSave.bind()\nbefore calling FlxSave.erase().");
return (false);
};
_so.clear();
return (forceSave(_arg1));
}
public function write(_arg1:String, _arg2:Object, _arg3:uint=0):Boolean{
if (_so == null){
FlxG.log("WARNING: You must call FlxSave.bind()\nbefore calling FlxSave.write().");
return (false);
};
data[_arg1] = _arg2;
return (forceSave(_arg3));
}
}
}//package org.flixel
Section 45
//FlxSound (org.flixel.FlxSound)
package org.flixel {
import flash.events.*;
import flash.net.*;
import flash.media.*;
public class FlxSound extends FlxObject {
protected var _position:Number;
protected var _fadeOutTotal:Number;
protected var _fadeOutTimer:Number;
protected var _sound:Sound;
protected var _pauseOnFadeOut:Boolean;
protected var _volumeAdjust:Number;
protected var _radius:Number;
protected var _volume:Number;
protected var _point2:FlxPoint;
protected var _channel:SoundChannel;
protected var _fadeInTimer:Number;
protected var _fadeInTotal:Number;
protected var _pan:Boolean;
protected var _looped:Boolean;
protected var _transform:SoundTransform;
protected var _init:Boolean;
public var survive:Boolean;
protected var _core:FlxObject;
public function FlxSound(){
_point2 = new FlxPoint();
_transform = new SoundTransform();
init();
fixed = true;
}
public function loadStream(_arg1:String, _arg2:Boolean=false):FlxSound{
stop();
init();
_sound = new Sound(new URLRequest(_arg1));
_looped = _arg2;
updateTransform();
active = true;
return (this);
}
public function stop():void{
_position = 0;
if (_channel != null){
_channel.stop();
stopped();
};
}
public function loadEmbedded(_arg1:Class, _arg2:Boolean=false):FlxSound{
stop();
init();
_sound = new (_arg1);
_looped = _arg2;
updateTransform();
active = true;
return (this);
}
public function get volume():Number{
return (_volume);
}
function updateTransform():void{
_transform.volume = (((FlxG.getMuteValue() * FlxG.volume) * _volume) * _volumeAdjust);
if (_channel != null){
_channel.soundTransform = _transform;
};
}
public function fadeOut(_arg1:Number, _arg2:Boolean=false):void{
_pauseOnFadeOut = _arg2;
_fadeInTimer = 0;
_fadeOutTimer = _arg1;
_fadeOutTotal = _fadeOutTimer;
}
public function set volume(_arg1:Number):void{
_volume = _arg1;
if (_volume < 0){
_volume = 0;
} else {
if (_volume > 1){
_volume = 1;
};
};
updateTransform();
}
public function play():void{
if (_position < 0){
return;
};
if (_looped){
if (_position == 0){
if (_channel == null){
_channel = _sound.play(0, 9999, _transform);
};
if (_channel == null){
active = false;
};
} else {
_channel = _sound.play(_position, 0, _transform);
if (_channel == null){
active = false;
} else {
_channel.addEventListener(Event.SOUND_COMPLETE, looped);
};
};
} else {
if (_position == 0){
if (_channel == null){
_channel = _sound.play(0, 0, _transform);
if (_channel == null){
active = false;
} else {
_channel.addEventListener(Event.SOUND_COMPLETE, stopped);
};
};
} else {
_channel = _sound.play(_position, 0, _transform);
if (_channel == null){
active = false;
};
};
};
_position = 0;
}
protected function init():void{
_transform.pan = 0;
_sound = null;
_position = 0;
_volume = 1;
_volumeAdjust = 1;
_looped = false;
_core = null;
_radius = 0;
_pan = false;
_fadeOutTimer = 0;
_fadeOutTotal = 0;
_pauseOnFadeOut = false;
_fadeInTimer = 0;
_fadeInTotal = 0;
active = false;
visible = false;
solid = false;
}
protected function looped(_arg1:Event=null):void{
if (_channel == null){
return;
};
_channel.removeEventListener(Event.SOUND_COMPLETE, looped);
_channel = null;
play();
}
protected function updateSound():void{
var _local3:FlxPoint;
var _local4:FlxPoint;
var _local5:Number;
var _local6:Number;
var _local7:Number;
if (_position != 0){
return;
};
var _local1:Number = 1;
var _local2:Number = 1;
if (_core != null){
_local3 = new FlxPoint();
_local4 = new FlxPoint();
_core.getScreenXY(_local3);
getScreenXY(_local4);
_local5 = (_local3.x - _local4.x);
_local6 = (_local3.y - _local4.y);
_local1 = ((_radius - Math.sqrt(((_local5 * _local5) + (_local6 * _local6)))) / _radius);
if (_local1 < 0){
_local1 = 0;
};
if (_local1 > 1){
_local1 = 1;
};
if (_pan){
_local7 = (-(_local5) / _radius);
if (_local7 < -1){
_local7 = -1;
} else {
if (_local7 > 1){
_local7 = 1;
};
};
_transform.pan = _local7;
};
};
if (_fadeOutTimer > 0){
_fadeOutTimer = (_fadeOutTimer - FlxG.elapsed);
if (_fadeOutTimer <= 0){
if (_pauseOnFadeOut){
pause();
} else {
stop();
};
};
_local2 = (_fadeOutTimer / _fadeOutTotal);
if (_local2 < 0){
_local2 = 0;
};
} else {
if (_fadeInTimer > 0){
_fadeInTimer = (_fadeInTimer - FlxG.elapsed);
_local2 = (_fadeInTimer / _fadeInTotal);
if (_local2 < 0){
_local2 = 0;
};
_local2 = (1 - _local2);
};
};
_volumeAdjust = (_local1 * _local2);
updateTransform();
}
public function fadeIn(_arg1:Number):void{
_fadeOutTimer = 0;
_fadeInTimer = _arg1;
_fadeInTotal = _fadeInTimer;
play();
}
override public function update():void{
super.update();
updateSound();
}
protected function stopped(_arg1:Event=null):void{
if (!_looped){
_channel.removeEventListener(Event.SOUND_COMPLETE, stopped);
} else {
_channel.removeEventListener(Event.SOUND_COMPLETE, looped);
};
_channel = null;
active = false;
}
public function pause():void{
if (_channel == null){
_position = -1;
return;
};
_position = _channel.position;
_channel.stop();
if (_looped){
while (_position >= _sound.length) {
_position = (_position - _sound.length);
};
};
_channel = null;
}
override public function destroy():void{
if (active){
stop();
};
}
public function proximity(_arg1:Number, _arg2:Number, _arg3:FlxObject, _arg4:Number, _arg5:Boolean=true):FlxSound{
x = _arg1;
y = _arg2;
_core = _arg3;
_radius = _arg4;
_pan = _arg5;
return (this);
}
}
}//package org.flixel
Section 46
//FlxSprite (org.flixel.FlxSprite)
package org.flixel {
import flash.display.*;
import flash.geom.*;
import org.flixel.data.*;
public class FlxSprite extends FlxObject {
protected var _mtx:Matrix;
protected var _caf:uint;
public var finished:Boolean;
protected var _animations:Array;
protected var _ct:ColorTransform;
public var offset:FlxPoint;
protected var _callback:Function;
protected var _curAnim:FlxAnim;
protected var _framePixels:BitmapData;
protected var _flipped:uint;
public var scale:FlxPoint;
protected var _pixels:BitmapData;
protected var _bakedRotation:Number;
public var blend:String;
public var frameWidth:uint;
protected var _flashRect2:Rectangle;
protected var _alpha:Number;
protected var _flashPointZero:Point;
protected var _curFrame:uint;
public var frameHeight:uint;
protected var _flashRect:Rectangle;
protected var _frameTimer:Number;
protected var _facing:uint;
public var antialiasing:Boolean;
protected var _color:uint;
public static const LEFT:uint = 0;
public static const DOWN:uint = 3;
public static const UP:uint = 2;
public static const RIGHT:uint = 1;
public function FlxSprite(_arg1:Number=0, _arg2:Number=0, _arg3:Class=null){
x = _arg1;
y = _arg2;
_flashRect = new Rectangle();
_flashRect2 = new Rectangle();
_flashPointZero = new Point();
if (_arg3 == null){
createGraphic(8, 8);
} else {
loadGraphic(_arg3);
};
offset = new FlxPoint();
scale = new FlxPoint(1, 1);
_alpha = 1;
_color = 0xFFFFFF;
blend = null;
antialiasing = false;
finished = false;
_facing = RIGHT;
_animations = new Array();
_flipped = 0;
_curAnim = null;
_curFrame = 0;
_caf = 0;
_frameTimer = 0;
_mtx = new Matrix();
_callback = null;
}
protected function renderSprite():void{
getScreenXY(_point);
_flashPoint.x = _point.x;
_flashPoint.y = _point.y;
if ((((((((((angle == 0)) || ((_bakedRotation > 0)))) && ((scale.x == 1)))) && ((scale.y == 1)))) && ((blend == null)))){
FlxG.buffer.copyPixels(_framePixels, _flashRect, _flashPoint, null, null, true);
return;
};
_mtx.identity();
_mtx.translate(-(origin.x), -(origin.y));
_mtx.scale(scale.x, scale.y);
if (angle != 0){
_mtx.rotate(((Math.PI * 2) * (angle / 360)));
};
_mtx.translate((_point.x + origin.x), (_point.y + origin.y));
FlxG.buffer.draw(_framePixels, _mtx, null, blend, null, antialiasing);
}
public function fill(_arg1:uint):void{
_pixels.fillRect(_flashRect2, _arg1);
calcFrame();
}
public function addAnimation(_arg1:String, _arg2:Array, _arg3:Number=0, _arg4:Boolean=true):void{
_animations.push(new FlxAnim(_arg1, _arg2, _arg3, _arg4));
}
override public function overlapsPoint(_arg1:Number, _arg2:Number, _arg3:Boolean=false):Boolean{
getScreenXY(_point);
if (_arg3){
return (_framePixels.hitTest(new Point(0, 0), 0xFF, new Point((_arg1 - _point.x), (_arg2 - _point.y))));
};
if ((((((((_arg1 <= _point.x)) || ((_arg1 >= (_point.x + frameWidth))))) || ((_arg2 <= _point.y)))) || ((_arg2 >= (_point.y + frameHeight))))){
return (false);
};
return (true);
}
override public function render():void{
renderSprite();
}
protected function calcFrame():void{
var _local1:uint = (_caf * frameWidth);
var _local2:uint;
var _local3:uint = (_flipped) ? _flipped : _pixels.width;
if (_local1 >= _local3){
_local2 = (uint((_local1 / _local3)) * frameHeight);
_local1 = (_local1 % _local3);
};
if (((_flipped) && ((_facing == LEFT)))){
_local1 = (((_flipped << 1) - _local1) - frameWidth);
};
_flashRect.x = _local1;
_flashRect.y = _local2;
_framePixels.copyPixels(_pixels, _flashRect, _flashPointZero);
_flashRect.x = (_flashRect.y = 0);
if (_ct != null){
_framePixels.colorTransform(_flashRect, _ct);
};
if (_callback != null){
_callback(_curAnim.name, _curFrame, _caf);
};
}
function unsafeBind(_arg1:BitmapData):void{
_pixels = (_framePixels = _arg1);
}
public function loadGraphic(_arg1:Class, _arg2:Boolean=false, _arg3:Boolean=false, _arg4:uint=0, _arg5:uint=0, _arg6:Boolean=false):FlxSprite{
_bakedRotation = 0;
_pixels = FlxG.addBitmap(_arg1, _arg3, _arg6);
if (_arg3){
_flipped = (_pixels.width >> 1);
} else {
_flipped = 0;
};
if (_arg4 == 0){
if (_arg2){
_arg4 = _pixels.height;
} else {
if (_flipped > 0){
_arg4 = (_pixels.width / 2);
} else {
_arg4 = _pixels.width;
};
};
};
width = (frameWidth = _arg4);
if (_arg5 == 0){
if (_arg2){
_arg5 = width;
} else {
_arg5 = _pixels.height;
};
};
height = (frameHeight = _arg5);
resetHelpers();
return (this);
}
public function get pixels():BitmapData{
return (_pixels);
}
public function set facing(_arg1:uint):void{
var _local2 = !((_facing == _arg1));
_facing = _arg1;
if (_local2){
calcFrame();
};
}
protected function resetHelpers():void{
_flashRect.x = 0;
_flashRect.y = 0;
_flashRect.width = frameWidth;
_flashRect.height = frameHeight;
_flashRect2.x = 0;
_flashRect2.y = 0;
_flashRect2.width = _pixels.width;
_flashRect2.height = _pixels.height;
if ((((((_framePixels == null)) || (!((_framePixels.width == width))))) || (!((_framePixels.height == height))))){
_framePixels = new BitmapData(width, height);
};
origin.x = (frameWidth / 2);
origin.y = (frameHeight / 2);
_framePixels.copyPixels(_pixels, _flashRect, _flashPointZero);
_caf = 0;
refreshHulls();
}
override public function getScreenXY(_arg1:FlxPoint=null):FlxPoint{
if (_arg1 == null){
_arg1 = new FlxPoint();
};
_arg1.x = ((FlxU.floor((x + FlxU.roundingError)) + FlxU.floor((FlxG.scroll.x * scrollFactor.x))) - offset.x);
_arg1.y = ((FlxU.floor((y + FlxU.roundingError)) + FlxU.floor((FlxG.scroll.y * scrollFactor.y))) - offset.y);
return (_arg1);
}
public function set alpha(_arg1:Number):void{
if (_arg1 > 1){
_arg1 = 1;
};
if (_arg1 < 0){
_arg1 = 0;
};
if (_arg1 == _alpha){
return;
};
_alpha = _arg1;
if (((!((_alpha == 1))) || (!((_color == 0xFFFFFF))))){
_ct = new ColorTransform((Number((_color >> 16)) / 0xFF), (Number(((_color >> 8) & 0xFF)) / 0xFF), (Number((_color & 0xFF)) / 0xFF), _alpha);
} else {
_ct = null;
};
calcFrame();
}
protected function updateAnimation():void{
var _local1:uint;
var _local2:int;
if (_bakedRotation){
_local1 = _caf;
_local2 = (angle % 360);
if (_local2 < 0){
_local2 = (_local2 + 360);
};
_caf = (_local2 / _bakedRotation);
if (_local1 != _caf){
calcFrame();
};
return;
};
if (((((!((_curAnim == null))) && ((_curAnim.delay > 0)))) && (((_curAnim.looped) || (!(finished)))))){
_frameTimer = (_frameTimer + FlxG.elapsed);
if (_frameTimer > _curAnim.delay){
_frameTimer = (_frameTimer - _curAnim.delay);
if (_curFrame == (_curAnim.frames.length - 1)){
if (_curAnim.looped){
_curFrame = 0;
};
finished = true;
} else {
_curFrame++;
};
_caf = _curAnim.frames[_curFrame];
calcFrame();
};
};
}
public function draw(_arg1:FlxSprite, _arg2:int=0, _arg3:int=0):void{
var _local4:BitmapData = _arg1._framePixels;
if ((((((((((_arg1.angle == 0)) || ((_arg1._bakedRotation > 0)))) && ((_arg1.scale.x == 1)))) && ((_arg1.scale.y == 1)))) && ((_arg1.blend == null)))){
_flashPoint.x = _arg2;
_flashPoint.y = _arg3;
_flashRect2.width = _local4.width;
_flashRect2.height = _local4.height;
_pixels.copyPixels(_local4, _flashRect2, _flashPoint, null, null, true);
_flashRect2.width = _pixels.width;
_flashRect2.height = _pixels.height;
calcFrame();
return;
};
_mtx.identity();
_mtx.translate(-(_arg1.origin.x), -(_arg1.origin.y));
_mtx.scale(_arg1.scale.x, _arg1.scale.y);
if (_arg1.angle != 0){
_mtx.rotate(((Math.PI * 2) * (_arg1.angle / 360)));
};
_mtx.translate((_arg2 + _arg1.origin.x), (_arg3 + _arg1.origin.y));
_pixels.draw(_local4, _mtx, null, _arg1.blend, null, _arg1.antialiasing);
calcFrame();
}
public function loadRotatedGraphic(_arg1:Class, _arg2:uint=16, _arg3:int=-1, _arg4:Boolean=false, _arg5:Boolean=false):FlxSprite{
var _local12:uint;
var _local13:uint;
var _local14:uint;
var _local15:uint;
var _local16:uint;
var _local17:uint;
var _local6:uint = 4;
var _local7:FlxSprite = new FlxSprite().loadGraphic(_arg1, (_arg3 >= 0));
if (_arg3 >= 0){
_local7.frame = _arg3;
};
_local7.antialiasing = _arg4;
var _local8:uint = _local7.width;
if (_local7.height > _local8){
_local8 = _local7.height;
};
if (_arg5){
_local8 = (_local8 * 1.5);
};
var _local9:uint = Math.ceil((_arg2 / _local6));
width = (_local8 * _local9);
height = (_local8 * _local6);
var _local10:String = ((((((String(_arg1) + ":") + _arg3) + ":") + width) + "x") + height);
var _local11:Boolean = FlxG.checkBitmapCache(_local10);
createGraphic(width, height, 0, true, _local10);
_bakedRotation = (360 / _arg2);
if (!_local11){
_local14 = (_local7.width / 2);
_local15 = (_local7.height / 2);
_local16 = (_local8 / 2);
_local17 = (_local8 / 2);
_local12 = 0;
while (_local12 < _local6) {
_local13 = 0;
while (_local13 < _local9) {
draw(_local7, ((_local16 + (_local8 * _local13)) - _local14), (_local17 - _local15));
_local7.angle = (_local7.angle + _bakedRotation);
_local13++;
};
_local17 = (_local17 + _local8);
_local12++;
};
};
frameWidth = (frameHeight = (width = (height = _local8)));
resetHelpers();
return (this);
}
public function set color(_arg1:uint):void{
_arg1 = (_arg1 & 0xFFFFFF);
if (_color == _arg1){
return;
};
_color = _arg1;
if (((!((_alpha == 1))) || (!((_color == 0xFFFFFF))))){
_ct = new ColorTransform((Number((_color >> 16)) / 0xFF), (Number(((_color >> 8) & 0xFF)) / 0xFF), (Number((_color & 0xFF)) / 0xFF), _alpha);
} else {
_ct = null;
};
calcFrame();
}
override public function update():void{
updateMotion();
updateAnimation();
updateFlickering();
}
public function onEmit():void{
}
public function createGraphic(_arg1:uint, _arg2:uint, _arg3:uint=4294967295, _arg4:Boolean=false, _arg5:String=null):FlxSprite{
_bakedRotation = 0;
_pixels = FlxG.createBitmap(_arg1, _arg2, _arg3, _arg4, _arg5);
width = (frameWidth = _pixels.width);
height = (frameHeight = _pixels.height);
resetHelpers();
return (this);
}
public function play(_arg1:String, _arg2:Boolean=false):void{
if (((((!(_arg2)) && (!((_curAnim == null))))) && ((_arg1 == _curAnim.name)))){
return;
};
_curFrame = 0;
_caf = 0;
_frameTimer = 0;
var _local3:uint = _animations.length;
var _local4:uint;
while (_local4 < _local3) {
if (_animations[_local4].name == _arg1){
_curAnim = _animations[_local4];
if (_curAnim.delay <= 0){
finished = true;
} else {
finished = false;
};
_caf = _curAnim.frames[_curFrame];
calcFrame();
return;
};
_local4++;
};
}
public function addAnimationCallback(_arg1:Function):void{
_callback = _arg1;
}
public function set pixels(_arg1:BitmapData):void{
_pixels = _arg1;
width = (frameWidth = _pixels.width);
height = (frameHeight = _pixels.height);
resetHelpers();
}
public function get alpha():Number{
return (_alpha);
}
public function get facing():uint{
return (_facing);
}
public function get color():uint{
return (_color);
}
public function set frame(_arg1:uint):void{
_curAnim = null;
_caf = _arg1;
calcFrame();
}
public function get frame():uint{
return (_caf);
}
public function randomFrame():void{
_curAnim = null;
_caf = int((FlxU.random() * (_pixels.width / frameWidth)));
calcFrame();
}
}
}//package org.flixel
Section 47
//FlxState (org.flixel.FlxState)
package org.flixel {
import flash.display.*;
public class FlxState extends Sprite {
public var defaultGroup:FlxGroup;
public static var screen:FlxSprite;
public static var bgColor:uint;
public function FlxState(){
defaultGroup = new FlxGroup();
if (screen == null){
screen = new FlxSprite();
screen.createGraphic(FlxG.width, FlxG.height, 0, true);
screen.origin.x = (screen.origin.y = 0);
screen.antialiasing = true;
};
}
public function add(_arg1:FlxObject):FlxObject{
return (defaultGroup.add(_arg1));
}
public function preProcess():void{
screen.fill(bgColor);
}
public function collide():void{
defaultGroup.collide();
}
public function render():void{
defaultGroup.render();
}
public function update():void{
defaultGroup.update();
}
public function destroy():void{
defaultGroup.destroy();
}
public function create():void{
}
public function postProcess():void{
}
}
}//package org.flixel
Section 48
//FlxText (org.flixel.FlxText)
package org.flixel {
import flash.display.*;
import flash.text.*;
public class FlxText extends FlxSprite {
protected var _tf:TextField;
protected var _regen:Boolean;
protected var _shadow:uint;
public function FlxText(_arg1:Number, _arg2:Number, _arg3:uint, _arg4:String=null){
if (_arg4 == null){
_arg4 = "";
};
_tf = new TextField();
_tf.width = _arg3;
_tf.height = 1;
_tf.embedFonts = true;
_tf.selectable = false;
_tf.sharpness = 100;
_tf.multiline = true;
_tf.wordWrap = true;
_tf.defaultTextFormat = new TextFormat("system", 8, 0xFFFFFF);
_tf.text = _arg4;
super(_arg1, _arg2);
createGraphic(_arg3, 1);
_regen = true;
_shadow = 0;
solid = false;
calcFrame();
}
public function get shadow():uint{
return (_shadow);
}
public function get size():Number{
return ((_tf.defaultTextFormat.size as Number));
}
override public function get color():uint{
return ((_tf.defaultTextFormat.color as uint));
}
override public function set color(_arg1:uint):void{
var _local2:TextFormat = dtfCopy();
_local2.color = _arg1;
_tf.defaultTextFormat = _local2;
_tf.setTextFormat(_local2);
_regen = true;
calcFrame();
}
public function set shadow(_arg1:uint):void{
_shadow = _arg1;
calcFrame();
}
public function set size(_arg1:Number):void{
var _local2:TextFormat = dtfCopy();
_local2.size = _arg1;
_tf.defaultTextFormat = _local2;
_tf.setTextFormat(_local2);
_regen = true;
calcFrame();
}
public function get alignment():String{
return (_tf.defaultTextFormat.align);
}
protected function dtfCopy():TextFormat{
var _local1:TextFormat = _tf.defaultTextFormat;
return (new TextFormat(_local1.font, _local1.size, _local1.color, _local1.bold, _local1.italic, _local1.underline, _local1.url, _local1.target, _local1.align));
}
public function get text():String{
return (_tf.text);
}
public function get font():String{
return (_tf.defaultTextFormat.font);
}
public function set alignment(_arg1:String):void{
var _local2:TextFormat = dtfCopy();
_local2.align = _arg1;
_tf.defaultTextFormat = _local2;
_tf.setTextFormat(_local2);
calcFrame();
}
public function set font(_arg1:String):void{
var _local2:TextFormat = dtfCopy();
_local2.font = _arg1;
_tf.defaultTextFormat = _local2;
_tf.setTextFormat(_local2);
_regen = true;
calcFrame();
}
override protected function calcFrame():void{
var _local3:uint;
var _local4:uint;
if ((((((_tf == null)) || ((_tf.text == null)))) || ((_tf.text.length <= 0)))){
_framePixels.fillRect(_flashRect, 0);
return;
};
if (_regen){
_local3 = _tf.numLines;
height = 0;
_local4 = 0;
while (_local4 < _local3) {
height = (height + _tf.getLineMetrics(_local4).height);
_local4++;
};
height = (height + 4);
_framePixels = new BitmapData(width, height, true, 0);
frameHeight = height;
_tf.height = (height * 1.2);
_flashRect.x = 0;
_flashRect.y = 0;
_flashRect.width = width;
_flashRect.height = height;
_regen = false;
} else {
_framePixels.fillRect(_flashRect, 0);
};
var _local1:TextFormat = _tf.defaultTextFormat;
var _local2:TextFormat = _local1;
_mtx.identity();
if ((((_local1.align == "center")) && ((_tf.numLines == 1)))){
_local2 = new TextFormat(_local1.font, _local1.size, _local1.color, null, null, null, null, null, "left");
_tf.setTextFormat(_local2);
_mtx.translate(Math.floor(((width - _tf.getLineMetrics(0).width) / 2)), 0);
};
if (_shadow > 0){
_tf.setTextFormat(new TextFormat(_local2.font, _local2.size, _shadow, null, null, null, null, null, _local2.align));
_mtx.translate(1, 1);
_framePixels.draw(_tf, _mtx, _ct);
_mtx.translate(-1, -1);
_tf.setTextFormat(new TextFormat(_local2.font, _local2.size, _local2.color, null, null, null, null, null, _local2.align));
};
_framePixels.draw(_tf, _mtx, _ct);
_tf.setTextFormat(new TextFormat(_local1.font, _local1.size, _local1.color, null, null, null, null, null, _local1.align));
if (solid){
refreshHulls();
};
}
public function setFormat(_arg1:String=null, _arg2:Number=8, _arg3:uint=0xFFFFFF, _arg4:String=null, _arg5:uint=0):FlxText{
if (_arg1 == null){
_arg1 = "";
};
var _local6:TextFormat = dtfCopy();
_local6.font = _arg1;
_local6.size = _arg2;
_local6.color = _arg3;
_local6.align = _arg4;
_tf.defaultTextFormat = _local6;
_tf.setTextFormat(_local6);
_shadow = _arg5;
_regen = true;
calcFrame();
return (this);
}
public function set text(_arg1:String):void{
_tf.text = _arg1;
_regen = true;
calcFrame();
}
}
}//package org.flixel
Section 49
//FlxTilemap (org.flixel.FlxTilemap)
package org.flixel {
import flash.display.*;
import flash.geom.*;
public class FlxTilemap extends FlxObject {
protected var _screenRows:uint;
protected var _data:Array;
protected var _block:FlxObject;
protected var _rects:Array;
protected var _tileHeight:uint;
public var totalTiles:uint;
protected var _screenCols:uint;
public var auto:uint;
public var collideIndex:uint;
protected var _tileWidth:uint;
public var widthInTiles:uint;
public var heightInTiles:uint;
protected var _pixels:BitmapData;
protected var _callbacks:Array;
public var autoTileIndex:uint;
public var drawIndex:uint;
protected var _flashRect:Rectangle;
public var startingIndex:uint;
public static const ALT:uint = 2;
public static const AUTO:uint = 1;
public static const OFF:uint = 0;
public static var ImgAutoAlt:Class = FlxTilemap_ImgAutoAlt;
public static var ImgAuto:Class = FlxTilemap_ImgAuto;
public function FlxTilemap(){
auto = OFF;
collideIndex = 1;
startingIndex = 0;
drawIndex = 1;
widthInTiles = 0;
heightInTiles = 0;
totalTiles = 0;
_data = new Array();
_tileWidth = 0;
_tileHeight = 0;
_rects = null;
_pixels = null;
_block = new FlxObject();
_block.width = (_block.height = 0);
_block.fixed = true;
_callbacks = new Array();
fixed = true;
autoTileIndex = 0;
}
override public function overlaps(_arg1:FlxObject):Boolean{
var _local2:uint;
var _local3:uint;
var _local4:uint;
var _local5:uint;
var _local6:Array = new Array();
var _local7:uint = Math.floor(((_arg1.x - x) / _tileWidth));
var _local8:uint = Math.floor(((_arg1.y - y) / _tileHeight));
var _local9:uint = (Math.ceil((_arg1.width / _tileWidth)) + 1);
var _local10:uint = (Math.ceil((_arg1.height / _tileHeight)) + 1);
var _local11:uint;
while (_local11 < _local10) {
if ((((_local11 < 0)) || ((_local11 >= heightInTiles)))){
break;
};
_local3 = (((_local8 + _local11) * widthInTiles) + _local7);
_local2 = 0;
while (_local2 < _local9) {
if ((((_local2 < 0)) || ((_local2 >= widthInTiles)))){
break;
};
_local5 = (_data[(_local3 + _local2)] as uint);
if (_local5 >= collideIndex){
_local6.push({x:(x + ((_local7 + _local2) * _tileWidth)), y:(y + ((_local8 + _local11) * _tileHeight)), data:_local5});
};
_local2++;
};
_local11++;
};
var _local12:uint = _local6.length;
var _local13:Boolean;
_local4 = 0;
while (_local4 < _local12) {
_block.x = _local6[_local4].x;
_block.y = _local6[_local4].y;
if (_block.overlaps(_arg1)){
return (true);
};
_local4++;
};
return (false);
}
public function loadMap(_arg1:String, _arg2:Class, _arg3:uint=0, _arg4:uint=0):FlxTilemap{
var _local5:uint;
var _local6:Array;
var _local9:uint;
var _local7:Array = _arg1.split("\n");
heightInTiles = _local7.length;
var _local8:uint;
while (_local8 < heightInTiles) {
_local6 = _local7[_local8].split(",");
if (_local6.length <= 1){
heightInTiles--;
} else {
if (widthInTiles == 0){
widthInTiles = _local6.length;
};
_local5 = 0;
while (_local5 < widthInTiles) {
_data.push(uint(_local6[_local5]));
_local5++;
};
};
_local8++;
};
totalTiles = (widthInTiles * heightInTiles);
if (auto > OFF){
collideIndex = (startingIndex = (drawIndex = 0));
_local9 = 0;
while (_local9 < totalTiles) {
autoTile(_local9);
_local9++;
};
};
_pixels = FlxG.addBitmap(_arg2);
_tileWidth = _arg3;
if (_tileWidth == 0){
_tileWidth = _pixels.height;
};
_tileHeight = _arg4;
if (_tileHeight == 0){
_tileHeight = _tileWidth;
};
_block.width = _tileWidth;
_block.height = _tileHeight;
width = (widthInTiles * _tileWidth);
height = (heightInTiles * _tileHeight);
_rects = new Array(totalTiles);
_local9 = 0;
while (_local9 < totalTiles) {
updateTile(_local9);
_local9++;
};
_screenRows = (Math.ceil((FlxG.height / _tileHeight)) + 1);
if (_screenRows > heightInTiles){
_screenRows = heightInTiles;
};
_screenCols = (Math.ceil((FlxG.width / _tileWidth)) + 1);
if (_screenCols > widthInTiles){
_screenCols = widthInTiles;
};
refreshHulls();
return (this);
}
protected function updateTile(_arg1:uint):void{
if (_data[_arg1] < drawIndex){
_rects[_arg1] = null;
return;
};
var _local2:uint = ((_data[_arg1] - startingIndex) * _tileWidth);
var _local3:uint;
if (_local2 >= _pixels.width){
_local3 = (uint((_local2 / _pixels.width)) * _tileHeight);
_local2 = (_local2 % _pixels.width);
};
_rects[_arg1] = new Rectangle(_local2, _local3, _tileWidth, _tileHeight);
}
override public function preCollide(_arg1:FlxObject):void{
var _local2:uint;
var _local3:uint;
colOffsets.length = 0;
var _local4:uint = FlxU.floor(((_arg1.x - x) / _tileWidth));
var _local5:uint = FlxU.floor(((_arg1.y - y) / _tileHeight));
var _local6:uint = (FlxU.ceil((_arg1.width / _tileWidth)) + 1);
var _local7:uint = (FlxU.ceil((_arg1.height / _tileHeight)) + 1);
var _local8:uint;
while (_local8 < _local7) {
if ((((_local8 < 0)) || ((_local8 >= heightInTiles)))){
break;
};
_local3 = (((_local5 + _local8) * widthInTiles) + _local4);
_local2 = 0;
while (_local2 < _local6) {
if ((((_local2 < 0)) || ((_local2 >= widthInTiles)))){
break;
};
if ((_data[(_local3 + _local2)] as uint) >= collideIndex){
colOffsets.push(new FlxPoint((x + ((_local4 + _local2) * _tileWidth)), (y + ((_local5 + _local8) * _tileHeight))));
};
_local2++;
};
_local8++;
};
}
override public function render():void{
renderTilemap();
}
public function getTile(_arg1:uint, _arg2:uint):uint{
return (getTileByIndex(((_arg2 * widthInTiles) + _arg1)));
}
public function ray(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:FlxPoint, _arg6:Number=1):Boolean{
var _local16:uint;
var _local17:uint;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:Number;
var _local7:Number = _tileWidth;
if (_tileHeight < _tileWidth){
_local7 = _tileHeight;
};
_local7 = (_local7 / _arg6);
var _local8:Number = (_arg3 - _arg1);
var _local9:Number = (_arg4 - _arg2);
var _local10:Number = Math.sqrt(((_local8 * _local8) + (_local9 * _local9)));
var _local11:uint = Math.ceil((_local10 / _local7));
var _local12:Number = (_local8 / _local11);
var _local13:Number = (_local9 / _local11);
var _local14:Number = (_arg1 - _local12);
var _local15:Number = (_arg2 - _local13);
var _local18:uint;
while (_local18 < _local11) {
_local14 = (_local14 + _local12);
_local15 = (_local15 + _local13);
if ((((((((_local14 < 0)) || ((_local14 > width)))) || ((_local15 < 0)))) || ((_local15 > height)))){
} else {
_local16 = (_local14 / _tileWidth);
_local17 = (_local15 / _tileHeight);
if ((_data[((_local17 * widthInTiles) + _local16)] as uint) >= collideIndex){
_local16 = (_local16 * _tileWidth);
_local17 = (_local17 * _tileHeight);
_local19 = 0;
_local20 = 0;
_local22 = (_local14 - _local12);
_local23 = (_local15 - _local13);
_local21 = _local16;
if (_local8 < 0){
_local21 = (_local21 + _tileWidth);
};
_local19 = _local21;
_local20 = (_local23 + (_local13 * ((_local21 - _local22) / _local12)));
if ((((_local20 > _local17)) && ((_local20 < (_local17 + _tileHeight))))){
if (_arg5 == null){
_arg5 = new FlxPoint();
};
_arg5.x = _local19;
_arg5.y = _local20;
return (true);
};
_local21 = _local17;
if (_local9 < 0){
_local21 = (_local21 + _tileHeight);
};
_local19 = (_local22 + (_local12 * ((_local21 - _local23) / _local13)));
_local20 = _local21;
if ((((_local19 > _local16)) && ((_local19 < (_local16 + _tileWidth))))){
if (_arg5 == null){
_arg5 = new FlxPoint();
};
_arg5.x = _local19;
_arg5.y = _local20;
return (true);
};
return (false);
};
};
_local18++;
};
return (false);
}
override public function refreshHulls():void{
colHullX.x = 0;
colHullX.y = 0;
colHullX.width = _tileWidth;
colHullX.height = _tileHeight;
colHullY.x = 0;
colHullY.y = 0;
colHullY.width = _tileWidth;
colHullY.height = _tileHeight;
}
public function setTile(_arg1:uint, _arg2:uint, _arg3:uint, _arg4:Boolean=true):void{
setTileByIndex(((_arg2 * widthInTiles) + _arg1), _arg3, _arg4);
}
public function follow():void{
FlxG.followBounds(x, y, width, height);
}
public function setCallback(_arg1:uint, _arg2:Function, _arg3:uint=1):void{
if (_arg3 <= 0){
return;
};
var _local4:uint = _arg1;
while (_local4 < (_arg1 + _arg3)) {
_callbacks[_local4] = _arg2;
_local4++;
};
}
protected function IsAutoTile(_arg1:uint):Boolean{
return ((((_arg1 >= autoTileIndex)) && ((_arg1 <= (autoTileIndex + 46)))));
}
public function setTileByIndex(_arg1:uint, _arg2:uint, _arg3:Boolean=true):void{
var _local4:uint;
_data[_arg1] = _arg2;
if (!_arg3){
return;
};
if (auto == OFF){
updateTile(_arg1);
return;
};
var _local5:int = (int((_arg1 / widthInTiles)) - 1);
var _local6:int = (_local5 + 3);
var _local7:int = ((_arg1 % widthInTiles) - 1);
var _local8:int = (_local7 + 3);
while (_local5 < _local6) {
_local7 = (_local8 - 3);
while (_local7 < _local8) {
if ((((((((_local5 >= 0)) && ((_local5 < heightInTiles)))) && ((_local7 >= 0)))) && ((_local7 < widthInTiles)))){
_local4 = ((_local5 * widthInTiles) + _local7);
autoTile(_local4);
updateTile(_local4);
};
_local7++;
};
_local5++;
};
}
public function getTileByIndex(_arg1:uint):uint{
return ((_data[_arg1] as uint));
}
protected function renderTilemap():void{
var _local5:uint;
var _local6:uint;
getScreenXY(_point);
_flashPoint.x = _point.x;
_flashPoint.y = _point.y;
var _local1:int = Math.floor((-(_flashPoint.x) / _tileWidth));
var _local2:int = Math.floor((-(_flashPoint.y) / _tileHeight));
if (_local1 < 0){
_local1 = 0;
};
if (_local1 > (widthInTiles - _screenCols)){
_local1 = (widthInTiles - _screenCols);
};
if (_local2 < 0){
_local2 = 0;
};
if (_local2 > (heightInTiles - _screenRows)){
_local2 = (heightInTiles - _screenRows);
};
var _local3:int = ((_local2 * widthInTiles) + _local1);
_flashPoint.x = (_flashPoint.x + (_local1 * _tileWidth));
_flashPoint.y = (_flashPoint.y + (_local2 * _tileHeight));
var _local4:int = _flashPoint.x;
var _local7:uint;
while (_local7 < _screenRows) {
_local6 = _local3;
_local5 = 0;
while (_local5 < _screenCols) {
var _temp1 = _local6;
_local6 = (_local6 + 1);
_flashRect = (_rects[_temp1] as Rectangle);
if (_flashRect != null){
FlxG.buffer.copyPixels(_pixels, _flashRect, _flashPoint, null, null, true);
};
_flashPoint.x = (_flashPoint.x + _tileWidth);
_local5++;
};
_local3 = (_local3 + widthInTiles);
_flashPoint.x = _local4;
_flashPoint.y = (_flashPoint.y + _tileHeight);
_local7++;
};
}
protected function autoTile(_arg1:uint):void{
if (!IsAutoTile(_data[_arg1])){
return;
};
_data[_arg1] = 0;
if (((((_arg1 - widthInTiles) < 0)) || (IsAutoTile(_data[(_arg1 - widthInTiles)])))){
_data[_arg1] = (_data[_arg1] + 1);
};
if (((((_arg1 % widthInTiles) >= (widthInTiles - 1))) || (IsAutoTile(_data[(_arg1 + 1)])))){
_data[_arg1] = (_data[_arg1] + 2);
};
if (((((_arg1 + widthInTiles) >= totalTiles)) || (IsAutoTile(_data[(_arg1 + widthInTiles)])))){
_data[_arg1] = (_data[_arg1] + 4);
};
if (((((_arg1 % widthInTiles) <= 0)) || (IsAutoTile(_data[(_arg1 - 1)])))){
_data[_arg1] = (_data[_arg1] + 8);
};
if ((((auto == ALT)) && ((_data[_arg1] == 15)))){
if (((((((_arg1 % widthInTiles) > 0)) && (((_arg1 - widthInTiles) >= 0)))) && (!(IsAutoTile(_data[((_arg1 - widthInTiles) - 1)]))))){
_data[_arg1] = (_data[_arg1] + 1);
};
if (((((((_arg1 % widthInTiles) < widthInTiles)) && (((_arg1 - widthInTiles) >= 0)))) && (!(IsAutoTile(_data[((_arg1 - widthInTiles) + 1)]))))){
_data[_arg1] = (_data[_arg1] + 2);
};
if (((((((_arg1 % widthInTiles) > 0)) && (((_arg1 + widthInTiles) < totalTiles)))) && (!(IsAutoTile(_data[((_arg1 + widthInTiles) - 1)]))))){
_data[_arg1] = (_data[_arg1] + 4);
};
if (((((((_arg1 % widthInTiles) < widthInTiles)) && (((_arg1 + widthInTiles) < totalTiles)))) && (!(IsAutoTile(_data[((_arg1 + widthInTiles) + 1)]))))){
_data[_arg1] = (_data[_arg1] + 8);
};
};
if ((((auto == ALT)) && ((_data[_arg1] < 15)))){
if (_data[_arg1] == 14){
if (((((((_arg1 % widthInTiles) > 0)) && (((_arg1 + widthInTiles) < totalTiles)))) && (!(IsAutoTile(_data[((_arg1 + widthInTiles) - 1)]))))){
_data[_arg1] = 31;
};
if (((((((_arg1 % widthInTiles) < widthInTiles)) && (((_arg1 + widthInTiles) < totalTiles)))) && (!(IsAutoTile(_data[((_arg1 + widthInTiles) + 1)]))))){
var _local2 = _data;
var _local3 = _arg1;
var _local4 = (_local2[_local3] + 1);
_local2[_local3] = _local4;
if (_data[_arg1] < 31){
_data[_arg1] = 33;
};
};
};
if (_data[_arg1] == 13){
if (((((((_arg1 % widthInTiles) > 0)) && (((_arg1 - widthInTiles) >= 0)))) && (!(IsAutoTile(_data[((_arg1 - widthInTiles) - 1)]))))){
_data[_arg1] = 34;
};
if (((((((_arg1 % widthInTiles) > 0)) && (((_arg1 + widthInTiles) < totalTiles)))) && (!(IsAutoTile(_data[((_arg1 + widthInTiles) - 1)]))))){
_local2 = _data;
_local3 = _arg1;
_local4 = (_local2[_local3] + 1);
_local2[_local3] = _local4;
if (_data[_arg1] < 34){
_data[_arg1] = 36;
};
};
};
if (_data[_arg1] == 11){
if (((((((_arg1 % widthInTiles) > 0)) && (((_arg1 - widthInTiles) >= 0)))) && (!(IsAutoTile(_data[((_arg1 - widthInTiles) - 1)]))))){
_data[_arg1] = 37;
};
if (((((((_arg1 % widthInTiles) < widthInTiles)) && (((_arg1 - widthInTiles) >= 0)))) && (!(IsAutoTile(_data[((_arg1 - widthInTiles) + 1)]))))){
_local2 = _data;
_local3 = _arg1;
_local4 = (_local2[_local3] + 1);
_local2[_local3] = _local4;
if (_data[_arg1] < 37){
_data[_arg1] = 39;
};
};
};
if (_data[_arg1] == 7){
if (((((((_arg1 % widthInTiles) < widthInTiles)) && (((_arg1 - widthInTiles) >= 0)))) && (!(IsAutoTile(_data[((_arg1 - widthInTiles) + 1)]))))){
_data[_arg1] = 40;
};
if (((((((_arg1 % widthInTiles) < widthInTiles)) && (((_arg1 + widthInTiles) < totalTiles)))) && (!(IsAutoTile(_data[((_arg1 + widthInTiles) + 1)]))))){
_local2 = _data;
_local3 = _arg1;
_local4 = (_local2[_local3] + 1);
_local2[_local3] = _local4;
if (_data[_arg1] < 40){
_data[_arg1] = 42;
};
};
};
if (_data[_arg1] == 3){
if (((((((_arg1 % widthInTiles) < widthInTiles)) && (((_arg1 - widthInTiles) >= 0)))) && (!(IsAutoTile(_data[((_arg1 - widthInTiles) + 1)]))))){
_data[_arg1] = 43;
};
};
if (_data[_arg1] == 6){
if (((((((_arg1 % widthInTiles) < widthInTiles)) && (((_arg1 + widthInTiles) < totalTiles)))) && (!(IsAutoTile(_data[((_arg1 + widthInTiles) + 1)]))))){
_data[_arg1] = 44;
};
};
if (_data[_arg1] == 9){
if (((((((_arg1 % widthInTiles) > 0)) && (((_arg1 - widthInTiles) >= 0)))) && (!(IsAutoTile(_data[((_arg1 - widthInTiles) - 1)]))))){
_data[_arg1] = 45;
};
};
if (_data[_arg1] == 12){
if (((((((_arg1 % widthInTiles) > 0)) && (((_arg1 + widthInTiles) < totalTiles)))) && (!(IsAutoTile(_data[((_arg1 + widthInTiles) - 1)]))))){
_data[_arg1] = 46;
};
};
};
_data[_arg1] = (_data[_arg1] + autoTileIndex);
}
public static function arrayToCSV(_arg1:Array, _arg2:int):String{
var _local3:uint;
var _local4:uint;
var _local5:String;
var _local6:int = (_arg1.length / _arg2);
_local3 = 0;
while (_local3 < _local6) {
_local4 = 0;
while (_local4 < _arg2) {
if (_local4 == 0){
if (_local3 == 0){
_local5 = (_local5 + _arg1[0]);
} else {
_local5 = (_local5 + ("\n" + _arg1[(_local3 * _arg2)]));
};
} else {
_local5 = (_local5 + (", " + _arg1[((_local3 * _arg2) + _local4)]));
};
_local4++;
};
_local3++;
};
return (_local5);
}
public static function pngToCSV(_arg1:Class, _arg2:Boolean=false, _arg3:uint=1):String{
var _local4:Bitmap;
var _local6:uint;
var _local7:uint;
var _local8:uint;
var _local9:String;
var _local12:Bitmap;
var _local13:Matrix;
if (_arg3 <= 1){
_local4 = new (_arg1);
} else {
_local12 = new (_arg1);
_local4 = new Bitmap(new BitmapData((_local12.width * _arg3), (_local12.height * _arg3)));
_local13 = new Matrix();
_local13.scale(_arg3, _arg3);
_local4.bitmapData.draw(_local12, _local13);
};
var _local5:BitmapData = _local4.bitmapData;
var _local10:uint = _local4.width;
var _local11:uint = _local4.height;
_local6 = 0;
while (_local6 < _local11) {
_local7 = 0;
while (_local7 < _local10) {
_local8 = _local5.getPixel(_local7, _local6);
if (((((_arg2) && ((_local8 > 0)))) || (((!(_arg2)) && ((_local8 == 0)))))){
_local8 = 1;
} else {
_local8 = 0;
};
if (_local7 == 0){
if (_local6 == 0){
_local9 = (_local9 + _local8);
} else {
_local9 = (_local9 + ("\n" + _local8));
};
} else {
_local9 = (_local9 + (", " + _local8));
};
_local7++;
};
_local6++;
};
return (_local9);
}
}
}//package org.flixel
Section 50
//FlxTilemap_ImgAuto (org.flixel.FlxTilemap_ImgAuto)
package org.flixel {
import mx.core.*;
public class FlxTilemap_ImgAuto extends BitmapAsset {
}
}//package org.flixel
Section 51
//FlxTilemap_ImgAutoAlt (org.flixel.FlxTilemap_ImgAutoAlt)
package org.flixel {
import mx.core.*;
public class FlxTilemap_ImgAutoAlt extends BitmapAsset {
}
}//package org.flixel
Section 52
//FlxU (org.flixel.FlxU)
package org.flixel {
import flash.net.*;
import flash.utils.*;
public class FlxU {
protected static var _originalSeed:Number;
public static var quadTree:FlxQuadTree;
protected static var _seed:Number;
static var roundingError:Number = 1E-7;
public static var quadTreeBounds:FlxRect;
public static function random(_arg1:Boolean=true):Number{
var _local2:Number;
if (((_arg1) && (!(isNaN(_seed))))){
_local2 = randomize(_seed);
_seed = mutate(_seed, _local2);
return (_local2);
};
return (Math.random());
}
public static function mutate(_arg1:Number, _arg2:Number):Number{
_arg1 = (_arg1 + _arg2);
if (_arg1 > 1){
_arg1 = (_arg1 - int(_arg1));
};
return (_arg1);
}
public static function overlap(_arg1:FlxObject, _arg2:FlxObject, _arg3:Function=null):Boolean{
if ((((((((_arg1 == null)) || (!(_arg1.exists)))) || ((_arg2 == null)))) || (!(_arg2.exists)))){
return (false);
};
quadTree = new FlxQuadTree(quadTreeBounds.x, quadTreeBounds.y, quadTreeBounds.width, quadTreeBounds.height);
quadTree.add(_arg1, FlxQuadTree.A_LIST);
if (_arg1 === _arg2){
return (quadTree.overlap(false, _arg3));
};
quadTree.add(_arg2, FlxQuadTree.B_LIST);
return (quadTree.overlap(true, _arg3));
}
public static function getClass(_arg1:String):Class{
return ((getDefinitionByName(_arg1) as Class));
}
public static function openURL(_arg1:String):void{
navigateToURL(new URLRequest(_arg1), "_blank");
}
public static function floor(_arg1:Number):Number{
var _local2:Number = int(_arg1);
return (((_arg1)>0) ? _local2 : ((_local2)!=_arg1) ? (_local2 - 1) : _local2);
}
public static function randRange(_arg1:Number, _arg2:Number):Number{
return ((_arg1 + (random() * (_arg2 - _arg1))));
}
public static function ceil(_arg1:Number):Number{
var _local2:Number = int(_arg1);
return (((_arg1)>0) ? ((_local2)!=_arg1) ? (_local2 + 1) : _local2 : _local2);
}
public static function solveYCollision(_arg1:FlxObject, _arg2:FlxObject):Boolean{
var _local5:Number;
var _local7:Boolean;
var _local14:uint;
var _local15:uint;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:Number;
var _local26:Number;
var _local27:Number;
var _local28:Number;
var _local29:Number;
var _local3:Number = _arg1.colVector.y;
var _local4:Number = _arg2.colVector.y;
if (_local3 == _local4){
return (false);
};
_arg1.preCollide(_arg2);
_arg2.preCollide(_arg1);
var _local6:Boolean;
var _local8 = (_local3 == 0);
var _local9 = (_local3 < 0);
var _local10 = (_local3 > 0);
var _local11 = (_local4 == 0);
var _local12 = (_local4 < 0);
var _local13 = (_local4 > 0);
var _local16:FlxRect = _arg1.colHullY;
var _local17:FlxRect = _arg2.colHullY;
var _local18:Array = _arg1.colOffsets;
var _local19:Array = _arg2.colOffsets;
var _local20:uint = _local18.length;
var _local21:uint = _local19.length;
_local7 = ((((((((((_local8) && (_local12))) || (((_local10) && (_local11))))) || (((_local10) && (_local12))))) || (((((_local9) && (_local12))) && ((((_local3)>0) ? _local3 : -(_local3) < ((_local4)>0) ? _local4 : -(_local4))))))) || (((((_local10) && (_local13))) && ((((_local3)>0) ? _local3 : -(_local3) > ((_local4)>0) ? _local4 : -(_local4))))));
if ((_local7) ? ((!(_arg1.collideBottom)) || (!(_arg2.collideTop))) : ((!(_arg1.collideTop)) || (!(_arg2.collideBottom)))){
return (false);
};
_local14 = 0;
while (_local14 < _local20) {
_local22 = _local18[_local14].x;
_local23 = _local18[_local14].y;
_local16.x = (_local16.x + _local22);
_local16.y = (_local16.y + _local23);
_local15 = 0;
while (_local15 < _local21) {
_local24 = _local19[_local15].x;
_local25 = _local19[_local15].y;
_local17.x = (_local17.x + _local24);
_local17.y = (_local17.y + _local25);
if (((((((((_local16.x + _local16.width) < (_local17.x + roundingError))) || (((_local16.x + roundingError) > (_local17.x + _local17.width))))) || (((_local16.y + _local16.height) < (_local17.y + roundingError))))) || (((_local16.y + roundingError) > (_local17.y + _local17.height))))){
_local17.x = (_local17.x - _local24);
_local17.y = (_local17.y - _local25);
} else {
if (_local7){
if (_local9){
_local26 = (_local16.y + _arg1.colHullX.height);
} else {
_local26 = (_local16.y + _local16.height);
};
if (_local12){
_local27 = _local17.y;
} else {
_local27 = ((_local17.y + _local17.height) - _arg2.colHullX.height);
};
} else {
if (_local12){
_local26 = (-(_local17.y) - _arg2.colHullX.height);
} else {
_local26 = (-(_local17.y) - _local17.height);
};
if (_local9){
_local27 = -(_local16.y);
} else {
_local27 = ((-(_local16.y) - _local16.height) + _arg1.colHullX.height);
};
};
_local5 = (_local26 - _local27);
if ((((((_local5 == 0)) || (((!(_arg1.fixed)) && ((((_local5)>0) ? _local5 : -(_local5) > (_local16.height * 0.8))))))) || (((!(_arg2.fixed)) && ((((_local5)>0) ? _local5 : -(_local5) > (_local17.height * 0.8))))))){
_local17.x = (_local17.x - _local24);
_local17.y = (_local17.y - _local25);
} else {
_local6 = true;
_local28 = _arg2.velocity.y;
_local29 = _arg1.velocity.y;
if (((!(_arg1.fixed)) && (_arg2.fixed))){
if (_arg1._group){
_arg1.reset(_arg1.x, (_arg1.y - _local5));
} else {
_arg1.y = (_arg1.y - _local5);
};
} else {
if (((_arg1.fixed) && (!(_arg2.fixed)))){
if (_arg2._group){
_arg2.reset(_arg2.x, (_arg2.y + _local5));
} else {
_arg2.y = (_arg2.y + _local5);
};
} else {
if (((!(_arg1.fixed)) && (!(_arg2.fixed)))){
_local5 = (_local5 / 2);
if (_arg1._group){
_arg1.reset(_arg1.x, (_arg1.y - _local5));
} else {
_arg1.y = (_arg1.y - _local5);
};
if (_arg2._group){
_arg2.reset(_arg2.x, (_arg2.y + _local5));
} else {
_arg2.y = (_arg2.y + _local5);
};
_local28 = (_local28 / 2);
_local29 = (_local29 / 2);
};
};
};
if (_local7){
_arg1.hitBottom(_arg2, _local28);
_arg2.hitTop(_arg1, _local29);
} else {
_arg1.hitTop(_arg2, _local28);
_arg2.hitBottom(_arg1, _local29);
};
if (((!(_arg1.fixed)) && (!((_local5 == 0))))){
if (_local7){
_local16.y = (_local16.y - _local5);
if (((_arg2.fixed) && (_arg2.moves))){
_local28 = _arg2.colVector.x;
_arg1.x = (_arg1.x + _local28);
_local16.x = (_local16.x + _local28);
_arg1.colHullX.x = (_arg1.colHullX.x + _local28);
};
} else {
_local16.y = (_local16.y - _local5);
_local16.height = (_local16.height + _local5);
};
};
if (((!(_arg2.fixed)) && (!((_local5 == 0))))){
if (_local7){
_local17.y = (_local17.y + _local5);
_local17.height = (_local17.height - _local5);
} else {
_local17.height = (_local17.height + _local5);
if (((_arg1.fixed) && (_arg1.moves))){
_local29 = _arg1.colVector.x;
_arg2.x = (_arg2.x + _local29);
_local17.x = (_local17.x + _local29);
_arg2.colHullX.x = (_arg2.colHullX.x + _local29);
};
};
};
_local17.x = (_local17.x - _local24);
_local17.y = (_local17.y - _local25);
};
};
_local15++;
};
_local16.x = (_local16.x - _local22);
_local16.y = (_local16.y - _local23);
_local14++;
};
return (_local6);
}
public static function getAngle(_arg1:Number, _arg2:Number):Number{
return (((Math.atan2(_arg2, _arg1) * 180) / Math.PI));
}
public static function setWorldBounds(_arg1:Number=0, _arg2:Number=0, _arg3:Number=0, _arg4:Number=0):void{
if ((((((((_arg1 == 0)) && ((_arg2 == 0)))) && ((_arg3 == 0)))) && ((_arg4 == 0)))){
_arg1 = (-128 * FlxG.width);
_arg2 = (-128 * FlxG.height);
_arg3 = (0x0100 * FlxG.width);
_arg4 = (0x0100 * FlxG.height);
};
if (quadTreeBounds == null){
quadTreeBounds = new FlxRect();
};
quadTreeBounds.x = _arg1;
quadTreeBounds.y = _arg2;
if (_arg3 != 0){
quadTreeBounds.width = _arg3;
};
if (_arg4 != 0){
quadTreeBounds.height = _arg4;
};
}
public static function set seed(_arg1:Number):void{
_seed = _arg1;
_originalSeed = _seed;
}
public static function getClassName(_arg1:Object, _arg2:Boolean=false):String{
var _local3:String = getQualifiedClassName(_arg1);
_local3 = _local3.replace("::", ".");
if (_arg2){
_local3 = _local3.substr((_local3.lastIndexOf(".") + 1));
};
return (_local3);
}
public static function randomize(_arg1:Number):Number{
return ((((69621 * int((_arg1 * 2147483647))) % 2147483647) / 2147483647));
}
public static function abs(_arg1:Number):Number{
return (((_arg1)>0) ? _arg1 : -(_arg1));
}
public static function rotatePoint(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:FlxPoint=null):FlxPoint{
if (_arg6 == null){
_arg6 = new FlxPoint();
};
var _local7:Number = ((-(_arg5) / 180) * Math.PI);
var _local8:Number = (_arg1 - _arg3);
var _local9:Number = (_arg4 - _arg2);
_arg6.x = ((_arg3 + (Math.cos(_local7) * _local8)) - (Math.sin(_local7) * _local9));
_arg6.y = (_arg4 - ((Math.sin(_local7) * _local8) + (Math.cos(_local7) * _local9)));
return (_arg6);
}
public static function get seed():Number{
return (_originalSeed);
}
public static function solveXCollision(_arg1:FlxObject, _arg2:FlxObject):Boolean{
var _local5:Boolean;
var _local6:Boolean;
var _local7:Number;
var _local9:Boolean;
var _local16:uint;
var _local17:uint;
var _local24:Number;
var _local25:Number;
var _local26:Number;
var _local27:Number;
var _local28:Number;
var _local29:Number;
var _local30:Number;
var _local31:Number;
var _local3:Number = _arg1.colVector.x;
var _local4:Number = _arg2.colVector.x;
if (_local3 == _local4){
return (false);
};
_arg1.preCollide(_arg2);
_arg2.preCollide(_arg1);
var _local8:Boolean;
var _local10 = (_local3 == 0);
var _local11 = (_local3 < 0);
var _local12 = (_local3 > 0);
var _local13 = (_local4 == 0);
var _local14 = (_local4 < 0);
var _local15 = (_local4 > 0);
var _local18:FlxRect = _arg1.colHullX;
var _local19:FlxRect = _arg2.colHullX;
var _local20:Array = _arg1.colOffsets;
var _local21:Array = _arg2.colOffsets;
var _local22:uint = _local20.length;
var _local23:uint = _local21.length;
_local9 = ((((((((((_local10) && (_local14))) || (((_local12) && (_local13))))) || (((_local12) && (_local14))))) || (((((_local11) && (_local14))) && ((((_local3)>0) ? _local3 : -(_local3) < ((_local4)>0) ? _local4 : -(_local4))))))) || (((((_local12) && (_local15))) && ((((_local3)>0) ? _local3 : -(_local3) > ((_local4)>0) ? _local4 : -(_local4))))));
if ((_local9) ? ((!(_arg1.collideRight)) || (!(_arg2.collideLeft))) : ((!(_arg1.collideLeft)) || (!(_arg2.collideRight)))){
return (false);
};
_local16 = 0;
while (_local16 < _local22) {
_local24 = _local20[_local16].x;
_local25 = _local20[_local16].y;
_local18.x = (_local18.x + _local24);
_local18.y = (_local18.y + _local25);
_local17 = 0;
while (_local17 < _local23) {
_local26 = _local21[_local17].x;
_local27 = _local21[_local17].y;
_local19.x = (_local19.x + _local26);
_local19.y = (_local19.y + _local27);
if (((((((((_local18.x + _local18.width) < (_local19.x + roundingError))) || (((_local18.x + roundingError) > (_local19.x + _local19.width))))) || (((_local18.y + _local18.height) < (_local19.y + roundingError))))) || (((_local18.y + roundingError) > (_local19.y + _local19.height))))){
_local19.x = (_local19.x - _local26);
_local19.y = (_local19.y - _local27);
} else {
if (_local9){
if (_local11){
_local28 = (_local18.x + _arg1.colHullY.width);
} else {
_local28 = (_local18.x + _local18.width);
};
if (_local14){
_local29 = _local19.x;
} else {
_local29 = ((_local19.x + _local19.width) - _arg2.colHullY.width);
};
} else {
if (_local14){
_local28 = (-(_local19.x) - _arg2.colHullY.width);
} else {
_local28 = (-(_local19.x) - _local19.width);
};
if (_local11){
_local29 = -(_local18.x);
} else {
_local29 = ((-(_local18.x) - _local18.width) + _arg1.colHullY.width);
};
};
_local7 = (_local28 - _local29);
if ((((((_local7 == 0)) || (((!(_arg1.fixed)) && ((((_local7)>0) ? _local7 : -(_local7) > (_local18.width * 0.8))))))) || (((!(_arg2.fixed)) && ((((_local7)>0) ? _local7 : -(_local7) > (_local19.width * 0.8))))))){
_local19.x = (_local19.x - _local26);
_local19.y = (_local19.y - _local27);
} else {
_local8 = true;
_local30 = _arg2.velocity.x;
_local31 = _arg1.velocity.x;
if (((!(_arg1.fixed)) && (_arg2.fixed))){
if (_arg1._group){
_arg1.reset((_arg1.x - _local7), _arg1.y);
} else {
_arg1.x = (_arg1.x - _local7);
};
} else {
if (((_arg1.fixed) && (!(_arg2.fixed)))){
if (_arg2._group){
_arg2.reset((_arg2.x + _local7), _arg2.y);
} else {
_arg2.x = (_arg2.x + _local7);
};
} else {
if (((!(_arg1.fixed)) && (!(_arg2.fixed)))){
_local7 = (_local7 / 2);
if (_arg1._group){
_arg1.reset((_arg1.x - _local7), _arg1.y);
} else {
_arg1.x = (_arg1.x - _local7);
};
if (_arg2._group){
_arg2.reset((_arg2.x + _local7), _arg2.y);
} else {
_arg2.x = (_arg2.x + _local7);
};
_local30 = (_local30 / 2);
_local31 = (_local31 / 2);
};
};
};
if (_local9){
_arg1.hitRight(_arg2, _local30);
_arg2.hitLeft(_arg1, _local31);
} else {
_arg1.hitLeft(_arg2, _local30);
_arg2.hitRight(_arg1, _local31);
};
if (((!(_arg1.fixed)) && (!((_local7 == 0))))){
if (_local9){
_local18.width = (_local18.width - _local7);
} else {
_local18.x = (_local18.x - _local7);
_local18.width = (_local18.width + _local7);
};
_arg1.colHullY.x = (_arg1.colHullY.x - _local7);
};
if (((!(_arg2.fixed)) && (!((_local7 == 0))))){
if (_local9){
_local19.x = (_local19.x + _local7);
_local19.width = (_local19.width - _local7);
} else {
_local19.width = (_local19.width + _local7);
};
_arg2.colHullY.x = (_arg2.colHullY.x + _local7);
};
_local19.x = (_local19.x - _local26);
_local19.y = (_local19.y - _local27);
};
};
_local17++;
};
_local18.x = (_local18.x - _local24);
_local18.y = (_local18.y - _local25);
_local16++;
};
return (_local8);
}
public static function computeVelocity(_arg1:Number, _arg2:Number=0, _arg3:Number=0, _arg4:Number=10000):Number{
var _local5:Number;
if (_arg2 != 0){
_arg1 = (_arg1 + (_arg2 * FlxG.elapsed));
} else {
if (_arg3 != 0){
_local5 = (_arg3 * FlxG.elapsed);
if ((_arg1 - _local5) > 0){
_arg1 = (_arg1 - _local5);
} else {
if ((_arg1 + _local5) < 0){
_arg1 = (_arg1 + _local5);
} else {
_arg1 = 0;
};
};
};
};
if (((!((_arg1 == 0))) && (!((_arg4 == 10000))))){
if (_arg1 > _arg4){
_arg1 = _arg4;
} else {
if (_arg1 < -(_arg4)){
_arg1 = -(_arg4);
};
};
};
return (_arg1);
}
public static function collide(_arg1:FlxObject, _arg2:FlxObject):Boolean{
if ((((((((_arg1 == null)) || (!(_arg1.exists)))) || ((_arg2 == null)))) || (!(_arg2.exists)))){
return (false);
};
quadTree = new FlxQuadTree(quadTreeBounds.x, quadTreeBounds.y, quadTreeBounds.width, quadTreeBounds.height);
quadTree.add(_arg1, FlxQuadTree.A_LIST);
var _local3 = (_arg1 === _arg2);
if (!_local3){
quadTree.add(_arg2, FlxQuadTree.B_LIST);
};
var _local4:Boolean = quadTree.overlap(!(_local3), solveXCollision);
var _local5:Boolean = quadTree.overlap(!(_local3), solveYCollision);
return (((_local4) || (_local5)));
}
}
}//package org.flixel
Section 53
//Bullet (Bullet)
package {
import org.flixel.*;
public class Bullet extends FlxSprite {
protected var BulletImage:Class;
public function Bullet(){
BulletImage = Bullet_BulletImage;
super(0, 0);
loadGraphic(BulletImage, true, false, 12, 12, true);
exists = false;
addAnimation("fly", [0, 1, 2, 3], 30, true);
addAnimation("pop", [4, 5], 40, false);
}
override public function hitTop(_arg1:FlxObject, _arg2:Number):void{
hurt(1);
}
public function shoot(_arg1:Number, _arg2:Number, _arg3:Number):void{
reset(_arg1, _arg2);
velocity.x = (Math.cos(((_arg3 * Math.PI) / 180)) * 200);
velocity.y = (Math.sin(((_arg3 * Math.PI) / 180)) * 200);
play("fly");
solid = true;
dead = false;
}
override public function hitRight(_arg1:FlxObject, _arg2:Number):void{
hurt(1);
}
override public function update():void{
if (((dead) && (finished))){
exists = false;
};
super.update();
if (!onScreen()){
exists = false;
};
}
override public function hitLeft(_arg1:FlxObject, _arg2:Number):void{
hurt(1);
}
override public function hitBottom(_arg1:FlxObject, _arg2:Number):void{
hurt(1);
}
override public function hurt(_arg1:Number):void{
play("pop");
dead = true;
solid = false;
}
}
}//package
Section 54
//Bullet_BulletImage (Bullet_BulletImage)
package {
import mx.core.*;
public class Bullet_BulletImage extends BitmapAsset {
}
}//package
Section 55
//GameOverState (GameOverState)
package {
import org.flixel.*;
import flash.display.*;
public class GameOverState extends FlxState {
protected var TitleImage:Class;
public var netText:FlxText;
public var network:Network;
public var txt:FlxGroup;
public var paramObj:Object;
public var titleSpr:FlxSprite;
public function GameOverState(){
TitleImage = GameOverState_TitleImage;
super();
}
override public function update():void{
netText.text = network.ResultString();
if (((((FlxG.keys.justPressed("Z")) || (FlxG.keys.justPressed("Y")))) || (FlxG.mouse.justPressed()))){
FlxG.state = new TitleState();
};
}
override public function create():void{
var _local1:FlxText;
titleSpr = new FlxSprite(0, 0);
titleSpr.loadGraphic(TitleImage);
add(titleSpr);
txt = new FlxGroup();
_local1 = new FlxText(0, 10, 320, "YER GAME BE OVER, MATEY");
_local1.alignment = "center";
txt.add(_local1);
_local1 = new FlxText(0, 70, 320, ("Score: " + Profile.score.toString()));
_local1.alignment = "center";
txt.add(_local1);
_local1 = new FlxText(0, 160, 320, ("Island Reached: " + Profile.island.toString()));
_local1.alignment = "center";
txt.add(_local1);
netText = new FlxText(0, 90, 320, "Saving...");
netText.alignment = "center";
txt.add(netText);
_local1 = new FlxText(0, 220, 320, "BATTEN DOWN THE Z KEY TO EXIT!");
_local1.alignment = "center";
txt.add(_local1);
add(txt);
FlxG.mouse.hide();
paramObj = LoaderInfo(FlxG._game.root.loaderInfo).parameters;
network = new Network(paramObj);
network.Xmit(Profile.score.toString());
}
}
}//package
Section 56
//GameOverState_TitleImage (GameOverState_TitleImage)
package {
import mx.core.*;
public class GameOverState_TitleImage extends BitmapAsset {
}
}//package
Section 57
//HelpState (HelpState)
package {
import org.flixel.*;
public class HelpState extends FlxState {
public var txt:FlxGroup;
protected var TitleImage:Class;
public var titleSpr:FlxSprite;
public function HelpState(){
TitleImage = HelpState_TitleImage;
super();
}
public function TextLine(_arg1:int, _arg2:String):void{
var _local3:FlxText;
_local3 = new FlxText(0, _arg1, 320, _arg2);
_local3.size = 8;
_local3.alignment = "center";
txt.add(_local3);
}
override public function update():void{
if (((((FlxG.keys.justPressed("Z")) || (FlxG.keys.justPressed("Y")))) || (FlxG.mouse.justPressed()))){
FlxG.state = new TitleState();
};
}
override public function create():void{
var _local1:FlxText;
titleSpr = new FlxSprite(0, 0);
titleSpr.loadGraphic(TitleImage);
add(titleSpr);
txt = new FlxGroup();
TextLine(4, "After a horrible pirate accident, Gaston LeFleur lost his entire");
TextLine((4 + 14), "body and had to have it replaced with a wooden peg. No longer");
TextLine((4 + (14 * 2)), "useful to his crew, he was abandoned on a desert island in");
TextLine((4 + (14 * 3)), "the Endless Atoll. A Sea Gypsy took pity on him and imbued him");
TextLine((4 + (14 * 4)), "with Sea Gypsy Magic! Gaston is doomed, but determined to get");
TextLine((4 + (14 * 5)), "whatever treasure he can before he dies of thirst. Good luck!");
TextLine((4 + (14 * 7)), "Arrow keys to hop");
TextLine((4 + (14 * 8)), "Press Z or Y to fire Sea Gypsy Magic");
TextLine((4 + (14 * 9)), "Press X to use a Plank to make a bridge");
TextLine((4 + (14 * 10)), "Press Q to give up and end it all");
TextLine((14 * 12), "Reach the ship on each island to move on to the next.");
TextLine((14 * 13), "Score as many points as you can by killing Kiwis,");
TextLine((14 * 14), "digging up Treasure, and collecting Planks and Hearts");
TextLine((14 * 15), "before you collapse in the tropical heat.");
TextLine(230, "BATTEN DOWN Z FOR THE TITLE SCREEN");
add(txt);
FlxG.mouse.hide();
}
}
}//package
Section 58
//HelpState_TitleImage (HelpState_TitleImage)
package {
import mx.core.*;
public class HelpState_TitleImage extends BitmapAsset {
}
}//package
Section 59
//Hud (Hud)
package {
import org.flixel.*;
public class Hud {
public var chest:FlxSprite;
public var x2:FlxSprite;
public var score:FlxText;
public var island:FlxText;
public var lifeback:FlxSprite;
public var shovel:FlxSprite;
public var lifeback2:FlxSprite;
public var plankTxt:FlxText;
public var hud:FlxGroup;
public var life:FlxSprite;
public function Hud(){
var _local1:FlxSprite;
super();
hud = new FlxGroup();
hud.scrollFactor.x = 0;
hud.scrollFactor.y = 0;
lifeback = new FlxSprite(1, 1);
lifeback.createGraphic(52, 16, 4294967295, true);
hud.add(lifeback, true);
lifeback2 = new FlxSprite(2, 2);
lifeback2.createGraphic(50, 14, 4278190080, true);
hud.add(lifeback2, true);
life = new FlxSprite(3, 3);
life.createGraphic(48, 12, 4294901760, true);
life.origin.x = 0;
hud.add(life, true);
_local1 = new FlxSprite(60, 2);
_local1.loadGraphic(Map.TileImage, true, false, 16, 16, true);
_local1.frame = 27;
hud.add(_local1, true);
shovel = new FlxSprite(110, 2);
shovel.loadGraphic(Map.TileImage, true, false, 16, 16, true);
shovel.frame = 28;
shovel.color = 4278190080;
hud.add(shovel, true);
plankTxt = new FlxText(78, 2, 25, "0");
SetPlanks();
hud.add(plankTxt, true);
score = new FlxText(258, 2, 60, "00000");
score.alignment = "right";
SetScore();
hud.add(score, true);
island = new FlxText(150, 2, 100, ("Island #" + Profile.island));
hud.add(island, true);
x2 = new FlxSprite((320 - 18), 12);
x2.loadGraphic(Map.TileImage, true, false, 16, 16, true);
x2.frame = 32;
x2.visible = false;
hud.add(x2, true);
chest = new FlxSprite(0, 0);
chest.loadGraphic(Map.TileImage, true, false, 16, 16, true);
chest.frame = 33;
chest.exists = false;
hud.add(chest, true);
PlayState(FlxG.state).add(hud);
}
public function SetShovel():void{
if (Profile.shovel){
shovel.color = 4294967295;
} else {
shovel.color = 4278190080;
};
}
public function SetX2():void{
if ((((Profile.x2 <= 1)) && ((Profile.x2 > 0)))){
x2.flicker(1);
};
if (Profile.x2 > 0){
x2.visible = true;
} else {
x2.visible = false;
};
}
public function SetLife(_arg1:int, _arg2:int):void{
life.scale.x = (_arg1 / _arg2);
}
public function Update():void{
if (chest.exists){
if ((((chest.x > 310)) || ((chest.y < 0)))){
Profile.Score(1000);
SetScore();
chest.exists = false;
};
};
}
public function SetScore():void{
var _local1:String;
_local1 = Profile.score.toString();
if (Profile.score < 10){
_local1 = ("0" + _local1);
};
if (Profile.score < 100){
_local1 = ("0" + _local1);
};
if (Profile.score < 1000){
_local1 = ("0" + _local1);
};
if (Profile.score < 10000){
_local1 = ("0" + _local1);
};
score.text = _local1;
}
public function SetPlanks():void{
plankTxt.text = Profile.planks.toString();
}
public function LaunchChest(_arg1:Number, _arg2:Number):void{
chest.exists = true;
chest.x = ((_arg1 + FlxG.scroll.x) - 8);
chest.y = ((_arg2 + FlxG.scroll.y) - 8);
chest.velocity.x = (320 - chest.x);
chest.velocity.y = (0 - chest.y);
}
}
}//package
Section 60
//Kiwi (Kiwi)
package {
import org.flixel.*;
public class Kiwi extends FlxSprite {
public var ouch:Number;
protected var dieSnd:Class;
protected var KiwiImage:Class;
protected var ouchSnd:Class;
public function Kiwi(_arg1:Number, _arg2:Number){
KiwiImage = Kiwi_KiwiImage;
ouchSnd = Kiwi_ouchSnd;
dieSnd = Kiwi_dieSnd;
super(_arg1, _arg2);
loadGraphic(KiwiImage, true, false, 16, 16, true);
addAnimation("walk_rt", [0, 1, 0, 2], 15, true);
addAnimation("walk_dn", [4, 5, 4, 6], 15, true);
addAnimation("walk_lf", [8, 9, 8, 10], 15, true);
addAnimation("walk_up", [12, 13, 12, 14], 15, true);
facing = DOWN;
maxVelocity.x = 100;
maxVelocity.y = 100;
width = 8;
offset.x = 4;
height = 8;
offset.y = 6;
health = 3;
ouch = 0;
}
override public function hitLeft(_arg1:FlxObject, _arg2:Number):void{
switch (int(FlxU.randRange(0, 3))){
case 0:
facing = DOWN;
break;
case 1:
facing = RIGHT;
break;
case 2:
facing = UP;
break;
};
}
public function DecideFacing():Boolean{
if (y < 0){
facing = DOWN;
};
if (x < 0){
facing = RIGHT;
};
if (x > (Profile.mapSize * 16)){
facing = LEFT;
};
if (y > (Profile.mapSize * 16)){
facing = UP;
};
if (FlxU.random() < 0.01){
facing = int(FlxU.randRange(0, 4));
return (true);
};
return (false);
}
override public function hitBottom(_arg1:FlxObject, _arg2:Number):void{
switch (int(FlxU.randRange(0, 3))){
case 0:
facing = LEFT;
break;
case 1:
facing = RIGHT;
break;
case 2:
facing = UP;
break;
};
}
override public function update():void{
DecideFacing();
if (facing == RIGHT){
play("walk_rt");
velocity.x = 30;
velocity.y = 0;
};
if (facing == DOWN){
play("walk_dn");
velocity.x = 0;
velocity.y = 30;
};
if (facing == LEFT){
play("walk_lf");
velocity.x = -30;
velocity.y = 0;
};
if (facing == UP){
play("walk_up");
velocity.x = 0;
velocity.y = -30;
};
super.update();
if (ouch > 0){
ouch = (ouch - FlxG.elapsed);
if (ouch <= 0){
ouch = 0;
color = 4294967295;
};
};
}
override public function hurt(_arg1:Number):void{
health = (health - _arg1);
if (health <= 0){
Profile.Score(100);
PlayState(FlxG.state).hud.SetScore();
exists = false;
FlxG.play(dieSnd, 0.7);
} else {
FlxG.play(ouchSnd, 0.7);
};
ouch = 0.2;
color = 4294936712;
}
override public function hitTop(_arg1:FlxObject, _arg2:Number):void{
switch (int(FlxU.randRange(0, 3))){
case 0:
facing = LEFT;
break;
case 1:
facing = RIGHT;
break;
case 2:
facing = DOWN;
break;
};
}
override public function hitRight(_arg1:FlxObject, _arg2:Number):void{
switch (int(FlxU.randRange(0, 3))){
case 0:
facing = LEFT;
break;
case 1:
facing = DOWN;
break;
case 2:
facing = UP;
break;
};
}
}
}//package
Section 61
//Kiwi_dieSnd (Kiwi_dieSnd)
package {
import mx.core.*;
public class Kiwi_dieSnd extends SoundAsset {
}
}//package
Section 62
//Kiwi_KiwiImage (Kiwi_KiwiImage)
package {
import mx.core.*;
public class Kiwi_KiwiImage extends BitmapAsset {
}
}//package
Section 63
//Kiwi_ouchSnd (Kiwi_ouchSnd)
package {
import mx.core.*;
public class Kiwi_ouchSnd extends SoundAsset {
}
}//package
Section 64
//Main (Main)
package {
import org.flixel.*;
public class Main extends FlxGame {
public function Main(){
super(320, 240, TitleState, 2);
useDefaultHotKeys = true;
}
}
}//package
Section 65
//Map (Map)
package {
import org.flixel.*;
public class Map {
public var backgd:FlxTilemap;
public var width:uint;
public var height:uint;
public var objects:FlxTilemap;
public var map:FlxTilemap;
public static var TileImage:Class = Map_TileImage;
public function Map(){
var _local1:Array;
var _local2:Array;
var _local3:int;
super();
width = Profile.mapSize;
height = Profile.mapSize;
_local1 = new Array();
_local2 = new Array();
backgd = new FlxTilemap();
_local3 = 0;
while (_local3 < ((width + 1) * height)) {
_local1[_local3] = 0;
_local3++;
};
backgd.drawIndex = 0;
backgd.loadMap(FlxTilemap.arrayToCSV(_local1, (width + 1)), TileImage, 16, 16);
_local3 = 0;
while (_local3 < (width * height)) {
if (FlxU.random() < 0.03){
_local1[_local3] = 1;
} else {
_local1[_local3] = 50;
};
_local3++;
};
_local1[(FlxU.randRange(1, (width - 1)) + width)] = 1;
_local3 = 0;
while (_local3 < 6) {
SpreadSand(_local1);
_local3++;
};
_local3 = 0;
while (_local3 < width) {
_local1[_local3] = 50;
_local1[(_local3 + (width * (height - 1)))] = 50;
_local3++;
};
_local3 = 0;
while (_local3 < height) {
_local1[(width * _local3)] = 50;
_local1[(((width * _local3) + width) - 1)] = 50;
_local3++;
};
SandEdges(_local1);
AddGrass(_local1);
map = new FlxTilemap();
map.collideIndex = 50;
objects = new FlxTilemap();
objects.collideIndex = 50;
AddTrees(_local1, _local2);
AddSpecial(_local1, _local2, 28);
AddSpecial(_local1, _local2, 29);
AddSpecial(_local1, _local2, 30);
AddSpecial(_local1, _local2, 32);
AddShip(_local1, _local2);
map.loadMap(FlxTilemap.arrayToCSV(_local1, width), TileImage, 16, 16);
objects.loadMap(FlxTilemap.arrayToCSV(_local2, width), TileImage, 16, 16);
objects.y = (objects.y - 4);
PlayState(FlxG.state).add(backgd);
PlayState(FlxG.state).add(map);
PlayState(FlxG.state).add(objects);
FlxG.followBounds(0, 0, (width * 16), (height * 16));
AddPirate(_local1, _local2);
AddBirds(_local1, _local2);
}
public function MakeGrass(_arg1:Array, _arg2:int, _arg3:int, _arg4:int, _arg5:int):void{
var _local6:int;
var _local7:int;
_local6 = _arg2;
while (_local6 < (_arg2 + _arg4)) {
_local7 = _arg3;
while (_local7 < (_arg3 + _arg5)) {
if ((((_local6 == _arg2)) && ((_local7 == _arg3)))){
_arg1[(_local6 + (_local7 * width))] = 17;
} else {
if ((((_local6 == _arg2)) && ((_local7 == ((_arg3 + _arg5) - 1))))){
_arg1[(_local6 + (_local7 * width))] = 23;
} else {
if (_local6 == _arg2){
_arg1[(_local6 + (_local7 * width))] = 20;
} else {
if ((((_local6 == ((_arg2 + _arg4) - 1))) && ((_local7 == _arg3)))){
_arg1[(_local6 + (_local7 * width))] = 19;
} else {
if ((((_local6 == ((_arg2 + _arg4) - 1))) && ((_local7 == ((_arg3 + _arg5) - 1))))){
_arg1[(_local6 + (_local7 * width))] = 25;
} else {
if (_local6 == ((_arg2 + _arg4) - 1)){
_arg1[(_local6 + (_local7 * width))] = 22;
} else {
if (_local7 == _arg3){
_arg1[(_local6 + (_local7 * width))] = 18;
} else {
if (_local7 == ((_arg3 + _arg5) - 1)){
_arg1[(_local6 + (_local7 * width))] = 24;
} else {
_arg1[(_local6 + (_local7 * width))] = 21;
};
};
};
};
};
};
};
};
_local7++;
};
_local6++;
};
}
public function Update():void{
backgd.x = (backgd.x - (FlxG.elapsed * 8));
if (backgd.x <= -16){
backgd.x = (backgd.x + 16);
};
}
public function PirateRange(_arg1:uint):Number{
var _local2:int;
var _local3:int;
_local2 = (_arg1 % width);
_local3 = (_arg1 / width);
return ((Math.abs((_local2 - Profile.pirateX)) + Math.abs((_local3 - Profile.pirateY))));
}
public function SandEdges(_arg1:Array):void{
var _local2:int;
var _local3:int;
var _local4:Array;
var _local5:int;
_local4 = new Array();
_local2 = 0;
while (_local2 < width) {
_local3 = 0;
while (_local3 < height) {
_local5 = (_local2 + (_local3 * width));
if (_arg1[_local5] == 1){
if (_local2 < (width - 1)){
_local4[0] = uint((_arg1[((_local2 + (_local3 * width)) + 1)] == 50));
} else {
_local4[0] = 1;
};
if (_local2 > 0){
_local4[2] = uint((_arg1[((_local2 + (_local3 * width)) - 1)] == 50));
} else {
_local4[2] = 1;
};
if (_local3 < (height - 1)){
_local4[1] = uint((_arg1[(_local2 + ((_local3 + 1) * width))] == 50));
} else {
_local4[1] = 1;
};
if (_local3 > 0){
_local4[3] = uint((_arg1[(_local2 + ((_local3 - 1) * width))] == 50));
} else {
_local4[3] = 1;
};
if ((((((((_local4[0] == 0)) && ((_local4[1] == 0)))) && ((_local4[2] == 0)))) && ((_local4[3] == 0)))){
_arg1[_local5] = 1;
};
if ((((((((_local4[0] == 1)) && ((_local4[1] == 1)))) && ((_local4[2] == 1)))) && ((_local4[3] == 1)))){
_arg1[_local5] = 2;
};
if ((((((((_local4[3] == 0)) && ((_local4[2] == 1)))) && ((_local4[1] == 1)))) && ((_local4[0] == 1)))){
_arg1[_local5] = 3;
};
if ((((((((_local4[0] == 0)) && ((_local4[2] == 1)))) && ((_local4[1] == 1)))) && ((_local4[3] == 1)))){
_arg1[_local5] = 4;
};
if ((((((((_local4[1] == 0)) && ((_local4[2] == 1)))) && ((_local4[3] == 1)))) && ((_local4[0] == 1)))){
_arg1[_local5] = 5;
};
if ((((((((_local4[0] == 1)) && ((_local4[2] == 0)))) && ((_local4[1] == 1)))) && ((_local4[3] == 1)))){
_arg1[_local5] = 6;
};
if ((((((((_local4[3] == 1)) && ((_local4[1] == 1)))) && ((_local4[2] == 0)))) && ((_local4[0] == 0)))){
_arg1[_local5] = 7;
};
if ((((((((_local4[0] == 1)) && ((_local4[2] == 1)))) && ((_local4[1] == 0)))) && ((_local4[3] == 0)))){
_arg1[_local5] = 8;
};
if ((((((((_local4[2] == 1)) && ((_local4[3] == 1)))) && ((_local4[1] == 0)))) && ((_local4[0] == 0)))){
_arg1[_local5] = 9;
};
if ((((((((_local4[2] == 0)) && ((_local4[3] == 1)))) && ((_local4[1] == 0)))) && ((_local4[0] == 0)))){
_arg1[_local5] = 10;
};
if ((((((((_local4[2] == 0)) && ((_local4[3] == 1)))) && ((_local4[1] == 0)))) && ((_local4[0] == 1)))){
_arg1[_local5] = 11;
};
if ((((((((_local4[2] == 1)) && ((_local4[3] == 0)))) && ((_local4[1] == 0)))) && ((_local4[0] == 0)))){
_arg1[_local5] = 12;
};
if ((((((((_local4[2] == 0)) && ((_local4[3] == 0)))) && ((_local4[1] == 0)))) && ((_local4[0] == 1)))){
_arg1[_local5] = 13;
};
if ((((((((_local4[2] == 1)) && ((_local4[3] == 0)))) && ((_local4[1] == 1)))) && ((_local4[0] == 0)))){
_arg1[_local5] = 14;
};
if ((((((((_local4[2] == 0)) && ((_local4[3] == 0)))) && ((_local4[1] == 1)))) && ((_local4[0] == 0)))){
_arg1[_local5] = 15;
};
if ((((((((_local4[2] == 0)) && ((_local4[3] == 0)))) && ((_local4[1] == 1)))) && ((_local4[0] == 1)))){
_arg1[_local5] = 16;
};
};
_local3++;
};
_local2++;
};
}
public function AddGrass(_arg1:Array):void{
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:int;
var _local8:int;
_local2 = 0;
while (_local2 < width) {
_local3 = 0;
while (_local3 < height) {
_local8 = (_local2 + (_local3 * width));
if (_arg1[_local8] == 1){
_local6 = 0;
_local4 = _local2;
while (_local4 < width) {
if (_arg1[(_local4 + (_local3 * width))] == 1){
_local6++;
} else {
break;
};
_local4++;
};
_local7 = height;
_local4 = _local2;
while (_local4 < (_local2 + _local6)) {
_local5 = _local3;
while (_local5 < height) {
if (_arg1[(_local4 + (_local5 * width))] != 1){
if ((_local5 - _local3) < _local7){
_local7 = (_local5 - _local3);
};
break;
};
_local5++;
};
_local4++;
};
if ((((_local6 >= 3)) && ((_local7 >= 3)))){
MakeGrass(_arg1, _local2, _local3, _local6, _local7);
};
};
_local3++;
};
_local2++;
};
}
public function SpreadSand(_arg1:Array):void{
var _local2:int;
while (_local2 < (width * height)) {
if (_arg1[_local2] == 1){
switch (int(FlxU.randRange(0, 4))){
case 0:
if ((_local2 % width) < (width - 1)){
_arg1[(_local2 + 1)] = 1;
};
break;
case 1:
if ((_local2 / width) < (height - 1)){
_arg1[(_local2 + width)] = 1;
};
break;
case 2:
if ((_local2 % width) > 0){
_arg1[(_local2 - 1)] = 1;
};
break;
case 3:
if ((_local2 / width) > 0){
_arg1[(_local2 - width)] = 1;
};
break;
};
};
_local2++;
};
}
public function AddBirds(_arg1:Array, _arg2:Array):void{
var _local3:int;
var _local4:int;
_local4 = 0;
while (_local4 < Profile.birds) {
while (1) {
_local3 = (int(FlxU.randRange(1, (width - 1))) + (int(FlxU.randRange(1, (height - 1))) * width));
if (((((!((_arg1[_local3] == 50))) && ((_arg2[_local3] == 0)))) && ((PirateRange(_local3) > 3)))){
PlayState(FlxG.state).guy.add(new Kiwi(((_local3 % width) * 16), ((_local3 / width) * 16)));
break;
};
};
_local4++;
};
}
public function AddPirate(_arg1:Array, _arg2:Array):void{
var _local3:int;
var _local4:int;
while (1) {
_local3 = (int(FlxU.randRange(1, (width - 1))) + (int(FlxU.randRange(1, (height - 1))) * width));
if (((!((_arg1[_local3] == 50))) && ((_arg2[_local3] == 0)))){
Profile.pirateX = (_local3 % width);
Profile.pirateY = (_local3 / width);
break;
};
};
}
public function AddTrees(_arg1:Array, _arg2:Array):void{
var _local3:int;
var _local4:int;
_local3 = 0;
while (_local3 < _arg1.length) {
_arg2[_local3] = 0;
if (((((((((_local3 % width) > 0)) && (((_local3 % width) < (width - 1))))) && (((_local3 / width) > 0)))) && (((_local3 / width) < (height - 1))))){
if (_arg1[_local3] != 50){
if (FlxU.random() < 0.05){
_arg2[_local3] = 51;
};
};
};
_local3++;
};
_local4 = 0;
while (_local4 < 3) {
while (1) {
_local3 = (int(FlxU.randRange(1, (width - 1))) + (int(FlxU.randRange(1, (height - 1))) * width));
if (((!((_arg1[_local3] == 50))) && ((_arg2[_local3] == 0)))){
_arg2[_local3] = 27;
break;
};
};
_local4++;
};
}
public function AddShip(_arg1:Array, _arg2:Array):void{
var _local3:int;
var _local4:int;
var _local5:Boolean;
_local5 = false;
while (!(_local5)) {
switch (int(FlxU.randRange(0, 4))){
case 0:
_local3 = int(FlxU.randRange(0, height));
if ((((_arg1[(1 + (_local3 * width))] >= 1)) && ((_arg1[(1 + (_local3 * width))] <= 16)))){
_arg1[(_local3 * width)] = 0;
_arg2[(_local3 * width)] = 31;
if (_arg2[(1 + (_local3 * width))] >= 50){
_arg2[(1 + (_local3 * width))] = 0;
};
_local5 = true;
};
break;
case 1:
_local3 = int(FlxU.randRange(0, height));
if ((((_arg1[((width - 2) + (_local3 * width))] >= 1)) && ((_arg1[((width - 2) + (_local3 * width))] <= 16)))){
_arg1[((width - 1) + (_local3 * width))] = 0;
_arg2[((width - 1) + (_local3 * width))] = 31;
if (_arg2[((width - 2) + (_local3 * width))] >= 50){
_arg2[((width - 2) + (_local3 * width))] = 0;
};
_local5 = true;
};
break;
case 2:
_local3 = int(FlxU.randRange(0, width));
if ((((_arg1[(_local3 + (1 * width))] >= 1)) && ((_arg1[(_local3 + (1 * width))] <= 16)))){
_arg1[_local3] = 0;
_arg2[_local3] = 31;
if (_arg2[(_local3 + (1 * width))] >= 50){
_arg2[(_local3 + (1 * width))] = 0;
};
_local5 = true;
};
break;
case 3:
_local3 = int(FlxU.randRange(0, width));
if ((((_arg1[(_local3 + ((height - 2) * width))] >= 1)) && ((_arg1[(_local3 + ((height - 2) * width))] <= 16)))){
_arg1[(_local3 + ((height - 1) * width))] = 0;
_arg2[(_local3 + ((height - 1) * width))] = 31;
if (_arg2[(_local3 + ((height - 2) * width))] >= 50){
_arg2[(_local3 + ((height - 2) * width))] = 0;
};
_local5 = true;
};
break;
};
};
}
public function AddSpecial(_arg1:Array, _arg2:Array, _arg3:int):void{
var _local4:int;
var _local5:int;
while (1) {
_local4 = (int(FlxU.randRange(1, (width - 1))) + (int(FlxU.randRange(1, (height - 1))) * width));
if (((!((_arg1[_local4] == 50))) && ((_arg2[_local4] == 0)))){
_arg2[_local4] = _arg3;
break;
};
};
}
}
}//package
Section 66
//Map_TileImage (Map_TileImage)
package {
import mx.core.*;
public class Map_TileImage extends BitmapAsset {
}
}//package
Section 67
//Network (Network)
package {
import flash.events.*;
import flash.net.*;
public class Network {
public var myID:int;
public var conn:String;
public var complete:Boolean;
public var result:String;
public var fail:Boolean;
public function Network(_arg1:Object){
conn = new String();
complete = false;
fail = false;
if ((((_arg1["conn"] == undefined)) || ((_arg1["conn"] == 0)))){
myID = 0;
} else {
conn = _arg1["conn"];
myID = _arg1["id"];
};
}
public function Xmit(_arg1:String):void{
result = "Saving...";
var _local2:URLRequest = new URLRequest("http://hamumu.com/piratecall.php");
_local2.data = ((((conn + "\n") + myID) + "\n") + _arg1);
_local2.contentType = "text/plain";
_local2.method = URLRequestMethod.POST;
var _local3:URLLoader = new URLLoader();
_local3.addEventListener(Event.COMPLETE, Complete);
_local3.load(_local2);
}
public function Complete(_arg1:Event):void{
var e = _arg1;
complete = true;
try {
result = new String(e.target.data);
} catch(e:TypeError) {
result = "Connection failed!";
fail = true;
};
}
public function ResultString():String{
return (result);
}
}
}//package
Section 68
//Pirate (Pirate)
package {
import org.flixel.*;
public class Pirate extends FlxSprite {
public var z:Number;
protected var ShadowImage:Class;
protected var heartSnd:Class;
protected var shootSnd:Class;
protected var shovelSnd:Class;
protected var x2Snd:Class;
public var reload:Number;
public var dz:Number;
protected var hopSnd:Class;
public var body:FlxSprite;
protected var ouchSnd:Class;
protected var plankSnd:Class;
protected var bridgeSnd:Class;
public var head:FlxSprite;
protected var BodyImage:Class;
protected var treasureSnd:Class;
protected var HeadImage:Class;
protected var nobridgeSnd:Class;
public function Pirate(_arg1:int, _arg2:int){
HeadImage = Pirate_HeadImage;
BodyImage = Pirate_BodyImage;
ShadowImage = Pirate_ShadowImage;
hopSnd = Pirate_hopSnd;
heartSnd = Pirate_heartSnd;
bridgeSnd = Pirate_bridgeSnd;
nobridgeSnd = Pirate_nobridgeSnd;
plankSnd = Pirate_plankSnd;
x2Snd = Pirate_x2Snd;
treasureSnd = Pirate_treasureSnd;
shovelSnd = Pirate_shovelSnd;
ouchSnd = Pirate_ouchSnd;
shootSnd = Pirate_shootSnd;
super(_arg1, _arg2);
loadGraphic(ShadowImage, true, false, 8, 8, true);
head = new FlxSprite((_arg1 - 4), (_arg2 - 16));
head.loadGraphic(HeadImage, true, false, 16, 16, true);
head.solid = false;
body = new FlxSprite(_arg1, (_arg2 - 8));
body.loadGraphic(BodyImage, true, false, 8, 11, true);
body.solid = false;
PlayState(FlxG.state).add(this);
PlayState(FlxG.state).add(body);
PlayState(FlxG.state).add(head);
FlxG.follow(this);
facing = DOWN;
head.frame = 1;
drag.x = 500;
drag.y = 500;
maxVelocity.x = 100;
maxVelocity.y = 100;
z = 0;
dz = 0;
health = 50;
reload = 0;
}
override public function update():void{
var _local1:int;
var _local2:int;
var _local3:FlxTilemap;
var _local4:Boolean;
acceleration.x = 0;
acceleration.y = 0;
if (!head.visible){
return;
};
health = (health - FlxG.elapsed);
if (health <= 0){
hurt(1);
};
PlayState(FlxG.state).hud.SetLife(health, 50);
z = (z + (dz * FlxG.elapsed));
if (z < 0){
z = 0;
dz = 0;
};
dz = (dz - (FlxG.elapsed * 1200));
if (FlxG.keys.UP){
facing = UP;
head.frame = 3;
acceleration.y = -250;
};
if (FlxG.keys.LEFT){
facing = LEFT;
head.frame = 2;
acceleration.x = -250;
};
if (FlxG.keys.RIGHT){
facing = RIGHT;
head.frame = 0;
acceleration.x = 250;
};
if (FlxG.keys.DOWN){
facing = DOWN;
head.frame = 1;
acceleration.y = 250;
};
if (((((FlxG.keys.Z) || (FlxG.keys.Y))) && ((reload == 0)))){
Shoot();
};
reload = (reload - FlxG.elapsed);
if (reload < 0){
reload = 0;
};
if ((((Profile.x2 > 1)) && (((Profile.x2 - FlxG.elapsed) <= 1)))){
Profile.x2 = (Profile.x2 - FlxG.elapsed);
PlayState(FlxG.state).hud.SetX2();
} else {
Profile.x2 = (Profile.x2 - FlxG.elapsed);
};
if (Profile.x2 <= 0){
PlayState(FlxG.state).hud.SetX2();
Profile.x2 = 0;
};
if (((!((acceleration.x == 0))) || (!((acceleration.y == 0))))){
if (z == 0){
FlxG.play(hopSnd, 0.05);
dz = 100;
};
};
_local1 = ((x + 4) / 16);
_local2 = ((y + 4) / 16);
_local3 = PlayState(FlxG.state).map.objects;
if (_local3.getTile(_local1, _local2) == 27){
_local3.setTile(_local1, _local2, 0);
Profile.planks++;
Profile.Score(20);
FlxG.play(plankSnd, 0.7);
PlayState(FlxG.state).hud.SetPlanks();
PlayState(FlxG.state).hud.SetScore();
};
if (_local3.getTile(_local1, _local2) == 28){
_local3.setTile(_local1, _local2, 0);
Profile.shovel = true;
Profile.Score(50);
FlxG.play(shovelSnd, 0.7);
PlayState(FlxG.state).hud.SetShovel();
PlayState(FlxG.state).hud.SetScore();
};
if ((((_local3.getTile(_local1, _local2) == 29)) && (Profile.shovel))){
_local3.setTile(_local1, _local2, 0);
FlxG.play(treasureSnd, 0.7);
Profile.shovel = false;
PlayState(FlxG.state).hud.SetShovel();
PlayState(FlxG.state).hud.LaunchChest(x, y);
PlayState(FlxG.state).hud.SetScore();
};
if (_local3.getTile(_local1, _local2) == 30){
_local3.setTile(_local1, _local2, 0);
health = (health + 10);
if (health > 50){
health = 50;
};
Profile.Score(10);
FlxG.play(heartSnd, 0.7);
PlayState(FlxG.state).hud.SetLife(health, 50);
PlayState(FlxG.state).hud.SetScore();
};
if (_local3.getTile(_local1, _local2) == 31){
PlayState(FlxG.state).Win();
_local3.setTile(_local1, _local2, 0);
head.visible = false;
body.visible = false;
this.visible = false;
this.solid = false;
Profile.Score((500 + (health * 10)));
PlayState(FlxG.state).hud.SetScore();
};
if (_local3.getTile(_local1, _local2) == 32){
_local3.setTile(_local1, _local2, 0);
Profile.x2 = 5;
FlxG.play(x2Snd, 0.7);
PlayState(FlxG.state).hud.SetX2();
PlayState(FlxG.state).hud.SetScore();
};
if (FlxG.keys.justPressed("Q")){
PlayState(FlxG.state).Lose();
};
if (((FlxG.keys.justPressed("X")) && ((Profile.planks > 0)))){
switch (facing){
case UP:
_local2--;
break;
case DOWN:
_local2++;
break;
case LEFT:
_local1--;
break;
case RIGHT:
_local1++;
break;
};
_local4 = false;
_local3 = PlayState(FlxG.state).map.map;
if ((((((((_local1 > 0)) && ((_local2 > 0)))) && ((_local1 < (Profile.mapSize - 1))))) && ((_local2 < (Profile.mapSize - 1))))){
if (_local3.getTile(_local1, _local2) == 50){
_local3.setTile(_local1, _local2, 26);
Profile.planks--;
PlayState(FlxG.state).hud.SetPlanks();
FlxG.play(bridgeSnd, 0.7);
_local4 = true;
};
};
if (!_local4){
FlxG.play(nobridgeSnd, 0.7);
};
};
super.update();
head.x = (x - 4);
head.y = ((y - 18) - z);
body.x = x;
body.y = ((y - 7) - z);
}
public function Shoot():void{
var _local1:Number;
var _local2:Bullet;
if (FlxG.keys.UP){
if (FlxG.keys.LEFT){
_local1 = (180 + 45);
} else {
if (FlxG.keys.RIGHT){
_local1 = (360 - 45);
} else {
_local1 = 270;
};
};
} else {
if (FlxG.keys.DOWN){
if (FlxG.keys.LEFT){
_local1 = (180 - 45);
} else {
if (FlxG.keys.RIGHT){
_local1 = 45;
} else {
_local1 = 90;
};
};
} else {
if (FlxG.keys.LEFT){
_local1 = 180;
} else {
if (FlxG.keys.RIGHT){
_local1 = 0;
} else {
if (facing == LEFT){
_local1 = 180;
} else {
if (facing == UP){
_local1 = 270;
} else {
if (facing == RIGHT){
_local1 = 0;
} else {
_local1 = 90;
};
};
};
};
};
};
};
for each (_local2 in PlayState(FlxG.state).bullets.members) {
if (!_local2.exists){
_local2.shoot(x, (y - 8), _local1);
reload = 0.25;
FlxG.play(shootSnd, 0.7);
break;
};
};
}
override public function hurt(_arg1:Number):void{
if (flickering()){
return;
};
health = (health - _arg1);
if (health > 0){
FlxG.play(ouchSnd, 0.7);
};
flicker(2);
head.flicker(2);
body.flicker(2);
velocity.x = 0;
velocity.y = 0;
PlayState(FlxG.state).hud.SetLife(health, 50);
if (health <= 0){
PlayState(FlxG.state).Lose();
};
}
}
}//package
Section 69
//Pirate_BodyImage (Pirate_BodyImage)
package {
import mx.core.*;
public class Pirate_BodyImage extends BitmapAsset {
}
}//package
Section 70
//Pirate_bridgeSnd (Pirate_bridgeSnd)
package {
import mx.core.*;
public class Pirate_bridgeSnd extends SoundAsset {
}
}//package
Section 71
//Pirate_HeadImage (Pirate_HeadImage)
package {
import mx.core.*;
public class Pirate_HeadImage extends BitmapAsset {
}
}//package
Section 72
//Pirate_heartSnd (Pirate_heartSnd)
package {
import mx.core.*;
public class Pirate_heartSnd extends SoundAsset {
}
}//package
Section 73
//Pirate_hopSnd (Pirate_hopSnd)
package {
import mx.core.*;
public class Pirate_hopSnd extends SoundAsset {
}
}//package
Section 74
//Pirate_nobridgeSnd (Pirate_nobridgeSnd)
package {
import mx.core.*;
public class Pirate_nobridgeSnd extends SoundAsset {
}
}//package
Section 75
//Pirate_ouchSnd (Pirate_ouchSnd)
package {
import mx.core.*;
public class Pirate_ouchSnd extends SoundAsset {
}
}//package
Section 76
//Pirate_plankSnd (Pirate_plankSnd)
package {
import mx.core.*;
public class Pirate_plankSnd extends SoundAsset {
}
}//package
Section 77
//Pirate_ShadowImage (Pirate_ShadowImage)
package {
import mx.core.*;
public class Pirate_ShadowImage extends BitmapAsset {
}
}//package
Section 78
//Pirate_shootSnd (Pirate_shootSnd)
package {
import mx.core.*;
public class Pirate_shootSnd extends SoundAsset {
}
}//package
Section 79
//Pirate_shovelSnd (Pirate_shovelSnd)
package {
import mx.core.*;
public class Pirate_shovelSnd extends SoundAsset {
}
}//package
Section 80
//Pirate_treasureSnd (Pirate_treasureSnd)
package {
import mx.core.*;
public class Pirate_treasureSnd extends SoundAsset {
}
}//package
Section 81
//Pirate_x2Snd (Pirate_x2Snd)
package {
import mx.core.*;
public class Pirate_x2Snd extends SoundAsset {
}
}//package
Section 82
//PlayState (PlayState)
package {
import org.flixel.*;
public class PlayState extends FlxState {
public var guy:FlxGroup;
protected var winSnd:Class;
public var bullets:FlxGroup;
protected var loseSnd:Class;
public var hud:Hud;
public var pirate:Pirate;
public var map:Map;
public function PlayState(){
winSnd = PlayState_winSnd;
loseSnd = PlayState_loseSnd;
super();
}
public function ShotGuy(_arg1:Bullet, _arg2:FlxSprite):void{
_arg2.hurt(1);
_arg1.hurt(1);
}
override public function create():void{
super.create();
guy = new FlxGroup();
map = new Map();
pirate = new Pirate((Profile.pirateX * 16), (Profile.pirateY * 16));
add(guy);
bullets = new FlxGroup();
var _local1:int;
while (_local1 < 20) {
bullets.add(new Bullet());
_local1++;
};
add(bullets);
hud = new Hud();
FlxG.mouse.hide();
}
public function PirateOuch(_arg1:Pirate, _arg2:FlxSprite):void{
if (_arg1.flickering()){
return;
};
_arg1.hurt(10);
hud.SetLife(_arg1.health, 50);
}
public function NextLevel():void{
Profile.NextLevel();
FlxG.state = new PlayState();
}
public function Defeat():void{
FlxG.state = new GameOverState();
}
override public function update():void{
super.update();
FlxU.collide(map.map, pirate);
FlxU.collide(map.objects, pirate);
FlxU.collide(map.map, guy);
FlxU.collide(map.objects, guy);
FlxU.collide(map.objects, bullets);
FlxU.overlap(bullets, guy, ShotGuy);
FlxU.overlap(pirate, guy, PirateOuch);
map.Update();
hud.Update();
}
public function Lose():void{
FlxG.play(loseSnd, 0.7);
FlxG.fade.start(4278190080, 1, Defeat);
}
public function Win():void{
FlxG.play(winSnd, 0.7);
FlxG.fade.start(4278190080, 1, NextLevel);
}
}
}//package
Section 83
//PlayState_loseSnd (PlayState_loseSnd)
package {
import mx.core.*;
public class PlayState_loseSnd extends SoundAsset {
}
}//package
Section 84
//PlayState_winSnd (PlayState_winSnd)
package {
import mx.core.*;
public class PlayState_winSnd extends SoundAsset {
}
}//package
Section 85
//Profile (Profile)
package {
public class Profile {
public static var pirateY:uint;
public static var shovel:Boolean;
public static var planks:uint;
public static var score:uint;
public static var island:uint;
public static var birds:uint;
public static var x2:Number;
public static var mapSize:uint;
public static var pirateX:uint;
public static function Score(_arg1:uint):void{
if (x2 > 0){
score = (score + (_arg1 * 2));
} else {
score = (score + _arg1);
};
}
public static function NextLevel():void{
island++;
birds++;
if (mapSize < 100){
mapSize = (mapSize + 2);
};
shovel = false;
x2 = 0;
}
public static function NewGame():void{
score = 0;
planks = 3;
mapSize = 20;
birds = 1;
shovel = false;
island = 1;
x2 = 0;
}
}
}//package
Section 86
//TitleState (TitleState)
package {
import org.flixel.*;
public class TitleState extends FlxState {
protected var PlayOffImage:Class;
protected var TitleImage:Class;
protected var PlayOnImage:Class;
protected var HelpOffImage:Class;
public var backSpr:FlxSprite;
protected var HelpOnImage:Class;
protected var TitleBackImage:Class;
public var titleSpr:FlxSprite;
public function TitleState(){
TitleImage = TitleState_TitleImage;
TitleBackImage = TitleState_TitleBackImage;
HelpOffImage = TitleState_HelpOffImage;
HelpOnImage = TitleState_HelpOnImage;
PlayOffImage = TitleState_PlayOffImage;
PlayOnImage = TitleState_PlayOnImage;
super();
}
override public function update():void{
if (((FlxG.keys.justPressed("Z")) || (FlxG.keys.justPressed("Y")))){
Profile.NewGame();
FlxG.state = new PlayState();
};
if (titleSpr.y < 2){
titleSpr.y = (titleSpr.y + (FlxG.elapsed * 80));
};
super.update();
}
public function PlayClick():void{
Profile.NewGame();
FlxG.state = new PlayState();
}
public function MakeButton(_arg1:Class, _arg2:Class, _arg3:Number, _arg4:Number, _arg5:Function):void{
var _local8:FlxButton;
var _local6:FlxSprite = new FlxSprite();
var _local7:FlxSprite = new FlxSprite();
_local6.loadGraphic(_arg2);
_local7.loadGraphic(_arg1);
_local8 = new FlxButton(_arg3, _arg4, _arg5);
_local8.loadGraphic(_local6, _local7);
_local8.scrollFactor.x = 0;
this.add(_local8);
}
override public function create():void{
backSpr = new FlxSprite(0, 0);
backSpr.loadGraphic(TitleBackImage);
add(backSpr);
titleSpr = new FlxSprite(5, -81);
titleSpr.loadGraphic(TitleImage);
add(titleSpr);
MakeButton(PlayOnImage, PlayOffImage, 2, (240 - 38), PlayClick);
MakeButton(HelpOnImage, HelpOffImage, (320 - 94), (240 - 38), HelpClick);
FlxG.mouse.show();
}
public function HelpClick():void{
FlxG.state = new HelpState();
}
}
}//package
Section 87
//TitleState_HelpOffImage (TitleState_HelpOffImage)
package {
import mx.core.*;
public class TitleState_HelpOffImage extends BitmapAsset {
}
}//package
Section 88
//TitleState_HelpOnImage (TitleState_HelpOnImage)
package {
import mx.core.*;
public class TitleState_HelpOnImage extends BitmapAsset {
}
}//package
Section 89
//TitleState_PlayOffImage (TitleState_PlayOffImage)
package {
import mx.core.*;
public class TitleState_PlayOffImage extends BitmapAsset {
}
}//package
Section 90
//TitleState_PlayOnImage (TitleState_PlayOnImage)
package {
import mx.core.*;
public class TitleState_PlayOnImage extends BitmapAsset {
}
}//package
Section 91
//TitleState_TitleBackImage (TitleState_TitleBackImage)
package {
import mx.core.*;
public class TitleState_TitleBackImage extends BitmapAsset {
}
}//package
Section 92
//TitleState_TitleImage (TitleState_TitleImage)
package {
import mx.core.*;
public class TitleState_TitleImage extends BitmapAsset {
}
}//package