| Package | org.flixel |
| Class | public class FlxGame |
| Inheritance | FlxGame flash.display.Sprite |
| Property | Defined By | ||
|---|---|---|---|
| _debugger : FlxDebugger
The debugger overlay object. | FlxGame | ||
| _debuggerUp : Boolean
A handy boolean that keeps track of whether the debugger exists and is currently visible. | FlxGame | ||
| _flashFramerate : uint
Framerate of the Flash player (NOT the game loop). | FlxGame | ||
| forceDebugger : Boolean
Initialize and allow the flixel debugger overlay even in release mode. | FlxGame | ||
| _maxAccumulation : uint
Max allowable accumulation (see _accumulator). | FlxGame | ||
| _mouse : Sprite
Mouse cursor. | FlxGame | ||
| _recording : Boolean
Flag for whether a new recording is being made. | FlxGame | ||
| _recordingRequested : Boolean
Flag for whether a new recording was requested. | FlxGame | ||
| _replay : FlxReplay
Container for a game replay object. | FlxGame | ||
| _replayCallback : Function
This function, if set, is triggered when the callback stops playing. | FlxGame | ||
| _replayCancelKeys : Array
Array that keeps track of keypresses that can cancel a replay. | FlxGame | ||
| _replaying : Boolean
Flag for whether a replay is currently playing. | FlxGame | ||
| _replayRequested : Boolean
Flag for whether a playback of a recording was requested. | FlxGame | ||
| _replayTimer : int
Helps time out a replay if necessary. | FlxGame | ||
| _requestedReset : Boolean
A flag for keeping track of whether a game reset was requested or not. | FlxGame | ||
| _requestedState : FlxState
If a state change was requested, the new state object is stored here until we switch to it. | FlxGame | ||
| _state : FlxState
Current game state. | FlxGame | ||
| _step : uint
Milliseconds of time per step of the game loop. | FlxGame | ||
| useSoundHotKeys : Boolean
Sets 0, -, and + to control the global volume sound volume. | FlxGame | ||
| useSystemCursor : Boolean
Tells flixel to use the default system mouse cursor instead of custom Flixel mouse cursors. | FlxGame | ||
| Property | Defined By | ||
|---|---|---|---|
| _accumulator : int
Total number of milliseconds elapsed since last update loop. | FlxGame | ||
| _created : Boolean
Whether the game object's basic initialization has finished yet. | FlxGame | ||
| _focus : Sprite
The "focus lost" screen (see createFocusScreen()). | FlxGame | ||
| ImgLogo : Class | FlxGame | ||
| _iState : Class
Class type of the initial/first game state for the game, usually MenuState or something like that. | FlxGame | ||
| junk : String | FlxGame | ||
| _lostFocus : Boolean
Whether the Flash player lost focus. | FlxGame | ||
| SndBeep : Class | FlxGame | ||
| _soundTray : Sprite
The sound tray display container (see createSoundTray()). | FlxGame | ||
| _soundTrayBars : Array
Helps display the volume bars on the sound tray. | FlxGame | ||
| _soundTrayTimer : Number
Helps us auto-hide the sound tray after a volume change. | FlxGame | ||
| _total : uint
Total number of milliseconds elapsed since game start. | FlxGame | ||
| Method | Defined By | ||
|---|---|---|---|
FlxGame(GameSizeX:uint, GameSizeY:uint, InitialState:Class, Zoom:Number = 1, GameFramerate:uint = 60, FlashFramerate:uint = 30, UseSystemCursor:Boolean = false)
Instantiate a new game object. | FlxGame | ||
showSoundTray(Silent:Boolean = false):void
Makes the little volume tray slide out. | FlxGame | ||
| Method | Defined By | ||
|---|---|---|---|
create(FlashEvent:Event):void
Used to instantiate the guts of the flixel game object once we have a valid reference to the root. | FlxGame | ||
createFocusScreen():void
Sets up the darkened overlay with the big white "play" button that appears when a flixel game loses focus. | FlxGame | ||
createSoundTray():void
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(FlashEvent:Event = null):void
Handles the onEnterFrame call and figures out how many updates and draw calls to do. | FlxGame | ||
onFocus(FlashEvent:Event = null):void
Internal event handler for input and focus. | FlxGame | ||
onFocusLost(FlashEvent:Event = null):void
Internal event handler for input and focus. | FlxGame | ||
onKeyDown(FlashEvent:KeyboardEvent):void
Internal event handler for input and focus. | FlxGame | ||
onKeyUp(FlashEvent:KeyboardEvent):void
Internal event handler for input and focus. | FlxGame | ||
onMouseDown(FlashEvent:MouseEvent):void
Internal event handler for input and focus. | FlxGame | ||
onMouseUp(FlashEvent:MouseEvent):void
Internal event handler for input and focus. | FlxGame | ||
onMouseWheel(FlashEvent:MouseEvent):void
Internal event handler for input and focus. | FlxGame | ||
step():void
This is the main game update logic section. | FlxGame | ||
switchState():void
If there is a state change requested during the update loop,
this function handles actual destroying the old state and related processes,
and calls creates on the new state and plugs it into the game object. | FlxGame | ||
update():void
This function is called by step() and updates the actual game state. | FlxGame | ||
updateSoundTray(MS:Number):void
This function just updates the soundtray object. | FlxGame | ||
| _accumulator | property |
protected var _accumulator:intTotal number of milliseconds elapsed since last update loop. Counts down as we step through the game loop.
| _created | property |
protected var _created:BooleanWhether the game object's basic initialization has finished yet.
| _debugger | property |
public var _debugger:FlxDebuggerThe debugger overlay object.
| _debuggerUp | property |
public var _debuggerUp:BooleanA handy boolean that keeps track of whether the debugger exists and is currently visible.
| _flashFramerate | property |
public var _flashFramerate:uintFramerate of the Flash player (NOT the game loop). Default = 30.
| _focus | property |
protected var _focus:Sprite
The "focus lost" screen (see createFocusScreen()).
| _iState | property |
protected var _iState:ClassClass type of the initial/first game state for the game, usually MenuState or something like that.
| _lostFocus | property |
protected var _lostFocus:BooleanWhether the Flash player lost focus.
| _maxAccumulation | property |
public var _maxAccumulation:uintMax allowable accumulation (see _accumulator). Should always (and automatically) be set to roughly 2x the flash player framerate.
| _mouse | property |
public var _mouse:SpriteMouse cursor.
| _recording | property |
public var _recording:BooleanFlag for whether a new recording is being made.
| _recordingRequested | property |
public var _recordingRequested:BooleanFlag for whether a new recording was requested.
| _replay | property |
public var _replay:FlxReplayContainer for a game replay object.
| _replayCallback | property |
public var _replayCallback:FunctionThis function, if set, is triggered when the callback stops playing.
| _replayCancelKeys | property |
public var _replayCancelKeys:ArrayArray that keeps track of keypresses that can cancel a replay. Handy for skipping cutscenes or getting out of attract modes!
| _replaying | property |
public var _replaying:BooleanFlag for whether a replay is currently playing.
| _replayRequested | property |
public var _replayRequested:BooleanFlag for whether a playback of a recording was requested.
| _replayTimer | property |
public var _replayTimer:intHelps time out a replay if necessary.
| _requestedReset | property |
public var _requestedReset:BooleanA flag for keeping track of whether a game reset was requested or not.
| _requestedState | property |
public var _requestedState:FlxStateIf a state change was requested, the new state object is stored here until we switch to it.
| _soundTray | property |
protected var _soundTray:Sprite
The sound tray display container (see createSoundTray()).
| _soundTrayBars | property |
protected var _soundTrayBars:ArrayHelps display the volume bars on the sound tray.
| _soundTrayTimer | property |
protected var _soundTrayTimer:NumberHelps us auto-hide the sound tray after a volume change.
| _state | property |
public var _state:FlxStateCurrent game state.
| _step | property |
public var _step:uintMilliseconds of time per step of the game loop. FlashEvent.g. 60 fps = 16ms.
| _total | property |
protected var _total:uintTotal number of milliseconds elapsed since game start.
| forceDebugger | property |
public var forceDebugger:BooleanInitialize and allow the flixel debugger overlay even in release mode. Also useful if you don't use FlxPreloader!
The default value is false.
| ImgLogo | property |
protected var ImgLogo:Class| junk | property |
protected var junk:String| SndBeep | property |
protected var SndBeep:Class| useSoundHotKeys | property |
public var useSoundHotKeys:BooleanSets 0, -, and + to control the global volume sound volume.
The default value is true.
| useSystemCursor | property |
public var useSystemCursor:BooleanTells flixel to use the default system mouse cursor instead of custom Flixel mouse cursors.
The default value is false.
| FlxGame | () | Constructor |
public function FlxGame(GameSizeX:uint, GameSizeY:uint, InitialState:Class, Zoom:Number = 1, GameFramerate:uint = 60, FlashFramerate:uint = 30, UseSystemCursor:Boolean = false)Instantiate a new game object.
ParametersGameSizeX:uint — The width of your game in game pixels, not necessarily final display pixels (see Zoom).
| |
GameSizeY:uint — The height of your game in game pixels, not necessarily final display pixels (see Zoom).
| |
InitialState:Class — The class name of the state you want to create and switch to first (e.g. MenuState).
| |
Zoom:Number (default = 1) — The default level of zoom for the game's cameras (e.g. 2 = all pixels are now drawn at 2x). Default = 1.
| |
GameFramerate:uint (default = 60) — How frequently the game should update (default is 60 times per second).
| |
FlashFramerate:uint (default = 30) — Sets the actual display framerate for Flash player (default is 30 times per second).
| |
UseSystemCursor:Boolean (default = false) — Whether to use the default OS mouse pointer, or to use custom flixel ones.
|
| create | () | method |
protected function create(FlashEvent:Event):voidUsed to instantiate the guts of the flixel game object once we have a valid reference to the root.
Parameters
FlashEvent:Event — Just a Flash system event, not too important for our purposes.
|
| createFocusScreen | () | method |
protected function createFocusScreen():voidSets up the darkened overlay with the big white "play" button that appears when a flixel game loses focus.
| createSoundTray | () | method |
protected function createSoundTray():voidSets up the "sound tray", the little volume meter that pops down sometimes.
| draw | () | method |
protected function draw():voidGoes through the game state and draws all the game objects and special effects.
| onEnterFrame | () | method |
protected function onEnterFrame(FlashEvent:Event = null):voidHandles the onEnterFrame call and figures out how many updates and draw calls to do.
Parameters
FlashEvent:Event (default = null) — Flash event.
|
| onFocus | () | method |
protected function onFocus(FlashEvent:Event = null):voidInternal event handler for input and focus.
Parameters
FlashEvent:Event (default = null) — Flash event.
|
| onFocusLost | () | method |
protected function onFocusLost(FlashEvent:Event = null):voidInternal event handler for input and focus.
Parameters
FlashEvent:Event (default = null) — Flash event.
|
| onKeyDown | () | method |
protected function onKeyDown(FlashEvent:KeyboardEvent):voidInternal event handler for input and focus.
Parameters
FlashEvent:KeyboardEvent — Flash keyboard event.
|
| onKeyUp | () | method |
protected function onKeyUp(FlashEvent:KeyboardEvent):voidInternal event handler for input and focus.
Parameters
FlashEvent:KeyboardEvent — Flash keyboard event.
|
| onMouseDown | () | method |
protected function onMouseDown(FlashEvent:MouseEvent):voidInternal event handler for input and focus.
Parameters
FlashEvent:MouseEvent — Flash mouse event.
|
| onMouseUp | () | method |
protected function onMouseUp(FlashEvent:MouseEvent):voidInternal event handler for input and focus.
Parameters
FlashEvent:MouseEvent — Flash mouse event.
|
| onMouseWheel | () | method |
protected function onMouseWheel(FlashEvent:MouseEvent):voidInternal event handler for input and focus.
Parameters
FlashEvent:MouseEvent — Flash mouse event.
|
| showSoundTray | () | method |
public function showSoundTray(Silent:Boolean = false):voidMakes the little volume tray slide out.
Parameters
Silent:Boolean (default = false) — Whether or not it should beep.
|
| step | () | method |
protected function step():voidThis is the main game update logic section. The onEnterFrame() handler is in charge of calling this the appropriate number of times each frame. This block handles state changes, replays, all that good stuff.
| switchState | () | method |
protected function switchState():voidIf there is a state change requested during the update loop, this function handles actual destroying the old state and related processes, and calls creates on the new state and plugs it into the game object.
| update | () | method |
protected function update():voidThis function is called by step() and updates the actual game state. May be called multiple times per "frame" or draw call.
| updateSoundTray | () | method |
protected function updateSoundTray(MS:Number):voidThis function just updates the soundtray object.
Parameters
MS:Number |