Skip to content

Latest commit

 

History

History
303 lines (221 loc) · 17.1 KB

DOCS.md

File metadata and controls

303 lines (221 loc) · 17.1 KB

Phaser CE

Phaser CE is the Community Edition of Phaser. It was started with the 2.7.0 release and since then the community has worked to continue updating it, fixing bugs and adding new features.

See README for a guide to getting started with Phaser CE.

API

Via: If a class has an entry in the Via column it means you can quickly access it through a local reference: e.g., you can control the camera via this.camera from any state, or game.camera if game has been globally defined.

Class Via Description
Game game Manages booting, creating subsystems and running the logic and render loop.
World world The Game World in which all Game Objects live.
Camera camera The Camera is your view into the Game World.
Stage stage The Stage is the root display object.

Game States

Class Via Description
StateManager state Creates, manages and swaps your Game States.
State - A base Game State object you can extend.

Loader

Class Via Description
Cache cache The Cache is where all loaded assets are stored and retrieved from.
Loader load Loads all external asset types (images, audio, json, xml, txt) and adds them to the Cache. Automatically invoked by a States preload method.
LoaderParser - A Static Class used by the Loader to handle parsing of complex asset types.

Game Scaling

Class Via Description
ScaleManager scale Manages the sizing and scaling of your game across devices.
FlexGrid scale.grid A responsive layout grid (still in testing)
FlexLayer - A responsive grid layer (still in testing)

Signals

Class Description
Signal Signals are Phasers internal Event system.
SignalBinding Manages which callbacks are bound to a Signal.

Plugins

Class Via Description
PluginManager plugins Installs, updates and destroys Plugins.
Plugin - A base Plugin object you can extend.

Game Objects

Class Via Description
GameObjectFactory add A helper class that can create any of the Phaser Game Objects and adds them to the Game World.
GameObjectCreator make A helper class that can creates and returns any Phaser Game Object.
Group add.group Groups can contain multiple Game Objects and have the ability to search, sort, call, update and filter them.
InputHandler <object>.input If a Game Object is enabled for input this class controls all input related events, including clicks and drag.
Events <object>.events All of the Game Object level events.
Create create Dynamic Sprite and Texture generation methods.

Display

Class Description
Sprite A Game Object with a texture, capable of running animation, input events and physics.
Image A lighter Game Object with a texture and input, but no physics or animation handlers.
TileSprite A Game Object with a repeating texture that can be scrolled and scaled.
Button An Image Game Object with helper methods and events to turn it into a UI Button.
SpriteBatch A custom Sprite Batch. Can render multiple Sprites significantly faster if they share the same texture.
Rope A jointed Game Object with a strip-based texture.

Graphics

Class Description
Graphics Allows you to draw primitive shapes (lines, rects, circles), setting color, stroke and fills.
BitmapData Provides a powerful interface to a blank Canvas object. Can be used as a Sprite texture.
RenderTexture A special kind of texture you can draw Sprites to extremely quickly.
Video A video that can be used as a Sprite texture.

Text

Class Description
Text Displays text using system fonts or Web Fonts, with optional fills, shadows and strokes.
BitmapText A texture based text object that uses a Bitmap Font file.
RetroFont Similar to a BitmapText object but uses a classic sprite sheet. Each character is a fixed-width.

Animation

Class Via Description
AnimationManager sprite.animations Adds, plays and updates animations on Sprite Game Objects.
Animation - The base Animation object that the Animation Manager creates.
AnimationParser - Used internally by the Phaser Loader to parse animation data from external files.
FrameData - A collection of Frame objects that comprise an animation.
Frame - A single Frame of an Animation. Stored inside of a FrameData object.

Geometry

Class Description
Circle A Circle object consisting of a position and diameter.
Ellipse An Ellipse object consisting of a position, width and height.
Line A Line object consisting of two points at the start and end of the Line.
Point A Point object consisting of an x and y position.
Polygon A Polygon object consisting of a series of Points.
Rectangle A Rectangle object consisting of an x, y, width and height.
RoundedRectangle A Rectangle object consisting of an x, y, width, height and corner radius.

Time

Class Via Description
Time time The core internal clock on which all Phaser time related operations rely.
Timer time.create A custom Timer that contains one or more TimerEvents. Can be used either once or be set to repeat.
TimerEvent time.add A single time related event object. Belongs to a Phaser.Timer.

Tilemaps

Class Description
Tilemap A Tilemap consists of one or more TilemapLayers and associated tile data. Contains methods for tile data manipulation and TilemapLayer generation.
TilemapLayer A single layer within a Tilemap. Extends from Phaser.Sprite and is responsible for rendering itself.
Tileset An object containing a texture and data used for rendering tiles by a TilemapLayer.
Tile A single Tile object with related properties. One of these exists for every tile in a map.
TilemapParser A Static class used to parse externally loaded map data. Typically called directly by Phaser.Loader.

Math

Class Via Description
Math math Contains lots of math related helper methods including fuzzy logic and interpolation.
QuadTree - A stand-alone QuadTree implementation. Used by Arcade Physics but can also be used directly.
RandomDataGenerator rnd A seedable repeatable random data generator.

Particles

Class Via Description
Particles particles The Phaser Particle Manager. Called during the game loop and updates any associated Particle Emitters.
Emitter add.emitter An Arcade Physics based Particle Emitter.
Particle - A single Particle object as emitted by the Emitter. Extends Phaser.Sprite.

Physics

Class Via Description
Physics physics The core Physics Manager. Provides access to all of the physics sub-systems.

Arcade Physics

Class Via Description
Arcade physics.arcade The Arcade Physics handler. Contains collision, overlap and movement related methods.
Body sprite.body An Arcade Physics Body. Contains velocity, acceleration, drag and other related properties.
Weapon game.add.weapon An Arcade Physics powered Weapon plugin, for easy bullet pool management.

Ninja Physics

Ninja Physics is not bundled in Phaser by default. Please see the README custom build details section.

Class Via Description
Ninja physics.ninja The Ninja Physics handler. Contains collision, overlap and movement related methods.
Body sprite.body A Ninja Physics Body. Contains velocity, acceleration, drag and other related properties.
AABB - An AABB Ninja Physics Body type.
Circle - A Circle Ninja Physics Body type.
Tile - A Tile Ninja Physics Body type.

P2 Physics

Class Via Description
P2 physics.p2 The P2 Physics World. Contains collision, overlap and movement related methods.
Body sprite.body A P2 Physics Body. Contains velocity, acceleration, drag and other related properties.
BodyDebug - A Debug specific version of a P2 Body object. Renders out its shape for visual debugging.
Material - A P2 Material used for world responses, such as friction and restitution.
ContactMaterial - A P2 Contact Material used for contact responses.
CollisionGroup - A P2 Collision Group.
FixtureList - The P2 Fixture List handler.
Constraints: - Distance Constraint, GearConstraint, LockConstraint, PrismaticConstraint, RevoluteConstraint
PointProxy - Responsible for proxying Phaser Game World to P2 Physics values.
InversePointProxy - Responsible for proxying Phaser Game World to inversed P2 Physics values.
Spring - A P2 Spring object.
RotationalSpring - A P2 Rotational Spring object.

Input

Class Via Description
Input input The Input Manager. Responsible for handling all Input sub-systems. Also looks after Input enabled Game Objects.
Pointer input.pointer Pointers encapsulate all mouse or touch related input, regardless of how it was generated. On multi-touch systems more than one Pointer can be active at any one time. In Input related events a reference to the corresponding Pointer is passed.
DeviceButton pointer.leftButton, … Represents a button on a mouse or pen/stylus.
Keyboard input.keyboard The Keyboard input handler. Listens for device related events. Can also create Key objects.
Key - A Key object is responsible for listening to a specific Key. Created by the Keyboard class.
KeyCode - The KeyCode constants are used when creating new Key objects.
Mouse input.mouse A Mouse event handler. Listens for device related events and passes them on to the active Pointer.
MouseWheel input.mouseWheel A Mouse Wheel event handler.
MSPointer input.mspointer An event handler for the Pointer Events API. Listens for device related events and passes them on to the active Pointer.
PointerLock input.pointerLock An event handler for the Pointer Lock API.
Touch input.touch A Touch event handler. Listens for device related events and passes them on to the active Pointer.

Gamepads

Class Via Description
Gamepad input.gamepad The Gamepad Manager looks after all connected Gamepads to the device. Creates SinglePad instances.
SinglePad input.gamepad.pad<1,4> Represents a single connected gamepad.
DeviceButton - Represents a button on a SinglePad instance.

Tweens

Class Via Description
TweenManager tweens The Tween Manager creates, updates and destroys all active tweens.
Tween add.tween A Tween object. Consists of TweenData objects that represent the tween and any child tweens.
TweenData - A TweenData object contains all the information related to a tween. Created by and belongs to a Phaser.Tween object.
Easing - A static class containing all of the easing functions available to Tweens.

Sound

Class Via Description
SoundManager sound The Sound Manager controls all Sound objects and can play, loop, fade and stop Sounds.
Sound add.audio, add.sound A Sound object. Can be played, paused and stopped directly, and have its volume adjusted.
AudioSprite add.audioSprite An Audio Sprite is a Sound object with related marker data representing sections of the audio.

System

Class Via Description
Canvas - A static class containing Canvas creation and manipulation methods. Such as adding to the dom, setting touch actions, smoothing and image rendering.
Device game.device The Device class checks system capabilities and settings on boot and stores them for later access.
DOM - A static class containing DOM specific methods including offset handling, viewport calibration and bounds checks.
RequestAnimationFrame game.raf Abstracts away the use of RAF or setTimeOut for the core game update loop.

Utils

Class Via Description
ArraySet - ArraySet is a Set data structure (items must be unique within the set) that also maintains order.
ArrayUtils - Array specific methods such as getRandomItem, shuffle, transposeMatrix, rotate and numberArray.
Color - Phaser.Color is a set of static methods that assist in color manipulation and conversion.
Debug game.debug A collection of methods for displaying debug information about game objects.
LinkedList - A basic Linked List data structure.
Utils - Utility methods for Object and String inspection and modification. Including getProperty, pad, isPlainObject, extend and mixin.