Package | org.flixel |
Class | public class FlxG |
Inheritance | FlxG Object |
FlxU
.
FlxG
is specifically for Flixel-specific properties.
Property | Defined By | ||
---|---|---|---|
bgColor : uint [static]
Get and set the background color of the game. | FlxG | ||
camera : FlxCamera [static]
By default this just refers to the first entry in the cameras array
declared above, but you can do what you like with it. | FlxG | ||
cameras : Array [static]
An array of FlxCamera objects that are used to draw stuff. | FlxG | ||
debug : Boolean [static]
Whether you are running in Debug or Release mode. | FlxG | ||
elapsed : Number [static]
Represents the amount of time in seconds that passed since last frame. | FlxG | ||
flashFramerate : Number [static]
How many times you want your game to update each second. | FlxG | ||
flashGfx : Graphics [static] | FlxG | ||
flashGfxSprite : Sprite [static]
Useful helper objects for doing Flash-specific rendering. | FlxG | ||
framerate : Number [static]
How many times you want your game to update each second. | FlxG | ||
_game : FlxGame [static]
Internal tracker for game object. | FlxG | ||
globalSeed : Number [static]
The global random number generator seed (for deterministic behavior in recordings and saves). | FlxG | ||
height : uint [static]
The height of the screen in game pixels. | FlxG | ||
keys : Keyboard [static]
A reference to a FlxKeyboard object. | FlxG | ||
level : int [static] | FlxG | ||
levels : Array [static]
FlxG.levels and FlxG.scores are generic
global variables that can be used for various cross-state stuff. | FlxG | ||
LIBRARY_MAJOR_VERSION : uint = 2 [static]
Assign a major version to your library. | FlxG | ||
LIBRARY_MINOR_VERSION : uint = 55 [static]
Assign a minor version to your library. | FlxG | ||
LIBRARY_NAME : String = flixel [static]
If you build and maintain your own version of flixel,
you can give it your own name here. | FlxG | ||
mobile : Boolean [static]
Setting this to true will disable/skip stuff that isn't necessary for mobile platforms like Android. | FlxG | ||
mouse : Mouse [static]
A reference to a FlxMouse object. | FlxG | ||
music : FlxSound [static]
A handy container for a background music object. | FlxG | ||
mute : Boolean [static]
Whether or not the game sounds are muted. | FlxG | ||
paused : Boolean [static]
Handy shared variable for implementing your own pause behavior. | FlxG | ||
plugins : Array [static]
An array container for plugins. | FlxG | ||
save : int [static] | FlxG | ||
saves : Array [static]
FlxG.saves is a generic bucket for storing
FlxSaves so you can access them whenever you want. | FlxG | ||
score : int [static] | FlxG | ||
scores : Array [static] | FlxG | ||
sounds : FlxGroup [static]
A list of all the sounds being played in the game. | FlxG | ||
stage : Stage [static] [read-only]
Read-only: retrieves the Flash stage object (required for event listeners)
Will be null if it's not safe/useful yet. | FlxG | ||
state : FlxState [static] [read-only]
Read-only: access the current game state from anywhere. | FlxG | ||
timeScale : Number [static]
How fast or slow time should pass in the game; default is 1.0. | FlxG | ||
useBufferLocking : Boolean [static]
Allows you to possibly slightly optimize the rendering process IF
you are not doing any pre-processing in your game state's draw() call. | FlxG | ||
visualDebug : Boolean [static]
Whether to show visual debug displays or not. | FlxG | ||
volume : Number [static]
Set volume to a number between 0 and 1 to change the global volume. | FlxG | ||
volumeHandler : Function [static]
Set this hook to get a callback whenever the volume changes. | FlxG | ||
width : uint [static]
The width of the screen in game pixels. | FlxG | ||
worldBounds : FlxRect [static]
The dimensions of the game world, used by the quad tree for collisions and overlap checks. | FlxG | ||
worldDivisions : uint [static]
How many times the quad tree should divide the world on each axis. | FlxG |
Property | Defined By | ||
---|---|---|---|
_cache : Object [static]
Internal storage system to prevent graphics from being used repeatedly in memory. | FlxG | ||
_cameraRect : Rectangle [static]
Internal helper variable for clearing the cameras each frame. | FlxG | ||
_volume : Number [static]
Internal volume level, used for global sound control. | FlxG |
Method | Defined By | ||
---|---|---|---|
addBitmap(Graphic:Class, Reverse:Boolean = false, Unique:Boolean = false, Key:String = null):BitmapData [static]
Loads a bitmap from a file, caches it, and generates a horizontally flipped version if necessary. | FlxG | ||
[static]
Add a new camera object to the game. | FlxG | ||
[static]
Adds a new plugin to the global plugin array. | FlxG | ||
checkBitmapCache(Key:String):Boolean [static]
Check the local bitmap cache to see if a bitmap with this key has been loaded already. | FlxG | ||
clearBitmapCache():void [static]
Dumps the cache's image references. | FlxG | ||
collide(ObjectOrGroup1:FlxBasic = null, ObjectOrGroup2:FlxBasic = null, NotifyCallback:Function = null):Boolean [static]
Call this function to see if one FlxObject collides with another. | FlxG | ||
createBitmap(Width:uint, Height:uint, Color:uint, Unique:Boolean = false, Key:String = null):BitmapData [static]
Generates a new BitmapData object (a colored square) and caches it. | FlxG | ||
destroySounds(ForceDestroy:Boolean = false):void [static]
Called by FlxGame on state changes to stop and destroy sounds. | FlxG | ||
drawPlugins():void [static]
Used by the game object to call draw() on all the plugins. | FlxG | ||
fade(Color:uint = 0xff000000, Duration:Number = 1, OnComplete:Function = null, Force:Boolean = false):void [static]
The screen is gradually filled with this color. | FlxG | ||
flash(Color:uint = 0xffffffff, Duration:Number = 1, OnComplete:Function = null, Force:Boolean = false):void [static]
All screens are filled with this color and gradually return to normal. | FlxG | ||
getLibraryName():String [static] | FlxG | ||
[static]
Retrieves a plugin based on its class name from the global plugin array. | FlxG | ||
getRandom(Objects:Array, StartIndex:uint = 0, Length:uint = 0):Object [static]
Fetch a random entry from the given array. | FlxG | ||
[static]
Called by FlxGame to set up FlxG during FlxGame's constructor. | FlxG | ||
loadReplay(Data:String, State:FlxState = null, CancelKeys:Array = null, Timeout:Number = 0, Callback:Function = null):void [static]
Load replay data from a string and play it back. | FlxG | ||
loadSound(EmbeddedSound:Class = null, Volume:Number = 1.0, Looped:Boolean = false, AutoDestroy:Boolean = false, AutoPlay:Boolean = false, URL:String = null):FlxSound [static]
Creates a new sound object. | FlxG | ||
lockCameras():void [static]
Called by the game object to lock all the camera buffers and clear them for the next draw pass. | FlxG | ||
log(Data:Object):void [static]
Log data to the debugger. | FlxG | ||
overlap(ObjectOrGroup1:FlxBasic = null, ObjectOrGroup2:FlxBasic = null, NotifyCallback:Function = null, ProcessCallback:Function = null):Boolean [static]
Call this function to see if one FlxObject overlaps another. | FlxG | ||
pauseSounds():void [static]
Pause all sounds currently playing. | FlxG | ||
play(EmbeddedSound:Class, Volume:Number = 1.0, Looped:Boolean = false, AutoDestroy:Boolean = true):FlxSound [static]
Creates a new sound object from an embedded Class object. | FlxG | ||
playMusic(Music:Class, Volume:Number = 1.0):void [static]
Set up and play a looping background soundtrack. | FlxG | ||
random():Number [static]
Generates a random number. | FlxG | ||
recordReplay(StandardMode:Boolean = true):void [static]
Resets the game or state and requests a new recording. | FlxG | ||
reloadReplay(StandardMode:Boolean = true):void [static]
Resets the game or state and replay requested flag. | FlxG | ||
removeCamera(Camera:FlxCamera, Destroy:Boolean = true):void [static]
Remove a camera from the game. | FlxG | ||
[static]
Removes an instance of a plugin from the global plugin array. | FlxG | ||
removePluginType(ClassType:Class):Boolean [static]
Removes an instance of a plugin from the global plugin array. | FlxG | ||
reset():void [static]
Called whenever the game is reset, doesn't have to do quite as much work as the basic initialization stuff. | FlxG | ||
resetCameras(NewCamera:FlxCamera = null):void [static]
Dumps all the current cameras and resets to just one camera. | FlxG | ||
resetDebuggerLayout():void [static]
Just resets the debugger windows to whatever the last selected layout was (DEBUGGER_STANDARD by default). | FlxG | ||
resetGame():void [static]
Like hitting the reset button on a game console, this will re-launch the game as if it just started. | FlxG | ||
resetInput():void [static]
Reset the input helper objects (useful when changing screens or states)
| FlxG | ||
resetState():void [static]
Request a reset of the current game state. | FlxG | ||
resumeSounds():void [static]
Resume playing existing sounds. | FlxG | ||
setDebuggerLayout(Layout:uint):void [static]
Change the way the debugger's windows are laid out. | FlxG | ||
shake(Intensity:Number = 0.05, Duration:Number = 0.5, OnComplete:Function = null, Force:Boolean = true, Direction:uint = 0):void [static]
A simple screen-shake effect. | FlxG | ||
shuffle(Objects:Array, HowManyTimes:uint):Array [static]
Shuffles the entries in an array into a new random order. | FlxG | ||
stopRecording():String [static]
Stop recording the current replay and return the replay data. | FlxG | ||
stopReplay():void [static]
Stops the current replay. | FlxG | ||
stream(URL:String, Volume:Number = 1.0, Looped:Boolean = false, AutoDestroy:Boolean = true):FlxSound [static]
Creates a new sound object from a URL. | FlxG | ||
switchState(State:FlxState):void [static]
Switch from the current game state to the one specified here. | FlxG | ||
unlockCameras():void [static]
Called by the game object to draw the special FX and unlock all the camera buffers. | FlxG | ||
unwatch(AnyObject:Object, VariableName:String = null):void [static]
Remove a variable from the watch list in the debugger. | FlxG | ||
updateCameras():void [static]
Called by the game object to update the cameras and their tracking/special effects logic. | FlxG | ||
updateInput():void [static]
Called by the game object to update the keyboard and mouse input tracking objects. | FlxG | ||
updatePlugins():void [static]
Used by the game object to call update() on all the plugins. | FlxG | ||
updateSounds():void [static]
Called by the game loop to make sure the sounds get updated each frame. | FlxG | ||
watch(AnyObject:Object, VariableName:String, DisplayName:String = null):void [static]
Add a variable to the watch list in the debugger. | FlxG |
Constant | Defined By | ||
---|---|---|---|
BLACK : uint = 0xff000000 [static]
And black too. | FlxG | ||
BLUE : uint = 0xff0090e9 [static]
Blue is used to indicate non-solid objects. | FlxG | ||
DEBUGGER_BIG : uint = 2 [static]
Debugger overlay layout preset: Large windows taking up bottom half of screen. | FlxG | ||
DEBUGGER_LEFT : uint = 4 [static]
Debugger overlay layout preset: Large windows taking up left third of screen. | FlxG | ||
DEBUGGER_MICRO : uint = 1 [static]
Debugger overlay layout preset: Tiny windows in the screen corners. | FlxG | ||
DEBUGGER_RIGHT : uint = 5 [static]
Debugger overlay layout preset: Large windows taking up right third of screen. | FlxG | ||
DEBUGGER_STANDARD : uint = 0 [static]
Debugger overlay layout preset: Wide but low windows at the bottom of the screen. | FlxG | ||
DEBUGGER_TOP : uint = 3 [static]
Debugger overlay layout preset: Wide but low windows at the top of the screen. | FlxG | ||
GREEN : uint = 0xff00f225 [static]
Green is used to indicate solid but immovable objects. | FlxG | ||
PINK : uint = 0xfff01eff [static]
Pink is used to indicate objects that are only partially solid, like one-way platforms. | FlxG | ||
RED : uint = 0xffff0012 [static]
Some handy color presets. | FlxG | ||
WHITE : uint = 0xffffffff [static]
White... | FlxG |
_cache | property |
protected static var _cache:Object
Internal storage system to prevent graphics from being used repeatedly in memory.
_cameraRect | property |
protected static var _cameraRect:Rectangle
Internal helper variable for clearing the cameras each frame.
_game | property |
public static var _game:FlxGame
Internal tracker for game object.
_volume | property |
protected static var _volume:Number
Internal volume level, used for global sound control.
bgColor | property |
bgColor:uint
Get and set the background color of the game. Get functionality is equivalent to FlxG.camera.bgColor. Set functionality sets the background color of all the current cameras.
public static function get bgColor():uint
public static function set bgColor(value:uint):void
camera | property |
public static var camera:FlxCamera
By default this just refers to the first entry in the cameras array declared above, but you can do what you like with it.
cameras | property |
public static var cameras:Array
An array of FlxCamera
objects that are used to draw stuff.
By default flixel creates one camera the size of the screen.
debug | property |
public static var debug:Boolean
Whether you are running in Debug or Release mode.
Set automatically by FlxPreloader
during startup.
elapsed | property |
public static var elapsed:Number
Represents the amount of time in seconds that passed since last frame.
flashFramerate | property |
flashFramerate:Number
How many times you want your game to update each second. More updates usually means better collisions and smoother motion. NOTE: This is NOT the same thing as the Flash Player framerate!
public static function get flashFramerate():Number
public static function set flashFramerate(value:Number):void
flashGfx | property |
public static var flashGfx:Graphics
flashGfxSprite | property |
public static var flashGfxSprite:Sprite
Useful helper objects for doing Flash-specific rendering. Primarily used for "debug visuals" like drawing bounding boxes directly to the screen buffer.
framerate | property |
framerate:Number
How many times you want your game to update each second. More updates usually means better collisions and smoother motion. NOTE: This is NOT the same thing as the Flash Player framerate!
public static function get framerate():Number
public static function set framerate(value:Number):void
globalSeed | property |
public static var globalSeed:Number
The global random number generator seed (for deterministic behavior in recordings and saves).
height | property |
public static var height:uint
The height of the screen in game pixels.
keys | property |
public static var keys:Keyboard
A reference to a FlxKeyboard
object. Important for input!
level | property |
public static var level:int
levels | property |
public static var levels:Array
FlxG.levels
and FlxG.scores
are generic
global variables that can be used for various cross-state stuff.
LIBRARY_MAJOR_VERSION | property |
public static var LIBRARY_MAJOR_VERSION:uint = 2
Assign a major version to your library. Appears before the decimal in the console.
LIBRARY_MINOR_VERSION | property |
public static var LIBRARY_MINOR_VERSION:uint = 55
Assign a minor version to your library. Appears after the decimal in the console.
LIBRARY_NAME | property |
public static var LIBRARY_NAME:String = flixel
If you build and maintain your own version of flixel, you can give it your own name here.
mobile | property |
public static var mobile:Boolean
Setting this to true will disable/skip stuff that isn't necessary for mobile platforms like Android. [BETA]
mouse | property |
public static var mouse:Mouse
A reference to a FlxMouse
object. Important for input!
music | property |
public static var music:FlxSound
A handy container for a background music object.
mute | property |
public static var mute:Boolean
Whether or not the game sounds are muted.
paused | property |
public static var paused:Boolean
Handy shared variable for implementing your own pause behavior.
plugins | property |
public static var plugins:Array
An array container for plugins. By default flixel uses a couple of plugins: DebugPathDisplay, and TimerManager.
save | property |
public static var save:int
saves | property |
public static var saves:Array
FlxG.saves
is a generic bucket for storing
FlxSaves so you can access them whenever you want.
score | property |
public static var score:int
scores | property |
public static var scores:Array
sounds | property |
public static var sounds:FlxGroup
A list of all the sounds being played in the game.
stage | property |
stage:Stage
[read-only] Read-only: retrieves the Flash stage object (required for event listeners) Will be null if it's not safe/useful yet.
public static function get stage():Stage
state | property |
state:FlxState
[read-only] Read-only: access the current game state from anywhere.
public static function get state():FlxState
timeScale | property |
public static var timeScale:Number
How fast or slow time should pass in the game; default is 1.0.
useBufferLocking | property |
public static var useBufferLocking:Boolean
Allows you to possibly slightly optimize the rendering process IF
you are not doing any pre-processing in your game state's draw()
call.
The default value is false
.
visualDebug | property |
public static var visualDebug:Boolean
Whether to show visual debug displays or not. Default = false.
volume | property |
volume:Number
Set volume
to a number between 0 and 1 to change the global volume.
The default value is 0.5
.
public static function get volume():Number
public static function set volume(value:Number):void
volumeHandler | property |
public static var volumeHandler:Function
Set this hook to get a callback whenever the volume changes.
Function should take the form myVolumeHandler(Volume:Number)
.
width | property |
public static var width:uint
The width of the screen in game pixels.
worldBounds | property |
public static var worldBounds:FlxRect
The dimensions of the game world, used by the quad tree for collisions and overlap checks.
worldDivisions | property |
public static var worldDivisions:uint
How many times the quad tree should divide the world on each axis. Generally, sparse collisions can have fewer divisons, while denser collision activity usually profits from more. Default value is 6.
addBitmap | () | method |
public static function addBitmap(Graphic:Class, Reverse:Boolean = false, Unique:Boolean = false, Key:String = null):BitmapData
Loads a bitmap from a file, caches it, and generates a horizontally flipped version if necessary.
Parameters
Graphic:Class — The image file that you want to load.
| |
Reverse:Boolean (default = false ) — Whether to generate a flipped version.
| |
Unique:Boolean (default = false ) — Ensures that the bitmap data uses a new slot in the cache.
| |
Key:String (default = null ) — Force the cache to use a specific Key to index the bitmap.
|
BitmapData — The BitmapData we just created.
|
addCamera | () | method |
public static function addCamera(NewCamera:FlxCamera):FlxCamera
Add a new camera object to the game. Handy for PiP, split-screen, etc.
Parameters
NewCamera:FlxCamera — The camera you want to add.
|
FlxCamera — This FlxCamera instance.
|
addPlugin | () | method |
public static function addPlugin(Plugin:FlxBasic):FlxBasic
Adds a new plugin to the global plugin array.
Parameters
Plugin:FlxBasic — Any object that extends FlxBasic. Useful for managers and other things. See org.flixel.plugin for some examples!
|
FlxBasic — The same FlxBasic -based plugin you passed in.
|
checkBitmapCache | () | method |
public static function checkBitmapCache(Key:String):Boolean
Check the local bitmap cache to see if a bitmap with this key has been loaded already.
Parameters
Key:String — The string key identifying the bitmap.
|
Boolean — Whether or not this file can be found in the cache.
|
clearBitmapCache | () | method |
public static function clearBitmapCache():void
Dumps the cache's image references.
collide | () | method |
public static function collide(ObjectOrGroup1:FlxBasic = null, ObjectOrGroup2:FlxBasic = null, NotifyCallback:Function = null):Boolean
Call this function to see if one FlxObject
collides with another.
Can be called with one object and one group, or two groups, or two objects,
whatever floats your boat! For maximum performance try bundling a lot of objects
together using a FlxGroup
(or even bundling groups together!).
This function just calls FlxG.overlap and presets the ProcessCallback parameter to FlxObject.separate. To create your own collision logic, write your own ProcessCallback and use FlxG.overlap to set it up.
NOTE: does NOT take objects' scrollfactor into account, all overlaps are checked in world space.
Parameters
ObjectOrGroup1:FlxBasic (default = null ) — The first object or group you want to check.
| |
ObjectOrGroup2:FlxBasic (default = null ) — The second object or group you want to check. If it is the same as the first, flixel knows to just do a comparison within that group.
| |
NotifyCallback:Function (default = null ) — A function with two FlxObject parameters - e.g. myOverlapFunction(Object1:FlxObject,Object2:FlxObject) - that is called if those two objects overlap.
|
Boolean — Whether any objects were successfully collided/separated.
|
createBitmap | () | method |
public static function createBitmap(Width:uint, Height:uint, Color:uint, Unique:Boolean = false, Key:String = null):BitmapData
Generates a new BitmapData
object (a colored square) and caches it.
Parameters
Width:uint — How wide the square should be.
| |
Height:uint — How high the square should be.
| |
Color:uint — What color the square should be (0xAARRGGBB)
| |
Unique:Boolean (default = false ) — Ensures that the bitmap data uses a new slot in the cache.
| |
Key:String (default = null ) — Force the cache to use a specific Key to index the bitmap.
|
BitmapData — The BitmapData we just created.
|
destroySounds | () | method |
public static function destroySounds(ForceDestroy:Boolean = false):void
Called by FlxGame on state changes to stop and destroy sounds.
Parameters
ForceDestroy:Boolean (default = false ) — Kill sounds even if they're flagged survive .
|
drawPlugins | () | method |
public static function drawPlugins():void
Used by the game object to call draw()
on all the plugins.
fade | () | method |
public static function fade(Color:uint = 0xff000000, Duration:Number = 1, OnComplete:Function = null, Force:Boolean = false):void
The screen is gradually filled with this color.
Parameters
Color:uint (default = 0xff000000 ) — The color you want to use.
| |
Duration:Number (default = 1 ) — How long it takes for the fade to finish.
| |
OnComplete:Function (default = null ) — A function you want to run when the fade finishes.
| |
Force:Boolean (default = false ) — Force the effect to reset.
|
flash | () | method |
public static function flash(Color:uint = 0xffffffff, Duration:Number = 1, OnComplete:Function = null, Force:Boolean = false):void
All screens are filled with this color and gradually return to normal.
Parameters
Color:uint (default = 0xffffffff ) — The color you want to use.
| |
Duration:Number (default = 1 ) — How long it takes for the flash to fade.
| |
OnComplete:Function (default = null ) — A function you want to run when the flash finishes.
| |
Force:Boolean (default = false ) — Force the effect to reset.
|
getLibraryName | () | method |
public static function getLibraryName():String
ReturnsString |
getPlugin | () | method |
public static function getPlugin(ClassType:Class):FlxBasic
Retrieves a plugin based on its class name from the global plugin array.
Parameters
ClassType:Class — The class name of the plugin you want to retrieve. See the FlxPath or FlxTimer constructors for example usage.
|
FlxBasic — The plugin object, or null if no matching plugin was found.
|
getRandom | () | method |
public static function getRandom(Objects:Array, StartIndex:uint = 0, Length:uint = 0):Object
Fetch a random entry from the given array.
Will return null if random selection is missing, or array has no entries.
FlxG.getRandom()
is deterministic and safe for use with replays/recordings.
HOWEVER, FlxU.getRandom()
is NOT deterministic and unsafe for use with replays/recordings.
Parameters
Objects:Array — A Flash array of objects.
| |
StartIndex:uint (default = 0 ) — Optional offset off the front of the array. Default value is 0, or the beginning of the array.
| |
Length:uint (default = 0 ) — Optional restriction on the number of values you want to randomly select from.
|
Object — The random object that was selected.
|
init | () | method |
public static function init(Game:FlxGame, Width:uint, Height:uint, Zoom:Number):void
Called by FlxGame
to set up FlxG
during FlxGame
's constructor.
Parameters
Game:FlxGame | |
Width:uint | |
Height:uint | |
Zoom:Number |
loadReplay | () | method |
public static function loadReplay(Data:String, State:FlxState = null, CancelKeys:Array = null, Timeout:Number = 0, Callback:Function = null):void
Load replay data from a string and play it back.
Parameters
Data:String — The replay that you want to load.
| |
State:FlxState (default = null ) — Optional parameter: if you recorded a state-specific demo or cutscene, pass a new instance of that state here.
| |
CancelKeys:Array (default = null ) — Optional parameter: an array of string names of keys (see FlxKeyboard) that can be pressed to cancel the playback, e.g. ["ESCAPE","ENTER"]. Also accepts 2 custom key names: "ANY" and "MOUSE" (fairly self-explanatory I hope!).
| |
Timeout:Number (default = 0 ) — Optional parameter: set a time limit for the replay. CancelKeys will override this if pressed.
| |
Callback:Function (default = null ) — Optional parameter: if set, called when the replay finishes. Running to the end, CancelKeys, and Timeout will all trigger Callback(), but only once, and CancelKeys and Timeout will NOT call FlxG.stopReplay() if Callback is set!
|
loadSound | () | method |
public static function loadSound(EmbeddedSound:Class = null, Volume:Number = 1.0, Looped:Boolean = false, AutoDestroy:Boolean = false, AutoPlay:Boolean = false, URL:String = null):FlxSound
Creates a new sound object.
Parameters
EmbeddedSound:Class (default = null ) — The embedded sound resource you want to play. To stream, use the optional URL parameter instead.
| |
Volume:Number (default = 1.0 ) — How loud to play it (0 to 1).
| |
Looped:Boolean (default = false ) — Whether to loop this sound.
| |
AutoDestroy:Boolean (default = false ) — Whether to destroy this sound when it finishes playing. Leave this value set to "false" if you want to re-use this FlxSound instance.
| |
AutoPlay:Boolean (default = false ) — Whether to play the sound.
| |
URL:String (default = null ) — Load a sound from an external web resource instead. Only used if EmbeddedSound = null.
|
FlxSound — A FlxSound object.
|
lockCameras | () | method |
public static function lockCameras():void
Called by the game object to lock all the camera buffers and clear them for the next draw pass.
log | () | method |
public static function log(Data:Object):void
Log data to the debugger.
Parameters
Data:Object — Anything you want to log to the console.
|
overlap | () | method |
public static function overlap(ObjectOrGroup1:FlxBasic = null, ObjectOrGroup2:FlxBasic = null, NotifyCallback:Function = null, ProcessCallback:Function = null):Boolean
Call this function to see if one FlxObject
overlaps another.
Can be called with one object and one group, or two groups, or two objects,
whatever floats your boat! For maximum performance try bundling a lot of objects
together using a FlxGroup
(or even bundling groups together!).
NOTE: does NOT take objects' scrollfactor into account, all overlaps are checked in world space.
Parameters
ObjectOrGroup1:FlxBasic (default = null ) — The first object or group you want to check.
| |
ObjectOrGroup2:FlxBasic (default = null ) — The second object or group you want to check. If it is the same as the first, flixel knows to just do a comparison within that group.
| |
NotifyCallback:Function (default = null ) — A function with two FlxObject parameters - e.g. myOverlapFunction(Object1:FlxObject,Object2:FlxObject) - that is called if those two objects overlap.
| |
ProcessCallback:Function (default = null ) — A function with two FlxObject parameters - e.g. myOverlapFunction(Object1:FlxObject,Object2:FlxObject) - that is called if those two objects overlap. If a ProcessCallback is provided, then NotifyCallback will only be called if ProcessCallback returns true for those objects!
|
Boolean — Whether any oevrlaps were detected.
|
pauseSounds | () | method |
public static function pauseSounds():void
Pause all sounds currently playing.
play | () | method |
public static function play(EmbeddedSound:Class, Volume:Number = 1.0, Looped:Boolean = false, AutoDestroy:Boolean = true):FlxSound
Creates a new sound object from an embedded Class
object.
NOTE: Just calls FlxG.loadSound() with AutoPlay == true.
Parameters
EmbeddedSound:Class — The sound you want to play.
| |
Volume:Number (default = 1.0 ) — How loud to play it (0 to 1).
| |
Looped:Boolean (default = false ) — Whether to loop this sound.
| |
AutoDestroy:Boolean (default = true ) — Whether to destroy this sound when it finishes playing. Leave this value set to "false" if you want to re-use this FlxSound instance.
|
FlxSound — A FlxSound object.
|
playMusic | () | method |
public static function playMusic(Music:Class, Volume:Number = 1.0):void
Set up and play a looping background soundtrack.
Parameters
Music:Class — The sound file you want to loop in the background.
| |
Volume:Number (default = 1.0 ) — How loud the sound should be, from 0 to 1.
|
random | () | method |
public static function random():Number
Generates a random number. Deterministic, meaning safe to use if you want to record replays in random environments.
ReturnsNumber — A Number between 0 and 1.
|
recordReplay | () | method |
public static function recordReplay(StandardMode:Boolean = true):void
Resets the game or state and requests a new recording.
Parameters
StandardMode:Boolean (default = true ) — If true, reset the entire game, else just reset the current state.
|
reloadReplay | () | method |
public static function reloadReplay(StandardMode:Boolean = true):void
Resets the game or state and replay requested flag.
Parameters
StandardMode:Boolean (default = true ) — If true, reload entire game, else just reload current game state.
|
removeCamera | () | method |
public static function removeCamera(Camera:FlxCamera, Destroy:Boolean = true):void
Remove a camera from the game.
Parameters
Camera:FlxCamera — The camera you want to remove.
| |
Destroy:Boolean (default = true ) — Whether to call destroy() on the camera, default value is true.
|
removePlugin | () | method |
public static function removePlugin(Plugin:FlxBasic):FlxBasic
Removes an instance of a plugin from the global plugin array.
Parameters
Plugin:FlxBasic — The plugin instance you want to remove.
|
FlxBasic — The same FlxBasic -based plugin you passed in.
|
removePluginType | () | method |
public static function removePluginType(ClassType:Class):Boolean
Removes an instance of a plugin from the global plugin array.
Parameters
ClassType:Class — The class name of the plugin type you want removed from the array.
|
Boolean — Whether or not at least one instance of this plugin type was removed.
|
reset | () | method |
public static function reset():void
Called whenever the game is reset, doesn't have to do quite as much work as the basic initialization stuff.
resetCameras | () | method |
public static function resetCameras(NewCamera:FlxCamera = null):void
Dumps all the current cameras and resets to just one camera. Handy for doing split-screen especially.
Parameters
NewCamera:FlxCamera (default = null ) — Optional; specify a specific camera object to be the new main camera.
|
resetDebuggerLayout | () | method |
public static function resetDebuggerLayout():void
Just resets the debugger windows to whatever the last selected layout was (DEBUGGER_STANDARD
by default).
resetGame | () | method |
public static function resetGame():void
Like hitting the reset button on a game console, this will re-launch the game as if it just started.
resetInput | () | method |
public static function resetInput():void
Reset the input helper objects (useful when changing screens or states)
resetState | () | method |
public static function resetState():void
Request a reset of the current game state.
resumeSounds | () | method |
public static function resumeSounds():void
Resume playing existing sounds.
setDebuggerLayout | () | method |
public static function setDebuggerLayout(Layout:uint):void
Change the way the debugger's windows are laid out.
Parameters
Layout:uint — See the presets above (e.g. DEBUGGER_MICRO , etc).
|
shake | () | method |
public static function shake(Intensity:Number = 0.05, Duration:Number = 0.5, OnComplete:Function = null, Force:Boolean = true, Direction:uint = 0):void
A simple screen-shake effect.
Parameters
Intensity:Number (default = 0.05 ) — Percentage of screen size representing the maximum distance that the screen can move while shaking.
| |
Duration:Number (default = 0.5 ) — The length in seconds that the shaking effect should last.
| |
OnComplete:Function (default = null ) — A function you want to run when the shake effect finishes.
| |
Force:Boolean (default = true ) — Force the effect to reset (default = true, unlike flash() and fade()!).
| |
Direction:uint (default = 0 ) — Whether to shake on both axes, just up and down, or just side to side (use class constants SHAKE_BOTH_AXES, SHAKE_VERTICAL_ONLY, or SHAKE_HORIZONTAL_ONLY). Default value is SHAKE_BOTH_AXES (0).
|
shuffle | () | method |
public static function shuffle(Objects:Array, HowManyTimes:uint):Array
Shuffles the entries in an array into a new random order.
FlxG.shuffle()
is deterministic and safe for use with replays/recordings.
HOWEVER, FlxU.shuffle()
is NOT deterministic and unsafe for use with replays/recordings.
Parameters
Objects:Array — A Flash Array object containing...stuff.
| |
HowManyTimes:uint — How many swaps to perform during the shuffle operation. Good rule of thumb is 2-4 times as many objects are in the list.
|
Array — The same Flash Array object that you passed in in the first place.
|
stopRecording | () | method |
public static function stopRecording():String
Stop recording the current replay and return the replay data.
ReturnsString — The replay data in simple ASCII format (see FlxReplay.save() ).
|
stopReplay | () | method |
public static function stopReplay():void
Stops the current replay.
stream | () | method |
public static function stream(URL:String, Volume:Number = 1.0, Looped:Boolean = false, AutoDestroy:Boolean = true):FlxSound
Creates a new sound object from a URL. NOTE: Just calls FlxG.loadSound() with AutoPlay == true.
Parameters
URL:String — The URL of the sound you want to play.
| |
Volume:Number (default = 1.0 ) — How loud to play it (0 to 1).
| |
Looped:Boolean (default = false ) — Whether or not to loop this sound.
| |
AutoDestroy:Boolean (default = true ) — Whether to destroy this sound when it finishes playing. Leave this value set to "false" if you want to re-use this FlxSound instance.
|
FlxSound — A FlxSound object.
|
switchState | () | method |
public static function switchState(State:FlxState):void
Switch from the current game state to the one specified here.
Parameters
State:FlxState |
unlockCameras | () | method |
public static function unlockCameras():void
Called by the game object to draw the special FX and unlock all the camera buffers.
unwatch | () | method |
public static function unwatch(AnyObject:Object, VariableName:String = null):void
Remove a variable from the watch list in the debugger. Don't pass a Variable Name to remove all watched variables for the specified object.
Parameters
AnyObject:Object — A reference to any object in your game, e.g. Player or Robot or this.
| |
VariableName:String (default = null ) — The name of the variable you want to watch, in quotes, as a string: e.g. "speed" or "health".
|
updateCameras | () | method |
public static function updateCameras():void
Called by the game object to update the cameras and their tracking/special effects logic.
updateInput | () | method |
public static function updateInput():void
Called by the game object to update the keyboard and mouse input tracking objects.
updatePlugins | () | method |
public static function updatePlugins():void
Used by the game object to call update()
on all the plugins.
updateSounds | () | method |
public static function updateSounds():void
Called by the game loop to make sure the sounds get updated each frame.
watch | () | method |
public static function watch(AnyObject:Object, VariableName:String, DisplayName:String = null):void
Add a variable to the watch list in the debugger. This lets you see the value of the variable all the time.
Parameters
AnyObject:Object — A reference to any object in your game, e.g. Player or Robot or this.
| |
VariableName:String — The name of the variable you want to watch, in quotes, as a string: e.g. "speed" or "health".
| |
DisplayName:String (default = null ) — Optional, display your own string instead of the class name + variable name: e.g. "enemy count".
|
BLACK | Constant |
public static const BLACK:uint = 0xff000000
And black too.
BLUE | Constant |
public static const BLUE:uint = 0xff0090e9
Blue is used to indicate non-solid objects.
DEBUGGER_BIG | Constant |
public static const DEBUGGER_BIG:uint = 2
Debugger overlay layout preset: Large windows taking up bottom half of screen.
DEBUGGER_LEFT | Constant |
public static const DEBUGGER_LEFT:uint = 4
Debugger overlay layout preset: Large windows taking up left third of screen.
DEBUGGER_MICRO | Constant |
public static const DEBUGGER_MICRO:uint = 1
Debugger overlay layout preset: Tiny windows in the screen corners.
DEBUGGER_RIGHT | Constant |
public static const DEBUGGER_RIGHT:uint = 5
Debugger overlay layout preset: Large windows taking up right third of screen.
DEBUGGER_STANDARD | Constant |
public static const DEBUGGER_STANDARD:uint = 0
Debugger overlay layout preset: Wide but low windows at the bottom of the screen.
DEBUGGER_TOP | Constant |
public static const DEBUGGER_TOP:uint = 3
Debugger overlay layout preset: Wide but low windows at the top of the screen.
GREEN | Constant |
public static const GREEN:uint = 0xff00f225
Green is used to indicate solid but immovable objects.
PINK | Constant |
public static const PINK:uint = 0xfff01eff
Pink is used to indicate objects that are only partially solid, like one-way platforms.
RED | Constant |
public static const RED:uint = 0xffff0012
Some handy color presets. Less glaring than pure RGB full values. Primarily used in the visual debugger mode for bounding box displays. Red is used to indicate an active, movable, solid object.
WHITE | Constant |
public static const WHITE:uint = 0xffffffff
White... for white stuff.