├── docs ├── images │ ├── logo.jpg │ ├── collapsed.gif │ ├── expanded.gif │ ├── inherit-arrow.gif │ ├── titleTableTop.jpg │ ├── detailHeaderRule.jpg │ ├── inheritedSummary.gif │ ├── titleTableBottom.jpg │ ├── titleTableMiddle.jpg │ └── detailSectionHeader.jpg ├── package-frame.html ├── package-list.html ├── mxml-tags.html ├── org │ └── flixel │ │ ├── data │ │ ├── class-list.html │ │ ├── package-detail.html │ │ ├── FlxFactory.html │ │ ├── FlxList.html │ │ ├── FlxKong.html │ │ └── FlxAnim.html │ │ ├── class-list.html │ │ ├── package-detail.html │ │ └── FlxPoint.html ├── index.html ├── index-list.html ├── appendixes.html ├── print.css ├── cookies.js ├── package-summary.html ├── all-classes.html ├── title-bar.html ├── all-index-X.html ├── all-index-Y.html ├── all-index-Z.html ├── all-index-J.html ├── all-index-W.html └── all-index-Q.html ├── org └── flixel │ ├── data │ ├── beep.mp3 │ ├── close.png │ ├── digg.png │ ├── key_0.png │ ├── key_p.png │ ├── logo.png │ ├── cursor.png │ ├── donate.png │ ├── flixel.mp3 │ ├── reddit.png │ ├── stumble.png │ ├── twitter.png │ ├── autotiles.png │ ├── delicious.png │ ├── key_minus.png │ ├── key_plus.png │ ├── logo_light.png │ ├── nokiafc22.ttf │ ├── logo_corners.png │ ├── autotiles_alt.png │ ├── FlxList.as │ ├── FlxAnim.as │ ├── FlxPause.as │ ├── FlxKong.as │ ├── FlxFade.as │ ├── FlxFlash.as │ ├── FlxQuake.as │ ├── FlxConsole.as │ ├── FlxMouse.as │ └── FlxKeyboard.as │ ├── FlxPoint.as │ ├── FlxRect.as │ ├── FlxMonitor.as │ ├── FlxTileblock.as │ ├── FlxSave.as │ ├── FlxState.as │ ├── FlxButton.as │ ├── FlxText.as │ └── FlxPreloader.as ├── license.txt └── flx.py /docs/images/logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/progrium/flixel/master/docs/images/logo.jpg -------------------------------------------------------------------------------- /docs/images/collapsed.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/progrium/flixel/master/docs/images/collapsed.gif -------------------------------------------------------------------------------- /docs/images/expanded.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/progrium/flixel/master/docs/images/expanded.gif -------------------------------------------------------------------------------- /org/flixel/data/beep.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/progrium/flixel/master/org/flixel/data/beep.mp3 -------------------------------------------------------------------------------- /org/flixel/data/close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/progrium/flixel/master/org/flixel/data/close.png -------------------------------------------------------------------------------- /org/flixel/data/digg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/progrium/flixel/master/org/flixel/data/digg.png -------------------------------------------------------------------------------- /org/flixel/data/key_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/progrium/flixel/master/org/flixel/data/key_0.png -------------------------------------------------------------------------------- /org/flixel/data/key_p.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/progrium/flixel/master/org/flixel/data/key_p.png -------------------------------------------------------------------------------- /org/flixel/data/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/progrium/flixel/master/org/flixel/data/logo.png -------------------------------------------------------------------------------- /org/flixel/data/cursor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/progrium/flixel/master/org/flixel/data/cursor.png -------------------------------------------------------------------------------- /org/flixel/data/donate.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/progrium/flixel/master/org/flixel/data/donate.png -------------------------------------------------------------------------------- /org/flixel/data/flixel.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/progrium/flixel/master/org/flixel/data/flixel.mp3 -------------------------------------------------------------------------------- /org/flixel/data/reddit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/progrium/flixel/master/org/flixel/data/reddit.png -------------------------------------------------------------------------------- /org/flixel/data/stumble.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/progrium/flixel/master/org/flixel/data/stumble.png -------------------------------------------------------------------------------- /org/flixel/data/twitter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/progrium/flixel/master/org/flixel/data/twitter.png -------------------------------------------------------------------------------- /docs/images/inherit-arrow.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/progrium/flixel/master/docs/images/inherit-arrow.gif -------------------------------------------------------------------------------- /docs/images/titleTableTop.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/progrium/flixel/master/docs/images/titleTableTop.jpg -------------------------------------------------------------------------------- /org/flixel/data/autotiles.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/progrium/flixel/master/org/flixel/data/autotiles.png -------------------------------------------------------------------------------- /org/flixel/data/delicious.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/progrium/flixel/master/org/flixel/data/delicious.png -------------------------------------------------------------------------------- /org/flixel/data/key_minus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/progrium/flixel/master/org/flixel/data/key_minus.png -------------------------------------------------------------------------------- /org/flixel/data/key_plus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/progrium/flixel/master/org/flixel/data/key_plus.png -------------------------------------------------------------------------------- /org/flixel/data/logo_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/progrium/flixel/master/org/flixel/data/logo_light.png -------------------------------------------------------------------------------- /org/flixel/data/nokiafc22.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/progrium/flixel/master/org/flixel/data/nokiafc22.ttf -------------------------------------------------------------------------------- /docs/images/detailHeaderRule.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/progrium/flixel/master/docs/images/detailHeaderRule.jpg -------------------------------------------------------------------------------- /docs/images/inheritedSummary.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/progrium/flixel/master/docs/images/inheritedSummary.gif -------------------------------------------------------------------------------- /docs/images/titleTableBottom.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/progrium/flixel/master/docs/images/titleTableBottom.jpg -------------------------------------------------------------------------------- /docs/images/titleTableMiddle.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/progrium/flixel/master/docs/images/titleTableMiddle.jpg -------------------------------------------------------------------------------- /org/flixel/data/logo_corners.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/progrium/flixel/master/org/flixel/data/logo_corners.png -------------------------------------------------------------------------------- /docs/images/detailSectionHeader.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/progrium/flixel/master/docs/images/detailSectionHeader.jpg -------------------------------------------------------------------------------- /org/flixel/data/autotiles_alt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/progrium/flixel/master/org/flixel/data/autotiles_alt.png -------------------------------------------------------------------------------- /org/flixel/data/FlxList.as: -------------------------------------------------------------------------------- 1 | package org.flixel.data 2 | { 3 | import org.flixel.*; 4 | 5 | /** 6 | * The world's smallest linked list class. 7 | * Useful for optimizing time-critical or highly repetitive tasks! 8 | * See FlxQuadTree for how to use it, IF YOU DARE. 9 | */ 10 | public class FlxList 11 | { 12 | /** 13 | * Stores a reference to a FlxObject. 14 | */ 15 | public var object:FlxObject; 16 | /** 17 | * Stores a reference to the next link in the list. 18 | */ 19 | public var next:FlxList; 20 | 21 | /** 22 | * Creates a new link, and sets object and next to null. 23 | */ 24 | public function FlxList() 25 | { 26 | object = null; 27 | next = null; 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /org/flixel/FlxPoint.as: -------------------------------------------------------------------------------- 1 | package org.flixel 2 | { 3 | /** 4 | * Stores a 2D floating point coordinate. 5 | */ 6 | public class FlxPoint 7 | { 8 | /** 9 | * @default 0 10 | */ 11 | public var x:Number; 12 | /** 13 | * @default 0 14 | */ 15 | public var y:Number; 16 | 17 | /** 18 | * Instantiate a new point object. 19 | * 20 | * @param X The X-coordinate of the point in space. 21 | * @param Y The Y-coordinate of the point in space. 22 | */ 23 | public function FlxPoint(X:Number=0, Y:Number=0) 24 | { 25 | x = X; 26 | y = Y; 27 | } 28 | 29 | /** 30 | * Convert object to readable string name. Useful for debugging, save games, etc. 31 | */ 32 | public function toString():String 33 | { 34 | return FlxU.getClassName(this,true); 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /docs/package-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Adobe Flex 2 Language Reference 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | <body> 20 | 21 | <h2>Frame Alert</h2> 22 | 23 | <p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. 24 | <br> 25 | Link to<a href="package-summary.html">Non-frame version.</a> 26 | 27 | </p> 28 | 29 | </body> 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /docs/package-list.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Package List - API Documentation 6 | 7 | 8 | 9 | 10 | 11 | 12 |

13 | Packages 14 |

15 | 16 | 17 | 20 | 21 | 22 | 23 | 24 |
org.flixel 18 |
19 |
org.flixel.data
25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /docs/mxml-tags.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | MXML Only Components - Adobe Flex 2 Language Reference 10 | 11 | 12 | 13 | 14 | 15 | 16 |

MXML Only Components

17 | 18 | <mx:Binding> 19 |
20 | 21 | <mx:Component> 22 |
23 | 24 | <mx:Metadata> 25 |
26 | 27 | <mx:Model> 28 |
29 | 30 | <mx:Script> 31 |
32 | 33 | <mx:Style> 34 |
35 | 36 | <mx:XML> 37 |
38 | 39 | <mx:XMLList> 40 |
41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /org/flixel/data/FlxAnim.as: -------------------------------------------------------------------------------- 1 | package org.flixel.data 2 | { 3 | /** 4 | * Just a helper structure for the FlxSprite animation system 5 | */ 6 | public class FlxAnim 7 | { 8 | /** 9 | * String name of the animation (e.g. "walk") 10 | */ 11 | public var name:String; 12 | /** 13 | * Seconds between frames (basically the framerate) 14 | */ 15 | public var delay:Number; 16 | /** 17 | * A list of frames stored as uint objects 18 | */ 19 | public var frames:Array; 20 | /** 21 | * Whether or not the animation is looped 22 | */ 23 | public var looped:Boolean; 24 | 25 | /** 26 | * Constructor 27 | * 28 | * @param Name What this animation should be called (e.g. "run") 29 | * @param Frames An array of numbers indicating what frames to play in what order (e.g. 1, 2, 3) 30 | * @param FrameRate The speed in frames per second that the animation should play at (e.g. 40) 31 | * @param Looped Whether or not the animation is looped or just plays once 32 | */ 33 | public function FlxAnim(Name:String, Frames:Array, FrameRate:Number=0, Looped:Boolean=true) 34 | { 35 | name = Name; 36 | delay = 0; 37 | if(FrameRate > 0) 38 | delay = 1.0/FrameRate; 39 | frames = Frames; 40 | looped = Looped; 41 | } 42 | } 43 | } -------------------------------------------------------------------------------- /license.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009 Adam 'Atomic' Saltsman 2 | 3 | Permission is hereby granted, free of charge, to any person 4 | obtaining a copy of this software and associated documentation 5 | files (the "Software"), to deal in the Software without 6 | restriction, including without limitation the rights to use, 7 | copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the 9 | Software is furnished to do so, subject to the following 10 | conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 17 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 19 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | NOTE FROM THE AUTHOR: As far as I know, you only have to include 25 | this license if you are redistributing source code that includes 26 | the Flixel library. There is no need (or way, afaik) to include 27 | it in your compiled flash games and apps! -------------------------------------------------------------------------------- /org/flixel/data/FlxPause.as: -------------------------------------------------------------------------------- 1 | package org.flixel.data 2 | { 3 | import org.flixel.*; 4 | 5 | /** 6 | * This is the default flixel pause screen. 7 | * It can be overridden with your own FlxLayer object. 8 | */ 9 | public class FlxPause extends FlxGroup 10 | { 11 | [Embed(source="key_minus.png")] private var ImgKeyMinus:Class; 12 | [Embed(source="key_plus.png")] private var ImgKeyPlus:Class; 13 | [Embed(source="key_0.png")] private var ImgKey0:Class; 14 | [Embed(source="key_p.png")] private var ImgKeyP:Class; 15 | 16 | /** 17 | * Constructor. 18 | */ 19 | public function FlxPause() 20 | { 21 | super(); 22 | scrollFactor.x = 0; 23 | scrollFactor.y = 0; 24 | var w:uint = 80; 25 | var h:uint = 92; 26 | x = (FlxG.width-w)/2; 27 | y = (FlxG.height-h)/2; 28 | add((new FlxSprite()).createGraphic(w,h,0xaa000000,true),true); 29 | (add(new FlxText(0,0,w,"this game is"),true) as FlxText).alignment = "center"; 30 | add((new FlxText(0,10,w,"PAUSED")).setFormat(null,16,0xffffff,"center"),true); 31 | add(new FlxSprite(4,36,ImgKeyP),true); 32 | add(new FlxText(16,36,w-16,"Pause Game"),true); 33 | add(new FlxSprite(4,50,ImgKey0),true); 34 | add(new FlxText(16,50,w-16,"Mute Sound"),true); 35 | add(new FlxSprite(4,64,ImgKeyMinus),true); 36 | add(new FlxText(16,64,w-16,"Sound Down"),true); 37 | add(new FlxSprite(4,78,ImgKeyPlus),true); 38 | add(new FlxText(16,78,w-16,"Sound Up"),true); 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /org/flixel/FlxRect.as: -------------------------------------------------------------------------------- 1 | package org.flixel 2 | { 3 | /** 4 | * Stores a rectangle. 5 | */ 6 | public class FlxRect extends FlxPoint 7 | { 8 | /** 9 | * @default 0 10 | */ 11 | public var width:Number; 12 | /** 13 | * @default 0 14 | */ 15 | public var height:Number; 16 | 17 | /** 18 | * Instantiate a new rectangle. 19 | * 20 | * @param X The X-coordinate of the point in space. 21 | * @param Y The Y-coordinate of the point in space. 22 | * @param Width Desired width of the rectangle. 23 | * @param Height Desired height of the rectangle. 24 | */ 25 | public function FlxRect(X:Number=0, Y:Number=0, Width:Number=0, Height:Number=0) 26 | { 27 | super(X,Y); 28 | width = Width; 29 | height = Height; 30 | } 31 | 32 | /** 33 | * The X coordinate of the left side of the rectangle. Read-only. 34 | */ 35 | public function get left():Number 36 | { 37 | return x; 38 | } 39 | 40 | /** 41 | * The X coordinate of the right side of the rectangle. Read-only. 42 | */ 43 | public function get right():Number 44 | { 45 | return x + width; 46 | } 47 | 48 | /** 49 | * The Y coordinate of the top of the rectangle. Read-only. 50 | */ 51 | public function get top():Number 52 | { 53 | return y; 54 | } 55 | 56 | /** 57 | * The Y coordinate of the bottom of the rectangle. Read-only. 58 | */ 59 | public function get bottom():Number 60 | { 61 | return y + height; 62 | } 63 | } 64 | } -------------------------------------------------------------------------------- /docs/org/flixel/data/class-list.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | org.flixel.data - API Documentation 6 | 7 | 8 | 9 | 10 | 11 |

12 | Package org.flixel.data 13 |

14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 |
Classes
FlxAnim
FlxConsole
FlxFade
FlxFlash
FlxKeyboard
FlxKong
FlxList
FlxMouse
FlxPanel
FlxPause
FlxQuake
52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /org/flixel/data/FlxKong.as: -------------------------------------------------------------------------------- 1 | package org.flixel.data 2 | { 3 | import flash.display.DisplayObject; 4 | import flash.display.LoaderInfo; 5 | import flash.display.Loader; 6 | import flash.display.Sprite; 7 | import flash.net.URLRequest; 8 | import flash.events.Event; 9 | 10 | /** 11 | * This class provides basic high scores and achievements via Kongregate's game API. 12 | */ 13 | public class FlxKong extends Sprite 14 | { 15 | /** 16 | * Stores the Kongregate API object. 17 | * 18 | * @default null 19 | */ 20 | public var API:*; 21 | 22 | /** 23 | * Constructor. 24 | */ 25 | public function FlxKong() 26 | { 27 | API = null; 28 | } 29 | 30 | /** 31 | * Actually initializes the FlxKong object. Highly recommend calling this 32 | * inside your first game state's update() function to ensure 33 | * that all the necessary Flash stage stuff is loaded. 34 | */ 35 | public function init():void 36 | { 37 | var paramObj:Object = LoaderInfo(root.loaderInfo).parameters; 38 | var api_url:String = paramObj.api_path || "http://www.kongregate.com/flash/API_AS3_Local.swf"; 39 | 40 | //Load the API 41 | var request:URLRequest = new URLRequest(api_url); 42 | var loader:Loader = new Loader(); 43 | loader.contentLoaderInfo.addEventListener(Event.COMPLETE,APILoaded); 44 | loader.load(request); 45 | this.addChild(loader); 46 | } 47 | 48 | /** 49 | * Fired when the Kongregate API finishes loading into the API object. 50 | */ 51 | protected function APILoaded(event:Event):void 52 | { 53 | API = event.target.content; 54 | API.services.connect(); 55 | } 56 | } 57 | } -------------------------------------------------------------------------------- /org/flixel/data/FlxFade.as: -------------------------------------------------------------------------------- 1 | package org.flixel.data 2 | { 3 | import org.flixel.*; 4 | 5 | /** 6 | * This is a special effects utility class to help FlxGame do the 'fade' effect. 7 | */ 8 | public class FlxFade extends FlxSprite 9 | { 10 | /** 11 | * How long the effect should last. 12 | */ 13 | protected var _delay:Number; 14 | /** 15 | * Callback for when the effect is finished. 16 | */ 17 | protected var _complete:Function; 18 | 19 | /** 20 | * Constructor initializes the fade object 21 | */ 22 | public function FlxFade() 23 | { 24 | super(); 25 | createGraphic(FlxG.width,FlxG.height,0,true); 26 | scrollFactor.x = 0; 27 | scrollFactor.y = 0; 28 | exists = false; 29 | solid = false; 30 | fixed = true; 31 | } 32 | 33 | /** 34 | * Reset and trigger this special effect 35 | * 36 | * @param Color The color you want to use 37 | * @param Duration How long it should take to fade the screen out 38 | * @param FadeComplete A function you want to run when the fade finishes 39 | * @param Force Force the effect to reset 40 | */ 41 | public function start(Color:uint=0xff000000, Duration:Number=1, FadeComplete:Function=null, Force:Boolean=false):void 42 | { 43 | if(!Force && exists) return; 44 | fill(Color); 45 | _delay = Duration; 46 | _complete = FadeComplete; 47 | alpha = 0; 48 | exists = true; 49 | } 50 | 51 | /** 52 | * Stops and hides this screen effect. 53 | */ 54 | public function stop():void 55 | { 56 | exists = false; 57 | } 58 | 59 | /** 60 | * Updates and/or animates this special effect 61 | */ 62 | override public function update():void 63 | { 64 | alpha += FlxG.elapsed/_delay; 65 | if(alpha >= 1) 66 | { 67 | alpha = 1; 68 | if(_complete != null) 69 | _complete(); 70 | } 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /org/flixel/data/FlxFlash.as: -------------------------------------------------------------------------------- 1 | package org.flixel.data 2 | { 3 | import org.flixel.*; 4 | 5 | /** 6 | * This is a special effects utility class to help FlxGame do the 'flash' effect 7 | */ 8 | public class FlxFlash extends FlxSprite 9 | { 10 | /** 11 | * How long the effect should last. 12 | */ 13 | protected var _delay:Number; 14 | /** 15 | * Callback for when the effect is finished. 16 | */ 17 | protected var _complete:Function; 18 | 19 | /** 20 | * Constructor for this special effect 21 | */ 22 | public function FlxFlash() 23 | { 24 | super(); 25 | createGraphic(FlxG.width,FlxG.height,0,true); 26 | scrollFactor.x = 0; 27 | scrollFactor.y = 0; 28 | exists = false; 29 | solid = false; 30 | fixed = true; 31 | } 32 | 33 | /** 34 | * Reset and trigger this special effect 35 | * 36 | * @param Color The color you want to use 37 | * @param Duration How long it takes for the flash to fade 38 | * @param FlashComplete A function you want to run when the flash finishes 39 | * @param Force Force the effect to reset 40 | */ 41 | public function start(Color:uint=0xffffffff, Duration:Number=1, FlashComplete:Function=null, Force:Boolean=false):void 42 | { 43 | if(!Force && exists) return; 44 | fill(Color); 45 | _delay = Duration; 46 | _complete = FlashComplete; 47 | alpha = 1; 48 | exists = true; 49 | } 50 | 51 | /** 52 | * Stops and hides this screen effect. 53 | */ 54 | public function stop():void 55 | { 56 | exists = false; 57 | } 58 | 59 | /** 60 | * Updates and/or animates this special effect 61 | */ 62 | override public function update():void 63 | { 64 | alpha -= FlxG.elapsed/_delay; 65 | if(alpha <= 0) 66 | { 67 | exists = false; 68 | if(_complete != null) 69 | _complete(); 70 | } 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /org/flixel/FlxMonitor.as: -------------------------------------------------------------------------------- 1 | package org.flixel 2 | { 3 | /** 4 | * FlxMonitor is a simple class that aggregates and averages data. 5 | * Flixel uses this to display the framerate and profiling data 6 | * in the developer console. It's nice for keeping track of 7 | * things that might be changing too fast from frame to frame. 8 | */ 9 | public class FlxMonitor 10 | { 11 | /** 12 | * Stores the requested size of the monitor array. 13 | */ 14 | protected var _size:uint; 15 | /** 16 | * Keeps track of where we are in the array. 17 | */ 18 | protected var _itr:uint; 19 | /** 20 | * An array to hold all the data we are averaging. 21 | */ 22 | protected var _data:Array; 23 | 24 | /** 25 | * Creates the monitor array and sets the size. 26 | * 27 | * @param Size The desired size - more entries means a longer window of averaging. 28 | * @param Default The default value of the entries in the array (0 by default). 29 | */ 30 | public function FlxMonitor(Size:uint,Default:Number=0) 31 | { 32 | _size = Size; 33 | if(_size <= 0) 34 | _size = 1; 35 | _itr = 0; 36 | _data = new Array(_size); 37 | for(var i:uint = 0; i < _size; i++) 38 | _data[i] = Default; 39 | } 40 | 41 | /** 42 | * Adds an entry to the array of data. 43 | * 44 | * @param Data The value you want to track and average. 45 | */ 46 | public function add(Data:Number):void 47 | { 48 | _data[_itr++] = Data; 49 | if(_itr >= _size) 50 | _itr = 0; 51 | } 52 | 53 | /** 54 | * Averages the value of all the numbers in the monitor window. 55 | * 56 | * @return The average value of all the numbers in the monitor window. 57 | */ 58 | public function average():Number 59 | { 60 | var sum:Number = 0; 61 | for(var i:uint = 0; i < _size; i++) 62 | sum += _data[i]; 63 | return sum/_size; 64 | } 65 | } 66 | } -------------------------------------------------------------------------------- /docs/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Adobe Flex 2 Language Reference 8 | 9 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | <body> 46 | 47 | <h2>Frame Alert</h2> 48 | 49 | <p> 50 | This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. 51 | <br> 52 | Link to <a href="package-summary.html">Non-frame version.</a> 53 | 54 | </p> 55 | 56 | </body> 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | -------------------------------------------------------------------------------- /org/flixel/data/FlxQuake.as: -------------------------------------------------------------------------------- 1 | package org.flixel.data 2 | { 3 | import org.flixel.FlxG; 4 | 5 | /** 6 | * This is a special effects utility class to help FlxGame do the 'quake' or screenshake effect. 7 | */ 8 | public class FlxQuake 9 | { 10 | /** 11 | * The game's level of zoom. 12 | */ 13 | protected var _zoom:uint; 14 | /** 15 | * The intensity of the quake effect: a percentage of the screen's size. 16 | */ 17 | protected var _intensity:Number; 18 | /** 19 | * Set to countdown the quake time. 20 | */ 21 | protected var _timer:Number; 22 | 23 | /** 24 | * The amount of X distortion to apply to the screen. 25 | */ 26 | public var x:int; 27 | /** 28 | * The amount of Y distortion to apply to the screen. 29 | */ 30 | public var y:int; 31 | 32 | /** 33 | * Constructor. 34 | */ 35 | public function FlxQuake(Zoom:uint) 36 | { 37 | _zoom = Zoom; 38 | start(0); 39 | } 40 | 41 | /** 42 | * Reset and trigger this special effect. 43 | * 44 | * @param Intensity Percentage of screen size representing the maximum distance that the screen can move during the 'quake'. 45 | * @param Duration The length in seconds that the "quake" should last. 46 | */ 47 | public function start(Intensity:Number=0.05,Duration:Number=0.5):void 48 | { 49 | stop(); 50 | _intensity = Intensity; 51 | _timer = Duration; 52 | } 53 | 54 | /** 55 | * Stops this screen effect. 56 | */ 57 | public function stop():void 58 | { 59 | x = 0; 60 | y = 0; 61 | _intensity = 0; 62 | _timer = 0; 63 | } 64 | 65 | /** 66 | * Updates and/or animates this special effect. 67 | */ 68 | public function update():void 69 | { 70 | if(_timer > 0) 71 | { 72 | _timer -= FlxG.elapsed; 73 | if(_timer <= 0) 74 | { 75 | _timer = 0; 76 | x = 0; 77 | y = 0; 78 | } 79 | else 80 | { 81 | x = (Math.random()*_intensity*FlxG.width*2-_intensity*FlxG.width)*_zoom; 82 | y = (Math.random()*_intensity*FlxG.height*2-_intensity*FlxG.height)*_zoom; 83 | } 84 | } 85 | } 86 | } 87 | } -------------------------------------------------------------------------------- /docs/org/flixel/class-list.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | org.flixel - API Documentation 6 | 7 | 8 | 9 | 10 | 11 |

12 | Package org.flixel 13 |

14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 |
Classes
FlxButton
FlxEmitter
FlxG
FlxGame
FlxGroup
FlxMonitor
FlxObject
FlxPoint
FlxPreloader
FlxQuadTree
FlxRect
FlxSave
FlxSound
FlxSprite
FlxState
FlxText
FlxTileblock
FlxTilemap
FlxU
76 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /docs/index-list.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Adobe Flex 2 Language Reference 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |

Index

19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 |
AN
BO
CP
DQ
ER
FS
GT
HU
IV
JW
KX
LY
MZ
117 | 118 | 119 | 120 | 121 | 122 | -------------------------------------------------------------------------------- /docs/appendixes.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Appendixes 8 | 9 | 10 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 31 |
32 |
33 |
34 | 35 | 36 | 37 | 38 |
 AppendixDescription
39 |

40 | 42 |
43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /docs/print.css: -------------------------------------------------------------------------------- 1 | /* 2 | //////////////////////////////////////////////////////////////////////////////// 3 | // 4 | // ADOBE SYSTEMS INCORPORATED 5 | // Copyright 2005-2007 Adobe Systems Incorporated 6 | // All Rights Reserved. 7 | // 8 | // NOTICE: Adobe permits you to use, modify, and distribute this file 9 | // in accordance with the terms of the license agreement accompanying it. 10 | // 11 | //////////////////////////////////////////////////////////////////////////////// 12 | */ 13 | 14 | body { 15 | color: #000000; 16 | background: #ffffff; 17 | font-family: "Times New Roman", Times, serif; 18 | font-size: 12pt; 19 | } 20 | a { 21 | text-decoration: none; 22 | color: #000000; 23 | } 24 | pre { 25 | white-space: -moz-pre-wrap; /* Mozilla */ 26 | white-space: -pre-wrap; /* Opera 4-6 */ 27 | white-space: -o-pre-wrap; /* Opera 7 */ 28 | word-wrap: break-word; /* IE */ 29 | } 30 | .titleTableTopNav, .titleTableSubNav, .logoImage { 31 | display: none; 32 | } 33 | .packageFrame { 34 | display: none; 35 | } 36 | .titleTableSubTitle { 37 | font-weight: bold; 38 | } 39 | .classHeaderTableLabel { 40 | padding-right: 10px; 41 | vertical-align: top; 42 | } 43 | .showHideLinks { 44 | display: none; 45 | } 46 | html>body code { 47 | font-size: 10pt; 48 | } 49 | .summaryTableTitle, .detailSectionHeader { 50 | font-size: 14pt; 51 | font-weight: bold; 52 | padding-top: 15px; 53 | padding-bottom: 5px; 54 | } 55 | .summaryTable { 56 | border: 1px solid #000000; 57 | border-collapse: collapse; 58 | width: 100%; 59 | } 60 | .summaryTableDescription { 61 | padding-bottom: 20px; 62 | } 63 | .summaryTableSignatureCol, .summaryTableOwnerCol, .summaryTableLastCol, .summaryTableCol { 64 | border: 1px solid #000000; 65 | } 66 | .summaryTablePaddingCol { 67 | border: 1px solid #000000; 68 | border-right: 0px; 69 | } 70 | .summaryTableInheritanceCol, .summaryTableOperatorCol, .summaryTableStatementCol, .summaryTableSecondCol { 71 | border: 1px solid #000000; 72 | border-left: 0px; 73 | } 74 | .summaryTableLastCol { 75 | vertical-align: top; 76 | } 77 | .detailHeader { 78 | font-size: 13pt; 79 | padding-top: 100px; 80 | } 81 | .detailHeaderName { 82 | font-weight: bold; 83 | } 84 | .detailHeaderType { 85 | padding-left: 5px; 86 | } 87 | .detailHeaderRule { 88 | background: #FF0000; 89 | } 90 | .seeAlso { 91 | padding-bottom: 20px; 92 | margin-top: -20px; 93 | } 94 | .innertable { 95 | border-collapse: collapse; 96 | } 97 | .innertable td,.innertable th { 98 | border: 1px solid #000000; 99 | padding-left: 5px; 100 | padding-right: 5px; 101 | } 102 | .listing { 103 | font-size: 10pt; 104 | } 105 | .feedbackLink { 106 | display: none; 107 | } 108 | .copyright { 109 | font-size: 10pt; 110 | } -------------------------------------------------------------------------------- /docs/cookies.js: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // ADOBE SYSTEMS INCORPORATED 4 | // Copyright 2006-2007 Adobe Systems Incorporated 5 | // All Rights Reserved. 6 | // 7 | // NOTICE: Adobe permits you to use, modify, and distribute this file 8 | // in accordance with the terms of the license agreement accompanying it. 9 | // 10 | //////////////////////////////////////////////////////////////////////////////// 11 | 12 | /** 13 | * Read the JavaScript cookies tutorial at: 14 | * http://www.netspade.com/articles/javascript/cookies.xml 15 | */ 16 | 17 | /** 18 | * Sets a Cookie with the given name and value. 19 | * 20 | * name Name of the cookie 21 | * value Value of the cookie 22 | * [expires] Expiration date of the cookie (default: end of current session) 23 | * [path] Path where the cookie is valid (default: path of calling document) 24 | * [domain] Domain where the cookie is valid 25 | * (default: domain of calling document) 26 | * [secure] Boolean value indicating if the cookie transmission requires a 27 | * secure transmission 28 | */ 29 | function setCookie(name, value, expires, path, domain, secure) 30 | { 31 | document.cookie= name + "=" + escape(value) + 32 | ((expires) ? "; expires=" + expires.toGMTString() : "") + 33 | ((path) ? "; path=" + path : "") + 34 | ((domain) ? "; domain=" + domain : "") + 35 | ((secure) ? "; secure" : ""); 36 | } 37 | 38 | /** 39 | * Gets the value of the specified cookie. 40 | * 41 | * name Name of the desired cookie. 42 | * 43 | * Returns a string containing value of specified cookie, 44 | * or null if cookie does not exist. 45 | */ 46 | function getCookie(name) 47 | { 48 | var dc = document.cookie; 49 | var prefix = name + "="; 50 | var begin = dc.indexOf("; " + prefix); 51 | if (begin == -1) 52 | { 53 | begin = dc.indexOf(prefix); 54 | if (begin != 0) return null; 55 | } 56 | else 57 | { 58 | begin += 2; 59 | } 60 | var end = document.cookie.indexOf(";", begin); 61 | if (end == -1) 62 | { 63 | end = dc.length; 64 | } 65 | return unescape(dc.substring(begin + prefix.length, end)); 66 | } 67 | 68 | /** 69 | * Deletes the specified cookie. 70 | * 71 | * name name of the cookie 72 | * [path] path of the cookie (must be same as path used to create cookie) 73 | * [domain] domain of the cookie (must be same as domain used to create cookie) 74 | */ 75 | function deleteCookie(name, path, domain) 76 | { 77 | if (getCookie(name)) 78 | { 79 | document.cookie = name + "=" + 80 | ((path) ? "; path=" + path : "") + 81 | ((domain) ? "; domain=" + domain : "") + 82 | "; expires=Thu, 01-Jan-70 00:00:01 GMT"; 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /docs/package-summary.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | All Packages 6 | 7 | 8 | 9 | 10 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 31 |
32 |
33 |
34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 |
 PackageDescription
 org.flixel 
 org.flixel.data 
45 |

46 | 48 |
49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /docs/all-classes.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | All Classes - API Documentation 6 | 7 | 8 | 9 | 10 | 11 |

12 | All Classes 13 |

14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 |
FlxAnim
FlxButton
FlxConsole
FlxEmitter
FlxFade
FlxFlash
FlxG
FlxGame
FlxGroup
FlxKeyboard
FlxKong
FlxList
FlxMonitor
FlxMouse
FlxObject
FlxPanel
FlxPause
FlxPoint
FlxPreloader
FlxQuadTree
FlxQuake
FlxRect
FlxSave
FlxSound
FlxSprite
FlxState
FlxText
FlxTileblock
FlxTilemap
FlxU
106 | 107 | 108 | 109 | -------------------------------------------------------------------------------- /org/flixel/FlxTileblock.as: -------------------------------------------------------------------------------- 1 | package org.flixel 2 | { 3 | import flash.display.BitmapData; 4 | import flash.geom.Rectangle; 5 | 6 | /** 7 | * This is the basic "environment object" class, used to create simple walls and floors. 8 | * It can be filled with a random selection of tiles to quickly add detail. 9 | */ 10 | public class FlxTileblock extends FlxObject 11 | { 12 | /** 13 | * Stores the tile strip from which the tiles are loaded. 14 | */ 15 | protected var _pixels:BitmapData; 16 | /** 17 | * Array of rectangles used to quickly blit the tiles to the screen. 18 | */ 19 | protected var _rects:Array; 20 | /** 21 | * The size of the tiles (e.g. 8 means 8x8). 22 | */ 23 | protected var _tileSize:uint; 24 | /** 25 | * Rendering helper. 26 | */ 27 | protected var _flashRect:Rectangle; 28 | /** 29 | * Bounding box rendering helper. 30 | */ 31 | protected var _bbRect:Rectangle; 32 | 33 | /** 34 | * Creates a new FlxBlock object with the specified position and size. 35 | * 36 | * @param X The X position of the block. 37 | * @param Y The Y position of the block. 38 | * @param Width The width of the block. 39 | * @param Height The height of the block. 40 | */ 41 | public function FlxTileblock(X:int,Y:int,Width:uint,Height:uint) 42 | { 43 | super(); 44 | x = X; 45 | y = Y; 46 | width = Width; 47 | height = Height; 48 | fixed = true; 49 | _bbRect = new Rectangle(width,height); 50 | refreshHulls(); 51 | } 52 | 53 | /** 54 | * Fills the block with a randomly arranged selection of graphics from the image provided. 55 | * 56 | * @param TileGraphic The graphic class that contains the tiles that should fill this block. 57 | * @param Empties The number of "empty" tiles to add to the auto-fill algorithm (e.g. 8 tiles + 4 empties = 1/3 of block will be open holes). 58 | */ 59 | public function loadGraphic(TileGraphic:Class,Empties:uint=0):void 60 | { 61 | if(TileGraphic == null) 62 | return; 63 | 64 | _pixels = FlxG.addBitmap(TileGraphic); 65 | _rects = new Array(); 66 | _tileSize = _pixels.height; 67 | var widthInTiles:uint = Math.ceil(width/_tileSize); 68 | var heightInTiles:uint = Math.ceil(height/_tileSize); 69 | width = widthInTiles*_tileSize; 70 | height = heightInTiles*_tileSize; 71 | var numTiles:uint = widthInTiles*heightInTiles; 72 | var numGraphics:uint = _pixels.width/_tileSize; 73 | for(var i:uint = 0; i < numTiles; i++) 74 | { 75 | if(FlxU.random()*(numGraphics+Empties) > Empties) 76 | _rects.push(new Rectangle(_tileSize*Math.floor(FlxU.random()*numGraphics),0,_tileSize,_tileSize)); 77 | else 78 | _rects.push(null); 79 | } 80 | } 81 | 82 | /** 83 | * Draws this block. 84 | */ 85 | override public function render():void 86 | { 87 | renderBlock(); 88 | } 89 | 90 | /** 91 | * Internal function to draw this block 92 | */ 93 | protected function renderBlock():void 94 | { 95 | getScreenXY(_point); 96 | var opx:int = _point.x; 97 | var rl:uint = _rects.length; 98 | _flashPoint.x = _point.x; 99 | _flashPoint.y = _point.y; 100 | for(var i:uint = 0; i < rl; i++) 101 | { 102 | _flashRect = _rects[i] as Rectangle; 103 | if(_flashRect != null) FlxG.buffer.copyPixels(_pixels,_flashRect,_flashPoint,null,null,true); 104 | _flashPoint.x += _tileSize; 105 | if(_flashPoint.x >= opx + width) 106 | { 107 | _flashPoint.x = opx; 108 | _flashPoint.y += _tileSize; 109 | } 110 | } 111 | 112 | //Draw bounding box if necessary 113 | if(FlxG.showBounds) 114 | { 115 | var bbc:uint = getBoundingColor(); 116 | 117 | //Draw top of box 118 | _bbRect.x = _point.x; 119 | _bbRect.y = _point.y; 120 | _bbRect.width = width; 121 | _bbRect.height = 1; 122 | FlxG.buffer.fillRect(_bbRect,bbc); 123 | 124 | //Draw bottom of box 125 | _bbRect.y += height-1; 126 | FlxG.buffer.fillRect(_bbRect,bbc); 127 | 128 | //Draw left side of box 129 | _bbRect.y = _point.y + 1; 130 | _bbRect.width = 1; 131 | _bbRect.height = height-2; 132 | FlxG.buffer.fillRect(_bbRect,bbc); 133 | 134 | //Draw right side of box 135 | _bbRect.x += width-1; 136 | FlxG.buffer.fillRect(_bbRect,bbc); 137 | } 138 | } 139 | } 140 | } -------------------------------------------------------------------------------- /org/flixel/FlxSave.as: -------------------------------------------------------------------------------- 1 | package org.flixel 2 | { 3 | import flash.net.SharedObject; 4 | import flash.net.SharedObjectFlushStatus; 5 | 6 | /** 7 | * A class to help automate and simplify save game functionality. 8 | */ 9 | public class FlxSave extends Object 10 | { 11 | /** 12 | * Allows you to directly access the data container in the local shared object. 13 | * @default null 14 | */ 15 | public var data:Object; 16 | /** 17 | * The name of the local shared object. 18 | * @default null 19 | */ 20 | public var name:String; 21 | /** 22 | * The local shared object itself. 23 | * @default null 24 | */ 25 | protected var _so:SharedObject; 26 | 27 | /** 28 | * Blanks out the containers. 29 | */ 30 | public function FlxSave() 31 | { 32 | name = null; 33 | _so = null; 34 | data = null; 35 | } 36 | 37 | /** 38 | * Automatically creates or reconnects to locally saved data. 39 | * 40 | * @param Name The name of the object (should be the same each time to access old data). 41 | * 42 | * @return Whether or not you successfully connected to the save data. 43 | */ 44 | public function bind(Name:String):Boolean 45 | { 46 | name = null; 47 | _so = null; 48 | data = null; 49 | name = Name; 50 | try 51 | { 52 | _so = SharedObject.getLocal(name); 53 | } 54 | catch(e:Error) 55 | { 56 | FlxG.log("WARNING: There was a problem binding to\nthe shared object data from FlxSave."); 57 | name = null; 58 | _so = null; 59 | data = null; 60 | return false; 61 | } 62 | data = _so.data; 63 | return true; 64 | } 65 | 66 | /** 67 | * If you don't like to access the data object directly, you can use this to write to it. 68 | * 69 | * @param FieldName The name of the data field you want to create or overwrite. 70 | * @param FieldValue The data you want to store. 71 | * @param MinFileSize If you need X amount of space for your save, specify it here. 72 | * 73 | * @return Whether or not the write and flush were successful. 74 | */ 75 | public function write(FieldName:String,FieldValue:Object,MinFileSize:uint=0):Boolean 76 | { 77 | if(_so == null) 78 | { 79 | FlxG.log("WARNING: You must call FlxSave.bind()\nbefore calling FlxSave.write()."); 80 | return false; 81 | } 82 | data[FieldName] = FieldValue; 83 | return forceSave(MinFileSize); 84 | } 85 | 86 | /** 87 | * If you don't like to access the data object directly, you can use this to read from it. 88 | * 89 | * @param FieldName The name of the data field you want to read 90 | * 91 | * @return The value of the data field you are reading (null if it doesn't exist). 92 | */ 93 | public function read(FieldName:String):Object 94 | { 95 | if(_so == null) 96 | { 97 | FlxG.log("WARNING: You must call FlxSave.bind()\nbefore calling FlxSave.read()."); 98 | return null; 99 | } 100 | return data[FieldName]; 101 | } 102 | 103 | /** 104 | * Writes the local shared object to disk immediately. 105 | * 106 | * @param MinFileSize If you need X amount of space for your save, specify it here. 107 | * 108 | * @return Whether or not the flush was successful. 109 | */ 110 | public function forceSave(MinFileSize:uint=0):Boolean 111 | { 112 | if(_so == null) 113 | { 114 | FlxG.log("WARNING: You must call FlxSave.bind()\nbefore calling FlxSave.forceSave()."); 115 | return false; 116 | } 117 | var status:Object = null; 118 | try 119 | { 120 | status = _so.flush(MinFileSize); 121 | } 122 | catch (e:Error) 123 | { 124 | FlxG.log("WARNING: There was a problem flushing\nthe shared object data from FlxSave."); 125 | return false; 126 | } 127 | return status == SharedObjectFlushStatus.FLUSHED; 128 | } 129 | 130 | /** 131 | * Erases everything stored in the local shared object. 132 | * 133 | * @param MinFileSize If you need X amount of space for your save, specify it here. 134 | * 135 | * @return Whether or not the clear and flush was successful. 136 | */ 137 | public function erase(MinFileSize:uint=0):Boolean 138 | { 139 | if(_so == null) 140 | { 141 | FlxG.log("WARNING: You must call FlxSave.bind()\nbefore calling FlxSave.erase()."); 142 | return false; 143 | } 144 | _so.clear(); 145 | return forceSave(MinFileSize); 146 | } 147 | } 148 | } 149 | -------------------------------------------------------------------------------- /docs/title-bar.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Adobe Flex 2 Language Reference 8 | 9 | 10 | 11 | 12 | 13 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 28 | 29 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 |
API Documentation 26 | All Packages | All Classes | Index | No Frames   27 | 30 |

31 |
 
 
51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /org/flixel/FlxState.as: -------------------------------------------------------------------------------- 1 | package org.flixel 2 | { 3 | import flash.display.Sprite; 4 | import flash.geom.Rectangle; 5 | 6 | /** 7 | * This is the basic game "state" object - e.g. in a simple game 8 | * you might have a menu state and a play state. 9 | * It acts as a kind of container for all your game objects. 10 | * You can also access the game's background color 11 | * and screen buffer through this object. 12 | * FlxState is kind of a funny class from the technical side, 13 | * it is just a regular Flash Sprite display object, 14 | * with one member variable: a flixel FlxGroup. 15 | * This means you can load it up with regular Flash stuff 16 | * or with flixel elements, whatever works! 17 | */ 18 | public class FlxState extends Sprite 19 | { 20 | /** 21 | * This static variable holds the screen buffer, 22 | * so you can draw to it directly if you want. 23 | */ 24 | static public var screen:FlxSprite; 25 | /** 26 | * This static variable indicates the "clear color" 27 | * or default background color of the game. 28 | * Change it at ANY time using FlxState.bgColor. 29 | */ 30 | static public var bgColor:uint; 31 | /** 32 | * Internal group used to organize and display objects you add to this state. 33 | */ 34 | public var defaultGroup:FlxGroup; 35 | 36 | /** 37 | * Creates a new FlxState object, 38 | * instantiating screen if necessary. 39 | */ 40 | public function FlxState() 41 | { 42 | super(); 43 | defaultGroup = new FlxGroup(); 44 | if(screen == null) 45 | { 46 | screen = new FlxSprite(); 47 | screen.createGraphic(FlxG.width,FlxG.height,0,true); 48 | screen.origin.x = screen.origin.y = 0; 49 | screen.antialiasing = true; 50 | screen.exists = false; 51 | screen.solid = false; 52 | screen.fixed = true; 53 | } 54 | } 55 | 56 | /** 57 | * Override this function to set up your game state. 58 | * This is where you create your groups and game objects and all that good stuff. 59 | */ 60 | public function create():void 61 | { 62 | //nothing to create initially 63 | } 64 | 65 | /** 66 | * Adds a new FlxCore subclass (FlxSprite, FlxBlock, etc) to the game loop. 67 | * FlxState is adding this object to its built-in FlxGroup to automate updating and rendering. 68 | * 69 | * @param Core The object you want to add to the game loop. 70 | */ 71 | public function add(Core:FlxObject):FlxObject 72 | { 73 | return defaultGroup.add(Core); 74 | } 75 | 76 | /** 77 | * Override this function to do special pre-processing FX like motion blur. 78 | * You can use scaling or blending modes or whatever you want against 79 | * FlxState.screen to achieve all sorts of cool FX. 80 | */ 81 | public function preProcess():void 82 | { 83 | screen.fill(bgColor); //Default behavior - just overwrite buffer with background color 84 | } 85 | 86 | /** 87 | * Automatically goes through and calls update on everything you added to the game loop, 88 | * override this function to handle custom input and perform collisions/ 89 | */ 90 | public function update():void 91 | { 92 | defaultGroup.update(); 93 | } 94 | 95 | /** 96 | * This function collides defaultGroup against defaultGroup 97 | * (basically everything you added to this state). 98 | */ 99 | public function collide():void 100 | { 101 | FlxU.collide(defaultGroup,defaultGroup); 102 | } 103 | 104 | /** 105 | * Automatically goes through and calls render on everything you added to the game loop, 106 | * override this loop to manually control the rendering process. 107 | */ 108 | public function render():void 109 | { 110 | defaultGroup.render(); 111 | } 112 | 113 | /** 114 | * Override this function to do special pre-processing FX like light bloom. 115 | * You can use scaling or blending modes or whatever you want against 116 | * FlxState.screen to achieve all sorts of cool FX. 117 | */ 118 | public function postProcess():void 119 | { 120 | //no fx by default 121 | } 122 | 123 | /** 124 | * Override this function to handle any deleting or "shutdown" type operations you 125 | * might need (such as removing traditional Flash children like Sprite objects). 126 | */ 127 | public function destroy():void 128 | { 129 | defaultGroup.destroy(); 130 | } 131 | } 132 | } -------------------------------------------------------------------------------- /flx.py: -------------------------------------------------------------------------------- 1 | #! /usr/local/bin/python 2 | import os 3 | import sys 4 | 5 | #BASIC SCRIPT PRESETS 6 | width = 320 # Width of your game in 'true' pixels (ignoring zoom) 7 | height = 240 # Height of your game in 'true' pixels 8 | zoom = 2 # How chunky you want your pixels 9 | src = 'src/' # Name of the source folder under the project folder (if there is one!) 10 | preloader = 'Preloader' # Name of the preloader class 11 | flexBuilder = True # Whether or not to generate a Default.css file 12 | menuState = 'MenuState' # Name of menu state class 13 | playState = 'PlayState' # Name of play state class 14 | 15 | #Get name of project 16 | if len(sys.argv) <= 1: 17 | sys.exit(0) 18 | project = sys.argv[1] 19 | 20 | #Generate basic game class 21 | filename = project+'/'+src+project+'.as'; 22 | try: 23 | fo = open(filename, 'w') 24 | except IOError: 25 | print('Can\'t open '+filename+' for writing.') 26 | sys.exit(0) 27 | lines = [] 28 | lines.append('package\r\n') 29 | lines.append('{\r\n') 30 | lines.append('\timport org.flixel.*;\r\n') 31 | lines.append('\t[SWF(width="'+str(width*zoom)+'", height="'+str(height*zoom)+'", backgroundColor="#000000")]\r\n') 32 | lines.append('\t[Frame(factoryClass="Preloader")]\r\n') 33 | lines.append('\r\n') 34 | lines.append('\tpublic class '+project+' extends FlxGame\r\n') 35 | lines.append('\t{\r\n') 36 | lines.append('\t\tpublic function '+project+'()\r\n') 37 | lines.append('\t\t{\r\n') 38 | lines.append('\t\t\tsuper('+str(width)+','+str(height)+','+menuState+','+str(zoom)+');\r\n') 39 | lines.append('\t\t}\r\n') 40 | lines.append('\t}\r\n') 41 | lines.append('}\r\n') 42 | fo.writelines(lines) 43 | fo.close() 44 | 45 | #Generate preloader 46 | filename = project+'/'+src+preloader+'.as'; 47 | try: 48 | fo = open(filename, 'w') 49 | except IOError: 50 | print('Can\'t open '+filename+' for writing.') 51 | sys.exit(0) 52 | lines = [] 53 | lines.append('package\r\n') 54 | lines.append('{\r\n') 55 | lines.append('\timport org.flixel.*;\r\n') 56 | lines.append('\r\n') 57 | lines.append('\tpublic class '+preloader+' extends FlxPreloader\r\n') 58 | lines.append('\t{\r\n') 59 | lines.append('\t\tpublic function '+preloader+'()\r\n') 60 | lines.append('\t\t{\r\n') 61 | lines.append('\t\t\tclassName = "'+project+'";\r\n') 62 | lines.append('\t\t\tsuper();\r\n') 63 | lines.append('\t\t}\r\n') 64 | lines.append('\t}\r\n') 65 | lines.append('}\r\n') 66 | fo.writelines(lines) 67 | fo.close() 68 | 69 | #Generate Default.css 70 | if flexBuilder: 71 | filename = project+'/'+src+'Default.css'; 72 | try: 73 | fo = open(filename, 'w') 74 | except IOError: 75 | print('Can\'t open '+filename+' for writing.') 76 | sys.exit(0) 77 | fo.write('Add this: "-defaults-css-url Default.css"\nto the project\'s additonal compiler arguments.') 78 | fo.close() 79 | 80 | #Generate game menu 81 | filename = project+'/'+src+menuState+'.as'; 82 | try: 83 | fo = open(filename, 'w') 84 | except IOError: 85 | print('Can\'t open '+filename+' for writing.') 86 | sys.exit(0) 87 | lines = [] 88 | lines.append('package\r\n') 89 | lines.append('{\r\n') 90 | lines.append('\timport org.flixel.*;\r\n') 91 | lines.append('\r\n') 92 | lines.append('\tpublic class '+menuState+' extends FlxState\r\n') 93 | lines.append('\t{\r\n') 94 | lines.append('\t\toverride public function create():void\r\n') 95 | lines.append('\t\t{\r\n') 96 | lines.append('\t\t\tvar t:FlxText;\r\n') 97 | lines.append('\t\t\tt = new FlxText(0,FlxG.height/2-10,FlxG.width,"'+project+'");\r\n') 98 | lines.append('\t\t\tt.size = 16;\r\n') 99 | lines.append('\t\t\tt.alignment = "center";\r\n') 100 | lines.append('\t\t\tadd(t);\r\n') 101 | lines.append('\t\t\tt = new FlxText(FlxG.width/2-50,FlxG.height-20,100,"click to play");\r\n') 102 | lines.append('\t\t\tt.alignment = "center";\r\n') 103 | lines.append('\t\t\tadd(t);\r\n') 104 | lines.append('\t\t\t\r\n') 105 | lines.append('\t\t\tFlxG.mouse.show();\r\n') 106 | lines.append('\t\t}\r\n') 107 | lines.append('\r\n') 108 | lines.append('\t\toverride public function update():void\r\n') 109 | lines.append('\t\t{\r\n') 110 | lines.append('\t\t\tsuper.update();\r\n') 111 | lines.append('\r\n') 112 | lines.append('\t\t\tif(FlxG.mouse.justPressed())\r\n') 113 | lines.append('\t\t\t{\r\n') 114 | lines.append('\t\t\t\tFlxG.mouse.hide();\r\n') 115 | lines.append('\t\t\t\tFlxG.state = new PlayState();\r\n') 116 | lines.append('\t\t\t}\r\n') 117 | lines.append('\t\t}\r\n') 118 | lines.append('\t}\r\n') 119 | lines.append('}\r\n') 120 | fo.writelines(lines) 121 | fo.close() 122 | 123 | #Generate basic game state 124 | filename = project+'/'+src+playState+'.as'; 125 | try: 126 | fo = open(filename, 'w') 127 | except IOError: 128 | print('Can\'t open '+filename+' for writing.') 129 | sys.exit(0) 130 | lines = [] 131 | lines.append('package\r\n') 132 | lines.append('{\r\n') 133 | lines.append('\timport org.flixel.*;\r\n') 134 | lines.append('\r\n') 135 | lines.append('\tpublic class '+playState+' extends FlxState\r\n') 136 | lines.append('\t{\r\n') 137 | lines.append('\t\toverride public function create():void\r\n') 138 | lines.append('\t\t{\r\n') 139 | lines.append('\t\t\tadd(new FlxText(0,0,100,"INSERT GAME HERE"));\r\n') 140 | lines.append('\t\t}\r\n') 141 | lines.append('\t}\r\n') 142 | lines.append('}\r\n') 143 | fo.writelines(lines) 144 | fo.close() 145 | 146 | print('Successfully generated game class, preloader, menu state, and play state.') -------------------------------------------------------------------------------- /org/flixel/data/FlxConsole.as: -------------------------------------------------------------------------------- 1 | package org.flixel.data 2 | { 3 | import flash.display.Bitmap; 4 | import flash.display.BitmapData; 5 | import flash.display.Sprite; 6 | import flash.text.AntiAliasType; 7 | import flash.text.GridFitType; 8 | import flash.text.TextField; 9 | import flash.text.TextFormat; 10 | 11 | import org.flixel.FlxG; 12 | import org.flixel.FlxMonitor; 13 | 14 | /** 15 | * Contains all the logic for the developer console. 16 | * This class is automatically created by FlxGame. 17 | */ 18 | public class FlxConsole extends Sprite 19 | { 20 | public var mtrUpdate:FlxMonitor; 21 | public var mtrRender:FlxMonitor; 22 | public var mtrTotal:FlxMonitor; 23 | 24 | /** 25 | * @private 26 | */ 27 | protected const MAX_CONSOLE_LINES:uint = 256; 28 | /** 29 | * @private 30 | */ 31 | protected var _console:Sprite; 32 | /** 33 | * @private 34 | */ 35 | protected var _text:TextField; 36 | /** 37 | * @private 38 | */ 39 | protected var _fpsDisplay:TextField; 40 | /** 41 | * @private 42 | */ 43 | protected var _extraDisplay:TextField; 44 | /** 45 | * @private 46 | */ 47 | protected var _curFPS:uint; 48 | /** 49 | * @private 50 | */ 51 | protected var _lines:Array; 52 | /** 53 | * @private 54 | */ 55 | protected var _Y:Number; 56 | /** 57 | * @private 58 | */ 59 | protected var _YT:Number; 60 | /** 61 | * @private 62 | */ 63 | protected var _bx:int; 64 | /** 65 | * @private 66 | */ 67 | protected var _by:int; 68 | /** 69 | * @private 70 | */ 71 | protected var _byt:int; 72 | 73 | /** 74 | * Constructor 75 | * 76 | * @param X X position of the console 77 | * @param Y Y position of the console 78 | * @param Zoom The game's zoom level 79 | */ 80 | public function FlxConsole(X:uint,Y:uint,Zoom:uint) 81 | { 82 | super(); 83 | 84 | visible = false; 85 | x = X*Zoom; 86 | _by = Y*Zoom; 87 | _byt = _by - FlxG.height*Zoom; 88 | _YT = _Y = y = _byt; 89 | var tmp:Bitmap = new Bitmap(new BitmapData(FlxG.width*Zoom,FlxG.height*Zoom,true,0x7F000000)); 90 | addChild(tmp); 91 | 92 | mtrUpdate = new FlxMonitor(8); 93 | mtrRender = new FlxMonitor(8); 94 | mtrTotal = new FlxMonitor(8); 95 | 96 | _text = new TextField(); 97 | _text.width = tmp.width; 98 | _text.height = tmp.height; 99 | _text.multiline = true; 100 | _text.wordWrap = true; 101 | _text.embedFonts = true; 102 | _text.selectable = false; 103 | _text.antiAliasType = AntiAliasType.NORMAL; 104 | _text.gridFitType = GridFitType.PIXEL; 105 | _text.defaultTextFormat = new TextFormat("system",8,0xffffff); 106 | addChild(_text); 107 | 108 | _fpsDisplay = new TextField(); 109 | _fpsDisplay.width = 100; 110 | _fpsDisplay.x = tmp.width-100; 111 | _fpsDisplay.height = 20; 112 | _fpsDisplay.multiline = true; 113 | _fpsDisplay.wordWrap = true; 114 | _fpsDisplay.embedFonts = true; 115 | _fpsDisplay.selectable = false; 116 | _fpsDisplay.antiAliasType = AntiAliasType.NORMAL; 117 | _fpsDisplay.gridFitType = GridFitType.PIXEL; 118 | _fpsDisplay.defaultTextFormat = new TextFormat("system",16,0xffffff,true,null,null,null,null,"right"); 119 | addChild(_fpsDisplay); 120 | 121 | _extraDisplay = new TextField(); 122 | _extraDisplay.width = 100; 123 | _extraDisplay.x = tmp.width-100; 124 | _extraDisplay.height = 64; 125 | _extraDisplay.y = 20; 126 | _extraDisplay.alpha = 0.5; 127 | _extraDisplay.multiline = true; 128 | _extraDisplay.wordWrap = true; 129 | _extraDisplay.embedFonts = true; 130 | _extraDisplay.selectable = false; 131 | _extraDisplay.antiAliasType = AntiAliasType.NORMAL; 132 | _extraDisplay.gridFitType = GridFitType.PIXEL; 133 | _extraDisplay.defaultTextFormat = new TextFormat("system",8,0xffffff,true,null,null,null,null,"right"); 134 | addChild(_extraDisplay); 135 | 136 | _lines = new Array(); 137 | } 138 | 139 | /** 140 | * Logs data to the developer console 141 | * 142 | * @param Text The text that you wanted to write to the console 143 | */ 144 | public function log(Text:String):void 145 | { 146 | if(Text == null) 147 | Text = "NULL"; 148 | trace(Text); 149 | _lines.push(Text); 150 | if(_lines.length > MAX_CONSOLE_LINES) 151 | { 152 | _lines.shift(); 153 | var newText:String = ""; 154 | for(var i:uint = 0; i < _lines.length; i++) 155 | newText += _lines[i]+"\n"; 156 | _text.text = newText; 157 | } 158 | else 159 | _text.appendText(Text+"\n"); 160 | _text.scrollV = _text.height; 161 | } 162 | 163 | /** 164 | * Shows/hides the console. 165 | */ 166 | public function toggle():void 167 | { 168 | if(_YT == _by) 169 | _YT = _byt; 170 | else 171 | { 172 | _YT = _by; 173 | visible = true; 174 | } 175 | } 176 | 177 | /** 178 | * Updates and/or animates the dev console. 179 | */ 180 | public function update():void 181 | { 182 | var total:Number = mtrTotal.average(); 183 | _fpsDisplay.text = uint(1000/total) + " fps"; 184 | var up:uint = mtrUpdate.average(); 185 | var rn:uint = mtrRender.average(); 186 | var fx:uint = up+rn; 187 | var tt:uint = uint(total); 188 | _extraDisplay.text = up + "ms update\n" + rn + "ms render\n" + fx + "ms flixel\n" + (tt-fx) + "ms flash\n" + tt + "ms total"; 189 | 190 | if(_Y < _YT) 191 | _Y += FlxG.height*10*FlxG.elapsed; 192 | else if(_Y > _YT) 193 | _Y -= FlxG.height*10*FlxG.elapsed; 194 | if(_Y > _by) 195 | _Y = _by; 196 | else if(_Y < _byt) 197 | { 198 | _Y = _byt; 199 | visible = false; 200 | } 201 | y = Math.floor(_Y); 202 | } 203 | } 204 | } -------------------------------------------------------------------------------- /docs/org/flixel/data/package-detail.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | org.flixel.data Summary 8 | 9 | 10 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 31 |
32 |
33 |
34 |
35 | 36 |
Classes
37 | 38 | 39 | 40 | 41 | 42 | 45 | 46 | 47 | 49 | 50 | 51 | 53 | 54 | 55 | 58 | 59 | 60 | 61 | 62 | 63 | 65 | 66 | 67 | 69 | 70 | 71 | 73 | 74 | 75 | 77 | 78 | 79 | 81 | 82 | 83 | 85 | 86 |
 ClassDescription
 FlxAnim 43 | Just a helper structure for the FlxSprite animation system 44 |
 FlxConsole 48 | Contains all the logic for the developer console.
 FlxFade 52 | This is a special effects utility class to help FlxGame do the 'fade' effect.
 FlxFlash 56 | This is a special effects utility class to help FlxGame do the 'flash' effect 57 |
 FlxKeyboard 
 FlxKong 64 | This class provides basic high scores and achievements via Kongregate's game API.
 FlxList 68 | The world's smallest linked list class.
 FlxMouse 72 | This class helps contain and track the mouse pointer in your game.
 FlxPanel 76 | This is a little built-in support visor that developers can optionally display.
 FlxPause 80 | This is the default flixel pause screen.
 FlxQuake 84 | This is a special effects utility class to help FlxGame do the 'quake' or screenshake effect.
87 |

88 |
89 |

90 | 92 |
93 |
94 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /org/flixel/data/FlxMouse.as: -------------------------------------------------------------------------------- 1 | package org.flixel.data 2 | { 3 | import flash.events.MouseEvent; 4 | 5 | import org.flixel.FlxPoint; 6 | import org.flixel.FlxSprite; 7 | import org.flixel.FlxU; 8 | 9 | /** 10 | * This class helps contain and track the mouse pointer in your game. 11 | * Automatically accounts for parallax scrolling, etc. 12 | */ 13 | public class FlxMouse 14 | { 15 | [Embed(source="cursor.png")] protected var ImgDefaultCursor:Class; 16 | 17 | /** 18 | * Current X position of the mouse pointer in the game world. 19 | */ 20 | public var x:int; 21 | /** 22 | * Current Y position of the mouse pointer in the game world. 23 | */ 24 | public var y:int; 25 | /** 26 | * Current X position of the mouse pointer on the screen. 27 | */ 28 | public var screenX:int; 29 | /** 30 | * Current Y position of the mouse pointer on the screen. 31 | */ 32 | public var screenY:int; 33 | /** 34 | * Graphical representation of the mouse pointer. 35 | */ 36 | public var cursor:FlxSprite; 37 | /** 38 | * Helper variable for tracking whether the mouse was just pressed or just released. 39 | */ 40 | protected var _current:int; 41 | /** 42 | * Helper variable for tracking whether the mouse was just pressed or just released. 43 | */ 44 | protected var _last:int; 45 | /** 46 | * Helper for mouse visibility. 47 | */ 48 | protected var _out:Boolean; 49 | 50 | /** 51 | * Constructor. 52 | */ 53 | public function FlxMouse() 54 | { 55 | x = 0; 56 | y = 0; 57 | screenX = 0; 58 | screenY = 0; 59 | _current = 0; 60 | _last = 0; 61 | cursor = null; 62 | _out = false; 63 | } 64 | 65 | /** 66 | * Either show an existing cursor or load a new one. 67 | * 68 | * @param Graphic The image you want to use for the cursor. 69 | * @param XOffset The number of pixels between the mouse's screen position and the graphic's top left corner. 70 | * * @param YOffset The number of pixels between the mouse's screen position and the graphic's top left corner. 71 | */ 72 | public function show(Graphic:Class=null,XOffset:int=0,YOffset:int=0):void 73 | { 74 | _out = true; 75 | if(Graphic != null) 76 | load(Graphic,XOffset,YOffset); 77 | else if(cursor != null) 78 | cursor.visible = true; 79 | else 80 | load(null); 81 | } 82 | 83 | /** 84 | * Hides the mouse cursor 85 | */ 86 | public function hide():void 87 | { 88 | if(cursor != null) 89 | { 90 | cursor.visible = false; 91 | _out = false; 92 | } 93 | } 94 | 95 | /** 96 | * Load a new mouse cursor graphic 97 | * 98 | * @param Graphic The image you want to use for the cursor. 99 | * @param XOffset The number of pixels between the mouse's screen position and the graphic's top left corner. 100 | * * @param YOffset The number of pixels between the mouse's screen position and the graphic's top left corner. 101 | */ 102 | public function load(Graphic:Class,XOffset:int=0,YOffset:int=0):void 103 | { 104 | if(Graphic == null) 105 | Graphic = ImgDefaultCursor; 106 | cursor = new FlxSprite(screenX,screenY,Graphic); 107 | cursor.offset.x = XOffset; 108 | cursor.offset.y = YOffset; 109 | } 110 | 111 | /** 112 | * Unload the current cursor graphic. If the current cursor is visible, 113 | * then the default system cursor is loaded up to replace the old one. 114 | */ 115 | public function unload():void 116 | { 117 | if(cursor != null) 118 | { 119 | if(cursor.visible) 120 | load(null); 121 | else 122 | cursor = null; 123 | } 124 | } 125 | 126 | /** 127 | * Called by the internal game loop to update the mouse pointer's position in the game world. 128 | * Also updates the just pressed/just released flags. 129 | * 130 | * @param X The current X position of the mouse in the window. 131 | * @param Y The current Y position of the mouse in the window. 132 | * @param XScroll The amount the game world has scrolled horizontally. 133 | * @param YScroll The amount the game world has scrolled vertically. 134 | */ 135 | public function update(X:int,Y:int,XScroll:Number,YScroll:Number):void 136 | { 137 | screenX = X; 138 | screenY = Y; 139 | x = screenX-FlxU.floor(XScroll); 140 | y = screenY-FlxU.floor(YScroll); 141 | if(cursor != null) 142 | { 143 | cursor.x = x; 144 | cursor.y = y; 145 | } 146 | if((_last == -1) && (_current == -1)) 147 | _current = 0; 148 | else if((_last == 2) && (_current == 2)) 149 | _current = 1; 150 | _last = _current; 151 | } 152 | 153 | /** 154 | * Resets the just pressed/just released flags and sets mouse to not pressed. 155 | */ 156 | public function reset():void 157 | { 158 | _current = 0; 159 | _last = 0; 160 | } 161 | 162 | /** 163 | * Check to see if the mouse is pressed. 164 | * 165 | * @return Whether the mouse is pressed. 166 | */ 167 | public function pressed():Boolean { return _current > 0; } 168 | 169 | /** 170 | * Check to see if the mouse was just pressed. 171 | * 172 | * @return Whether the mouse was just pressed. 173 | */ 174 | public function justPressed():Boolean { return _current == 2; } 175 | 176 | /** 177 | * Check to see if the mouse was just released. 178 | * 179 | * @return Whether the mouse was just released. 180 | */ 181 | public function justReleased():Boolean { return _current == -1; } 182 | 183 | /** 184 | * Event handler so FlxGame can toggle the mouse. 185 | * 186 | * @param event A MouseEvent object. 187 | */ 188 | public function handleMouseDown(event:MouseEvent):void 189 | { 190 | if(_current > 0) _current = 1; 191 | else _current = 2; 192 | } 193 | 194 | /** 195 | * Event handler so FlxGame can toggle the mouse. 196 | * 197 | * @param event A MouseEvent object. 198 | */ 199 | public function handleMouseUp(event:MouseEvent):void 200 | { 201 | if(_current > 0) _current = -1; 202 | else _current = 0; 203 | } 204 | 205 | /** 206 | * Event handler so FlxGame can toggle the mouse. 207 | * 208 | * @param event A MouseEvent object. 209 | */ 210 | public function handleMouseOut(event:MouseEvent):void 211 | { 212 | if(cursor != null) 213 | { 214 | _out = cursor.visible; 215 | cursor.visible = false; 216 | } 217 | } 218 | 219 | /** 220 | * Event handler so FlxGame can toggle the mouse. 221 | * 222 | * @param event A MouseEvent object. 223 | */ 224 | public function handleMouseOver(event:MouseEvent):void 225 | { 226 | if(cursor != null) 227 | cursor.visible = _out; 228 | } 229 | } 230 | } -------------------------------------------------------------------------------- /docs/org/flixel/data/FlxFactory.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | org.flixel.data.FlxFactory 9 | 10 | 11 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 32 |
33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 |
Packageorg.flixel.data
Classpublic class FlxFactory
InheritanceFlxFactory Inheritance flash.display.MovieClip
44 |

45 | This class handles the 8-bit style preloader. 46 |

47 |
48 |
49 |
50 | 51 |
52 |
Public Properties
53 | 54 | 55 | 56 | 57 | 58 | 61 | 62 | 63 | 66 | 67 |
 PropertyDefined by
  className : String
59 | This should always be the name of your main project/document class (e.g.
60 |
FlxFactory
  myURL : String
64 | Set this to your game's URL to use built-in site-locking.
65 |
FlxFactory
68 |
69 | 70 |
71 |
Public Methods
72 | 73 | 74 | 75 | 76 | 77 | 84 | 85 |
 MethodDefined by
   78 |
79 | FlxFactory()
80 |
81 | Constructor 82 |
83 |
FlxFactory
86 |
87 | 91 |
92 | 93 |
Property detail
94 | 95 | 96 | 97 | 98 | 99 |
classNameproperty
100 |
101 | public var className:String

102 | This should always be the name of your main project/document class (e.g. GravityHook). 103 |

104 | 105 | 106 | 107 | 108 | 109 |
myURLproperty 
110 |
111 | public var myURL:String

112 | Set this to your game's URL to use built-in site-locking. 113 |

114 | 115 |
Constructor detail
116 | 117 | 118 | 119 | 120 | 121 |
FlxFactory()constructor
122 |
123 | public function FlxFactory()

124 | Constructor 125 |

126 |
127 |
128 |
129 |
130 |

131 | 133 |
134 | 135 | 136 | 137 | -------------------------------------------------------------------------------- /org/flixel/FlxButton.as: -------------------------------------------------------------------------------- 1 | package org.flixel 2 | { 3 | import flash.events.MouseEvent; 4 | 5 | /** 6 | * A simple button class that calls a function when clicked by the mouse. 7 | * Supports labels, highlight states, and parallax scrolling. 8 | */ 9 | public class FlxButton extends FlxGroup 10 | { 11 | /** 12 | * Used for checkbox-style behavior. 13 | */ 14 | protected var _onToggle:Boolean; 15 | /** 16 | * Stores the 'off' or normal button state graphic. 17 | */ 18 | protected var _off:FlxSprite; 19 | /** 20 | * Stores the 'on' or highlighted button state graphic. 21 | */ 22 | protected var _on:FlxSprite; 23 | /** 24 | * Stores the 'off' or normal button state label. 25 | */ 26 | protected var _offT:FlxText; 27 | /** 28 | * Stores the 'on' or highlighted button state label. 29 | */ 30 | protected var _onT:FlxText; 31 | /** 32 | * This function is called when the button is clicked. 33 | */ 34 | protected var _callback:Function; 35 | /** 36 | * Tracks whether or not the button is currently pressed. 37 | */ 38 | protected var _pressed:Boolean; 39 | /** 40 | * Whether or not the button has initialized itself yet. 41 | */ 42 | protected var _initialized:Boolean; 43 | /** 44 | * Helper variable for correcting its members' scrollFactor objects. 45 | */ 46 | protected var _sf:FlxPoint; 47 | 48 | /** 49 | * Creates a new FlxButton object with a gray background 50 | * and a callback function on the UI thread. 51 | * 52 | * @param X The X position of the button. 53 | * @param Y The Y position of the button. 54 | * @param Callback The function to call whenever the button is clicked. 55 | */ 56 | public function FlxButton(X:int,Y:int,Callback:Function) 57 | { 58 | super(); 59 | x = X; 60 | y = Y; 61 | width = 100; 62 | height = 20; 63 | _off = new FlxSprite().createGraphic(width,height,0xff7f7f7f); 64 | _off.solid = false; 65 | add(_off,true); 66 | _on = new FlxSprite().createGraphic(width,height,0xffffffff); 67 | _on.solid = false; 68 | add(_on,true); 69 | _offT = null; 70 | _onT = null; 71 | _callback = Callback; 72 | _onToggle = false; 73 | _pressed = false; 74 | _initialized = false; 75 | _sf = null; 76 | } 77 | 78 | /** 79 | * Set your own image as the button background. 80 | * 81 | * @param Image A FlxSprite object to use for the button background. 82 | * @param ImageHighlight A FlxSprite object to use for the button background when highlighted (optional). 83 | * 84 | * @return This FlxButton instance (nice for chaining stuff together, if you're into that). 85 | */ 86 | public function loadGraphic(Image:FlxSprite,ImageHighlight:FlxSprite=null):FlxButton 87 | { 88 | _off = replace(_off,Image) as FlxSprite; 89 | if(ImageHighlight == null) 90 | { 91 | if(_on != _off) 92 | remove(_on); 93 | _on = _off; 94 | } 95 | else 96 | _on = replace(_on,ImageHighlight) as FlxSprite; 97 | _on.solid = _off.solid = false; 98 | _off.scrollFactor = scrollFactor; 99 | _on.scrollFactor = scrollFactor; 100 | width = _off.width; 101 | height = _off.height; 102 | refreshHulls(); 103 | return this; 104 | } 105 | 106 | /** 107 | * Add a text label to the button. 108 | * 109 | * @param Text A FlxText object to use to display text on this button (optional). 110 | * @param TextHighlight A FlxText object that is used when the button is highlighted (optional). 111 | * 112 | * @return This FlxButton instance (nice for chaining stuff together, if you're into that). 113 | */ 114 | public function loadText(Text:FlxText,TextHighlight:FlxText=null):FlxButton 115 | { 116 | if(Text != null) 117 | { 118 | if(_offT == null) 119 | { 120 | _offT = Text; 121 | add(_offT); 122 | } 123 | else 124 | _offT = replace(_offT,Text) as FlxText; 125 | } 126 | if(TextHighlight == null) 127 | _onT = _offT; 128 | else 129 | { 130 | if(_onT == null) 131 | { 132 | _onT = TextHighlight; 133 | add(_onT); 134 | } 135 | else 136 | _onT = replace(_onT,TextHighlight) as FlxText; 137 | } 138 | _offT.scrollFactor = scrollFactor; 139 | _onT.scrollFactor = scrollFactor; 140 | return this; 141 | } 142 | 143 | /** 144 | * Called by the game loop automatically, handles mouseover and click detection. 145 | */ 146 | override public function update():void 147 | { 148 | if(!_initialized) 149 | { 150 | if(FlxG.stage != null) 151 | { 152 | FlxG.stage.addEventListener(MouseEvent.MOUSE_UP, onMouseUp); 153 | _initialized = true; 154 | } 155 | } 156 | 157 | super.update(); 158 | 159 | visibility(false); 160 | if(overlapsPoint(FlxG.mouse.x,FlxG.mouse.y)) 161 | { 162 | if(!FlxG.mouse.pressed()) 163 | _pressed = false; 164 | else if(!_pressed) 165 | _pressed = true; 166 | visibility(!_pressed); 167 | } 168 | if(_onToggle) visibility(_off.visible); 169 | } 170 | 171 | /** 172 | * Use this to toggle checkbox-style behavior. 173 | */ 174 | public function get on():Boolean 175 | { 176 | return _onToggle; 177 | _onToggle = On; 178 | } 179 | 180 | /** 181 | * @private 182 | */ 183 | public function set on(On:Boolean):void 184 | { 185 | _onToggle = On; 186 | } 187 | 188 | /** 189 | * Called by the game state when state is changed (if this object belongs to the state) 190 | */ 191 | override public function destroy():void 192 | { 193 | if(FlxG.stage != null) 194 | FlxG.stage.removeEventListener(MouseEvent.MOUSE_UP, onMouseUp); 195 | } 196 | 197 | /** 198 | * Internal function for handling the visibility of the off and on graphics. 199 | * 200 | * @param On Whether the button should be on or off. 201 | */ 202 | protected function visibility(On:Boolean):void 203 | { 204 | if(On) 205 | { 206 | _off.visible = false; 207 | if(_offT != null) _offT.visible = false; 208 | _on.visible = true; 209 | if(_onT != null) _onT.visible = true; 210 | } 211 | else 212 | { 213 | _on.visible = false; 214 | if(_onT != null) _onT.visible = false; 215 | _off.visible = true; 216 | if(_offT != null) _offT.visible = true; 217 | } 218 | } 219 | 220 | /** 221 | * Internal function for handling the actual callback call (for UI thread dependent calls like FlxU.openURL()). 222 | */ 223 | protected function onMouseUp(event:MouseEvent):void 224 | { 225 | if(!exists || !visible || !active || !FlxG.mouse.justReleased() || (_callback == null)) return; 226 | if(overlapsPoint(FlxG.mouse.x,FlxG.mouse.y)) _callback(); 227 | } 228 | } 229 | } 230 | -------------------------------------------------------------------------------- /docs/org/flixel/data/FlxList.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | org.flixel.data.FlxList 9 | 10 | 11 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 32 |
33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 |
Packageorg.flixel.data
Classpublic class FlxList
41 |

42 | The world's smallest linked list class. 43 | Useful for optimizing time-critical or highly repetitive tasks! 44 | See FlxQuadTree for how to use it, IF YOU DARE. 45 |

46 |
47 |
48 |
49 | 50 |
51 |
Public Properties
52 | 53 | 54 | 55 | 56 | 57 | 61 | 62 | 63 | 67 | 68 |
 PropertyDefined by
  next : FlxList 58 |
59 | Stores a reference to the next link in the list.
60 |
FlxList
  object : FlxObject 64 |
65 | Stores a reference to a FlxObject.
66 |
FlxList
69 |
70 | 71 |
72 |
Public Methods
73 | 74 | 75 | 76 | 77 | 78 | 84 | 85 |
 MethodDefined by
   79 |
80 | FlxList()
81 |
82 | Creates a new link, and sets object and next to null.
83 |
FlxList
86 |
87 | 91 |
92 | 93 |
Property detail
94 | 95 | 96 | 97 | 98 | 99 |
nextproperty
100 |
101 | public var next:FlxList

102 | Stores a reference to the next link in the list. 103 |

104 | 105 | 106 | 107 | 108 | 109 |
objectproperty 
110 |
111 | public var object:FlxObject

112 | Stores a reference to a FlxObject. 113 |

114 | 115 |
Constructor detail
116 | 117 | 118 | 119 | 120 | 121 |
FlxList()constructor
122 |
123 | public function FlxList()

124 | Creates a new link, and sets object and next to null. 125 |

126 |
127 |
128 |
129 |
130 |

131 | 133 |
134 | 135 | 136 | 137 | -------------------------------------------------------------------------------- /org/flixel/data/FlxKeyboard.as: -------------------------------------------------------------------------------- 1 | package org.flixel.data 2 | { 3 | import flash.events.KeyboardEvent; 4 | 5 | public class FlxKeyboard 6 | { 7 | public var ESCAPE:Boolean; 8 | public var F1:Boolean; 9 | public var F2:Boolean; 10 | public var F3:Boolean; 11 | public var F4:Boolean; 12 | public var F5:Boolean; 13 | public var F6:Boolean; 14 | public var F7:Boolean; 15 | public var F8:Boolean; 16 | public var F9:Boolean; 17 | public var F10:Boolean; 18 | public var F11:Boolean; 19 | public var F12:Boolean; 20 | public var ONE:Boolean; 21 | public var TWO:Boolean; 22 | public var THREE:Boolean; 23 | public var FOUR:Boolean; 24 | public var FIVE:Boolean; 25 | public var SIX:Boolean; 26 | public var SEVEN:Boolean; 27 | public var EIGHT:Boolean; 28 | public var NINE:Boolean; 29 | public var ZERO:Boolean; 30 | public var MINUS:Boolean; 31 | public var PLUS:Boolean; 32 | public var DELETE:Boolean; 33 | public var BACKSPACE:Boolean; 34 | public var Q:Boolean; 35 | public var W:Boolean; 36 | public var E:Boolean; 37 | public var R:Boolean; 38 | public var T:Boolean; 39 | public var Y:Boolean; 40 | public var U:Boolean; 41 | public var I:Boolean; 42 | public var O:Boolean; 43 | public var P:Boolean; 44 | public var LBRACKET:Boolean; 45 | public var RBRACKET:Boolean; 46 | public var BACKSLASH:Boolean; 47 | public var CAPSLOCK:Boolean; 48 | public var A:Boolean; 49 | public var S:Boolean; 50 | public var D:Boolean; 51 | public var F:Boolean; 52 | public var G:Boolean; 53 | public var H:Boolean; 54 | public var J:Boolean; 55 | public var K:Boolean; 56 | public var L:Boolean; 57 | public var SEMICOLON:Boolean; 58 | public var QUOTE:Boolean; 59 | public var ENTER:Boolean; 60 | public var SHIFT:Boolean; 61 | public var Z:Boolean; 62 | public var X:Boolean; 63 | public var C:Boolean; 64 | public var V:Boolean; 65 | public var B:Boolean; 66 | public var N:Boolean; 67 | public var M:Boolean; 68 | public var COMMA:Boolean; 69 | public var PERIOD:Boolean; 70 | public var SLASH:Boolean; 71 | public var CONTROL:Boolean; 72 | public var ALT:Boolean; 73 | public var SPACE:Boolean; 74 | public var UP:Boolean; 75 | public var DOWN:Boolean; 76 | public var LEFT:Boolean; 77 | public var RIGHT:Boolean; 78 | 79 | /** 80 | * @private 81 | */ 82 | protected var _lookup:Object; 83 | /** 84 | * @private 85 | */ 86 | protected var _map:Array; 87 | /** 88 | * @private 89 | */ 90 | protected const _t:uint = 256; 91 | 92 | /** 93 | * Constructor 94 | */ 95 | public function FlxKeyboard() 96 | { 97 | //BASIC STORAGE & TRACKING 98 | var i:uint = 0; 99 | _lookup = new Object(); 100 | _map = new Array(_t); 101 | 102 | //LETTERS 103 | for(i = 65; i <= 90; i++) 104 | addKey(String.fromCharCode(i),i); 105 | 106 | //NUMBERS 107 | i = 48; 108 | addKey("ZERO",i++); 109 | addKey("ONE",i++); 110 | addKey("TWO",i++); 111 | addKey("THREE",i++); 112 | addKey("FOUR",i++); 113 | addKey("FIVE",i++); 114 | addKey("SIX",i++); 115 | addKey("SEVEN",i++); 116 | addKey("EIGHT",i++); 117 | addKey("NINE",i++); 118 | 119 | //FUNCTION KEYS 120 | for(i = 1; i <= 12; i++) 121 | addKey("F"+i,111+i); 122 | 123 | //SPECIAL KEYS + PUNCTUATION 124 | addKey("ESCAPE",27); 125 | addKey("MINUS",189); 126 | addKey("PLUS",187); 127 | addKey("DELETE",46); 128 | addKey("BACKSPACE",8); 129 | addKey("LBRACKET",219); 130 | addKey("RBRACKET",221); 131 | addKey("BACKSLASH",220); 132 | addKey("CAPSLOCK",20); 133 | addKey("SEMICOLON",186); 134 | addKey("QUOTE",222); 135 | addKey("ENTER",13); 136 | addKey("SHIFT",16); 137 | addKey("COMMA",188); 138 | addKey("PERIOD",190); 139 | addKey("SLASH",191); 140 | addKey("CONTROL",17); 141 | addKey("ALT",18); 142 | addKey("SPACE",32); 143 | addKey("UP",38); 144 | addKey("DOWN",40); 145 | addKey("LEFT",37); 146 | addKey("RIGHT",39); 147 | } 148 | 149 | /** 150 | * Updates the key states (for tracking just pressed, just released, etc). 151 | */ 152 | public function update():void 153 | { 154 | for(var i:uint = 0; i < _t; i++) 155 | { 156 | if(_map[i] == null) continue; 157 | var o:Object = _map[i]; 158 | if((o.last == -1) && (o.current == -1)) o.current = 0; 159 | else if((o.last == 2) && (o.current == 2)) o.current = 1; 160 | o.last = o.current; 161 | } 162 | } 163 | 164 | /** 165 | * Resets all the keys. 166 | */ 167 | public function reset():void 168 | { 169 | for(var i:uint = 0; i < _t; i++) 170 | { 171 | if(_map[i] == null) continue; 172 | var o:Object = _map[i]; 173 | this[o.name] = false; 174 | o.current = 0; 175 | o.last = 0; 176 | } 177 | } 178 | 179 | /** 180 | * Check to see if this key is pressed. 181 | * 182 | * @param Key One of the key constants listed above (e.g. "LEFT" or "A"). 183 | * 184 | * @return Whether the key is pressed 185 | */ 186 | public function pressed(Key:String):Boolean { return this[Key]; } 187 | 188 | /** 189 | * Check to see if this key was just pressed. 190 | * 191 | * @param Key One of the key constants listed above (e.g. "LEFT" or "A"). 192 | * 193 | * @return Whether the key was just pressed 194 | */ 195 | public function justPressed(Key:String):Boolean { return _map[_lookup[Key]].current == 2; } 196 | 197 | /** 198 | * Check to see if this key is just released. 199 | * 200 | * @param Key One of the key constants listed above (e.g. "LEFT" or "A"). 201 | * 202 | * @return Whether the key is just released. 203 | */ 204 | public function justReleased(Key:String):Boolean { return _map[_lookup[Key]].current == -1; } 205 | 206 | /** 207 | * Event handler so FlxGame can toggle keys. 208 | * 209 | * @param event A KeyboardEvent object. 210 | */ 211 | public function handleKeyDown(event:KeyboardEvent):void 212 | { 213 | var o:Object = _map[event.keyCode]; 214 | if(o == null) return; 215 | if(o.current > 0) o.current = 1; 216 | else o.current = 2; 217 | this[o.name] = true; 218 | } 219 | 220 | /** 221 | * Event handler so FlxGame can toggle keys. 222 | * 223 | * @param event A KeyboardEvent object. 224 | */ 225 | public function handleKeyUp(event:KeyboardEvent):void 226 | { 227 | var o:Object = _map[event.keyCode]; 228 | if(o == null) return; 229 | if(o.current > 0) o.current = -1; 230 | else o.current = 0; 231 | this[o.name] = false; 232 | } 233 | 234 | /** 235 | * An internal helper function used to build the key array. 236 | * 237 | * @param KeyName String name of the key (e.g. "LEFT" or "A") 238 | * @param KeyCode The numeric Flash code for this key. 239 | */ 240 | protected function addKey(KeyName:String,KeyCode:uint):void 241 | { 242 | _lookup[KeyName] = KeyCode; 243 | _map[KeyCode] = { name: KeyName, current: 0, last: 0 }; 244 | } 245 | } 246 | } 247 | -------------------------------------------------------------------------------- /docs/org/flixel/package-detail.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | org.flixel Summary 8 | 9 | 10 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 31 |
32 |
33 |
34 |
35 | 36 |
Classes
37 | 38 | 39 | 40 | 41 | 42 | 44 | 45 | 46 | 48 | 49 | 50 | 53 | 54 | 55 | 57 | 58 | 59 | 61 | 62 | 63 | 65 | 66 | 67 | 69 | 70 | 71 | 73 | 74 | 75 | 77 | 78 | 79 | 81 | 82 | 83 | 85 | 86 | 87 | 89 | 90 | 91 | 93 | 94 | 95 | 97 | 98 | 99 | 101 | 102 | 103 | 105 | 106 | 107 | 109 | 110 | 111 | 113 | 114 | 115 | 116 | 117 |
 ClassDescription
 FlxButton 43 | A simple button class that calls a function when clicked by the mouse.
 FlxEmitter 47 | FlxEmitter is a lightweight particle emitter.
 FlxG 51 | This is a global helper class full of useful functions for audio, 52 | input, basic info, and the camera system among other things.
 FlxGame 56 | FlxGame is the heart of all flixel games, and contains a bunch of basic game loops and things.
 FlxGroup 60 | This is an organizational class that can update and render a bunch of FlxObjects.
 FlxMonitor 64 | FlxMonitor is a simple class that aggregates and averages data.
 FlxObject 68 | This is the base class for most of the display objects (FlxSprite, FlxText, etc).
 FlxPoint 72 | Stores a 2D floating point coordinate.
 FlxPreloader 76 | This class handles the 8-bit style preloader.
 FlxQuadTree 80 | A fairly generic quad tree structure for rapid overlap checks.
 FlxRect 84 | Stores a rectangle.
 FlxSave 88 | A class to help automate and simplify save game functionality.
 FlxSound 92 | This is the universal flixel sound object, used for streaming, music, and sound effects.
 FlxSprite 96 | The main "game object" class, handles basic physics and animation.
 FlxState 100 | This is the basic game "state" object - e.g.
 FlxText 104 | Extends FlxSprite to support rendering text.
 FlxTileblock 108 | This is the basic "environment object" class, used to create simple walls and floors.
 FlxTilemap 112 | This is a traditional tilemap display and collision class.
 FlxU 
118 |

119 |
120 |

121 | 123 |
124 |
125 | 126 | 127 | 128 | -------------------------------------------------------------------------------- /docs/org/flixel/FlxPoint.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | org.flixel.FlxPoint 9 | 10 | 11 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 32 |
33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 |
Packageorg.flixel
Classpublic class FlxPoint
SubclassesFlxRect
44 |

45 | Stores a 2D floating point coordinate. 46 |

47 |
48 |
49 |
50 | 51 |
52 |
Public Properties
53 | 54 | 55 | 56 | 57 | 58 | 61 | 62 | 63 | 66 | 67 |
 PropertyDefined by
  x : Number
59 |
60 |
FlxPoint
  y : Number
64 |
65 |
FlxPoint
68 |
69 | 70 |
71 |
Public Methods
72 | 73 | 74 | 75 | 76 | 77 | 83 | 84 | 85 | 91 | 92 |
 MethodDefined by
   78 |
79 | FlxPoint(X:Number = 0, Y:Number = 0)
80 |
81 | Instantiate a new point object.
82 |
FlxPoint
   86 |
87 | toString():String
88 |
89 | Convert object to readable string name.
90 |
FlxPoint
93 |
94 | 98 |
99 | 100 |
Property detail
101 | 102 | 103 | 104 | 105 | 106 |
xproperty
107 |
108 | public var x:Number

109 |

The default value is 0.

110 |
111 | 112 | 113 | 114 | 115 | 116 |
yproperty 
117 |
118 | public var y:Number

119 |

The default value is 0.

120 |
121 | 122 |
Constructor detail
123 | 124 | 125 | 126 | 127 | 128 |
FlxPoint()constructor
129 |
130 | public function FlxPoint(X:Number = 0, Y:Number = 0)

131 | Instantiate a new point object. 132 | 133 |

Parameters 134 | 135 | 136 | 138 | 139 | 140 | 141 | 142 | 143 | 145 | 146 |
X:Number (default = 0) — The X-coordinate of the point in space. 137 |
 
Y:Number (default = 0) — The Y-coordinate of the point in space. 144 |
147 |
148 | 149 |
Method detail
150 | 151 | 152 | 153 | 154 | 155 |
toString()method
156 |
157 | public function toString():String

158 | Convert object to readable string name. Useful for debugging, save games, etc. 159 |

160 | Returns 161 | 162 | 163 | 164 | 165 |
String
166 |
167 |
168 |
169 |
170 |
171 |

172 | 174 |
175 | 176 | 177 | 178 | -------------------------------------------------------------------------------- /docs/org/flixel/data/FlxKong.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | org.flixel.data.FlxKong 9 | 10 | 11 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 32 |
33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 |
Packageorg.flixel.data
Classpublic class FlxKong
InheritanceFlxKong Inheritance flash.display.Sprite
44 |

45 | This class provides basic high scores and achievements via Kongregate's game API. 46 |

47 |
48 |
49 |
50 | 51 |
52 |
Public Properties
53 | 54 | 55 | 56 | 57 | 58 | 61 | 62 |
 PropertyDefined by
  API : *
59 | Stores the Kongregate API object.
60 |
FlxKong
63 |
64 | 65 |
66 |
Public Methods
67 | 68 | 69 | 70 | 71 | 72 | 78 | 79 | 80 | 86 | 87 |
 MethodDefined by
   73 |
74 | FlxKong()
75 |
76 | Constructor.
77 |
FlxKong
   81 |
82 | init():void
83 |
84 | Actually initializes the FlxKong object.
85 |
FlxKong
88 |
89 | 90 |
91 |
Protected Methods
92 | 93 | 94 | 95 | 96 | 97 | 103 | 104 |
 MethodDefined by
   98 |
99 | APILoaded(event:Event):void
100 |
101 | Fired when the Kongregate API finishes loading into the API object.
102 |
FlxKong
105 |
106 | 110 |
111 | 112 |
Property detail
113 | 114 | 115 | 116 | 117 | 118 |
APIproperty
119 |
120 | public var API:*

121 | Stores the Kongregate API object. 122 | 123 |

The default value is null.

124 |
125 | 126 |
Constructor detail
127 | 128 | 129 | 130 | 131 | 132 |
FlxKong()constructor
133 |
134 | public function FlxKong()

135 | Constructor. 136 |

137 | 138 |
Method detail
139 | 140 | 141 | 142 | 143 | 144 |
APILoaded()method
145 |
146 | protected function APILoaded(event:Event):void

147 | Fired when the Kongregate API finishes loading into the API object. 148 |

Parameters 149 | 150 | 151 | 152 | 153 |
event:Event
154 |
155 | 156 | 157 | 158 | 159 | 160 |
init()method 
161 |
162 | public function init():void

163 | Actually initializes the FlxKong object. Highly recommend calling this 164 | inside your first game state's update() function to ensure 165 | that all the necessary Flash stage stuff is loaded. 166 |

167 |
168 |
169 |
170 |
171 |

172 | 174 |
175 | 176 | 177 | 178 | -------------------------------------------------------------------------------- /org/flixel/FlxText.as: -------------------------------------------------------------------------------- 1 | package org.flixel 2 | { 3 | import flash.display.BitmapData; 4 | import flash.text.TextField; 5 | import flash.text.TextFormat; 6 | 7 | /** 8 | * Extends FlxSprite to support rendering text. 9 | * Can tint, fade, rotate and scale just like a sprite. 10 | * Doesn't really animate though, as far as I know. 11 | * Also does nice pixel-perfect centering on pixel fonts 12 | * as long as they are only one liners. 13 | */ 14 | public class FlxText extends FlxSprite 15 | { 16 | protected var _tf:TextField; 17 | protected var _regen:Boolean; 18 | protected var _shadow:uint; 19 | 20 | /** 21 | * Creates a new FlxText object at the specified position. 22 | * 23 | * @param X The X position of the text. 24 | * @param Y The Y position of the text. 25 | * @param Width The width of the text object (height is determined automatically). 26 | * @param Text The actual text you would like to display initially. 27 | * @param EmbeddedFont Whether this text field uses embedded fonts or nto 28 | */ 29 | public function FlxText(X:Number, Y:Number, Width:uint, Text:String=null, EmbeddedFont:Boolean=true) 30 | { 31 | super(X,Y); 32 | createGraphic(Width,1,0); 33 | 34 | if(Text == null) 35 | Text = ""; 36 | _tf = new TextField(); 37 | _tf.width = Width; 38 | _tf.embedFonts = EmbeddedFont; 39 | _tf.selectable = false; 40 | _tf.sharpness = 100; 41 | _tf.multiline = true; 42 | _tf.wordWrap = true; 43 | _tf.text = Text; 44 | var tf:TextFormat = new TextFormat("system",8,0xffffff); 45 | _tf.defaultTextFormat = tf; 46 | _tf.setTextFormat(tf); 47 | if(Text.length <= 0) 48 | _tf.height = 1; 49 | else 50 | _tf.height = 10; 51 | 52 | _regen = true; 53 | _shadow = 0; 54 | solid = false; 55 | calcFrame(); 56 | } 57 | 58 | /** 59 | * You can use this if you have a lot of text parameters 60 | * to set instead of the individual properties. 61 | * 62 | * @param Font The name of the font face for the text display. 63 | * @param Size The size of the font (in pixels essentially). 64 | * @param Color The color of the text in traditional flash 0xRRGGBB format. 65 | * @param Alignment A string representing the desired alignment ("left,"right" or "center"). 66 | * @param ShadowColor A uint representing the desired text shadow color in flash 0xRRGGBB format. 67 | * 68 | * @return This FlxText instance (nice for chaining stuff together, if you're into that). 69 | */ 70 | public function setFormat(Font:String=null,Size:Number=8,Color:uint=0xffffff,Alignment:String=null,ShadowColor:uint=0):FlxText 71 | { 72 | if(Font == null) 73 | Font = ""; 74 | var tf:TextFormat = dtfCopy(); 75 | tf.font = Font; 76 | tf.size = Size; 77 | tf.color = Color; 78 | tf.align = Alignment; 79 | _tf.defaultTextFormat = tf; 80 | _tf.setTextFormat(tf); 81 | _shadow = ShadowColor; 82 | _regen = true; 83 | calcFrame(); 84 | return this; 85 | } 86 | 87 | /** 88 | * The text being displayed. 89 | */ 90 | public function get text():String 91 | { 92 | return _tf.text; 93 | } 94 | 95 | /** 96 | * @private 97 | */ 98 | public function set text(Text:String):void 99 | { 100 | var ot:String = _tf.text; 101 | _tf.text = Text; 102 | if(_tf.text != ot) 103 | { 104 | _regen = true; 105 | calcFrame(); 106 | } 107 | } 108 | 109 | /** 110 | * The size of the text being displayed. 111 | */ 112 | public function get size():Number 113 | { 114 | return _tf.defaultTextFormat.size as Number; 115 | } 116 | 117 | /** 118 | * @private 119 | */ 120 | public function set size(Size:Number):void 121 | { 122 | var tf:TextFormat = dtfCopy(); 123 | tf.size = Size; 124 | _tf.defaultTextFormat = tf; 125 | _tf.setTextFormat(tf); 126 | _regen = true; 127 | calcFrame(); 128 | } 129 | 130 | /** 131 | * The color of the text being displayed. 132 | */ 133 | override public function get color():uint 134 | { 135 | return _tf.defaultTextFormat.color as uint; 136 | } 137 | 138 | /** 139 | * @private 140 | */ 141 | override public function set color(Color:uint):void 142 | { 143 | var tf:TextFormat = dtfCopy(); 144 | tf.color = Color; 145 | _tf.defaultTextFormat = tf; 146 | _tf.setTextFormat(tf); 147 | _regen = true; 148 | calcFrame(); 149 | } 150 | 151 | /** 152 | * The font used for this text. 153 | */ 154 | public function get font():String 155 | { 156 | return _tf.defaultTextFormat.font; 157 | } 158 | 159 | /** 160 | * @private 161 | */ 162 | public function set font(Font:String):void 163 | { 164 | var tf:TextFormat = dtfCopy(); 165 | tf.font = Font; 166 | _tf.defaultTextFormat = tf; 167 | _tf.setTextFormat(tf); 168 | _regen = true; 169 | calcFrame(); 170 | } 171 | 172 | /** 173 | * The alignment of the font ("left", "right", or "center"). 174 | */ 175 | public function get alignment():String 176 | { 177 | return _tf.defaultTextFormat.align; 178 | } 179 | 180 | /** 181 | * @private 182 | */ 183 | public function set alignment(Alignment:String):void 184 | { 185 | var tf:TextFormat = dtfCopy(); 186 | tf.align = Alignment; 187 | _tf.defaultTextFormat = tf; 188 | _tf.setTextFormat(tf); 189 | calcFrame(); 190 | } 191 | 192 | /** 193 | * The alignment of the font ("left", "right", or "center"). 194 | */ 195 | public function get shadow():uint 196 | { 197 | return _shadow; 198 | } 199 | 200 | /** 201 | * @private 202 | */ 203 | public function set shadow(Color:uint):void 204 | { 205 | _shadow = Color; 206 | calcFrame(); 207 | } 208 | 209 | /** 210 | * Internal function to update the current animation frame. 211 | */ 212 | override protected function calcFrame():void 213 | { 214 | if(_regen) 215 | { 216 | //Need to generate a new buffer to store the text graphic 217 | var nl:uint = _tf.numLines; 218 | height = 0; 219 | for(var i:uint = 0; i < nl; i++) 220 | height += _tf.getLineMetrics(i).height; 221 | height += 4; //account for 2px gutter on top and bottom 222 | _pixels = new BitmapData(width,height,true,0); 223 | _bbb = new BitmapData(width,height,true,0); 224 | frameHeight = height; 225 | _tf.height = height*1.2; 226 | _flashRect.x = 0; 227 | _flashRect.y = 0; 228 | _flashRect.width = width; 229 | _flashRect.height = height; 230 | _regen = false; 231 | } 232 | else //Else just clear the old buffer before redrawing the text 233 | _pixels.fillRect(_flashRect,0); 234 | 235 | if((_tf != null) && (_tf.text != null) && (_tf.text.length > 0)) 236 | { 237 | //Now that we've cleared a buffer, we need to actually render the text to it 238 | var tf:TextFormat = _tf.defaultTextFormat; 239 | var tfa:TextFormat = tf; 240 | _mtx.identity(); 241 | //If it's a single, centered line of text, we center it ourselves so it doesn't blur to hell 242 | if((tf.align == "center") && (_tf.numLines == 1)) 243 | { 244 | tfa = new TextFormat(tf.font,tf.size,tf.color,null,null,null,null,null,"left"); 245 | _tf.setTextFormat(tfa); 246 | _mtx.translate(Math.floor((width - _tf.getLineMetrics(0).width)/2),0); 247 | } 248 | //Render a single pixel shadow beneath the text 249 | if(_shadow > 0) 250 | { 251 | _tf.setTextFormat(new TextFormat(tfa.font,tfa.size,_shadow,null,null,null,null,null,tfa.align)); 252 | _mtx.translate(1,1); 253 | _pixels.draw(_tf,_mtx,_ct); 254 | _mtx.translate(-1,-1); 255 | _tf.setTextFormat(new TextFormat(tfa.font,tfa.size,tfa.color,null,null,null,null,null,tfa.align)); 256 | } 257 | //Actually draw the text onto the buffer 258 | _pixels.draw(_tf,_mtx,_ct); 259 | _tf.setTextFormat(new TextFormat(tf.font,tf.size,tf.color,null,null,null,null,null,tf.align)); 260 | } 261 | 262 | //Finally, update the visible pixels 263 | if((_framePixels == null) || (_framePixels.width != _pixels.width) || (_framePixels.height != _pixels.height)) 264 | _framePixels = new BitmapData(_pixels.width,_pixels.height,true,0); 265 | _framePixels.copyPixels(_pixels,_flashRect,_flashPointZero); 266 | if(FlxG.showBounds) 267 | drawBounds(); 268 | if(solid) 269 | refreshHulls(); 270 | } 271 | 272 | /** 273 | * A helper function for updating the TextField that we use for rendering. 274 | * 275 | * @return A writable copy of TextField.defaultTextFormat. 276 | */ 277 | protected function dtfCopy():TextFormat 278 | { 279 | var dtf:TextFormat = _tf.defaultTextFormat; 280 | return new TextFormat(dtf.font,dtf.size,dtf.color,dtf.bold,dtf.italic,dtf.underline,dtf.url,dtf.target,dtf.align); 281 | } 282 | } 283 | } 284 | -------------------------------------------------------------------------------- /org/flixel/FlxPreloader.as: -------------------------------------------------------------------------------- 1 | package org.flixel 2 | { 3 | import flash.display.Bitmap; 4 | import flash.display.BitmapData; 5 | import flash.display.DisplayObject; 6 | import flash.display.MovieClip; 7 | import flash.display.Sprite; 8 | import flash.display.StageAlign; 9 | import flash.display.StageScaleMode; 10 | import flash.events.Event; 11 | import flash.events.MouseEvent; 12 | import flash.net.URLRequest; 13 | import flash.net.navigateToURL; 14 | import flash.text.TextField; 15 | import flash.text.TextFormat; 16 | import flash.utils.getDefinitionByName; 17 | import flash.utils.getTimer; 18 | 19 | 20 | /** 21 | * This class handles the 8-bit style preloader. 22 | */ 23 | public class FlxPreloader extends MovieClip 24 | { 25 | [Embed(source="data/logo.png")] protected var ImgLogo:Class; 26 | [Embed(source="data/logo_corners.png")] protected var ImgLogoCorners:Class; 27 | [Embed(source="data/logo_light.png")] protected var ImgLogoLight:Class; 28 | 29 | /** 30 | * @private 31 | */ 32 | protected var _init:Boolean; 33 | /** 34 | * @private 35 | */ 36 | protected var _buffer:Sprite; 37 | /** 38 | * @private 39 | */ 40 | protected var _bmpBar:Bitmap; 41 | /** 42 | * @private 43 | */ 44 | protected var _text:TextField; 45 | /** 46 | * Useful for storing "real" stage width if you're scaling your preloader graphics. 47 | */ 48 | protected var _width:uint; 49 | /** 50 | * Useful for storing "real" stage height if you're scaling your preloader graphics. 51 | */ 52 | protected var _height:uint; 53 | /** 54 | * @private 55 | */ 56 | protected var _logo:Bitmap; 57 | /** 58 | * @private 59 | */ 60 | protected var _logoGlow:Bitmap; 61 | /** 62 | * @private 63 | */ 64 | protected var _min:uint; 65 | 66 | /** 67 | * This should always be the name of your main project/document class (e.g. GravityHook). 68 | */ 69 | public var className:String; 70 | /** 71 | * Set this to your game's URL to use built-in site-locking. 72 | */ 73 | public var myURL:String; 74 | /** 75 | * Change this if you want the flixel logo to show for more or less time. Default value is 0 seconds. 76 | */ 77 | public var minDisplayTime:Number; 78 | 79 | /** 80 | * Constructor 81 | */ 82 | public function FlxPreloader() 83 | { 84 | minDisplayTime = 0; 85 | 86 | stop(); 87 | stage.scaleMode = StageScaleMode.NO_SCALE; 88 | stage.align = StageAlign.TOP_LEFT; 89 | 90 | //Check if we are on debug or release mode and set _DEBUG accordingly 91 | try 92 | { 93 | throw new Error("Setting global debug flag..."); 94 | } 95 | catch(e:Error) 96 | { 97 | var re:RegExp = /\[.*:[0-9]+\]/; 98 | FlxG.debug = re.test(e.getStackTrace()); 99 | } 100 | 101 | var tmp:Bitmap; 102 | if(!FlxG.debug && (myURL != null) && (root.loaderInfo.url.indexOf(myURL) < 0)) 103 | { 104 | tmp = new Bitmap(new BitmapData(stage.stageWidth,stage.stageHeight,true,0xFFFFFFFF)); 105 | addChild(tmp); 106 | 107 | var fmt:TextFormat = new TextFormat(); 108 | fmt.color = 0x000000; 109 | fmt.size = 16; 110 | fmt.align = "center"; 111 | fmt.bold = true; 112 | fmt.font = "system"; 113 | 114 | var txt:TextField = new TextField(); 115 | txt.width = tmp.width-16; 116 | txt.height = tmp.height-16; 117 | txt.y = 8; 118 | txt.multiline = true; 119 | txt.wordWrap = true; 120 | txt.embedFonts = true; 121 | txt.defaultTextFormat = fmt; 122 | 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!"; 123 | addChild(txt); 124 | 125 | txt.addEventListener(MouseEvent.CLICK,goToMyURL); 126 | tmp.addEventListener(MouseEvent.CLICK,goToMyURL); 127 | return; 128 | } 129 | _init = false; 130 | addEventListener(Event.ENTER_FRAME, onEnterFrame); 131 | } 132 | 133 | private function goToMyURL(event:MouseEvent=null):void 134 | { 135 | navigateToURL(new URLRequest("http://"+myURL)); 136 | } 137 | 138 | private function onEnterFrame(event:Event):void 139 | { 140 | if(!_init) 141 | { 142 | if((stage.stageWidth <= 0) || (stage.stageHeight <= 0)) 143 | return; 144 | create(); 145 | _init = true; 146 | } 147 | var i:int; 148 | graphics.clear(); 149 | var time:uint = getTimer(); 150 | if((framesLoaded >= totalFrames) && (time > _min)) 151 | { 152 | removeEventListener(Event.ENTER_FRAME, onEnterFrame); 153 | nextFrame(); 154 | var mainClass:Class = Class(getDefinitionByName(className)); 155 | if(mainClass) 156 | { 157 | var app:Object = new mainClass(); 158 | addChild(app as DisplayObject); 159 | } 160 | removeChild(_buffer); 161 | } 162 | else 163 | { 164 | var percent:Number = root.loaderInfo.bytesLoaded/root.loaderInfo.bytesTotal; 165 | if((_min > 0) && (percent > time/_min)) 166 | percent = time/_min; 167 | update(percent); 168 | } 169 | } 170 | 171 | /** 172 | * Override this to create your own preloader objects. 173 | * Highly recommended you also override update()! 174 | */ 175 | protected function create():void 176 | { 177 | _min = 0; 178 | if(!FlxG.debug) 179 | _min = minDisplayTime*1000; 180 | _buffer = new Sprite(); 181 | _buffer.scaleX = 2; 182 | _buffer.scaleY = 2; 183 | addChild(_buffer); 184 | _width = stage.stageWidth/_buffer.scaleX; 185 | _height = stage.stageHeight/_buffer.scaleY; 186 | _buffer.addChild(new Bitmap(new BitmapData(_width,_height,false,0x00345e))); 187 | var b:Bitmap = new ImgLogoLight(); 188 | b.smoothing = true; 189 | b.width = b.height = _height; 190 | b.x = (_width-b.width)/2; 191 | _buffer.addChild(b); 192 | _bmpBar = new Bitmap(new BitmapData(1,7,false,0x5f6aff)); 193 | _bmpBar.x = 4; 194 | _bmpBar.y = _height-11; 195 | _buffer.addChild(_bmpBar); 196 | _text = new TextField(); 197 | _text.defaultTextFormat = new TextFormat("system",8,0x5f6aff); 198 | _text.embedFonts = true; 199 | _text.selectable = false; 200 | _text.multiline = false; 201 | _text.x = 2; 202 | _text.y = _bmpBar.y - 11; 203 | _text.width = 80; 204 | _buffer.addChild(_text); 205 | _logo = new ImgLogo(); 206 | _logo.scaleX = _logo.scaleY = _height/8; 207 | _logo.x = (_width-_logo.width)/2; 208 | _logo.y = (_height-_logo.height)/2; 209 | _buffer.addChild(_logo); 210 | _logoGlow = new ImgLogo(); 211 | _logoGlow.smoothing = true; 212 | _logoGlow.blendMode = "screen"; 213 | _logoGlow.scaleX = _logoGlow.scaleY = _height/8; 214 | _logoGlow.x = (_width-_logoGlow.width)/2; 215 | _logoGlow.y = (_height-_logoGlow.height)/2; 216 | _buffer.addChild(_logoGlow); 217 | b = new ImgLogoCorners(); 218 | b.smoothing = true; 219 | b.width = _width; 220 | b.height = _height; 221 | _buffer.addChild(b); 222 | b = new Bitmap(new BitmapData(_width,_height,false,0xffffff)); 223 | for(var i:uint = 0; i < _height; i+=2) 224 | for(var j:uint = 0; j < _width; j++) 225 | b.bitmapData.setPixel(j,i,0); 226 | b.blendMode = "overlay"; 227 | b.alpha = 0.25; 228 | _buffer.addChild(b); 229 | } 230 | 231 | /** 232 | * Override this function to manually update the preloader. 233 | * 234 | * @param Percent How much of the program has loaded. 235 | */ 236 | protected function update(Percent:Number):void 237 | { 238 | _bmpBar.scaleX = Percent*(_width-8); 239 | _text.text = "FLX v"+FlxG.LIBRARY_MAJOR_VERSION+"."+FlxG.LIBRARY_MINOR_VERSION+" "+FlxU.floor(Percent*100)+"%"; 240 | _text.setTextFormat(_text.defaultTextFormat); 241 | if(Percent < 0.1) 242 | { 243 | _logoGlow.alpha = 0; 244 | _logo.alpha = 0; 245 | } 246 | else if(Percent < 0.15) 247 | { 248 | _logoGlow.alpha = FlxU.random(false); 249 | _logo.alpha = 0; 250 | } 251 | else if(Percent < 0.2) 252 | { 253 | _logoGlow.alpha = 0; 254 | _logo.alpha = 0; 255 | } 256 | else if(Percent < 0.25) 257 | { 258 | _logoGlow.alpha = 0; 259 | _logo.alpha = FlxU.random(false); 260 | } 261 | else if(Percent < 0.7) 262 | { 263 | _logoGlow.alpha = (Percent-0.45)/0.45; 264 | _logo.alpha = 1; 265 | } 266 | else if((Percent > 0.8) && (Percent < 0.9)) 267 | { 268 | _logoGlow.alpha = 1-(Percent-0.8)/0.1; 269 | _logo.alpha = 0; 270 | } 271 | else if(Percent > 0.9) 272 | { 273 | _buffer.alpha = 1-(Percent-0.9)/0.1; 274 | } 275 | } 276 | } 277 | } 278 | -------------------------------------------------------------------------------- /docs/all-index-X.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | X Index 6 | 7 | 8 | 9 | 10 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 31 |
32 |
33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 43 | 44 | 45 | 46 | 47 | 48 | 50 | 51 | 52 | 53 | 54 | 55 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 |
A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z  
x — Property in class org.flixel.FlxPoint
42 |
x — Property in class org.flixel.data.FlxMouse
49 | Current X position of the mouse pointer in the game world.
x — Property in class org.flixel.data.FlxQuake
56 | The amount of X distortion to apply to the screen.
X — Property in class org.flixel.data.FlxKeyboard
A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z  
71 |

72 | 74 |
75 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /docs/all-index-Y.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Y Index 6 | 7 | 8 | 9 | 10 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 31 |
32 |
33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 43 | 44 | 45 | 46 | 47 | 48 | 50 | 51 | 52 | 53 | 54 | 55 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 |
A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z  
y — Property in class org.flixel.FlxPoint
42 |
y — Property in class org.flixel.data.FlxMouse
49 | Current Y position of the mouse pointer in the game world.
y — Property in class org.flixel.data.FlxQuake
56 | The amount of Y distortion to apply to the screen.
Y — Property in class org.flixel.data.FlxKeyboard
A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z  
71 |

72 | 74 |
75 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /docs/org/flixel/data/FlxAnim.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | org.flixel.data.FlxAnim 9 | 10 | 11 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 32 |
33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 |
Packageorg.flixel.data
Classpublic class FlxAnim
41 |

42 | Just a helper structure for the FlxSprite animation system 43 |

44 |
45 |
46 |
47 | 48 |
49 |
Public Properties
50 | 51 | 52 | 53 | 54 | 55 | 59 | 60 | 61 | 65 | 66 | 67 | 71 | 72 | 73 | 76 | 77 |
 PropertyDefined by
  delay : Number
56 | Seconds between frames (basically the framerate) 57 |
58 |
FlxAnim
  frames : Array
62 | A list of frames stored as uint objects 63 |
64 |
FlxAnim
  looped : Boolean
68 | Whether or not the animation is looped 69 |
70 |
FlxAnim
  name : String
74 | String name of the animation (e.g.
75 |
FlxAnim
78 |
79 | 80 |
81 |
Public Methods
82 | 83 | 84 | 85 | 86 | 87 | 95 | 96 |
 MethodDefined by
   88 |
89 | FlxAnim(Name:String, Frames:Array, FrameRate:Number = 0, Looped:Boolean = true)
90 |
91 | Constructor 92 | 93 |
94 |
FlxAnim
97 |
98 | 102 |
103 | 104 |
Property detail
105 | 106 | 107 | 108 | 109 | 110 |
delayproperty
111 |
112 | public var delay:Number

113 | Seconds between frames (basically the framerate) 114 |

115 | 116 | 117 | 118 | 119 | 120 |
framesproperty 
121 |
122 | public var frames:Array

123 | A list of frames stored as uint objects 124 |

125 | 126 | 127 | 128 | 129 | 130 |
loopedproperty 
131 |
132 | public var looped:Boolean

133 | Whether or not the animation is looped 134 |

135 | 136 | 137 | 138 | 139 | 140 |
nameproperty 
141 |
142 | public var name:String

143 | String name of the animation (e.g. "walk") 144 |

145 | 146 |
Constructor detail
147 | 148 | 149 | 150 | 151 | 152 |
FlxAnim()constructor
153 |
154 | public function FlxAnim(Name:String, Frames:Array, FrameRate:Number = 0, Looped:Boolean = true)

155 | Constructor 156 | 157 |

Parameters 158 | 159 | 160 | 162 | 163 | 164 | 165 | 166 | 167 | 169 | 170 | 171 | 172 | 173 | 174 | 176 | 177 | 178 | 179 | 180 | 181 | 183 | 184 |
Name:String — What this animation should be called (e.g. "run") 161 |
 
Frames:Array — An array of numbers indicating what frames to play in what order (e.g. 1, 2, 3) 168 |
 
FrameRate:Number (default = 0) — The speed in frames per second that the animation should play at (e.g. 40) 175 |
 
Looped:Boolean (default = true) — Whether or not the animation is looped or just plays once 182 |
185 |
186 |
187 |
188 |
189 |
190 |

191 | 193 |
194 | 195 | 196 | 197 | -------------------------------------------------------------------------------- /docs/all-index-Z.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Z Index 6 | 7 | 8 | 9 | 10 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 31 |
32 |
33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 |
A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z  
Z — Property in class org.flixel.data.FlxKeyboard
ZERO — Property in class org.flixel.data.FlxKeyboard
_zeroPoint — Property in class org.flixel.FlxGame
_zoom — Property in class org.flixel.FlxGame
_zoom — Property in class org.flixel.data.FlxQuake
66 | The game's level of zoom.
A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z  
75 |

76 | 78 |
79 | 80 | 81 | 82 | -------------------------------------------------------------------------------- /docs/all-index-J.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | J Index 6 | 7 | 8 | 9 | 10 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 31 |
32 |
33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 55 | 56 | 57 | 58 | 59 | 60 | 62 | 63 | 64 | 65 | 66 | 67 | 69 | 70 | 71 | 72 | 73 | 74 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 |
A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z  
J — Property in class org.flixel.data.FlxKeyboard
junk — Property in class org.flixel.FlxGame
justPressed(Key) — Method in class org.flixel.data.FlxKeyboard
54 | Check to see if this key was just pressed.
justPressed() — Method in class org.flixel.data.FlxMouse
61 | Check to see if the mouse was just pressed.
justReleased(Key) — Method in class org.flixel.data.FlxKeyboard
68 | Check to see if this key is just released.
justReleased() — Method in class org.flixel.data.FlxMouse
75 | Check to see if the mouse was just released.
A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z  
84 |

85 | 87 |
88 | 89 | 90 | 91 | -------------------------------------------------------------------------------- /docs/all-index-W.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | W Index 6 | 7 | 8 | 9 | 10 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 31 |
32 |
33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 49 | 50 | 51 | 52 | 53 | 54 | 56 | 57 | 58 | 59 | 60 | 61 | 63 | 64 | 65 | 66 | 67 | 68 | 71 | 72 | 73 | 74 | 75 | 76 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 |
A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z  
W — Property in class org.flixel.data.FlxKeyboard
width — Static property in class org.flixel.FlxG
48 | The width of the screen in game pixels.
_width — Property in class org.flixel.FlxPreloader
55 | Useful for storing "real" stage width if you're scaling your preloader graphics.
width — Property in class org.flixel.FlxRect
62 |
widthInTiles — Property in class org.flixel.FlxTilemap
69 | Read-only variable, do NOT recommend changing after the map is loaded! 70 |
write(FieldName, FieldValue, MinFileSize) — Method in class org.flixel.FlxSave
77 | If you don't like to access the data object directly, you can use this to write to it.
A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z  
86 |

87 | 89 |
90 | 91 | 92 | 93 | -------------------------------------------------------------------------------- /docs/all-index-Q.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Q Index 6 | 7 | 8 | 9 | 10 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 31 |
32 |
33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 49 | 50 | 51 | 52 | 53 | 54 | 56 | 57 | 58 | 59 | 60 | 61 | 63 | 64 | 65 | 66 | 67 | 68 | 70 | 71 | 72 | 73 | 74 | 75 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 |
A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z  
Q — Property in class org.flixel.data.FlxKeyboard
quadTree — Static property in class org.flixel.FlxU
48 | The global quad tree (stored here since it is used primarily by FlxU functions).
quadTreeBounds — Static property in class org.flixel.FlxU
55 | This variable stores the dimensions of the root of the quad tree.
quadTreeDivisions — Static property in class org.flixel.FlxU
62 | Controls the granularity of the quad tree.
quake — Static property in class org.flixel.FlxG
69 | A special effect that shakes the screen.
quantity — Property in class org.flixel.FlxEmitter
76 | The number of particles to launch at a time.
QUOTE — Property in class org.flixel.data.FlxKeyboard
A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z  
91 |

92 | 94 |
95 | 96 | 97 | 98 | --------------------------------------------------------------------------------