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:int
Total number of milliseconds elapsed since last update loop. Counts down as we step through the game loop.
_created | property |
protected var _created:Boolean
Whether the game object's basic initialization has finished yet.
_debugger | property |
public var _debugger:FlxDebugger
The debugger overlay object.
_debuggerUp | property |
public var _debuggerUp:Boolean
A handy boolean that keeps track of whether the debugger exists and is currently visible.
_flashFramerate | property |
public var _flashFramerate:uint
Framerate 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:Class
Class type of the initial/first game state for the game, usually MenuState or something like that.
_lostFocus | property |
protected var _lostFocus:Boolean
Whether the Flash player lost focus.
_maxAccumulation | property |
public var _maxAccumulation:uint
Max allowable accumulation (see _accumulator). Should always (and automatically) be set to roughly 2x the flash player framerate.
_mouse | property |
public var _mouse:Sprite
Mouse cursor.
_recording | property |
public var _recording:Boolean
Flag for whether a new recording is being made.
_recordingRequested | property |
public var _recordingRequested:Boolean
Flag for whether a new recording was requested.
_replay | property |
public var _replay:FlxReplay
Container for a game replay object.
_replayCallback | property |
public var _replayCallback:Function
This function, if set, is triggered when the callback stops playing.
_replayCancelKeys | property |
public var _replayCancelKeys:Array
Array 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:Boolean
Flag for whether a replay is currently playing.
_replayRequested | property |
public var _replayRequested:Boolean
Flag for whether a playback of a recording was requested.
_replayTimer | property |
public var _replayTimer:int
Helps time out a replay if necessary.
_requestedReset | property |
public var _requestedReset:Boolean
A flag for keeping track of whether a game reset was requested or not.
_requestedState | property |
public var _requestedState:FlxState
If 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:Array
Helps display the volume bars on the sound tray.
_soundTrayTimer | property |
protected var _soundTrayTimer:Number
Helps us auto-hide the sound tray after a volume change.
_state | property |
public var _state:FlxState
Current game state.
_step | property |
public var _step:uint
Milliseconds of time per step of the game loop. FlashEvent.g. 60 fps = 16ms.
_total | property |
protected var _total:uint
Total number of milliseconds elapsed since game start.
forceDebugger | property |
public var forceDebugger:Boolean
Initialize 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:Boolean
Sets 0, -, and + to control the global volume sound volume.
The default value is true
.
useSystemCursor | property |
public var useSystemCursor:Boolean
Tells 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):void
Used 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():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(FlashEvent:Event = null):void
Handles 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):void
Internal event handler for input and focus.
Parameters
FlashEvent:Event (default = null ) — Flash event.
|
onFocusLost | () | method |
protected function onFocusLost(FlashEvent:Event = null):void
Internal event handler for input and focus.
Parameters
FlashEvent:Event (default = null ) — Flash event.
|
onKeyDown | () | method |
protected function onKeyDown(FlashEvent:KeyboardEvent):void
Internal event handler for input and focus.
Parameters
FlashEvent:KeyboardEvent — Flash keyboard event.
|
onKeyUp | () | method |
protected function onKeyUp(FlashEvent:KeyboardEvent):void
Internal event handler for input and focus.
Parameters
FlashEvent:KeyboardEvent — Flash keyboard event.
|
onMouseDown | () | method |
protected function onMouseDown(FlashEvent:MouseEvent):void
Internal event handler for input and focus.
Parameters
FlashEvent:MouseEvent — Flash mouse event.
|
onMouseUp | () | method |
protected function onMouseUp(FlashEvent:MouseEvent):void
Internal event handler for input and focus.
Parameters
FlashEvent:MouseEvent — Flash mouse event.
|
onMouseWheel | () | method |
protected function onMouseWheel(FlashEvent:MouseEvent):void
Internal event handler for input and focus.
Parameters
FlashEvent:MouseEvent — Flash mouse event.
|
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
This 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():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.
update | () | method |
protected function update():void
This 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):void
This function just updates the soundtray object.
Parameters
MS:Number |