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 var _buffer:Bitmap
public var _console:FlxConsole
public var _created:Boolean
public var _elapsed:Number
public var _gameXOffset:int
public var _gameYOffset:int
public var _paused:Boolean
public var _screen:Sprite
public var _soundTray:Sprite
public var _soundTrayBars:Array
public var _soundTrayTimer:Number
public var _state:FlxState
public var _zeroPoint:Point
protected var junk:String
public var pause:FlxGroup
Displayed whenever the game is paused.
Override with your own FlxLayer
for hot custom pause action!
Defaults to data.FlxPause
.
public var pauseOnFocusLost:Boolean
Should then game pause/result on focus changes?
The default value is true.
.
protected var SndBeep:Class
protected var SndFlixel:Class
public var useDefaultHotKeys:Boolean
Sets 0, -, and + to control the global volume and P to pause.
The default value is true
.
public function FlxGame(GameSizeX:uint, GameSizeY:uint, InitialState:Class, Zoom:uint = 2)
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:uint (default = 2 ) — The level of zoom (e.g. 2 means all pixels are now rendered twice as big).
|
protected function addFrame(Frame:Class, ScreenOffsetX:uint, ScreenOffsetY:uint):FlxGame
Adds a frame around your game for presentation purposes (see Canabalt, Gravity Hook).
Parameters
| Frame:Class — If you want you can add a little graphical frame to the outside edges of your game.
|
|
| ScreenOffsetX:uint — Width in pixels of left side of frame.
|
|
| ScreenOffsetY:uint — Height in pixels of top of frame.
|
Returns public function create(event:Event):void
Used to instantiate the guts of flixel once we have a valid pointer to the root.
Parameters
protected function onFocus(event:Event = null):void
Internal event handler for input and focus.
Parameters
| event:Event (default = null )
|
protected function onFocusLost(event:Event = null):void
Internal event handler for input and focus.
Parameters
| event:Event (default = null )
|
protected function onKeyUp(event:KeyboardEvent):void
Internal event handler for input and focus.
Parameters
public function pauseGame():void
Internal function to help with basic pause game functionality.
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.
|
public function switchState(State:FlxState):void
Switch from one FlxState
to another.
Usually called from FlxG
.
Parameters
| State:FlxState — The class name of the state you want (e.g. PlayState)
|
public function unpauseGame():void
Internal function to help with basic pause game functionality.
protected function update(event:Event):void
This is the main game loop. It controls all the updating and rendering.
Parameters
public const MAX_ELAPSED:Number = 0.0333
Essentially locks the framerate to 30 FPS minimum - any slower and you'll get slowdown instead of frameskip.
Sun Apr 17 2011, 12:17 AM -07:00