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.2.0.3958";
public function BitmapAsset(bitmapData:BitmapData=null, pixelSnapping:String="auto", smoothing:Boolean=false){
super(bitmapData, pixelSnapping, smoothing);
}
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(newWidth:Number, newHeight:Number):void{
width = newWidth;
height = newHeight;
}
public function move(x:Number, y:Number):void{
this.x = x;
this.y = y;
}
}
}//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.2.0.3958";
public function FlexBitmap(bitmapData:BitmapData=null, pixelSnapping:String="auto", smoothing:Boolean=false){
var bitmapData = bitmapData;
var pixelSnapping = pixelSnapping;
var smoothing = smoothing;
super(bitmapData, pixelSnapping, smoothing);
name = NameUtil.createUniqueName(this);
//unresolved jump
var _slot1 = e;
}
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.2.0.3958";
public function FontAsset(){
super();
}
}
}//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(void:Point):Point;
function get name():String;
function set width(flash.display:Number):void;
function get measuredHeight():Number;
function get blendMode():String;
function get scale9Grid():Rectangle;
function set name(flash.display:String):void;
function set scaleX(flash.display:Number):void;
function set scaleY(flash.display:Number):void;
function get measuredWidth():Number;
function get accessibilityProperties():AccessibilityProperties;
function set scrollRect(flash.display:Rectangle):void;
function get cacheAsBitmap():Boolean;
function globalToLocal(void:Point):Point;
function get height():Number;
function set blendMode(flash.display:String):void;
function get parent():DisplayObjectContainer;
function getBounds(String:DisplayObject):Rectangle;
function get opaqueBackground():Object;
function set scale9Grid(flash.display:Rectangle):void;
function setActualSize(_arg1:Number, _arg2:Number):void;
function set alpha(flash.display:Number):void;
function set accessibilityProperties(flash.display:AccessibilityProperties):void;
function get width():Number;
function hitTestPoint(_arg1:Number, _arg2:Number, _arg3:Boolean=false):Boolean;
function set cacheAsBitmap(flash.display: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(flash.display:Number):void;
function set mask(flash.display:DisplayObject):void;
function getRect(String:DisplayObject):Rectangle;
function get alpha():Number;
function set transform(flash.display:Transform):void;
function move(_arg1:Number, _arg2:Number):void;
function get loaderInfo():LoaderInfo;
function get root():DisplayObject;
function hitTestObject(mx.core:IFlexDisplayObject/mx.core:IFlexDisplayObject:stage/get:DisplayObject):Boolean;
function set opaqueBackground(flash.display:Object):void;
function set visible(flash.display:Boolean):void;
function get mask():DisplayObject;
function set x(flash.display:Number):void;
function set y(flash.display:Number):void;
function get transform():Transform;
function set filters(flash.display:Array):void;
function get x():Number;
function get y():Number;
function get filters():Array;
function set rotation(flash.display: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(C:\autobuild\3.2.0\frameworks\projects\framework\src;mx\core;IRepeaterClient.as:Array):void;
function get isDocument():Boolean;
function set repeaters(C:\autobuild\3.2.0\frameworks\projects\framework\src;mx\core;IRepeaterClient.as:Array):void;
function initializeRepeaterArrays(C:\autobuild\3.2.0\frameworks\projects\framework\src;mx\core;IRepeaterClient.as:IRepeaterClient):void;
function get repeaters():Array;
function set repeaterIndices(C:\autobuild\3.2.0\frameworks\projects\framework\src;mx\core;IRepeaterClient.as: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.2.0.3958";
public function SoundAsset(){
super();
}
}
}//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.2.0.3958";
private static var counter:int = 0;
public function NameUtil(){
super();
}
public static function displayObjectToString(displayObject:DisplayObject):String{
var result:String;
var o:DisplayObject;
var s:String;
var indices:Array;
var displayObject = displayObject;
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;
};
//unresolved jump
var _slot1 = e;
return (result);
}
public static function createUniqueName(object:Object):String{
if (!object){
return (null);
};
var name:String = getQualifiedClassName(object);
var index:int = name.indexOf("::");
if (index != -1){
name = name.substr((index + 2));
};
var charCode:int = name.charCodeAt((name.length - 1));
if ((((charCode >= 48)) && ((charCode <= 57)))){
name = (name + "_");
};
return ((name + 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(Name:String, Frames:Array, FrameRate:Number=0, Looped:Boolean=true){
super();
name = Name;
delay = 0;
if (FrameRate > 0){
delay = (1 / FrameRate);
};
frames = Frames;
looped = Looped;
}
}
}//package org.flixel.data
Section 11
//FlxConsole (org.flixel.data.FlxConsole)
package org.flixel.data {
import flash.display.*;
import org.flixel.*;
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(X:uint, Y:uint, Zoom:uint){
super();
visible = false;
x = (X * Zoom);
_by = (Y * Zoom);
_byt = (_by - (FlxG.height * Zoom));
_YT = (_Y = (y = _byt));
var tmp:Bitmap = new Bitmap(new BitmapData((FlxG.width * Zoom), (FlxG.height * Zoom), true, 2130706432));
addChild(tmp);
_fps = new Array(8);
_curFPS = 0;
_fpsUpdate = true;
_text = new TextField();
_text.width = tmp.width;
_text.height = tmp.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 = tmp.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(Text:String):void{
var newText:String;
var i:uint;
if (Text == null){
Text = "NULL";
};
trace(Text);
_lines.push(Text);
if (_lines.length > MAX_CONSOLE_LINES){
_lines.shift();
newText = "";
i = 0;
while (i < _lines.length) {
newText = (newText + (_lines[i] + "\n"));
i++;
};
_text.text = newText;
} else {
_text.appendText((Text + "\n"));
};
_text.scrollV = _text.height;
}
public function update():void{
var fps:uint;
var i:uint;
if (visible){
_fps[_curFPS] = (1 / lastElapsed);
if (++_curFPS >= _fps.length){
_curFPS = 0;
};
_fpsUpdate = !(_fpsUpdate);
if (_fpsUpdate){
fps = 0;
i = 0;
while (i < _fps.length) {
fps = (fps + _fps[i]);
i++;
};
_fpsDisplay.text = (Math.floor((fps / _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(){
super();
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(Color:uint=4278190080, Duration:Number=1, FadeComplete:Function=null, Force:Boolean=false):void{
if (((!(Force)) && (exists))){
return;
};
fill(Color);
_delay = Duration;
_complete = FadeComplete;
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(){
super();
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(Color:uint=4294967295, Duration:Number=1, FlashComplete:Function=null, Force:Boolean=false):void{
if (((!(Force)) && (exists))){
return;
};
fill(Color);
_delay = Duration;
_complete = FlashComplete;
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(){
super();
var i:uint;
_lookup = new Object();
_map = new Array(_t);
i = 65;
while (i <= 90) {
addKey(String.fromCharCode(i), i);
i++;
};
i = 48;
var _temp1 = i;
i = (i + 1);
addKey("ZERO", _temp1);
var _temp2 = i;
i = (i + 1);
addKey("ONE", _temp2);
var _temp3 = i;
i = (i + 1);
addKey("TWO", _temp3);
var _temp4 = i;
i = (i + 1);
addKey("THREE", _temp4);
var _temp5 = i;
i = (i + 1);
addKey("FOUR", _temp5);
var _temp6 = i;
i = (i + 1);
addKey("FIVE", _temp6);
var _temp7 = i;
i = (i + 1);
addKey("SIX", _temp7);
var _temp8 = i;
i = (i + 1);
addKey("SEVEN", _temp8);
var _temp9 = i;
i = (i + 1);
addKey("EIGHT", _temp9);
var _temp10 = i;
i = (i + 1);
addKey("NINE", _temp10);
i = 1;
while (i <= 12) {
addKey(("F" + i), (111 + i));
i++;
};
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(event:KeyboardEvent):void{
var o:Object = _map[event.keyCode];
if (o == null){
return;
};
if (o.current > 0){
o.current = -1;
} else {
o.current = 0;
};
this[o.name] = false;
}
public function pressed(Key:String):Boolean{
return (this[Key]);
}
public function justReleased(Key:String):Boolean{
return ((_map[_lookup[Key]].current == -1));
}
public function handleKeyDown(event:KeyboardEvent):void{
var o:Object = _map[event.keyCode];
if (o == null){
return;
};
if (o.current > 0){
o.current = 1;
} else {
o.current = 2;
};
this[o.name] = true;
}
public function reset():void{
var o:Object;
var i:uint;
while (i < _t) {
if (_map[i] == null){
} else {
o = _map[i];
this[o.name] = false;
o.current = 0;
o.last = 0;
};
i++;
};
}
public function justPressed(Key:String):Boolean{
return ((_map[_lookup[Key]].current == 2));
}
public function update():void{
var o:Object;
var i:uint;
while (i < _t) {
if (_map[i] == null){
} else {
o = _map[i];
if ((((o.last == -1)) && ((o.current == -1)))){
o.current = 0;
} else {
if ((((o.last == 2)) && ((o.current == 2)))){
o.current = 1;
};
};
o.last = o.current;
};
i++;
};
}
protected function addKey(KeyName:String, KeyCode:uint):void{
_lookup[KeyName] = KeyCode;
_map[KeyCode] = {name:KeyName, 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(){
super();
API = null;
}
public function init():void{
var paramObj:Object = LoaderInfo(root.loaderInfo).parameters;
var api_url:String = ((paramObj.api_path) || ("http://www.kongregate.com/flash/API_AS3_Local.swf"));
var request:URLRequest = new URLRequest(api_url);
var loader:Loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, APILoaded);
loader.load(request);
this.addChild(loader);
}
protected function APILoaded(event:Event):void{
API = event.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(){
super();
object = null;
next = null;
}
}
}//package org.flixel.data
Section 17
//FlxMouse (org.flixel.data.FlxMouse)
package org.flixel.data {
import flash.events.*;
import org.flixel.*;
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(X:int, Y:int, XScroll:Number, YScroll:Number):void{
screenX = X;
screenY = Y;
x = (screenX - FlxU.floor(XScroll));
y = (screenY - FlxU.floor(YScroll));
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(event:MouseEvent):void{
if (cursor != null){
cursor.visible = _out;
};
}
public function handleMouseDown(event: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(Graphic:Class, XOffset:int=0, YOffset:int=0):void{
if (Graphic == null){
Graphic = ImgDefaultCursor;
};
cursor = new FlxSprite(screenX, screenY, Graphic);
cursor.offset.x = XOffset;
cursor.offset.y = YOffset;
}
public function handleMouseUp(event:MouseEvent):void{
if (_current > 0){
_current = -1;
} else {
_current = 0;
};
}
public function handleMouseOut(event:MouseEvent):void{
if (cursor != null){
_out = cursor.visible;
cursor.visible = false;
};
}
public function show(Graphic:Class=null, XOffset:int=0, YOffset:int=0):void{
_out = true;
if (Graphic != null){
load(Graphic, XOffset, YOffset);
} 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(PayPalID:String, PayPalAmount:Number, GameTitle:String, GameURL:String, Caption:String):void{
_payPalID = PayPalID;
if (_payPalID.length <= 0){
_donate.visible = false;
};
_payPalAmount = PayPalAmount;
_gameTitle = GameTitle;
_gameURL = GameURL;
_caption.text = Caption;
_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(Top: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 (Top){
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 h:uint;
ImgKeyMinus = FlxPause_ImgKeyMinus;
ImgKeyPlus = FlxPause_ImgKeyPlus;
ImgKey0 = FlxPause_ImgKey0;
ImgKeyP = FlxPause_ImgKeyP;
super();
scrollFactor.x = 0;
scrollFactor.y = 0;
var w:uint = 80;
h = 92;
x = ((FlxG.width - w) / 2);
y = ((FlxG.height - h) / 2);
add(new FlxSprite().createGraphic(w, h, 2852126720, true), true);
(add(new FlxText(0, 0, w, "this game is"), true) as FlxText).alignment = "center";
add(new FlxText(0, 10, w, "PAUSED").setFormat(null, 16, 0xFFFFFF, "center"), true);
add(new FlxSprite(4, 36, ImgKeyP), true);
add(new FlxText(16, 36, (w - 16), "Pause Game"), true);
add(new FlxSprite(4, 50, ImgKey0), true);
add(new FlxText(16, 50, (w - 16), "Mute Sound"), true);
add(new FlxSprite(4, 64, ImgKeyMinus), true);
add(new FlxText(16, 64, (w - 16), "Sound Down"), true);
add(new FlxSprite(4, 78, ImgKeyPlus), true);
add(new FlxText(16, 78, (w - 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(Zoom:uint){
super();
_zoom = Zoom;
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(Intensity:Number=0.05, Duration:Number=0.5):void{
stop();
_intensity = Intensity;
_timer = Duration;
}
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(X:int, Y:int, Callback:Function){
super();
x = X;
y = Y;
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 = Callback;
_onToggle = false;
_pressed = false;
_initialized = false;
_sf = null;
}
protected function onMouseUp(event:MouseEvent):void{
if (((((((((!(exists)) || (!(visible)))) || (!(active)))) || (!(FlxG.mouse.justReleased())))) || ((_callback == null)))){
return;
};
if (overlapsPoint(FlxG.mouse.x, FlxG.mouse.y)){
_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.x, FlxG.mouse.y)){
if (!FlxG.mouse.pressed()){
_pressed = false;
} else {
if (!_pressed){
_pressed = true;
};
};
visibility(!(_pressed));
};
if (_onToggle){
visibility(_off.visible);
};
}
protected function visibility(On:Boolean):void{
if (On){
_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(Image:FlxSprite, ImageHighlight:FlxSprite=null):FlxButton{
_off = (replace(_off, Image) as FlxSprite);
if (ImageHighlight == null){
if (_on != _off){
remove(_on);
};
_on = _off;
} else {
_on = (replace(_on, ImageHighlight) 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(Text:FlxText, TextHighlight:FlxText=null):FlxButton{
if (Text != null){
if (_offT == null){
_offT = Text;
add(_offT);
} else {
_offT = (replace(_offT, Text) as FlxText);
};
};
if (TextHighlight == null){
_onT = _offT;
} else {
if (_onT == null){
_onT = TextHighlight;
add(_onT);
} else {
_onT = (replace(_onT, TextHighlight) 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(On:Boolean):void{
_onToggle = On;
}
}
}//package org.flixel
Section 34
//FlxEmitter (org.flixel.FlxEmitter)
package org.flixel {
public class FlxEmitter extends FlxGroup {
public var maxRotation:Number;
public var delay:Number;
public var quantity:uint;
protected var _timer:Number;
public var gravity:Number;
public var particleDrag:FlxPoint;
public var maxParticleSpeed:FlxPoint;
public var on:Boolean;
protected var _explode:Boolean;
protected var _particle:uint;
public var minParticleSpeed:FlxPoint;
public var minRotation:Number;
protected var _counter:uint;
public function FlxEmitter(X:Number=0, Y:Number=0){
super();
x = X;
y = Y;
width = 0;
height = 0;
minParticleSpeed = new FlxPoint(-100, -100);
maxParticleSpeed = new FlxPoint(100, 100);
minRotation = -360;
maxRotation = 360;
gravity = 400;
particleDrag = new FlxPoint();
delay = 0.1;
quantity = 0;
_counter = 0;
_explode = true;
exists = false;
on = false;
}
public function setRotation(Min:Number=0, Max:Number=0):void{
minRotation = Min;
maxRotation = Max;
}
override public function update():void{
super.update();
updateEmitter();
}
public function setYSpeed(Min:Number=0, Max:Number=0):void{
minParticleSpeed.y = Min;
maxParticleSpeed.y = Max;
}
public function stop(Delay:Number=3):void{
_explode = true;
delay = Delay;
if (delay < 0){
delay = -(Delay);
};
on = false;
}
public function setSize(Width:uint, Height:uint):void{
width = Width;
height = Height;
}
public function at(Object:FlxObject):void{
x = (Object.x + Object.origin.x);
y = (Object.y + Object.origin.y);
}
override protected function updateMembers():void{
var o:FlxObject;
var l:uint = members.length;
var i:uint;
while (i < l) {
o = (members[i] as FlxObject);
if (((((!((o == null))) && (o.exists))) && (o.active))){
o.update();
};
i++;
};
}
public function start(Explode:Boolean=true, Delay:Number=0, Quantity:uint=0):void{
if (members.length <= 0){
FlxG.log("WARNING: there are no sprites loaded in your emitter.\nAdd some to FlxEmitter.members or use FlxEmitter.createSprites().");
return;
};
_explode = Explode;
if (!_explode){
_counter = 0;
};
if (!exists){
_particle = 0;
};
exists = true;
visible = true;
active = true;
dead = false;
on = true;
_timer = 0;
if (quantity == 0){
quantity = Quantity;
};
if (Delay != 0){
delay = Delay;
};
if (delay < 0){
delay = -(delay);
};
}
protected function updateEmitter():void{
var i:uint;
var l:uint;
if (_explode){
_timer = (_timer + FlxG.elapsed);
if ((((delay > 0)) && ((_timer > delay)))){
kill();
return;
};
if (on){
on = false;
l = members.length;
if (quantity > 0){
l = quantity;
};
l = (l + _particle);
i = _particle;
while (i < l) {
emitParticle();
i++;
};
};
return;
};
if (!on){
return;
};
_timer = (_timer + FlxG.elapsed);
while ((((_timer > delay)) && ((((quantity <= 0)) || ((_counter < quantity)))))) {
_timer = (_timer - delay);
emitParticle();
};
}
override public function kill():void{
super.kill();
on = false;
}
public function setXSpeed(Min:Number=0, Max:Number=0):void{
minParticleSpeed.x = Min;
maxParticleSpeed.x = Max;
}
public function createSprites(Graphics:Class, Quantity:uint=50, BakedRotations:uint=16, Multiple:Boolean=true, Collide:Number=0):FlxEmitter{
var r:uint;
var s:FlxSprite;
var sw:Number;
var sh:Number;
members = new Array();
var tf:uint = 1;
if (Multiple){
s = new FlxSprite(0, 0, Graphics);
tf = (s.width / s.height);
};
var i:uint;
while (i < Quantity) {
s = new FlxSprite();
if (Multiple){
r = (FlxU.random() * tf);
if (BakedRotations > 0){
s.loadRotatedGraphic(Graphics, BakedRotations, r);
} else {
s.loadGraphic(Graphics, true);
s.frame = r;
};
} else {
if (BakedRotations > 0){
s.loadRotatedGraphic(Graphics, BakedRotations);
} else {
s.loadGraphic(Graphics);
};
};
if (Collide > 0){
sw = s.width;
sh = s.height;
s.width = (s.width * Collide);
s.height = (s.height * Collide);
s.offset.x = ((sw - s.width) / 2);
s.offset.y = ((sh - s.height) / 2);
s.solid = true;
} else {
s.solid = false;
};
s.exists = false;
s.scrollFactor = scrollFactor;
add(s);
i++;
};
return (this);
}
public function emitParticle():void{
_counter++;
var s:FlxSprite = (members[_particle] as FlxSprite);
s.visible = true;
s.exists = true;
s.active = true;
s.x = ((x - (s.width >> 1)) + (FlxU.random() * width));
s.y = ((y - (s.height >> 1)) + (FlxU.random() * height));
s.velocity.x = minParticleSpeed.x;
if (minParticleSpeed.x != maxParticleSpeed.x){
s.velocity.x = (s.velocity.x + (FlxU.random() * (maxParticleSpeed.x - minParticleSpeed.x)));
};
s.velocity.y = minParticleSpeed.y;
if (minParticleSpeed.y != maxParticleSpeed.y){
s.velocity.y = (s.velocity.y + (FlxU.random() * (maxParticleSpeed.y - minParticleSpeed.y)));
};
s.acceleration.y = gravity;
s.angularVelocity = minRotation;
if (minRotation != maxRotation){
s.angularVelocity = (s.angularVelocity + (FlxU.random() * (maxRotation - minRotation)));
};
if (s.angularVelocity != 0){
s.angle = ((FlxU.random() * 360) - 180);
};
s.drag.x = particleDrag.x;
s.drag.y = particleDrag.y;
s.visible = true;
_particle++;
if (_particle >= members.length){
_particle = 0;
};
s.onEmit();
}
}
}//package org.flixel
Section 35
//FlxG (org.flixel.FlxG)
package org.flixel {
import flash.display.*;
import flash.geom.*;
import org.flixel.data.*;
import flash.utils.*;
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 = 23;
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;
protected 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 function FlxG(){
super();
}
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 s:FlxSound;
if (((!((music == null))) && (music.active))){
music.updateTransform();
};
var sl:uint = sounds.length;
var i:uint;
while (i < sl) {
s = (sounds[i] as FlxSound);
if (((!((s == null))) && (s.active))){
s.updateTransform();
};
i++;
};
}
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(Graphic:Class, Reverse:Boolean=false, Unique:Boolean=false, Key:String=null):BitmapData{
var inc:uint;
var ukey:String;
var classType:String;
var newPixels:BitmapData;
var mtx:Matrix;
var needReverse:Boolean;
var key:String = Key;
if (key == null){
key = String(Graphic);
if (((((Unique) && (!((_cache[key] == undefined))))) && (!((_cache[key] == null))))){
inc = 0;
do {
var _temp1 = inc;
inc = (inc + 1);
ukey = (key + _temp1);
} while (((!((_cache[ukey] == undefined))) && (!((_cache[ukey] == null)))));
key = ukey;
};
};
if (!checkBitmapCache(key)){
classType = getQualifiedSuperclassName(Graphic);
if (classType.indexOf("BitmapData") == -1){
_cache[key] = new (Graphic).bitmapData;
} else {
_cache[key] = new Graphic(0, 0);
};
if (Reverse){
needReverse = true;
};
};
var pixels:BitmapData = _cache[key];
if (((((!(needReverse)) && (Reverse))) && ((pixels.width == new (Graphic).bitmapData.width)))){
needReverse = true;
};
if (needReverse){
newPixels = new BitmapData((pixels.width << 1), pixels.height, true, 0);
newPixels.draw(pixels);
mtx = new Matrix();
mtx.scale(-1, 1);
mtx.translate(newPixels.width, 0);
newPixels.draw(pixels, mtx);
pixels = newPixels;
};
return (pixels);
}
public static function set state(State:FlxState):void{
_game.switchState(State);
}
public static function set mute(Mute:Boolean):void{
_mute = Mute;
changeSounds();
}
public static function play(EmbeddedSound:Class, Volume:Number=1, Looped:Boolean=false):FlxSound{
var sl:uint = sounds.length;
var i:uint;
while (i < sl) {
if (!(sounds[i] as FlxSound).active){
break;
};
i++;
};
if (sounds[i] == null){
sounds[i] = new FlxSound();
};
var s:FlxSound = sounds[i];
s.loadEmbedded(EmbeddedSound, Looped);
s.volume = Volume;
s.play();
return (s);
}
public static function set volume(Volume:Number):void{
_volume = Volume;
if (_volume < 0){
_volume = 0;
} else {
if (_volume > 1){
_volume = 1;
};
};
changeSounds();
}
static function setGameData(Game:FlxGame, Width:uint, Height:uint, Zoom:uint):void{
_game = Game;
_cache = new Object();
width = Width;
height = Height;
_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(Zoom);
flash = new FlxFlash();
fade = new FlxFade();
FlxU.setWorldBounds();
}
public static function playMusic(Music:Class, Volume:Number=1):void{
if (music == null){
music = new FlxSound();
} else {
if (music.active){
music.stop();
};
};
music.loadEmbedded(Music, true);
music.volume = Volume;
music.survive = true;
music.play();
}
public static function createBitmap(Width:uint, Height:uint, Color:uint, Unique:Boolean=false, Key:String=null):BitmapData{
var inc:uint;
var ukey:String;
var key:String = Key;
if (key == null){
key = ((((Width + "x") + Height) + ":") + Color);
if (((((Unique) && (!((_cache[key] == undefined))))) && (!((_cache[key] == null))))){
inc = 0;
do {
var _temp1 = inc;
inc = (inc + 1);
ukey = (key + _temp1);
} while (((!((_cache[ukey] == undefined))) && (!((_cache[ukey] == null)))));
key = ukey;
};
};
if (!checkBitmapCache(key)){
_cache[key] = new BitmapData(Width, Height, true, Color);
};
return (_cache[key]);
}
public static function log(Data:Object):void{
if (((!((_game == null))) && (!((_game._console == null))))){
_game._console.log(((Data)==null) ? "ERROR: null object" : Data.toString());
};
}
public static function checkBitmapCache(Key:String):Boolean{
return (((!((_cache[Key] == undefined))) && (!((_cache[Key] == null)))));
}
static function updateSounds():void{
var s:FlxSound;
if (((!((music == null))) && (music.active))){
music.update();
};
var sl:uint = sounds.length;
var i:uint;
while (i < sl) {
s = (sounds[i] as FlxSound);
if (((!((s == null))) && (s.active))){
s.update();
};
i++;
};
}
static function updateInput():void{
keys.update();
mouse.update(state.mouseX, state.mouseY, scroll.x, scroll.y);
}
public static function stream(URL:String, Volume:Number=1, Looped:Boolean=false):FlxSound{
var sl:uint = sounds.length;
var i:uint;
while (i < sl) {
if (!(sounds[i] as FlxSound).active){
break;
};
i++;
};
if (sounds[i] == null){
sounds[i] = new FlxSound();
};
var s:FlxSound = sounds[i];
s.loadStream(URL, Looped);
s.volume = Volume;
s.play();
return (s);
}
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 s:FlxSound;
if (((!((music == null))) && (music.active))){
music.play();
};
var sl:uint = sounds.length;
var i:uint;
while (i < sl) {
s = (sounds[i] as FlxSound);
if (((!((s == null))) && (s.active))){
s.play();
};
i++;
};
}
public static function followAdjust(LeadX:Number=0, LeadY:Number=0):void{
followLead = new Point(LeadX, LeadY);
}
public static function follow(Target:FlxObject, Lerp:Number=1):void{
followTarget = Target;
followLerp = Lerp;
_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(MinX:int=0, MinY:int=0, MaxX:int=0, MaxY:int=0, UpdateWorldBounds:Boolean=true):void{
followMin = new Point(-(MinX), -(MinY));
followMax = new Point((-(MaxX) + width), (-(MaxY) + height));
if (followMax.x > followMin.x){
followMax.x = followMin.x;
};
if (followMax.y > followMin.y){
followMax.y = followMin.y;
};
if (UpdateWorldBounds){
FlxU.setWorldBounds(-(MinX), -(MinY), (-(MinX) + MaxX), (-(MinY) + MaxY));
};
doFollow();
}
protected static function pauseSounds():void{
var s:FlxSound;
if (((!((music == null))) && (music.active))){
music.pause();
};
var sl:uint = sounds.length;
var i:uint;
while (i < sl) {
s = (sounds[i] as FlxSound);
if (((!((s == null))) && (s.active))){
s.pause();
};
i++;
};
}
static function destroySounds(ForceDestroy:Boolean=false):void{
var s:FlxSound;
if (sounds == null){
return;
};
if (((!((music == null))) && (((ForceDestroy) || (!(music.survive)))))){
music.destroy();
};
var sl:uint = sounds.length;
var i:uint;
while (i < sl) {
s = (sounds[i] as FlxSound);
if (((!((s == null))) && (((ForceDestroy) || (!(s.survive)))))){
s.destroy();
};
i++;
};
}
public static function set pause(Pause:Boolean):void{
var op:Boolean = _pause;
_pause = Pause;
if (_pause != op){
if (_pause){
_game.pauseGame();
pauseSounds();
} else {
_game.unpauseGame();
playSounds();
};
};
}
public static function get pause():Boolean{
return (_pause);
}
}
}//package org.flixel
Section 36
//FlxGame (org.flixel.FlxGame)
package org.flixel {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import org.flixel.data.*;
import flash.text.*;
import flash.utils.*;
import flash.ui.*;
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;
var _iState:Class;
protected var junk:String;// = "FlxGame_junk"
var _zeroPoint:Point;
var _bmpBack:Bitmap;
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 static var useDefaultHotKeys:Boolean;
public function FlxGame(GameSizeX:uint, GameSizeY:uint, InitialState:Class, Zoom:uint=2){
SndBeep = FlxGame_SndBeep;
SndFlixel = FlxGame_SndFlixel;
super();
Mouse.hide();
_zoom = Zoom;
FlxState.bgColor = 4278190080;
FlxG.setGameData(this, GameSizeX, GameSizeY, Zoom);
_elapsed = 0;
_total = 0;
pause = new FlxPause();
_state = null;
_iState = InitialState;
_zeroPoint = new Point();
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, _zeroPoint);
} else {
_bmpFront.bitmapData.copyPixels(_bmpBack.bitmapData, _r, _zeroPoint);
};
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(event:Event=null):void{
if (FlxG.pause){
FlxG.pause = false;
};
}
protected function onKeyUp(event:KeyboardEvent):void{
var c:int;
var code:String;
if ((((event.keyCode == 192)) || ((event.keyCode == 220)))){
_console.toggle();
return;
};
if (useDefaultHotKeys){
c = event.keyCode;
code = String.fromCharCode(event.charCode);
switch (c){
case 48:
case 96:
FlxG.mute = !(FlxG.mute);
showSoundTray();
return;
case 109:
case 189:
FlxG.mute = false;
FlxG.volume = (FlxG.volume - 0.1);
showSoundTray();
return;
case 107:
case 187:
FlxG.mute = false;
FlxG.volume = (FlxG.volume + 0.1);
showSoundTray();
return;
case 80:
FlxG.pause = !(FlxG.pause);
default:
break;
};
};
FlxG.keys.handleKeyUp(event);
}
public function switchState(State: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(State);
if (_state != null){
_state.destroy();
_buffer.swapChildren(State, _state);
_buffer.removeChild(_state);
};
_state = State;
_state.create();
}
protected function addFrame(Frame:Class, ScreenOffsetX:uint, ScreenOffsetY:uint):FlxGame{
_frame = Frame;
_gameXOffset = ScreenOffsetX;
_gameYOffset = ScreenOffsetY;
return (this);
}
protected function onEnterFrame(event:Event):void{
var i:uint;
var soundPrefs:FlxSave;
var vstring:String;
var underline:String;
var tmp:Bitmap;
var text:TextField;
var bx:uint;
var by:uint;
var bmp:Bitmap;
var t:uint = getTimer();
_elapsed = ((t - _total) / 1000);
if (_created){
_console.lastElapsed = _elapsed;
};
_total = t;
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;
soundPrefs = new FlxSave();
if (soundPrefs.bind("flixel")){
if (soundPrefs.data.sound == null){
soundPrefs.data.sound = new Object();
};
soundPrefs.data.mute = FlxG.mute;
soundPrefs.data.volume = FlxG.volume;
soundPrefs.forceSave();
};
};
};
};
};
if (_created){
FlxG.panel.update();
_console.update();
FlxG.updateInput();
FlxG.updateSounds();
if (_paused){
pause.update();
if (_flipped){
FlxG.buffer.copyPixels(_bmpFront.bitmapData, _r, _zeroPoint);
} else {
FlxG.buffer.copyPixels(_bmpBack.bitmapData, _r, _zeroPoint);
};
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);
vstring = ((((FlxG.LIBRARY_NAME + " v") + FlxG.LIBRARY_MAJOR_VERSION) + ".") + FlxG.LIBRARY_MINOR_VERSION);
if (FlxG.debug){
vstring = (vstring + " [debug]");
} else {
vstring = (vstring + " [release]");
};
underline = "";
i = 0;
while (i < (vstring.length + 32)) {
underline = (underline + "-");
i++;
};
FlxG.log(vstring);
FlxG.log(underline);
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;
tmp = new Bitmap(new BitmapData(80, 30, true, 2130706432));
_soundTray.x = (((_gameXOffset + (FlxG.width / 2)) * _zoom) - ((tmp.width / 2) * _soundTray.scaleX));
_soundTray.addChild(tmp);
text = new TextField();
text.width = tmp.width;
text.height = tmp.height;
text.multiline = true;
text.wordWrap = true;
text.selectable = false;
text.embedFonts = true;
text.antiAliasType = AntiAliasType.NORMAL;
text.gridFitType = GridFitType.PIXEL;
text.defaultTextFormat = new TextFormat("system", 8, 0xFFFFFF, null, null, null, null, null, "center");
_soundTray.addChild(text);
text.text = "VOLUME";
text.y = 16;
bx = 10;
by = 14;
_soundTrayBars = new Array();
i = 0;
while (i < 10) {
tmp = new Bitmap(new BitmapData(4, (i + 1), false, 0xFFFFFF));
tmp.x = bx;
tmp.y = by;
_soundTrayBars.push(_soundTray.addChild(tmp));
bx = (bx + 6);
by--;
i++;
};
addChild(_soundTray);
if (_frame != null){
bmp = new _frame();
bmp.scaleX = _zoom;
bmp.scaleY = _zoom;
addChild(bmp);
};
soundPrefs = new FlxSave();
if (((soundPrefs.bind("flixel")) && (!((soundPrefs.data.sound == null))))){
if (soundPrefs.data.volume != null){
FlxG.volume = soundPrefs.data.volume;
};
if (soundPrefs.data.mute != null){
FlxG.mute = soundPrefs.data.mute;
};
showSoundTray(true);
};
_created = true;
switchState(new _iState());
};
};
}
public function showSoundTray(Silent:Boolean=false):void{
if (!Silent){
FlxG.play(SndBeep);
};
_soundTrayTimer = 1;
_soundTray.y = (_gameYOffset * _zoom);
_soundTray.visible = true;
var gv:uint = Math.round((FlxG.volume * 10));
if (FlxG.mute){
gv = 0;
};
var i:uint;
while (i < _soundTrayBars.length) {
if (i < gv){
_soundTrayBars[i].alpha = 1;
} else {
_soundTrayBars[i].alpha = 0.5;
};
i++;
};
}
protected function onFocusLost(event:Event=null):void{
FlxG.pause = true;
}
public static function turnOffHotkeys():void{
useDefaultHotKeys = false;
}
}
}//package org.flixel
Section 37
//FlxGame_junk (org.flixel.FlxGame_junk)
package org.flixel {
import mx.core.*;
public class FlxGame_junk extends FontAsset {
}
}//package org.flixel
Section 38
//FlxGame_SndBeep (org.flixel.FlxGame_SndBeep)
package org.flixel {
import mx.core.*;
public class FlxGame_SndBeep extends SoundAsset {
}
}//package org.flixel
Section 39
//FlxGame_SndFlixel (org.flixel.FlxGame_SndFlixel)
package org.flixel {
import mx.core.*;
public class FlxGame_SndFlixel extends SoundAsset {
}
}//package org.flixel
Section 40
//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(){
super();
_group = true;
solid = false;
members = new Array();
_last = new FlxPoint();
_first = true;
}
public function getFirstExtant():FlxObject{
var o:FlxObject;
var ml:uint = members.length;
var i:uint;
while (i < ml) {
o = (members[i] as FlxObject);
if (((!((o == null))) && (o.exists))){
return (o);
};
i++;
};
return (null);
}
override public function destroy():void{
destroyMembers();
super.destroy();
}
public function getFirstAlive():FlxObject{
var o:FlxObject;
var ml:uint = members.length;
var i:uint;
while (i < ml) {
o = (members[i] as FlxObject);
if (((((!((o == null))) && (o.exists))) && (!(o.dead)))){
return (o);
};
i++;
};
return (null);
}
public function remove(Object:FlxObject, Splice:Boolean=false):FlxObject{
var index:int = members.indexOf(Object);
if ((((index < 0)) || ((index >= members.length)))){
return (null);
};
if (Splice){
members.splice(index, 1);
} else {
members[index] = null;
};
return (Object);
}
override public function update():void{
saveOldPosition();
updateMotion();
updateMembers();
updateFlickering();
}
public function resetFirstAvail(X:Number=0, Y:Number=0):Boolean{
var o:FlxObject = getFirstAvail();
if (o == null){
return (false);
};
o.reset(X, Y);
return (true);
}
override public function reset(X:Number, Y:Number):void{
var mx:Number;
var my:Number;
var o:FlxObject;
saveOldPosition();
super.reset(X, Y);
var moved:Boolean;
if (((!((x == _last.x))) || (!((y == _last.y))))){
moved = true;
mx = (x - _last.x);
my = (y - _last.y);
};
var l:uint = members.length;
var i:uint;
while (i < l) {
o = (members[i] as FlxObject);
if (((!((o == null))) && (o.exists))){
if (moved){
if (o._group){
o.reset((o.x + mx), (o.y + my));
} else {
o.x = (o.x + mx);
o.y = (o.y + my);
if (solid){
o.colHullX.width = (o.colHullX.width + ((mx)>0) ? mx : -(mx));
if (mx < 0){
o.colHullX.x = (o.colHullX.x + mx);
};
o.colHullY.x = x;
o.colHullY.height = (o.colHullY.height + ((my)>0) ? my : -(my));
if (my < 0){
o.colHullY.y = (o.colHullY.y + my);
};
o.colVector.x = (o.colVector.x + mx);
o.colVector.y = (o.colVector.y + my);
};
};
};
};
i++;
};
}
protected function updateMembers():void{
var mx:Number;
var my:Number;
var o:FlxObject;
var moved:Boolean;
if (((!((x == _last.x))) || (!((y == _last.y))))){
moved = true;
mx = (x - _last.x);
my = (y - _last.y);
};
var l:uint = members.length;
var i:uint;
while (i < l) {
o = (members[i] as FlxObject);
if (((!((o == null))) && (o.exists))){
if (moved){
if (o._group){
o.reset((o.x + mx), (o.y + my));
} else {
o.x = (o.x + mx);
o.y = (o.y + my);
};
};
if (o.active){
o.update();
};
if (((moved) && (o.solid))){
o.colHullX.width = (o.colHullX.width + ((mx)>0) ? mx : -(mx));
if (mx < 0){
o.colHullX.x = (o.colHullX.x + mx);
};
o.colHullY.x = x;
o.colHullY.height = (o.colHullY.height + ((my)>0) ? my : -(my));
if (my < 0){
o.colHullY.y = (o.colHullY.y + my);
};
o.colVector.x = (o.colVector.x + mx);
o.colVector.y = (o.colVector.y + my);
};
};
i++;
};
}
public function countDead():int{
var o:FlxObject;
var count = -1;
var ml:uint = members.length;
var i:uint;
while (i < ml) {
o = (members[i] as FlxObject);
if (o != null){
if (count < 0){
count = 0;
};
if (o.dead){
count++;
};
};
i++;
};
return (count);
}
public function getFirstAvail():FlxObject{
var o:FlxObject;
var ml:uint = members.length;
var i:uint;
while (i < ml) {
o = (members[i] as FlxObject);
if (((!((o == null))) && (!(o.exists)))){
return (o);
};
i++;
};
return (null);
}
override public function render():void{
renderMembers();
}
public function countLiving():int{
var o:FlxObject;
var count = -1;
var ml:uint = members.length;
var i:uint;
while (i < ml) {
o = (members[i] as FlxObject);
if (o != null){
if (count < 0){
count = 0;
};
if (((o.exists) && (!(o.dead)))){
count++;
};
};
i++;
};
return (count);
}
public function countOnScreen():int{
var o:FlxObject;
var count = -1;
var ml:uint = members.length;
var i:uint;
while (i < ml) {
o = (members[i] as FlxObject);
if (o != null){
if (count < 0){
count = 0;
};
if (o.onScreen()){
count++;
};
};
i++;
};
return (count);
}
protected function killMembers():void{
var o:FlxObject;
var l:uint = members.length;
var i:uint;
while (i < l) {
o = (members[i] as FlxObject);
if (o != null){
o.kill();
};
i++;
};
}
override public function kill():void{
killMembers();
super.kill();
}
public function getFirstNull():int{
var ml:uint = members.length;
var i:uint;
while (i < ml) {
if (members[i] == null){
return (i);
};
i++;
};
return (-1);
}
protected function renderMembers():void{
var o:FlxObject;
var l:uint = members.length;
var i:uint;
while (i < l) {
o = (members[i] as FlxObject);
if (((((!((o == null))) && (o.exists))) && (o.visible))){
o.render();
};
i++;
};
}
public function add(Object:FlxObject, ShareScroll:Boolean=false):FlxObject{
members.push(Object);
if (ShareScroll){
Object.scrollFactor = scrollFactor;
};
return (Object);
}
protected function saveOldPosition():void{
if (_first){
_first = false;
_last.x = 0;
_last.y = 0;
return;
};
_last.x = x;
_last.y = y;
}
public function replace(OldObject:FlxObject, NewObject:FlxObject):FlxObject{
var index:int = members.indexOf(OldObject);
if ((((index < 0)) || ((index >= members.length)))){
return (null);
};
members[index] = NewObject;
return (NewObject);
}
public function getRandom():FlxObject{
var c:uint;
var o:FlxObject;
var l:uint = members.length;
var i:uint = uint((FlxU.random() * l));
while ((((o == null)) && ((c < members.length)))) {
++i;
o = (members[(i % l)] as FlxObject);
c++;
};
return (o);
}
public function getFirstDead():FlxObject{
var o:FlxObject;
var ml:uint = members.length;
var i:uint;
while (i < ml) {
o = (members[i] as FlxObject);
if (((!((o == null))) && (o.dead))){
return (o);
};
i++;
};
return (null);
}
protected function destroyMembers():void{
var o:FlxObject;
var l:uint = members.length;
var i:uint;
while (i < l) {
o = (members[i] as FlxObject);
if (o != null){
o.destroy();
};
i++;
};
members.length = 0;
}
}
}//package org.flixel
Section 41
//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(X:Number=0, Y:Number=0, Width:Number=0, Height:Number=0){
super(X, Y, Width, Height);
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(Contact:FlxObject, Velocity:Number):void{
onFloor = true;
if (!fixed){
velocity.y = Velocity;
};
}
public function overlaps(Object:FlxObject):Boolean{
var ts:FlxSprite;
var os:FlxSprite;
getScreenXY(_point);
var tx:Number = _point.x;
var ty:Number = _point.y;
var tw:Number = width;
var th:Number = height;
if ((this is FlxSprite)){
ts = (this as FlxSprite);
tw = ts.frameWidth;
th = ts.frameHeight;
};
Object.getScreenXY(_point);
var ox:Number = _point.x;
var oy:Number = _point.y;
var ow:Number = Object.width;
var oh:Number = Object.height;
if ((Object is FlxSprite)){
os = (Object as FlxSprite);
ow = os.frameWidth;
oh = os.frameHeight;
};
if ((((((((ox <= (tx - ow))) || ((ox >= (tx + tw))))) || ((oy <= (ty - oh))))) || ((oy >= (ty + th))))){
return (false);
};
return (true);
}
public function overlapsPoint(X:Number, Y:Number, PerPixel:Boolean=false):Boolean{
X = (X + FlxU.floor(FlxG.scroll.x));
Y = (Y + FlxU.floor(FlxG.scroll.y));
getScreenXY(_point);
if ((((((((X <= _point.x)) || ((X >= (_point.x + width))))) || ((Y <= _point.y)))) || ((Y >= (_point.y + height))))){
return (false);
};
return (true);
}
public function hurt(Damage:Number):void{
if ((health = (health - Damage)) <= 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(Object:FlxObject):void{
}
public function hitLeft(Contact:FlxObject, Velocity:Number):void{
if (!fixed){
velocity.x = Velocity;
};
}
public function collide(Object:FlxObject=null):Boolean{
return (FlxU.collide(this, ((Object)==null) ? this : Object));
}
public function reset(X:Number, Y:Number):void{
x = X;
y = Y;
exists = true;
dead = false;
}
public function update():void{
updateMotion();
updateFlickering();
}
public function hitTop(Contact:FlxObject, Velocity:Number):void{
if (!fixed){
velocity.y = Velocity;
};
}
protected function updateMotion():void{
var thrustComponents:FlxPoint;
var maxComponents:FlxPoint;
var max:Number;
if (!moves){
return;
};
if (solid){
refreshHulls();
};
onFloor = false;
angle = (angle + ((angularVelocity = FlxU.computeVelocity(angularVelocity, angularAcceleration, angularDrag, maxAngular)) * FlxG.elapsed));
if (thrust != 0){
thrustComponents = FlxU.rotatePoint(-(thrust), 0, 0, 0, angle);
maxComponents = FlxU.rotatePoint(-(maxThrust), 0, 0, 0, angle);
max = ((maxComponents.x)>0) ? maxComponents.x : -(maxComponents.x);
if (max > ((maxComponents.y)>0) ? maxComponents.y : -(maxComponents.y)){
maxComponents.y = max;
} else {
max = ((maxComponents.y)>0) ? maxComponents.y : -(maxComponents.y);
};
maxVelocity.x = (maxVelocity.y = ((max)>0) ? max : -(max));
} else {
thrustComponents = _pZero;
};
velocity.x = FlxU.computeVelocity(velocity.x, (acceleration.x + thrustComponents.x), drag.x, maxVelocity.x);
velocity.y = FlxU.computeVelocity(velocity.y, (acceleration.y + thrustComponents.y), drag.y, maxVelocity.y);
var xd:Number = (velocity.x * FlxG.elapsed);
var yd:Number = (velocity.y * FlxG.elapsed);
x = (x + xd);
y = (y + yd);
if (!solid){
return;
};
colVector.x = xd;
colVector.y = yd;
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(Contact:FlxObject, Velocity:Number):void{
hitLeft(Contact, Velocity);
}
public function destroy():void{
}
public function getScreenXY(Point:FlxPoint=null):FlxPoint{
if (Point == null){
Point = new FlxPoint();
};
Point.x = (FlxU.floor((x + FlxU.roundingError)) + FlxU.floor((FlxG.scroll.x * scrollFactor.x)));
Point.y = (FlxU.floor((y + FlxU.roundingError)) + FlxU.floor((FlxG.scroll.y * scrollFactor.y)));
return (Point);
}
public function flicker(Duration:Number=1):void{
_flickerTimer = Duration;
if (_flickerTimer < 0){
_flicker = false;
visible = true;
};
}
}
}//package org.flixel
Section 42
//FlxPoint (org.flixel.FlxPoint)
package org.flixel {
public class FlxPoint {
public var x:Number;
public var y:Number;
public function FlxPoint(X:Number=0, Y:Number=0){
super();
x = X;
y = Y;
}
public function toString():String{
return (FlxU.getClassName(this, true));
}
}
}//package org.flixel
Section 43
//FlxPreloader (org.flixel.FlxPreloader)
package org.flixel {
import flash.events.*;
import flash.display.*;
import flash.text.*;
import flash.net.*;
import flash.utils.*;
public class FlxPreloader extends MovieClip {
protected var _height:uint;
protected var _width:uint;
protected var ImgLogoLight:Class;
protected var _logo:Bitmap;
protected var _text:TextField;
protected var _buffer:Sprite;
public var className:String;
public var myURL:String;
protected var _bmpBar:Bitmap;
protected var ImgLogo:Class;
protected var _init:Boolean;
protected var ImgLogoCorners:Class;
protected var _logoGlow:Bitmap;
public function FlxPreloader(){
var tmp:Bitmap;
var re:RegExp;
var fmt:TextFormat;
var txt:TextField;
ImgLogo = FlxPreloader_ImgLogo;
ImgLogoCorners = FlxPreloader_ImgLogoCorners;
ImgLogoLight = FlxPreloader_ImgLogoLight;
super();
stop();
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
throw (new Error("Setting global debug flag..."));
//unresolved jump
var _slot1 = e;
re = /\[.*:[0-9]+\]/;
FlxG.debug = re.test(_slot1.getStackTrace());
if (((((!(FlxG.debug)) && (!((myURL == null))))) && ((root.loaderInfo.url.indexOf(myURL) < 0)))){
tmp = new Bitmap(new BitmapData(stage.stageWidth, stage.stageHeight, true, 4294967295));
addChild(tmp);
fmt = new TextFormat();
fmt.color = 0;
fmt.size = 16;
fmt.align = "center";
fmt.bold = true;
fmt.font = "system";
txt = new TextField();
txt.width = (tmp.width - 16);
txt.height = (tmp.height - 16);
txt.y = 8;
txt.multiline = true;
txt.wordWrap = true;
txt.embedFonts = true;
txt.defaultTextFormat = fmt;
txt.text = (("Hi there! It looks like somebody copied this game without my permission. Just click anywhere, or copy-paste this URL into your browser.\n\n" + myURL) + "\n\nto play the game at my site. Thanks, and have fun!");
addChild(txt);
txt.addEventListener(MouseEvent.CLICK, goToMyURL);
tmp.addEventListener(MouseEvent.CLICK, goToMyURL);
return;
};
_init = false;
addEventListener(Event.ENTER_FRAME, onEnterFrame);
}
protected function update(Percent:Number):void{
_bmpBar.scaleX = (Percent * (_width - 8));
_text.text = (((((("FLX v" + FlxG.LIBRARY_MAJOR_VERSION) + ".") + FlxG.LIBRARY_MINOR_VERSION) + " ") + FlxU.floor((Percent * 100))) + "%");
_text.setTextFormat(_text.defaultTextFormat);
if (Percent < 0.1){
_logoGlow.alpha = 0;
_logo.alpha = 0;
} else {
if (Percent < 0.15){
_logoGlow.alpha = FlxU.random(false);
_logo.alpha = 0;
} else {
if (Percent < 0.2){
_logoGlow.alpha = 0;
_logo.alpha = 0;
} else {
if (Percent < 0.25){
_logoGlow.alpha = 0;
_logo.alpha = FlxU.random(false);
} else {
if (Percent < 0.7){
_logoGlow.alpha = ((Percent - 0.45) / 0.45);
_logo.alpha = 1;
} else {
if ((((Percent > 0.8)) && ((Percent < 0.9)))){
_logoGlow.alpha = (1 - ((Percent - 0.8) / 0.1));
_logo.alpha = 0;
} else {
if (Percent > 0.9){
_buffer.alpha = (1 - ((Percent - 0.9) / 0.1));
};
};
};
};
};
};
};
}
private function goToMyURL(event:MouseEvent=null):void{
navigateToURL(new URLRequest(("http://" + myURL)));
}
private function onEnterFrame(event:Event):void{
var i:int;
var mainClass:Class;
var app:Object;
if (!_init){
if ((((stage.stageWidth <= 0)) || ((stage.stageHeight <= 0)))){
return;
};
create();
_init = true;
};
graphics.clear();
if (framesLoaded >= totalFrames){
removeEventListener(Event.ENTER_FRAME, onEnterFrame);
nextFrame();
mainClass = Class(getDefinitionByName(className));
if (mainClass){
app = new (mainClass);
addChild((app as DisplayObject));
};
removeChild(_buffer);
} else {
update((root.loaderInfo.bytesLoaded / root.loaderInfo.bytesTotal));
};
}
protected function create():void{
var j:uint;
_buffer = new Sprite();
_buffer.scaleX = 2;
_buffer.scaleY = 2;
addChild(_buffer);
_width = (stage.stageWidth / _buffer.scaleX);
_height = (stage.stageHeight / _buffer.scaleY);
_buffer.addChild(new Bitmap(new BitmapData(_width, _height, false, 13406)));
var b:Bitmap = new ImgLogoLight();
b.smoothing = true;
b.width = (b.height = _height);
b.x = ((_width - b.width) / 2);
_buffer.addChild(b);
_bmpBar = new Bitmap(new BitmapData(1, 7, false, 6253311));
_bmpBar.x = 4;
_bmpBar.y = (_height - 11);
_buffer.addChild(_bmpBar);
_text = new TextField();
_text.defaultTextFormat = new TextFormat("system", 8, 6253311);
_text.embedFonts = true;
_text.selectable = false;
_text.multiline = false;
_text.x = 2;
_text.y = (_bmpBar.y - 11);
_text.width = 80;
_buffer.addChild(_text);
_logo = new ImgLogo();
_logo.scaleX = (_logo.scaleY = (_height / 8));
_logo.x = ((_width - _logo.width) / 2);
_logo.y = ((_height - _logo.height) / 2);
_buffer.addChild(_logo);
_logoGlow = new ImgLogo();
_logoGlow.smoothing = true;
_logoGlow.blendMode = "screen";
_logoGlow.scaleX = (_logoGlow.scaleY = (_height / 8));
_logoGlow.x = ((_width - _logoGlow.width) / 2);
_logoGlow.y = ((_height - _logoGlow.height) / 2);
_buffer.addChild(_logoGlow);
b = new ImgLogoCorners();
b.smoothing = true;
b.width = _width;
b.height = _height;
_buffer.addChild(b);
b = new Bitmap(new BitmapData(_width, _height, false, 0xFFFFFF));
var i:uint;
while (i < _height) {
j = 0;
while (j < _width) {
b.bitmapData.setPixel(j, i, 0);
j++;
};
i = (i + 2);
};
b.blendMode = "overlay";
b.alpha = 0.25;
_buffer.addChild(b);
}
}
}//package org.flixel
Section 44
//FlxPreloader_ImgLogo (org.flixel.FlxPreloader_ImgLogo)
package org.flixel {
import mx.core.*;
public class FlxPreloader_ImgLogo extends BitmapAsset {
}
}//package org.flixel
Section 45
//FlxPreloader_ImgLogoCorners (org.flixel.FlxPreloader_ImgLogoCorners)
package org.flixel {
import mx.core.*;
public class FlxPreloader_ImgLogoCorners extends BitmapAsset {
}
}//package org.flixel
Section 46
//FlxPreloader_ImgLogoLight (org.flixel.FlxPreloader_ImgLogoLight)
package org.flixel {
import mx.core.*;
public class FlxPreloader_ImgLogoLight extends BitmapAsset {
}
}//package org.flixel
Section 47
//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(X:Number, Y:Number, Width:Number, Height:Number, Parent:FlxQuadTree=null){
var itr:FlxList;
var ot:FlxList;
super(X, Y, Width, Height);
_canSubdivide = (((Width > MIN)) || ((Height > MIN)));
_headA = (_tailA = new FlxList());
_headB = (_tailB = new FlxList());
if (Parent){
if (Parent._headA.object != null){
itr = Parent._headA;
while (itr != null) {
if (_tailA.object != null){
ot = _tailA;
_tailA = new FlxList();
ot.next = _tailA;
};
_tailA.object = itr.object;
itr = itr.next;
};
};
if (Parent._headB.object != null){
itr = Parent._headB;
while (itr != null) {
if (_tailB.object != null){
ot = _tailB;
_tailB = new FlxList();
ot.next = _tailB;
};
_tailB.object = itr.object;
itr = itr.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 ot:FlxList;
if (_oa == A_LIST){
if (_tailA.object != null){
ot = _tailA;
_tailA = new FlxList();
ot.next = _tailA;
};
_tailA.object = _o;
} else {
if (_tailB.object != null){
ot = _tailB;
_tailB = new FlxList();
ot.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(BothLists:Boolean=true, Callback:Function=null):Boolean{
var itr:FlxList;
_oc = Callback;
var c:Boolean;
if (BothLists){
_oa = B_LIST;
if (_headA.object != null){
itr = _headA;
while (itr != null) {
_o = itr.object;
if (((((_o.exists) && (_o.solid))) && (overlapNode()))){
c = true;
};
itr = itr.next;
};
};
_oa = A_LIST;
if (_headB.object != null){
itr = _headB;
while (itr != null) {
_o = itr.object;
if (((_o.exists) && (_o.solid))){
if (((!((_nw == null))) && (_nw.overlapNode()))){
c = true;
};
if (((!((_ne == null))) && (_ne.overlapNode()))){
c = true;
};
if (((!((_se == null))) && (_se.overlapNode()))){
c = true;
};
if (((!((_sw == null))) && (_sw.overlapNode()))){
c = true;
};
};
itr = itr.next;
};
};
} else {
if (_headA.object != null){
itr = _headA;
while (itr != null) {
_o = itr.object;
if (((((_o.exists) && (_o.solid))) && (overlapNode(itr.next)))){
c = true;
};
itr = itr.next;
};
};
};
if (((!((_nw == null))) && (_nw.overlap(BothLists, _oc)))){
c = true;
};
if (((!((_ne == null))) && (_ne.overlap(BothLists, _oc)))){
c = true;
};
if (((!((_se == null))) && (_se.overlap(BothLists, _oc)))){
c = true;
};
if (((!((_sw == null))) && (_sw.overlap(BothLists, _oc)))){
c = true;
};
return (c);
}
public function add(Object:FlxObject, List:uint):void{
var m:FlxObject;
var members:Array;
var l:uint;
var i:uint;
_oa = List;
if (Object._group){
members = (Object as FlxGroup).members;
l = members.length;
i = 0;
while (i < l) {
m = (members[i] as FlxObject);
if (((!((m == null))) && (m.exists))){
if (m._group){
add(m, List);
} else {
if (m.solid){
_o = m;
_ol = _o.x;
_ot = _o.y;
_or = (_o.x + _o.width);
_ob = (_o.y + _o.height);
addObject();
};
};
};
i++;
};
};
if (Object.solid){
_o = Object;
_ol = _o.x;
_ot = _o.y;
_or = (_o.x + _o.width);
_ob = (_o.y + _o.height);
addObject();
};
}
protected function overlapNode(Iterator:FlxList=null):Boolean{
var co:FlxObject;
var c:Boolean;
var itr:FlxList = Iterator;
if (itr == null){
if (_oa == A_LIST){
itr = _headA;
} else {
itr = _headB;
};
};
if (itr.object != null){
while (itr != null) {
co = itr.object;
if ((((((((((((((((((_o === co)) || (!(co.exists)))) || (!(_o.exists)))) || (!(co.solid)))) || (!(_o.solid)))) || (((_o.x + _o.width) < (co.x + FlxU.roundingError))))) || (((_o.x + FlxU.roundingError) > (co.x + co.width))))) || (((_o.y + _o.height) < (co.y + FlxU.roundingError))))) || (((_o.y + FlxU.roundingError) > (co.y + co.height))))){
itr = itr.next;
} else {
if (_oc == null){
_o.kill();
co.kill();
c = true;
} else {
if (_oc(_o, co)){
c = true;
};
};
itr = itr.next;
};
};
};
return (c);
}
}
}//package org.flixel
Section 48
//FlxRect (org.flixel.FlxRect)
package org.flixel {
public class FlxRect extends FlxPoint {
public var width:Number;
public var height:Number;
public function FlxRect(X:Number=0, Y:Number=0, Width:Number=0, Height:Number=0){
super(X, Y);
width = Width;
height = Height;
}
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 49
//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(){
super();
name = null;
_so = null;
data = null;
}
public function read(FieldName:String):Object{
if (_so == null){
FlxG.log("WARNING: You must call FlxSave.bind()\nbefore calling FlxSave.read().");
return (null);
};
return (data[FieldName]);
}
public function forceSave(MinFileSize:uint=0):Boolean{
var MinFileSize = MinFileSize;
if (_so == null){
FlxG.log("WARNING: You must call FlxSave.bind()\nbefore calling FlxSave.forceSave().");
return (false);
};
var status:Object;
status = _so.flush(MinFileSize);
//unresolved jump
var _slot1 = e;
FlxG.log("WARNING: There was a problem flushing\nthe shared object data from FlxSave.");
return (false);
return ((status == SharedObjectFlushStatus.FLUSHED));
}
public function bind(Name:String):Boolean{
var Name = Name;
name = null;
_so = null;
data = null;
name = Name;
_so = SharedObject.getLocal(name);
//unresolved jump
var _slot1 = e;
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(MinFileSize:uint=0):Boolean{
if (_so == null){
FlxG.log("WARNING: You must call FlxSave.bind()\nbefore calling FlxSave.erase().");
return (false);
};
_so.clear();
return (forceSave(MinFileSize));
}
public function write(FieldName:String, FieldValue:Object, MinFileSize:uint=0):Boolean{
if (_so == null){
FlxG.log("WARNING: You must call FlxSave.bind()\nbefore calling FlxSave.write().");
return (false);
};
data[FieldName] = FieldValue;
return (forceSave(MinFileSize));
}
}
}//package org.flixel
Section 50
//FlxSound (org.flixel.FlxSound)
package org.flixel {
import flash.events.*;
import flash.media.*;
import flash.net.*;
public class FlxSound extends FlxObject {
public var name:String;
protected var _position:Number;
protected var _fadeOutTotal:Number;
protected var _fadeOutTimer:Number;
protected var _sound:Sound;
protected var _pauseOnFadeOut:Boolean;
protected var _volumeAdjust:Number;
public var playing:Boolean;
protected var _radius:Number;
protected var _volume:Number;
protected var _point2:FlxPoint;
protected var _fadeInTimer:Number;
public var artist:String;
protected var _channel:SoundChannel;
protected var _fadeInTotal:Number;
protected var _looped:Boolean;
protected var _pan:Boolean;
protected var _transform:SoundTransform;
protected var _init:Boolean;
public var survive:Boolean;
protected var _core:FlxObject;
public function FlxSound(){
super();
_point2 = new FlxPoint();
_transform = new SoundTransform();
init();
fixed = true;
}
public function loadStream(SoundURL:String, Looped:Boolean=false):FlxSound{
stop();
init();
_sound = new Sound();
_sound.addEventListener(Event.ID3, gotID3);
_sound.load(new URLRequest(SoundURL));
_looped = Looped;
updateTransform();
active = true;
return (this);
}
public function stop():void{
_position = 0;
if (_channel != null){
_channel.stop();
stopped();
};
}
public function loadEmbedded(EmbeddedSound:Class, Looped:Boolean=false):FlxSound{
stop();
init();
_sound = new (EmbeddedSound);
_looped = Looped;
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(Seconds:Number, PauseInstead:Boolean=false):void{
_pauseOnFadeOut = PauseInstead;
_fadeInTimer = 0;
_fadeOutTimer = Seconds;
_fadeOutTotal = _fadeOutTimer;
}
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;
};
};
};
playing = !((_channel == null));
_position = 0;
}
public function set volume(Volume:Number):void{
_volume = Volume;
if (_volume < 0){
_volume = 0;
} else {
if (_volume > 1){
_volume = 1;
};
};
updateTransform();
}
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;
playing = false;
name = null;
artist = null;
}
protected function looped(event:Event=null):void{
if (_channel == null){
return;
};
_channel.removeEventListener(Event.SOUND_COMPLETE, looped);
_channel = null;
play();
}
protected function updateSound():void{
var _point:FlxPoint;
var _point2:FlxPoint;
var dx:Number;
var dy:Number;
var d:Number;
if (_position != 0){
return;
};
var radial:Number = 1;
var fade:Number = 1;
if (_core != null){
_point = new FlxPoint();
_point2 = new FlxPoint();
_core.getScreenXY(_point);
getScreenXY(_point2);
dx = (_point.x - _point2.x);
dy = (_point.y - _point2.y);
radial = ((_radius - Math.sqrt(((dx * dx) + (dy * dy)))) / _radius);
if (radial < 0){
radial = 0;
};
if (radial > 1){
radial = 1;
};
if (_pan){
d = (-(dx) / _radius);
if (d < -1){
d = -1;
} else {
if (d > 1){
d = 1;
};
};
_transform.pan = d;
};
};
if (_fadeOutTimer > 0){
_fadeOutTimer = (_fadeOutTimer - FlxG.elapsed);
if (_fadeOutTimer <= 0){
if (_pauseOnFadeOut){
pause();
} else {
stop();
};
};
fade = (_fadeOutTimer / _fadeOutTotal);
if (fade < 0){
fade = 0;
};
} else {
if (_fadeInTimer > 0){
_fadeInTimer = (_fadeInTimer - FlxG.elapsed);
fade = (_fadeInTimer / _fadeInTotal);
if (fade < 0){
fade = 0;
};
fade = (1 - fade);
};
};
_volumeAdjust = (radial * fade);
updateTransform();
}
public function fadeIn(Seconds:Number):void{
_fadeOutTimer = 0;
_fadeInTimer = Seconds;
_fadeInTotal = _fadeInTimer;
play();
}
override public function update():void{
super.update();
updateSound();
}
protected function stopped(event:Event=null):void{
if (!_looped){
_channel.removeEventListener(Event.SOUND_COMPLETE, stopped);
} else {
_channel.removeEventListener(Event.SOUND_COMPLETE, looped);
};
_channel = null;
active = false;
playing = false;
}
protected function gotID3(event:Event=null):void{
FlxG.log("got ID3 info!");
if (_sound.id3.songName.length > 0){
name = _sound.id3.songName;
};
if (_sound.id3.artist.length > 0){
artist = _sound.id3.artist;
};
_sound.removeEventListener(Event.ID3, gotID3);
}
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;
playing = false;
}
override public function destroy():void{
if (active){
stop();
};
}
public function proximity(X:Number, Y:Number, Core:FlxObject, Radius:Number, Pan:Boolean=true):FlxSound{
x = X;
y = Y;
_core = Core;
_radius = Radius;
_pan = Pan;
return (this);
}
}
}//package org.flixel
Section 51
//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(X:Number=0, Y:Number=0, SimpleGraphic:Class=null){
super();
x = X;
y = Y;
_flashRect = new Rectangle();
_flashRect2 = new Rectangle();
_flashPointZero = new Point();
if (SimpleGraphic == null){
createGraphic(8, 8);
} else {
loadGraphic(SimpleGraphic);
};
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(Color:uint):void{
_pixels.fillRect(_flashRect2, Color);
calcFrame();
}
public function addAnimation(Name:String, Frames:Array, FrameRate:Number=0, Looped:Boolean=true):void{
_animations.push(new FlxAnim(Name, Frames, FrameRate, Looped));
}
override public function overlapsPoint(X:Number, Y:Number, PerPixel:Boolean=false):Boolean{
X = (X - FlxU.floor(FlxG.scroll.x));
Y = (Y - FlxU.floor(FlxG.scroll.y));
getScreenXY(_point);
if (PerPixel){
return (_framePixels.hitTest(new Point(0, 0), 0xFF, new Point((X - _point.x), (Y - _point.y))));
};
if ((((((((X <= _point.x)) || ((X >= (_point.x + frameWidth))))) || ((Y <= _point.y)))) || ((Y >= (_point.y + frameHeight))))){
return (false);
};
return (true);
}
override public function render():void{
renderSprite();
}
protected function calcFrame():void{
var rx:uint = (_caf * frameWidth);
var ry:uint;
var w:uint = (_flipped) ? _flipped : _pixels.width;
if (rx >= w){
ry = (uint((rx / w)) * frameHeight);
rx = (rx % w);
};
if (((_flipped) && ((_facing == LEFT)))){
rx = (((_flipped << 1) - rx) - frameWidth);
};
_flashRect.x = rx;
_flashRect.y = ry;
_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(Pixels:BitmapData):void{
_pixels = (_framePixels = Pixels);
}
public function loadGraphic(Graphic:Class, Animated:Boolean=false, Reverse:Boolean=false, Width:uint=0, Height:uint=0, Unique:Boolean=false):FlxSprite{
_bakedRotation = 0;
_pixels = FlxG.addBitmap(Graphic, Reverse, Unique);
if (Reverse){
_flipped = (_pixels.width >> 1);
} else {
_flipped = 0;
};
if (Width == 0){
if (Animated){
Width = _pixels.height;
} else {
if (_flipped > 0){
Width = (_pixels.width / 2);
} else {
Width = _pixels.width;
};
};
};
width = (frameWidth = Width);
if (Height == 0){
if (Animated){
Height = width;
} else {
Height = _pixels.height;
};
};
height = (frameHeight = Height);
resetHelpers();
return (this);
}
public function get pixels():BitmapData{
return (_pixels);
}
public function set facing(Direction:uint):void{
var c = !((_facing == Direction));
_facing = Direction;
if (c){
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(Point:FlxPoint=null):FlxPoint{
if (Point == null){
Point = new FlxPoint();
};
Point.x = ((FlxU.floor((x + FlxU.roundingError)) + FlxU.floor((FlxG.scroll.x * scrollFactor.x))) - offset.x);
Point.y = ((FlxU.floor((y + FlxU.roundingError)) + FlxU.floor((FlxG.scroll.y * scrollFactor.y))) - offset.y);
return (Point);
}
public function set alpha(Alpha:Number):void{
if (Alpha > 1){
Alpha = 1;
};
if (Alpha < 0){
Alpha = 0;
};
if (Alpha == _alpha){
return;
};
_alpha = Alpha;
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 oc:uint;
var ta:int;
if (_bakedRotation){
oc = _caf;
ta = (angle % 360);
if (ta < 0){
ta = (ta + 360);
};
_caf = (ta / _bakedRotation);
if (oc != _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(Brush:FlxSprite, X:int=0, Y:int=0):void{
var b:BitmapData = Brush._framePixels;
if ((((((((((Brush.angle == 0)) || ((Brush._bakedRotation > 0)))) && ((Brush.scale.x == 1)))) && ((Brush.scale.y == 1)))) && ((Brush.blend == null)))){
_flashPoint.x = X;
_flashPoint.y = Y;
_flashRect2.width = b.width;
_flashRect2.height = b.height;
_pixels.copyPixels(b, _flashRect2, _flashPoint, null, null, true);
_flashRect2.width = _pixels.width;
_flashRect2.height = _pixels.height;
calcFrame();
return;
};
_mtx.identity();
_mtx.translate(-(Brush.origin.x), -(Brush.origin.y));
_mtx.scale(Brush.scale.x, Brush.scale.y);
if (Brush.angle != 0){
_mtx.rotate(((Math.PI * 2) * (Brush.angle / 360)));
};
_mtx.translate((X + Brush.origin.x), (Y + Brush.origin.y));
_pixels.draw(b, _mtx, null, Brush.blend, null, Brush.antialiasing);
calcFrame();
}
public function loadRotatedGraphic(Graphic:Class, Rotations:uint=16, Frame:int=-1, AntiAliasing:Boolean=false, AutoBuffer:Boolean=false):FlxSprite{
var r:uint;
var c:uint;
var bw2:uint;
var bh2:uint;
var gxc:uint;
var gyc:uint;
var rows:uint = 4;
var brush:FlxSprite = new FlxSprite().loadGraphic(Graphic, (Frame >= 0));
if (Frame >= 0){
brush.frame = Frame;
};
brush.antialiasing = AntiAliasing;
var max:uint = brush.width;
if (brush.height > max){
max = brush.height;
};
if (AutoBuffer){
max = (max * 1.5);
};
var cols:uint = Math.ceil((Rotations / rows));
width = (max * cols);
height = (max * rows);
var key:String = ((((((String(Graphic) + ":") + Frame) + ":") + width) + "x") + height);
var skipGen:Boolean = FlxG.checkBitmapCache(key);
createGraphic(width, height, 0, true, key);
_bakedRotation = (360 / Rotations);
if (!skipGen){
bw2 = (brush.width / 2);
bh2 = (brush.height / 2);
gxc = (max / 2);
gyc = (max / 2);
r = 0;
while (r < rows) {
c = 0;
while (c < cols) {
draw(brush, ((gxc + (max * c)) - bw2), (gyc - bh2));
brush.angle = (brush.angle + _bakedRotation);
c++;
};
gyc = (gyc + max);
r++;
};
};
frameWidth = (frameHeight = (width = (height = max)));
resetHelpers();
return (this);
}
public function set color(Color:uint):void{
Color = (Color & 0xFFFFFF);
if (_color == Color){
return;
};
_color = Color;
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(Width:uint, Height:uint, Color:uint=4294967295, Unique:Boolean=false, Key:String=null):FlxSprite{
_bakedRotation = 0;
_pixels = FlxG.createBitmap(Width, Height, Color, Unique, Key);
width = (frameWidth = _pixels.width);
height = (frameHeight = _pixels.height);
resetHelpers();
return (this);
}
public function play(AnimName:String, Force:Boolean=false):void{
if (((((!(Force)) && (!((_curAnim == null))))) && ((AnimName == _curAnim.name)))){
return;
};
_curFrame = 0;
_caf = 0;
_frameTimer = 0;
var al:uint = _animations.length;
var i:uint;
while (i < al) {
if (_animations[i].name == AnimName){
_curAnim = _animations[i];
if (_curAnim.delay <= 0){
finished = true;
} else {
finished = false;
};
_caf = _curAnim.frames[_curFrame];
calcFrame();
return;
};
i++;
};
}
public function addAnimationCallback(AnimationCallback:Function):void{
_callback = AnimationCallback;
}
public function set pixels(Pixels:BitmapData):void{
_pixels = Pixels;
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(Frame:uint):void{
_curAnim = null;
_caf = Frame;
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 52
//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(){
super();
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(Core:FlxObject):FlxObject{
return (defaultGroup.add(Core));
}
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 53
//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(X:Number, Y:Number, Width:uint, Text:String=null){
super(X, Y);
createGraphic(Width, 1);
if (Text == null){
Text = "";
};
_tf = new TextField();
_tf.width = Width;
_tf.embedFonts = true;
_tf.selectable = false;
_tf.sharpness = 100;
_tf.multiline = true;
_tf.wordWrap = true;
_tf.text = Text;
var tf:TextFormat = new TextFormat("system", 8, 0xFFFFFF);
_tf.defaultTextFormat = tf;
_tf.setTextFormat(tf);
if (Text.length <= 0){
_tf.height = 1;
} else {
_tf.height = 10;
};
_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(Color:uint):void{
var tf:TextFormat = dtfCopy();
tf.color = Color;
_tf.defaultTextFormat = tf;
_tf.setTextFormat(tf);
_regen = true;
calcFrame();
}
public function set shadow(Color:uint):void{
_shadow = Color;
calcFrame();
}
public function set size(Size:Number):void{
var tf:TextFormat = dtfCopy();
tf.size = Size;
_tf.defaultTextFormat = tf;
_tf.setTextFormat(tf);
_regen = true;
calcFrame();
}
public function get alignment():String{
return (_tf.defaultTextFormat.align);
}
protected function dtfCopy():TextFormat{
var dtf:TextFormat = _tf.defaultTextFormat;
return (new TextFormat(dtf.font, dtf.size, dtf.color, dtf.bold, dtf.italic, dtf.underline, dtf.url, dtf.target, dtf.align));
}
public function get text():String{
return (_tf.text);
}
public function get font():String{
return (_tf.defaultTextFormat.font);
}
public function set alignment(Alignment:String):void{
var tf:TextFormat = dtfCopy();
tf.align = Alignment;
_tf.defaultTextFormat = tf;
_tf.setTextFormat(tf);
calcFrame();
}
public function set font(Font:String):void{
var tf:TextFormat = dtfCopy();
tf.font = Font;
_tf.defaultTextFormat = tf;
_tf.setTextFormat(tf);
_regen = true;
calcFrame();
}
override protected function calcFrame():void{
var nl:uint;
var i:uint;
if ((((((_tf == null)) || ((_tf.text == null)))) || ((_tf.text.length <= 0)))){
_pixels.fillRect(_flashRect, 0);
return;
};
if (_regen){
nl = _tf.numLines;
height = 0;
i = 0;
while (i < nl) {
height = (height + _tf.getLineMetrics(i).height);
i++;
};
height = (height + 4);
_pixels = 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 {
_pixels.fillRect(_flashRect, 0);
};
var tf:TextFormat = _tf.defaultTextFormat;
var tfa:TextFormat = tf;
_mtx.identity();
if ((((tf.align == "center")) && ((_tf.numLines == 1)))){
tfa = new TextFormat(tf.font, tf.size, tf.color, null, null, null, null, null, "left");
_tf.setTextFormat(tfa);
_mtx.translate(Math.floor(((width - _tf.getLineMetrics(0).width) / 2)), 0);
};
if (_shadow > 0){
_tf.setTextFormat(new TextFormat(tfa.font, tfa.size, _shadow, null, null, null, null, null, tfa.align));
_mtx.translate(1, 1);
_pixels.draw(_tf, _mtx, _ct);
_mtx.translate(-1, -1);
_tf.setTextFormat(new TextFormat(tfa.font, tfa.size, tfa.color, null, null, null, null, null, tfa.align));
};
_pixels.draw(_tf, _mtx, _ct);
_tf.setTextFormat(new TextFormat(tf.font, tf.size, tf.color, null, null, null, null, null, tf.align));
_framePixels = new BitmapData(_pixels.width, _pixels.height, true, 0);
_framePixels.copyPixels(_pixels, _flashRect, _flashPointZero);
if (solid){
refreshHulls();
};
}
public function setFormat(Font:String=null, Size:Number=8, Color:uint=0xFFFFFF, Alignment:String=null, ShadowColor:uint=0):FlxText{
if (Font == null){
Font = "";
};
var tf:TextFormat = dtfCopy();
tf.font = Font;
tf.size = Size;
tf.color = Color;
tf.align = Alignment;
_tf.defaultTextFormat = tf;
_tf.setTextFormat(tf);
_shadow = ShadowColor;
_regen = true;
calcFrame();
return (this);
}
public function set text(Text:String):void{
_tf.text = Text;
_regen = true;
calcFrame();
}
}
}//package org.flixel
Section 54
//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 function FlxU(){
super();
}
public static function random(UseGlobalSeed:Boolean=true):Number{
var random:Number;
if (((UseGlobalSeed) && (!(isNaN(_seed))))){
random = randomize(_seed);
_seed = mutate(_seed, random);
return (random);
};
return (Math.random());
}
public static function mutate(Seed:Number, Mutator:Number):Number{
Seed = (Seed + Mutator);
if (Seed > 1){
Seed = (Seed - int(Seed));
};
return (Seed);
}
public static function overlap(Object1:FlxObject, Object2:FlxObject, Callback:Function=null):Boolean{
if ((((((((Object1 == null)) || (!(Object1.exists)))) || ((Object2 == null)))) || (!(Object2.exists)))){
return (false);
};
quadTree = new FlxQuadTree(quadTreeBounds.x, quadTreeBounds.y, quadTreeBounds.width, quadTreeBounds.height);
quadTree.add(Object1, FlxQuadTree.A_LIST);
if (Object1 === Object2){
return (quadTree.overlap(false, Callback));
};
quadTree.add(Object2, FlxQuadTree.B_LIST);
return (quadTree.overlap(true, Callback));
}
public static function getClass(Name:String):Class{
return ((getDefinitionByName(Name) as Class));
}
public static function openURL(URL:String):void{
navigateToURL(new URLRequest(URL), "_blank");
}
public static function floor(N:Number):Number{
var n:Number = int(N);
return (((N)>0) ? n : ((n)!=N) ? (n - 1) : n);
}
public static function solveYCollision(Object1:FlxObject, Object2:FlxObject):Boolean{
var overlap:Number;
var p1hn2:Boolean;
var i1:uint;
var i2:uint;
var ox1:Number;
var oy1:Number;
var ox2:Number;
var oy2:Number;
var r1:Number;
var r2:Number;
var sv1:Number;
var sv2:Number;
var o1:Number = Object1.colVector.y;
var o2:Number = Object2.colVector.y;
if (o1 == o2){
return (false);
};
Object1.preCollide(Object2);
Object2.preCollide(Object1);
var hit:Boolean;
var obj1Stopped = (o1 == 0);
var obj1MoveNeg = (o1 < 0);
var obj1MovePos = (o1 > 0);
var obj2Stopped = (o2 == 0);
var obj2MoveNeg = (o2 < 0);
var obj2MovePos = (o2 > 0);
var obj1Hull:FlxRect = Object1.colHullY;
var obj2Hull:FlxRect = Object2.colHullY;
var co1:Array = Object1.colOffsets;
var co2:Array = Object2.colOffsets;
var l1:uint = co1.length;
var l2:uint = co2.length;
p1hn2 = ((((((((((obj1Stopped) && (obj2MoveNeg))) || (((obj1MovePos) && (obj2Stopped))))) || (((obj1MovePos) && (obj2MoveNeg))))) || (((((obj1MoveNeg) && (obj2MoveNeg))) && ((((o1)>0) ? o1 : -(o1) < ((o2)>0) ? o2 : -(o2))))))) || (((((obj1MovePos) && (obj2MovePos))) && ((((o1)>0) ? o1 : -(o1) > ((o2)>0) ? o2 : -(o2))))));
if ((p1hn2) ? ((!(Object1.collideBottom)) || (!(Object2.collideTop))) : ((!(Object1.collideTop)) || (!(Object2.collideBottom)))){
return (false);
};
i1 = 0;
while (i1 < l1) {
ox1 = co1[i1].x;
oy1 = co1[i1].y;
obj1Hull.x = (obj1Hull.x + ox1);
obj1Hull.y = (obj1Hull.y + oy1);
i2 = 0;
while (i2 < l2) {
ox2 = co2[i2].x;
oy2 = co2[i2].y;
obj2Hull.x = (obj2Hull.x + ox2);
obj2Hull.y = (obj2Hull.y + oy2);
if (((((((((obj1Hull.x + obj1Hull.width) < (obj2Hull.x + roundingError))) || (((obj1Hull.x + roundingError) > (obj2Hull.x + obj2Hull.width))))) || (((obj1Hull.y + obj1Hull.height) < (obj2Hull.y + roundingError))))) || (((obj1Hull.y + roundingError) > (obj2Hull.y + obj2Hull.height))))){
obj2Hull.x = (obj2Hull.x - ox2);
obj2Hull.y = (obj2Hull.y - oy2);
} else {
if (p1hn2){
if (obj1MoveNeg){
r1 = (obj1Hull.y + Object1.colHullX.height);
} else {
r1 = (obj1Hull.y + obj1Hull.height);
};
if (obj2MoveNeg){
r2 = obj2Hull.y;
} else {
r2 = ((obj2Hull.y + obj2Hull.height) - Object2.colHullX.height);
};
} else {
if (obj2MoveNeg){
r1 = (-(obj2Hull.y) - Object2.colHullX.height);
} else {
r1 = (-(obj2Hull.y) - obj2Hull.height);
};
if (obj1MoveNeg){
r2 = -(obj1Hull.y);
} else {
r2 = ((-(obj1Hull.y) - obj1Hull.height) + Object1.colHullX.height);
};
};
overlap = (r1 - r2);
if ((((((overlap == 0)) || (((!(Object1.fixed)) && ((((overlap)>0) ? overlap : -(overlap) > (obj1Hull.height * 0.8))))))) || (((!(Object2.fixed)) && ((((overlap)>0) ? overlap : -(overlap) > (obj2Hull.height * 0.8))))))){
obj2Hull.x = (obj2Hull.x - ox2);
obj2Hull.y = (obj2Hull.y - oy2);
} else {
hit = true;
sv1 = Object2.velocity.y;
sv2 = Object1.velocity.y;
if (((!(Object1.fixed)) && (Object2.fixed))){
if (Object1._group){
Object1.reset(Object1.x, (Object1.y - overlap));
} else {
Object1.y = (Object1.y - overlap);
};
} else {
if (((Object1.fixed) && (!(Object2.fixed)))){
if (Object2._group){
Object2.reset(Object2.x, (Object2.y + overlap));
} else {
Object2.y = (Object2.y + overlap);
};
} else {
if (((!(Object1.fixed)) && (!(Object2.fixed)))){
overlap = (overlap / 2);
if (Object1._group){
Object1.reset(Object1.x, (Object1.y - overlap));
} else {
Object1.y = (Object1.y - overlap);
};
if (Object2._group){
Object2.reset(Object2.x, (Object2.y + overlap));
} else {
Object2.y = (Object2.y + overlap);
};
sv1 = (sv1 / 2);
sv2 = (sv2 / 2);
};
};
};
if (p1hn2){
Object1.hitBottom(Object2, sv1);
Object2.hitTop(Object1, sv2);
} else {
Object1.hitTop(Object2, sv1);
Object2.hitBottom(Object1, sv2);
};
if (((!(Object1.fixed)) && (!((overlap == 0))))){
if (p1hn2){
obj1Hull.y = (obj1Hull.y - overlap);
if (((Object2.fixed) && (Object2.moves))){
sv1 = Object2.colVector.x;
Object1.x = (Object1.x + sv1);
obj1Hull.x = (obj1Hull.x + sv1);
Object1.colHullX.x = (Object1.colHullX.x + sv1);
};
} else {
obj1Hull.y = (obj1Hull.y - overlap);
obj1Hull.height = (obj1Hull.height + overlap);
};
};
if (((!(Object2.fixed)) && (!((overlap == 0))))){
if (p1hn2){
obj2Hull.y = (obj2Hull.y + overlap);
obj2Hull.height = (obj2Hull.height - overlap);
} else {
obj2Hull.height = (obj2Hull.height + overlap);
if (((Object1.fixed) && (Object1.moves))){
sv2 = Object1.colVector.x;
Object2.x = (Object2.x + sv2);
obj2Hull.x = (obj2Hull.x + sv2);
Object2.colHullX.x = (Object2.colHullX.x + sv2);
};
};
};
obj2Hull.x = (obj2Hull.x - ox2);
obj2Hull.y = (obj2Hull.y - oy2);
};
};
i2++;
};
obj1Hull.x = (obj1Hull.x - ox1);
obj1Hull.y = (obj1Hull.y - oy1);
i1++;
};
return (hit);
}
public static function ceil(N:Number):Number{
var n:Number = int(N);
return (((N)>0) ? ((n)!=N) ? (n + 1) : n : n);
}
public static function getAngle(X:Number, Y:Number):Number{
return (((Math.atan2(Y, X) * 180) / Math.PI));
}
public static function setWorldBounds(X:Number=0, Y:Number=0, Width:Number=0, Height:Number=0):void{
if ((((((((X == 0)) && ((Y == 0)))) && ((Width == 0)))) && ((Height == 0)))){
X = (-128 * FlxG.width);
Y = (-128 * FlxG.height);
Width = (0x0100 * FlxG.width);
Height = (0x0100 * FlxG.height);
};
if (quadTreeBounds == null){
quadTreeBounds = new FlxRect();
};
quadTreeBounds.x = X;
quadTreeBounds.y = Y;
if (Width != 0){
quadTreeBounds.width = Width;
};
if (Height != 0){
quadTreeBounds.height = Height;
};
}
public static function set seed(Seed:Number):void{
_seed = Seed;
_originalSeed = _seed;
}
public static function getClassName(Obj:Object, Simple:Boolean=false):String{
var s:String = getQualifiedClassName(Obj);
s = s.replace("::", ".");
if (Simple){
s = s.substr((s.lastIndexOf(".") + 1));
};
return (s);
}
public static function randomize(Seed:Number):Number{
return ((((69621 * int((Seed * 2147483647))) % 2147483647) / 2147483647));
}
public static function abs(N:Number):Number{
return (((N)>0) ? N : -(N));
}
public static function computeVelocity(Velocity:Number, Acceleration:Number=0, Drag:Number=0, Max:Number=10000):Number{
var d:Number;
if (Acceleration != 0){
Velocity = (Velocity + (Acceleration * FlxG.elapsed));
} else {
if (Drag != 0){
d = (Drag * FlxG.elapsed);
if ((Velocity - d) > 0){
Velocity = (Velocity - d);
} else {
if ((Velocity + d) < 0){
Velocity = (Velocity + d);
} else {
Velocity = 0;
};
};
};
};
if (((!((Velocity == 0))) && (!((Max == 10000))))){
if (Velocity > Max){
Velocity = Max;
} else {
if (Velocity < -(Max)){
Velocity = -(Max);
};
};
};
return (Velocity);
}
public static function rotatePoint(X:Number, Y:Number, PivotX:Number, PivotY:Number, Angle:Number, P:FlxPoint=null):FlxPoint{
if (P == null){
P = new FlxPoint();
};
var radians:Number = ((-(Angle) / 180) * Math.PI);
var dx:Number = (X - PivotX);
var dy:Number = (PivotY - Y);
P.x = ((PivotX + (Math.cos(radians) * dx)) - (Math.sin(radians) * dy));
P.y = (PivotY - ((Math.sin(radians) * dx) + (Math.cos(radians) * dy)));
return (P);
}
public static function get seed():Number{
return (_originalSeed);
}
public static function solveXCollision(Object1:FlxObject, Object2:FlxObject):Boolean{
var f1:Boolean;
var f2:Boolean;
var overlap:Number;
var p1hn2:Boolean;
var i1:uint;
var i2:uint;
var ox1:Number;
var oy1:Number;
var ox2:Number;
var oy2:Number;
var r1:Number;
var r2:Number;
var sv1:Number;
var sv2:Number;
var o1:Number = Object1.colVector.x;
var o2:Number = Object2.colVector.x;
if (o1 == o2){
return (false);
};
Object1.preCollide(Object2);
Object2.preCollide(Object1);
var hit:Boolean;
var obj1Stopped = (o1 == 0);
var obj1MoveNeg = (o1 < 0);
var obj1MovePos = (o1 > 0);
var obj2Stopped = (o2 == 0);
var obj2MoveNeg = (o2 < 0);
var obj2MovePos = (o2 > 0);
var obj1Hull:FlxRect = Object1.colHullX;
var obj2Hull:FlxRect = Object2.colHullX;
var co1:Array = Object1.colOffsets;
var co2:Array = Object2.colOffsets;
var l1:uint = co1.length;
var l2:uint = co2.length;
p1hn2 = ((((((((((obj1Stopped) && (obj2MoveNeg))) || (((obj1MovePos) && (obj2Stopped))))) || (((obj1MovePos) && (obj2MoveNeg))))) || (((((obj1MoveNeg) && (obj2MoveNeg))) && ((((o1)>0) ? o1 : -(o1) < ((o2)>0) ? o2 : -(o2))))))) || (((((obj1MovePos) && (obj2MovePos))) && ((((o1)>0) ? o1 : -(o1) > ((o2)>0) ? o2 : -(o2))))));
if ((p1hn2) ? ((!(Object1.collideRight)) || (!(Object2.collideLeft))) : ((!(Object1.collideLeft)) || (!(Object2.collideRight)))){
return (false);
};
i1 = 0;
while (i1 < l1) {
ox1 = co1[i1].x;
oy1 = co1[i1].y;
obj1Hull.x = (obj1Hull.x + ox1);
obj1Hull.y = (obj1Hull.y + oy1);
i2 = 0;
while (i2 < l2) {
ox2 = co2[i2].x;
oy2 = co2[i2].y;
obj2Hull.x = (obj2Hull.x + ox2);
obj2Hull.y = (obj2Hull.y + oy2);
if (((((((((obj1Hull.x + obj1Hull.width) < (obj2Hull.x + roundingError))) || (((obj1Hull.x + roundingError) > (obj2Hull.x + obj2Hull.width))))) || (((obj1Hull.y + obj1Hull.height) < (obj2Hull.y + roundingError))))) || (((obj1Hull.y + roundingError) > (obj2Hull.y + obj2Hull.height))))){
obj2Hull.x = (obj2Hull.x - ox2);
obj2Hull.y = (obj2Hull.y - oy2);
} else {
if (p1hn2){
if (obj1MoveNeg){
r1 = (obj1Hull.x + Object1.colHullY.width);
} else {
r1 = (obj1Hull.x + obj1Hull.width);
};
if (obj2MoveNeg){
r2 = obj2Hull.x;
} else {
r2 = ((obj2Hull.x + obj2Hull.width) - Object2.colHullY.width);
};
} else {
if (obj2MoveNeg){
r1 = (-(obj2Hull.x) - Object2.colHullY.width);
} else {
r1 = (-(obj2Hull.x) - obj2Hull.width);
};
if (obj1MoveNeg){
r2 = -(obj1Hull.x);
} else {
r2 = ((-(obj1Hull.x) - obj1Hull.width) + Object1.colHullY.width);
};
};
overlap = (r1 - r2);
if ((((((overlap == 0)) || (((!(Object1.fixed)) && ((((overlap)>0) ? overlap : -(overlap) > (obj1Hull.width * 0.8))))))) || (((!(Object2.fixed)) && ((((overlap)>0) ? overlap : -(overlap) > (obj2Hull.width * 0.8))))))){
obj2Hull.x = (obj2Hull.x - ox2);
obj2Hull.y = (obj2Hull.y - oy2);
} else {
hit = true;
sv1 = Object2.velocity.x;
sv2 = Object1.velocity.x;
if (((!(Object1.fixed)) && (Object2.fixed))){
if (Object1._group){
Object1.reset((Object1.x - overlap), Object1.y);
} else {
Object1.x = (Object1.x - overlap);
};
} else {
if (((Object1.fixed) && (!(Object2.fixed)))){
if (Object2._group){
Object2.reset((Object2.x + overlap), Object2.y);
} else {
Object2.x = (Object2.x + overlap);
};
} else {
if (((!(Object1.fixed)) && (!(Object2.fixed)))){
overlap = (overlap / 2);
if (Object1._group){
Object1.reset((Object1.x - overlap), Object1.y);
} else {
Object1.x = (Object1.x - overlap);
};
if (Object2._group){
Object2.reset((Object2.x + overlap), Object2.y);
} else {
Object2.x = (Object2.x + overlap);
};
sv1 = (sv1 / 2);
sv2 = (sv2 / 2);
};
};
};
if (p1hn2){
Object1.hitRight(Object2, sv1);
Object2.hitLeft(Object1, sv2);
} else {
Object1.hitLeft(Object2, sv1);
Object2.hitRight(Object1, sv2);
};
if (((!(Object1.fixed)) && (!((overlap == 0))))){
if (p1hn2){
obj1Hull.width = (obj1Hull.width - overlap);
} else {
obj1Hull.x = (obj1Hull.x - overlap);
obj1Hull.width = (obj1Hull.width + overlap);
};
Object1.colHullY.x = (Object1.colHullY.x - overlap);
};
if (((!(Object2.fixed)) && (!((overlap == 0))))){
if (p1hn2){
obj2Hull.x = (obj2Hull.x + overlap);
obj2Hull.width = (obj2Hull.width - overlap);
} else {
obj2Hull.width = (obj2Hull.width + overlap);
};
Object2.colHullY.x = (Object2.colHullY.x + overlap);
};
obj2Hull.x = (obj2Hull.x - ox2);
obj2Hull.y = (obj2Hull.y - oy2);
};
};
i2++;
};
obj1Hull.x = (obj1Hull.x - ox1);
obj1Hull.y = (obj1Hull.y - oy1);
i1++;
};
return (hit);
}
public static function collide(Object1:FlxObject, Object2:FlxObject):Boolean{
if ((((((((Object1 == null)) || (!(Object1.exists)))) || ((Object2 == null)))) || (!(Object2.exists)))){
return (false);
};
quadTree = new FlxQuadTree(quadTreeBounds.x, quadTreeBounds.y, quadTreeBounds.width, quadTreeBounds.height);
quadTree.add(Object1, FlxQuadTree.A_LIST);
var match = (Object1 === Object2);
if (!match){
quadTree.add(Object2, FlxQuadTree.B_LIST);
};
var cx:Boolean = quadTree.overlap(!(match), solveXCollision);
var cy:Boolean = quadTree.overlap(!(match), solveYCollision);
return (((cx) || (cy)));
}
}
}//package org.flixel
Section 55
//AssetLayerRandom (AssetLayerRandom)
package {
import org.flixel.*;
public class AssetLayerRandom extends SpawningElementSet {
private var prevX:Number;
private var density:Number;
private var images:Array;
private var prevWidth:Number;
private var scatter:Number;
public function AssetLayerRandom(sDelay:Number, Imgs:Array, den:Number=3, sca:Number=60){
super();
startTimer = 1;
spawnDelay = sDelay;
spawnTimer = spawnDelay;
density = den;
scatter = sca;
images = Imgs;
scrollFactor = new FlxPoint(0.4, 0);
}
public function spawnOnce():void{
spawn();
_stopped = true;
}
override protected function spawn():void{
var rand:int;
var tempImg:Class;
var randPos:Number;
var tempAsset:SpawningElement;
var i:int = Horse.randRange(1, density);
prevX = 0;
prevWidth = 0;
while (i > 0) {
rand = Horse.randRange(0, (images.length - 1));
tempImg = (images[rand] as Class);
randPos = ((Horse.gamePos + (FlxG.width / 2)) - Horse.randRange(1, scatter));
while ((((randPos > prevX)) && ((randPos < (prevX + prevWidth))))) {
randPos = (((Horse.gamePos + FlxG.width) - 2) + Horse.randRange(1, scatter));
};
trace(randPos);
tempAsset = new SpawningElement(randPos, Horse.randRange(16, (FlxG.height - 64)), tempImg);
prevX = tempAsset.x;
prevWidth = tempAsset.width;
add(tempAsset, true);
i--;
};
}
}
}//package
Section 56
//AssetLayerRow (AssetLayerRow)
package {
import org.flixel.*;
public class AssetLayerRow extends FlxGroup {
private var layerPos:String;
public var rowLength:int;
private var layerX:int;
private var layerY:int;
private var layerType:String;
private var layerOrient:String;
private var images:Array;
private var _layerNumber:int;
public static const RANDOM:String = "row";
public static const HORIZONTAL:String = "horizontal";
public static const LEFT:String = "left";
public static const BOTTOM:String = "bottom";
public static const ORDERED:String = "ordered";
public static const TOP:String = "top";
public static const VERTICAL:String = "vertical";
public function AssetLayerRow(imgs:Array, num:int, pos:String, type:String, orientation:String="horizontal", rotated:Boolean=false){
super();
layerPos = pos;
layerType = type;
layerOrient = orientation;
_layerNumber = num;
layerX = 0;
images = imgs;
switch (_layerNumber){
case 0:
scrollFactor = new FlxPoint(0, 0);
break;
case 1:
scrollFactor = new FlxPoint(0.2, 0);
break;
case 2:
scrollFactor = new FlxPoint(0.6, 0);
break;
case 3:
scrollFactor = new FlxPoint(1, 0);
break;
};
calcLength();
if (layerType == RANDOM){
buildRowRandom(rotated, orientation);
} else {
if (layerType == ORDERED){
buildRowOrdered();
};
};
}
protected function buildRowOrdered():void{
var tempElement:ScrollingElement;
var tempImg:Class;
var X:int;
var Y:int;
var i:int;
while (i < images.length) {
tempImg = (images[i] as Class);
tempElement = new ScrollingElement(X, Y, tempImg);
switch (layerPos){
case TOP:
tempElement.y = -(tempElement.height);
break;
case BOTTOM:
tempElement.y = FlxG.height;
break;
};
X = (X + tempElement.width);
add(tempElement, true);
i++;
};
i = 0;
while (i < images.length) {
tempElement = (members[i] as ScrollingElement);
tempElement.EndPosX = X;
i++;
};
}
private function buildVertical(rotated:Boolean):void{
var tempElement:ScrollingElement;
var rand:int;
var tempImg:Class;
var X:int;
var Y:int;
var prev = -1;
var j:int;
while (j < rowLength) {
rand = Horse.randRange(0, (images.length - 1));
if (images.length > 2){
while (rand == prev) {
rand = Horse.randRange(0, (images.length - 1));
};
};
prev = rand;
tempImg = (images[rand] as Class);
tempElement = new ScrollingElement(X, Y, tempImg, rotated);
tempElement.x = -(tempElement.width);
Y = (Y + tempElement.height);
add(tempElement, true);
j++;
};
}
override public function update():void{
super.update();
}
public function moveOut():void{
var temp:ScrollingElement;
var i:int;
switch (layerPos){
case TOP:
i = 0;
while (i < members.length) {
temp = (members[i] as ScrollingElement);
temp.setVel(ScrollingElement.topOut);
i++;
};
break;
case BOTTOM:
i = 0;
while (i < members.length) {
temp = (members[i] as ScrollingElement);
temp.setVel(ScrollingElement.bottomOut);
i++;
};
break;
case LEFT:
i = 0;
while (i < members.length) {
temp = (members[i] as ScrollingElement);
temp.setVel(ScrollingElement.leftOut);
i++;
};
break;
};
}
protected function calcLength():void{
var tempSprite:FlxSprite;
var tempWidth:int;
var numSprites:int = images.length;
var widthSum:int;
var i:int;
while (i < numSprites) {
tempSprite = new FlxSprite(-(FlxG.width), 0, (images[i] as Class));
tempWidth = tempSprite.width;
widthSum = (widthSum + tempWidth);
i++;
};
rowLength = Math.ceil(((FlxG.width * 2) / (widthSum / numSprites)));
}
public function moveIn():void{
var temp:ScrollingElement;
var i:int;
switch (layerPos){
case TOP:
i = 0;
while (i < members.length) {
temp = (members[i] as ScrollingElement);
temp.setVel(ScrollingElement.topIn);
i++;
};
break;
case BOTTOM:
i = 0;
while (i < members.length) {
temp = (members[i] as ScrollingElement);
temp.setVel(ScrollingElement.bottomIn);
i++;
};
break;
case LEFT:
i = 0;
while (i < members.length) {
temp = (members[i] as ScrollingElement);
temp.setVel(ScrollingElement.leftIn);
i++;
};
break;
};
}
protected function buildRowRandom(rotated:Boolean, orientation:String):void{
switch (orientation){
case HORIZONTAL:
buildHorizontal(rotated);
break;
case VERTICAL:
buildVertical(rotated);
break;
};
}
private function buildHorizontal(rotated:Boolean):void{
var tempElement:ScrollingElement;
var rand:int;
var tempImg:Class;
var X:int;
var Y:int;
var prev = -1;
var j:int;
while (j < rowLength) {
rand = Horse.randRange(0, (images.length - 1));
if (images.length > 2){
while (rand == prev) {
rand = Horse.randRange(0, (images.length - 1));
};
};
prev = rand;
tempImg = (images[rand] as Class);
tempElement = new ScrollingElement(X, Y, tempImg, rotated);
switch (layerPos){
case TOP:
tempElement.y = -(tempElement.height);
break;
case BOTTOM:
tempElement.y = FlxG.height;
break;
};
X = (X + tempElement.width);
add(tempElement, true);
j++;
};
j = 0;
while (j < rowLength) {
tempElement = (members[j] as ScrollingElement);
tempElement.EndPosX = X;
j++;
};
}
public function get layerNumber():Number{
return (_layerNumber);
}
}
}//package
Section 57
//BaseState (BaseState)
package {
import org.flixel.*;
public class BaseState extends State {
private var init:Boolean;
public function BaseState(i:Boolean=false){
super();
init = i;
}
override protected function collisions():void{
_obstacles.collide(boundsVerticalGroup);
if (((_ship.dead) || (_ship.invincible))){
_ship.collide(boundsVerticalGroup);
};
}
override public function update():void{
if (initShip){
shipStartY = _ship.y;
};
super.update();
}
override protected function overlaps():void{
var loseScore:Points;
var loseScore2:Points;
if (((((_ship.overlaps(verticalBounds)) && (!(_ship.dead)))) && (!(_ship.invincible)))){
_ship.kill();
loseScore = new Points(_ship.x, _ship.y, 100, ("-" + Math.floor((FlxG.score / 2))), 0xCC0000, 40);
add(loseScore);
};
if (((((_ship.overlaps(verticalBounds2)) && (!(_ship.dead)))) && (!(_ship.invincible)))){
_ship.kill();
loseScore2 = new Points(_ship.x, _ship.y, 100, ("-" + Math.floor((FlxG.score / 2))), 0xCC0000, 40);
add(loseScore2);
};
}
override public function create():void{
currentMode = Constants.BASICMODE;
super.create();
stateBeginText = new InitText(currentMode);
add(stateBeginText);
if (init){
Horse.ship = new Ship(40, 80);
Horse.init = false;
} else {
Horse.changeShipMode(currentMode);
};
_ship = Horse.ship;
add(_ship.blood);
add(_ship);
_ship.x = 40;
_ship.y = 80;
FlxG.playMusic(BasicsMusic);
}
}
}//package
Section 58
//Basics_Layer1_01 (Basics_Layer1_01)
package {
import flash.display.*;
public dynamic class Basics_Layer1_01 extends BitmapData {
public function Basics_Layer1_01(_arg1:int=320, _arg2:int=160){
super(_arg1, _arg2);
}
}
}//package
Section 59
//Basics_Layer1_02 (Basics_Layer1_02)
package {
import flash.display.*;
public dynamic class Basics_Layer1_02 extends BitmapData {
public function Basics_Layer1_02(_arg1:int=320, _arg2:int=160){
super(_arg1, _arg2);
}
}
}//package
Section 60
//Basics_Layer2_01 (Basics_Layer2_01)
package {
import flash.display.*;
public dynamic class Basics_Layer2_01 extends BitmapData {
public function Basics_Layer2_01(_arg1:int=10, _arg2:int=10){
super(_arg1, _arg2);
}
}
}//package
Section 61
//Basics_Layer2_02 (Basics_Layer2_02)
package {
import flash.display.*;
public dynamic class Basics_Layer2_02 extends BitmapData {
public function Basics_Layer2_02(_arg1:int=11, _arg2:int=7){
super(_arg1, _arg2);
}
}
}//package
Section 62
//Basics_Layer2_03 (Basics_Layer2_03)
package {
import flash.display.*;
public dynamic class Basics_Layer2_03 extends BitmapData {
public function Basics_Layer2_03(_arg1:int=9, _arg2:int=11){
super(_arg1, _arg2);
}
}
}//package
Section 63
//Basics_Layer3_01 (Basics_Layer3_01)
package {
import flash.display.*;
public dynamic class Basics_Layer3_01 extends BitmapData {
public function Basics_Layer3_01(_arg1:int=21, _arg2:int=34){
super(_arg1, _arg2);
}
}
}//package
Section 64
//Basics_Layer3_02 (Basics_Layer3_02)
package {
import flash.display.*;
public dynamic class Basics_Layer3_02 extends BitmapData {
public function Basics_Layer3_02(_arg1:int=28, _arg2:int=40){
super(_arg1, _arg2);
}
}
}//package
Section 65
//Basics_Layer3_03 (Basics_Layer3_03)
package {
import flash.display.*;
public dynamic class Basics_Layer3_03 extends BitmapData {
public function Basics_Layer3_03(_arg1:int=72, _arg2:int=63){
super(_arg1, _arg2);
}
}
}//package
Section 66
//Basics_Layer3_05 (Basics_Layer3_05)
package {
import flash.display.*;
public dynamic class Basics_Layer3_05 extends BitmapData {
public function Basics_Layer3_05(_arg1:int=28, _arg2:int=40){
super(_arg1, _arg2);
}
}
}//package
Section 67
//Basics_Layer3_06 (Basics_Layer3_06)
package {
import flash.display.*;
public dynamic class Basics_Layer3_06 extends BitmapData {
public function Basics_Layer3_06(_arg1:int=64, _arg2:int=37){
super(_arg1, _arg2);
}
}
}//package
Section 68
//Basics_Layer3_07 (Basics_Layer3_07)
package {
import flash.display.*;
public dynamic class Basics_Layer3_07 extends BitmapData {
public function Basics_Layer3_07(_arg1:int=52, _arg2:int=38){
super(_arg1, _arg2);
}
}
}//package
Section 69
//Basics_Layer3_08 (Basics_Layer3_08)
package {
import flash.display.*;
public dynamic class Basics_Layer3_08 extends BitmapData {
public function Basics_Layer3_08(_arg1:int=28, _arg2:int=34){
super(_arg1, _arg2);
}
}
}//package
Section 70
//Basics_Layer3_09 (Basics_Layer3_09)
package {
import flash.display.*;
public dynamic class Basics_Layer3_09 extends BitmapData {
public function Basics_Layer3_09(_arg1:int=80, _arg2:int=43){
super(_arg1, _arg2);
}
}
}//package
Section 71
//Basics_Layer3_10 (Basics_Layer3_10)
package {
import flash.display.*;
public dynamic class Basics_Layer3_10 extends BitmapData {
public function Basics_Layer3_10(_arg1:int=49, _arg2:int=41){
super(_arg1, _arg2);
}
}
}//package
Section 72
//Basics_Layer4_01 (Basics_Layer4_01)
package {
import flash.display.*;
public dynamic class Basics_Layer4_01 extends BitmapData {
public function Basics_Layer4_01(_arg1:int=16, _arg2:int=15){
super(_arg1, _arg2);
}
}
}//package
Section 73
//ChangeText (ChangeText)
package {
import org.flixel.*;
public class ChangeText extends FlxGroup {
protected var toStateText:FlxText;
protected var countDownText:FlxText;
protected var _stateChangeTimer:Number;
protected var stopText:FlxText;
protected var drawText:Boolean;
protected var _countDown:Number;
protected var _ok:Boolean;
protected var toState:String;
public function ChangeText(nextState:String, c:uint=0xFFFFFF){
super();
drawText = false;
toState = nextState;
scrollFactor = new FlxPoint(0, 0);
stopText = new FlxText(0, (FlxG.height / 2), FlxG.width, "GET READY");
stopText.visible = false;
stopText.size = 16;
stopText.alignment = "center";
stopText.color = c;
add(stopText, true);
_stateChangeTimer = 2;
}
public function set freezeTimer(t:Number):void{
_stateChangeTimer = t;
}
public function onRunStateChange():void{
if (_stateChangeTimer > 0){
stopText.visible = true;
_stateChangeTimer = (_stateChangeTimer - FlxG.elapsed);
} else {
if ((((_stateChangeTimer <= 0)) && (!(drawText)))){
Horse.changeMode(toState);
stopText.visible = false;
drawText = true;
};
};
}
}
}//package
Section 74
//Constants (Constants)
package {
public class Constants {
public static const GBMODE:String = "Gameboy";
public static const TIMEMODE:String = "Time Warp";
public static const NORMAL:String = "normal";
public static const PLATFORMMODE:String = "Platforms";
public static const UP:String = "up";
public static const HORIZONTAL:String = "horizontal";
public static const JUMP:String = "jump";
public static const CROWDMODE:String = "Crowd Control";
public static const BASICMODE:String = "Back to Basics";
public static const TOP:String = "top";
public static const NONE:String = "none";
public static const RANDOM:String = "random";
public static const OFF:String = "off";
public static const SHMUPMODE:String = "Bullet Hell";
public static const LLR:String = "llr";
public static const ON:String = "on";
public static const HORSEMODE:String = "Horse";
public static const HAMMERMODE:String = "Hammer Time";
public static const FFMODE:String = "Friendly Fire";
public static const STATIC:String = "static";
public static const TARGETED:String = "targeted";
public static const LLRMODE:String = "Love Love Revolution";
public static const JAWSMODE:String = "Jaws";
public static const WAVES:String = "waves";
public static const GREEDMODE:String = "Greed";
public static const VERTICAL:String = "vertical";
public static const INCREASING:String = "increasing";
public function Constants(){
super();
}
}
}//package
Section 75
//CreditState (CreditState)
package {
import org.flixel.*;
public class CreditState extends FlxState {
public function CreditState(){
super();
}
override public function update():void{
if (FlxG.keys.UP){
FlxG.state = new MenuState();
};
}
override public function create():void{
add(new FlxSprite(0, 0, Basics_Layer1_02));
var title:FlxText = new FlxText(0, (FlxG.height / 12), FlxG.width, "CREDITS");
title.size = 16;
title.alignment = "center";
add(title);
var t1:FlxText = new FlxText(0, ((9 * FlxG.height) / 10), FlxG.width, "PRESS 'UP' TO GO BACK TO MENU");
t1.color = 4284769380;
t1.alignment = "center";
add(t1);
t1 = new FlxText(0, (FlxG.height / 4), FlxG.width, "HENRIK PETTERSSON had ideas and made them shiny. DELIA HAMWOOD made them do stuff and make noise.");
t1.color = 4294967295;
t1.alignment = "center";
add(t1);
t1 = new FlxText(0, (FlxG.height / 2), FlxG.width, "KAI HULME and KYLIE FINDLAY gave art and ideas. MATT DITTON helped fix the broken bits.");
t1.color = 4294967295;
t1.alignment = "center";
add(t1);
t1 = new FlxText(0, ((3 * FlxG.height) / 4), FlxG.width, "Some of the musics borrowed from WEEBL, MC HAMMER and HADDAWAY. All other musics composed by DELIA.");
t1.color = 4294967295;
t1.alignment = "center";
add(t1);
FlxG.stage.focus = this;
}
}
}//package
Section 76
//Crowd_Layer1_01 (Crowd_Layer1_01)
package {
import flash.display.*;
public dynamic class Crowd_Layer1_01 extends BitmapData {
public function Crowd_Layer1_01(_arg1:int=320, _arg2:int=160){
super(_arg1, _arg2);
}
}
}//package
Section 77
//Crowd_Layer1_02 (Crowd_Layer1_02)
package {
import flash.display.*;
public dynamic class Crowd_Layer1_02 extends BitmapData {
public function Crowd_Layer1_02(_arg1:int=320, _arg2:int=160){
super(_arg1, _arg2);
}
}
}//package
Section 78
//Crowd_Layer2_01 (Crowd_Layer2_01)
package {
import flash.display.*;
public dynamic class Crowd_Layer2_01 extends BitmapData {
public function Crowd_Layer2_01(_arg1:int=9, _arg2:int=11){
super(_arg1, _arg2);
}
}
}//package
Section 79
//Crowd_Layer2_02 (Crowd_Layer2_02)
package {
import flash.display.*;
public dynamic class Crowd_Layer2_02 extends BitmapData {
public function Crowd_Layer2_02(_arg1:int=11, _arg2:int=7){
super(_arg1, _arg2);
}
}
}//package
Section 80
//Crowd_Layer2_03 (Crowd_Layer2_03)
package {
import flash.display.*;
public dynamic class Crowd_Layer2_03 extends BitmapData {
public function Crowd_Layer2_03(_arg1:int=10, _arg2:int=10){
super(_arg1, _arg2);
}
}
}//package
Section 81
//Crowd_Layer3_01 (Crowd_Layer3_01)
package {
import flash.display.*;
public dynamic class Crowd_Layer3_01 extends BitmapData {
public function Crowd_Layer3_01(_arg1:int=28, _arg2:int=34){
super(_arg1, _arg2);
}
}
}//package
Section 82
//Crowd_Layer3_02 (Crowd_Layer3_02)
package {
import flash.display.*;
public dynamic class Crowd_Layer3_02 extends BitmapData {
public function Crowd_Layer3_02(_arg1:int=72, _arg2:int=62){
super(_arg1, _arg2);
}
}
}//package
Section 83
//Crowd_Layer3_03 (Crowd_Layer3_03)
package {
import flash.display.*;
public dynamic class Crowd_Layer3_03 extends BitmapData {
public function Crowd_Layer3_03(_arg1:int=56, _arg2:int=44){
super(_arg1, _arg2);
}
}
}//package
Section 84
//Crowd_Layer3_05 (Crowd_Layer3_05)
package {
import flash.display.*;
public dynamic class Crowd_Layer3_05 extends BitmapData {
public function Crowd_Layer3_05(_arg1:int=49, _arg2:int=41){
super(_arg1, _arg2);
}
}
}//package
Section 85
//Crowd_Layer3_06 (Crowd_Layer3_06)
package {
import flash.display.*;
public dynamic class Crowd_Layer3_06 extends BitmapData {
public function Crowd_Layer3_06(_arg1:int=52, _arg2:int=38){
super(_arg1, _arg2);
}
}
}//package
Section 86
//Crowd_Layer3_07 (Crowd_Layer3_07)
package {
import flash.display.*;
public dynamic class Crowd_Layer3_07 extends BitmapData {
public function Crowd_Layer3_07(_arg1:int=64, _arg2:int=37){
super(_arg1, _arg2);
}
}
}//package
Section 87
//Crowd_Layer3_08 (Crowd_Layer3_08)
package {
import flash.display.*;
public dynamic class Crowd_Layer3_08 extends BitmapData {
public function Crowd_Layer3_08(_arg1:int=20, _arg2:int=53){
super(_arg1, _arg2);
}
}
}//package
Section 88
//Crowd_Layer3_09 (Crowd_Layer3_09)
package {
import flash.display.*;
public dynamic class Crowd_Layer3_09 extends BitmapData {
public function Crowd_Layer3_09(_arg1:int=21, _arg2:int=34){
super(_arg1, _arg2);
}
}
}//package
Section 89
//Crowd_Layer3_10 (Crowd_Layer3_10)
package {
import flash.display.*;
public dynamic class Crowd_Layer3_10 extends BitmapData {
public function Crowd_Layer3_10(_arg1:int=28, _arg2:int=39){
super(_arg1, _arg2);
}
}
}//package
Section 90
//CrowdState (CrowdState)
package {
import org.flixel.*;
public class CrowdState extends State {
public function CrowdState(){
super();
}
override protected function collisions():void{
_obstacles.collide(boundsVerticalGroup);
}
override public function update():void{
super.update();
}
override public function create():void{
currentMode = Constants.CROWDMODE;
super.create();
stateBeginText = new InitText(currentMode);
add(stateBeginText);
_ship = Horse.ship;
add(_ship.blood);
add(_ship);
_ship.x = 40;
_ship.y = 80;
Horse.changeShipMode(currentMode);
FlxG.playMusic(BasicsMusic);
}
override protected function setupAssets():void{
Layer1 = [Crowd_Layer1_01, Crowd_Layer1_02];
Layer2 = [Crowd_Layer2_01, Crowd_Layer2_02, Crowd_Layer2_03];
Layer3 = [Crowd_Layer3_01, Crowd_Layer3_02, Crowd_Layer3_03, Crowd_Layer3_05, Crowd_Layer3_06, Crowd_Layer3_07, Crowd_Layer3_08, Crowd_Layer3_09, Crowd_Layer3_10];
assets = new Array();
assets.push(new AssetLayerRow(Layer1, 1, AssetLayerRow.TOP, AssetLayerRow.ORDERED));
assets.push(new AssetLayerRow(Layer3, 2, AssetLayerRow.BOTTOM, AssetLayerRow.RANDOM));
assets.push(new AssetLayerRow(Layer3, 2, AssetLayerRow.TOP, AssetLayerRow.RANDOM, AssetLayerRow.HORIZONTAL, true));
add((assets[0] as AssetLayerRow));
var tempAsset:AssetLayerRandom = new AssetLayerRandom(0.8, Layer2, 5, FlxG.width);
add(tempAsset);
var i = 1;
while (i < assets.length) {
add((assets[i] as AssetLayerRow));
i++;
};
}
}
}//package
Section 91
//EndState (EndState)
package {
import org.flixel.*;
public class EndState extends FlxState {
private var _ok:Boolean;
private var _t2:FlxText;
private var nameSplicePoint:int;// = -1
private var _ok2:Boolean;
private var title:FlxText;
protected var initialsInput:FlxInputText;
public function EndState(){
super();
}
override public function update():void{
var t1:FlxText;
var t2:FlxText;
var t3:FlxText;
var t5:FlxText;
var t6:FlxText;
var t4:FlxText;
var tm:Number = (FlxG.height / 6);
var t1m:Number = title.y;
if (title.y < tm){
title.y = (title.y + ((FlxG.elapsed * FlxG.height) * 2));
if (title.y > tm){
title.y = tm;
};
};
if (((!(_ok)) && ((title.y == t1m)))){
_ok = true;
FlxG.flash.start(68719476735, 0.5);
t2 = new FlxText(0, (title.y + 40), FlxG.width, ("YOUR SCORE: " + FlxG.score));
t2.size = 16;
t2.color = 4294967295;
t2.alignment = "center";
add(t2);
if (nameSplicePoint == -1){
t1 = new FlxText(0, (title.y + 100), FlxG.width, "PRESS 'UP' TO GO BACK TO MENU");
t1.color = 4284769380;
t1.alignment = "center";
add(t1);
t5 = new FlxText(0, (title.y + 116), FlxG.width, "PRESS 'DOWN' TO SEE HIGH SCORES");
t5.color = 4284769380;
t5.alignment = "center";
add(t5);
t6 = new FlxText(0, (title.y + 70), FlxG.width, ("TOP SCORE: " + Horse.scores[0]));
t6.size = 16;
t6.color = 4294967295;
t6.alignment = "center";
add(t6);
} else {
if (nameSplicePoint >= 0){
t4 = new FlxText(0, (title.y + 60), FlxG.width, "NEW HIGH SCORE!");
t4.size = 16;
t4.color = 4294967295;
t4.alignment = "center";
add(t4);
t3 = new FlxText(0, (title.y + 80), FlxG.width, "ENTER YOUR INITIALS:");
t3.color = 4294967295;
t3.alignment = "center";
add(t3);
t1 = new FlxText(0, (title.y + 120), FlxG.width, "PRESS 'UP' TO CONFIRM");
t1.color = 4284769380;
t1.alignment = "center";
add(t1);
initialsInput = new FlxInputText(((FlxG.width / 2) - 16), (title.y + 100), 32, 16, "", 0xFFFFFF, null, 16);
initialsInput.setMaxLength(3);
initialsInput.filterMode = FlxInputText.ONLY_ALPHA;
initialsInput.forceUpperCase = true;
add(initialsInput);
};
};
};
if (((((_ok) && (!(_ok2)))) && (FlxG.keys.UP))){
_ok2 = true;
FlxG.fade.start(4279442459, 1, onFade);
} else {
if (((((_ok) && (!(_ok2)))) && (FlxG.keys.DOWN))){
_ok2 = true;
if (nameSplicePoint == -1){
FlxG.state = new HighScoreState();
};
};
};
super.update();
}
private function onFade():void{
var tempName:String;
var saveScore:FlxSave;
if (nameSplicePoint >= 0){
tempName = (initialsInput.getText() as String);
Horse.names.splice(nameSplicePoint, 0, "asdf");
Horse.names[nameSplicePoint] = tempName;
Horse.names.pop();
saveScore = new FlxSave();
if (saveScore.bind("Horse")){
saveScore.data.names = Horse.names;
saveScore.data.scores = Horse.scores;
};
FlxG.state = new HighScoreState();
} else {
FlxG.state = new MenuState();
};
}
override public function create():void{
var i:uint;
var s:FlxSprite;
var scores:Array;
var names:Array;
FlxGame.turnOffHotkeys();
FlxG.stage.focus = this;
title = new FlxText(0, 0, FlxG.width, "GAME OVER");
title.alignment = "center";
title.size = 32;
title.color = 4291559424;
title.antialiasing = true;
add(title);
FlxG.music.stop();
FlxState.bgColor = 4281479730;
_ok = false;
_ok2 = false;
var addScore:Boolean;
var j:int;
while (j < Horse.scores.length) {
if ((((FlxG.score > Horse.scores[j])) && (addScore))){
Horse.scores.splice(j, 0, FlxG.score);
Horse.scores.pop();
nameSplicePoint = j;
addScore = false;
};
j++;
};
}
}
}//package
Section 92
//FF_L1_1 (FF_L1_1)
package {
import flash.display.*;
public dynamic class FF_L1_1 extends BitmapData {
public function FF_L1_1(_arg1:int=6, _arg2:int=8){
super(_arg1, _arg2);
}
}
}//package
Section 93
//FF_L1_2 (FF_L1_2)
package {
import flash.display.*;
public dynamic class FF_L1_2 extends BitmapData {
public function FF_L1_2(_arg1:int=8, _arg2:int=8){
super(_arg1, _arg2);
}
}
}//package
Section 94
//FF_L1_3 (FF_L1_3)
package {
import flash.display.*;
public dynamic class FF_L1_3 extends BitmapData {
public function FF_L1_3(_arg1:int=8, _arg2:int=8){
super(_arg1, _arg2);
}
}
}//package
Section 95
//FF_L1_4 (FF_L1_4)
package {
import flash.display.*;
public dynamic class FF_L1_4 extends BitmapData {
public function FF_L1_4(_arg1:int=8, _arg2:int=6){
super(_arg1, _arg2);
}
}
}//package
Section 96
//FF_L1_5 (FF_L1_5)
package {
import flash.display.*;
public dynamic class FF_L1_5 extends BitmapData {
public function FF_L1_5(_arg1:int=8, _arg2:int=7){
super(_arg1, _arg2);
}
}
}//package
Section 97
//FF_L2_1 (FF_L2_1)
package {
import flash.display.*;
public dynamic class FF_L2_1 extends BitmapData {
public function FF_L2_1(_arg1:int=7, _arg2:int=7){
super(_arg1, _arg2);
}
}
}//package
Section 98
//FF_L2_2 (FF_L2_2)
package {
import flash.display.*;
public dynamic class FF_L2_2 extends BitmapData {
public function FF_L2_2(_arg1:int=7, _arg2:int=7){
super(_arg1, _arg2);
}
}
}//package
Section 99
//FF_L2_3 (FF_L2_3)
package {
import flash.display.*;
public dynamic class FF_L2_3 extends BitmapData {
public function FF_L2_3(_arg1:int=7, _arg2:int=6){
super(_arg1, _arg2);
}
}
}//package
Section 100
//FF_L2_4 (FF_L2_4)
package {
import flash.display.*;
public dynamic class FF_L2_4 extends BitmapData {
public function FF_L2_4(_arg1:int=7, _arg2:int=7){
super(_arg1, _arg2);
}
}
}//package
Section 101
//FF_L3_1 (FF_L3_1)
package {
import flash.display.*;
public dynamic class FF_L3_1 extends BitmapData {
public function FF_L3_1(_arg1:int=6, _arg2:int=6){
super(_arg1, _arg2);
}
}
}//package
Section 102
//FF_L3_2 (FF_L3_2)
package {
import flash.display.*;
public dynamic class FF_L3_2 extends BitmapData {
public function FF_L3_2(_arg1:int=6, _arg2:int=6){
super(_arg1, _arg2);
}
}
}//package
Section 103
//FF_L3_3 (FF_L3_3)
package {
import flash.display.*;
public dynamic class FF_L3_3 extends BitmapData {
public function FF_L3_3(_arg1:int=6, _arg2:int=6){
super(_arg1, _arg2);
}
}
}//package
Section 104
//FF_L3_4 (FF_L3_4)
package {
import flash.display.*;
public dynamic class FF_L3_4 extends BitmapData {
public function FF_L3_4(_arg1:int=6, _arg2:int=6){
super(_arg1, _arg2);
}
}
}//package
Section 105
//FF_L4_1 (FF_L4_1)
package {
import flash.display.*;
public dynamic class FF_L4_1 extends BitmapData {
public function FF_L4_1(_arg1:int=4, _arg2:int=4){
super(_arg1, _arg2);
}
}
}//package
Section 106
//FF_L4_2 (FF_L4_2)
package {
import flash.display.*;
public dynamic class FF_L4_2 extends BitmapData {
public function FF_L4_2(_arg1:int=5, _arg2:int=5){
super(_arg1, _arg2);
}
}
}//package
Section 107
//FF_L4_3 (FF_L4_3)
package {
import flash.display.*;
public dynamic class FF_L4_3 extends BitmapData {
public function FF_L4_3(_arg1:int=5, _arg2:int=5){
super(_arg1, _arg2);
}
}
}//package
Section 108
//FF_L4_4 (FF_L4_4)
package {
import flash.display.*;
public dynamic class FF_L4_4 extends BitmapData {
public function FF_L4_4(_arg1:int=5, _arg2:int=5){
super(_arg1, _arg2);
}
}
}//package
Section 109
//FF_L5_1 (FF_L5_1)
package {
import flash.display.*;
public dynamic class FF_L5_1 extends BitmapData {
public function FF_L5_1(_arg1:int=4, _arg2:int=4){
super(_arg1, _arg2);
}
}
}//package
Section 110
//FF_L5_2 (FF_L5_2)
package {
import flash.display.*;
public dynamic class FF_L5_2 extends BitmapData {
public function FF_L5_2(_arg1:int=4, _arg2:int=4){
super(_arg1, _arg2);
}
}
}//package
Section 111
//FF_L5_3 (FF_L5_3)
package {
import flash.display.*;
public dynamic class FF_L5_3 extends BitmapData {
public function FF_L5_3(_arg1:int=4, _arg2:int=4){
super(_arg1, _arg2);
}
}
}//package
Section 112
//FF_L5_4 (FF_L5_4)
package {
import flash.display.*;
public dynamic class FF_L5_4 extends BitmapData {
public function FF_L5_4(_arg1:int=4, _arg2:int=4){
super(_arg1, _arg2);
}
}
}//package
Section 113
//FFBullet (FFBullet)
package {
import org.flixel.*;
public class FFBullet extends SpawningElement {
public var changeDir:Boolean;// = false
public function FFBullet(X:Number=0, Y:Number=0, SimpleGraphic:Class=null){
super(X, Y, SimpleGraphic);
this.velocity.x = Horse.gameSpeed;
this.maxVelocity.x = 250;
this.drag.x = maxVelocity.x;
this.scrollFactor = new FlxPoint(0, 0);
createGraphic(4, 4);
}
override public function update():void{
if (this.x > (FlxG.width / 2.5)){
changeDir = true;
};
if (changeDir){
acceleration.x = -(Horse.gameSpeed);
} else {
acceleration.x = Horse.gameSpeed;
};
super.update();
}
}
}//package
Section 114
//FFBulletSet (FFBulletSet)
package {
import org.flixel.*;
public class FFBulletSet extends SpawningElementSet {
public var collidable:FlxGroup;
public function FFBulletSet(){
super();
collidable = new FlxGroup();
spawnDelay = 0.5;
spawnTimer = spawnDelay;
spawnMod = false;
}
override public function update():void{
checkCollidable();
super.update();
}
override protected function spawn():void{
var tempBullet:FFBullet = new FFBullet(Horse.getShipX(), Horse.getShipY());
add(tempBullet);
}
protected function checkCollidable():void{
var temp:FFBullet;
var i:int;
while (i < members.length) {
temp = members[i];
if (temp.changeDir){
if (Math.abs(temp.velocity.x) == temp.maxVelocity.x){
collidable.add(temp);
};
};
i++;
};
}
}
}//package
Section 115
//FFState (FFState)
package {
import org.flixel.*;
public class FFState extends State {
private var bulletSet:FFBulletSet;
public function FFState(){
super();
}
override protected function collisions():void{
_obstacles.collide(boundsVerticalGroup);
if (((_ship.dead) || (_ship.invincible))){
_ship.collide(boundsVerticalGroup);
};
}
override protected function overlaps():void{
var loseScore:Points;
var loseScore2:Points;
if (((((_ship.overlaps(verticalBounds)) && (!(_ship.dead)))) && (!(_ship.invincible)))){
_ship.kill();
loseScore = new Points(_ship.x, _ship.y, 100, ("-" + Math.floor((FlxG.score / 2))), 0xCC0000, 40);
add(loseScore);
};
if (((((_ship.overlaps(verticalBounds2)) && (!(_ship.dead)))) && (!(_ship.invincible)))){
_ship.kill();
loseScore2 = new Points(_ship.x, _ship.y, 100, ("-" + Math.floor((FlxG.score / 2))), 0xCC0000, 40);
add(loseScore2);
};
}
override public function update():void{
if (initShip){
shipStartY = _ship.y;
};
if (_ship.dead){
bulletSet.stopped = true;
} else {
bulletSet.stopped = false;
};
super.update();
}
override protected function killShip(Object1:FlxObject, Object2:FlxObject):void{
var loseScore:Points = new Points(Object1.x, Object1.y, 120, ("-" + Math.floor((FlxG.score / 2))), 0xCC0000, 40);
add(loseScore);
var temp1:Ship = (Object1 as Ship);
var temp2:FFBullet = (Object2 as FFBullet);
temp1.kill();
temp2.kill();
}
override protected function obstacleOverlaps():void{
if (((!(_ship.dead)) && (!(_ship.invincible)))){
FlxU.overlap(_ship, bulletSet.collidable, killShip);
};
}
override public function create():void{
currentMode = Constants.FFMODE;
super.create();
stateBeginText = new InitText(currentMode);
add(stateBeginText);
_ship = Horse.ship;
bulletSet = new FFBulletSet();
add(bulletSet);
add(_ship.blood);
add(_ship);
_ship.x = 40;
_ship.y = 80;
FlxState.bgColor = 4278190080;
FlxG.playMusic(BasicsMusic);
}
override protected function setupAssets():void{
Layer4 = [Basics_Layer4_01];
assets.push(new AssetLayerRow(Layer4, 3, AssetLayerRow.TOP, AssetLayerRow.RANDOM, AssetLayerRow.HORIZONTAL, true));
assets.push(new AssetLayerRow(Layer4, 3, AssetLayerRow.BOTTOM, AssetLayerRow.RANDOM));
var i:int;
while (i < assets.length) {
add((assets[i] as AssetLayerRow));
i++;
};
}
}
}//package
Section 116
//FlxInputText (FlxInputText)
package {
import org.flixel.*;
import flash.events.*;
import flash.text.*;
public class FlxInputText extends FlxText {
public var forceUpperCase:Boolean;// = false
public var filterMode:uint;// = 0
private var nextFrameHide:Boolean;// = false
public var customFilterPattern:RegExp;
public static const CUSTOM_FILTER:uint = 4;
public static const ONLY_ALPHANUMERIC:uint = 3;
public static const ONLY_NUMERIC:uint = 2;
public static const ONLY_ALPHA:uint = 1;
public static const NO_FILTER:uint = 0;
public function FlxInputText(X:Number, Y:Number, Width:uint, Height:uint, Text:String, Color:uint=0, Font:String=null, Size:uint=8, Justification:String=null, Angle:Number=0){
customFilterPattern = /[]*/g;
super(X, Y, Width, Text);
_tf.selectable = true;
_tf.type = TextFieldType.INPUT;
_tf.background = true;
_tf.backgroundColor = 4281479730;
_tf.textColor = Color;
_tf.border = false;
_tf.borderColor = Color;
_tf.visible = false;
_tf.height = Height;
this.height = Height;
this.angle = Angle;
FlxG.stage.focus = this._tf;
this.alignment = "center";
_tf.addEventListener(Event.ENTER_FRAME, onEnterFrame);
_tf.addEventListener(Event.REMOVED_FROM_STAGE, onInputFieldRemoved);
_tf.addEventListener(Event.CHANGE, onTextChange);
FlxG.state.addChild(_tf);
}
private function onTextChange(event:Event):void{
var pattern:RegExp;
if (forceUpperCase){
_tf.text = _tf.text.toUpperCase();
};
if (filterMode != NO_FILTER){
switch (filterMode){
case ONLY_ALPHA:
pattern = /[^a-zA-Z]*/g;
break;
case ONLY_NUMERIC:
pattern = /[^0-9]*/g;
break;
case ONLY_ALPHANUMERIC:
pattern = /[^a-zA-Z0-9]*/g;
break;
case CUSTOM_FILTER:
pattern = customFilterPattern;
break;
default:
throw (new Error((("FlxInputText: Unknown filterMode (" + filterMode) + ")")));
};
_tf.text = _tf.text.replace(pattern, "");
};
}
public function get backgroundColor():uint{
return (_tf.backgroundColor);
}
public function set borderColor(Color:uint):void{
_tf.borderColor = Color;
}
public function set backgroundVisible(Enabled:Boolean):void{
_tf.background = Enabled;
}
public function set backgroundColor(Color:uint):void{
_tf.backgroundColor = Color;
}
public function get backgroundVisible():Boolean{
return (_tf.background);
}
public function set borderVisible(Enabled:Boolean):void{
_tf.border = Enabled;
}
public function get borderVisible():Boolean{
return (_tf.border);
}
public function setMaxLength(Length:uint):void{
_tf.maxChars = Length;
}
public function focus():void{
FlxG.stage.focus = this._tf;
}
private function onInputFieldRemoved(event:Event):void{
_tf.removeEventListener(Event.ENTER_FRAME, onEnterFrame);
_tf.removeEventListener(Event.REMOVED, onInputFieldRemoved);
_tf.removeEventListener(Event.CHANGE, onTextChange);
}
public function getText():String{
return (_tf.text);
}
private function onEnterFrame(event:Event):void{
if (nextFrameHide){
_tf.visible = false;
};
nextFrameHide = true;
}
public function get borderColor():uint{
return (_tf.borderColor);
}
override public function render():void{
_tf.x = x;
_tf.y = y;
_tf.visible = true;
nextFrameHide = false;
}
}
}//package
Section 117
//Greed_Layer1_01 (Greed_Layer1_01)
package {
import flash.display.*;
public dynamic class Greed_Layer1_01 extends BitmapData {
public function Greed_Layer1_01(_arg1:int=320, _arg2:int=160){
super(_arg1, _arg2);
}
}
}//package
Section 118
//Greed_Layer2_01 (Greed_Layer2_01)
package {
import flash.display.*;
public dynamic class Greed_Layer2_01 extends BitmapData {
public function Greed_Layer2_01(_arg1:int=157, _arg2:int=73){
super(_arg1, _arg2);
}
}
}//package
Section 119
//Greed_Layer2_02 (Greed_Layer2_02)
package {
import flash.display.*;
public dynamic class Greed_Layer2_02 extends BitmapData {
public function Greed_Layer2_02(_arg1:int=241, _arg2:int=74){
super(_arg1, _arg2);
}
}
}//package
Section 120
//Greed_Layer2_03 (Greed_Layer2_03)
package {
import flash.display.*;
public dynamic class Greed_Layer2_03 extends BitmapData {
public function Greed_Layer2_03(_arg1:int=176, _arg2:int=77){
super(_arg1, _arg2);
}
}
}//package
Section 121
//Greed_Layer2_04 (Greed_Layer2_04)
package {
import flash.display.*;
public dynamic class Greed_Layer2_04 extends BitmapData {
public function Greed_Layer2_04(_arg1:int=192, _arg2:int=73){
super(_arg1, _arg2);
}
}
}//package
Section 122
//Greed_Layer3_01 (Greed_Layer3_01)
package {
import flash.display.*;
public dynamic class Greed_Layer3_01 extends BitmapData {
public function Greed_Layer3_01(_arg1:int=240, _arg2:int=45){
super(_arg1, _arg2);
}
}
}//package
Section 123
//Greed_Obstacle_01 (Greed_Obstacle_01)
package {
import flash.display.*;
public dynamic class Greed_Obstacle_01 extends BitmapData {
public function Greed_Obstacle_01(_arg1:int=15, _arg2:int=9){
super(_arg1, _arg2);
}
}
}//package
Section 124
//Greed_Obstacle_02 (Greed_Obstacle_02)
package {
import flash.display.*;
public dynamic class Greed_Obstacle_02 extends BitmapData {
public function Greed_Obstacle_02(_arg1:int=12, _arg2:int=11){
super(_arg1, _arg2);
}
}
}//package
Section 125
//Greed_Obstacle_03 (Greed_Obstacle_03)
package {
import flash.display.*;
public dynamic class Greed_Obstacle_03 extends BitmapData {
public function Greed_Obstacle_03(_arg1:int=14, _arg2:int=12){
super(_arg1, _arg2);
}
}
}//package
Section 126
//Greed_Obstacle_04 (Greed_Obstacle_04)
package {
import flash.display.*;
public dynamic class Greed_Obstacle_04 extends BitmapData {
public function Greed_Obstacle_04(_arg1:int=15, _arg2:int=16){
super(_arg1, _arg2);
}
}
}//package
Section 127
//Greed_Obstacle_05 (Greed_Obstacle_05)
package {
import flash.display.*;
public dynamic class Greed_Obstacle_05 extends BitmapData {
public function Greed_Obstacle_05(_arg1:int=15, _arg2:int=20){
super(_arg1, _arg2);
}
}
}//package
Section 128
//Greed_Obstacle_06 (Greed_Obstacle_06)
package {
import flash.display.*;
public dynamic class Greed_Obstacle_06 extends BitmapData {
public function Greed_Obstacle_06(_arg1:int=13, _arg2:int=12){
super(_arg1, _arg2);
}
}
}//package
Section 129
//Greed_Obstacle_07 (Greed_Obstacle_07)
package {
import flash.display.*;
public dynamic class Greed_Obstacle_07 extends BitmapData {
public function Greed_Obstacle_07(_arg1:int=5, _arg2:int=12){
super(_arg1, _arg2);
}
}
}//package
Section 130
//Greed_Obstacle_08 (Greed_Obstacle_08)
package {
import flash.display.*;
public dynamic class Greed_Obstacle_08 extends BitmapData {
public function Greed_Obstacle_08(_arg1:int=13, _arg2:int=16){
super(_arg1, _arg2);
}
}
}//package
Section 131
//Greed_Obstacle_09 (Greed_Obstacle_09)
package {
import flash.display.*;
public dynamic class Greed_Obstacle_09 extends BitmapData {
public function Greed_Obstacle_09(_arg1:int=13, _arg2:int=13){
super(_arg1, _arg2);
}
}
}//package
Section 132
//Greed_Obstacle_Special_01 (Greed_Obstacle_Special_01)
package {
import flash.display.*;
public dynamic class Greed_Obstacle_Special_01 extends BitmapData {
public function Greed_Obstacle_Special_01(_arg1:int=20, _arg2:int=14){
super(_arg1, _arg2);
}
}
}//package
Section 133
//Greed_Obstacle_Special_02 (Greed_Obstacle_Special_02)
package {
import flash.display.*;
public dynamic class Greed_Obstacle_Special_02 extends BitmapData {
public function Greed_Obstacle_Special_02(_arg1:int=25, _arg2:int=19){
super(_arg1, _arg2);
}
}
}//package
Section 134
//Greed_PG_Lava (Greed_PG_Lava)
package {
import flash.display.*;
public dynamic class Greed_PG_Lava extends BitmapData {
public function Greed_PG_Lava(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 135
//Greed_PG_topBricks (Greed_PG_topBricks)
package {
import flash.display.*;
public dynamic class Greed_PG_topBricks extends BitmapData {
public function Greed_PG_topBricks(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 136
//Greed_Ship (Greed_Ship)
package {
import flash.display.*;
public dynamic class Greed_Ship extends BitmapData {
public function Greed_Ship(_arg1:int=80, _arg2:int=7){
super(_arg1, _arg2);
}
}
}//package
Section 137
//GreedState (GreedState)
package {
import org.flixel.*;
public class GreedState extends State {
public function GreedState(){
super();
}
override protected function setupAssets():void{
Layer1 = [Greed_Layer1_01];
Layer2 = [Greed_Layer2_01, Greed_Layer2_02, Greed_Layer2_03, Greed_Layer2_04];
Layer3 = [Greed_Layer3_01, Greed_Layer3_01];
Layer4 = [Greed_PG_Lava];
var Layer5:Array = [Greed_PG_topBricks];
assets = new Array();
assets.push(new AssetLayerRow(Layer1, 1, AssetLayerRow.TOP, AssetLayerRow.RANDOM));
assets.push(new AssetLayerRow(Layer2, 2, AssetLayerRow.BOTTOM, AssetLayerRow.RANDOM));
assets.push(new AssetLayerRow(Layer3, 3, AssetLayerRow.BOTTOM, AssetLayerRow.RANDOM));
assets.push(new AssetLayerRow(Layer4, 3, AssetLayerRow.BOTTOM, AssetLayerRow.RANDOM));
assets.push(new AssetLayerRow(Layer5, 3, AssetLayerRow.TOP, AssetLayerRow.RANDOM));
var i:int;
while (i < assets.length) {
add((assets[i] as AssetLayerRow));
i++;
};
}
override protected function collisions():void{
_obstacles.collide(boundsVerticalGroup);
if (((_ship.dead) || (_ship.invincible))){
_ship.collide(boundsVerticalGroup);
};
}
override public function update():void{
if (initShip){
_ship.collide(boundsVerticalGroup);
};
super.update();
}
override public function create():void{
currentMode = Constants.GREEDMODE;
super.create();
stateBeginText = new InitText(currentMode);
add(stateBeginText);
_ship = Horse.ship;
_ship.x = 40;
_ship.y = 80;
add(_ship.blood);
add(_ship);
FlxG.playMusic(GreedMusic);
}
override protected function overlaps():void{
var loseScore:Points;
var loseScore2:Points;
if (((((_ship.overlaps(verticalBounds)) && (!(_ship.dead)))) && (!(_ship.invincible)))){
_ship.kill();
loseScore = new Points(_ship.x, _ship.y, 100, ("-" + Math.floor((FlxG.score / 2))), 0xCC0000, 40);
add(loseScore);
};
if (((((_ship.overlaps(verticalBounds2)) && (!(_ship.dead)))) && (!(_ship.invincible)))){
_ship.kill();
loseScore2 = new Points(_ship.x, _ship.y, 100, ("-" + Math.floor((FlxG.score / 2))), 0xCC0000, 40);
add(loseScore2);
};
}
}
}//package
Section 138
//Hammer_Layer1_01 (Hammer_Layer1_01)
package {
import flash.display.*;
public dynamic class Hammer_Layer1_01 extends BitmapData {
public function Hammer_Layer1_01(_arg1:int=46, _arg2:int=46){
super(_arg1, _arg2);
}
}
}//package
Section 139
//Hammer_Layer1_02 (Hammer_Layer1_02)
package {
import flash.display.*;
public dynamic class Hammer_Layer1_02 extends BitmapData {
public function Hammer_Layer1_02(_arg1:int=68, _arg2:int=9){
super(_arg1, _arg2);
}
}
}//package
Section 140
//Hammer_Layer2_02 (Hammer_Layer2_02)
package {
import flash.display.*;
public dynamic class Hammer_Layer2_02 extends BitmapData {
public function Hammer_Layer2_02(_arg1:int=16, _arg2:int=16){
super(_arg1, _arg2);
}
}
}//package
Section 141
//Hammer_Obstacle_01 (Hammer_Obstacle_01)
package {
import flash.display.*;
public dynamic class Hammer_Obstacle_01 extends BitmapData {
public function Hammer_Obstacle_01(_arg1:int=351, _arg2:int=34){
super(_arg1, _arg2);
}
}
}//package
Section 142
//Hammer_Ship (Hammer_Ship)
package {
import flash.display.*;
public dynamic class Hammer_Ship extends BitmapData {
public function Hammer_Ship(_arg1:int=128, _arg2:int=32){
super(_arg1, _arg2);
}
}
}//package
Section 143
//HammerState (HammerState)
package {
import org.flixel.*;
public class HammerState extends State {
public function HammerState(){
super();
}
override protected function setupAssets():void{
var dancingGirl:FlxSprite;
assets = new Array();
Layer1 = [Hammer_Layer1_01];
var i = 1;
while (i < 6) {
dancingGirl = new FlxSprite(46, ((i * FlxG.height) / 6));
dancingGirl.loadGraphic(Hammer_Layer1_02, true, false, 17, 9);
dancingGirl.addAnimation("dance", [1, 2, 3, 4], 8);
dancingGirl.play("dance");
dancingGirl.scrollFactor = new FlxPoint(0, 0);
add(dancingGirl);
i++;
};
Layer3 = [Hammer_Layer2_02];
assets.push(new AssetLayerRow(Layer1, 0, AssetLayerRow.LEFT, AssetLayerRow.RANDOM, AssetLayerRow.VERTICAL));
assets.push(new AssetLayerRow(Layer3, 0, AssetLayerRow.LEFT, AssetLayerRow.RANDOM, AssetLayerRow.VERTICAL));
i = 0;
while (i < assets.length) {
add((assets[i] as AssetLayerRow));
i++;
};
}
override protected function collisions():void{
_ship.collide(boundsHorizontalGroup);
_ship.collide(boundsVerticalGroup);
_obstacles.collide(horizontalBounds);
}
override protected function addScore():void{
}
override public function update():void{
if (initShip){
shipStartY = _ship.y;
_ship.collide(boundsVerticalGroup);
};
super.update();
}
override public function create():void{
currentMode = Constants.HAMMERMODE;
super.create();
stateBeginText = new InitText(currentMode);
add(stateBeginText);
_ship = Horse.ship;
add(_ship.blood);
add(_ship);
_ship.x = 40;
_ship.y = 80;
FlxG.playMusic(HammerMusic);
FlxState.bgColor = 4294966201;
}
}
}//package
Section 144
//HighScoreState (HighScoreState)
package {
import org.flixel.*;
public class HighScoreState extends FlxState {
private var scores:Array;
private var names:Array;
private var title:FlxText;
public function HighScoreState(){
super();
}
override public function update():void{
if (FlxG.keys.UP){
FlxG.state = new MenuState();
} else {
if (FlxG.keys.DOWN){
FlxG.state = new CreditState();
};
};
}
override public function create():void{
var tempText:FlxText;
FlxG.stage.focus = this;
scores = Horse.scores.slice();
names = (Horse.names as Array);
add(new FlxSprite(0, 0, Basics_Layer1_01));
title = new FlxText(0, 2, FlxG.width, "HIGH SCORES");
title.size = 16;
title.alignment = "center";
add(title);
FlxG.music.stop();
FlxState.bgColor = 4281479730;
var i:int;
while (i < Horse.scores.length) {
if (i < 5){
tempText = new FlxText(0, ((FlxG.height / 8) * (i + 2)), (FlxG.width / 4), (Horse.names[i] as String));
tempText.alignment = "center";
tempText.size = 8;
add(tempText);
tempText = new FlxText((FlxG.width / 4), ((FlxG.height / 8) * (i + 2)), (FlxG.width / 4), Horse.scores[i].toString());
tempText.alignment = "center";
add(tempText);
} else {
tempText = new FlxText((FlxG.width / 2), ((FlxG.height / 8) * (i - 3)), (FlxG.width / 4), (Horse.names[i] as String));
tempText.size = 8;
tempText.alignment = "center";
add(tempText);
tempText = new FlxText(((3 * FlxG.width) / 4), ((FlxG.height / 8) * (i - 3)), (FlxG.width / 4), Horse.scores[i].toString());
tempText.alignment = "center";
add(tempText);
};
i++;
};
var t1:FlxText = new FlxText(0, (FlxG.height / 7), FlxG.width, "PRESS 'UP' TO GO BACK TO MENU");
t1.color = 4284769380;
t1.alignment = "center";
add(t1);
t1 = new FlxText(0, ((9 * FlxG.height) / 10), FlxG.width, "PRESS 'DOWN' TO SEE CREDITS");
t1.color = 4284769380;
t1.alignment = "center";
add(t1);
}
}
}//package
Section 145
//Horse (Horse)
package {
import org.flixel.*;
public class Horse extends FlxGame {
protected var DrumTrack:Class;
private static var _gamePos:Number = 0;
public static var names:Array;
public static var modeTracker:Array = new Array();
public static var init:Boolean = true;
private static var _ship:Ship;
public static var scores:Array;
private static var _gameSpeed:Number = 150;
public function Horse(){
DrumTrack = Horse_DrumTrack;
super(320, 160, MenuState, 4);
FlxState.bgColor = 4278190080;
modeTracker.push(Constants.BASICMODE);
scores = [1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000];
names = ["LOO", "KAT", "MYH", "ORS", "EMY", "HOR", "SEI", "SAM", "AZI", "NG"];
}
public static function set gamePos(_newPos:Number):void{
_gamePos = _newPos;
}
public static function get gamePos():Number{
return (_gamePos);
}
public static function changeShipMode(newMode:String):void{
_ship.changeMode(newMode);
}
public static function randRange(minNum:Number, maxNum:Number):Number{
return ((Math.floor((Math.random() * ((maxNum - minNum) + 1))) + minNum));
}
public static function getShipX():Number{
return (_ship.x);
}
public static function getShipY():Number{
return (_ship.y);
}
public static function set gameSpeed(_newSpeed:Number):void{
_gameSpeed = _newSpeed;
}
public static function changeMode(newMode:String):void{
var tempObj:String;
if ((((gameSpeed < 180)) && (!(_ship.dead)))){
gameSpeed = (gameSpeed + 6);
};
modeTracker.push(newMode);
if (modeTracker.length == 7){
tempObj = modeTracker[(modeTracker.length - 1)];
modeTracker = new Array();
};
switch (newMode){
case Constants.BASICMODE:
FlxG.state = new BaseState();
break;
case Constants.CROWDMODE:
FlxG.state = new CrowdState();
break;
case Constants.HORSEMODE:
FlxG.state = new HorseState();
break;
case Constants.HAMMERMODE:
FlxG.state = new HammerState();
break;
case Constants.FFMODE:
FlxG.state = new FFState();
break;
case Constants.GREEDMODE:
FlxG.state = new GreedState();
break;
case Constants.LLRMODE:
FlxG.state = new LLRState();
break;
};
}
public static function get gameSpeed():Number{
return (_gameSpeed);
}
public static function set ship(newShip:Ship):void{
_ship = newShip;
}
public static function get ship():Ship{
return (_ship);
}
}
}//package
Section 146
//Horse_DrumTrack (Horse_DrumTrack)
package {
import mx.core.*;
public class Horse_DrumTrack extends SoundAsset {
}
}//package
Section 147
//Horse_Layer1_01 (Horse_Layer1_01)
package {
import flash.display.*;
public dynamic class Horse_Layer1_01 extends BitmapData {
public function Horse_Layer1_01(_arg1:int=320, _arg2:int=160){
super(_arg1, _arg2);
}
}
}//package
Section 148
//Horse_Layer1_02 (Horse_Layer1_02)
package {
import flash.display.*;
public dynamic class Horse_Layer1_02 extends BitmapData {
public function Horse_Layer1_02(_arg1:int=320, _arg2:int=160){
super(_arg1, _arg2);
}
}
}//package
Section 149
//Horse_Layer2_01 (Horse_Layer2_01)
package {
import flash.display.*;
public dynamic class Horse_Layer2_01 extends BitmapData {
public function Horse_Layer2_01(_arg1:int=71, _arg2:int=43){
super(_arg1, _arg2);
}
}
}//package
Section 150
//Horse_Layer2_02 (Horse_Layer2_02)
package {
import flash.display.*;
public dynamic class Horse_Layer2_02 extends BitmapData {
public function Horse_Layer2_02(_arg1:int=49, _arg2:int=58){
super(_arg1, _arg2);
}
}
}//package
Section 151
//Horse_Layer2_03 (Horse_Layer2_03)
package {
import flash.display.*;
public dynamic class Horse_Layer2_03 extends BitmapData {
public function Horse_Layer2_03(_arg1:int=85, _arg2:int=54){
super(_arg1, _arg2);
}
}
}//package
Section 152
//Horse_Layer3_01 (Horse_Layer3_01)
package {
import flash.display.*;
public dynamic class Horse_Layer3_01 extends BitmapData {
public function Horse_Layer3_01(_arg1:int=126, _arg2:int=32){
super(_arg1, _arg2);
}
}
}//package
Section 153
//Horse_Layer3_02 (Horse_Layer3_02)
package {
import flash.display.*;
public dynamic class Horse_Layer3_02 extends BitmapData {
public function Horse_Layer3_02(_arg1:int=157, _arg2:int=44){
super(_arg1, _arg2);
}
}
}//package
Section 154
//Horse_Layer3_03 (Horse_Layer3_03)
package {
import flash.display.*;
public dynamic class Horse_Layer3_03 extends BitmapData {
public function Horse_Layer3_03(_arg1:int=164, _arg2:int=33){
super(_arg1, _arg2);
}
}
}//package
Section 155
//Horse_Layer3_04 (Horse_Layer3_04)
package {
import flash.display.*;
public dynamic class Horse_Layer3_04 extends BitmapData {
public function Horse_Layer3_04(_arg1:int=117, _arg2:int=57){
super(_arg1, _arg2);
}
}
}//package
Section 156
//Horse_Layer4_01 (Horse_Layer4_01)
package {
import flash.display.*;
public dynamic class Horse_Layer4_01 extends BitmapData {
public function Horse_Layer4_01(_arg1:int=8, _arg2:int=8){
super(_arg1, _arg2);
}
}
}//package
Section 157
//Horse_Obstacle_01 (Horse_Obstacle_01)
package {
import flash.display.*;
public dynamic class Horse_Obstacle_01 extends BitmapData {
public function Horse_Obstacle_01(_arg1:int=8, _arg2:int=8){
super(_arg1, _arg2);
}
}
}//package
Section 158
//Horse_Obstacle_02 (Horse_Obstacle_02)
package {
import flash.display.*;
public dynamic class Horse_Obstacle_02 extends BitmapData {
public function Horse_Obstacle_02(_arg1:int=8, _arg2:int=16){
super(_arg1, _arg2);
}
}
}//package
Section 159
//Horse_Obstacle_03 (Horse_Obstacle_03)
package {
import flash.display.*;
public dynamic class Horse_Obstacle_03 extends BitmapData {
public function Horse_Obstacle_03(_arg1:int=8, _arg2:int=24){
super(_arg1, _arg2);
}
}
}//package
Section 160
//HorseState (HorseState)
package {
import org.flixel.*;
public class HorseState extends State {
public function HorseState(){
super();
}
override protected function collisions():void{
_ship.collide(boundsVerticalGroup);
_obstacles.collide(boundsVerticalGroup);
}
override public function update():void{
if (initShip){
shipStartY = _ship.y;
_ship.collide(boundsVerticalGroup);
};
super.update();
}
override public function create():void{
currentMode = Constants.HORSEMODE;
FlxG.playMusic(HorseMusic);
super.create();
stateBeginText = new InitText(currentMode);
add(stateBeginText);
_ship = Horse.ship;
add(_ship.blood);
add(_ship);
_ship.x = 40;
_ship.y = 80;
scoreText.color = 0;
FlxState.bgColor = 4289447935;
}
override protected function setupAssets():void{
assets = new Array();
Layer1 = [Horse_Layer1_01, Horse_Layer1_02];
Layer2 = [Horse_Layer2_01, Horse_Layer2_02, Horse_Layer2_03];
Layer3 = [Horse_Layer3_01, Horse_Layer3_02, Horse_Layer3_03, Horse_Layer3_04];
Layer4 = [Horse_Layer4_01];
assets.push(new AssetLayerRow(Layer1, 1, AssetLayerRow.TOP, AssetLayerRow.ORDERED));
assets.push(new AssetLayerRow(Layer3, 2, AssetLayerRow.BOTTOM, AssetLayerRow.RANDOM));
assets.push(new AssetLayerRow(Layer4, 3, AssetLayerRow.BOTTOM, AssetLayerRow.RANDOM));
add((assets[0] as AssetLayerRow));
var tempAsset:AssetLayerRandom = new AssetLayerRandom(0.8, Layer2);
add(tempAsset);
var i = 1;
while (i < assets.length) {
add((assets[i] as AssetLayerRow));
i++;
};
}
}
}//package
Section 161
//InitText (InitText)
package {
import org.flixel.*;
public class InitText extends FlxGroup {
protected var toStateText:FlxText;
protected var countDownText:FlxText;
protected var stopText:FlxText;
protected var drawText:Boolean;
protected var _countDown:Number;
protected var _ok:Boolean;
protected var toState:String;
public function InitText(_toState:String):void{
super();
toState = _toState;
scrollFactor = new FlxPoint(0, 0);
initChange();
}
public function initChange():void{
_countDown = 5;
_ok = false;
switch (toState){
case Constants.BASICMODE:
toStateText = new FlxText(0, (FlxG.height / 8), 160, Constants.BASICMODE);
break;
case Constants.CROWDMODE:
toStateText = new FlxText(0, (FlxG.height / 8), 160, Constants.CROWDMODE);
break;
case Constants.HORSEMODE:
toStateText = new FlxText(0, (FlxG.height / 5), 120, Constants.HORSEMODE);
break;
case Constants.HAMMERMODE:
toStateText = new FlxText(0, (FlxG.height / 8), 180, Constants.HAMMERMODE);
break;
case Constants.FFMODE:
toStateText = new FlxText(0, (FlxG.height / 5), 220, Constants.FFMODE);
break;
case Constants.GREEDMODE:
toStateText = new FlxText(0, (FlxG.height / 5), 120, Constants.GREEDMODE);
break;
case Constants.LLRMODE:
toStateText = new FlxText(0, (FlxG.height / 5), 220, Constants.LLRMODE);
break;
};
toStateText.size = 32;
toStateText.alignment = "center";
toStateText.antialiasing = true;
add(toStateText, true);
countDownText = new FlxText(0, ((2 * FlxG.height) / 3), FlxG.width);
countDownText.size = 32;
countDownText.alignment = "center";
countDownText.shadow = 0;
add(countDownText, true);
countDownText.visible = false;
if (toState == Constants.HAMMERMODE){
toStateText.color = 4278190080;
countDownText.color = 4278190080;
};
}
public function changeState():void{
var t1m:uint = ((FlxG.width / 2) - (toStateText.width / 2));
if (toStateText.x < t1m){
toStateText.x = (toStateText.x + (FlxG.elapsed * FlxG.width));
if (toStateText.x > t1m){
toStateText.x = t1m;
};
};
if (((!(_ok)) && ((toStateText.x == t1m)))){
_ok = true;
FlxG.flash.start(0xFFFFFF, 0.6);
FlxG.quake.start(0.005, 0.3);
};
_countDown = (_countDown - (FlxG.elapsed * 2));
if (_countDown <= 4){
countDownText.visible = true;
countDownText.text = int(_countDown).toString();
};
if (_countDown < 1){
countDownText.text = "GO";
};
if (_countDown <= 0){
countDownText.destroy();
countDownText.visible = false;
toStateText.destroy();
toStateText.visible = false;
};
}
override public function update():void{
super.update();
changeState();
}
public function get ok():Boolean{
return (_ok);
}
public function get countDown():Number{
return (_countDown);
}
}
}//package
Section 162
//InstructionState (InstructionState)
package {
import org.flixel.*;
public class InstructionState extends FlxState {
protected var playText:FlxText;
protected var lineA:FlxText;
protected var lineB:FlxText;
protected var lineC:FlxText;
protected var lineD:FlxText;
public function InstructionState(){
super();
}
override public function update():void{
if (FlxG.keys.justReleased("UP")){
FlxG.flash.start(4294967295, 0.5);
FlxG.fade.start(4279442459, 1, onFade);
};
}
private function onFade():void{
FlxG.state = new BaseState(true);
}
override public function create():void{
FlxG.stage.focus = this;
lineA = new FlxText(0, (FlxG.height / 4), FlxG.width, "Your controls are UP and DOWN.");
lineC = new FlxText(0, ((2 * FlxG.height) / 4), FlxG.width, "Things may CHANGE UNEXPECTEDLY.");
lineD = new FlxText(0, ((3 * FlxG.height) / 4), FlxG.width, "Be PREPARED. If you're ready, press UP.");
lineA.alignment = "center";
lineC.alignment = "center";
lineC.color = 0xCC0000;
lineD.alignment = "center";
lineD.color = 0xCC00;
add(lineA);
add(lineB);
add(lineC);
add(lineD);
}
}
}//package
Section 163
//LLRState (LLRState)
package {
import org.flixel.*;
public class LLRState extends State {
public function LLRState(){
super();
}
override protected function addScore():void{
}
override public function update():void{
super.update();
}
override public function create():void{
currentMode = Constants.LLRMODE;
super.create();
FlxState.bgColor = 4278190080;
_ship = Horse.ship;
add(_ship.blood);
add(_ship);
shipStartX = 0;
shipStartY = 0;
_ship.x = 0;
_ship.y = 0;
var hitZone:FlxSprite = new FlxSprite(150, 0);
hitZone.createGraphic(32, FlxG.height, 2285789601);
hitZone.scrollFactor = new FlxPoint(0, 0);
add(hitZone);
Horse.changeShipMode(currentMode);
FlxG.playMusic(LLRMusic);
stateBeginText = new InitText(currentMode);
add(stateBeginText);
}
override protected function setupAssets():void{
}
}
}//package
Section 164
//Love_PG_DownArrow (Love_PG_DownArrow)
package {
import flash.display.*;
public dynamic class Love_PG_DownArrow extends BitmapData {
public function Love_PG_DownArrow(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 165
//Love_PG_upArrow (Love_PG_upArrow)
package {
import flash.display.*;
public dynamic class Love_PG_upArrow extends BitmapData {
public function Love_PG_upArrow(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 166
//Love_Ship (Love_Ship)
package {
import flash.display.*;
public dynamic class Love_Ship extends BitmapData {
public function Love_Ship(_arg1:int=600, _arg2:int=157){
super(_arg1, _arg2);
}
}
}//package
Section 167
//MenuState (MenuState)
package {
import org.flixel.*;
public class MenuState extends FlxState {
private var _ok:Boolean;
private var _ok2:Boolean;
private var title:FlxText;
private var _t2:FlxText;
public function MenuState(){
super();
}
override public function update():void{
var t1:FlxText;
var t2:FlxText;
var tm:Number = (FlxG.height / 3);
var t1m:Number = title.y;
if (title.y < tm){
title.y = (title.y + ((FlxG.elapsed * FlxG.height) * 2));
if (title.y > tm){
title.y = tm;
};
};
if (((!(_ok)) && ((title.y == t1m)))){
_ok = true;
FlxG.flash.start(68719476735, 0.5);
t1 = new FlxText(0, (title.y + 40), FlxG.width, "PRESS 'UP' TO PLAY.");
t1.color = 4284769380;
t1.alignment = "center";
add(t1);
t2 = new FlxText(0, (t1.y + 20), FlxG.width, "PRESS 'DOWN' FOR INSTRUCTIONS.");
t2.color = 0x646464;
t2.alignment = "center";
add(t2);
};
if (((((_ok) && (!(_ok2)))) && (FlxG.keys.UP))){
_ok2 = true;
FlxG.flash.start(4294967295, 0.5);
FlxG.fade.start(4279442459, 1, onFade);
} else {
if (((((_ok) && (!(_ok2)))) && (FlxG.keys.DOWN))){
_ok2 = true;
FlxG.state = new InstructionState();
};
};
super.update();
}
private function onFade():void{
FlxG.state = new BaseState(true);
}
override public function create():void{
var i:uint;
var s:FlxSprite;
FlxG.stage.focus = this;
Horse.gameSpeed = 150;
Horse.init = true;
if (FlxG.music){
FlxG.music.stop();
};
FlxState.bgColor = 4281479730;
FlxG.score = 0;
title = new FlxText(0, 0, FlxG.width, "UP DOWN READY");
title.alignment = "center";
title.size = 32;
title.color = 4294967295;
title.antialiasing = true;
add(title);
_ok = false;
_ok2 = false;
var savedScores:FlxSave = new FlxSave();
if (savedScores.bind("Horse")){
if (savedScores.data.scores == null){
savedScores.data.scores = Horse.scores;
} else {
Horse.scores = savedScores.data.scores;
};
if (savedScores.data.names == null){
savedScores.data.names = Horse.names;
} else {
Horse.names = savedScores.data.names;
};
FlxG.log(Horse.scores[0]);
FlxG.log(Horse.scores.length);
FlxG.log((Horse.names[0] as String));
FlxG.log(Horse.names.length);
};
}
}
}//package
Section 168
//Obstacle (Obstacle)
package {
import org.flixel.*;
public class Obstacle extends SpawningElement {
private var greedObstacles:Array;
private var prevAge:Number;
private var canBeKilled:Boolean;// = true
private var _gravityMode:String;
private var _quake:Boolean;// = true
private var _controlMode:String;
private var _killKey:String;
private var horseObstacles:Array;
private var _failKey:String;
private var ffObstacles:Array;
private var llrObstacles:Array;
private var _moveMode:String;
private var layerNum:int;// = 0
public function Obstacle(X:int, Y:int, _gameMode:String, _layerNum:int=0):void{
prevAge = age;
horseObstacles = [Horse_Obstacle_01, Horse_Obstacle_02, Horse_Obstacle_03];
ffObstacles = [FF_L1_1, FF_L1_2, FF_L1_3, FF_L1_4, FF_L1_5, FF_L2_1, FF_L2_2, FF_L2_3, FF_L2_4, FF_L3_1, FF_L3_2, FF_L3_3, FF_L3_4, FF_L4_1, FF_L4_2, FF_L4_3, FF_L4_4, FF_L5_1, FF_L5_2, FF_L5_3, FF_L5_4];
greedObstacles = [Greed_Obstacle_01, Greed_Obstacle_02, Greed_Obstacle_03, Greed_Obstacle_04, Greed_Obstacle_05, Greed_Obstacle_06, Greed_Obstacle_07, Greed_Obstacle_08, Greed_Obstacle_09, Greed_Obstacle_Special_01, Greed_Obstacle_Special_02];
super(X, Y);
layerNum = _layerNum;
setModes(_gameMode);
setControl();
}
public function set controlMode(c:String):void{
_controlMode = c;
}
override public function update():void{
if ((((this._gravityMode == Constants.HORIZONTAL)) && ((this.startMoveTimer <= 0)))){
play("HammerAnim");
checkHammerScore();
};
switch (_controlMode){
case Constants.NONE:
break;
case Constants.VERTICAL:
moveVertical();
break;
case Constants.LLR:
checkLLRScore();
break;
};
prevAge = age;
super.update();
}
public function get gravityMode():String{
return (_gravityMode);
}
public function get moveMode():String{
return (_moveMode);
}
public function setControl():void{
switch (_controlMode){
case Constants.NONE:
velocity.y = 0;
break;
case Constants.VERTICAL:
maxVelocity.y = 35;
drag.y = (maxVelocity.y * 5);
velocity.y = 0;
break;
};
switch (_moveMode){
case Constants.NORMAL:
switch (layerNum){
case 1:
velocity.x = (-(Horse.gameSpeed) + 50);
break;
case 2:
velocity.x = (-(Horse.gameSpeed) + 40);
break;
case 3:
velocity.x = (-(Horse.gameSpeed) + 30);
break;
case 4:
velocity.x = (-(Horse.gameSpeed) + 20);
break;
case 5:
velocity.x = (-(Horse.gameSpeed) + 10);
break;
default:
velocity.x = -(Horse.gameSpeed);
break;
};
break;
};
switch (_gravityMode){
case Constants.ON:
maxVelocity.y = 400;
acceleration.y = 400;
break;
case Constants.OFF:
velocity.y = 0;
break;
case Constants.HORIZONTAL:
velocity.x = -400;
break;
};
}
private function checkHammerScore():void{
if ((((this.age < 0.5)) && ((prevAge >= 0.5)))){
State.gainPoints(x, y, 200);
};
}
private function checkLLRScore():void{
if ((((((this.x <= 190)) && ((this.x >= (140 - this.width))))) && (canBeKilled))){
if (FlxG.keys.justPressed(_killKey)){
this.kill();
State.gainPoints(x, y, 50);
canBeKilled = false;
} else {
if (FlxG.keys.justPressed(_failKey)){
State.losePoints(x, y);
canBeKilled = false;
};
};
};
}
private function moveVertical():void{
if (FlxG.keys.UP){
acceleration.y = (acceleration.y - drag.y);
};
if (FlxG.keys.DOWN){
acceleration.y = (acceleration.y + drag.y);
};
if (((FlxG.keys.justReleased("UP")) || (FlxG.keys.justReleased("DOWN")))){
acceleration.y = 0;
};
}
public function get controlMode():String{
return (_controlMode);
}
public function set gravityMode(g:String):void{
_gravityMode = g;
}
public function set moveMode(m:String):void{
_moveMode = m;
}
private function setModes(newMode:String):void{
switch (newMode){
case Constants.BASICMODE:
gravityMode = Constants.OFF;
moveMode = Constants.NORMAL;
controlMode = Constants.NONE;
createGraphic(8, int(((Math.random() * 32) + 8)), 4294914610);
age = 0;
startMoveTimer = 0;
break;
case Constants.CROWDMODE:
gravityMode = Constants.OFF;
moveMode = Constants.NORMAL;
controlMode = Constants.VERTICAL;
createGraphic(8, int(((Math.random() * 32) + 8)), 4278242304);
age = 0;
startMoveTimer = 0;
break;
case Constants.HORSEMODE:
gravityMode = Constants.ON;
moveMode = Constants.NORMAL;
controlMode = Constants.NONE;
loadGraphic(horseObstacles[Horse.randRange(0, (horseObstacles.length - 1))]);
this.color = 2009907200;
age = 0;
startMoveTimer = 0;
break;
case Constants.HAMMERMODE:
gravityMode = Constants.HORIZONTAL;
moveMode = Constants.NONE;
controlMode = Constants.NONE;
loadGraphic(Hammer_Obstacle_01, true, false, 117, 34);
addAnimation("HammerStatic", [2]);
addAnimation("HammerAnim", [1, 1, 0], 5, false);
this.play("HammerStatic");
this.x = (this.x - this.width);
age = 2.7;
startMoveTimer = 1;
break;
case Constants.FFMODE:
this.solid = false;
gravityMode = Constants.OFF;
moveMode = Constants.NORMAL;
controlMode = Constants.NONE;
switch (layerNum){
case 1:
loadGraphic(ffObstacles[Horse.randRange(0, 4)]);
this.alpha = 1;
break;
case 2:
loadGraphic(ffObstacles[Horse.randRange(6, 8)]);
this.alpha = 0.5;
break;
case 3:
loadGraphic(ffObstacles[Horse.randRange(9, 12)]);
this.alpha = 0.5;
break;
case 4:
loadGraphic(ffObstacles[Horse.randRange(13, 16)]);
this.alpha = 0.5;
break;
case 5:
loadGraphic(ffObstacles[Horse.randRange(17, 20)]);
this.alpha = 0.5;
break;
};
age = 10;
startMoveTimer = 0;
break;
case Constants.GREEDMODE:
gravityMode = Constants.OFF;
moveMode = Constants.NORMAL;
controlMode = Constants.NONE;
this.loadGraphic((greedObstacles[Horse.randRange(0, (greedObstacles.length - 1))] as Class));
age = 0;
startMoveTimer = 0;
break;
case Constants.LLRMODE:
gravityMode = Constants.OFF;
moveMode = Constants.NORMAL;
controlMode = Constants.LLR;
age = 0;
startMoveTimer = 0;
if (Math.random() > 0.5){
_killKey = "DOWN";
_failKey = "UP";
loadGraphic(Love_PG_DownArrow);
} else {
_killKey = "UP";
_failKey = "DOWN";
loadGraphic(Love_PG_upArrow);
};
break;
};
}
}
}//package
Section 169
//ObstacleSet (ObstacleSet)
package {
import org.flixel.*;
public class ObstacleSet extends SpawningElementSet {
private var layers:Array;
private var difficultyMode:String;
private var maxObstacles:Number;
private var difficultyTimer:Number;// = 1
private var _bonusZones:FlxGroup;
private var _collidable:FlxGroup;
private var gravityMode:String;
private var moveMode:String;
private var numObstacles:Number;
private var controlMode:String;
private var gameMode:String;
private var spawnMode:String;
public function ObstacleSet(_gameMode:String):void{
var tempLayer:FlxGroup;
layers = new Array();
super();
_collidable = new FlxGroup();
_bonusZones = new FlxGroup();
gameMode = _gameMode;
setModes(_gameMode);
scrollFactor = new FlxPoint(0, 0);
var i = 4;
while (i >= 0) {
tempLayer = new FlxGroup();
layers[i] = tempLayer;
add(tempLayer, true);
i--;
};
}
override public function update():void{
super.update();
}
public function get collidable():FlxGroup{
return (_collidable);
}
private function updateDifficulty():void{
switch (difficultyMode){
case Constants.INCREASING:
if (difficultyTimer > 0.5){
difficultyTimer = (difficultyTimer - (FlxG.elapsed / 15));
};
break;
default:
break;
};
}
public function setModes(_gameMode:String):void{
switch (_gameMode){
case Constants.BASICMODE:
spawnMode = Constants.RANDOM;
difficultyMode = Constants.NONE;
spawnDelay = 0.7;
spawnTimer = spawnDelay;
spawnMod = true;
maxObstacles = 2;
break;
case Constants.CROWDMODE:
spawnMode = Constants.RANDOM;
difficultyMode = Constants.NONE;
spawnDelay = 1;
spawnTimer = spawnDelay;
spawnMod = true;
maxObstacles = 2;
break;
case Constants.HORSEMODE:
spawnMode = Constants.RANDOM;
difficultyMode = Constants.NONE;
spawnDelay = 1;
spawnTimer = spawnDelay;
spawnMod = true;
maxObstacles = 1;
break;
case Constants.HAMMERMODE:
spawnMode = Constants.TARGETED;
difficultyMode = Constants.NONE;
spawnDelay = 1.5;
spawnTimer = spawnDelay;
spawnMod = true;
difficultyTimer = 1;
maxObstacles = 1;
break;
case Constants.FFMODE:
spawnMode = Constants.RANDOM;
difficultyMode = Constants.INCREASING;
spawnDelay = 0.37;
spawnTimer = spawnDelay;
spawnMod = true;
difficultyTimer = 1.2;
maxObstacles = 2;
break;
case Constants.GREEDMODE:
spawnMode = Constants.RANDOM;
difficultyMode = Constants.INCREASING;
spawnDelay = 0.6;
spawnTimer = spawnDelay;
spawnMod = true;
difficultyTimer = 1.5;
maxObstacles = 1;
break;
case Constants.LLRMODE:
spawnMode = Constants.TARGETED;
difficultyMode = Constants.NONE;
spawnDelay = 0.4;
spawnTimer = spawnDelay;
spawnMod = false;
difficultyTimer = 1;
maxObstacles = 1;
break;
};
}
public function get bonusZones():FlxGroup{
return (_bonusZones);
}
override protected function updateSpawning():void{
spawnTimer = (spawnTimer - FlxG.elapsed);
if (spawnTimer <= 0){
spawn();
spawnTimer = (spawnDelay * difficultyTimer);
};
}
override protected function spawn():void{
var tempObst:Obstacle;
var tempZone:Obstacle;
var i:int;
var tempLayer:FlxGroup;
switch (spawnMode){
case Constants.RANDOM:
if (gameMode != Constants.FFMODE){
numObstacles = Horse.randRange(1, maxObstacles);
while (numObstacles > 0) {
tempObst = new Obstacle(FlxG.width, Horse.randRange(10, (145 - height)), gameMode);
add(tempObst, true);
_collidable.add(tempObst);
numObstacles--;
};
} else {
i = 5;
while (i > 0) {
while (numObstacles > 0) {
tempObst = new Obstacle((FlxG.width + Horse.randRange(0, 40)), Horse.randRange(0, FlxG.height), gameMode, i);
tempLayer = (layers[(i - 1)] as FlxGroup);
tempLayer.add(tempObst, true);
numObstacles--;
};
numObstacles = maxObstacles;
i--;
};
};
break;
case Constants.TARGETED:
numObstacles = Horse.randRange(1, maxObstacles);
while (numObstacles > 0) {
if (gameMode == Constants.LLRMODE){
tempObst = new Obstacle(FlxG.width, (FlxG.height / 2), gameMode);
} else {
tempObst = new Obstacle(FlxG.width, Horse.getShipY(), gameMode);
};
add(tempObst, true);
_collidable.add(tempObst);
numObstacles--;
};
break;
case Constants.TOP:
numObstacles = Horse.randRange(1, maxObstacles);
while (numObstacles > 0) {
tempObst = new Obstacle(Horse.randRange((Horse.getShipX() - 128), (Horse.getShipX() + 128)), 0, gameMode);
add(tempObst, true);
_collidable.add(tempObst);
numObstacles--;
};
break;
};
}
public function setControl():void{
var j:int;
while (j < members.length) {
members[j].setControl();
j++;
};
}
}
}//package
Section 170
//Points (Points)
package {
import org.flixel.*;
public class Points extends FlxText {
protected var liveTimer:Number;
public function Points(X:Number, Y:Number, W:uint, s:String, c:uint, v:Number):void{
super(X, Y, W, s);
liveTimer = 1;
velocity.y = v;
color = c;
scrollFactor = new FlxPoint(0, 0);
}
override public function update():void{
liveTimer = (liveTimer - FlxG.elapsed);
super.update();
if (liveTimer < 0){
this.kill();
};
}
}
}//package
Section 171
//Preloader (Preloader)
package {
import org.flixel.*;
public class Preloader extends FlxPreloader {
public function Preloader():void{
className = "Horse";
super();
}
}
}//package
Section 172
//ScrollingElement (ScrollingElement)
package {
import org.flixel.*;
public class ScrollingElement extends FlxSprite {
private var _rotated:Boolean;
private var _moveMode:int;
private var endPosX:Number;
public static const bottomOut:int = 4;
public static const leftOut:int = 6;
public static const leftIn:int = 5;
public static const bottomIn:int = 2;
public static const none:int = 0;
public static const topOut:int = 3;
public static const topIn:int = 1;
public function ScrollingElement(X:Number=0, Y:Number=0, SimpleGraphic:Class=null, rotate:Boolean=false, animate:Boolean=false){
var theOffset:FlxPoint;
endPosX = (FlxG.width / 2);
super(X, Y);
this.solid = false;
_rotated = rotate;
this.loadGraphic(SimpleGraphic);
var tempWidth:Number = this.width;
var tempHeight:Number = this.height;
if (rotate){
this.loadRotatedGraphic(SimpleGraphic, 2, -1, true);
if (tempHeight > tempWidth){
theOffset = new FlxPoint((Math.floor((width - tempWidth)) / 2), 0);
} else {
if (tempWidth > tempHeight){
theOffset = new FlxPoint(0, ((Math.floor((height - tempHeight)) / 2) + 1));
} else {
theOffset = new FlxPoint(0, 0);
};
};
this.angle = 180;
this.width = tempWidth;
this.height = tempHeight;
this.offset = theOffset;
this.visible = true;
};
_moveMode = 0;
setVel(_moveMode);
}
private function checkPosOutFromLeft():Boolean{
if (this.x < -(this.width)){
return (true);
};
return (false);
}
private function checkPosInFromTop():Boolean{
if (this.y >= 0){
this.y = 0;
return (true);
};
return (false);
}
private function checkOffScreen():void{
if (this.scrollFactor.x > 0){
if (((((!(onScreen())) && (((x + width) < (Horse.gamePos * scrollFactor.x))))) && ((y >= 0)))){
this.x = (this.x + endPosX);
};
};
}
public function set EndPosX(_newPos:Number):void{
endPosX = _newPos;
}
private function moveInFromLeft():void{
if (checkPosInFromLeft()){
setVel(none);
};
}
override public function update():void{
super.update();
checkOffScreen();
switch (_moveMode){
case topIn:
moveInFromTop();
break;
case bottomOut:
moveOutFromBottom();
break;
case bottomIn:
moveInFromBottom();
break;
case topOut:
moveOutFromTop();
break;
case leftIn:
moveInFromLeft();
trace("LEFT IN");
break;
case leftOut:
moveOutFromLeft();
trace("LEFT IN");
break;
};
}
private function moveInFromBottom():void{
if (checkPosInFromBottom()){
setVel(none);
};
}
private function checkPosInFromBottom():Boolean{
if (this.y <= (FlxG.height - this.height)){
this.y = (FlxG.height - this.height);
return (true);
};
return (false);
}
private function moveOutFromTop():void{
if (checkPosOutFromTop()){
setVel(none);
};
}
private function checkPosOutFromTop():Boolean{
if (this.y <= -(FlxG.height)){
return (true);
};
return (false);
}
private function checkPosInFromLeft():Boolean{
if (this.x >= 0){
this.x = 0;
return (true);
};
return (false);
}
private function moveOutFromBottom():void{
if (checkPosOutFromBottom()){
setVel(none);
};
}
private function moveInFromTop():void{
if (checkPosInFromTop()){
setVel(none);
};
}
private function checkPosOutFromBottom():Boolean{
if (this.y >= FlxG.height){
return (true);
};
return (false);
}
public function setVel(m:int):void{
_moveMode = m;
switch (_moveMode){
case topIn:
this.velocity.y = (this.height * 2);
this.maxVelocity.y = (this.height * 2);
break;
case bottomIn:
this.velocity.y = (-(this.height) * 2);
this.maxVelocity.y = (this.height * 2);
break;
case topOut:
this.velocity.y = (-(this.height) * 2);
this.maxVelocity.y = (this.height * 2);
break;
case bottomOut:
this.velocity.y = (this.height * 2);
this.maxVelocity.y = (this.height * 2);
break;
case leftIn:
this.velocity.x = (this.width * 2);
this.maxVelocity.x = (this.width * 2);
break;
case leftOut:
this.velocity.x = (-(this.width) * 2);
this.maxVelocity.x = (this.width * 2);
break;
case none:
this.maxVelocity = new FlxPoint(0, 0);
break;
};
}
private function moveOutFromLeft():void{
if (checkPosOutFromLeft()){
setVel(none);
};
}
}
}//package
Section 173
//Ship (Ship)
package {
import org.flixel.*;
public class Ship extends FlxSprite {
private var ImgHorse:Class;
protected var _blood:FlxEmitter;
protected var jumpMod:Number;
protected var jumpPower:Number;
protected var gravityMode:String;
protected var moveMode:String;
protected var ImgBlood:Class;
public var invincible:Boolean;
public var _ready:Boolean;
protected var flickerInit:Boolean;
protected var newPos:FlxPoint;
protected var waitForExplode:Number;
protected var startJump:Boolean;// = false
public var gameMode:String;// = ""
protected var respawnPoint:FlxPoint;
protected var _restart:Number;
protected var invTimer:Number;
private var ImgShip:Class;
public function Ship(X:Number, Y:Number):void{
respawnPoint = new FlxPoint(40, 80);
ImgShip = Ship_ImgShip;
ImgHorse = Ship_ImgHorse;
ImgBlood = Ship_ImgBlood;
super(X, Y);
moveMode = Constants.VERTICAL;
gravityMode = Constants.OFF;
scrollFactor = new FlxPoint(0, 0);
loadGraphic(ImgShip, true, false, 16, 12);
addAnimation("light", [1, 2, 3], 24);
_blood = new FlxEmitter();
_blood.delay = 1.5;
_blood.setXSpeed(-150, 150);
_blood.setYSpeed(-200, 0);
_blood.setRotation(-720, -720);
_blood.scrollFactor = new FlxPoint(0, 0);
_restart = 0;
invincible = true;
invTimer = 2;
health = 3;
waitForExplode = 1.5;
flickerInit = true;
setControl();
play("light");
}
private function playHammerAnims():void{
if (gravityMode == Constants.HORIZONTAL){
if (velocity.y != 0){
play("HammerMove");
} else {
play("HammerIdle");
};
};
}
private function moveVertical():void{
acceleration.y = 0;
if (FlxG.keys.UP){
acceleration.y = (acceleration.y - drag.y);
};
if (FlxG.keys.DOWN){
acceleration.y = (acceleration.y + drag.y);
};
}
private function setControl():void{
switch (gravityMode){
case Constants.ON:
acceleration.x = 0;
maxVelocity.y = 400;
acceleration.y = 800;
break;
case Constants.OFF:
acceleration.y = 0;
acceleration.x = 0;
break;
case Constants.HORIZONTAL:
maxVelocity.x = 800;
acceleration.y = 0;
acceleration.x = -400;
break;
};
switch (moveMode){
case Constants.VERTICAL:
maxVelocity.y = 100;
drag.y = (maxVelocity.y * 5);
break;
case Constants.HORIZONTAL:
maxVelocity.x = 100;
drag.x = (maxVelocity.x * 4);
break;
case Constants.STATIC:
break;
case Constants.JUMP:
jumpPower = 0;
jumpMod = 50;
break;
case Constants.UP:
maxVelocity.y = 200;
acceleration.y = 10;
drag.y = (maxVelocity.y * 0.9);
break;
};
}
private function toHammer():void{
gravityMode = Constants.HORIZONTAL;
moveMode = Constants.VERTICAL;
color = 4294967295;
loadGraphic(Hammer_Ship, true, false, 32, 32);
addAnimation("HammerIdle", [1, 3], 4);
addAnimation("HammerMove", [0, 1, 2, 3], 8);
play("HammerIdle");
respawnPoint = new FlxPoint(40, 80);
setControl();
}
public function get ready():Boolean{
return (_ready);
}
public function checkForDead():void{
_restart = (_restart + FlxG.elapsed);
waitForExplode = (waitForExplode - FlxG.elapsed);
if ((((health == 0)) && ((waitForExplode <= 0)))){
(FlxG.state as State).gameOver();
} else {
if ((((_restart > 3)) && ((health > 0)))){
respawn();
};
};
}
private function moveJump():void{
if (FlxG.keys.justReleased("UP")){
jumpPower = 0;
play("run");
};
if (onFloor){
if (FlxG.keys.UP){
startJump = true;
};
};
if (FlxG.keys.UP){
if ((((jumpPower < 0.3)) && ((startJump == true)))){
velocity.y = ((-(acceleration.y) * jumpPower) - jumpMod);
jumpPower = (jumpPower + 0.07);
jumpMod = (jumpMod / 10);
} else {
startJump = false;
jumpPower = 0;
jumpMod = 20;
};
} else {
jumpPower = 0;
jumpMod = 20;
startJump = false;
};
}
private function checkForInvincible():void{
if (invincible){
invTimer = (invTimer - FlxG.elapsed);
};
if (invTimer < 0){
invincible = false;
};
}
private function toHorse():void{
gravityMode = Constants.ON;
moveMode = Constants.JUMP;
color = 4294967295;
loadGraphic(ImgHorse, true, false, 16, 13);
addAnimation("run", [1, 4, 5], 10);
play("run");
respawnPoint = new FlxPoint(40, 80);
setControl();
}
private function toGreed():void{
createGraphic(8, 8);
gravityMode = Constants.ON;
moveMode = Constants.UP;
color = 4294967295;
loadGraphic(Greed_Ship, true, false, 20, 7);
addAnimation("GreedFly", [0, 1, 2, 3], 6);
play("GreedFly");
respawnPoint = new FlxPoint(40, 80);
setControl();
}
override public function update():void{
switch (moveMode){
case Constants.STATIC:
break;
case Constants.HORIZONTAL:
moveHorizontal();
break;
case Constants.VERTICAL:
moveVertical();
break;
case Constants.JUMP:
moveJump();
break;
case Constants.UP:
moveUp();
break;
};
checkForInvincible();
if (dead){
checkForDead();
} else {
if (((invincible) && (flickerInit))){
invincibility();
return;
};
};
playHammerAnims();
super.update();
}
private function respawn():void{
reset(respawnPoint.x, respawnPoint.y);
flickerInit = true;
visible = true;
invincible = true;
invTimer = 2;
_restart = 0;
waitForExplode = 1.5;
}
private function invincibility():void{
flicker(2);
flickerInit = false;
}
private function moveUp():void{
acceleration.y = 85;
if (FlxG.keys.UP){
acceleration.y = (acceleration.y - drag.y);
};
}
private function moveHorizontal():void{
acceleration.x = 0;
if (FlxG.keys.UP){
acceleration.x = (acceleration.x - drag.x);
};
if (FlxG.keys.DOWN){
acceleration.x = (acceleration.x + drag.x);
};
}
override public function kill():void{
if (dead){
return;
};
if (invincible){
return;
};
super.kill();
flicker(-1);
exists = true;
visible = false;
FlxG.quake.start(0.005, 0.35);
FlxG.flash.start(4291572531, 0.35);
_blood.createSprites(ImgBlood, 100, 10, true, 0.5);
_blood.at(this);
_blood.start(true, 0, 50);
FlxG.play(Ship_Hit);
FlxG.score = (FlxG.score / 2);
hurt(1);
}
private function toBasics():void{
gravityMode = Constants.OFF;
moveMode = Constants.VERTICAL;
loadGraphic(ImgShip, true, false, 16, 12);
respawnPoint = new FlxPoint(40, 80);
color = 4294967295;
addAnimation("light", [1, 2, 3], 24);
play("light");
setControl();
maxVelocity.x = 0;
}
private function toCrowd():void{
gravityMode = Constants.OFF;
moveMode = Constants.STATIC;
loadGraphic(ImgShip, true, false, 16, 12);
color = 4291559424;
addAnimation("light", [1, 2, 3], 24);
play("light");
respawnPoint = new FlxPoint(40, 80);
setControl();
}
public function changeMode(newMode:String):void{
gameMode = newMode;
switch (newMode){
case Constants.BASICMODE:
toBasics();
break;
case Constants.CROWDMODE:
toCrowd();
break;
case Constants.HORSEMODE:
toHorse();
break;
case Constants.HAMMERMODE:
toHammer();
break;
case Constants.FFMODE:
toFF();
break;
case Constants.GREEDMODE:
toGreed();
break;
case Constants.LLRMODE:
toLLR();
break;
};
}
private function toLLR():void{
gravityMode = Constants.OFF;
moveMode = Constants.STATIC;
respawnPoint = new FlxPoint(0, 0);
loadGraphic(Love_Ship, true, false, 120, 157);
addAnimation("LoveIdle", [0, 1, 2, 3, 4], 10);
play("LoveIdle");
color = 4294967295;
setControl();
}
public function get blood():FlxEmitter{
return (_blood);
}
private function toFF():void{
createGraphic(8, 8);
gravityMode = Constants.OFF;
moveMode = Constants.VERTICAL;
color = 4294967295;
respawnPoint = new FlxPoint(40, 80);
setControl();
}
}
}//package
Section 174
//Ship_Hit (Ship_Hit)
package {
import flash.media.*;
public dynamic class Ship_Hit extends Sound {
}
}//package
Section 175
//Ship_ImgBlood (Ship_ImgBlood)
package {
import mx.core.*;
public class Ship_ImgBlood extends BitmapAsset {
}
}//package
Section 176
//Ship_ImgHorse (Ship_ImgHorse)
package {
import mx.core.*;
public class Ship_ImgHorse extends BitmapAsset {
}
}//package
Section 177
//Ship_ImgShip (Ship_ImgShip)
package {
import mx.core.*;
public class Ship_ImgShip extends BitmapAsset {
}
}//package
Section 178
//SpawningElement (SpawningElement)
package {
import org.flixel.*;
public class SpawningElement extends FlxSprite {
protected var startMoveTimer:Number;// = 0
protected var age:Number;// = 0
public function SpawningElement(X:Number=0, Y:Number=0, SimpleGraphic:Class=null){
super(X, Y, SimpleGraphic);
this.moves = false;
}
override public function update():void{
super.update();
if (startMoveTimer > 0){
startMoveTimer = (startMoveTimer - FlxG.elapsed);
} else {
this.moves = true;
};
if (age != 0){
age = (age - FlxG.elapsed);
};
if (!this.onScreen()){
if ((((this.x < (Horse.gamePos * scrollFactor.x))) || ((this.y > FlxG.height)))){
this.destroy();
};
};
if ((((age < 0)) && (!(dead)))){
this.kill();
} else {
if (((((!((age == 0))) && ((age <= 0.5)))) && (!(dead)))){
this.flicker(0.5);
this.solid = false;
};
};
}
}
}//package
Section 179
//SpawningElementSet (SpawningElementSet)
package {
import org.flixel.*;
public class SpawningElementSet extends FlxGroup {
protected var startTimer:Number;// = 2
protected var spawnMod:Boolean;// = true
protected var spawnDelay:Number;// = 1
protected var spawnTimer:Number;// = 1
protected var _stopped:Boolean;// = false
public function SpawningElementSet():void{
super();
}
override public function update():void{
if (!_stopped){
if (startTimer > 0){
startTimer = (startTimer - FlxG.elapsed);
} else {
updateSpawning();
};
};
super.update();
}
public function get stopped():Boolean{
return (_stopped);
}
protected function updateSpawning():void{
spawnTimer = (spawnTimer - FlxG.elapsed);
if (spawnTimer <= 0){
spawn();
if (spawnMod){
spawnTimer = (spawnDelay * Horse.randRange(0.5, 1.5));
} else {
spawnTimer = spawnDelay;
};
};
}
public function set stopped(s:Boolean):void{
_stopped = s;
}
protected function spawn():void{
}
}
}//package
Section 180
//State (State)
package {
import org.flixel.*;
public class State extends FlxState {
protected var BasicsMusic:Class;
protected var assets:Array;
protected var assetImages:Array;
protected var stateTimerComplete:Boolean;
protected var shipStartX:Number;// = 40
protected var shipStartY:Number;// = 80
public var _ship:Ship;
protected var camControl:FlxSprite;
protected var lives:Number;
protected var Layer1:Array;
protected var Layer2:Array;
protected var Layer3:Array;
protected var Layer4:Array;
protected var DrumTrack:Class;
public var stateTimer:Number;
protected var assetTimer:Number;
protected var currentMode:String;
protected var Layer4Bottom:Array;
protected var _obstacles:ObstacleSet;
protected var boundsHorizontalGroup:FlxGroup;
protected var verticalBounds2:FlxSprite;
protected var verticalBounds:FlxSprite;
protected var GreedMusic:Class;
protected var livesText:FlxText;
protected var stateEndText:ChangeText;
protected var horizontalBounds2:FlxSprite;
protected var HammerMusic:Class;
protected var stateBeginText:InitText;
protected var initShip:Boolean;// = true
protected var transIn:Boolean;// = true
protected var scoreText:FlxText;
protected var HorseMusic:Class;
protected var LLRMusic:Class;
protected var boundsVerticalGroup:FlxGroup;
public var horizontalBounds:FlxSprite;
public static var This:State;
public function State(){
LLRMusic = State_LLRMusic;
BasicsMusic = State_BasicsMusic;
GreedMusic = State_GreedMusic;
HammerMusic = State_HammerMusic;
HorseMusic = State_HorseMusic;
DrumTrack = State_DrumTrack;
assets = new Array();
super();
}
protected function collisions():void{
if (((_ship.dead) || (_ship.invincible))){
_ship.collide(boundsVerticalGroup);
};
}
protected function assetsIn():void{
assetTimer = (assetTimer - (FlxG.elapsed * 2));
if (assetTimer < 1){
assetsSetIn(3);
transIn = false;
} else {
if (assetTimer < 2){
assetsSetIn(2);
} else {
if (assetTimer < 3){
assetsSetIn(1);
} else {
if (assetTimer < 4){
assetsSetIn(0);
};
};
};
};
}
protected function followShip():void{
FlxG.follow(_ship, 1);
}
protected function setupBoundaries():void{
boundsVerticalGroup = new FlxGroup();
boundsVerticalGroup.scrollFactor = new FlxPoint(0, 0);
boundsHorizontalGroup = new FlxGroup();
boundsHorizontalGroup.scrollFactor = new FlxPoint(0, 0);
verticalBounds = new FlxSprite(0, 0);
verticalBounds.createGraphic(FlxG.width, 8);
verticalBounds.fixed = true;
verticalBounds.visible = false;
boundsVerticalGroup.add(verticalBounds, true);
verticalBounds2 = new FlxSprite(0, (FlxG.height - 8));
verticalBounds2.createGraphic(FlxG.width, 8);
verticalBounds2.fixed = true;
verticalBounds2.visible = false;
verticalBounds2.scrollFactor = new FlxPoint(0, 0);
boundsVerticalGroup.add(verticalBounds2, true);
horizontalBounds = new FlxSprite(0, 0);
horizontalBounds.createGraphic(16, FlxG.height);
horizontalBounds.fixed = true;
horizontalBounds.visible = false;
boundsHorizontalGroup.add(horizontalBounds, true);
horizontalBounds2 = new FlxSprite((FlxG.width - 8), 0);
horizontalBounds2.createGraphic(16, FlxG.height);
horizontalBounds2.fixed = true;
horizontalBounds2.visible = false;
boundsHorizontalGroup.add(horizontalBounds2, true);
}
protected function bonus(Object1:FlxObject, Object2:FlxObject):void{
var bonusText:Points;
if (Object1.dead == false){
bonusText = new Points(Object1.x, Object1.y, 100, "+100!", 4294967295, -80);
add(bonusText);
FlxG.score = (FlxG.score + 100);
Object2.kill();
};
}
protected function runStateChange():void{
stateEndText.onRunStateChange();
}
protected function overlaps():void{
}
protected function killShip(Object1:FlxObject, Object2:FlxObject):void{
var loseScore:Points = new Points(Object1.x, Object1.y, 120, ("-" + Math.floor((FlxG.score / 2))), 0xCC0000, 40);
add(loseScore);
var temp1:Ship = (Object1 as Ship);
var temp2:Obstacle = (Object2 as Obstacle);
temp1.kill();
temp2.kill();
}
protected function obstacleOverlaps():void{
if (((!(_ship.dead)) && (!(_ship.invincible)))){
FlxU.overlap(_ship, _obstacles.collidable, killShip);
};
}
protected function followCamControl():void{
FlxG.follow(camControl, 0.001);
FlxG.followAdjust(1, 0);
FlxG.followBounds(0, 0, (camControl.x + FlxG.width), 0);
}
private function godKey():void{
if (FlxG.keys.justReleased("ONE")){
FlxG.state = new BaseState();
} else {
if (FlxG.keys.justReleased("TWO")){
FlxG.state = new CrowdState();
} else {
if (FlxG.keys.justReleased("THREE")){
FlxG.state = new HorseState();
} else {
if (FlxG.keys.justReleased("FOUR")){
FlxG.state = new HammerState();
} else {
if (FlxG.keys.justReleased("FIVE")){
FlxG.state = new GreedState();
} else {
if (FlxG.keys.justReleased("SIX")){
FlxG.state = new LLRState();
} else {
if (FlxG.keys.justReleased("SEVEN")){
FlxG.state = new FFState();
};
};
};
};
};
};
};
}
override public function update():void{
var tempPoints:Points;
if (initShip){
_ship.collide(boundsHorizontalGroup);
_ship.collide(boundsVerticalGroup);
};
if (stateBeginText.countDown <= 0){
initShip = false;
collisions();
overlaps();
obstacleOverlaps();
};
followCamControl();
if (((transIn) && (stateBeginText.ok))){
assetsIn();
};
stateTimer = (stateTimer - FlxG.elapsed);
addScore();
if (stateTimer <= 0){
stateTimerComplete = true;
};
if (stateTimerComplete){
runStateChange();
if (_obstacles.stopped == false){
tempPoints = new Points(((FlxG.width / 2) - 30), (FlxG.height / 2), 100, "+300", 4294967295, -40);
FlxG.score = (FlxG.score + 300);
tempPoints.size = 16;
add(tempPoints);
};
_obstacles.stopped = true;
assetsOut();
};
Horse.gamePos = camControl.x;
updateScore();
updateLives();
super.update();
}
protected function assetsOut():void{
assetTimer = (assetTimer - (FlxG.elapsed * 2));
if (assetTimer < 1){
assetsSetOut(3);
transIn = false;
assetTimer = 3;
} else {
if (assetTimer < 2){
assetsSetOut(2);
} else {
if (assetTimer < 3){
assetsSetOut(1);
} else {
if (assetTimer < 4){
assetsSetOut(0);
};
};
};
};
}
private function updateLives():void{
livesText.text = ("Lives: " + _ship.health.toString());
}
protected function nextState():void{
var newState:int = Math.floor((Math.random() * 7));
switch (newState){
case 0:
if (isNewMode(Constants.CROWDMODE)){
stateEndText = new ChangeText(Constants.CROWDMODE);
} else {
nextState();
};
break;
case 1:
if (isNewMode(Constants.HORSEMODE)){
stateEndText = new ChangeText(Constants.HORSEMODE);
} else {
nextState();
};
break;
case 2:
if (isNewMode(Constants.HAMMERMODE)){
stateEndText = new ChangeText(Constants.HAMMERMODE);
} else {
nextState();
};
break;
case 3:
if (isNewMode(Constants.GREEDMODE)){
stateEndText = new ChangeText(Constants.GREEDMODE);
} else {
nextState();
};
break;
case 4:
if (isNewMode(Constants.LLRMODE)){
stateEndText = new ChangeText(Constants.LLRMODE);
} else {
nextState();
};
break;
case 5:
if (isNewMode(Constants.FFMODE)){
stateEndText = new ChangeText(Constants.FFMODE);
} else {
nextState();
};
break;
case 6:
if (isNewMode(Constants.BASICMODE)){
stateEndText = new ChangeText(Constants.BASICMODE);
} else {
nextState();
};
break;
};
}
protected function isNewMode(newMode:String):Boolean{
var i:int;
while (i < Horse.modeTracker.length) {
if (Horse.modeTracker[i] == newMode){
return (false);
};
i++;
};
return (true);
}
private function updateScore():void{
scoreText.text = ("Score: " + FlxG.score.toString());
}
protected function assetsSetIn(num:int):void{
var tempAsset:AssetLayerRow;
var i:int;
if (assets != null){
i = 0;
while (i < assets.length) {
tempAsset = assets[i];
if (tempAsset.layerNumber == num){
tempAsset.moveIn();
};
i++;
};
};
}
protected function setupAssets():void{
Layer1 = [Basics_Layer1_01, Basics_Layer1_02];
Layer2 = [Basics_Layer2_01, Basics_Layer2_02, Basics_Layer2_03];
Layer3 = [Basics_Layer3_01, Basics_Layer3_02, Basics_Layer3_03, Basics_Layer3_05, Basics_Layer3_06, Basics_Layer3_07, Basics_Layer3_08, Basics_Layer3_09, Basics_Layer3_10];
Layer4 = [Basics_Layer4_01];
assets = new Array();
assets.push(new AssetLayerRow(Layer1, 1, AssetLayerRow.TOP, AssetLayerRow.ORDERED));
assets.push(new AssetLayerRow(Layer3, 2, AssetLayerRow.BOTTOM, AssetLayerRow.RANDOM));
assets.push(new AssetLayerRow(Layer3, 2, AssetLayerRow.TOP, AssetLayerRow.RANDOM, AssetLayerRow.HORIZONTAL, true));
assets.push(new AssetLayerRow(Layer4, 3, AssetLayerRow.TOP, AssetLayerRow.RANDOM, AssetLayerRow.HORIZONTAL, true));
assets.push(new AssetLayerRow(Layer4, 3, AssetLayerRow.BOTTOM, AssetLayerRow.RANDOM));
add((assets[0] as AssetLayerRow));
var tempAsset:AssetLayerRandom = new AssetLayerRandom(0.8, Layer2, 5, FlxG.width);
add(tempAsset);
var i = 1;
while (i < assets.length) {
add((assets[i] as AssetLayerRow));
i++;
};
}
protected function addScore():void{
if (!stateTimerComplete){
if (_ship.dead == false){
FlxG.score++;
};
};
}
public function gameOver():void{
FlxG.state = new EndState();
}
protected function assetsSetOut(num:int):void{
var tempAsset:AssetLayerRow;
var i:int;
while (i < assets.length) {
tempAsset = assets[i];
if (tempAsset.layerNumber == num){
tempAsset.moveOut();
};
i++;
};
}
override public function create():void{
FlxG.stage.focus = this;
This = this;
assetTimer = 4;
FlxState.bgColor = 4281479730;
setupAssets();
_obstacles = new ObstacleSet(currentMode);
add(_obstacles);
stateTimer = ((Math.random() * 15) + 10);
setupBoundaries();
stateTimerComplete = false;
nextState();
add(stateEndText);
lives = 3;
livesText = new FlxText(0, (FlxG.height - 15), FlxG.width, lives.toString());
livesText.scrollFactor = new FlxPoint(0, 0);
add(livesText);
scoreText = new FlxText(0, 0, FlxG.width, ("Score: " + FlxG.score.toString()));
scoreText.scrollFactor = new FlxPoint(0, 0);
add(scoreText);
camControl = new FlxSprite((FlxG.width / 2), 0);
camControl.visible = false;
camControl.solid = false;
camControl.velocity.x = Horse.gameSpeed;
add(camControl);
if (!Horse.init){
Horse.changeShipMode(currentMode);
};
}
public static function losePoints(X:Number, Y:Number, amount:int=100):void{
var gainScore:Points = new Points(X, Y, amount, ("-" + amount), 0xCC0000, 40);
FlxG.score = (FlxG.score - amount);
This.add(gainScore);
}
public static function gainPoints(X:Number, Y:Number, amount:int=100):void{
var gainScore:Points = new Points(X, Y, amount, ("+" + amount), 0xFFFFFF, -40);
FlxG.score = (FlxG.score + amount);
This.add(gainScore);
}
}
}//package
Section 181
//State_BasicsMusic (State_BasicsMusic)
package {
import mx.core.*;
public class State_BasicsMusic extends SoundAsset {
}
}//package
Section 182
//State_DrumTrack (State_DrumTrack)
package {
import mx.core.*;
public class State_DrumTrack extends SoundAsset {
}
}//package
Section 183
//State_GreedMusic (State_GreedMusic)
package {
import mx.core.*;
public class State_GreedMusic extends SoundAsset {
}
}//package
Section 184
//State_HammerMusic (State_HammerMusic)
package {
import mx.core.*;
public class State_HammerMusic extends SoundAsset {
}
}//package
Section 185
//State_HorseMusic (State_HorseMusic)
package {
import mx.core.*;
public class State_HorseMusic extends SoundAsset {
}
}//package
Section 186
//State_LLRMusic (State_LLRMusic)
package {
import mx.core.*;
public class State_LLRMusic extends SoundAsset {
}
}//package