Packageorg.flixel
Classpublic class FlxGame
InheritanceFlxGame Inheritance flash.display.Sprite

FlxGame is the heart of all flixel games, and contains a bunch of basic game loops and things. It is a long and sloppy file that you shouldn't have to worry about too much! It is basically only used to create your game object in the first place, after that FlxG and FlxState have all the useful stuff you actually need.



Public Properties
 PropertyDefined By
  _debugger : FlxDebugger
FlxGame
  _debuggerUp : Boolean
FlxGame
  debugOnRelease : Boolean
Initialize and allow the flixel debugger overlay even in release mode.
FlxGame
  _flashFramerate : uint
FlxGame
  _maxAccumulation : uint
FlxGame
  _mouse : Sprite
FlxGame
  _recording : Boolean
FlxGame
  _recordingRequested : Boolean
FlxGame
  _replay : FlxReplay
FlxGame
  _replayCallback : Function
FlxGame
  _replayCancelKeys : Array
FlxGame
  _replaying : Boolean
FlxGame
  _replayRequested : Boolean
FlxGame
  _replayTimer : int
FlxGame
  _requestedReset : Boolean
FlxGame
  _requestedState : FlxState
FlxGame
  _state : FlxState
FlxGame
  _step : uint
FlxGame
  useSoundHotKeys : Boolean
Sets 0, -, and + to control the global volume sound volume.
FlxGame
Protected Properties
 PropertyDefined By
  _accumulator : int
FlxGame
  _created : Boolean
FlxGame
  _focus : Sprite
FlxGame
  _iState : Class
FlxGame
  junk : String
FlxGame
  _lostFocus : Boolean
FlxGame
  SndBeep : Class
FlxGame
  _soundTray : Sprite
FlxGame
  _soundTrayBars : Array
FlxGame
  _soundTrayTimer : Number
FlxGame
  _total : uint
FlxGame
Public Methods
 MethodDefined By
  
FlxGame(GameSizeX:uint, GameSizeY:uint, InitialState:Class, Zoom:Number = 1)
Game object constructor - sets up the basic properties of your game.
FlxGame
  
showSoundTray(Silent:Boolean = false):void
Makes the little volume tray slide out.
FlxGame
Protected Methods
 MethodDefined By
  
create(E:Event):void
Used to instantiate the guts of flixel once we have a valid reference to the root.
FlxGame
  
Sets up the darkened overlay with the big white "play" button that appears when a flixel game loses focus.
FlxGame
  
Sets up the "sound tray", the little volume meter that pops down sometimes.
FlxGame
  
draw():void
Goes through the game state and draws all the game objects and special effects.
FlxGame
  
onEnterFrame(E:Event = null):void
Handles the onEnterFrame call, figures out how many updates and draw calls to do.
FlxGame
  
onFocus(E:Event = null):void
Internal event handler for input and focus.
FlxGame
  
onFocusLost(E:Event = null):void
Internal event handler for input and focus.
FlxGame
  
onKeyDown(event:KeyboardEvent):void
Internal event handler for input and focus.
FlxGame
  
onKeyUp(event:KeyboardEvent):void
Internal event handler for input and focus.
FlxGame
  
onMouseDown(event:MouseEvent):void
Internal event handler for input and focus.
FlxGame
  
onMouseUp(E:MouseEvent):void
Internal event handler for input and focus.
FlxGame
  
onMouseWheel(E:MouseEvent):void
Internal event handler for input and focus.
FlxGame
  
step():void
FlxGame
  
FlxGame
  
update():void
This function updates the actual game state.
FlxGame
  
updateSoundTray(MS:Number):void
This function handles updating the volume controls, debugger, stuff like that.
FlxGame
Property Detail
_accumulatorproperty
protected var _accumulator:int

_createdproperty 
protected var _created:Boolean

_debuggerproperty 
public var _debugger:FlxDebugger

_debuggerUpproperty 
public var _debuggerUp:Boolean

_flashFramerateproperty 
public var _flashFramerate:uint

_focusproperty 
protected var _focus:Sprite

_iStateproperty 
protected var _iState:Class

_lostFocusproperty 
protected var _lostFocus:Boolean

_maxAccumulationproperty 
public var _maxAccumulation:uint

_mouseproperty 
public var _mouse:Sprite

_recordingproperty 
public var _recording:Boolean

_recordingRequestedproperty 
public var _recordingRequested:Boolean

_replayproperty 
public var _replay:FlxReplay

_replayCallbackproperty 
public var _replayCallback:Function

_replayCancelKeysproperty 
public var _replayCancelKeys:Array

_replayingproperty 
public var _replaying:Boolean

_replayRequestedproperty 
public var _replayRequested:Boolean

_replayTimerproperty 
public var _replayTimer:int

_requestedResetproperty 
public var _requestedReset:Boolean

_requestedStateproperty 
public var _requestedState:FlxState

_soundTrayproperty 
protected var _soundTray:Sprite

_soundTrayBarsproperty 
protected var _soundTrayBars:Array

_soundTrayTimerproperty 
protected var _soundTrayTimer:Number

_stateproperty 
public var _state:FlxState

_stepproperty 
public var _step:uint

_totalproperty 
protected var _total:uint

debugOnReleaseproperty 
public var debugOnRelease:Boolean

Initialize and allow the flixel debugger overlay even in release mode.

The default value is false.

junkproperty 
protected var junk:String

SndBeepproperty 
protected var SndBeep:Class

useSoundHotKeysproperty 
public var useSoundHotKeys:Boolean

Sets 0, -, and + to control the global volume sound volume.

The default value is true.

Constructor Detail
FlxGame()Constructor
public function FlxGame(GameSizeX:uint, GameSizeY:uint, InitialState:Class, Zoom:Number = 1)

Game object constructor - sets up the basic properties of your game.

Parameters
GameSizeX:uint — The width of your game in pixels (e.g. 320).
 
GameSizeY:uint — The height of your game in pixels (e.g. 240).
 
InitialState:Class — The class name of the state you want to create and switch to first (e.g. MenuState).
 
Zoom:Number (default = 1) — How frequently the game should update (default is 60 times per second).
Method Detail
create()method
protected function create(E:Event):void

Used to instantiate the guts of flixel once we have a valid reference to the root.

Parameters

E:Event — Just a Flash system event, not too important for our purposes.

createFocusScreen()method 
protected function createFocusScreen():void

Sets up the darkened overlay with the big white "play" button that appears when a flixel game loses focus.

createSoundTray()method 
protected function createSoundTray():void

Sets up the "sound tray", the little volume meter that pops down sometimes.

draw()method 
protected function draw():void

Goes through the game state and draws all the game objects and special effects.

onEnterFrame()method 
protected function onEnterFrame(E:Event = null):void

Handles the onEnterFrame call, figures out how many updates and draw calls to do.

Parameters

E:Event (default = null) — A Flash system event, not terribly important for our purposes!

onFocus()method 
protected function onFocus(E:Event = null):void

Internal event handler for input and focus.

Parameters

E:Event (default = null)

onFocusLost()method 
protected function onFocusLost(E:Event = null):void

Internal event handler for input and focus.

Parameters

E:Event (default = null)

onKeyDown()method 
protected function onKeyDown(event:KeyboardEvent):void

Internal event handler for input and focus.

Parameters

event:KeyboardEvent

onKeyUp()method 
protected function onKeyUp(event:KeyboardEvent):void

Internal event handler for input and focus.

Parameters

event:KeyboardEvent

onMouseDown()method 
protected function onMouseDown(event:MouseEvent):void

Internal event handler for input and focus.

Parameters

event:MouseEvent

onMouseUp()method 
protected function onMouseUp(E:MouseEvent):void

Internal event handler for input and focus.

Parameters

E:MouseEvent

onMouseWheel()method 
protected function onMouseWheel(E:MouseEvent):void

Internal event handler for input and focus.

Parameters

E:MouseEvent

showSoundTray()method 
public function showSoundTray(Silent:Boolean = false):void

Makes the little volume tray slide out.

Parameters

Silent:Boolean (default = false) — Whether or not it should beep.

step()method 
protected function step():void

switchState()method 
protected function switchState():void

update()method 
protected function update():void

This function updates the actual game state. May be called multiple times per "frame" or draw call.

updateSoundTray()method 
protected function updateSoundTray(MS:Number):void

This function handles updating the volume controls, debugger, stuff like that. This function does NOT update the actual game state or game effects! May be called multiple times per "frame" or draw call.

Parameters

MS:Number