| Package | net.flashpunk |
| Class | public class Engine |
| Inheritance | Engine flash.display.MovieClip |
| Property | Defined By | ||
|---|---|---|---|
| maxElapsed : Number = 0.0333
Cap on the elapsed time (default at 30 FPS). | Engine | ||
| maxFrameSkip : uint = 5
The max amount of frames that can be skipped in fixed framerate mode. | Engine | ||
| paused : Boolean = false
If the game should stop updating/rendering. | Engine | ||
| tickRate : uint = 4
The amount of milliseconds between ticks in fixed framerate mode. | Engine | ||
| Method | Defined By | ||
|---|---|---|---|
Engine(width:uint, height:uint, frameRate:Number = 60, fixed:Boolean = false)
Constructor. | Engine | ||
focusGained():void
Override this; called when game gains focus. | Engine | ||
focusLost():void
Override this; called when game loses focus. | Engine | ||
init():void
Override this, called after Engine has been added to the stage. | Engine | ||
render():void
Renders the game, rendering the World and Entities. | Engine | ||
setStageProperties():void
Sets the game's stage properties. | Engine | ||
update():void
Updates the game, updating the World and Entities. | Engine | ||
| maxElapsed | property |
public var maxElapsed:Number = 0.0333Cap on the elapsed time (default at 30 FPS). Raise this to allow for lower framerates (eg. 1 / 10).
| maxFrameSkip | property |
public var maxFrameSkip:uint = 5The max amount of frames that can be skipped in fixed framerate mode.
| paused | property |
public var paused:Boolean = falseIf the game should stop updating/rendering.
| tickRate | property |
public var tickRate:uint = 4The amount of milliseconds between ticks in fixed framerate mode.
| Engine | () | Constructor |
public function Engine(width:uint, height:uint, frameRate:Number = 60, fixed:Boolean = false)Constructor. Defines startup information about your game.
Parameterswidth:uint — The width of your game.
| |
height:uint — The height of your game.
| |
frameRate:Number (default = 60) — The game framerate, in frames per second.
| |
fixed:Boolean (default = false) — If a fixed-framerate should be used.
|
| focusGained | () | method |
public function focusGained():voidOverride this; called when game gains focus.
| focusLost | () | method |
public function focusLost():voidOverride this; called when game loses focus.
| init | () | method |
public function init():voidOverride this, called after Engine has been added to the stage.
| render | () | method |
public function render():voidRenders the game, rendering the World and Entities.
| setStageProperties | () | method |
public function setStageProperties():voidSets the game's stage properties. Override this to set them differently.
| update | () | method |
public function update():voidUpdates the game, updating the World and Entities.