Readonlyaccelerometeraccess to the the device's accelerometer
The background layers
Background color for the stage being drawn. Defaults to white
ReadonlyconfigThe game-wide configuration object
ReadonlyconsoleA console device, for debug messages
The foreground layers
ReadonlygameNamed layers of background music that don't stop when the level changes
ReadonlygamepadsUp to four gamepad slots, matching navigator.getGamepads()'s indices.
Each entry always exists (check .connected before using one), so
stage.gamepads[0] never throws even if nothing's plugged in yet.
touch controller, providing gesture inputs
A heads-up display
ReadonlyimageA library of images
Readonlykeyboardkeyboard controller, providing key event inputs
ReadonlylevelNamed layers of music that belong to one level. Every layer is stopped and emptied when the level changes.
ReadonlymusicA library of sound and music files
ReadonlynetworkNetwork interface
OptionaloverlayThe current overlay (pause/win/lose) scene, if any
ReadonlyplatformPlatform-specific features * *
ReadonlyrandomA random number generator, for reproducible randomness
Readonlyrendererrendering support, for drawing to the screen
ReadonlyscoreThe Score, suitable for use throughout JetLag
ReadonlyspeechText-to-speech support
ReadonlystoragePersistent storage + volatile storage for a game session and a level
ReadonlytiltThe tilt system for the stage
How fast the world runs: 1 is normal, 0.5 is half speed, and 0 freezes it.
This slows physics, timers, and animations, but not the HUD or overlays.
See slowMotion and hitstop for changing it for a short time.
ReadonlyvisibilityPage visibility detection support
The physics world in which all actors exist
Remove the current overlay scene, if any
Close the window to exit the game
Freeze the world for a moment, such as when a heavy blow lands. The camera (shake) and the HUD keep going.
How long to freeze, in real seconds
Update every gamepad slot from the browser's live gamepad state, and fire any button handlers whose pressed state changed
This code is called dozens of times per second to update the game's world's state and re-draw the world
The time in milliseconds since the previous render
Request that an overlay be put on top of the game. This is not the HUD. It's something that goes on top of everything else, and prevents the game from playing, such as a pause scene, a win/lose scene, or a welcome scene.
Code for creating the overlay. When
requestScreenshot is true, it is also given the
screenshot
OptionalrequestScreenshot: false
Should the overlay delay for a cycle or two, so a screenshot can be taken first? (Default false)
Request that an overlay be put on top of the game. This is not the HUD. It's something that goes on top of everything else, and prevents the game from playing, such as a pause scene, a win/lose scene, or a welcome scene.
Code for creating the overlay. When
requestScreenshot is true, it is also given the
screenshot
Should the overlay delay for a cycle or two, so a screenshot can be taken first? (Default false)
Run the world slowly for a short time, and then at normal speed again.
How long it lasts, in real seconds
How fast the world runs while it lasts: 0.25 is a quarter of normal speed
Before we call programmer code to load a new stage, we call this to ensure that everything is in a clean state.
Stage is the container for all of the functionality for the playable portion of a game. Stage has several components:
Stage is effectively a singleton: On any transition from one stage to another in the game, we don't make a new Stage object... instead we clear out the existing one and reuse it.
Stage does not manage transitions between scenes on its own. Instead, it has mechanisms (onScreenChange and endLevel) for resetting itself at the beginning of a stage, and cleaning itself up at the end of a stage.