From 02b75b9e23f7cb2604cb510e50f4faa2346f31d1 Mon Sep 17 00:00:00 2001
From: photonstorm
Date: Wed, 5 Feb 2014 06:29:17 +0000
Subject: [PATCH] Updated doc files.
---
README.md | 10 +-
docs/Animation.js.html | 67 +-
docs/AnimationManager.js.html | 62 +-
docs/AnimationParser.js.html | 74 +-
docs/ArcadePhysics.js.html | 1561 ++--
docs/BitmapData.js.html | 64 +-
docs/BitmapText.js.html | 69 +-
docs/Body.js.html | 1771 +++--
docs/Button.js.html | 318 +-
docs/Cache.js.html | 287 +-
docs/Camera.js.html | 86 +-
docs/Canvas.js.html | 122 +-
docs/Circle.js.html | 68 +-
docs/Color.js.html | 60 +-
docs/DOMSprite.js.html | 567 ++
docs/Debug.js.html | 478 +-
docs/Device.js.html | 201 +-
docs/Easing.js.html | 60 +-
docs/Emitter.js.html | 261 +-
docs/Events.js.html | 69 +-
docs/Filter.js.html | 77 +-
docs/Frame.js.html | 62 +-
docs/FrameData.js.html | 62 +-
docs/Game.js.html | 347 +-
docs/GameObjectFactory.js.html | 178 +-
docs/Gamepad.js.html | 1057 +++
docs/GamepadButton.js.html | 654 ++
docs/Graphics.js.html | 60 +-
docs/Group.js.html | 381 +-
docs/Input.js.html | 107 +-
docs/InputHandler.js.html | 326 +-
docs/IntroDocs.js.html | 52 +-
docs/Key.js.html | 62 +-
docs/Keyboard.js.html | 74 +-
docs/Line.js.html | 743 ++
docs/LinkedList.js.html | 65 +-
docs/Loader.js.html | 167 +-
docs/LoaderParser.js.html | 60 +-
docs/MSPointer.js.html | 65 +-
docs/Math.js.html | 261 +-
docs/Mouse.js.html | 65 +-
docs/Net.js.html | 66 +-
docs/Particles.js.html | 65 +-
docs/Phaser.Animation.html | 99 +-
docs/Phaser.AnimationManager.html | 72 +-
docs/Phaser.AnimationParser.html | 144 +-
docs/Phaser.BitmapData.html | 122 +-
docs/Phaser.BitmapText.html | 168 +-
docs/Phaser.Button.html | 720 +-
docs/Phaser.Cache.html | 1346 ++--
docs/Phaser.Camera.html | 261 +-
docs/Phaser.Canvas.html | 213 +-
docs/Phaser.Circle.html | 104 +-
docs/Phaser.Color.html | 58 +-
docs/Phaser.DOMSprite.html | 1476 ++++
docs/Phaser.Device.html | 772 +-
docs/Phaser.Easing.Back.html | 58 +-
docs/Phaser.Easing.Bounce.html | 58 +-
docs/Phaser.Easing.Circular.html | 58 +-
docs/Phaser.Easing.Cubic.html | 58 +-
docs/Phaser.Easing.Elastic.html | 58 +-
docs/Phaser.Easing.Exponential.html | 58 +-
docs/Phaser.Easing.Linear.html | 58 +-
docs/Phaser.Easing.Quadratic.html | 58 +-
docs/Phaser.Easing.Quartic.html | 58 +-
docs/Phaser.Easing.Quintic.html | 58 +-
docs/Phaser.Easing.Sinusoidal.html | 58 +-
docs/Phaser.Easing.html | 58 +-
docs/Phaser.Events.html | 58 +-
docs/Phaser.Filter.html | 66 +-
docs/Phaser.Frame.html | 58 +-
docs/Phaser.FrameData.html | 82 +-
docs/Phaser.Game.html | 922 ++-
docs/Phaser.GameObjectFactory.html | 1110 +--
docs/Phaser.Gamepad.html | 3409 +++++++++
docs/Phaser.GamepadButton.html | 2587 +++++++
docs/Phaser.Graphics.html | 58 +-
docs/Phaser.Group.html | 1192 ++-
docs/Phaser.Input.html | 632 +-
docs/Phaser.InputHandler.html | 448 +-
docs/Phaser.Key.html | 58 +-
docs/Phaser.Keyboard.html | 70 +-
docs/Phaser.Line.html | 3100 ++++++++
docs/Phaser.LinkedList.html | 58 +-
docs/Phaser.Loader.html | 954 +--
docs/Phaser.LoaderParser.html | 58 +-
docs/Phaser.MSPointer.html | 58 +-
docs/Phaser.Math.html | 1221 ++-
docs/Phaser.Mouse.html | 89 +-
docs/Phaser.Net.html | 58 +-
docs/Phaser.Particles.Arcade.Emitter.html | 1698 ++++-
docs/Phaser.Particles.html | 58 +-
docs/Phaser.Physics.Arcade.Body.html | 6996 ++++++++++++++----
docs/Phaser.Physics.Arcade.html | 2881 ++++----
docs/Phaser.Physics.html | 58 +-
docs/Phaser.Plugin.html | 58 +-
docs/Phaser.PluginManager.html | 58 +-
docs/Phaser.Point.html | 72 +-
docs/Phaser.Pointer.html | 76 +-
docs/Phaser.Polygon.html | 62 +-
docs/Phaser.QuadTree.html | 478 +-
docs/Phaser.RandomDataGenerator.html | 62 +-
docs/Phaser.Rectangle.html | 108 +-
docs/Phaser.RenderTexture.html | 664 +-
docs/Phaser.RequestAnimationFrame.html | 60 +-
docs/Phaser.Signal.html | 58 +-
docs/Phaser.SinglePad.html | 3822 ++++++++++
docs/Phaser.Sound.html | 68 +-
docs/Phaser.SoundManager.html | 62 +-
docs/Phaser.Sprite.html | 719 +-
docs/Phaser.Stage.html | 354 +-
docs/Phaser.StageScaleMode.html | 88 +-
docs/Phaser.State.html | 58 +-
docs/Phaser.StateManager.html | 275 +-
docs/Phaser.Text.html | 289 +-
docs/Phaser.Tile.html | 1304 +++-
docs/Phaser.TileSprite.html | 807 +-
docs/Phaser.Tilemap.html | 1695 +++--
docs/Phaser.TilemapLayer.html | 2919 ++++----
docs/Phaser.TilemapParser.html | 333 +-
docs/Phaser.Tileset.html | 4653 ++++++++++--
docs/Phaser.Time.html | 507 +-
docs/Phaser.Timer.html | 3121 +++++++-
docs/Phaser.TimerEvent.html | 1616 ++++
docs/Phaser.Touch.html | 83 +-
docs/Phaser.Tween.html | 613 +-
docs/Phaser.TweenManager.html | 187 +-
docs/Phaser.Utils.Debug.html | 1757 +++--
docs/Phaser.Utils.html | 58 +-
docs/Phaser.World.html | 8173 ++++++++++++++++++++-
docs/Phaser.html | 76 +-
docs/Phaser.js.html | 67 +-
docs/Plugin.js.html | 62 +-
docs/PluginManager.js.html | 62 +-
docs/Point.js.html | 62 +-
docs/Pointer.js.html | 73 +-
docs/Polygon.js.html | 60 +-
docs/QuadTree.js.html | 200 +-
docs/RandomDataGenerator.js.html | 62 +-
docs/Rectangle.js.html | 72 +-
docs/RenderTexture.js.html | 153 +-
docs/RequestAnimationFrame.js.html | 67 +-
docs/SAT.js.html | 1340 ++++
docs/Signal.js.html | 62 +-
docs/SignalBinding.html | 58 +-
docs/SignalBinding.js.html | 62 +-
docs/SinglePad.js.html | 1048 +++
docs/Sound.js.html | 87 +-
docs/SoundManager.js.html | 64 +-
docs/Sprite.js.html | 191 +-
docs/Stage.js.html | 149 +-
docs/StageScaleMode.js.html | 113 +-
docs/State.js.html | 62 +-
docs/StateManager.js.html | 80 +-
docs/Text.js.html | 80 +-
docs/Tile.js.html | 231 +-
docs/TileSprite.js.html | 168 +-
docs/Tilemap.js.html | 897 ++-
docs/TilemapLayer.js.html | 704 +-
docs/TilemapParser.js.html | 369 +-
docs/Tileset.js.html | 255 +-
docs/Time.js.html | 526 +-
docs/Timer.js.html | 535 +-
docs/TimerEvent.js.html | 546 ++
docs/Touch.js.html | 82 +-
docs/Tween.js.html | 345 +-
docs/TweenManager.js.html | 124 +-
docs/Utils.js.html | 117 +-
docs/World.js.html | 184 +-
docs/build/build dev.bat | 1 -
docs/build/build master.bat | 2 +-
docs/build/conf.json | 3 +-
docs/build/conf_dev.json | 58 -
docs/classes.list.html | 76 +-
docs/global.html | 809 +-
docs/index.html | 475 +-
docs/namespaces.list.html | 76 +-
src/IntroDocs.js | 20 +-
src/physics/arcade/ArcadePhysics.js | 2 +-
src/physics/arcade/Body.js | 86 +-
src/time/Timer.js | 6 +-
src/utils/Utils.js | 24 -
182 files changed, 72763 insertions(+), 19286 deletions(-)
create mode 100644 docs/DOMSprite.js.html
create mode 100644 docs/Gamepad.js.html
create mode 100644 docs/GamepadButton.js.html
create mode 100644 docs/Line.js.html
create mode 100644 docs/Phaser.DOMSprite.html
create mode 100644 docs/Phaser.Gamepad.html
create mode 100644 docs/Phaser.GamepadButton.html
create mode 100644 docs/Phaser.Line.html
create mode 100644 docs/Phaser.SinglePad.html
create mode 100644 docs/Phaser.TimerEvent.html
create mode 100644 docs/SAT.js.html
create mode 100644 docs/SinglePad.js.html
create mode 100644 docs/TimerEvent.js.html
delete mode 100644 docs/build/build dev.bat
delete mode 100644 docs/build/conf_dev.json
diff --git a/README.md b/README.md
index 60276bdd..3c0ff441 100644
--- a/README.md
+++ b/README.md
@@ -9,11 +9,11 @@ Version: 1.1.4 "Kandor" - Released: February 5th 2014
By Richard Davey, [Photon Storm](http://www.photonstorm.com)
-View the [Official Website](http://phaser.io)
-Follow on [Twitter](https://twitter.com/photonstorm)
-Join the [Forum](http://www.html5gamedevs.com/forum/14-phaser/)
-Try out 210+ [Phaser Examples](http://examples.phaser.io)
-Read the [documentation online](http://docs.phaser.io)
+* View the [Official Website](http://phaser.io)
+* Follow on [Twitter](https://twitter.com/photonstorm)
+* Join the [Forum](http://www.html5gamedevs.com/forum/14-phaser/)
+* Try out 220+ [Phaser Examples](http://examples.phaser.io)
+* Read the [documentation online](http://docs.phaser.io)
[Subscribe to our new Phaser Newsletter](https://confirmsubscription.com/h/r/369DE48E3E86AF1E). We'll email you when new versions are released as well as send you our regular Phaser game making magazine.
diff --git a/docs/Animation.js.html b/docs/Animation.js.html
index 9234bde6..b367005b 100644
--- a/docs/Animation.js.html
+++ b/docs/Animation.js.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -423,7 +417,7 @@
/**
* @author Richard Davey <rich@photonstorm.com>
-* @copyright 2013 Photon Storm Ltd.
+* @copyright 2014 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -466,7 +460,7 @@ Phaser.Animation = function (game, parent, name, frameData, frames, delay, loope
this.name = name;
/**
- * @property {object} _frames
+ * @property {array} _frames
* @private
*/
this._frames = [];
@@ -483,7 +477,8 @@ Phaser.Animation = function (game, parent, name, frameData, frames, delay, loope
this.looped = looped;
/**
- * @property {boolean} looped - The loop state of the Animation.
+ * @property {boolean} killOnComplete - Should the parent of this Animation be killed when the animation completes?
+ * @default
*/
this.killOnComplete = false;
@@ -750,6 +745,8 @@ Phaser.Animation.prototype = {
};
+Phaser.Animation.prototype.constructor = Phaser.Animation;
+
/**
* @name Phaser.Animation#paused
* @property {boolean} paused - Gets and sets the paused state of this Animation.
@@ -906,13 +903,13 @@ Phaser.Animation.generateFrameNames = function (prefix, start, stop, suffix, zer
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:25 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/AnimationManager.js.html b/docs/AnimationManager.js.html
index 48a1f83a..7361a183 100644
--- a/docs/AnimationManager.js.html
+++ b/docs/AnimationManager.js.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -423,7 +417,7 @@
/**
* @author Richard Davey <rich@photonstorm.com>
-* @copyright 2013 Photon Storm Ltd.
+* @copyright 2014 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -734,6 +728,8 @@ Phaser.AnimationManager.prototype = {
};
+Phaser.AnimationManager.prototype.constructor = Phaser.AnimationManager;
+
/**
* @name Phaser.AnimationManager#frameData
* @property {Phaser.FrameData} frameData - The current animations FrameData.
@@ -863,13 +859,13 @@ Object.defineProperty(Phaser.AnimationManager.prototype, 'frameName', {
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:25 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/AnimationParser.js.html b/docs/AnimationParser.js.html
index 7e14835d..63062ca5 100644
--- a/docs/AnimationParser.js.html
+++ b/docs/AnimationParser.js.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -423,7 +417,7 @@
/**
* @author Richard Davey <rich@photonstorm.com>
-* @copyright 2013 Photon Storm Ltd.
+* @copyright 2014 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -443,9 +437,11 @@ Phaser.AnimationParser = {
* @param {number} frameWidth - The fixed width of each frame of the animation.
* @param {number} frameHeight - The fixed height of each frame of the animation.
* @param {number} [frameMax=-1] - The total number of animation frames to extact from the Sprite Sheet. The default value of -1 means "extract all frames".
+ * @param {number} [margin=0] - If the frames have been drawn with a margin, specify the amount here.
+ * @param {number} [spacing=0] - If the frames have been drawn with spacing between them, specify the amount here.
* @return {Phaser.FrameData} A FrameData object containing the parsed frames.
*/
- spriteSheet: function (game, key, frameWidth, frameHeight, frameMax) {
+ spriteSheet: function (game, key, frameWidth, frameHeight, frameMax, margin, spacing) {
// How big is our image?
var img = game.cache.getImage(key);
@@ -486,8 +482,8 @@ Phaser.AnimationParser = {
// Let's create some frames then
var data = new Phaser.FrameData();
- var x = 0;
- var y = 0;
+ var x = margin;
+ var y = margin;
for (var i = 0; i < total; i++)
{
@@ -502,12 +498,12 @@ Phaser.AnimationParser = {
height: frameHeight
});
- x += frameWidth;
+ x += frameWidth + spacing;
if (x === width)
{
- x = 0;
- y += frameHeight;
+ x = margin;
+ y += frameHeight + spacing;
}
}
@@ -761,13 +757,13 @@ Phaser.AnimationParser = {
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:25 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/ArcadePhysics.js.html b/docs/ArcadePhysics.js.html
index 0dd1246e..f1d2775b 100644
--- a/docs/ArcadePhysics.js.html
+++ b/docs/ArcadePhysics.js.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -423,7 +417,7 @@
/**
* @author Richard Davey <rich@photonstorm.com>
-* @copyright 2013 Photon Storm Ltd.
+* @copyright 2014 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -453,9 +447,34 @@ Phaser.Physics.Arcade = function (game) {
this.gravity = new Phaser.Point();
/**
- * @property {Phaser.Rectangle} bounds - The bounds inside of which the physics world exists. Defaults to match the world bounds.
+ * @property {SAT.Box} worldLeft - The left hand side of the physics bounds.
*/
- this.bounds = new Phaser.Rectangle(0, 0, game.world.width, game.world.height);
+ this.worldLeft = null;
+
+ /**
+ * @property {SAT.Box} worldRight - The right hand side of the physics bounds.
+ */
+ this.worldRight = null;
+
+ /**
+ * @property {SAT.Box} worldTop - The top side of the physics bounds.
+ */
+ this.worldTop = null;
+
+ /**
+ * @property {SAT.Box} worldBottom - The bottom of the physics bounds.
+ */
+ this.worldBottom = null;
+
+ /**
+ * @property {array<SAT.Polygon>} worldPolys - An array of the polygon data from the physics bounds.
+ */
+ this.worldPolys = [ null, null, null, null ];
+
+ /**
+ * @property {Phaser.QuadTree} quadTree - The world QuadTree.
+ */
+ this.quadTree = new Phaser.QuadTree(this.game.world.bounds.x, this.game.world.bounds.y, this.game.world.bounds.width, this.game.world.bounds.height, this.maxObjects, this.maxLevels);
/**
* @property {number} maxObjects - Used by the QuadTree to set the maximum number of objects per quad.
@@ -467,77 +486,6 @@ Phaser.Physics.Arcade = function (game) {
*/
this.maxLevels = 4;
- /**
- * @property {number} OVERLAP_BIAS - A value added to the delta values during collision checks.
- */
- this.OVERLAP_BIAS = 4;
-
- /**
- * @property {Phaser.QuadTree} quadTree - The world QuadTree.
- */
- this.quadTree = new Phaser.QuadTree(this, this.game.world.bounds.x, this.game.world.bounds.y, this.game.world.bounds.width, this.game.world.bounds.height, this.maxObjects, this.maxLevels);
-
- /**
- * @property {number} quadTreeID - The QuadTree ID.
- */
- this.quadTreeID = 0;
-
- // Avoid gc spikes by caching these values for re-use
-
- /**
- * @property {Phaser.Rectangle} _bounds1 - Internal cache var.
- * @private
- */
- this._bounds1 = new Phaser.Rectangle();
-
- /**
- * @property {Phaser.Rectangle} _bounds2 - Internal cache var.
- * @private
- */
- this._bounds2 = new Phaser.Rectangle();
-
- /**
- * @property {number} _overlap - Internal cache var.
- * @private
- */
- this._overlap = 0;
-
- /**
- * @property {number} _maxOverlap - Internal cache var.
- * @private
- */
- this._maxOverlap = 0;
-
- /**
- * @property {number} _velocity1 - Internal cache var.
- * @private
- */
- this._velocity1 = 0;
-
- /**
- * @property {number} _velocity2 - Internal cache var.
- * @private
- */
- this._velocity2 = 0;
-
- /**
- * @property {number} _newVelocity1 - Internal cache var.
- * @private
- */
- this._newVelocity1 = 0;
-
- /**
- * @property {number} _newVelocity2 - Internal cache var.
- * @private
- */
- this._newVelocity2 = 0;
-
- /**
- * @property {number} _average - Internal cache var.
- * @private
- */
- this._average = 0;
-
/**
* @property {Array} _mapData - Internal cache var.
* @private
@@ -568,6 +516,12 @@ Phaser.Physics.Arcade = function (game) {
*/
this._angle = 0;
+ /**
+ * @property {number} _drag - Internal cache var.
+ * @private
+ */
+ this._drag = 0;
+
/**
* @property {number} _dx - Internal cache var.
* @private
@@ -580,10 +534,212 @@ Phaser.Physics.Arcade = function (game) {
*/
this._dy = 0;
+ /**
+ * @property {Phaser.Point} _p - Internal cache var.
+ * @private
+ */
+ this._p = new Phaser.Point(0, 0);
+
+ /**
+ * @property {number} _intersection - Internal cache var.
+ * @private
+ */
+ this._intersection = [0,0,0,0];
+
+ /**
+ * @property {number} _gravityX - Internal cache var.
+ * @private
+ */
+ this._gravityX = 0;
+
+ /**
+ * @property {number} _gravityY - Internal cache var.
+ * @private
+ */
+ this._gravityY = 0;
+
+ /**
+ * @property {SAT.Response} _response - Internal cache var.
+ * @private
+ */
+ this._response = new SAT.Response();
+
+ // Set the bounds to the world as default
+ this.setBoundsToWorld(true, true, true, true);
+
};
+/**
+* @constant
+* @type {number}
+*/
+Phaser.Physics.Arcade.RECT = 0;
+
+/**
+* @constant
+* @type {number}
+*/
+Phaser.Physics.Arcade.CIRCLE = 1;
+
+/**
+* @constant
+* @type {number}
+*/
+Phaser.Physics.Arcade.POLYGON = 2;
+
Phaser.Physics.Arcade.prototype = {
+ /**
+ * Checks the given Physics.Body against the Physics Bounds, if any are set, and separates them, setting the blocked flags on the Body as it does so.
+ *
+ * @method Phaser.Physics.Arcade#checkBounds
+ * @param {Phaser.Physics.Arcade.Body} The Body object to be checked.
+ * @return {boolean} True if the body hit the bounds, otherwise false.
+ */
+ checkBounds: function (body) {
+
+ if (!body.collideWorldBounds || (!this.worldLeft && !this.worldRight && !this.worldTop && !this.worldBottom))
+ {
+ return false;
+ }
+
+ this._response.clear();
+
+ var test = SAT.testPolygonPolygon;
+ var part = body.polygon;
+ var rebounded = false;
+
+ if (body.type === Phaser.Physics.Arcade.CIRCLE)
+ {
+ test = SAT.testPolygonCircle;
+ part = body.shape;
+ }
+
+ if (this.worldLeft && test(this.worldPolys[0], part, this._response))
+ {
+ body.blocked.left = true;
+ part.pos.add(this._response.overlapV);
+ body.blocked.x = Math.floor(body.x);
+ body.blocked.y = Math.floor(body.y);
+ rebounded = true;
+ }
+ else if (this.worldRight && test(this.worldPolys[1], part, this._response))
+ {
+ body.blocked.right = true;
+ part.pos.add(this._response.overlapV);
+ body.blocked.x = Math.floor(body.x);
+ body.blocked.y = Math.floor(body.y);
+ rebounded = true;
+ }
+
+ this._response.clear();
+
+ if (this.worldTop && test(this.worldPolys[2], part, this._response))
+ {
+ body.blocked.up = true;
+ part.pos.add(this._response.overlapV);
+ body.blocked.x = Math.floor(body.x);
+ body.blocked.y = Math.floor(body.y);
+ rebounded = true;
+ }
+ else if (this.worldBottom && test(this.worldPolys[3], part, this._response))
+ {
+ body.blocked.down = true;
+ part.pos.add(this._response.overlapV);
+ body.blocked.x = Math.floor(body.x);
+ body.blocked.y = Math.floor(body.y);
+ rebounded = true;
+ }
+
+ return rebounded;
+
+ },
+
+ /**
+ * Sets the bounds of the Physics world to match the Game.World.
+ * You can optionally set which 'walls' to create: left, right, top or bottom.
+ *
+ * @method Phaser.Physics.Arcade#setBoundsToWorld
+ * @param {boolean} [left=true] - If true will create the left bounds wall.
+ * @param {boolean} [right=true] - If true will create the right bounds wall.
+ * @param {boolean} [top=true] - If true will create the top bounds wall.
+ * @param {boolean} [bottom=true] - If true will create the bottom bounds wall.
+ */
+ setBoundsToWorld: function (left, right, top, bottom) {
+
+ this.setBounds(this.game.world.bounds.x, this.game.world.bounds.y, this.game.world.bounds.width, this.game.world.bounds.height, left, right, top, bottom);
+
+ },
+
+ /**
+ * Sets the bounds of the Physics world to match the given world pixel dimensions.
+ * You can optionally set which 'walls' to create: left, right, top or bottom.
+ *
+ * @method Phaser.Physics.Arcade#setBounds
+ * @param {number} x - The x coordinate of the top-left corner of the bounds.
+ * @param {number} y - The y coordinate of the top-left corner of the bounds.
+ * @param {number} width - The width of the bounds.
+ * @param {number} height - The height of the bounds.
+ * @param {boolean} [left=true] - If true will create the left bounds wall.
+ * @param {boolean} [right=true] - If true will create the right bounds wall.
+ * @param {boolean} [top=true] - If true will create the top bounds wall.
+ * @param {boolean} [bottom=true] - If true will create the bottom bounds wall.
+ */
+ setBounds: function (x, y, width, height, left, right, top, bottom) {
+
+ if (typeof left === 'undefined') { left = true; }
+ if (typeof right === 'undefined') { right = true; }
+ if (typeof top === 'undefined') { top = true; }
+ if (typeof bottom === 'undefined') { bottom = true; }
+
+ var thickness = 100;
+
+ if (left)
+ {
+ this.worldLeft = new SAT.Box(new SAT.Vector(x - thickness, y), thickness, height);
+ this.worldPolys[0] = this.worldLeft.toPolygon();
+ }
+ else
+ {
+ this.worldLeft = null;
+ this.worldPolys[0] = null;
+ }
+
+ if (right)
+ {
+ this.worldRight = new SAT.Box(new SAT.Vector(x + width, y), thickness, height);
+ this.worldPolys[1] = this.worldRight.toPolygon();
+ }
+ else
+ {
+ this.worldRight = null;
+ this.worldPolys[1] = null;
+ }
+
+ if (top)
+ {
+ this.worldTop = new SAT.Box(new SAT.Vector(x, y - thickness), width, thickness);
+ this.worldPolys[2] = this.worldTop.toPolygon();
+ }
+ else
+ {
+ this.worldTop = null;
+ this.worldPolys[2] = null;
+ }
+
+ if (bottom)
+ {
+ this.worldBottom = new SAT.Box(new SAT.Vector(x, y + height), width, thickness);
+ this.worldPolys[3] = this.worldBottom.toPolygon();
+ }
+ else
+ {
+ this.worldBottom = null;
+ this.worldPolys[3] = null;
+ }
+
+ },
+
/**
* Called automatically by a Physics body, it updates all motion related values on the Body.
*
@@ -594,113 +750,68 @@ Phaser.Physics.Arcade.prototype = {
// If you're wondering why the velocity is halved and applied twice, read this: http://www.niksula.hut.fi/~hkankaan/Homepages/gravity.html
+ // World gravity is allowed
+ if (body.allowGravity)
+ {
+ this._gravityX = this.gravity.x + body.gravity.x;
+ this._gravityY = this.gravity.y + body.gravity.y;
+ }
+ else
+ {
+ this._gravityX = body.gravity.x;
+ this._gravityY = body.gravity.y;
+ }
+
+ // Don't apply gravity to any body that is blocked
+ if ((this._gravityX < 0 && body.blocked.left) || (this._gravityX > 0 && body.blocked.right))
+ {
+ this._gravityX = 0;
+ }
+
+ if ((this._gravityY < 0 && body.blocked.up) || (this._gravityY > 0 && body.blocked.down))
+ {
+ this._gravityY = 0;
+ }
+
// Rotation
- this._velocityDelta = (this.computeVelocity(0, body, body.angularVelocity, body.angularAcceleration, body.angularDrag, body.maxAngular) - body.angularVelocity) * this.game.time.physicsElapsed * 0.5 * 60;
- body.angularVelocity += this._velocityDelta;
- body.rotation += (body.angularVelocity * this.game.time.physicsElapsed);
- body.angularVelocity += this._velocityDelta;
-
- // Horizontal
- this._velocityDelta = (this.computeVelocity(1, body, body.velocity.x, body.acceleration.x, body.drag.x, body.maxVelocity.x) - body.velocity.x) * this.game.time.physicsElapsed * 0.5 * 60;
- body.velocity.x += this._velocityDelta;
- body.x += (body.velocity.x * this.game.time.physicsElapsed);
- body.velocity.x += this._velocityDelta;
-
- // Vertical
- this._velocityDelta = (this.computeVelocity(2, body, body.velocity.y, body.acceleration.y, body.drag.y, body.maxVelocity.y) - body.velocity.y) * this.game.time.physicsElapsed * 0.5 * 60;
- body.velocity.y += this._velocityDelta;
- body.y += (body.velocity.y * this.game.time.physicsElapsed);
- body.velocity.y += this._velocityDelta;
-
- },
-
- /**
- * A tween-like function that takes a starting velocity and some other factors and returns an altered velocity.
- *
- * @method Phaser.Physics.Arcade#computeVelocity
- * @param {number} axis - 1 for horizontal, 2 for vertical.
- * @param {Phaser.Physics.Arcade.Body} body - The Body object to be updated.
- * @param {number} velocity - Any component of velocity (e.g. 20).
- * @param {number} acceleration - Rate at which the velocity is changing.
- * @param {number} drag - Really kind of a deceleration, this is how much the velocity changes if Acceleration is not set.
- * @param {number} mMax - An absolute value cap for the velocity.
- * @return {number} The altered Velocity value.
- */
- computeVelocity: function (axis, body, velocity, acceleration, drag, max) {
-
- max = max || 10000;
-
- if (axis == 1 && body.allowGravity)
+ if (body.allowRotation)
{
- velocity += this.gravity.x + body.gravity.x;
- }
- else if (axis == 2 && body.allowGravity)
- {
- velocity += this.gravity.y + body.gravity.y;
- }
+ this._velocityDelta = body.angularAcceleration * this.game.time.physicsElapsed;
- if (acceleration !== 0)
- {
- velocity += acceleration * this.game.time.physicsElapsed;
- }
- else if (drag !== 0)
- {
- this._drag = drag * this.game.time.physicsElapsed;
-
- if (velocity - this._drag > 0)
+ if (body.angularDrag !== 0 && body.angularAcceleration === 0)
{
- velocity -= this._drag;
+ this._drag = body.angularDrag * this.game.time.physicsElapsed;
+
+ if (body.angularVelocity > 0)
+ {
+ body.angularVelocity -= this._drag;
+ }
+ else if (body.angularVelocity < 0)
+ {
+ body.angularVelocity += this._drag;
+ }
}
- else if (velocity + this._drag < 0)
+
+ body.rotation += this.game.time.physicsElapsed * (body.angularVelocity + this._velocityDelta / 2);
+ body.angularVelocity += this._velocityDelta;
+
+ if (body.angularVelocity > body.maxAngular)
{
- velocity += this._drag;
+ body.angularVelocity = body.maxAngular;
}
- else
+ else if (body.angularVelocity < -body.maxAngular)
{
- velocity = 0;
+ body.angularVelocity = -body.maxAngular;
}
}
- if (velocity > max)
- {
- velocity = max;
- }
- else if (velocity < -max)
- {
- velocity = -max;
- }
+ // temp = acc*dt
+ // pos = pos + dt*(vel + temp/2)
+ // vel = vel + temp
- return velocity;
+ this._p.setTo((body.acceleration.x + this._gravityX) * this.game.time.physicsElapsed, (body.acceleration.y + this._gravityY) * this.game.time.physicsElapsed);
- },
-
- /**
- * Called automatically by the core game loop.
- *
- * @method Phaser.Physics.Arcade#preUpdate
- * @protected
- */
- preUpdate: function () {
-
- // Clear the tree
- this.quadTree.clear();
-
- // Create our tree which all of the Physics bodies will add themselves to
- this.quadTreeID = 0;
- this.quadTree = new Phaser.QuadTree(this, this.game.world.bounds.x, this.game.world.bounds.y, this.game.world.bounds.width, this.game.world.bounds.height, this.maxObjects, this.maxLevels);
-
- },
-
- /**
- * Called automatically by the core game loop.
- *
- * @method Phaser.Physics.Arcade#postUpdate
- * @protected
- */
- postUpdate: function () {
-
- // Clear the tree ready for the next update
- this.quadTree.clear();
+ return this._p;
},
@@ -708,10 +819,11 @@ Phaser.Physics.Arcade.prototype = {
* Checks for overlaps between two game objects. The objects can be Sprites, Groups or Emitters.
* You can perform Sprite vs. Sprite, Sprite vs. Group and Group vs. Group overlap checks.
* Unlike collide the objects are NOT automatically separated or have any physics applied, they merely test for overlap results.
+ * The second parameter can be an array of objects, of differing types.
*
* @method Phaser.Physics.Arcade#overlap
* @param {Phaser.Sprite|Phaser.Group|Phaser.Particles.Emitter} object1 - The first object to check. Can be an instance of Phaser.Sprite, Phaser.Group or Phaser.Particles.Emitter.
- * @param {Phaser.Sprite|Phaser.Group|Phaser.Particles.Emitter} object2 - The second object to check. Can be an instance of Phaser.Sprite, Phaser.Group or Phaser.Particles.Emitter.
+ * @param {Phaser.Sprite|Phaser.Group|Phaser.Particles.Emitter|array} object2 - The second object or array of objects to check. Can be Phaser.Sprite, Phaser.Group or Phaser.Particles.Emitter.
* @param {function} [overlapCallback=null] - An optional callback function that is called if the objects overlap. The two objects will be passed to this function in the same order in which you specified them.
* @param {function} [processCallback=null] - A callback function that lets you perform additional checks against the two objects if they overlap. If this is set then overlapCallback will only be called if processCallback returns true.
* @param {object} [callbackContext] - The context in which to run the callbacks.
@@ -726,83 +838,144 @@ Phaser.Physics.Arcade.prototype = {
this._result = false;
this._total = 0;
- // Only test valid objects
- if (object1 && object2 && object1.exists && object2.exists)
+ if (Array.isArray(object2))
{
- // SPRITES
- if (object1.type == Phaser.SPRITE)
+ for (var i = 0, len = object2.length; i < len; i++)
{
- if (object2.type == Phaser.SPRITE)
- {
- this.overlapSpriteVsSprite(object1, object2, overlapCallback, processCallback, callbackContext);
- }
- else if (object2.type == Phaser.GROUP || object2.type == Phaser.EMITTER)
- {
- this.overlapSpriteVsGroup(object1, object2, overlapCallback, processCallback, callbackContext);
- }
- }
- // GROUPS
- else if (object1.type == Phaser.GROUP)
- {
- if (object2.type == Phaser.SPRITE)
- {
- this.overlapSpriteVsGroup(object2, object1, overlapCallback, processCallback, callbackContext);
- }
- else if (object2.type == Phaser.GROUP || object2.type == Phaser.EMITTER)
- {
- this.overlapGroupVsGroup(object1, object2, overlapCallback, processCallback, callbackContext);
- }
- }
- // EMITTER
- else if (object1.type == Phaser.EMITTER)
- {
- if (object2.type == Phaser.SPRITE)
- {
- this.overlapSpriteVsGroup(object2, object1, overlapCallback, processCallback, callbackContext);
- }
- else if (object2.type == Phaser.GROUP || object2.type == Phaser.EMITTER)
- {
- this.overlapGroupVsGroup(object1, object2, overlapCallback, processCallback, callbackContext);
- }
+ this.collideHandler(object1, object2[i], overlapCallback, processCallback, callbackContext, true);
}
}
+ else
+ {
+ this.collideHandler(object1, object2, overlapCallback, processCallback, callbackContext, true);
+ }
return (this._total > 0);
},
/**
- * An internal function. Use Phaser.Physics.Arcade.overlap instead.
+ * Checks for collision between two game objects. You can perform Sprite vs. Sprite, Sprite vs. Group, Group vs. Group, Sprite vs. Tilemap Layer or Group vs. Tilemap Layer collisions.
+ * The second parameter can be an array of objects, of differing types.
+ * The objects are also automatically separated. If you don't require separation then use ArcadePhysics.overlap instead.
+ * An optional processCallback can be provided. If given this function will be called when two sprites are found to be colliding. It is called before any separation takes place,
+ * giving you the chance to perform additional checks. If the function returns true then the collision and separation is carried out. If it returns false it is skipped.
+ * The collideCallback is an optional function that is only called if two sprites collide. If a processCallback has been set then it needs to return true for collideCallback to be called.
*
- * @method Phaser.Physics.Arcade#overlapSpriteVsSprite
- * @private
+ * @method Phaser.Physics.Arcade#collide
+ * @param {Phaser.Sprite|Phaser.Group|Phaser.Particles.Emitter|Phaser.Tilemap} object1 - The first object to check. Can be an instance of Phaser.Sprite, Phaser.Group, Phaser.Particles.Emitter, or Phaser.Tilemap.
+ * @param {Phaser.Sprite|Phaser.Group|Phaser.Particles.Emitter|Phaser.Tilemap|array} object2 - The second object or array of objects to check. Can be Phaser.Sprite, Phaser.Group, Phaser.Particles.Emitter or Phaser.Tilemap.
+ * @param {function} [collideCallback=null] - An optional callback function that is called if the objects collide. The two objects will be passed to this function in the same order in which you specified them.
+ * @param {function} [processCallback=null] - A callback function that lets you perform additional checks against the two objects if they overlap. If this is set then collision will only happen if processCallback returns true. The two objects will be passed to this function in the same order in which you specified them.
+ * @param {object} [callbackContext] - The context in which to run the callbacks.
+ * @returns {boolean} True if a collision occured otherwise false.
*/
- overlapSpriteVsSprite: function (sprite1, sprite2, overlapCallback, processCallback, callbackContext) {
+ collide: function (object1, object2, collideCallback, processCallback, callbackContext) {
- this._result = Phaser.Rectangle.intersects(sprite1.body, sprite2.body);
+ collideCallback = collideCallback || null;
+ processCallback = processCallback || null;
+ callbackContext = callbackContext || collideCallback;
- if (this._result)
+ this._result = false;
+ this._total = 0;
+
+ if (Array.isArray(object2))
{
- // They collided, is there a custom process callback?
- if (processCallback)
+ for (var i = 0, len = object2.length; i < len; i++)
{
- if (processCallback.call(callbackContext, sprite1, sprite2))
- {
- this._total++;
+ this.collideHandler(object1, object2[i], collideCallback, processCallback, callbackContext, false);
+ }
+ }
+ else
+ {
+ this.collideHandler(object1, object2, collideCallback, processCallback, callbackContext, false);
+ }
- if (overlapCallback)
- {
- overlapCallback.call(callbackContext, sprite1, sprite2);
- }
+ return (this._total > 0);
+
+ },
+
+ /**
+ * Internal collision handler.
+ *
+ * @method Phaser.Physics.Arcade#collideHandler
+ * @private
+ * @param {Phaser.Sprite|Phaser.Group|Phaser.Particles.Emitter|Phaser.Tilemap} object1 - The first object to check. Can be an instance of Phaser.Sprite, Phaser.Group, Phaser.Particles.Emitter, or Phaser.Tilemap.
+ * @param {Phaser.Sprite|Phaser.Group|Phaser.Particles.Emitter|Phaser.Tilemap} object2 - The second object to check. Can be an instance of Phaser.Sprite, Phaser.Group, Phaser.Particles.Emitter or Phaser.Tilemap. Can also be an array of objects to check.
+ * @param {function} collideCallback - An optional callback function that is called if the objects collide. The two objects will be passed to this function in the same order in which you specified them.
+ * @param {function} processCallback - A callback function that lets you perform additional checks against the two objects if they overlap. If this is set then collision will only happen if processCallback returns true. The two objects will be passed to this function in the same order in which you specified them.
+ * @param {object} callbackContext - The context in which to run the callbacks.
+ * @param {boolean} overlapOnly - Just run an overlap or a full collision.
+ */
+ collideHandler: function (object1, object2, collideCallback, processCallback, callbackContext, overlapOnly) {
+
+ // Only collide valid objects
+ if (typeof object2 === 'undefined' && (object1.type === Phaser.GROUP || object1.type === Phaser.EMITTER))
+ {
+ this.collideGroupVsSelf(object1, collideCallback, processCallback, callbackContext, overlapOnly);
+ return;
+ }
+
+ if (object1 && object2 && object1.exists && object2.exists)
+ {
+ // SPRITES
+ if (object1.type == Phaser.SPRITE || object1.type == Phaser.TILESPRITE)
+ {
+ if (object2.type == Phaser.SPRITE || object2.type == Phaser.TILESPRITE)
+ {
+ this.collideSpriteVsSprite(object1, object2, collideCallback, processCallback, callbackContext, overlapOnly);
+ }
+ else if (object2.type == Phaser.GROUP || object2.type == Phaser.EMITTER)
+ {
+ this.collideSpriteVsGroup(object1, object2, collideCallback, processCallback, callbackContext, overlapOnly);
+ }
+ else if (object2.type == Phaser.TILEMAPLAYER)
+ {
+ this.collideSpriteVsTilemapLayer(object1, object2, collideCallback, processCallback, callbackContext);
}
}
- else
+ // GROUPS
+ else if (object1.type == Phaser.GROUP)
{
- this._total++;
-
- if (overlapCallback)
+ if (object2.type == Phaser.SPRITE || object2.type == Phaser.TILESPRITE)
{
- overlapCallback.call(callbackContext, sprite1, sprite2);
+ this.collideSpriteVsGroup(object2, object1, collideCallback, processCallback, callbackContext, overlapOnly);
+ }
+ else if (object2.type == Phaser.GROUP || object2.type == Phaser.EMITTER)
+ {
+ this.collideGroupVsGroup(object1, object2, collideCallback, processCallback, callbackContext, overlapOnly);
+ }
+ else if (object2.type == Phaser.TILEMAPLAYER)
+ {
+ this.collideGroupVsTilemapLayer(object1, object2, collideCallback, processCallback, callbackContext);
+ }
+ }
+ // TILEMAP LAYERS
+ else if (object1.type == Phaser.TILEMAPLAYER)
+ {
+ if (object2.type == Phaser.SPRITE || object2.type == Phaser.TILESPRITE)
+ {
+ this.collideSpriteVsTilemapLayer(object2, object1, collideCallback, processCallback, callbackContext);
+ }
+ else if (object2.type == Phaser.GROUP || object2.type == Phaser.EMITTER)
+ {
+ this.collideGroupVsTilemapLayer(object2, object1, collideCallback, processCallback, callbackContext);
+ }
+ }
+ // EMITTER
+ else if (object1.type == Phaser.EMITTER)
+ {
+ if (object2.type == Phaser.SPRITE || object2.type == Phaser.TILESPRITE)
+ {
+ this.collideSpriteVsGroup(object2, object1, collideCallback, processCallback, callbackContext, overlapOnly);
+ }
+ else if (object2.type == Phaser.GROUP || object2.type == Phaser.EMITTER)
+ {
+ this.collideGroupVsGroup(object1, object2, collideCallback, processCallback, callbackContext, overlapOnly);
+ }
+ else if (object2.type == Phaser.TILEMAPLAYER)
+ {
+ this.collideGroupVsTilemapLayer(object1, object2, collideCallback, processCallback, callbackContext);
}
}
}
@@ -810,12 +983,32 @@ Phaser.Physics.Arcade.prototype = {
},
/**
- * An internal function. Use Phaser.Physics.Arcade.overlap instead.
+ * An internal function. Use Phaser.Physics.Arcade.collide instead.
*
- * @method Phaser.Physics.Arcade#overlapSpriteVsGroup
+ * @method Phaser.Physics.Arcade#collideSpriteVsSprite
* @private
*/
- overlapSpriteVsGroup: function (sprite, group, overlapCallback, processCallback, callbackContext) {
+ collideSpriteVsSprite: function (sprite1, sprite2, collideCallback, processCallback, callbackContext, overlapOnly) {
+
+ if (this.separate(sprite1.body, sprite2.body, processCallback, callbackContext, overlapOnly))
+ {
+ if (collideCallback)
+ {
+ collideCallback.call(callbackContext, sprite1, sprite2);
+ }
+
+ this._total++;
+ }
+
+ },
+
+ /**
+ * An internal function. Use Phaser.Physics.Arcade.collide instead.
+ *
+ * @method Phaser.Physics.Arcade#collideSpriteVsGroup
+ * @private
+ */
+ collideSpriteVsGroup: function (sprite, group, collideCallback, processCallback, callbackContext, overlapOnly) {
if (group.length === 0)
{
@@ -823,28 +1016,52 @@ Phaser.Physics.Arcade.prototype = {
}
// What is the sprite colliding with in the quadtree?
+ this.quadTree.clear();
+
+ this.quadTree = new Phaser.QuadTree(this.game.world.bounds.x, this.game.world.bounds.y, this.game.world.bounds.width, this.game.world.bounds.height, this.maxObjects, this.maxLevels);
+
+ this.quadTree.populate(group);
+
this._potentials = this.quadTree.retrieve(sprite);
for (var i = 0, len = this._potentials.length; i < len; i++)
{
// We have our potential suspects, are they in this group?
- if (this._potentials[i].sprite.group == group)
+ if (this.separate(sprite.body, this._potentials[i], processCallback, callbackContext, overlapOnly))
{
- this._result = Phaser.Rectangle.intersects(sprite.body, this._potentials[i]);
-
- if (this._result && processCallback)
+ if (collideCallback)
{
- this._result = processCallback.call(callbackContext, sprite, this._potentials[i].sprite);
+ collideCallback.call(callbackContext, sprite, this._potentials[i].sprite);
}
- if (this._result)
- {
- this._total++;
+ this._total++;
+ }
+ }
- if (overlapCallback)
- {
- overlapCallback.call(callbackContext, sprite, this._potentials[i].sprite);
- }
+ },
+
+ /**
+ * An internal function. Use Phaser.Physics.Arcade.collide instead.
+ *
+ * @method Phaser.Physics.Arcade#collideGroupVsSelf
+ * @private
+ */
+ collideGroupVsSelf: function (group, collideCallback, processCallback, callbackContext, overlapOnly) {
+
+ if (group.length === 0)
+ {
+ return;
+ }
+
+ var len = group._container.children.length;
+
+ for (var i = 0; i < len; i++)
+ {
+ for (var j = i + 1; j <= len; j++)
+ {
+ if (group._container.children[i] && group._container.children[j] && group._container.children[i].exists && group._container.children[j].exists)
+ {
+ this.collideSpriteVsSprite(group._container.children[i], group._container.children[j], collideCallback, processCallback, callbackContext, overlapOnly);
}
}
}
@@ -852,12 +1069,12 @@ Phaser.Physics.Arcade.prototype = {
},
/**
- * An internal function. Use Phaser.Physics.Arcade.overlap instead.
+ * An internal function. Use Phaser.Physics.Arcade.collide instead.
*
- * @method Phaser.Physics.Arcade#overlapGroupVsGroup
+ * @method Phaser.Physics.Arcade#collideGroupVsGroup
* @private
*/
- overlapGroupVsGroup: function (group1, group2, overlapCallback, processCallback, callbackContext) {
+ collideGroupVsGroup: function (group1, group2, collideCallback, processCallback, callbackContext, overlapOnly) {
if (group1.length === 0 || group2.length === 0)
{
@@ -872,7 +1089,7 @@ Phaser.Physics.Arcade.prototype = {
{
if (currentNode.exists)
{
- this.overlapSpriteVsGroup(currentNode, group2, overlapCallback, processCallback, callbackContext);
+ this.collideSpriteVsGroup(currentNode, group2, collideCallback, processCallback, callbackContext, overlapOnly);
}
currentNode = currentNode._iNext;
}
@@ -881,99 +1098,6 @@ Phaser.Physics.Arcade.prototype = {
},
- /**
- * Checks for collision between two game objects. The objects can be Sprites, Groups, Emitters or Tilemap Layers.
- * You can perform Sprite vs. Sprite, Sprite vs. Group, Group vs. Group, Sprite vs. Tilemap Layer or Group vs. Tilemap Layer collisions.
- * The objects are also automatically separated.
- *
- * @method Phaser.Physics.Arcade#collide
- * @param {Phaser.Sprite|Phaser.Group|Phaser.Particles.Emitter|Phaser.Tilemap} object1 - The first object to check. Can be an instance of Phaser.Sprite, Phaser.Group, Phaser.Particles.Emitter, or Phaser.Tilemap
- * @param {Phaser.Sprite|Phaser.Group|Phaser.Particles.Emitter|Phaser.Tilemap} object2 - The second object to check. Can be an instance of Phaser.Sprite, Phaser.Group, Phaser.Particles.Emitter or Phaser.Tilemap
- * @param {function} [collideCallback=null] - An optional callback function that is called if the objects overlap. The two objects will be passed to this function in the same order in which you specified them.
- * @param {function} [processCallback=null] - A callback function that lets you perform additional checks against the two objects if they overlap. If this is set then collideCallback will only be called if processCallback returns true.
- * @param {object} [callbackContext] - The context in which to run the callbacks.
- * @returns {boolean} True if a collision occured otherwise false.
- */
- collide: function (object1, object2, collideCallback, processCallback, callbackContext) {
-
- collideCallback = collideCallback || null;
- processCallback = processCallback || null;
- callbackContext = callbackContext || collideCallback;
-
- this._result = false;
- this._total = 0;
-
- // Only collide valid objects
- if (object1 && object2 && object1.exists && object2.exists)
- {
- // Can expand to support Buttons, Text, etc at a later date. For now these are the essentials.
-
- // SPRITES
- if (object1.type == Phaser.SPRITE)
- {
- if (object2.type == Phaser.SPRITE)
- {
- this.collideSpriteVsSprite(object1, object2, collideCallback, processCallback, callbackContext);
- }
- else if (object2.type == Phaser.GROUP || object2.type == Phaser.EMITTER)
- {
- this.collideSpriteVsGroup(object1, object2, collideCallback, processCallback, callbackContext);
- }
- else if (object2.type == Phaser.TILEMAPLAYER)
- {
- this.collideSpriteVsTilemapLayer(object1, object2, collideCallback, processCallback, callbackContext);
- }
- }
- // GROUPS
- else if (object1.type == Phaser.GROUP)
- {
- if (object2.type == Phaser.SPRITE)
- {
- this.collideSpriteVsGroup(object2, object1, collideCallback, processCallback, callbackContext);
- }
- else if (object2.type == Phaser.GROUP || object2.type == Phaser.EMITTER)
- {
- this.collideGroupVsGroup(object1, object2, collideCallback, processCallback, callbackContext);
- }
- else if (object2.type == Phaser.TILEMAPLAYER)
- {
- this.collideGroupVsTilemapLayer(object1, object2, collideCallback, processCallback, callbackContext);
- }
- }
- // TILEMAP LAYERS
- else if (object1.type == Phaser.TILEMAPLAYER)
- {
- if (object2.type == Phaser.SPRITE)
- {
- this.collideSpriteVsTilemapLayer(object2, object1, collideCallback, processCallback, callbackContext);
- }
- else if (object2.type == Phaser.GROUP || object2.type == Phaser.EMITTER)
- {
- this.collideGroupVsTilemapLayer(object2, object1, collideCallback, processCallback, callbackContext);
- }
- }
- // EMITTER
- else if (object1.type == Phaser.EMITTER)
- {
- if (object2.type == Phaser.SPRITE)
- {
- this.collideSpriteVsGroup(object2, object1, collideCallback, processCallback, callbackContext);
- }
- else if (object2.type == Phaser.GROUP || object2.type == Phaser.EMITTER)
- {
- this.collideGroupVsGroup(object1, object2, collideCallback, processCallback, callbackContext);
- }
- else if (object2.type == Phaser.TILEMAPLAYER)
- {
- this.collideGroupVsTilemapLayer(object1, object2, collideCallback, processCallback, callbackContext);
- }
- }
- }
-
- return (this._total > 0);
-
- },
-
/**
* An internal function. Use Phaser.Physics.Arcade.collide instead.
*
@@ -982,15 +1106,21 @@ Phaser.Physics.Arcade.prototype = {
*/
collideSpriteVsTilemapLayer: function (sprite, tilemapLayer, collideCallback, processCallback, callbackContext) {
- this._mapData = tilemapLayer.getTiles(sprite.body.x, sprite.body.y, sprite.body.width, sprite.body.height, true);
+ this._mapData = tilemapLayer.getTiles(sprite.body.left, sprite.body.top, sprite.body.width, sprite.body.height, true);
if (this._mapData.length === 0)
{
return;
}
- for (var i = 0; i < this._mapData.length; i++)
+ if (this._mapData.length > 1)
{
+ this.separateTiles(sprite.body, this._mapData);
+ }
+ else
+ {
+ var i = 0;
+
if (this.separateTile(sprite.body, this._mapData[i]))
{
// They collided, is there a custom process callback?
@@ -1033,11 +1163,6 @@ Phaser.Physics.Arcade.prototype = {
return;
}
- if (group.length === 0)
- {
- return;
- }
-
if (group._container.first._iNext)
{
var currentNode = group._container.first._iNext;
@@ -1055,232 +1180,39 @@ Phaser.Physics.Arcade.prototype = {
},
- /**
- * An internal function. Use Phaser.Physics.Arcade.collide instead.
- *
- * @method Phaser.Physics.Arcade#collideSpriteVsSprite
- * @private
- */
- collideSpriteVsSprite: function (sprite1, sprite2, collideCallback, processCallback, callbackContext) {
-
- this.separate(sprite1.body, sprite2.body);
-
- if (this._result)
- {
- // They collided, is there a custom process callback?
- if (processCallback)
- {
- if (processCallback.call(callbackContext, sprite1, sprite2))
- {
- this._total++;
-
- if (collideCallback)
- {
- collideCallback.call(callbackContext, sprite1, sprite2);
- }
- }
- }
- else
- {
- this._total++;
-
- if (collideCallback)
- {
- collideCallback.call(callbackContext, sprite1, sprite2);
- }
- }
- }
-
- },
-
- /**
- * An internal function. Use Phaser.Physics.Arcade.collide instead.
- *
- * @method Phaser.Physics.Arcade#collideSpriteVsGroup
- * @private
- */
- collideSpriteVsGroup: function (sprite, group, collideCallback, processCallback, callbackContext) {
-
- if (group.length === 0)
- {
- return;
- }
-
- // What is the sprite colliding with in the quadtree?
- this._potentials = this.quadTree.retrieve(sprite);
-
- for (var i = 0, len = this._potentials.length; i < len; i++)
- {
- // We have our potential suspects, are they in this group?
- if (this._potentials[i].sprite.group == group)
- {
- this.separate(sprite.body, this._potentials[i]);
-
- if (this._result && processCallback)
- {
- this._result = processCallback.call(callbackContext, sprite, this._potentials[i].sprite);
- }
-
- if (this._result)
- {
- this._total++;
-
- if (collideCallback)
- {
- collideCallback.call(callbackContext, sprite, this._potentials[i].sprite);
- }
- }
- }
- }
-
- },
-
- /**
- * An internal function. Use Phaser.Physics.Arcade.collide instead.
- *
- * @method Phaser.Physics.Arcade#collideGroupVsGroup
- * @private
- */
- collideGroupVsGroup: function (group1, group2, collideCallback, processCallback, callbackContext) {
-
- if (group1.length === 0 || group2.length === 0)
- {
- return;
- }
-
- if (group1._container.first._iNext)
- {
- var currentNode = group1._container.first._iNext;
-
- do
- {
- if (currentNode.exists)
- {
- this.collideSpriteVsGroup(currentNode, group2, collideCallback, processCallback, callbackContext);
- }
- currentNode = currentNode._iNext;
- }
- while (currentNode != group1._container.last._iNext);
- }
-
- },
-
/**
* The core separation function to separate two physics bodies.
* @method Phaser.Physics.Arcade#separate
* @param {Phaser.Physics.Arcade.Body} body1 - The Body object to separate.
* @param {Phaser.Physics.Arcade.Body} body2 - The Body object to separate.
- * @returns {boolean} Returns true if the bodies were separated, otherwise false.
+ * @param {function} [processCallback=null] - A callback function that lets you perform additional checks against the two objects if they overlap. If this function is set then the sprites will only be collided if it returns true.
+ * @param {object} [callbackContext] - The context in which to run the process callback.
+ * @returns {boolean} Returns true if the bodies collided, otherwise false.
*/
- separate: function (body1, body2) {
+ separate: function (body1, body2, processCallback, callbackContext, overlapOnly) {
- this._result = (this.separateX(body1, body2) || this.separateY(body1, body2));
-
- },
-
- /**
- * The core separation function to separate two physics bodies on the x axis.
- * @method Phaser.Physics.Arcade#separateX
- * @param {Phaser.Physics.Arcade.Body} body1 - The Body object to separate.
- * @param {Phaser.Physics.Arcade.Body} body2 - The Body object to separate.
- * @returns {boolean} Returns true if the bodies were separated, otherwise false.
- */
- separateX: function (body1, body2) {
-
- // Can't separate two immovable bodies
- if (body1.immovable && body2.immovable)
+ if (body1 === body2 || this.intersects(body1, body2) === false)
{
return false;
}
- this._overlap = 0;
-
- // Check if the hulls actually overlap
- if (Phaser.Rectangle.intersects(body1, body2))
+ // They overlap. Is there a custom process callback? If it returns true then we can carry on, otherwise we should abort.
+ if (processCallback && processCallback.call(callbackContext, body1.sprite, body2.sprite) === false)
{
- this._maxOverlap = body1.deltaAbsX() + body2.deltaAbsX() + this.OVERLAP_BIAS;
+ return false;
+ }
- if (body1.deltaX() === 0 && body2.deltaX() === 0)
+ this._response.clear();
+
+ if (overlapOnly)
+ {
+ return body1.overlap(body2, this._response);
+ }
+ else
+ {
+ if (body1.overlap(body2, this._response))
{
- // They overlap but neither of them are moving
- body1.embedded = true;
- body2.embedded = true;
- }
- else if (body1.deltaX() > body2.deltaX())
- {
- // Body1 is moving right and/or Body2 is moving left
- this._overlap = body1.x + body1.width - body2.x;
-
- if ((this._overlap > this._maxOverlap) || body1.allowCollision.right === false || body2.allowCollision.left === false)
- {
- this._overlap = 0;
- }
- else
- {
- body1.touching.right = true;
- body2.touching.left = true;
- }
- }
- else if (body1.deltaX() < body2.deltaX())
- {
- // Body1 is moving left and/or Body2 is moving right
- this._overlap = body1.x - body2.width - body2.x;
-
- if ((-this._overlap > this._maxOverlap) || body1.allowCollision.left === false || body2.allowCollision.right === false)
- {
- this._overlap = 0;
- }
- else
- {
- body1.touching.left = true;
- body2.touching.right = true;
- }
- }
-
- // Then adjust their positions and velocities accordingly (if there was any overlap)
- if (this._overlap !== 0)
- {
- body1.overlapX = this._overlap;
- body2.overlapX = this._overlap;
-
- if (body1.customSeparateX || body2.customSeparateX)
- {
- return true;
- }
-
- this._velocity1 = body1.velocity.x;
- this._velocity2 = body2.velocity.x;
-
- if (!body1.immovable && !body2.immovable)
- {
- this._overlap *= 0.5;
-
- body1.x = body1.x - this._overlap;
- body2.x += this._overlap;
-
- this._newVelocity1 = Math.sqrt((this._velocity2 * this._velocity2 * body2.mass) / body1.mass) * ((this._velocity2 > 0) ? 1 : -1);
- this._newVelocity2 = Math.sqrt((this._velocity1 * this._velocity1 * body1.mass) / body2.mass) * ((this._velocity1 > 0) ? 1 : -1);
- this._average = (this._newVelocity1 + this._newVelocity2) * 0.5;
- this._newVelocity1 -= this._average;
- this._newVelocity2 -= this._average;
-
- body1.velocity.x = this._average + this._newVelocity1 * body1.bounce.x;
- body2.velocity.x = this._average + this._newVelocity2 * body2.bounce.x;
- }
- else if (!body1.immovable)
- {
- body1.x = body1.x - this._overlap;
- body1.velocity.x = this._velocity2 - this._velocity1 * body1.bounce.x;
- }
- else if (!body2.immovable)
- {
- body2.x += this._overlap;
- body2.velocity.x = this._velocity1 - this._velocity2 * body2.bounce.x;
- }
- body1.updateHulls();
- body2.updateHulls();
-
- return true;
+ return body1.separate(body2, this._response);
}
}
@@ -1289,221 +1221,203 @@ Phaser.Physics.Arcade.prototype = {
},
/**
- * The core separation function to separate two physics bodies on the y axis.
- * @method Phaser.Physics.Arcade#separateY
- * @param {Phaser.Physics.Arcade.Body} body1 - The Body object to separate.
- * @param {Phaser.Physics.Arcade.Body} body2 - The Body object to separate.
- * @returns {boolean} Returns true if the bodies were separated, otherwise false.
+ * Performs a rect intersection test against the two objects.
+ * Objects must expose properties: width, height, left, right, top, bottom.
+ * @method Phaser.Physics.Arcade#intersects
+ * @param {object} a - The first object to test.
+ * @param {object} b - The second object to test.
+ * @returns {boolean} Returns true if the objects intersect, otherwise false.
*/
- separateY: function (body1, body2) {
+ intersects: function (a, b) {
- // Can't separate two immovable or non-existing bodys
- if (body1.immovable && body2.immovable)
+ var result = false;
+
+ if (a.width <= 0 || a.height <= 0 || b.width <= 0 || b.height <= 0)
{
- return false;
+ result = false;
}
- this._overlap = 0;
+ result = !(a.right < b.left || a.bottom < b.top || a.left > b.right || a.top > b.bottom);
- // Check if the hulls actually overlap
- if (Phaser.Rectangle.intersects(body1, body2))
+ if (!result && a.inContact(b))
{
- this._maxOverlap = body1.deltaAbsY() + body2.deltaAbsY() + this.OVERLAP_BIAS;
-
- if (body1.deltaY() === 0 && body2.deltaY() === 0)
- {
- // They overlap but neither of them are moving
- body1.embedded = true;
- body2.embedded = true;
- }
- else if (body1.deltaY() > body2.deltaY())
- {
- // Body1 is moving down and/or Body2 is moving up
- this._overlap = body1.y + body1.height - body2.y;
-
- if ((this._overlap > this._maxOverlap) || body1.allowCollision.down === false || body2.allowCollision.up === false)
- {
- this._overlap = 0;
- }
- else
- {
- body1.touching.down = true;
- body2.touching.up = true;
- }
- }
- else if (body1.deltaY() < body2.deltaY())
- {
- // Body1 is moving up and/or Body2 is moving down
- this._overlap = body1.y - body2.height - body2.y;
-
- if ((-this._overlap > this._maxOverlap) || body1.allowCollision.up === false || body2.allowCollision.down === false)
- {
- this._overlap = 0;
- }
- else
- {
- body1.touching.up = true;
- body2.touching.down = true;
- }
- }
-
- // Then adjust their positions and velocities accordingly (if there was any overlap)
- if (this._overlap !== 0)
- {
- body1.overlapY = this._overlap;
- body2.overlapY = this._overlap;
-
- if (body1.customSeparateY || body2.customSeparateY)
- {
- return true;
- }
-
- this._velocity1 = body1.velocity.y;
- this._velocity2 = body2.velocity.y;
-
- if (!body1.immovable && !body2.immovable)
- {
- this._overlap *= 0.5;
-
- body1.y = body1.y - this._overlap;
- body2.y += this._overlap;
-
- this._newVelocity1 = Math.sqrt((this._velocity2 * this._velocity2 * body2.mass) / body1.mass) * ((this._velocity2 > 0) ? 1 : -1);
- this._newVelocity2 = Math.sqrt((this._velocity1 * this._velocity1 * body1.mass) / body2.mass) * ((this._velocity1 > 0) ? 1 : -1);
- this._average = (this._newVelocity1 + this._newVelocity2) * 0.5;
- this._newVelocity1 -= this._average;
- this._newVelocity2 -= this._average;
-
- body1.velocity.y = this._average + this._newVelocity1 * body1.bounce.y;
- body2.velocity.y = this._average + this._newVelocity2 * body2.bounce.y;
- }
- else if (!body1.immovable)
- {
- body1.y = body1.y - this._overlap;
- body1.velocity.y = this._velocity2 - this._velocity1 * body1.bounce.y;
-
- // This is special case code that handles things like horizontal moving platforms you can ride
- if (body2.active && body2.moves && (body1.deltaY() > body2.deltaY()))
- {
- body1.x += body2.x - body2.lastX;
- }
- }
- else if (!body2.immovable)
- {
- body2.y += this._overlap;
- body2.velocity.y = this._velocity1 - this._velocity2 * body2.bounce.y;
-
- // This is special case code that handles things like horizontal moving platforms you can ride
- if (body1.sprite.active && body1.moves && (body1.deltaY() < body2.deltaY()))
- {
- body2.x += body1.x - body1.lastX;
- }
- }
- body1.updateHulls();
- body2.updateHulls();
-
- return true;
- }
-
+ a.removeContact(b);
}
- return false;
+ },
+
+ /**
+ * Performs a rect intersection test against the two objects.
+ * Objects must expose properties: width, height, left, right, top, bottom.
+ * @method Phaser.Physics.Arcade#tileIntersects
+ * @param {object} body - The Body to test.
+ * @param {object} tile - The Tile to test.
+ * @returns {boolean} Returns true if the objects intersect, otherwise false.
+ */
+ tileIntersects: function (body, tile) {
+
+ if (body.width <= 0 || body.height <= 0 || tile.width <= 0 || tile.height <= 0)
+ {
+ this._intersection[4] = 0;
+ return this._intersection;
+ }
+
+ if (!(body.right < tile.x || body.bottom < tile.y || body.left > tile.right || body.top > tile.bottom))
+ {
+ this._intersection[0] = Math.max(body.left, tile.x); // x
+ this._intersection[1] = Math.max(body.top, tile.y); // y
+ this._intersection[2] = Math.min(body.right, tile.right) - this._intersection[0]; // width
+ this._intersection[3] = Math.min(body.bottom, tile.bottom) - this._intersection[1]; // height
+ this._intersection[4] = 1;
+
+ return this._intersection;
+ }
+
+ this._intersection[4] = 0;
+
+ return this._intersection;
+
+ },
+
+ /**
+ * The core separation function to separate a physics body and an array of tiles.
+ * @method Phaser.Physics.Arcade#separateTiles
+ * @param {Phaser.Physics.Arcade.Body} body - The Body object to separate.
+ * @param {array<Phaser.Tile>} tiles - The array of tiles to collide against.
+ * @returns {boolean} Returns true if the body was separated, otherwise false.
+ */
+ separateTiles: function (body, tiles) {
+
+ var tile;
+ var result = false;
+
+ for (var i = 0; i < tiles.length; i++)
+ {
+ tile = tiles[i];
+
+ if (this.separateTile(body, tile))
+ {
+ result = true;
+ }
+ }
+
+ return result;
},
/**
* The core separation function to separate a physics body and a tile.
* @method Phaser.Physics.Arcade#separateTile
- * @param {Phaser.Physics.Arcade.Body} body1 - The Body object to separate.
+ * @param {Phaser.Physics.Arcade.Body} body - The Body object to separate.
* @param {Phaser.Tile} tile - The tile to collide against.
- * @returns {boolean} Returns true if the bodies were separated, otherwise false.
+ * @returns {boolean} Returns true if the body was separated, otherwise false.
*/
separateTile: function (body, tile) {
- this._result = (this.separateTileX(body, tile, true) || this.separateTileY(body, tile, true));
+ this._intersection = this.tileIntersects(body, tile);
- return this._result;
-
- },
-
- /**
- * The core separation function to separate a physics body and a tile on the x axis.
- * @method Phaser.Physics.Arcade#separateTileX
- * @param {Phaser.Physics.Arcade.Body} body1 - The Body object to separate.
- * @param {Phaser.Tile} tile - The tile to collide against.
- * @returns {boolean} Returns true if the bodies were separated, otherwise false.
- */
- separateTileX: function (body, tile, separate) {
-
- // Can't separate two immovable objects (tiles are always immovable)
- if (body.immovable || body.deltaX() === 0 || Phaser.Rectangle.intersects(body.hullX, tile) === false)
+ // If the intersection area is either entirely null, or has a width/height of zero, we bail out now
+ if (this._intersection[4] === 0 || this._intersection[2] === 0 || this._intersection[3] === 0)
{
return false;
}
- this._overlap = 0;
-
- // The hulls overlap, let's process it
- // this._maxOverlap = body.deltaAbsX() + this.OVERLAP_BIAS;
-
- if (body.deltaX() < 0)
+ // They overlap. Any custom callbacks?
+ if (tile.tile.callback || tile.layer.callbacks[tile.tile.index])
{
- // Moving left
- this._overlap = tile.right - body.hullX.x;
-
- // if ((this._overlap > this._maxOverlap) || body.allowCollision.left === false || tile.tile.collideRight === false)
- if (body.allowCollision.left === false || tile.tile.collideRight === false)
+ // A local callback takes priority over a global callback.
+ if (tile.tile.callback && tile.tile.callback.call(tile.tile.callbackContext, body.sprite, tile) === false)
{
- this._overlap = 0;
+ // Is there a tile specific collision callback? If it returns true then we can carry on, otherwise we should abort.
+ return false;
}
- else
+ else if (tile.layer.callbacks[tile.tile.index] && tile.layer.callbacks[tile.tile.index].callback.call(tile.layer.callbacks[tile.tile.index].callbackContext, body.sprite, tile) === false)
{
- body.touching.left = true;
- }
- }
- else
- {
- // Moving right
- this._overlap = body.hullX.right - tile.x;
-
- // if ((this._overlap > this._maxOverlap) || body.allowCollision.right === false || tile.tile.collideLeft === false)
- if (body.allowCollision.right === false || tile.tile.collideLeft === false)
- {
- this._overlap = 0;
- }
- else
- {
- body.touching.right = true;
+ // Is there a tile index collision callback? If it returns true then we can carry on, otherwise we should abort.
+ return false;
}
}
- // Then adjust their positions and velocities accordingly (if there was any overlap)
- if (this._overlap !== 0)
+ body.overlapX = 0;
+ body.overlapY = 0;
+
+ var process = false;
+
+ if (body.deltaX() < 0 && body.checkCollision.left && tile.tile.faceRight && !body.blocked.left)
{
- if (separate)
+ // LEFT
+ body.overlapX = body.left - tile.right;
+
+ if (body.overlapX < 0)
{
- if (body.deltaX() < 0)
- {
- body.x = body.x + this._overlap;
- }
- else
- {
- body.x = body.x - this._overlap;
- }
-
- if (body.bounce.x === 0)
- {
- body.velocity.x = 0;
- }
- else
- {
- body.velocity.x = -body.velocity.x * body.bounce.x;
- }
-
- body.updateHulls();
+ process = true;
}
+ else
+ {
+ body.overlapX = 0;
+ }
+ }
+ else if (body.deltaX() > 0 && body.checkCollision.right && tile.tile.faceLeft && !body.blocked.right)
+ {
+ // RIGHT
+ body.overlapX = body.right - tile.x;
- return true;
+ if (body.overlapX > 0)
+ {
+ process = true;
+ }
+ else
+ {
+ body.overlapX = 0;
+ }
+ }
+
+ if (body.deltaY() < 0 && body.checkCollision.up && tile.tile.faceBottom && !body.blocked.up)
+ {
+ // UP
+ body.overlapY = body.top - tile.bottom;
+
+ if (body.overlapY < 0)
+ {
+ process = true;
+ }
+ else
+ {
+ body.overlapY = 0;
+ }
+ }
+ else if (body.deltaY() > 0 && body.checkCollision.down && tile.tile.faceTop && !body.blocked.down)
+ {
+ // DOWN
+ body.overlapY = body.bottom - tile.y;
+
+ if (body.overlapY > 0)
+ {
+ process = true;
+ }
+ else
+ {
+ body.overlapY = 0;
+ }
+ }
+
+ // Only separate on the smallest of the two values if it's a single tile
+ if (body.overlapX !== 0 && body.overlapY !== 0)
+ {
+ if (Math.abs(body.overlapX) > Math.abs(body.overlapY))
+ {
+ body.overlapX = 0;
+ }
+ else
+ {
+ body.overlapY = 0;
+ }
+ }
+
+ // Separate in a single sweep
+ if (process)
+ {
+ return this.processTileSeparation(body);
}
else
{
@@ -1513,88 +1427,53 @@ Phaser.Physics.Arcade.prototype = {
},
/**
- * The core separation function to separate a physics body and a tile on the x axis.
- * @method Phaser.Physics.Arcade#separateTileY
+ * Internal function to process the separation of a physics body from a tile.
+ * @method Phaser.Physics.Arcade#processTileSeparation
+ * @protected
* @param {Phaser.Physics.Arcade.Body} body1 - The Body object to separate.
- * @param {Phaser.Tile} tile - The tile to collide against.
- * @returns {boolean} Returns true if the bodies were separated, otherwise false.
+ * @returns {boolean} Returns true if separated, false if not.
*/
- separateTileY: function (body, tile, separate) {
+ processTileSeparation: function (body) {
- // Can't separate two immovable objects (tiles are always immovable)
- if (body.immovable || body.deltaY() === 0 || Phaser.Rectangle.intersects(body.hullY, tile) === false)
+ if (body.overlapX < 0)
{
- return false;
+ body.x -= body.overlapX;
+ body.left -= body.overlapX;
+ body.right -= body.overlapX;
+ body.blocked.x = Math.floor(body.x);
+ body.blocked.y = Math.floor(body.y);
+ body.blocked.left = true;
+ }
+ else if (body.overlapX > 0)
+ {
+ body.x -= body.overlapX;
+ body.left -= body.overlapX;
+ body.right -= body.overlapX;
+ body.blocked.x = Math.floor(body.x);
+ body.blocked.y = Math.floor(body.y);
+ body.blocked.right = true;
}
- this._overlap = 0;
-
- // The hulls overlap, let's process it
- // this._maxOverlap = body.deltaAbsY() + this.OVERLAP_BIAS;
-
- if (body.deltaY() < 0)
+ if (body.overlapY < 0)
{
- // Moving up
- this._overlap = tile.bottom - body.hullY.y;
-
- // if ((this._overlap > this._maxOverlap) || body.allowCollision.up === false || tile.tile.collideDown === false)
- if (body.allowCollision.up === false || tile.tile.collideDown === false)
- {
- this._overlap = 0;
- }
- else
- {
- body.touching.up = true;
- }
+ body.y -= body.overlapY;
+ body.top -= body.overlapY;
+ body.bottom -= body.overlapY;
+ body.blocked.x = Math.floor(body.x);
+ body.blocked.y = Math.floor(body.y);
+ body.blocked.up = true;
}
- else
+ else if (body.overlapY > 0)
{
- // Moving down
- this._overlap = body.hullY.bottom - tile.y;
-
- // if ((this._overlap > this._maxOverlap) || body.allowCollision.down === false || tile.tile.collideUp === false)
- if (body.allowCollision.down === false || tile.tile.collideUp === false)
- {
- this._overlap = 0;
- }
- else
- {
- body.touching.down = true;
- }
+ body.y -= body.overlapY;
+ body.top -= body.overlapY;
+ body.bottom -= body.overlapY;
+ body.blocked.x = Math.floor(body.x);
+ body.blocked.y = Math.floor(body.y);
+ body.blocked.down = true;
}
- // Then adjust their positions and velocities accordingly (if there was any overlap)
- if (this._overlap !== 0)
- {
- if (separate)
- {
- if (body.deltaY() < 0)
- {
- body.y = body.y + this._overlap;
- }
- else
- {
- body.y = body.y - this._overlap;
- }
-
- if (body.bounce.y === 0)
- {
- body.velocity.y = 0;
- }
- else
- {
- body.velocity.y = -body.velocity.y * body.bounce.y;
- }
-
- body.updateHulls();
- }
-
- return true;
- }
- else
- {
- return false;
- }
+ return true;
},
@@ -1744,7 +1623,7 @@ Phaser.Physics.Arcade.prototype = {
/**
* Given the rotation (in radians) and speed calculate the acceleration and return it as a Point object, or set it to the given point object.
- * One way to use this is: velocityFromRotation(rotation, 200, sprite.velocity) which will set the values directly to the sprites velocity and not create a new Point object.
+ * One way to use this is: accelerationFromRotation(rotation, 200, sprite.acceleration) which will set the values directly to the sprites acceleration and not create a new Point object.
*
* @method Phaser.Physics.Arcade#accelerationFromRotation
* @param {number} rotation - The angle in radians.
@@ -1963,6 +1842,8 @@ Phaser.Physics.Arcade.prototype = {
}
};
+
+Phaser.Physics.Arcade.prototype.constructor = Phaser.Physics.Arcade;
@@ -1978,13 +1859,13 @@ Phaser.Physics.Arcade.prototype = {
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:25 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/BitmapData.js.html b/docs/BitmapData.js.html
index b38a31c2..f1e849a9 100644
--- a/docs/BitmapData.js.html
+++ b/docs/BitmapData.js.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -423,7 +417,7 @@
/**
* @author Richard Davey <rich@photonstorm.com>
-* @copyright 2013 Photon Storm Ltd.
+* @copyright 2014 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -1380,7 +1374,9 @@ Phaser.BitmapData.prototype = {
}
-}
+};
+
+Phaser.BitmapData.prototype.constructor = Phaser.BitmapData;
// EaselJS Tiny API emulation
@@ -1554,13 +1550,13 @@ Phaser.BitmapData.prototype.de = Phaser.BitmapData.prototype.ellipse;
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:25 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/BitmapText.js.html b/docs/BitmapText.js.html
index 87502549..3f69ce4e 100644
--- a/docs/BitmapText.js.html
+++ b/docs/BitmapText.js.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -423,7 +417,7 @@
/**
* @author Richard Davey <rich@photonstorm.com>
-* @copyright 2013 Photon Storm Ltd.
+* @copyright 2014 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -543,11 +537,6 @@ Phaser.BitmapText = function (game, x, y, text, style) {
this._cache.x = this.x;
this._cache.y = this.y;
- /**
- * @property {boolean} renderable - A renderable object will be rendered to the context each frame.
- */
- this.renderable = true;
-
};
Phaser.BitmapText.prototype = Object.create(PIXI.BitmapText.prototype);
@@ -576,8 +565,8 @@ Phaser.BitmapText.prototype.update = function() {
this._cache.dirty = true;
}
- this.pivot.x = this.anchor.x*this.width;
- this.pivot.y = this.anchor.y*this.height;
+ this.pivot.x = this.anchor.x * this.width;
+ this.pivot.y = this.anchor.y * this.height;
}
@@ -674,13 +663,13 @@ Object.defineProperty(Phaser.BitmapText.prototype, 'y', {
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:25 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Body.js.html b/docs/Body.js.html
index 244d0230..0168e9ab 100644
--- a/docs/Body.js.html
+++ b/docs/Body.js.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -423,13 +417,14 @@
/**
* @author Richard Davey <rich@photonstorm.com>
-* @copyright 2013 Photon Storm Ltd.
+* @copyright 2014 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
/**
-* The Physics Body is linked to a single Sprite. All physics operations should be performed against the body rather than
-* the Sprite itself. For example you can set the velocity, acceleration, bounce values etc all on the Body.
+* The Physics Body is linked to a single Sprite and defines properties that determine how the physics body is simulated.
+* These properties affect how the body reacts to forces, what forces it generates on itself (to simulate friction), and how it reacts to collisions in the scene. In most cases, the properties are used to simulate physical effects.
+* Each body also has its own property values that determine exactly how it reacts to forces and collisions in the scene.
*
* @class Phaser.Physics.Arcade.Body
* @classdesc Arcade Physics Body Constructor
@@ -453,29 +448,17 @@ Phaser.Physics.Arcade.Body = function (sprite) {
*/
this.offset = new Phaser.Point();
- /**
- * @property {number} x - The x position of the physics body.
- * @readonly
- */
- this.x = sprite.x;
-
- /**
- * @property {number} y - The y position of the physics body.
- * @readonly
- */
- this.y = sprite.y;
-
/**
* @property {number} preX - The previous x position of the physics body.
* @readonly
*/
- this.preX = sprite.x;
+ this.preX = sprite.world.x;
/**
* @property {number} preY - The previous y position of the physics body.
* @readonly
*/
- this.preY = sprite.y;
+ this.preY = sprite.world.y;
/**
* @property {number} preRotation - The previous rotation of the physics body.
@@ -484,53 +467,262 @@ Phaser.Physics.Arcade.Body = function (sprite) {
this.preRotation = sprite.angle;
/**
- * @property {number} screenX - The x position of the physics body translated to screen space.
+ * @property {Phaser.Point} velocity - The velocity of the Body.
+ */
+ this.velocity = new Phaser.Point();
+
+ /**
+ * @property {Phaser.Point} acceleration - The acceleration in pixels per second sq. of the Body.
+ */
+ this.acceleration = new Phaser.Point();
+
+ /**
+ * @property {number} speed - The speed in pixels per second sq. of the Body.
+ */
+ this.speed = 0;
+
+ /**
+ * @property {number} angle - The angle of the Body based on its velocity in radians.
+ */
+ this.angle = 0;
+
+ /**
+ * @property {Phaser.Point} gravity - The gravity applied to the motion of the Body. This works in addition to any gravity set on the world.
+ */
+ this.gravity = new Phaser.Point();
+
+ /**
+ * @property {Phaser.Point} bounce - The elasticitiy of the Body when colliding. This property determines how much energy a body maintains during a collision, i.e. its bounciness.
+ */
+ this.bounce = new Phaser.Point();
+
+ /**
+ * @property {Phaser.Point} minVelocity - When a body rebounds off another body or a wall the minVelocity is checked. If the new velocity is lower than minVelocity the body is stopped.
+ * @default
+ */
+ this.minVelocity = new Phaser.Point();
+
+ /**
+ * @property {Phaser.Point} maxVelocity - The maximum velocity that the Body can reach.
+ * @default
+ */
+ this.maxVelocity = new Phaser.Point(1000, 1000);
+
+ /**
+ * @property {number} angularVelocity - The angular velocity of the Body.
+ * @default
+ */
+ this.angularVelocity = 0;
+
+ /**
+ * @property {number} angularAcceleration - The angular acceleration of the Body.
+ * @default
+ */
+ this.angularAcceleration = 0;
+
+ /**
+ * @property {number} angularDrag - angularDrag is used to calculate friction on the body as it rotates.
+ * @default
+ */
+ this.angularDrag = 0;
+
+ /**
+ * @property {number} maxAngular - The maximum angular velocity that the Body can reach.
+ * @default
+ */
+ this.maxAngular = 1000;
+
+ /**
+ * @property {number} mass - The mass property determines how forces affect the body, as well as how much momentum the body has when it is involved in a collision.
+ * @default
+ */
+ this.mass = 1;
+
+ /**
+ * @property {number} linearDamping - linearDamping is used to calculate friction on the body as it moves through the world. For example, this might be used to simulate air or water friction.
+ * @default
+ */
+ this.linearDamping = 0.0;
+
+ /**
+ * Set the checkCollision properties to control which directions collision is processed for this Body.
+ * For example checkCollision.up = false means it won't collide when the collision happened while moving up.
+ * @property {object} checkCollision - An object containing allowed collision.
+ */
+ this.checkCollision = { none: false, any: true, up: true, down: true, left: true, right: true };
+
+ /**
+ * This object is populated with boolean values when the Body collides with another.
+ * touching.up = true means the collision happened to the top of this Body for example.
+ * @property {object} touching - An object containing touching results.
+ */
+ this.touching = { none: true, up: false, down: false, left: false, right: false };
+
+ /**
+ * This object is populated with boolean values when the Body collides with the World bounds or a Tile.
+ * For example if blocked.up is true then the Body cannot move up.
+ * @property {object} blocked - An object containing on which faces this Body is blocked from moving, if any.
+ */
+ this.blocked = { x: 0, y: 0, up: false, down: false, left: false, right: false };
+
+ /**
+ * @property {number} facing - A const reference to the direction the Body is traveling or facing.
+ * @default
+ */
+ this.facing = Phaser.NONE;
+
+ /**
+ * @property {boolean} rebound - A Body set to rebound will exchange velocity with another Body during collision. Set to false to allow this body to be 'pushed' rather than exchange velocity.
+ * @default
+ */
+ this.rebound = true;
+
+ /**
+ * @property {boolean} immovable - An immovable Body will not receive any impacts or exchanges of velocity from other bodies.
+ * @default
+ */
+ this.immovable = false;
+
+ /**
+ * @property {boolean} moves - Set to true to allow the Physics system (such as velocity) to move this Body, or false to move it manually.
+ * @default
+ */
+ this.moves = true;
+
+ /**
+ * @property {number} rotation - The amount the parent Sprite is rotated.
+ * @default
+ */
+ this.rotation = 0;
+
+ /**
+ * @property {boolean} allowRotation - Allow angular rotation? This will cause the Sprite to be rotated via angularVelocity, etc.
+ * @default
+ */
+ this.allowRotation = true;
+
+ /**
+ * @property {boolean} allowGravity - Allow this Body to be influenced by the global Gravity value? Note: It will always be influenced by the local gravity if set.
+ * @default
+ */
+ this.allowGravity = true;
+
+ /**
+ * @property {function} customSeparateCallback - If set this callback will be used for Body separation instead of the built-in one. Callback should return true if separated, otherwise false.
+ * @default
+ */
+ this.customSeparateCallback = null;
+
+ /**
+ * @property {object} customSeparateContext - The context in which the customSeparateCallback is called.
+ * @default
+ */
+ this.customSeparateContext = null;
+
+ /**
+ * @property {function} collideCallback - If set this callback will be fired whenever this Body is hit (on any face). It will send three parameters, the face it hit on, this Body and the Body that hit it.
+ * @default
+ */
+ this.collideCallback = null;
+
+ /**
+ * @property {object} collideCallbackContext - The context in which the collideCallback is called.
+ * @default
+ */
+ this.collideCallbackContext = null;
+
+ /**
+ * A Body can be set to collide against the World bounds automatically and rebound back into the World if this is set to true. Otherwise it will leave the World.
+ * @property {boolean} collideWorldBounds - Should the Body collide with the World bounds?
+ */
+ this.collideWorldBounds = false;
+
+ /**
+ * @property {Phaser.Physics.Arcade.RECT|Phaser.Physics.Arcade.CIRCLE} type - The type of SAT Shape.
+ */
+ this.type = Phaser.Physics.Arcade.RECT;
+
+ /**
+ * @property {SAT.Box|SAT.Circle|SAT.Polygon} shape - The SAT Collision shape.
+ */
+ this.shape = null;
+
+ /**
+ * @property {SAT.Polygon} polygon - The SAT Polygons, as derived from the Shape.
+ */
+ this.polygon = null;
+
+ /**
+ * @property {number} left - The left-most point of this Body.
* @readonly
*/
- this.screenX = sprite.x;
+ this.left = 0;
/**
- * @property {number} screenY - The y position of the physics body translated to screen space.
+ * @property {number} right - The right-most point of this Body.
* @readonly
*/
- this.screenY = sprite.y;
+ this.right = 0;
/**
- * @property {number} sourceWidth - The un-scaled original size.
+ * @property {number} top - The top-most point of this Body.
* @readonly
*/
- this.sourceWidth = sprite.currentFrame.sourceSizeW;
+ this.top = 0;
/**
- * @property {number} sourceHeight - The un-scaled original size.
+ * @property {number} bottom - The bottom-most point of this Body.
* @readonly
*/
- this.sourceHeight = sprite.currentFrame.sourceSizeH;
+ this.bottom = 0;
/**
- * @property {number} width - The calculated width of the physics body.
+ * @property {number} width - The current width of the Body, taking into account the point rotation.
+ * @readonly
*/
- this.width = sprite.currentFrame.sourceSizeW;
+ this.width = 0;
/**
- * @property .numInternal ID cache
+ * @property {number} height - The current height of the Body, taking into account the point rotation.
+ * @readonly
*/
- this.height = sprite.currentFrame.sourceSizeH;
+ this.height = 0;
/**
- * @property {number} halfWidth - The calculated width / 2 of the physics body.
+ * @property {array<Phaser.Physics.Arcade.Body>} contacts - Used to store references to bodies this Body is in contact with.
+ * @protected
*/
- this.halfWidth = Math.floor(sprite.currentFrame.sourceSizeW / 2);
+ this.contacts = [];
/**
- * @property {number} halfHeight - The calculated height / 2 of the physics body.
+ * @property {number} overlapX - Mostly used internally to store the overlap values from Tile seperation.
+ * @protected
*/
- this.halfHeight = Math.floor(sprite.currentFrame.sourceSizeH / 2);
+ this.overlapX = 0;
/**
- * @property {Phaser.Point} center - The center coordinate of the Physics Body.
+ * @property {number} overlapY - Mostly used internally to store the overlap values from Tile seperation.
+ * @protected
*/
- this.center = new Phaser.Point(this.x + this.halfWidth, this.y + this.halfHeight);
+ this.overlapY = 0;
+
+ /**
+ * @property {Phaser.Point} _temp - Internal cache var.
+ * @private
+ */
+ this._temp = null;
+
+ /**
+ * @property {number} _dx - Internal cache var.
+ * @private
+ */
+ this._dx = 0;
+
+ /**
+ * @property {number} _dy - Internal cache var.
+ * @private
+ */
+ this._dy = 0;
/**
* @property {number} _sx - Internal cache var.
@@ -545,231 +737,80 @@ Phaser.Physics.Arcade.Body = function (sprite) {
this._sy = sprite.scale.y;
/**
- * @property {Phaser.Point} velocity - The velocity in pixels per second sq. of the Body.
+ * @property {array} _distances - Internal cache var.
+ * @private
*/
- this.velocity = new Phaser.Point();
+ this._distances = [0, 0, 0, 0];
/**
- * @property {Phaser.Point} acceleration - The velocity in pixels per second sq. of the Body.
+ * @property {number} _vx - Internal cache var.
+ * @private
*/
- this.acceleration = new Phaser.Point();
+ this._vx = 0;
/**
- * @property {Phaser.Point} drag - The drag applied to the motion of the Body.
+ * @property {number} _vy - Internal cache var.
+ * @private
*/
- this.drag = new Phaser.Point();
+ this._vy = 0;
- /**
- * @property {Phaser.Point} gravity - A private Gravity setting for the Body.
- */
- this.gravity = new Phaser.Point();
+ // Set-up the default shape
+ this.setRectangle(sprite.width, sprite.height, 0, 0);
- /**
- * @property {Phaser.Point} bounce - The elasticitiy of the Body when colliding. bounce.x/y = 1 means full rebound, bounce.x/y = 0.5 means 50% rebound velocity.
- */
- this.bounce = new Phaser.Point();
-
- /**
- * @property {Phaser.Point} maxVelocity - The maximum velocity in pixels per second sq. that the Body can reach.
- * @default
- */
- this.maxVelocity = new Phaser.Point(10000, 10000);
-
- /**
- * @property {number} angularVelocity - The angular velocity in pixels per second sq. of the Body.
- * @default
- */
- this.angularVelocity = 0;
-
- /**
- * @property {number} angularAcceleration - The angular acceleration in pixels per second sq. of the Body.
- * @default
- */
- this.angularAcceleration = 0;
-
- /**
- * @property {number} angularDrag - The angular drag applied to the rotation of the Body.
- * @default
- */
- this.angularDrag = 0;
-
- /**
- * @property {number} maxAngular - The maximum angular velocity in pixels per second sq. that the Body can reach.
- * @default
- */
- this.maxAngular = 1000;
-
- /**
- * @property {number} mass - The mass of the Body.
- * @default
- */
- this.mass = 1;
-
- /**
- * @property {boolean} skipQuadTree - If the Body is an irregular shape you can set this to true to avoid it being added to the World quad tree.
- * @default
- */
- this.skipQuadTree = false;
-
- /**
- * @property {Array} quadTreeIDs - Internal ID cache.
- * @protected
- */
- this.quadTreeIDs = [];
-
- /**
- * @property {number} quadTreeIndex - Internal ID cache.
- * @protected
- */
- this.quadTreeIndex = -1;
-
- // Allow collision
-
- /**
- * Set the allowCollision properties to control which directions collision is processed for this Body.
- * For example allowCollision.up = false means it won't collide when the collision happened while moving up.
- * @property {object} allowCollision - An object containing allowed collision.
- */
- this.allowCollision = { none: false, any: true, up: true, down: true, left: true, right: true };
-
- /**
- * This object is populated with boolean values when the Body collides with another.
- * touching.up = true means the collision happened to the top of this Body for example.
- * @property {object} touching - An object containing touching results.
- */
- this.touching = { none: true, up: false, down: false, left: false, right: false };
-
- /**
- * This object is populated with previous touching values from the bodies previous collision.
- * @property {object} wasTouching - An object containing previous touching results.
- */
- this.wasTouching = { none: true, up: false, down: false, left: false, right: false };
-
- /**
- * @property {number} facing - A const reference to the direction the Body is traveling or facing.
- * @default
- */
- this.facing = Phaser.NONE;
-
- /**
- * @property {boolean} immovable - An immovable Body will not receive any impacts from other bodies.
- * @default
- */
- this.immovable = false;
-
- /**
- * @property {boolean} moves - Set to true to allow the Physics system to move this Body, other false to move it manually.
- * @default
- */
- this.moves = true;
-
- /**
- * @property {number} rotation - The amount the Body is rotated.
- * @default
- */
- this.rotation = 0;
-
- /**
- * @property {boolean} allowRotation - Allow this Body to be rotated? (via angularVelocity, etc)
- * @default
- */
- this.allowRotation = true;
-
- /**
- * @property {boolean} allowGravity - Allow this Body to be influenced by the global Gravity?
- * @default
- */
- this.allowGravity = true;
-
- /**
- * This flag allows you to disable the custom x separation that takes place by Physics.Arcade.separate.
- * Used in combination with your own collision processHandler you can create whatever type of collision response you need.
- * @property {boolean} customSeparateX - Use a custom separation system or the built-in one?
- * @default
- */
- this.customSeparateX = false;
-
- /**
- * This flag allows you to disable the custom y separation that takes place by Physics.Arcade.separate.
- * Used in combination with your own collision processHandler you can create whatever type of collision response you need.
- * @property {boolean} customSeparateY - Use a custom separation system or the built-in one?
- * @default
- */
- this.customSeparateY = false;
-
- /**
- * When this body collides with another, the amount of overlap is stored here.
- * @property {number} overlapX - The amount of horizontal overlap during the collision.
- */
- this.overlapX = 0;
-
- /**
- * When this body collides with another, the amount of overlap is stored here.
- * @property {number} overlapY - The amount of vertical overlap during the collision.
- */
- this.overlapY = 0;
-
- /**
- * @property {Phaser.Rectangle} hullX - The dynamically calculated hull used during collision.
- */
- this.hullX = new Phaser.Rectangle();
-
- /**
- * @property {Phaser.Rectangle} hullY - The dynamically calculated hull used during collision.
- */
- this.hullY = new Phaser.Rectangle();
-
- /**
- * If a body is overlapping with another body, but neither of them are moving (maybe they spawned on-top of each other?) this is set to true.
- * @property {boolean} embedded - Body embed value.
- */
- this.embedded = false;
-
- /**
- * A Body can be set to collide against the World bounds automatically and rebound back into the World if this is set to true. Otherwise it will leave the World.
- * @property {boolean} collideWorldBounds - Should the Body collide with the World bounds?
- */
- this.collideWorldBounds = false;
+ // Set-up contact events
+ this.sprite.events.onBeginContact = new Phaser.Signal();
+ this.sprite.events.onEndContact = new Phaser.Signal();
};
Phaser.Physics.Arcade.Body.prototype = {
/**
- * Internal method.
+ * Internal method that updates the Body scale in relation to the parent Sprite.
*
- * @method Phaser.Physics.Arcade#updateBounds
+ * @method Phaser.Physics.Arcade.Body#updateScale
* @protected
*/
- updateBounds: function (centerX, centerY, scaleX, scaleY) {
+ updateScale: function () {
- if (scaleX != this._sx || scaleY != this._sy)
+ if (this.polygon)
{
- this.width = this.sourceWidth * scaleX;
- this.height = this.sourceHeight * scaleY;
- this.halfWidth = Math.floor(this.width / 2);
- this.halfHeight = Math.floor(this.height / 2);
- this._sx = scaleX;
- this._sy = scaleY;
- this.center.setTo(this.x + this.halfWidth, this.y + this.halfHeight);
+ this.polygon.scale(this.sprite.scale.x / this._sx, this.sprite.scale.y / this._sy);
}
+ else
+ {
+ this.shape.r *= Math.max(this.sprite.scale.x, this.sprite.scale.y);
+ }
+
+ this._sx = this.sprite.scale.x;
+ this._sy = this.sprite.scale.y;
},
/**
- * Internal method.
+ * Internal method that updates the Body position in relation to the parent Sprite.
*
- * @method Phaser.Physics.Arcade#preUpdate
+ * @method Phaser.Physics.Arcade.Body#preUpdate
* @protected
*/
preUpdate: function () {
- // Store and reset collision flags
- this.wasTouching.none = this.touching.none;
- this.wasTouching.up = this.touching.up;
- this.wasTouching.down = this.touching.down;
- this.wasTouching.left = this.touching.left;
- this.wasTouching.right = this.touching.right;
+ this.x = (this.sprite.world.x - (this.sprite.anchor.x * this.sprite.width)) + this.offset.x;
+ this.y = (this.sprite.world.y - (this.sprite.anchor.y * this.sprite.height)) + this.offset.y;
+
+ // This covers any motion that happens during this frame, not since the last frame
+ this.preX = this.x;
+ this.preY = this.y;
+ this.preRotation = this.sprite.angle;
+
+ this.rotation = this.preRotation;
+
+ if (this.sprite.scale.x !== this._sx || this.sprite.scale.y !== this._sy)
+ {
+ this.updateScale();
+ }
+
+ this.checkBlocked();
this.touching.none = true;
this.touching.up = false;
@@ -777,290 +818,1116 @@ Phaser.Physics.Arcade.Body.prototype = {
this.touching.left = false;
this.touching.right = false;
- this.embedded = false;
-
- this.screenX = (this.sprite.worldTransform[2] - (this.sprite.anchor.x * this.width)) + this.offset.x;
- this.screenY = (this.sprite.worldTransform[5] - (this.sprite.anchor.y * this.height)) + this.offset.y;
-
- this.preX = (this.sprite.world.x - (this.sprite.anchor.x * this.width)) + this.offset.x;
- this.preY = (this.sprite.world.y - (this.sprite.anchor.y * this.height)) + this.offset.y;
-
- this.preRotation = this.sprite.angle;
-
- this.x = this.preX;
- this.y = this.preY;
- this.rotation = this.preRotation;
-
if (this.moves)
{
- this.game.physics.updateMotion(this);
-
- if (this.collideWorldBounds)
+ if (this._vx !== this.velocity.x || this._vy !== this.velocity.y)
{
- this.checkWorldBounds();
+ // No need to re-calc these if they haven't changed
+ this._vx = this.velocity.x;
+ this._vy = this.velocity.y;
+ this.speed = Math.sqrt(this.velocity.x * this.velocity.x + this.velocity.y * this.velocity.y);
+ this.angle = Math.atan2(this.velocity.y, this.velocity.x);
}
- this.updateHulls();
- }
+ if (this.game.physics.checkBounds(this))
+ {
+ this.reboundCheck(true, true, true);
+ }
- if (this.skipQuadTree === false && this.allowCollision.none === false && this.sprite.visible && this.sprite.alive)
+ this.applyDamping();
+
+ this.integrateVelocity();
+
+ this.updateBounds();
+
+ this.checkBlocked();
+ }
+ else
{
- this.quadTreeIDs = [];
- this.quadTreeIndex = -1;
- this.game.physics.quadTree.insert(this);
+ this.updateBounds();
}
},
/**
- * Internal method.
+ * Internal method that checks and potentially resets the blocked status flags.
*
- * @method Phaser.Physics.Arcade#postUpdate
+ * @method Phaser.Physics.Arcade.Body#checkBlocked
+ * @protected
+ */
+ checkBlocked: function () {
+
+ if ((this.blocked.left || this.blocked.right) && (Math.floor(this.x) !== this.blocked.x || Math.floor(this.y) !== this.blocked.y))
+ {
+ this.blocked.left = false;
+ this.blocked.right = false;
+ }
+
+ if ((this.blocked.up || this.blocked.down) && (Math.floor(this.x) !== this.blocked.x || Math.floor(this.y) !== this.blocked.y))
+ {
+ this.blocked.up = false;
+ this.blocked.down = false;
+ }
+
+ },
+
+ /**
+ * Internal method that updates the left, right, top, bottom, width and height properties.
+ *
+ * @method Phaser.Physics.Arcade.Body#updateBounds
+ * @protected
+ */
+ updateBounds: function () {
+
+ if (this.type === Phaser.Physics.Arcade.CIRCLE)
+ {
+ this.left = this.shape.pos.x - this.shape.r;
+ this.right = this.shape.pos.x + this.shape.r;
+ this.top = this.shape.pos.y - this.shape.r;
+ this.bottom = this.shape.pos.y + this.shape.r;
+ }
+ else
+ {
+ this.left = Phaser.Math.minProperty('x', this.polygon.points) + this.polygon.pos.x;
+ this.right = Phaser.Math.maxProperty('x', this.polygon.points) + this.polygon.pos.x;
+ this.top = Phaser.Math.minProperty('y', this.polygon.points) + this.polygon.pos.y;
+ this.bottom = Phaser.Math.maxProperty('y', this.polygon.points) + this.polygon.pos.y;
+ }
+
+ this.width = this.right - this.left;
+ this.height = this.bottom - this.top;
+
+ },
+
+ /**
+ * Internal method that checks the acceleration and applies damping if not set.
+ *
+ * @method Phaser.Physics.Arcade.Body#applyDamping
+ * @protected
+ */
+ applyDamping: function () {
+
+ if (this.linearDamping > 0 && this.acceleration.isZero())
+ {
+ if (this.speed > this.linearDamping)
+ {
+ this.speed -= this.linearDamping;
+ }
+ else
+ {
+ this.speed = 0;
+ }
+
+ // Don't bother if speed 0
+ if (this.speed > 0)
+ {
+ this.velocity.x = Math.cos(this.angle) * this.speed;
+ this.velocity.y = Math.sin(this.angle) * this.speed;
+
+ this.speed = Math.sqrt(this.velocity.x * this.velocity.x + this.velocity.y * this.velocity.y);
+ this.angle = Math.atan2(this.velocity.y, this.velocity.x);
+ }
+ }
+
+ },
+
+ /**
+ * Check if we're below minVelocity and gravity isn't trying to drag us in the opposite direction.
+ *
+ * @method Phaser.Physics.Arcade.Body#reboundCheck
+ * @protected
+ * @param {boolean} x - Check the X axis?
+ * @param {boolean} y - Check the Y axis?
+ * @param {boolean} rebound - If true it will reverse the velocity on the given axis
+ */
+ reboundCheck: function (x, y, rebound) {
+
+ if (x)
+ {
+ if (rebound && this.bounce.x !== 0 && (this.blocked.left || this.blocked.right || this.touching.left || this.touching.right))
+ {
+ // Don't rebound if they've already rebounded in this frame
+ if (!(this._vx <= 0 && this.velocity.x > 0) && !(this._vx >= 0 && this.velocity.x < 0))
+ {
+ this.velocity.x *= -this.bounce.x;
+ this.angle = Math.atan2(this.velocity.y, this.velocity.x);
+ }
+ }
+
+ if (this.bounce.x === 0 || Math.abs(this.velocity.x) < this.minVelocity.x)
+ {
+ var gx = this.getUpwardForce();
+
+ if (((this.blocked.left || this.touching.left) && (gx < 0 || this.velocity.x < 0)) || ((this.blocked.right || this.touching.right) && (gx > 0 || this.velocity.x > 0)))
+ {
+ this.velocity.x = 0;
+ }
+ }
+ }
+
+ if (y)
+ {
+ if (rebound && this.bounce.y !== 0 && (this.blocked.up || this.blocked.down || this.touching.up || this.touching.down))
+ {
+ // Don't rebound if they've already rebounded in this frame
+ if (!(this._vy <= 0 && this.velocity.y > 0) && !(this._vy >= 0 && this.velocity.y < 0))
+ {
+ this.velocity.y *= -this.bounce.y;
+ this.angle = Math.atan2(this.velocity.y, this.velocity.x);
+ }
+ }
+
+ if (this.bounce.y === 0 || Math.abs(this.velocity.y) < this.minVelocity.y)
+ {
+ var gy = this.getDownwardForce();
+
+ if (((this.blocked.up || this.touching.up) && (gy < 0 || this.velocity.y < 0)) || ((this.blocked.down || this.touching.down) && (gy > 0 || this.velocity.y > 0)))
+ {
+ this.velocity.y = 0;
+ }
+ }
+ }
+
+ },
+
+ /**
+ * Gets the total force being applied on the X axis, including gravity and velocity.
+ *
+ * @method Phaser.Physics.Arcade.Body#getUpwardForce
+ * @return {number} The total force being applied on the X axis.
+ */
+ getUpwardForce: function () {
+
+ if (this.allowGravity)
+ {
+ return this.gravity.x + this.game.physics.gravity.x + this.velocity.x;
+ }
+ else
+ {
+ return this.gravity.x + this.velocity.x;
+ }
+
+ },
+
+ /**
+ * Gets the total force being applied on the X axis, including gravity and velocity.
+ *
+ * @method Phaser.Physics.Arcade.Body#getDownwardForce
+ * @return {number} The total force being applied on the Y axis.
+ */
+ getDownwardForce: function () {
+
+ if (this.allowGravity)
+ {
+ return this.gravity.y + this.game.physics.gravity.y + this.velocity.y;
+ }
+ else
+ {
+ return this.gravity.y + this.velocity.y;
+ }
+
+ },
+
+ /**
+ * Subtracts the given Vector from this Body.
+ *
+ * @method Phaser.Physics.Arcade.Body#sub
+ * @protected
+ * @param {SAT.Vector} v - The vector to substract from this Body.
+ */
+ sub: function (v) {
+
+ this.x -= v.x;
+ this.y -= v.y;
+
+ },
+
+ /**
+ * Adds the given Vector to this Body.
+ *
+ * @method Phaser.Physics.Arcade.Body#add
+ * @protected
+ * @param {SAT.Vector} v - The vector to add to this Body.
+ */
+ add: function (v) {
+
+ this.x += v.x;
+ this.y += v.y;
+
+ },
+
+ /**
+ * Separation response handler.
+ *
+ * @method Phaser.Physics.Arcade.Body#give
+ * @protected
+ * @param {Phaser.Physics.Arcade.Body} body - The Body that collided.
+ * @param {SAT.Response} response - The SAT Response object containing the collision data.
+ */
+ give: function (body, response) {
+
+ this.add(response.overlapV);
+
+ if (this.rebound)
+ {
+ this.processRebound(body);
+ this.reboundCheck(true, true, false);
+ body.reboundCheck(true, true, false);
+ }
+
+ },
+
+ /**
+ * Separation response handler.
+ *
+ * @method Phaser.Physics.Arcade.Body#take
+ * @protected
+ * @param {Phaser.Physics.Arcade.Body} body - The Body that collided.
+ * @param {SAT.Response} response - The SAT Response object containing the collision data.
+ */
+ take: function (body, response) {
+
+ this.sub(response.overlapV);
+
+ if (this.rebound)
+ {
+ this.processRebound(body);
+ this.reboundCheck(true, true, false);
+ body.reboundCheck(true, true, false);
+ }
+
+ },
+
+ /**
+ * Split the collision response evenly between the two bodies.
+ *
+ * @method Phaser.Physics.Arcade.Body#split
+ * @protected
+ * @param {Phaser.Physics.Arcade.Body} body - The Body that collided.
+ * @param {SAT.Response} response - The SAT Response object containing the collision data.
+ */
+ split: function (body, response) {
+
+ response.overlapV.scale(0.5);
+ this.sub(response.overlapV);
+ body.add(response.overlapV);
+
+ if (this.rebound)
+ {
+ this.exchange(body);
+ this.reboundCheck(true, true, false);
+ body.reboundCheck(true, true, false);
+ }
+
+ },
+
+ /**
+ * Exchange velocity with the given Body.
+ *
+ * @method Phaser.Physics.Arcade.Body#exchange
+ * @protected
+ * @param {Phaser.Physics.Arcade.Body} body - The Body that collided.
+ */
+ exchange: function (body) {
+
+ if (this.mass === body.mass && this.speed > 0 && body.speed > 0)
+ {
+ // A direct velocity exchange (as they are both moving and have the same mass)
+ this._dx = body.velocity.x;
+ this._dy = body.velocity.y;
+
+ body.velocity.x = this.velocity.x * body.bounce.x;
+ body.velocity.y = this.velocity.y * body.bounce.x;
+
+ this.velocity.x = this._dx * this.bounce.x;
+ this.velocity.y = this._dy * this.bounce.y;
+ }
+ else
+ {
+ var nv1 = Math.sqrt((body.velocity.x * body.velocity.x * body.mass) / this.mass) * ((body.velocity.x > 0) ? 1 : -1);
+ var nv2 = Math.sqrt((this.velocity.x * this.velocity.x * this.mass) / body.mass) * ((this.velocity.x > 0) ? 1 : -1);
+ var average = (nv1 + nv2) * 0.5;
+ nv1 -= average;
+ nv2 -= average;
+
+ this.velocity.x = nv1;
+ body.velocity.x = nv2;
+
+ nv1 = Math.sqrt((body.velocity.y * body.velocity.y * body.mass) / this.mass) * ((body.velocity.y > 0) ? 1 : -1);
+ nv2 = Math.sqrt((this.velocity.y * this.velocity.y * this.mass) / body.mass) * ((this.velocity.y > 0) ? 1 : -1);
+ average = (nv1 + nv2) * 0.5;
+ nv1 -= average;
+ nv2 -= average;
+
+ this.velocity.y = nv1;
+ body.velocity.y = nv2;
+ }
+
+ // update speed / angle?
+
+ },
+
+ /**
+ * Rebound the velocity of this Body.
+ *
+ * @method Phaser.Physics.Arcade.Body#processRebound
+ * @protected
+ * @param {Phaser.Physics.Arcade.Body} body - The Body that collided.
+ */
+ processRebound: function (body) {
+
+ // Don't rebound again if they've already rebounded in this frame
+ if (!(this._vx <= 0 && this.velocity.x > 0) && !(this._vx >= 0 && this.velocity.x < 0))
+ {
+ this.velocity.x = body.velocity.x - this.velocity.x * this.bounce.x;
+ }
+
+ if (!(this._vy <= 0 && this.velocity.y > 0) && !(this._vy >= 0 && this.velocity.y < 0))
+ {
+ this.velocity.y = body.velocity.y - this.velocity.y * this.bounce.y;
+ }
+
+ this.angle = Math.atan2(this.velocity.y, this.velocity.x);
+
+ this.reboundCheck(true, true, false);
+
+ },
+
+ /**
+ * Checks for an overlap between this Body and the given Body.
+ *
+ * @method Phaser.Physics.Arcade.Body#overlap
+ * @param {Phaser.Physics.Arcade.Body} body - The Body that is being checked against this Body.
+ * @param {SAT.Response} response - SAT Response handler.
+ * @return {boolean} True if the two bodies overlap, otherwise false.
+ */
+ overlap: function (body, response) {
+
+ var result = false;
+
+ if ((this.type === Phaser.Physics.Arcade.RECT || this.type === Phaser.Physics.Arcade.POLYGON) && (body.type === Phaser.Physics.Arcade.RECT || body.type === Phaser.Physics.Arcade.POLYGON))
+ {
+ result = SAT.testPolygonPolygon(this.polygon, body.polygon, response);
+ }
+ else if (this.type === Phaser.Physics.Arcade.CIRCLE && body.type === Phaser.Physics.Arcade.CIRCLE)
+ {
+ result = SAT.testCircleCircle(this.shape, body.shape, response);
+ }
+ else if ((this.type === Phaser.Physics.Arcade.RECT || this.type === Phaser.Physics.Arcade.POLYGON) && body.type === Phaser.Physics.Arcade.CIRCLE)
+ {
+ result = SAT.testPolygonCircle(this.polygon, body.shape, response);
+ }
+ else if (this.type === Phaser.Physics.Arcade.CIRCLE && (body.type === Phaser.Physics.Arcade.RECT || body.type === Phaser.Physics.Arcade.POLYGON))
+ {
+ result = SAT.testCirclePolygon(this.shape, body.polygon, response);
+ }
+
+ if (!result)
+ {
+ this.removeContact(body);
+ }
+
+ return result;
+
+ },
+
+ /**
+ * Checks if this Body is already in contact with the given Body.
+ *
+ * @method Phaser.Physics.Arcade.Body#inContact
+ * @param {Phaser.Physics.Arcade.Body} body - The Body to be checked.
+ * @return {boolean} True if the given Body is already in contact with this Body.
+ */
+ inContact: function (body) {
+
+ return (this.contacts.indexOf(body) != -1);
+
+ },
+
+ /**
+ * Adds the given Body to the contact list of this Body. Also adds this Body to the contact list of the given Body.
+ *
+ * @method Phaser.Physics.Arcade.Body#addContact
+ * @param {Phaser.Physics.Arcade.Body} body - The Body to be added.
+ * @return {boolean} True if the given Body was added to this contact list, false if already on it.
+ */
+ addContact: function (body) {
+
+ if (this.inContact(body))
+ {
+ return false;
+ }
+
+ this.contacts.push(body);
+
+ this.sprite.events.onBeginContact.dispatch(this.sprite, body.sprite, this, body);
+
+ body.addContact(this);
+
+ return true;
+
+ },
+
+ /**
+ * Removes the given Body from the contact list of this Body. Also removes this Body from the contact list of the given Body.
+ *
+ * @method Phaser.Physics.Arcade.Body#removeContact
+ * @param {Phaser.Physics.Arcade.Body} body - The Body to be removed.
+ * @return {boolean} True if the given Body was removed from this contact list, false if wasn't on it.
+ */
+ removeContact: function (body) {
+
+ if (!this.inContact(body))
+ {
+ return false;
+ }
+
+ this.contacts.splice(this.contacts.indexOf(body), 1);
+
+ this.sprite.events.onEndContact.dispatch(this.sprite, body.sprite, this, body);
+
+ body.removeContact(this);
+
+ return true;
+
+ },
+
+ /**
+ * This separates this Body from the given Body unless a customSeparateCallback is set.
+ * It assumes they have already been overlap checked and the resulting overlap is stored in the SAT response.
+ *
+ * @method Phaser.Physics.Arcade.Body#separate
+ * @protected
+ * @param {Phaser.Physics.Arcade.Body} body - The Body to be separated from this one.
+ * @param {SAT.Response} response - SAT Response handler.
+ * @return {boolean} True if the bodies were separated, false if not (for example checkCollide allows them to pass through)
+ */
+ separate: function (body, response) {
+
+ if (this.inContact(body))
+ {
+ return false;
+ }
+
+ this._distances[0] = body.right - this.x; // Distance of B to face on left side of A
+ this._distances[1] = this.right - body.x; // Distance of B to face on right side of A
+ this._distances[2] = body.bottom - this.y; // Distance of B to face on bottom side of A
+ this._distances[3] = this.bottom - body.y; // Distance of B to face on top side of A
+
+ // If we've zero distance then check for side-slicing
+ if (response.overlapN.x && (this._distances[0] === 0 || this._distances[1] === 0))
+ {
+ response.overlapN.x = false;
+ response.overlapN.y = true;
+ }
+ else if (response.overlapN.y && (this._distances[2] === 0 || this._distances[3] === 0))
+ {
+ response.overlapN.x = true;
+ response.overlapN.y = false;
+ }
+
+ if (this.customSeparateCallback)
+ {
+ return this.customSeparateCallback.call(this.customSeparateContext, this, response, this._distances);
+ }
+
+ var hasSeparated = false;
+
+ if (response.overlapN.x)
+ {
+ // Which is smaller? Left or Right?
+ if (this._distances[0] < this._distances[1] && (body.checkCollision.right || this.checkCollision.left))
+ {
+ hasSeparated = this.hitLeft(body, response);
+ }
+ else if (this._distances[1] < this._distances[0] && (body.checkCollision.left || this.checkCollision.right))
+ {
+ hasSeparated = this.hitRight(body, response);
+ }
+ }
+ else if (response.overlapN.y)
+ {
+ // Which is smaller? Top or Bottom?
+ if (this._distances[2] < this._distances[3] && (body.checkCollision.down || this.checkCollision.up))
+ {
+ hasSeparated = this.hitTop(body, response);
+ }
+ else if (this._distances[3] < this._distances[2] && (body.checkCollision.up || this.checkCollision.down))
+ {
+ hasSeparated = this.hitBottom(body, response);
+ }
+ }
+
+ if (hasSeparated)
+ {
+ this.game.physics.checkBounds(this);
+ this.game.physics.checkBounds(body);
+ }
+ else
+ {
+ // They can only contact like this if at least one of their sides is open, otherwise it's a separation
+ if (!this.checkCollision.up || !this.checkCollision.down || !this.checkCollision.left || !this.checkCollision.right || !body.checkCollision.up || !body.checkCollision.down || !body.checkCollision.left || !body.checkCollision.right)
+ {
+ this.addContact(body);
+ }
+ }
+
+ return hasSeparated;
+
+ },
+
+ /**
+ * Process a collision with the left face of this Body.
+ * Collision and separation can be further checked by setting a collideCallback.
+ * This callback will be sent 4 parameters: The face of collision, this Body, the colliding Body and the SAT Response.
+ * If the callback returns true then separation, rebounds and the touching flags will all be set.
+ * If it returns false this will be skipped and must be handled manually.
+ *
+ * @method Phaser.Physics.Arcade.Body#hitLeft
+ * @protected
+ * @param {Phaser.Physics.Arcade.Body} body - The Body that collided.
+ * @param {SAT.Response} response - The SAT Response object containing the collision data.
+ */
+ hitLeft: function (body, response) {
+
+ if (this.collideCallback && !this.collideCallback.call(this.collideCallbackContext, Phaser.LEFT, this, body, response))
+ {
+ return;
+ }
+
+ if (!this.moves || this.immovable || this.blocked.right || this.touching.right)
+ {
+ body.give(this, response);
+ }
+ else
+ {
+ if (body.immovable || body.blocked.left || body.touching.left)
+ {
+ // We take the full separation
+ this.take(body, response);
+ }
+ else
+ {
+ // Share out the separation
+ this.split(body, response);
+ }
+ }
+
+ this.touching.left = true;
+ body.touching.right = true;
+
+ },
+
+ /**
+ * Process a collision with the right face of this Body.
+ * Collision and separation can be further checked by setting a collideCallback.
+ * This callback will be sent 4 parameters: The face of collision, this Body, the colliding Body and the SAT Response.
+ * If the callback returns true then separation, rebounds and the touching flags will all be set.
+ * If it returns false this will be skipped and must be handled manually.
+ *
+ * @method Phaser.Physics.Arcade.Body#hitRight
+ * @protected
+ * @param {Phaser.Physics.Arcade.Body} body - The Body that collided.
+ * @param {SAT.Response} response - The SAT Response object containing the collision data.
+ */
+ hitRight: function (body, response) {
+
+ if (this.collideCallback && !this.collideCallback.call(this.collideCallbackContext, Phaser.RIGHT, this, body))
+ {
+ return;
+ }
+
+ if (!this.moves || this.immovable || this.blocked.left || this.touching.left)
+ {
+ body.give(this, response);
+ }
+ else
+ {
+ if (body.immovable || body.blocked.right || body.touching.right)
+ {
+ // We take the full separation
+ this.take(body, response);
+ }
+ else
+ {
+ // Share out the separation
+ this.split(body, response);
+ }
+ }
+
+ this.touching.right = true;
+ body.touching.left = true;
+
+ },
+
+ /**
+ * Process a collision with the top face of this Body.
+ * Collision and separation can be further checked by setting a collideCallback.
+ * This callback will be sent 4 parameters: The face of collision, this Body, the colliding Body and the SAT Response.
+ * If the callback returns true then separation, rebounds and the touching flags will all be set.
+ * If it returns false this will be skipped and must be handled manually.
+ *
+ * @method Phaser.Physics.Arcade.Body#hitTop
+ * @protected
+ * @param {Phaser.Physics.Arcade.Body} body - The Body that collided.
+ * @param {SAT.Response} response - The SAT Response object containing the collision data.
+ */
+ hitTop: function (body, response) {
+
+ if (this.collideCallback && !this.collideCallback.call(this.collideCallbackContext, Phaser.UP, this, body))
+ {
+ return false;
+ }
+
+ if (!this.moves || this.immovable || this.blocked.down || this.touching.down)
+ {
+ body.give(this, response);
+ }
+ else
+ {
+ if (body.immovable || body.blocked.up || body.touching.up)
+ {
+ // We take the full separation
+ this.take(body, response);
+ }
+ else
+ {
+ // Share out the separation
+ this.split(body, response);
+ }
+ }
+
+ this.touching.up = true;
+ body.touching.down = true;
+
+ return true;
+
+ },
+
+ /**
+ * Process a collision with the bottom face of this Body.
+ * Collision and separation can be further checked by setting a collideCallback.
+ * This callback will be sent 4 parameters: The face of collision, this Body, the colliding Body and the SAT Response.
+ * If the callback returns true then separation, rebounds and the touching flags will all be set.
+ * If it returns false this will be skipped and must be handled manually.
+ *
+ * @method Phaser.Physics.Arcade.Body#hitBottom
+ * @protected
+ * @param {Phaser.Physics.Arcade.Body} body - The Body that collided.
+ * @param {SAT.Response} response - The SAT Response object containing the collision data.
+ */
+ hitBottom: function (body, response) {
+
+ if (this.collideCallback && !this.collideCallback.call(this.collideCallbackContext, Phaser.DOWN, this, body))
+ {
+ return false;
+ }
+
+ if (!this.moves || this.immovable || this.blocked.up || this.touching.up)
+ {
+ body.give(this, response);
+ }
+ else
+ {
+ if (body.immovable || body.blocked.down || body.touching.down)
+ {
+ // We take the full separation
+ this.take(body, response);
+ }
+ else
+ {
+ // Share out the separation
+ this.split(body, response);
+ }
+ }
+
+ this.touching.down = true;
+ body.touching.up = true;
+
+ return true;
+
+ },
+
+ /**
+ * Internal method. Integrates velocity, global gravity and the delta timer.
+ *
+ * @method Phaser.Physics.Arcade.Body#integrateVelocity
+ * @protected
+ */
+ integrateVelocity: function () {
+
+ this._temp = this.game.physics.updateMotion(this);
+ this._dx = this.game.time.physicsElapsed * (this.velocity.x + this._temp.x / 2);
+ this._dy = this.game.time.physicsElapsed * (this.velocity.y + this._temp.y / 2);
+
+ // positive = RIGHT / DOWN
+ // negative = LEFT / UP
+
+ if ((this._dx < 0 && !this.blocked.left && !this.touching.left) || (this._dx > 0 && !this.blocked.right && !this.touching.right))
+ {
+ this.x += this._dx;
+ this.velocity.x += this._temp.x;
+ }
+
+ if ((this._dy < 0 && !this.blocked.up && !this.touching.up) || (this._dy > 0 && !this.blocked.down && !this.touching.down))
+ {
+ this.y += this._dy;
+ this.velocity.y += this._temp.y;
+ }
+
+ if (this.velocity.x > this.maxVelocity.x)
+ {
+ this.velocity.x = this.maxVelocity.x;
+ }
+ else if (this.velocity.x < -this.maxVelocity.x)
+ {
+ this.velocity.x = -this.maxVelocity.x;
+ }
+
+ if (this.velocity.y > this.maxVelocity.y)
+ {
+ this.velocity.y = this.maxVelocity.y;
+ }
+ else if (this.velocity.y < -this.maxVelocity.y)
+ {
+ this.velocity.y = -this.maxVelocity.y;
+ }
+
+ },
+
+ /**
+ * Internal method. This is called directly before the sprites are sent to the renderer and after the update function has finished.
+ *
+ * @method Phaser.Physics.Arcade.Body#postUpdate
* @protected
*/
postUpdate: function () {
- if (this.deltaX() < 0)
+ if (this.moves)
{
- this.facing = Phaser.LEFT;
- }
- else if (this.deltaX() > 0)
- {
- this.facing = Phaser.RIGHT;
- }
+ this.reboundCheck(true, true, true);
- if (this.deltaY() < 0)
- {
- this.facing = Phaser.UP;
- }
- else if (this.deltaY() > 0)
- {
- this.facing = Phaser.DOWN;
- }
+ this.game.physics.checkBounds(this);
- if (this.deltaX() !== 0 || this.deltaY() !== 0)
- {
- this.sprite.x += this.deltaX();
- this.sprite.y += this.deltaY();
- this.center.setTo(this.x + this.halfWidth, this.y + this.halfHeight);
- }
+ this._dx = this.deltaX();
+ this._dy = this.deltaY();
+
+ if (this._dx < 0)
+ {
+ this.facing = Phaser.LEFT;
+ }
+ else if (this._dx > 0)
+ {
+ this.facing = Phaser.RIGHT;
+ }
+
+ if (this._dy < 0)
+ {
+ this.facing = Phaser.UP;
+ }
+ else if (this._dy > 0)
+ {
+ this.facing = Phaser.DOWN;
+ }
+
+ if (this._dx !== 0 || this._dy !== 0)
+ {
+ this.sprite.x += this._dx;
+ this.sprite.y += this._dy;
+ }
+
+ if (this.allowRotation && this.deltaZ() !== 0)
+ {
+ this.sprite.angle += this.deltaZ();
+ }
+
+ if (this.sprite.scale.x !== this._sx || this.sprite.scale.y !== this._sy)
+ {
+ this.updateScale();
+ }
- if (this.allowRotation)
- {
- this.sprite.angle += this.deltaZ();
}
},
/**
- * Internal method.
+ * Resets the Body motion values: velocity, acceleration, angularVelocity and angularAcceleration.
+ * Also resets the forces to defaults: gravity, bounce, minVelocity,maxVelocity, angularDrag, maxAngular, mass, friction and checkCollision if 'full' specified.
*
- * @method Phaser.Physics.Arcade#updateHulls
- * @protected
+ * @method Phaser.Physics.Arcade.Body#reset
+ * @param {boolean} [full=false] - A full reset clears down settings you may have set, such as gravity, bounce and drag. A non-full reset just clears motion values.
*/
- updateHulls: function () {
+ reset: function (full) {
- this.hullX.setTo(this.x, this.preY, this.width, this.height);
- this.hullY.setTo(this.preX, this.y, this.width, this.height);
+ if (typeof full === 'undefined') { full = false; }
- },
-
- /**
- * Internal method.
- *
- * @method Phaser.Physics.Arcade#checkWorldBounds
- * @protected
- */
- checkWorldBounds: function () {
-
- if (this.x < this.game.world.bounds.x)
+ if (full)
{
- this.x = this.game.world.bounds.x;
- this.velocity.x *= -this.bounce.x;
+ this.gravity.setTo(0, 0);
+ this.bounce.setTo(0, 0);
+ this.minVelocity.setTo(5, 5);
+ this.maxVelocity.setTo(1000, 1000);
+ this.angularDrag = 0;
+ this.maxAngular = 1000;
+ this.mass = 1;
+ this.friction = 0.0;
+ this.checkCollision = { none: false, any: true, up: true, down: true, left: true, right: true };
}
- else if (this.right > this.game.world.bounds.right)
- {
- this.x = this.game.world.bounds.right - this.width;
- this.velocity.x *= -this.bounce.x;
- }
-
- if (this.y < this.game.world.bounds.y)
- {
- this.y = this.game.world.bounds.y;
- this.velocity.y *= -this.bounce.y;
- }
- else if (this.bottom > this.game.world.bounds.bottom)
- {
- this.y = this.game.world.bounds.bottom - this.height;
- this.velocity.y *= -this.bounce.y;
- }
-
- },
-
- /**
- * You can modify the size of the physics Body to be any dimension you need.
- * So it could be smaller or larger than the parent Sprite. You can also control the x and y offset, which
- * is the position of the Body relative to the top-left of the Sprite.
- *
- * @method Phaser.Physics.Arcade#setSize
- * @param {number} width - The width of the Body.
- * @param {number} height - The height of the Body.
- * @param {number} offsetX - The X offset of the Body from the Sprite position.
- * @param {number} offsetY - The Y offset of the Body from the Sprite position.
- */
- setSize: function (width, height, offsetX, offsetY) {
-
- offsetX = offsetX || this.offset.x;
- offsetY = offsetY || this.offset.y;
-
- this.sourceWidth = width;
- this.sourceHeight = height;
- this.width = this.sourceWidth * this._sx;
- this.height = this.sourceHeight * this._sy;
- this.halfWidth = Math.floor(this.width / 2);
- this.halfHeight = Math.floor(this.height / 2);
- this.offset.setTo(offsetX, offsetY);
-
- this.center.setTo(this.x + this.halfWidth, this.y + this.halfHeight);
-
- },
-
- /**
- * Resets all Body values (velocity, acceleration, rotation, etc)
- *
- * @method Phaser.Physics.Arcade#reset
- */
- reset: function () {
this.velocity.setTo(0, 0);
this.acceleration.setTo(0, 0);
-
this.angularVelocity = 0;
this.angularAcceleration = 0;
- this.preX = (this.sprite.world.x - (this.sprite.anchor.x * this.width)) + this.offset.x;
- this.preY = (this.sprite.world.y - (this.sprite.anchor.y * this.height)) + this.offset.y;
- this.preRotation = this.sprite.angle;
+ this.blocked = { x: 0, y: 0, up: false, down: false, left: false, right: false };
+ this.x = (this.sprite.world.x - (this.sprite.anchor.x * this.sprite.width)) + this.offset.x;
+ this.y = (this.sprite.world.y - (this.sprite.anchor.y * this.sprite.height)) + this.offset.y;
+ this.preX = this.x;
+ this.preY = this.y;
+ this.updateBounds();
- this.x = this.preX;
- this.y = this.preY;
- this.rotation = this.preRotation;
-
- this.center.setTo(this.x + this.halfWidth, this.y + this.halfHeight);
+ this.contacts.length = 0;
},
/**
- * Returns the absolute delta x value.
+ * Destroys this Body and all references it holds to other objects.
*
- * @method Phaser.Physics.Arcade.Body#deltaAbsX
- * @return {number} The absolute delta value.
+ * @method Phaser.Physics.Arcade.Body#destroy
*/
- deltaAbsX: function () {
- return (this.deltaX() > 0 ? this.deltaX() : -this.deltaX());
+ destroy: function () {
+
+ this.sprite = null;
+
+ this.collideCallback = null;
+ this.collideCallbackContext = null;
+
+ this.customSeparateCallback = null;
+ this.customSeparateContext = null;
+
+ this.contacts.length = 0;
+
},
/**
- * Returns the absolute delta y value.
+ * Sets this Body to use a circle of the given radius for all collision.
+ * The Circle will be centered on the center of the Sprite by default, but can be adjusted via the Body.offset property and the setCircle x/y parameters.
*
- * @method Phaser.Physics.Arcade.Body#deltaAbsY
- * @return {number} The absolute delta value.
+ * @method Phaser.Physics.Arcade.Body#setCircle
+ * @param {number} radius - The radius of this circle (in pixels)
+ * @param {number} [offsetX=0] - The x amount the circle will be offset from the Sprites center.
+ * @param {number} [offsetY=0] - The y amount the circle will be offset from the Sprites center.
*/
- deltaAbsY: function () {
- return (this.deltaY() > 0 ? this.deltaY() : -this.deltaY());
+ setCircle: function (radius, offsetX, offsetY) {
+
+ if (typeof offsetX === 'undefined') { offsetX = this.sprite._cache.halfWidth; }
+ if (typeof offsetY === 'undefined') { offsetY = this.sprite._cache.halfHeight; }
+
+ this.type = Phaser.Physics.Arcade.CIRCLE;
+ this.shape = new SAT.Circle(new SAT.Vector(this.sprite.x, this.sprite.y), radius);
+ this.polygon = null;
+
+ this.offset.setTo(offsetX, offsetY);
+
},
/**
- * Returns the delta x value. The difference between Body.x now and in the previous step.
+ * Sets this Body to use a rectangle for all collision.
+ * If you don't specify any parameters it will be sized to match the parent Sprites current width and height (including scale factor) and centered on the sprite.
+ *
+ * @method Phaser.Physics.Arcade.Body#setRectangle
+ * @param {number} [width] - The width of the rectangle. If not specified it will default to the width of the parent Sprite.
+ * @param {number} [height] - The height of the rectangle. If not specified it will default to the height of the parent Sprite.
+ * @param {number} [translateX] - The x amount the rectangle will be translated from the Sprites center.
+ * @param {number} [translateY] - The y amount the rectangle will be translated from the Sprites center.
+ */
+ setRectangle: function (width, height, translateX, translateY) {
+
+ if (typeof width === 'undefined') { width = this.sprite.width; }
+ if (typeof height === 'undefined') { height = this.sprite.height; }
+ if (typeof translateX === 'undefined') { translateX = -this.sprite._cache.halfWidth; }
+ if (typeof translateY === 'undefined') { translateY = -this.sprite._cache.halfHeight; }
+
+ this.type = Phaser.Physics.Arcade.RECT;
+ this.shape = new SAT.Box(new SAT.Vector(this.sprite.world.x, this.sprite.world.y), width, height);
+ this.polygon = this.shape.toPolygon();
+ this.polygon.translate(translateX, translateY);
+
+ this.offset.setTo(0, 0);
+
+ },
+
+ /**
+ * Sets this Body to use a convex polygon for collision.
+ * The points are specified in a counter-clockwise direction and must create a convex polygon.
+ * Use Body.translate and/or Body.offset to re-position the polygon from the Sprite origin.
+ *
+ * @method Phaser.Physics.Arcade.Body#setPolygon
+ * @param {(SAT.Vector[]|number[]|...SAT.Vector|...number)} points - This can be an array of Vectors that form the polygon,
+ * a flat array of numbers that will be interpreted as [x,y, x,y, ...], or the arguments passed can be
+ * all the points of the polygon e.g. `setPolygon(new SAT.Vector(), new SAT.Vector(), ...)`, or the
+ * arguments passed can be flat x,y values e.g. `setPolygon(x,y, x,y, x,y, ...)` where `x` and `y` are Numbers.
+ */
+ setPolygon: function (points) {
+
+ this.type = Phaser.Physics.Arcade.POLYGON;
+ this.shape = null;
+
+ if (!Array.isArray(points))
+ {
+ points = Array.prototype.slice.call(arguments);
+ }
+
+ if (typeof points[0] === 'number')
+ {
+ var p = [];
+
+ for (var i = 0, len = points.length; i < len; i += 2)
+ {
+ p.push(new SAT.Vector(points[i], points[i + 1]));
+ }
+
+ points = p;
+ }
+
+ this.polygon = new SAT.Polygon(new SAT.Vector(this.sprite.center.x, this.sprite.center.y), points);
+
+ this.offset.setTo(0, 0);
+
+ },
+
+ /**
+ * Used for translating rectangle and polygon bodies from the Sprite parent. Doesn't apply to Circles.
+ * See also the Body.offset property.
+ *
+ * @method Phaser.Physics.Arcade.Body#translate
+ * @param {number} x - The x amount the polygon or rectangle will be translated by from the Sprite.
+ * @param {number} y - The y amount the polygon or rectangle will be translated by from the Sprite.
+ */
+ translate: function (x, y) {
+
+ if (this.polygon)
+ {
+ this.polygon.translate(x, y);
+ }
+
+ },
+
+ /**
+ * Determines if this Body is 'on the floor', which means in contact with a Tile or World bounds, or other object that has set 'down' as blocked.
+ *
+ * @method Phaser.Physics.Arcade.Body#onFloor
+ * @return {boolean} True if this Body is 'on the floor', which means in contact with a Tile or World bounds, or object that has set 'down' as blocked.
+ */
+ onFloor: function () {
+ return this.blocked.down;
+ },
+
+ /**
+ * Determins if this Body is 'on a wall', which means horizontally in contact with a Tile or World bounds, or other object but not the ground.
+ *
+ * @method Phaser.Physics.Arcade.Body#onWall
+ * @return {boolean} True if this Body is 'on a wall', which means horizontally in contact with a Tile or World bounds, or other object but not the ground.
+ */
+ onWall: function () {
+ return (!this.blocked.down && (this.blocked.left || this.blocked.right));
+ },
+
+ /**
+ * Returns the delta x value. The amount the Body has moved horizontally in the current step.
*
* @method Phaser.Physics.Arcade.Body#deltaX
- * @return {number} The delta value.
+ * @return {number} The delta value. Positive if the motion was to the right, negative if to the left.
*/
deltaX: function () {
return this.x - this.preX;
},
/**
- * Returns the delta y value. The difference between Body.y now and in the previous step.
+ * Returns the delta y value. The amount the Body has moved vertically in the current step.
*
* @method Phaser.Physics.Arcade.Body#deltaY
- * @return {number} The delta value.
+ * @return {number} The delta value. Positive if the motion was downwards, negative if upwards.
*/
deltaY: function () {
return this.y - this.preY;
},
+ /**
+ * Returns the delta z value. The amount the Body has rotated in the current step.
+ *
+ * @method Phaser.Physics.Arcade.Body#deltaZ
+ * @return {number} The delta value.
+ */
deltaZ: function () {
return this.rotation - this.preRotation;
}
};
+Phaser.Physics.Arcade.Body.prototype.constructor = Phaser.Physics.Arcade.Body;
+
/**
-* @name Phaser.Physics.Arcade.Body#bottom
-* @property {number} bottom - The bottom value of this Body (same as Body.y + Body.height)
+* @name Phaser.Physics.Arcade.Body#x
+* @property {number} x - The x coordinate of this Body.
*/
-Object.defineProperty(Phaser.Physics.Arcade.Body.prototype, "bottom", {
+Object.defineProperty(Phaser.Physics.Arcade.Body.prototype, "x", {
- /**
- * The sum of the y and height properties. Changing the bottom property of a Rectangle object has no effect on the x, y and width properties, but does change the height property.
- * @method bottom
- * @return {number}
- */
get: function () {
- return this.y + this.height;
- },
-
- /**
- * The sum of the y and height properties. Changing the bottom property of a Rectangle object has no effect on the x, y and width properties, but does change the height property.
- * @method bottom
- * @param {number} value
- */
- set: function (value) {
-
- if (value <= this.y)
+
+ if (this.type === Phaser.Physics.Arcade.CIRCLE)
{
- this.height = 0;
+ return this.shape.pos.x;
}
else
{
- this.height = (this.y - value);
+ return this.polygon.pos.x;
}
-
+
+ },
+
+ set: function (value) {
+
+ if (this.type === Phaser.Physics.Arcade.CIRCLE)
+ {
+ this.shape.pos.x = value;
+ }
+ else
+ {
+ this.polygon.pos.x = value;
+ }
+
}
});
/**
-* @name Phaser.Physics.Arcade.Body#right
-* @property {number} right - The right value of this Body (same as Body.x + Body.width)
+* @name Phaser.Physics.Arcade.Body#y
+* @property {number} y - The y coordinate of this Body.
*/
-Object.defineProperty(Phaser.Physics.Arcade.Body.prototype, "right", {
+Object.defineProperty(Phaser.Physics.Arcade.Body.prototype, "y", {
- /**
- * The sum of the x and width properties. Changing the right property of a Rectangle object has no effect on the x, y and height properties.
- * However it does affect the width property.
- * @method right
- * @return {number}
- */
get: function () {
- return this.x + this.width;
- },
-
- /**
- * The sum of the x and width properties. Changing the right property of a Rectangle object has no effect on the x, y and height properties.
- * However it does affect the width property.
- * @method right
- * @param {number} value
- */
- set: function (value) {
-
- if (value <= this.x)
+
+ if (this.type === Phaser.Physics.Arcade.CIRCLE)
{
- this.width = 0;
+ return this.shape.pos.y;
}
else
{
- this.width = this.x + value;
+ return this.polygon.pos.y;
+ }
+
+ },
+
+ set: function (value) {
+
+ if (this.type === Phaser.Physics.Arcade.CIRCLE)
+ {
+ this.shape.pos.y = value;
+ }
+ else
+ {
+ this.polygon.pos.y = value;
}
}
@@ -1081,13 +1948,13 @@ Object.defineProperty(Phaser.Physics.Arcade.Body.prototype, "right", {
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:25 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Button.js.html b/docs/Button.js.html
index fcdbc0b0..50feb1cd 100644
--- a/docs/Button.js.html
+++ b/docs/Button.js.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -423,7 +417,7 @@
/**
* @author Richard Davey <rich@photonstorm.com>
-* @copyright 2013 Photon Storm Ltd.
+* @copyright 2014 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -442,16 +436,17 @@
* @constructor
*
* @param {Phaser.Game} game Current game instance.
-* @param {number} [x] - X position of the Button.
-* @param {number} [y] - Y position of the Button.
+* @param {number} [x=0] - X position of the Button.
+* @param {number} [y=0] - Y position of the Button.
* @param {string} [key] - The image key as defined in the Game.Cache to use as the texture for this Button.
* @param {function} [callback] - The function to call when this Button is pressed.
* @param {object} [callbackContext] - The context in which the callback will be called (usually 'this').
* @param {string|number} [overFrame] - This is the frame or frameName that will be set when this button is in an over state. Give either a number to use a frame ID or a string for a frame name.
* @param {string|number} [outFrame] - This is the frame or frameName that will be set when this button is in an out state. Give either a number to use a frame ID or a string for a frame name.
* @param {string|number} [downFrame] - This is the frame or frameName that will be set when this button is in a down state. Give either a number to use a frame ID or a string for a frame name.
+* @param {string|number} [upFrame] - This is the frame or frameName that will be set when this button is in an up state. Give either a number to use a frame ID or a string for a frame name.
*/
-Phaser.Button = function (game, x, y, key, callback, callbackContext, overFrame, outFrame, downFrame) {
+Phaser.Button = function (game, x, y, key, callback, callbackContext, overFrame, outFrame, downFrame, upFrame) {
x = x || 0;
y = y || 0;
@@ -486,7 +481,7 @@ Phaser.Button = function (game, x, y, key, callback, callbackContext, overFrame,
* @default
*/
this._onDownFrameName = null;
-
+
/**
* @property {string} _onUpFrameName - Internal variable.
* @private
@@ -514,7 +509,7 @@ Phaser.Button = function (game, x, y, key, callback, callbackContext, overFrame,
* @default
*/
this._onDownFrameID = null;
-
+
/**
* @property {number} _onUpFrameID - Internal variable.
* @private
@@ -596,13 +591,13 @@ Phaser.Button = function (game, x, y, key, callback, callbackContext, overFrame,
this.freezeFrames = false;
/**
- * When the Button is clicked you can optionally force the state to "out".
+ * When the Button is touched / clicked and then released you can force it to enter a state of "out" instead of "up".
* @property {boolean} forceOut
* @default
*/
- this.forceOut = true;
+ this.forceOut = false;
- this.setFrames(overFrame, outFrame, downFrame);
+ this.setFrames(overFrame, outFrame, downFrame, upFrame);
if (callback !== null)
{
@@ -624,15 +619,38 @@ Phaser.Button.prototype = Phaser.Utils.extend(true, Phaser.Button.prototype, Pha
Phaser.Button.prototype.constructor = Phaser.Button;
/**
-* Used to manually set the frames that will be used for the different states of the button
-* exactly like setting them in the constructor.
+* Clears all of the frames set on this Button.
+*
+* @method Phaser.Button.prototype.clearFrames
+*/
+Phaser.Button.prototype.clearFrames = function () {
+
+ this._onOverFrameName = null;
+ this._onOverFrameID = null;
+
+ this._onOutFrameName = null;
+ this._onOutFrameID = null;
+
+ this._onDownFrameName = null;
+ this._onDownFrameID = null;
+
+ this._onUpFrameName = null;
+ this._onUpFrameID = null;
+
+}
+
+/**
+* Used to manually set the frames that will be used for the different states of the Button.
*
* @method Phaser.Button.prototype.setFrames
* @param {string|number} [overFrame] - This is the frame or frameName that will be set when this button is in an over state. Give either a number to use a frame ID or a string for a frame name.
* @param {string|number} [outFrame] - This is the frame or frameName that will be set when this button is in an out state. Give either a number to use a frame ID or a string for a frame name.
* @param {string|number} [downFrame] - This is the frame or frameName that will be set when this button is in a down state. Give either a number to use a frame ID or a string for a frame name.
+* @param {string|number} [upFrame] - This is the frame or frameName that will be set when this button is in an up state. Give either a number to use a frame ID or a string for a frame name.
*/
-Phaser.Button.prototype.setFrames = function (overFrame, outFrame, downFrame) {
+Phaser.Button.prototype.setFrames = function (overFrame, outFrame, downFrame, upFrame) {
+
+ this.clearFrames();
if (overFrame !== null)
{
@@ -661,7 +679,6 @@ Phaser.Button.prototype.setFrames = function (overFrame, outFrame, downFrame) {
if (typeof outFrame === 'string')
{
this._onOutFrameName = outFrame;
- this._onUpFrameName = outFrame;
if (this.input.pointerOver() === false)
{
@@ -671,7 +688,6 @@ Phaser.Button.prototype.setFrames = function (overFrame, outFrame, downFrame) {
else
{
this._onOutFrameID = outFrame;
- this._onUpFrameID = outFrame;
if (this.input.pointerOver() === false)
{
@@ -702,6 +718,28 @@ Phaser.Button.prototype.setFrames = function (overFrame, outFrame, downFrame) {
}
}
+ if (upFrame !== null)
+ {
+ if (typeof upFrame === 'string')
+ {
+ this._onUpFrameName = upFrame;
+
+ if (this.input.pointerUp())
+ {
+ this.frameName = upFrame;
+ }
+ }
+ else
+ {
+ this._onUpFrameID = upFrame;
+
+ if (this.input.pointerUp())
+ {
+ this.frame = upFrame;
+ }
+ }
+ }
+
};
/**
@@ -723,8 +761,8 @@ Phaser.Button.prototype.setSounds = function (overSound, overMarker, downSound,
this.setOverSound(overSound, overMarker);
this.setOutSound(outSound, outMarker);
- this.setUpSound(upSound, upMarker);
this.setDownSound(downSound, downMarker);
+ this.setUpSound(upSound, upMarker);
}
@@ -777,31 +815,7 @@ Phaser.Button.prototype.setOutSound = function (sound, marker) {
}
/**
-* The Sound to be played when a Pointer clicks on this Button.
-*
-* @method Phaser.Button.prototype.setUpSound
-* @param {Phaser.Sound} sound - The Sound that will be played.
-* @param {string} [marker] - A Sound Marker that will be used in the playback.
-*/
-Phaser.Button.prototype.setUpSound = function (sound, marker) {
-
- this.onUpSound = null;
- this.onUpSoundMarker = '';
-
- if (sound instanceof Phaser.Sound)
- {
- this.onUpSound = sound;
- }
-
- if (typeof marker === 'string')
- {
- this.onUpSoundMarker = marker;
- }
-
-}
-
-/**
-* The Sound to be played when a Pointer clicks on this Button.
+* The Sound to be played when a Pointer presses down on this Button.
*
* @method Phaser.Button.prototype.setDownSound
* @param {Phaser.Sound} sound - The Sound that will be played.
@@ -824,25 +838,43 @@ Phaser.Button.prototype.setDownSound = function (sound, marker) {
}
+/**
+* The Sound to be played when a Pointer has pressed down and is released from this Button.
+*
+* @method Phaser.Button.prototype.setUpSound
+* @param {Phaser.Sound} sound - The Sound that will be played.
+* @param {string} [marker] - A Sound Marker that will be used in the playback.
+*/
+Phaser.Button.prototype.setUpSound = function (sound, marker) {
+
+ this.onUpSound = null;
+ this.onUpSoundMarker = '';
+
+ if (sound instanceof Phaser.Sound)
+ {
+ this.onUpSound = sound;
+ }
+
+ if (typeof marker === 'string')
+ {
+ this.onUpSoundMarker = marker;
+ }
+
+}
+
/**
* Internal function that handles input events.
*
* @protected
* @method Phaser.Button.prototype.onInputOverHandler
+* @param {Phaser.Button} sprite - The Button that the event occured on.
* @param {Phaser.Pointer} pointer - The Pointer that activated the Button.
*/
-Phaser.Button.prototype.onInputOverHandler = function (pointer) {
+Phaser.Button.prototype.onInputOverHandler = function (sprite, pointer) {
if (this.freezeFrames === false)
{
- if (this._onOverFrameName != null)
- {
- this.frameName = this._onOverFrameName;
- }
- else if (this._onOverFrameID != null)
- {
- this.frame = this._onOverFrameID;
- }
+ this.setState(1);
}
if (this.onOverSound)
@@ -861,20 +893,14 @@ Phaser.Button.prototype.onInputOverHandler = function (pointer) {
*
* @protected
* @method Phaser.Button.prototype.onInputOverHandler
+* @param {Phaser.Button} sprite - The Button that the event occured on.
* @param {Phaser.Pointer} pointer - The Pointer that activated the Button.
*/
-Phaser.Button.prototype.onInputOutHandler = function (pointer) {
+Phaser.Button.prototype.onInputOutHandler = function (sprite, pointer) {
if (this.freezeFrames === false)
{
- if (this._onOutFrameName != null)
- {
- this.frameName = this._onOutFrameName;
- }
- else if (this._onOutFrameID != null)
- {
- this.frame = this._onOutFrameID;
- }
+ this.setState(2);
}
if (this.onOutSound)
@@ -893,20 +919,14 @@ Phaser.Button.prototype.onInputOutHandler = function (pointer) {
*
* @protected
* @method Phaser.Button.prototype.onInputOverHandler
+* @param {Phaser.Button} sprite - The Button that the event occured on.
* @param {Phaser.Pointer} pointer - The Pointer that activated the Button.
*/
-Phaser.Button.prototype.onInputDownHandler = function (pointer) {
+Phaser.Button.prototype.onInputDownHandler = function (sprite, pointer) {
if (this.freezeFrames === false)
{
- if (this._onDownFrameName != null)
- {
- this.frameName = this._onDownFrameName;
- }
- else if (this._onDownFrameID != null)
- {
- this.frame = this._onDownFrameID;
- }
+ this.setState(3);
}
if (this.onDownSound)
@@ -925,29 +945,76 @@ Phaser.Button.prototype.onInputDownHandler = function (pointer) {
*
* @protected
* @method Phaser.Button.prototype.onInputOverHandler
+* @param {Phaser.Button} sprite - The Button that the event occured on.
* @param {Phaser.Pointer} pointer - The Pointer that activated the Button.
*/
-Phaser.Button.prototype.onInputUpHandler = function (pointer) {
-
- if (this.freezeFrames === false)
- {
- if (this._onUpFrameName != null)
- {
- this.frameName = this._onUpFrameName;
- }
- else if (this._onUpFrameID != null)
- {
- this.frame = this._onUpFrameID;
- }
- }
+Phaser.Button.prototype.onInputUpHandler = function (sprite, pointer, isOver) {
if (this.onUpSound)
{
this.onUpSound.play(this.onUpSoundMarker);
}
- if (this.forceOut && this.freezeFrames === false)
+ if (this.onInputUp)
{
+ this.onInputUp.dispatch(this, pointer, isOver);
+ }
+
+ if (this.freezeFrames)
+ {
+ return;
+ }
+
+ if (this.forceOut)
+ {
+ // Button should be forced to the Out frame when released.
+ this.setState(2);
+ }
+ else
+ {
+ if (this._onUpFrameName || this._onUpFrameID)
+ {
+ this.setState(4);
+ }
+ else
+ {
+ if (isOver)
+ {
+ this.setState(1);
+ }
+ else
+ {
+ this.setState(2);
+ }
+ }
+ }
+
+};
+
+/**
+* Internal function that handles Button state changes.
+*
+* @protected
+* @method Phaser.Button.prototype.setState
+* @param {number} newState - The new State of the Button.
+*/
+Phaser.Button.prototype.setState = function (newState) {
+
+ if (newState === 1)
+ {
+ // Over
+ if (this._onOverFrameName != null)
+ {
+ this.frameName = this._onOverFrameName;
+ }
+ else if (this._onOverFrameID != null)
+ {
+ this.frame = this._onOverFrameID;
+ }
+ }
+ else if (newState === 2)
+ {
+ // Out
if (this._onOutFrameName != null)
{
this.frameName = this._onOutFrameName;
@@ -957,10 +1024,29 @@ Phaser.Button.prototype.onInputUpHandler = function (pointer) {
this.frame = this._onOutFrameID;
}
}
-
- if (this.onInputUp)
+ else if (newState === 3)
{
- this.onInputUp.dispatch(this, pointer);
+ // Down
+ if (this._onDownFrameName != null)
+ {
+ this.frameName = this._onDownFrameName;
+ }
+ else if (this._onDownFrameID != null)
+ {
+ this.frame = this._onDownFrameID;
+ }
+ }
+ else if (newState === 4)
+ {
+ // Up
+ if (this._onUpFrameName != null)
+ {
+ this.frameName = this._onUpFrameName;
+ }
+ else if (this._onUpFrameID != null)
+ {
+ this.frame = this._onUpFrameID;
+ }
}
};
@@ -979,13 +1065,13 @@ Phaser.Button.prototype.onInputUpHandler = function (pointer) {
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:25 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Cache.js.html b/docs/Cache.js.html
index b6f9b4f4..bc00d8b4 100644
--- a/docs/Cache.js.html
+++ b/docs/Cache.js.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -423,16 +417,15 @@
/**
* @author Richard Davey <rich@photonstorm.com>
-* @copyright 2013 Photon Storm Ltd.
+* @copyright 2014 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
/**
* Phaser.Cache constructor.
*
-* @class Phaser.Cache
-* @classdesc A game only has one instance of a Cache and it is used to store all externally loaded assets such
-* as images, sounds and data files as a result of Loader calls. Cache items use string based keys for look-up.
+* @class Phaser.Cache
+* @classdesc A game only has one instance of a Cache and it is used to store all externally loaded assets such as images, sounds and data files as a result of Loader calls. Cached items use string based keys for look-up.
* @constructor
* @param {Phaser.Game} game - A reference to the currently running game.
*/
@@ -480,10 +473,10 @@ Phaser.Cache = function (game) {
this._tilemaps = {};
/**
- * @property {object} _tilesets - Tileset key-value container.
+ * @property {object} _binary - Binary file key-value container.
* @private
*/
- this._tilesets = {};
+ this._binary = {};
/**
* @property {object} _bitmapDatas - BitmapData key-value container.
@@ -516,6 +509,18 @@ Phaser.Cache.prototype = {
},
+ /**
+ * Add a binary object in to the cache.
+ * @method Phaser.Cache#addBinary
+ * @param {string} key - Asset key for this binary data.
+ * @param {object} binaryData - The binary object to be addded to the cache.
+ */
+ addBinary: function (key, binaryData) {
+
+ this._binary[key] = binaryData;
+
+ },
+
/**
* Add a BitmapData object in to the cache.
* @method Phaser.Cache#addBitmapData
@@ -555,40 +560,18 @@ Phaser.Cache.prototype = {
* @param {object} data - Extra sprite sheet data.
* @param {number} frameWidth - Width of the sprite sheet.
* @param {number} frameHeight - Height of the sprite sheet.
- * @param {number} frameMax - How many frames stored in the sprite sheet.
+ * @param {number} [frameMax=-1] - How many frames stored in the sprite sheet. If -1 then it divides the whole sheet evenly.
+ * @param {number} [margin=0] - If the frames have been drawn with a margin, specify the amount here.
+ * @param {number} [spacing=0] - If the frames have been drawn with spacing between them, specify the amount here.
*/
- addSpriteSheet: function (key, url, data, frameWidth, frameHeight, frameMax) {
+ addSpriteSheet: function (key, url, data, frameWidth, frameHeight, frameMax, margin, spacing) {
- this._images[key] = { url: url, data: data, spriteSheet: true, frameWidth: frameWidth, frameHeight: frameHeight };
+ this._images[key] = { url: url, data: data, spriteSheet: true, frameWidth: frameWidth, frameHeight: frameHeight, margin: margin, spacing: spacing };
PIXI.BaseTextureCache[key] = new PIXI.BaseTexture(data);
PIXI.TextureCache[key] = new PIXI.Texture(PIXI.BaseTextureCache[key]);
- this._images[key].frameData = Phaser.AnimationParser.spriteSheet(this.game, key, frameWidth, frameHeight, frameMax);
-
- },
-
- /**
- * Add a new tile set in to the cache.
- *
- * @method Phaser.Cache#addTileset
- * @param {string} key - The unique key by which you will reference this object.
- * @param {string} url - URL of this tile set file.
- * @param {object} data - Extra tile set data.
- * @param {number} tileWidth - Width of the sprite sheet.
- * @param {number} tileHeight - Height of the sprite sheet.
- * @param {number} tileMax - How many tiles stored in the sprite sheet.
- * @param {number} [tileMargin=0] - If the tiles have been drawn with a margin, specify the amount here.
- * @param {number} [tileSpacing=0] - If the tiles have been drawn with spacing between them, specify the amount here.
- */
- addTileset: function (key, url, data, tileWidth, tileHeight, tileMax, tileMargin, tileSpacing) {
-
- this._tilesets[key] = { url: url, data: data, tileWidth: tileWidth, tileHeight: tileHeight, tileMargin: tileMargin, tileSpacing: tileSpacing };
-
- PIXI.BaseTextureCache[key] = new PIXI.BaseTexture(data);
- PIXI.TextureCache[key] = new PIXI.Texture(PIXI.BaseTextureCache[key]);
-
- this._tilesets[key].tileData = Phaser.TilemapParser.tileset(this.game, key, tileWidth, tileHeight, tileMax, tileMargin, tileSpacing);
+ this._images[key].frameData = Phaser.AnimationParser.spriteSheet(this.game, key, frameWidth, frameHeight, frameMax, margin, spacing);
},
@@ -598,15 +581,13 @@ Phaser.Cache.prototype = {
* @method Phaser.Cache#addTilemap
* @param {string} key - The unique key by which you will reference this object.
* @param {string} url - URL of the tilemap image.
- * @param {object} mapData - The tilemap data object.
+ * @param {object} mapData - The tilemap data object (either a CSV or JSON file).
* @param {number} format - The format of the tilemap data.
*/
addTilemap: function (key, url, mapData, format) {
this._tilemaps[key] = { url: url, data: mapData, format: format };
- this._tilemaps[key].layers = Phaser.TilemapParser.parse(this.game, mapData, format);
-
},
/**
@@ -756,12 +737,13 @@ Phaser.Cache.prototype = {
decoded = true;
}
- this._sounds[key] = { url: url, data: data, isDecoding: false, decoded: decoded, webAudio: webAudio, audioTag: audioTag };
+ this._sounds[key] = { url: url, data: data, isDecoding: false, decoded: decoded, webAudio: webAudio, audioTag: audioTag, locked: this.game.sound.touchLocked };
},
/**
* Reload a sound.
+ *
* @method Phaser.Cache#reloadSound
* @param {string} key - Asset key for the sound.
*/
@@ -782,7 +764,8 @@ Phaser.Cache.prototype = {
},
/**
- * Description.
+ * Fires the onSoundUnlock event when the sound has completed reloading.
+ *
* @method Phaser.Cache#reloadSoundComplete
* @param {string} key - Asset key for the sound.
*/
@@ -797,7 +780,8 @@ Phaser.Cache.prototype = {
},
/**
- * Description.
+ * Updates the sound object in the cache.
+ *
* @method Phaser.Cache#updateSound
* @param {string} key - Asset key for the sound.
*/
@@ -829,8 +813,8 @@ Phaser.Cache.prototype = {
* Get a canvas object from the cache by its key.
*
* @method Phaser.Cache#getCanvas
- * @param {string} key - Asset key of the canvas you want.
- * @return {object} The canvas you want.
+ * @param {string} key - Asset key of the canvas to retrieve from the Cache.
+ * @return {object} The canvas object.
*/
getCanvas: function (key) {
@@ -838,8 +822,10 @@ Phaser.Cache.prototype = {
{
return this._canvases[key].canvas;
}
-
- return null;
+ else
+ {
+ console.warn('Phaser.Cache.getCanvas: Invalid key: "' + key + '"');
+ }
},
@@ -847,7 +833,7 @@ Phaser.Cache.prototype = {
* Get a BitmapData object from the cache by its key.
*
* @method Phaser.Cache#getBitmapData
- * @param {string} key - Asset key of the BitmapData object you want.
+ * @param {string} key - Asset key of the BitmapData object to retrieve from the Cache.
* @return {Phaser.BitmapData} The requested BitmapData object if found, or null if not.
*/
getBitmapData: function (key) {
@@ -856,8 +842,10 @@ Phaser.Cache.prototype = {
{
return this._bitmapDatas[key];
}
-
- return null;
+ else
+ {
+ console.warn('Phaser.Cache.getBitmapData: Invalid key: "' + key + '"');
+ }
},
@@ -865,7 +853,7 @@ Phaser.Cache.prototype = {
* Checks if an image key exists.
*
* @method Phaser.Cache#checkImageKey
- * @param {string} key - Asset key of the image you want.
+ * @param {string} key - Asset key of the image to check is in the Cache.
* @return {boolean} True if the key exists, otherwise false.
*/
checkImageKey: function (key) {
@@ -883,8 +871,8 @@ Phaser.Cache.prototype = {
* Get image data by key.
*
* @method Phaser.Cache#getImage
- * @param {string} key - Asset key of the image you want.
- * @return {object} The image data you want.
+ * @param {string} key - Asset key of the image to retrieve from the Cache.
+ * @return {object} The image data.
*/
getImage: function (key) {
@@ -892,53 +880,19 @@ Phaser.Cache.prototype = {
{
return this._images[key].data;
}
-
- return null;
-
- },
-
- /**
- * Get tile set image data by key.
- *
- * @method Phaser.Cache#getTileSetImage
- * @param {string} key - Asset key of the image you want.
- * @return {object} The image data you want.
- */
- getTilesetImage: function (key) {
-
- if (this._tilesets[key])
+ else
{
- return this._tilesets[key].data;
+ console.warn('Phaser.Cache.getImage: Invalid key: "' + key + '"');
}
- return null;
-
- },
-
- /**
- * Get tile set image data by key.
- *
- * @method Phaser.Cache#getTileset
- * @param {string} key - Asset key of the image you want.
- * @return {Phaser.Tileset} The tileset data. The tileset image is in the data property, the tile data in tileData.
- */
- getTileset: function (key) {
-
- if (this._tilesets[key])
- {
- return this._tilesets[key].tileData;
- }
-
- return null;
-
},
/**
* Get tilemap data by key.
*
* @method Phaser.Cache#getTilemap
- * @param {string} key - Asset key of the tilemap you want.
- * @return {Object} The tilemap data. The tileset image is in the data property, the map data in mapData.
+ * @param {string} key - Asset key of the tilemap data to retrieve from the Cache.
+ * @return {Object} The raw tilemap data in CSV or JSON format.
*/
getTilemapData: function (key) {
@@ -946,16 +900,19 @@ Phaser.Cache.prototype = {
{
return this._tilemaps[key];
}
+ else
+ {
+ console.warn('Phaser.Cache.getTilemapData: Invalid key: "' + key + '"');
+ }
- return null;
},
/**
* Get frame data by key.
*
* @method Phaser.Cache#getFrameData
- * @param {string} key - Asset key of the frame data you want.
- * @return {Phaser.FrameData} The frame data you want.
+ * @param {string} key - Asset key of the frame data to retrieve from the Cache.
+ * @return {Phaser.FrameData} The frame data.
*/
getFrameData: function (key) {
@@ -971,8 +928,8 @@ Phaser.Cache.prototype = {
* Get a single frame out of a frameData set by key.
*
* @method Phaser.Cache#getFrameByIndex
- * @param {string} key - Asset key of the frame data you want.
- * @return {Phaser.Frame} The frame data you want.
+ * @param {string} key - Asset key of the frame data to retrieve from the Cache.
+ * @return {Phaser.Frame} The frame object.
*/
getFrameByIndex: function (key, frame) {
@@ -988,8 +945,8 @@ Phaser.Cache.prototype = {
* Get a single frame out of a frameData set by key.
*
* @method Phaser.Cache#getFrameByName
- * @param {string} key - Asset key of the frame data you want.
- * @return {Phaser.Frame} The frame data you want.
+ * @param {string} key - Asset key of the frame data to retrieve from the Cache.
+ * @return {Phaser.Frame} The frame object.
*/
getFrameByName: function (key, frame) {
@@ -1005,8 +962,8 @@ Phaser.Cache.prototype = {
* Get a single frame by key. You'd only do this to get the default Frame created for a non-atlas/spritesheet image.
*
* @method Phaser.Cache#getFrame
- * @param {string} key - Asset key of the frame data you want.
- * @return {Phaser.Frame} The frame data you want.
+ * @param {string} key - Asset key of the frame data to retrieve from the Cache.
+ * @return {Phaser.Frame} The frame data.
*/
getFrame: function (key) {
@@ -1019,11 +976,11 @@ Phaser.Cache.prototype = {
},
/**
- * Get a single frame by key. You'd only do this to get the default Frame created for a non-atlas/spritesheet image.
+ * Get a single texture frame by key. You'd only do this to get the default Frame created for a non-atlas/spritesheet image.
*
* @method Phaser.Cache#getTextureFrame
- * @param {string} key - Asset key of the frame data you want.
- * @return {Phaser.Frame} The frame data you want.
+ * @param {string} key - Asset key of the frame to retrieve from the Cache.
+ * @return {Phaser.Frame} The frame data.
*/
getTextureFrame: function (key) {
@@ -1039,8 +996,8 @@ Phaser.Cache.prototype = {
* Get a RenderTexture by key.
*
* @method Phaser.Cache#getTexture
- * @param {string} key - Asset key of the RenderTexture you want.
- * @return {Phaser.RenderTexture} The RenderTexture you want.
+ * @param {string} key - Asset key of the RenderTexture to retrieve from the Cache.
+ * @return {Phaser.RenderTexture} The RenderTexture object.
*/
getTexture: function (key) {
@@ -1048,8 +1005,10 @@ Phaser.Cache.prototype = {
{
return this._textures[key];
}
-
- return null;
+ else
+ {
+ console.warn('Phaser.Cache.getTexture: Invalid key: "' + key + '"');
+ }
},
@@ -1057,8 +1016,8 @@ Phaser.Cache.prototype = {
* Get sound by key.
*
* @method Phaser.Cache#getSound
- * @param {string} key - Asset key of the sound you want.
- * @return {Phaser.Sound} The sound you want.
+ * @param {string} key - Asset key of the sound to retrieve from the Cache.
+ * @return {Phaser.Sound} The sound object.
*/
getSound: function (key) {
@@ -1066,8 +1025,10 @@ Phaser.Cache.prototype = {
{
return this._sounds[key];
}
-
- return null;
+ else
+ {
+ console.warn('Phaser.Cache.getSound: Invalid key: "' + key + '"');
+ }
},
@@ -1075,8 +1036,8 @@ Phaser.Cache.prototype = {
* Get sound data by key.
*
* @method Phaser.Cache#getSoundData
- * @param {string} key - Asset key of the sound you want.
- * @return {object} The sound data you want.
+ * @param {string} key - Asset key of the sound to retrieve from the Cache.
+ * @return {object} The sound data.
*/
getSoundData: function (key) {
@@ -1084,8 +1045,10 @@ Phaser.Cache.prototype = {
{
return this._sounds[key].data;
}
-
- return null;
+ else
+ {
+ console.warn('Phaser.Cache.getSoundData: Invalid key: "' + key + '"');
+ }
},
@@ -1093,7 +1056,7 @@ Phaser.Cache.prototype = {
* Check if the given sound has finished decoding.
*
* @method Phaser.Cache#isSoundDecoded
- * @param {string} key - Asset key of the sound you want.
+ * @param {string} key - Asset key of the sound in the Cache.
* @return {boolean} The decoded state of the Sound object.
*/
isSoundDecoded: function (key) {
@@ -1109,7 +1072,7 @@ Phaser.Cache.prototype = {
* Check if the given sound is ready for playback. A sound is considered ready when it has finished decoding and the device is no longer touch locked.
*
* @method Phaser.Cache#isSoundReady
- * @param {string} key - Asset key of the sound you want.
+ * @param {string} key - Asset key of the sound in the Cache.
* @return {boolean} True if the sound is decoded and the device is not touch locked.
*/
isSoundReady: function (key) {
@@ -1140,8 +1103,8 @@ Phaser.Cache.prototype = {
* Get text data by key.
*
* @method Phaser.Cache#getText
- * @param {string} key - Asset key of the text data you want.
- * @return {object} The text data you want.
+ * @param {string} key - Asset key of the text data to retrieve from the Cache.
+ * @return {object} The text data.
*/
getText: function (key) {
@@ -1149,8 +1112,30 @@ Phaser.Cache.prototype = {
{
return this._text[key].data;
}
+ else
+ {
+ console.warn('Phaser.Cache.getText: Invalid key: "' + key + '"');
+ }
+
+ },
- return null;
+ /**
+ * Get binary data by key.
+ *
+ * @method Phaser.Cache#getBinary
+ * @param {string} key - Asset key of the binary data object to retrieve from the Cache.
+ * @return {object} The binary data object.
+ */
+ getBinary: function (key) {
+
+ if (this._binary[key])
+ {
+ return this._binary[key];
+ }
+ else
+ {
+ console.warn('Phaser.Cache.getBinary: Invalid key: "' + key + '"');
+ }
},
@@ -1168,7 +1153,7 @@ Phaser.Cache.prototype = {
for (var item in array)
{
- if (item !== '__default')
+ if (item !== '__default' && item !== '__missing')
{
output.push(item);
}
@@ -1277,6 +1262,8 @@ Phaser.Cache.prototype = {
}
};
+
+Phaser.Cache.prototype.constructor = Phaser.Cache;
@@ -1292,13 +1279,13 @@ Phaser.Cache.prototype = {
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:25 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Camera.js.html b/docs/Camera.js.html
index ee194b88..c91ddc80 100644
--- a/docs/Camera.js.html
+++ b/docs/Camera.js.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -423,7 +417,7 @@
/**
* @author Richard Davey <rich@photonstorm.com>
-* @copyright 2013 Photon Storm Ltd.
+* @copyright 2014 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -462,7 +456,7 @@ Phaser.Camera = function (game, id, x, y, width, height) {
* Camera view.
* The view into the world we wish to render (by default the game dimensions).
* The x/y values are in world coordinates, not screen coordinates, the width/height is how many pixels to render.
- * Objects outside of this view are not rendered (unless set to ignore the Camera, i.e. UI?).
+ * Objects outside of this view are not rendered if set to camera cull.
* @property {Phaser.Rectangle} view
*/
this.view = new Phaser.Rectangle(x, y, width, height);
@@ -509,6 +503,9 @@ Phaser.Camera = function (game, id, x, y, width, height) {
*/
this._edge = 0;
+ /**
+ * @property {PIXI.DisplayObject} displayObject - The display object to which all game objects are added. Set by World.boot
+ */
this.displayObject = null;
};
@@ -626,6 +623,11 @@ Phaser.Camera.prototype = {
},
+ /**
+ * Internal method
+ * @method Phaser.Camera#updateTarget
+ * @private
+ */
updateTarget: function () {
if (this.deadzone)
@@ -665,9 +667,13 @@ Phaser.Camera.prototype = {
},
+ /**
+ * Update the Camera bounds to match the game world.
+ * @method Phaser.Camera#setBoundsToWorld
+ */
setBoundsToWorld: function () {
- this.bounds.setTo(this.game.world.x, this.game.world.y, this.game.world.width, this.game.world.height);
+ this.bounds.setTo(this.game.world.bounds.x, this.game.world.bounds.y, this.game.world.bounds.width, this.game.world.bounds.height);
},
@@ -687,10 +693,10 @@ Phaser.Camera.prototype = {
this.view.x = this.bounds.x;
}
- if (this.view.x > this.bounds.right - this.width)
+ if (this.view.right > this.bounds.right)
{
this.atLimit.x = true;
- this.view.x = (this.bounds.right - this.width) + 1;
+ this.view.x = this.bounds.right - this.width;
}
if (this.view.y < this.bounds.top)
@@ -699,10 +705,10 @@ Phaser.Camera.prototype = {
this.view.y = this.bounds.top;
}
- if (this.view.y > this.bounds.bottom - this.height)
+ if (this.view.bottom > this.bounds.bottom)
{
this.atLimit.y = true;
- this.view.y = (this.bounds.bottom - this.height) + 1;
+ this.view.y = this.bounds.bottom - this.height;
}
this.view.floor();
@@ -745,6 +751,8 @@ Phaser.Camera.prototype = {
};
+Phaser.Camera.prototype.constructor = Phaser.Camera;
+
/**
* The Cameras x coordinate. This value is automatically clamped if it falls outside of the World bounds.
* @name Phaser.Camera#x
@@ -839,13 +847,13 @@ Object.defineProperty(Phaser.Camera.prototype, "height", {
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:25 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Canvas.js.html b/docs/Canvas.js.html
index a10e0bbe..a5a6e341 100644
--- a/docs/Canvas.js.html
+++ b/docs/Canvas.js.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -423,12 +417,12 @@
/**
* @author Richard Davey <rich@photonstorm.com>
-* @copyright 2013 Photon Storm Ltd.
+* @copyright 2014 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
/**
-* The Canvas class handles everything related to the <canvas> tag as a DOM Element, like styles, offset, aspect ratio
+* The Canvas class handles everything related to creating the `canvas` DOM tag that Phaser will use, including styles, offset and aspect ratio.
*
* @class Phaser.Canvas
* @static
@@ -436,21 +430,29 @@
Phaser.Canvas = {
/**
- * Creates the <canvas> tag
+ * Creates a `canvas` DOM element. The element is not automatically added to the document.
*
* @method Phaser.Canvas.create
- * @param {number} width - The desired width.
- * @param {number} height - The desired height.
- * @return {HTMLCanvasElement} The newly created <canvas> tag.
+ * @param {number} [width=256] - The width of the canvas element.
+ * @param {number} [height=256] - The height of the canvas element..
+ * @param {string} [id=''] - If given this will be set as the ID of the canvas element, otherwise no ID will be set.
+ * @return {HTMLCanvasElement} The newly created canvas element.
*/
- create: function (width, height) {
+ create: function (width, height, id) {
width = width || 256;
height = height || 256;
var canvas = document.createElement('canvas');
+
+ if (typeof id === 'string')
+ {
+ canvas.id = id;
+ }
+
canvas.width = width;
canvas.height = height;
+
canvas.style.display = 'block';
return canvas;
@@ -471,8 +473,22 @@ Phaser.Canvas = {
var box = element.getBoundingClientRect();
var clientTop = element.clientTop || document.body.clientTop || 0;
var clientLeft = element.clientLeft || document.body.clientLeft || 0;
- var scrollTop = window.pageYOffset || element.scrollTop || document.body.scrollTop;
- var scrollLeft = window.pageXOffset || element.scrollLeft || document.body.scrollLeft;
+
+ // Without this check Chrome is now throwing console warnings about strict vs. quirks :(
+
+ var scrollTop = 0;
+ var scrollLeft = 0;
+
+ if (document.compatMode === 'CSS1Compat')
+ {
+ scrollTop = window.pageYOffset || document.documentElement.scrollTop || element.scrollTop || 0;
+ scrollLeft = window.pageXOffset || document.documentElement.scrollLeft || element.scrollLeft || 0;
+ }
+ else
+ {
+ scrollTop = window.pageYOffset || document.body.scrollTop || element.scrollTop || 0;
+ scrollLeft = window.pageXOffset || document.body.scrollLeft || element.scrollLeft || 0;
+ }
point.x = box.left + scrollLeft - clientLeft;
point.y = box.top + scrollTop - clientTop;
@@ -560,8 +576,8 @@ Phaser.Canvas = {
*
* @method Phaser.Canvas.addToDOM
* @param {HTMLCanvasElement} canvas - The canvas to set the touch action on.
- * @param {string|HTMLElement} parent - The DOM element to add the canvas to. Defaults to ''.
- * @param {boolean} overflowHidden - If set to true it will add the overflow='hidden' style to the parent DOM element.
+ * @param {string|HTMLElement} parent - The DOM element to add the canvas to.
+ * @param {boolean} [overflowHidden=true] - If set to true it will add the overflow='hidden' style to the parent DOM element.
* @return {HTMLCanvasElement} Returns the source canvas.
*/
addToDOM: function (canvas, parent, overflowHidden) {
@@ -572,29 +588,29 @@ Phaser.Canvas = {
if (parent)
{
- // hopefully an element ID
if (typeof parent === 'string')
{
+ // hopefully an element ID
target = document.getElementById(parent);
}
- // quick test for a HTMLelement
else if (typeof parent === 'object' && parent.nodeType === 1)
{
+ // quick test for a HTMLelement
target = parent;
}
-
- if (overflowHidden)
- {
- target.style.overflow = 'hidden';
- }
}
- // fallback, covers an invalid ID and a none HTMLelement object
- if(!target)
+ // Fallback, covers an invalid ID and a non HTMLelement object
+ if (!target)
{
target = document.body;
}
+ if (overflowHidden && target.style)
+ {
+ target.style.overflow = 'hidden';
+ }
+
target.appendChild(canvas);
return canvas;
@@ -656,9 +672,11 @@ Phaser.Canvas = {
*/
setImageRenderingCrisp: function (canvas) {
+ canvas.style['image-rendering'] = 'optimizeSpeed';
canvas.style['image-rendering'] = 'crisp-edges';
canvas.style['image-rendering'] = '-moz-crisp-edges';
canvas.style['image-rendering'] = '-webkit-optimize-contrast';
+ canvas.style['image-rendering'] = 'optimize-contrast';
canvas.style.msInterpolationMode = 'nearest-neighbor';
return canvas;
@@ -698,13 +716,13 @@ Phaser.Canvas = {
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:25 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Circle.js.html b/docs/Circle.js.html
index 41f1a8a5..b66a23cb 100644
--- a/docs/Circle.js.html
+++ b/docs/Circle.js.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -423,7 +417,7 @@
/**
* @author Richard Davey <rich@photonstorm.com>
-* @copyright 2013 Photon Storm Ltd.
+* @copyright 2014 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -432,9 +426,9 @@
* @class Circle
* @classdesc Phaser - Circle
* @constructor
-* @param {number} [x] The x coordinate of the center of the circle.
-* @param {number} [y] The y coordinate of the center of the circle.
-* @param {number} [diameter] The diameter of the circle.
+* @param {number} [x=0] - The x coordinate of the center of the circle.
+* @param {number} [y=0] - The y coordinate of the center of the circle.
+* @param {number} [diameter=0] - The diameter of the circle.
* @return {Phaser.Circle} This circle object
*/
Phaser.Circle = function (x, y, diameter) {
@@ -618,6 +612,8 @@ Phaser.Circle.prototype = {
};
+Phaser.Circle.prototype.constructor = Phaser.Circle;
+
/**
* The largest distance between any two points on the circle. The same as the radius * 2.
* @name Phaser.Circle#diameter
@@ -911,13 +907,13 @@ Phaser.Circle.intersectsRectangle = function (c, r) {
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:25 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Color.js.html b/docs/Color.js.html
index 904f01d0..ed3362bd 100644
--- a/docs/Color.js.html
+++ b/docs/Color.js.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -423,7 +417,7 @@
/**
* @author Richard Davey <rich@photonstorm.com>
-* @copyright 2013 Photon Storm Ltd.
+* @copyright 2014 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -787,13 +781,13 @@ Phaser.Color = {
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:25 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/DOMSprite.js.html b/docs/DOMSprite.js.html
new file mode 100644
index 00000000..9bd6f200
--- /dev/null
+++ b/docs/DOMSprite.js.html
@@ -0,0 +1,567 @@
+
+
+
+
+
+ Phaser Source: gameobjects/DOMSprite.js
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Source: gameobjects/DOMSprite.js
+
+
+
+ /**
+* @author Richard Davey <rich@photonstorm.com>
+* @copyright 2014 Photon Storm Ltd.
+* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+*/
+
+/**
+* Create a new DOMSprite.
+* @class Phaser.DOMSprite
+* @constructor
+* @param {Phaser.Game} game - Current game instance.
+* @param {string} id - DOM ID.
+* @param {number} x - X position of the new text object.
+* @param {number} y - Y position of the new text object.
+* @param {string} text - The actual text that will be written.
+* @param {object} style - The style object containing style attributes like font, font size ,
+*/
+Phaser.DOMSprite = function (game, element, x, y, style) {
+
+ x = x || 0;
+ y = y || 0;
+ style = style || '';
+
+ /**
+ * @property {Phaser.Game} game - A reference to the currently running Game.
+ */
+ this.game = game;
+
+ /**
+ * @property {boolean} exists - If exists = false then the Text isn't updated by the core game loop.
+ * @default
+ */
+ this.exists = true;
+
+ /**
+ * @property {boolean} alive - This is a handy little var your game can use to determine if an object is alive or not, it doesn't effect rendering.
+ * @default
+ */
+ this.alive = true;
+
+ /**
+ * @property {Phaser.Group} group - The parent Group of this Text object.
+ */
+ this.group = null;
+
+ /**
+ * @property {string} name - The user defined name given to this object.
+ * @default
+ */
+ this.name = '';
+
+ /**
+ * @property {number} type - The const type of this object.
+ * @default
+ */
+ this.type = Phaser.DOMSPRITE;
+
+ /**
+ * @property {boolean} visible - Sets the visible state of this DOMSprite.
+ * @default
+ */
+ this.visible = true;
+
+ /*
+ if (parent)
+ {
+ if (typeof parent === 'string')
+ {
+ // hopefully an element ID
+ target = document.getElementById(parent);
+ }
+ else if (typeof parent === 'object' && parent.nodeType === 1)
+ {
+ // quick test for a HTMLelement
+ target = parent;
+ }
+
+ if (overflowHidden)
+ {
+ target.style.overflow = 'hidden';
+ }
+ }
+ */
+
+};
+
+// Phaser.DOMSprite.prototype = Object.create(PIXI.DOMSprite.prototype);
+// Phaser.DOMSprite.prototype.constructor = Phaser.DOMSprite;
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
+
+
+
+
+ Documentation generated by JSDoc 3.3.0-dev
+ on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template .
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/docs/Debug.js.html b/docs/Debug.js.html
index 05fb0929..3db78003 100644
--- a/docs/Debug.js.html
+++ b/docs/Debug.js.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -423,7 +417,7 @@
/**
* @author Richard Davey <rich@photonstorm.com>
-* @copyright 2013 Photon Storm Ltd.
+* @copyright 2014 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -453,6 +447,11 @@ Phaser.Utils.Debug = function (game) {
*/
this.font = '14px Courier';
+ /**
+ * @property {number} columnWidth - The spacing between columns.
+ */
+ this.columnWidth = 100;
+
/**
* @property {number} lineHeight - The line height between the debug text.
*/
@@ -488,11 +487,12 @@ Phaser.Utils.Debug.prototype = {
/**
* Internal method that resets and starts the debug output values.
* @method Phaser.Utils.Debug#start
- * @param {number} x - The X value the debug info will start from.
- * @param {number} y - The Y value the debug info will start from.
- * @param {string} color - The color the debug info will drawn in.
+ * @param {number} [x=0] - The X value the debug info will start from.
+ * @param {number} [y=0] - The Y value the debug info will start from.
+ * @param {string} [color='rgb(255,255,255)'] - The color the debug text will drawn in.
+ * @param {number} [columnWidth=0] - The spacing between columns.
*/
- start: function (x, y, color) {
+ start: function (x, y, color, columnWidth) {
if (this.context == null)
{
@@ -501,16 +501,18 @@ Phaser.Utils.Debug.prototype = {
if (typeof x !== 'number') { x = 0; }
if (typeof y !== 'number') { y = 0; }
-
color = color || 'rgb(255,255,255)';
+ if (typeof columnWidth === 'undefined') { columnWidth = 0; }
this.currentX = x;
this.currentY = y;
this.currentColor = color;
this.currentAlpha = this.context.globalAlpha;
+ this.columnWidth = columnWidth;
this.context.save();
this.context.setTransform(1, 0, 0, 1, 0, 0);
+ this.context.strokeStyle = color;
this.context.fillStyle = color;
this.context.font = this.font;
this.context.globalAlpha = 1;
@@ -523,7 +525,6 @@ Phaser.Utils.Debug.prototype = {
*/
stop: function () {
-
this.context.restore();
this.context.globalAlpha = this.currentAlpha;
@@ -533,8 +534,8 @@ Phaser.Utils.Debug.prototype = {
* Internal method that outputs a single line of text.
* @method Phaser.Utils.Debug#line
* @param {string} text - The line of text to draw.
- * @param {number} x - The X value the debug info will start from.
- * @param {number} y - The Y value the debug info will start from.
+ * @param {number} [x] - The X value the debug info will start from.
+ * @param {number} [y] - The Y value the debug info will start from.
*/
line: function (text, x, y) {
@@ -543,16 +544,8 @@ Phaser.Utils.Debug.prototype = {
return;
}
- x = x || null;
- y = y || null;
-
- if (x !== null) {
- this.currentX = x;
- }
-
- if (y !== null) {
- this.currentY = y;
- }
+ if (typeof x !== 'undefined') { this.currentX = x; }
+ if (typeof y !== 'undefined') { this.currentY = y; }
if (this.renderShadow)
{
@@ -566,6 +559,38 @@ Phaser.Utils.Debug.prototype = {
},
+ /**
+ * Internal method that outputs a single line of text split over as many columns as needed, one per parameter.
+ * @method Phaser.Utils.Debug#splitline
+ * @param {string} text - The text to render. You can have as many columns of text as you want, just pass them as additional parameters.
+ */
+ splitline: function (text) {
+
+ if (this.context == null)
+ {
+ return;
+ }
+
+ var x = this.currentX;
+
+ for (var i = 0; i < arguments.length; i++)
+ {
+ if (this.renderShadow)
+ {
+ this.context.fillStyle = 'rgb(0,0,0)';
+ this.context.fillText(arguments[i], x + 1, this.currentY + 1);
+ this.context.fillStyle = this.currentColor;
+ }
+
+ this.context.fillText(arguments[i], x, this.currentY);
+
+ x += this.columnWidth;
+ }
+
+ this.currentY += this.lineHeight;
+
+ },
+
/**
* Visually renders a QuadTree to the display.
* @method Phaser.Utils.Debug#renderQuadTree
@@ -811,25 +836,27 @@ Phaser.Utils.Debug.prototype = {
},
/**
- * Render Sprite collision.
- * @method Phaser.Utils.Debug#renderSpriteCollision
+ * Render Sprite Body Physics Data as text.
+ * @method Phaser.Utils.Debug#renderBodyInfo
* @param {Phaser.Sprite} sprite - The sprite to be rendered.
* @param {number} x - X position of the debug info to be rendered.
* @param {number} y - Y position of the debug info to be rendered.
* @param {string} [color='rgb(255,255,255)'] - color of the debug info to be rendered. (format is css color string).
*/
- renderSpriteCollision: function (sprite, x, y, color) {
+ renderBodyInfo: function (sprite, x, y, color) {
color = color || 'rgb(255,255,255)';
- this.start(x, y, color);
- this.line('Sprite Collision: (' + sprite.width + ' x ' + sprite.height + ')');
- this.line('left: ' + sprite.body.touching.left);
- this.line('right: ' + sprite.body.touching.right);
- this.line('up: ' + sprite.body.touching.up);
- this.line('down: ' + sprite.body.touching.down);
- this.line('velocity.x: ' + sprite.body.velocity.x);
- this.line('velocity.y: ' + sprite.body.velocity.y);
+ this.start(x, y, color, 210);
+
+ this.splitline('x: ' + sprite.body.x.toFixed(2), 'y: ' + sprite.body.y.toFixed(2), 'width: ' + sprite.width, 'height: ' + sprite.height);
+ this.splitline('speed: ' + sprite.body.speed.toFixed(2), 'angle: ' + sprite.body.angle.toFixed(2), 'linear damping: ' + sprite.body.linearDamping);
+ this.splitline('blocked left: ' + sprite.body.blocked.left, 'right: ' + sprite.body.blocked.right, 'up: ' + sprite.body.blocked.up, 'down: ' + sprite.body.blocked.down);
+ this.splitline('touching left: ' + sprite.body.touching.left, 'right: ' + sprite.body.touching.right, 'up: ' + sprite.body.touching.up, 'down: ' + sprite.body.touching.down);
+ this.splitline('gravity x: ' + sprite.body.gravity.x, 'y: ' + sprite.body.gravity.y, 'world gravity x: ' + this.game.physics.gravity.x, 'y: ' + this.game.physics.gravity.y);
+ this.splitline('acceleration x: ' + sprite.body.acceleration.x.toFixed(2), 'y: ' + sprite.body.acceleration.y.toFixed(2));
+ this.splitline('velocity x: ' + sprite.body.velocity.x.toFixed(2), 'y: ' + sprite.body.velocity.y.toFixed(2), 'deltaX: ' + sprite.body.deltaX().toFixed(2), 'deltaY: ' + sprite.body.deltaY().toFixed(2));
+ this.splitline('bounce x: ' + sprite.body.bounce.x.toFixed(2), 'y: ' + sprite.body.bounce.y.toFixed(2));
this.stop();
},
@@ -892,17 +919,15 @@ Phaser.Utils.Debug.prototype = {
// 4 = scaleY
// 5 = translateY
- // this.line('id: ' + sprite._id);
- // this.line('scale x: ' + sprite.worldTransform[0]);
- // this.line('scale y: ' + sprite.worldTransform[4]);
- // this.line('tx: ' + sprite.worldTransform[2]);
- // this.line('ty: ' + sprite.worldTransform[5]);
- // this.line('skew x: ' + sprite.worldTransform[3]);
- // this.line('skew y: ' + sprite.worldTransform[1]);
- this.line('deltaX: ' + sprite.body.deltaX());
- this.line('deltaY: ' + sprite.body.deltaY());
- // this.line('sdx: ' + sprite.deltaX());
- // this.line('sdy: ' + sprite.deltaY());
+ this.line('id: ' + sprite._id);
+ this.line('scale x: ' + sprite.worldTransform[0]);
+ this.line('scale y: ' + sprite.worldTransform[4]);
+ this.line('tx: ' + sprite.worldTransform[2]);
+ this.line('ty: ' + sprite.worldTransform[5]);
+ this.line('skew x: ' + sprite.worldTransform[3]);
+ this.line('skew y: ' + sprite.worldTransform[1]);
+ this.line('sdx: ' + sprite.deltaX);
+ this.line('sdy: ' + sprite.deltaY);
// this.line('inCamera: ' + this.game.renderer.spriteRenderer.inCamera(this.game.camera, sprite));
this.stop();
@@ -910,65 +935,13 @@ Phaser.Utils.Debug.prototype = {
},
/**
- * Render the World Transform information of the given Sprite.
- * @method Phaser.Utils.Debug#renderWorldTransformInfo
- * @param {Phaser.Sprite} sprite - Description.
+ * Renders the sprite coordinates in local, positional and world space.
+ * @method Phaser.Utils.Debug#renderSpriteCoords
+ * @param {Phaser.Sprite} line - The sprite to inspect.
* @param {number} x - X position of the debug info to be rendered.
* @param {number} y - Y position of the debug info to be rendered.
* @param {string} [color='rgb(255,255,255)'] - color of the debug info to be rendered. (format is css color string).
*/
- renderWorldTransformInfo: function (sprite, x, y, color) {
-
- if (this.context == null)
- {
- return;
- }
-
- color = color || 'rgb(255, 255, 255)';
-
- this.start(x, y, color);
-
- this.line('World Transform');
- this.line('skewX: ' + sprite.worldTransform[3]);
- this.line('skewY: ' + sprite.worldTransform[1]);
- this.line('scaleX: ' + sprite.worldTransform[0]);
- this.line('scaleY: ' + sprite.worldTransform[4]);
- this.line('transX: ' + sprite.worldTransform[2]);
- this.line('transY: ' + sprite.worldTransform[5]);
- this.stop();
-
- },
-
- /**
- * Render the Local Transform information of the given Sprite.
- * @method Phaser.Utils.Debug#renderLocalTransformInfo
- * @param {Phaser.Sprite} sprite - Description.
- * @param {number} x - X position of the debug info to be rendered.
- * @param {number} y - Y position of the debug info to be rendered.
- * @param {string} [color='rgb(255,255,255)'] - color of the debug info to be rendered. (format is css color string).
- */
- renderLocalTransformInfo: function (sprite, x, y, color) {
-
- if (this.context == null)
- {
- return;
- }
-
- color = color || 'rgb(255, 255, 255)';
-
- this.start(x, y, color);
-
- this.line('Local Transform');
- this.line('skewX: ' + sprite.localTransform[3]);
- this.line('skewY: ' + sprite.localTransform[1]);
- this.line('scaleX: ' + sprite.localTransform[0]);
- this.line('scaleY: ' + sprite.localTransform[4]);
- this.line('transX: ' + sprite.localTransform[2]);
- this.line('transY: ' + sprite.localTransform[5]);
- this.stop();
-
- },
-
renderSpriteCoords: function (sprite, x, y, color) {
if (this.context == null)
@@ -978,29 +951,28 @@ Phaser.Utils.Debug.prototype = {
color = color || 'rgb(255, 255, 255)';
- this.start(x, y, color);
+ this.start(x, y, color, 100);
if (sprite.name)
{
this.line(sprite.name);
}
- this.line('x: ' + sprite.x);
- this.line('y: ' + sprite.y);
- this.line('pos x: ' + sprite.position.x);
- this.line('pos y: ' + sprite.position.y);
- this.line('local x: ' + sprite.localTransform[2]);
- this.line('local y: ' + sprite.localTransform[5]);
- this.line('t x: ' + sprite.worldTransform[2]);
- this.line('t y: ' + sprite.worldTransform[5]);
- this.line('world x: ' + sprite.world.x);
- this.line('world y: ' + sprite.world.y);
+ this.splitline('x:', sprite.x.toFixed(2), 'y:', sprite.y.toFixed(2));
+ this.splitline('pos x:', sprite.position.x.toFixed(2), 'pos y:', sprite.position.y.toFixed(2));
+ this.splitline('world x:', sprite.world.x.toFixed(2), 'world y:', sprite.world.y.toFixed(2));
this.stop();
},
- renderGroupInfo: function (group, x, y, color) {
+ /**
+ * Renders a Line object in the given color.
+ * @method Phaser.Utils.Debug#renderLine
+ * @param {Phaser.Line} line - The Line to render.
+ * @param {string} [color='rgb(255,255,255)'] - color of the debug info to be rendered. (format is css color string).
+ */
+ renderLine: function (line, color) {
if (this.context == null)
{
@@ -1009,12 +981,38 @@ Phaser.Utils.Debug.prototype = {
color = color || 'rgb(255, 255, 255)';
- this.start(x, y, color);
+ this.start(0, 0, color);
+ this.context.lineWidth = 1;
+ this.context.beginPath();
+ this.context.moveTo(line.start.x + 0.5, line.start.y + 0.5);
+ this.context.lineTo(line.end.x + 0.5, line.end.y + 0.5);
+ this.context.closePath();
+ this.context.stroke();
+ this.stop();
- this.line('Group (size: ' + group.length + ')');
- this.line('x: ' + group.x);
- this.line('y: ' + group.y);
+ },
+ /**
+ * Renders Line information in the given color.
+ * @method Phaser.Utils.Debug#renderLineInfo
+ * @param {Phaser.Line} line - The Line to render.
+ * @param {number} x - X position of the debug info to be rendered.
+ * @param {number} y - Y position of the debug info to be rendered.
+ * @param {string} [color='rgb(255,255,255)'] - color of the debug info to be rendered. (format is css color string).
+ */
+ renderLineInfo: function (line, x, y, color) {
+
+ if (this.context == null)
+ {
+ return;
+ }
+
+ color = color || 'rgb(255, 255, 255)';
+
+ this.start(x, y, color, 80);
+ this.splitline('start.x:', line.start.x.toFixed(2), 'start.y:', line.start.y.toFixed(2));
+ this.splitline('end.x:', line.end.x.toFixed(2), 'end.y:', line.end.y.toFixed(2));
+ this.splitline('length:', line.length.toFixed(2), 'angle:', line.angle);
this.stop();
},
@@ -1043,24 +1041,36 @@ Phaser.Utils.Debug.prototype = {
},
/**
- * Renders just the Sprite.body bounds.
- * @method Phaser.Utils.Debug#renderSpriteBody
+ * Renders just the full Sprite bounds.
+ * @method Phaser.Utils.Debug#renderSpriteBounds
* @param {Phaser.Sprite} sprite - Description.
* @param {string} [color] - Color of the debug info to be rendered (format is css color string).
+ * @param {boolean} [fill=false] - If false the bounds outline is rendered, if true the whole rectangle is rendered.
*/
- renderSpriteBody: function (sprite, color) {
+ renderSpriteBody: function (sprite, color, fill) {
if (this.context == null)
{
return;
}
- color = color || 'rgba(255,0,255, 0.3)';
+ color = color || 'rgb(255,0,255)';
+
+ if (typeof fill === 'undefined') { fill = false; }
this.start(0, 0, color);
- this.context.fillStyle = color;
- this.context.fillRect(sprite.body.screenX, sprite.body.screenY, sprite.body.width, sprite.body.height);
+ if (fill)
+ {
+ this.context.fillStyle = color;
+ this.context.fillRect(sprite.body.left, sprite.body.top, sprite.body.width, sprite.body.height);
+ }
+ else
+ {
+ this.context.strokeStyle = color;
+ this.context.strokeRect(sprite.body.left, sprite.body.top, sprite.body.width, sprite.body.height);
+ this.context.stroke();
+ }
this.stop();
@@ -1222,86 +1232,110 @@ Phaser.Utils.Debug.prototype = {
},
/**
- * Dumps the Linked List to the console.
- *
- * @method Phaser.Utils.Debug#Phaser.LinkedList#dump
- * @param {Phaser.LinkedList} list - The LinkedList to dump.
+ * @method Phaser.Utils.Debug#renderPhysicsBody
+ * @param {array} body
+ * @param {string} [color='rgb(255,255,255)'] - The color the polygon is stroked in.
*/
- dumpLinkedList: function (list) {
+ renderPhysicsBody: function (body, color, context) {
- var spacing = 20;
-
- var output = "\n" + Phaser.Utils.pad('Node', spacing) + "|" + Phaser.Utils.pad('Next', spacing) + "|" + Phaser.Utils.pad('Previous', spacing) + "|" + Phaser.Utils.pad('First', spacing) + "|" + Phaser.Utils.pad('Last', spacing);
- console.log(output);
-
- var output = Phaser.Utils.pad('----------', spacing) + "|" + Phaser.Utils.pad('----------', spacing) + "|" + Phaser.Utils.pad('----------', spacing) + "|" + Phaser.Utils.pad('----------', spacing) + "|" + Phaser.Utils.pad('----------', spacing);
- console.log(output);
-
- var entity = list;
-
- var testObject = entity.last.next;
- entity = entity.first;
-
- do
+ if (this.context === null && context === null)
{
- var name = entity.sprite.name || '*';
- var nameNext = '-';
- var namePrev = '-';
- var nameFirst = '-';
- var nameLast = '-';
-
- if (entity.next)
- {
- nameNext = entity.next.sprite.name;
- }
-
- if (entity.prev)
- {
- namePrev = entity.prev.sprite.name;
- }
-
- if (entity.first)
- {
- nameFirst = entity.first.sprite.name;
- }
-
- if (entity.last)
- {
- nameLast = entity.last.sprite.name;
- }
-
- if (typeof nameNext === 'undefined')
- {
- nameNext = '-';
- }
-
- if (typeof namePrev === 'undefined')
- {
- namePrev = '-';
- }
-
- if (typeof nameFirst === 'undefined')
- {
- nameFirst = '-';
- }
-
- if (typeof nameLast === 'undefined')
- {
- nameLast = '-';
- }
-
- var output = Phaser.Utils.pad(name, spacing) + "|" + Phaser.Utils.pad(nameNext, spacing) + "|" + Phaser.Utils.pad(namePrev, spacing) + "|" + Phaser.Utils.pad(nameFirst, spacing) + "|" + Phaser.Utils.pad(nameLast, spacing);
- console.log(output);
-
- entity = entity.next;
-
+ return;
}
- while(entity != testObject)
+
+ color = color || 'rgb(255,255,255)';
+
+ var x = body.x - this.game.camera.x;
+ var y = body.y - this.game.camera.y;
+
+ if (body.type === Phaser.Physics.Arcade.CIRCLE)
+ {
+ this.start(0, 0, color);
+ this.context.beginPath();
+ this.context.strokeStyle = color;
+ this.context.arc(x, y, body.shape.r, 0, Math.PI * 2, false);
+ this.context.stroke();
+ this.context.closePath();
+
+ // this.context.strokeStyle = 'rgb(0,0,255)';
+ // this.context.strokeRect(body.left, body.top, body.width, body.height);
+
+ this.stop();
+ }
+ else
+ {
+ var points = body.polygon.points;
+
+ this.start(0, 0, color);
+
+ this.context.beginPath();
+ this.context.moveTo(x + points[0].x, y + points[0].y);
+
+ for (var i = 1; i < points.length; i++)
+ {
+ this.context.lineTo(x + points[i].x, y + points[i].y);
+ }
+
+ this.context.closePath();
+ this.context.strokeStyle = color;
+ this.context.stroke();
+
+ this.context.fillStyle = 'rgb(255,0,0)';
+ this.context.fillRect(x + points[0].x - 2, y + points[0].y - 2, 5, 5);
+
+ for (var i = 1; i < points.length; i++)
+ {
+ this.context.fillStyle = 'rgb(255,' + (i * 40) + ',0)';
+ this.context.fillRect(x + points[i].x - 2, y + points[i].y - 2, 5, 5);
+ }
+
+ // this.context.strokeStyle = 'rgb(0,255,255)';
+ // this.context.strokeRect(body.left, body.top, body.width, body.height);
+
+ this.stop();
+ }
+
+ },
+
+ /**
+ * @method Phaser.Utils.Debug#renderPolygon
+ * @param {array} polygon
+ * @param {string} [color='rgb(255,255,255)'] - The color the polygon is stroked in.
+ */
+ renderPolygon: function (polygon, color, context) {
+
+ if (this.context === null && context === null)
+ {
+ return;
+ }
+
+ color = color || 'rgb(255,255,255)';
+
+ var points = polygon.points;
+ var x = polygon.pos.x;
+ var y = polygon.pos.y;
+
+ this.start(0, 0, color);
+
+ this.context.beginPath();
+ this.context.moveTo(x + points[0].x, y + points[0].y);
+
+ for (var i = 1; i < points.length; i++)
+ {
+ this.context.lineTo(x + points[i].x, y + points[i].y);
+ }
+
+ this.context.closePath();
+ this.context.strokeStyle = color;
+ this.context.stroke();
+
+ this.stop();
}
-
};
+
+Phaser.Utils.Debug.prototype.constructor = Phaser.Utils.Debug;
@@ -1317,13 +1351,13 @@ Phaser.Utils.Debug.prototype = {
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:25 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Device.js.html b/docs/Device.js.html
index d2be1bb7..b5182378 100644
--- a/docs/Device.js.html
+++ b/docs/Device.js.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -423,7 +417,7 @@
/**
* @author Richard Davey <rich@photonstorm.com>
-* @copyright 2013 Photon Storm Ltd.
+* @copyright 2014 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -463,6 +457,12 @@ Phaser.Device = function () {
*/
this.cocoonJS = false;
+ /**
+ * @property {boolean} ejecta - Is the game running under Ejecta?
+ * @default
+ */
+ this.ejecta = false;
+
/**
* @property {boolean} android - Is running on android?
* @default
@@ -561,6 +561,18 @@ Phaser.Device = function () {
*/
this.typedArray = false;
+ /**
+ * @property {boolean} vibration - Does the device support the Vibration API?
+ * @default
+ */
+ this.vibration = false;
+
+ /**
+ * @property {boolean} quirksMode - Is the browser running in strict mode (false) or quirks mode? (true)
+ * @default
+ */
+ this.quirksMode = false;
+
// Browser
/**
@@ -599,6 +611,18 @@ Phaser.Device = function () {
*/
this.ieVersion = 0;
+ /**
+ * @property {boolean} trident - Set to true if running a Trident version of Internet Explorer (IE11+)
+ * @default
+ */
+ this.trident = false;
+
+ /**
+ * @property {number} tridentVersion - If running in Internet Explorer 11 this will contain the major version number. See http://msdn.microsoft.com/en-us/library/ie/ms537503(v=vs.85).aspx
+ * @default
+ */
+ this.tridentVersion = 0;
+
/**
* @property {boolean} mobileSafari - Set to true if running in Mobile Safari.
* @default
@@ -629,6 +653,12 @@ Phaser.Device = function () {
*/
this.webApp = false;
+ /**
+ * @property {boolean} silk - Set to true if running in the Silk browser (as used on the Amazon Kindle)
+ * @default
+ */
+ this.silk = false;
+
// Audio
/**
@@ -733,21 +763,33 @@ Phaser.Device.prototype = {
var ua = navigator.userAgent;
- if (/Android/.test(ua)) {
+ if (/Android/.test(ua))
+ {
this.android = true;
- } else if (/CrOS/.test(ua)) {
+ }
+ else if (/CrOS/.test(ua))
+ {
this.chromeOS = true;
- } else if (/iP[ao]d|iPhone/i.test(ua)) {
+ }
+ else if (/iP[ao]d|iPhone/i.test(ua))
+ {
this.iOS = true;
- } else if (/Linux/.test(ua)) {
+ }
+ else if (/Linux/.test(ua))
+ {
this.linux = true;
- } else if (/Mac OS/.test(ua)) {
+ }
+ else if (/Mac OS/.test(ua))
+ {
this.macOS = true;
- } else if (/Windows/.test(ua)) {
+ }
+ else if (/Windows/.test(ua))
+ {
this.windows = true;
}
- if (this.windows || this.macOS || this.linux) {
+ if (this.windows || this.macOS || (this.linux && this.silk === false))
+ {
this.desktop = true;
}
@@ -783,16 +825,20 @@ Phaser.Device.prototype = {
this.worker = !!window['Worker'];
- if ('ontouchstart' in document.documentElement || (window.navigator.maxTouchPoints && window.navigator.maxTouchPoints > 1)) {
+ if ('ontouchstart' in document.documentElement || (window.navigator.maxTouchPoints && window.navigator.maxTouchPoints > 1))
+ {
this.touch = true;
}
- if (window.navigator.msPointerEnabled || window.navigator.pointerEnabled) {
+ if (window.navigator.msPointerEnabled || window.navigator.pointerEnabled)
+ {
this.mspointer = true;
}
this.pointerLock = 'pointerLockElement' in document || 'mozPointerLockElement' in document || 'webkitPointerLockElement' in document;
+ this.quirksMode = (document.compatMode === 'CSS1Compat') ? false : true;
+
},
/**
@@ -804,36 +850,70 @@ Phaser.Device.prototype = {
var ua = navigator.userAgent;
- if (/Arora/.test(ua)) {
+ if (/Arora/.test(ua))
+ {
this.arora = true;
- } else if (/Chrome/.test(ua)) {
+ }
+ else if (/Chrome/.test(ua))
+ {
this.chrome = true;
- } else if (/Epiphany/.test(ua)) {
+ }
+ else if (/Epiphany/.test(ua))
+ {
this.epiphany = true;
- } else if (/Firefox/.test(ua)) {
+ }
+ else if (/Firefox/.test(ua))
+ {
this.firefox = true;
- } else if (/Mobile Safari/.test(ua)) {
+ }
+ else if (/Mobile Safari/.test(ua))
+ {
this.mobileSafari = true;
- } else if (/MSIE (\d+\.\d+);/.test(ua)) {
+ }
+ else if (/MSIE (\d+\.\d+);/.test(ua))
+ {
this.ie = true;
this.ieVersion = parseInt(RegExp.$1, 10);
- } else if (/Midori/.test(ua)) {
+ }
+ else if (/Midori/.test(ua))
+ {
this.midori = true;
- } else if (/Opera/.test(ua)) {
+ }
+ else if (/Opera/.test(ua))
+ {
this.opera = true;
- } else if (/Safari/.test(ua)) {
+ }
+ else if (/Safari/.test(ua))
+ {
this.safari = true;
}
+ else if (/Silk/.test(ua))
+ {
+ this.silk = true;
+ }
+ else if (/Trident\/(\d+\.\d+);/.test(ua))
+ {
+ this.ie = true;
+ this.trident = true;
+ this.tridentVersion = parseInt(RegExp.$1, 10);
+ }
// WebApp mode in iOS
- if (navigator['standalone']) {
+ if (navigator['standalone'])
+ {
this.webApp = true;
}
- if (navigator['isCocoonJS']) {
+ if (navigator['isCocoonJS'])
+ {
this.cocoonJS = true;
}
+ if (typeof window.ejecta !== "undefined")
+ {
+ this.ejecta = true;
+ }
+
},
/**
@@ -906,6 +986,13 @@ Phaser.Device.prototype = {
this.typedArray = false;
}
+ navigator.vibrate = navigator.vibrate || navigator.webkitVibrate || navigator.mozVibrate || navigator.msVibrate;
+
+ if (navigator.vibrate)
+ {
+ this.vibration = true;
+ }
+
},
/**
@@ -928,8 +1015,10 @@ Phaser.Device.prototype = {
// Add it to the body to get the computed style.
document.body.insertBefore(el, null);
- for (var t in transforms) {
- if (el.style[t] !== undefined) {
+ for (var t in transforms)
+ {
+ if (el.style[t] !== undefined)
+ {
el.style[t] = "translate3d(1px,1px,1px)";
has3d = window.getComputedStyle(el).getPropertyValue(transforms[t]);
}
@@ -1003,6 +1092,8 @@ Phaser.Device.prototype = {
}
};
+
+Phaser.Device.prototype.constructor = Phaser.Device;
@@ -1018,13 +1109,13 @@ Phaser.Device.prototype = {
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:25 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Easing.js.html b/docs/Easing.js.html
index f7b7fe22..4c9ee5bf 100644
--- a/docs/Easing.js.html
+++ b/docs/Easing.js.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -425,7 +419,7 @@
/**
* @author Richard Davey <rich@photonstorm.com>
-* @copyright 2013 Photon Storm Ltd.
+* @copyright 2014 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -999,13 +993,13 @@ Phaser.Easing = {
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:25 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Emitter.js.html b/docs/Emitter.js.html
index fdd2c084..f12e2643 100644
--- a/docs/Emitter.js.html
+++ b/docs/Emitter.js.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -423,7 +417,7 @@
/**
* @author Richard Davey <rich@photonstorm.com>
-* @copyright 2013 Photon Storm Ltd.
+* @copyright 2014 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -445,7 +439,6 @@
Phaser.Particles.Arcade.Emitter = function (game, x, y, maxParticles) {
/**
- * The total number of particles in this emitter.
* @property {number} maxParticles - The total number of particles in this emitter..
* @default
*/
@@ -459,7 +452,8 @@ Phaser.Particles.Arcade.Emitter = function (game, x, y, maxParticles) {
this.name = 'emitter' + this.game.particles.ID++;
/**
- * @property {Description} type - Description.
+ * @property {number} type - Internal Phaser Type value.
+ * @protected
*/
this.type = Phaser.EMITTER;
@@ -488,140 +482,114 @@ Phaser.Particles.Arcade.Emitter = function (game, x, y, maxParticles) {
this.height = 1;
/**
- * The minimum possible velocity of a particle.
- * The default value is (-100,-100).
- * @property {Phaser.Point} minParticleSpeed
+ * @property {Phaser.Point} minParticleSpeed - The minimum possible velocity of a particle.
+ * @default
*/
this.minParticleSpeed = new Phaser.Point(-100, -100);
/**
- * The maximum possible velocity of a particle.
- * The default value is (100,100).
- * @property {Phaser.Point} maxParticleSpeed
+ * @property {Phaser.Point} maxParticleSpeed - The maximum possible velocity of a particle.
+ * @default
*/
this.maxParticleSpeed = new Phaser.Point(100, 100);
/**
- * The minimum possible scale of a particle.
- * The default value is 1.
- * @property {number} minParticleScale
+ * @property {number} minParticleScale - The minimum possible scale of a particle.
* @default
*/
this.minParticleScale = 1;
/**
- * The maximum possible scale of a particle.
- * The default value is 1.
- * @property {number} maxParticleScale
+ * @property {number} maxParticleScale - The maximum possible scale of a particle.
* @default
*/
this.maxParticleScale = 1;
/**
- * The minimum possible angular velocity of a particle. The default value is -360.
- * @property {number} minRotation
+ * @property {number} minRotation - The minimum possible angular velocity of a particle.
* @default
*/
this.minRotation = -360;
/**
- * The maximum possible angular velocity of a particle. The default value is 360.
- * @property {number} maxRotation
+ * @property {number} maxRotation - The maximum possible angular velocity of a particle.
* @default
*/
this.maxRotation = 360;
/**
- * Sets the <code>gravity.y</code> of each particle to this value on launch.
- * @property {number} gravity
+ * @property {number} gravity - Sets the `body.gravity.y` of each particle sprite to this value on launch.
* @default
*/
- this.gravity = 2;
+ this.gravity = 100;
/**
- * Set your own particle class type here.
- * @property {Description} particleClass
+ * @property {any} particleClass - For emitting your own particle class types.
* @default
*/
this.particleClass = null;
/**
- * The X and Y drag component of particles launched from the emitter.
- * @property {Phaser.Point} particleDrag
+ * @property {number} particleFriction - The friction component of particles launched from the emitter.
+ * @default
*/
- this.particleDrag = new Phaser.Point();
+ this.particleFriction = 0;
/**
- * The angular drag component of particles launched from the emitter if they are rotating.
- * @property {number} angularDrag
+ * @property {number} angularDrag - The angular drag component of particles launched from the emitter if they are rotating.
* @default
*/
this.angularDrag = 0;
/**
- * How often a particle is emitted in ms (if emitter is started with Explode === false).
- * @property {boolean} frequency
+ * @property {boolean} frequency - How often a particle is emitted in ms (if emitter is started with Explode === false).
* @default
*/
this.frequency = 100;
/**
- * How long each particle lives once it is emitted in ms. Default is 2 seconds.
- * Set lifespan to 'zero' for particles to live forever.
- * @property {number} lifespan
+ * @property {number} lifespan - How long each particle lives once it is emitted in ms. Default is 2 seconds. Set lifespan to 'zero' for particles to live forever.
* @default
*/
this.lifespan = 2000;
/**
- * How much each particle should bounce on each axis. 1 = full bounce, 0 = no bounce.
- * @property {Phaser.Point} bounce
+ * @property {Phaser.Point} bounce - How much each particle should bounce on each axis. 1 = full bounce, 0 = no bounce.
*/
this.bounce = new Phaser.Point();
/**
- * Internal helper for deciding how many particles to launch.
- * @property {number} _quantity
+ * @property {number} _quantity - Internal helper for deciding how many particles to launch.
* @private
- * @default
*/
this._quantity = 0;
/**
- * Internal helper for deciding when to launch particles or kill them.
- * @property {number} _timer
+ * @property {number} _timer - Internal helper for deciding when to launch particles or kill them.
* @private
- * @default
*/
this._timer = 0;
/**
- * Internal counter for figuring out how many particles to launch.
- * @property {number} _counter
+ * @property {number} _counter - Internal counter for figuring out how many particles to launch.
* @private
- * @default
*/
this._counter = 0;
/**
- * Internal helper for the style of particle emission (all at once, or one at a time).
- * @property {boolean} _explode
+ * @property {boolean} _explode - Internal helper for the style of particle emission (all at once, or one at a time).
* @private
- * @default
*/
this._explode = true;
/**
- * Determines whether the emitter is currently emitting particles.
- * It is totally safe to directly toggle this.
- * @property {boolean} on
+ * @property {boolean} on - Determines whether the emitter is currently emitting particles. It is totally safe to directly toggle this.
* @default
*/
this.on = false;
/**
- * Determines whether the emitter is being updated by the core game loop.
- * @property {boolean} exists
+ * @property {boolean} exists - Determines whether the emitter is being updated by the core game loop.
* @default
*/
this.exists = true;
@@ -695,43 +663,35 @@ Phaser.Particles.Arcade.Emitter.prototype.update = function () {
* This function generates a new array of particle sprites to attach to the emitter.
*
* @method Phaser.Particles.Arcade.Emitter#makeParticles
-* @param {Description} keys - Description.
-* @param {number} frames - Description.
-* @param {number} quantity - The number of particles to generate when using the "create from image" option.
-* @param {number} collide - Description.
-* @param {boolean} collideWorldBounds - Description.
-* @return This Emitter instance (nice for chaining stuff together, if you're into that).
+* @param {array|string} keys - A string or an array of strings that the particle sprites will use as their texture. If an array one is picked at random.
+* @param {array|number} frames - A frame number, or array of frames that the sprite will use. If an array one is picked at random.
+* @param {number} quantity - The number of particles to generate.
+* @param {boolean} [collide=false] - Sets the checkCollision.none flag on the particle sprites body.
+* @param {boolean} [collideWorldBounds=false] - A particle can be set to collide against the World bounds automatically and rebound back into the World if this is set to true. Otherwise it will leave the World.
+* @return {Phaser.Particles.Arcade.Emitter} This Emitter instance.
*/
Phaser.Particles.Arcade.Emitter.prototype.makeParticles = function (keys, frames, quantity, collide, collideWorldBounds) {
- if (typeof frames == 'undefined')
- {
- frames = 0;
- }
-
- quantity = quantity || this.maxParticles;
- collide = collide || 0;
-
- if (typeof collideWorldBounds == 'undefined')
- {
- collideWorldBounds = false;
- }
+ if (typeof frames === 'undefined') { frames = 0; }
+ if (typeof quantity === 'undefined') { quantity = this.maxParticles; }
+ if (typeof collide === 'undefined') { collide = false; }
+ if (typeof collideWorldBounds === 'undefined') { collideWorldBounds = false; }
var particle;
var i = 0;
var rndKey = keys;
- var rndFrame = 0;
+ var rndFrame = frames;
while (i < quantity)
{
- if (this.particleClass == null)
+ if (this.particleClass === null)
{
- if (typeof keys == 'object')
+ if (typeof keys === 'object')
{
rndKey = this.game.rnd.pick(keys);
}
- if (typeof frames == 'object')
+ if (typeof frames === 'object')
{
rndFrame = this.game.rnd.pick(frames);
}
@@ -743,14 +703,14 @@ Phaser.Particles.Arcade.Emitter.prototype.makeParticles = function (keys, frames
// particle = new this.particleClass(this.game);
// }
- if (collide > 0)
+ if (collide)
{
- particle.body.allowCollision.any = true;
- particle.body.allowCollision.none = false;
+ particle.body.checkCollision.any = true;
+ particle.body.checkCollision.none = false;
}
else
{
- particle.body.allowCollision.none = true;
+ particle.body.checkCollision.none = true;
}
particle.body.collideWorldBounds = collideWorldBounds;
@@ -770,9 +730,9 @@ Phaser.Particles.Arcade.Emitter.prototype.makeParticles = function (keys, frames
}
/**
- * Call this function to turn off all the particles and the emitter.
- * @method Phaser.Particles.Arcade.Emitter#kill
- */
+* Call this function to turn off all the particles and the emitter.
+* @method Phaser.Particles.Arcade.Emitter#kill
+*/
Phaser.Particles.Arcade.Emitter.prototype.kill = function () {
this.on = false;
@@ -782,10 +742,9 @@ Phaser.Particles.Arcade.Emitter.prototype.kill = function () {
}
/**
- * Handy for bringing game objects "back to life". Just sets alive and exists back to true.
- * In practice, this is most often called by <code>Object.reset()</code>.
- * @method Phaser.Particles.Arcade.Emitter#revive
- */
+* Handy for bringing game objects "back to life". Just sets alive and exists back to true.
+* @method Phaser.Particles.Arcade.Emitter#revive
+*/
Phaser.Particles.Arcade.Emitter.prototype.revive = function () {
this.alive = true;
@@ -794,27 +753,19 @@ Phaser.Particles.Arcade.Emitter.prototype.revive = function () {
}
/**
- * Call this function to start emitting particles.
- * @method Phaser.Particles.Arcade.Emitter#start
- * @param {boolean} explode - Whether the particles should all burst out at once.
- * @param {number} lifespan - How long each particle lives once emitted. 0 = forever.
- * @param {number} frequency - Ignored if Explode is set to true. Frequency is how often to emit a particle in ms.
- * @param {number} quantity - How many particles to launch. 0 = "all of the particles".
- */
+* Call this function to start emitting particles.
+* @method Phaser.Particles.Arcade.Emitter#start
+* @param {boolean} [explode=true] - Whether the particles should all burst out at once.
+* @param {number} [lifespan=0] - How long each particle lives once emitted. 0 = forever.
+* @param {number} [frequency=250] - Ignored if Explode is set to true. Frequency is how often to emit a particle in ms.
+* @param {number} [quantity=0] - How many particles to launch. 0 = "all of the particles".
+*/
Phaser.Particles.Arcade.Emitter.prototype.start = function (explode, lifespan, frequency, quantity) {
- if (typeof explode !== 'boolean')
- {
- explode = true;
- }
-
- lifespan = lifespan || 0;
-
- // How many ms between emissions?
- frequency = frequency || 250;
-
- // Total number of particles to emit
- quantity = quantity || 0;
+ if (typeof explode === 'undefined') { explode = true; }
+ if (typeof lifespan === 'undefined') { lifespan = 0; }
+ if (typeof frequency === 'undefined') { frequency = 250; }
+ if (typeof quantity === 'undefined') { quantity = 0; }
this.revive();
@@ -840,9 +791,9 @@ Phaser.Particles.Arcade.Emitter.prototype.start = function (explode, lifespan, f
}
/**
- * This function can be used both internally and externally to emit the next particle.
- * @method Phaser.Particles.Arcade.Emitter#emitParticle
- */
+* This function can be used both internally and externally to emit the next particle.
+* @method Phaser.Particles.Arcade.Emitter#emitParticle
+*/
Phaser.Particles.Arcade.Emitter.prototype.emitParticle = function () {
var particle = this.getFirstExists(false);
@@ -900,8 +851,7 @@ Phaser.Particles.Arcade.Emitter.prototype.emitParticle = function () {
particle.scale.setTo(scale, scale);
}
- particle.body.drag.x = this.particleDrag.x;
- particle.body.drag.y = this.particleDrag.y;
+ particle.body.friction = this.particleFriction;
particle.body.angularDrag = this.angularDrag;
}
@@ -909,8 +859,8 @@ Phaser.Particles.Arcade.Emitter.prototype.emitParticle = function () {
/**
* A more compact way of setting the width and height of the emitter.
* @method Phaser.Particles.Arcade.Emitter#setSize
-* @param {number} width - The desired width of the emitter (particles are spawned randomly within these dimensions).
-* @param {number} height - The desired height of the emitter.
+* @param {number} width - The desired width of the emitter (particles are spawned randomly within these dimensions).
+* @param {number} height - The desired height of the emitter.
*/
Phaser.Particles.Arcade.Emitter.prototype.setSize = function (width, height) {
@@ -922,8 +872,8 @@ Phaser.Particles.Arcade.Emitter.prototype.setSize = function (width, height) {
/**
* A more compact way of setting the X velocity range of the emitter.
* @method Phaser.Particles.Arcade.Emitter#setXSpeed
-* @param {number} min - The minimum value for this range.
-* @param {number} max - The maximum value for this range.
+* @param {number} [min=0] - The minimum value for this range.
+* @param {number} [max=0] - The maximum value for this range.
*/
Phaser.Particles.Arcade.Emitter.prototype.setXSpeed = function (min, max) {
@@ -938,8 +888,8 @@ Phaser.Particles.Arcade.Emitter.prototype.setXSpeed = function (min, max) {
/**
* A more compact way of setting the Y velocity range of the emitter.
* @method Phaser.Particles.Arcade.Emitter#setYSpeed
-* @param {number} min - The minimum value for this range.
-* @param {number} max - The maximum value for this range.
+* @param {number} [min=0] - The minimum value for this range.
+* @param {number} [max=0] - The maximum value for this range.
*/
Phaser.Particles.Arcade.Emitter.prototype.setYSpeed = function (min, max) {
@@ -954,8 +904,8 @@ Phaser.Particles.Arcade.Emitter.prototype.setYSpeed = function (min, max) {
/**
* A more compact way of setting the angular velocity constraints of the emitter.
* @method Phaser.Particles.Arcade.Emitter#setRotation
-* @param {number} min - The minimum value for this range.
-* @param {number} max - The maximum value for this range.
+* @param {number} [min=0] - The minimum value for this range.
+* @param {number} [max=0] - The maximum value for this range.
*/
Phaser.Particles.Arcade.Emitter.prototype.setRotation = function (min, max) {
@@ -968,14 +918,17 @@ Phaser.Particles.Arcade.Emitter.prototype.setRotation = function (min, max) {
}
/**
-* Change the emitter's midpoint to match the midpoint of a <code>Object</code>.
+* Change the emitters center to match the center of any object with a `center` property, such as a Sprite.
* @method Phaser.Particles.Arcade.Emitter#at
-* @param {object} object - The <code>Object</code> that you want to sync up with.
+* @param {object|Phaser.Sprite} object - The object that you wish to match the center with.
*/
Phaser.Particles.Arcade.Emitter.prototype.at = function (object) {
- this.emitX = object.center.x;
- this.emitY = object.center.y;
+ if (object.center)
+ {
+ this.emitX = object.center.x;
+ this.emitY = object.center.y;
+ }
}
@@ -1111,13 +1064,13 @@ Object.defineProperty(Phaser.Particles.Arcade.Emitter.prototype, "bottom", {
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:25 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Events.js.html b/docs/Events.js.html
index b49c7657..0e77e3f9 100644
--- a/docs/Events.js.html
+++ b/docs/Events.js.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -423,7 +417,7 @@
/**
* @author Richard Davey <rich@photonstorm.com>
-* @copyright 2013 Photon Storm Ltd.
+* @copyright 2014 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -447,6 +441,7 @@
Phaser.Events = function (sprite) {
this.parent = sprite;
+
this.onAddedToGroup = new Phaser.Signal();
this.onRemovedFromGroup = new Phaser.Signal();
this.onKilled = new Phaser.Signal();
@@ -464,6 +459,9 @@ Phaser.Events = function (sprite) {
this.onAnimationComplete = null;
this.onAnimationLoop = null;
+ this.onBeginContact = null;
+ this.onEndContact = null;
+
};
Phaser.Events.prototype = {
@@ -496,7 +494,10 @@ Phaser.Events.prototype = {
}
-};
+};
+
+Phaser.Events.prototype.constructor = Phaser.Events;
+
@@ -511,13 +512,13 @@ Phaser.Events.prototype = {
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:25 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Filter.js.html b/docs/Filter.js.html
index 32d52126..b187003d 100644
--- a/docs/Filter.js.html
+++ b/docs/Filter.js.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -423,7 +417,7 @@
/**
* @author Richard Davey <rich@photonstorm.com>
-* @copyright 2013 Photon Storm Ltd.
+* @copyright 2014 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -475,9 +469,9 @@ Phaser.Filter = function (game, uniforms, fragmentSrc) {
*/
this.uniforms = {
- resolution: { type: '3f', value: { x: 256, y: 256, z: 0 }},
time: { type: '1f', value: 0 },
- mouse: { type: '4f', value: { x: 0, y: 0, z: 0, w: 0 }}
+ resolution: { type: '2f', value: { x: 256, y: 256 }},
+ mouse: { type: '2f', value: { x: 0.0, y: 0.0 }}
};
@@ -520,8 +514,15 @@ Phaser.Filter.prototype = {
if (typeof pointer !== 'undefined')
{
- this.uniforms.mouse.x = pointer.x;
- this.uniforms.mouse.y = pointer.y;
+ if (pointer.x > 0)
+ {
+ this.uniforms.mouse.x = pointer.x.toFixed(2);
+ }
+
+ if (pointer.y > 0)
+ {
+ this.uniforms.mouse.y = pointer.y.toFixed(2);
+ }
}
this.uniforms.time.value = this.game.time.totalElapsedSeconds();
@@ -540,6 +541,8 @@ Phaser.Filter.prototype = {
};
+Phaser.Filter.prototype.constructor = Phaser.Filter;
+
/**
* @name Phaser.Filter#width
* @property {number} width - The width (resolution uniform)
@@ -586,13 +589,13 @@ Object.defineProperty(Phaser.Filter.prototype, 'height', {
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:25 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Frame.js.html b/docs/Frame.js.html
index 85be511e..56b5e93c 100644
--- a/docs/Frame.js.html
+++ b/docs/Frame.js.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -423,7 +417,7 @@
/**
* @author Richard Davey <rich@photonstorm.com>
-* @copyright 2013 Photon Storm Ltd.
+* @copyright 2014 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -581,6 +575,8 @@ Phaser.Frame.prototype = {
}
};
+
+Phaser.Frame.prototype.constructor = Phaser.Frame;
@@ -596,13 +592,13 @@ Phaser.Frame.prototype = {
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:25 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/FrameData.js.html b/docs/FrameData.js.html
index da678000..a25b6514 100644
--- a/docs/FrameData.js.html
+++ b/docs/FrameData.js.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -423,7 +417,7 @@
/**
* @author Richard Davey <rich@photonstorm.com>
-* @copyright 2013 Photon Storm Ltd.
+* @copyright 2014 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -646,6 +640,8 @@ Phaser.FrameData.prototype = {
};
+Phaser.FrameData.prototype.constructor = Phaser.FrameData;
+
/**
* @name Phaser.FrameData#total
* @property {number} total - The total number of frames in this FrameData set.
@@ -673,13 +669,13 @@ Object.defineProperty(Phaser.FrameData.prototype, "total", {
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:25 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Game.js.html b/docs/Game.js.html
index 1bb2ffda..b075f156 100644
--- a/docs/Game.js.html
+++ b/docs/Game.js.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -423,7 +417,7 @@
/**
* @author Richard Davey <rich@photonstorm.com>
-* @copyright 2013 Photon Storm Ltd.
+* @copyright 2014 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -440,64 +434,68 @@
* @param {number} [width=800] - The width of your game in game pixels.
* @param {number} [height=600] - The height of your game in game pixels.
* @param {number} [renderer=Phaser.AUTO] - Which renderer to use: Phaser.AUTO will auto-detect, Phaser.WEBGL, Phaser.CANVAS or Phaser.HEADLESS (no rendering at all).
-* @param {HTMLElement} [parent=''] - The Games DOM parent.
-* @param {any} [state=null] - Description.
+* @param {string|HTMLElement} [parent=''] - The DOM element into which this games canvas will be injected. Either a DOM ID (string) or the element itself.
+* @param {object} [state=null] - The default state object. A object consisting of Phaser.State functions (preload, create, update, render) or null.
* @param {boolean} [transparent=false] - Use a transparent canvas background or not.
* @param {boolean} [antialias=true] - Anti-alias graphics.
*/
Phaser.Game = function (width, height, renderer, parent, state, transparent, antialias) {
- width = width || 800;
- height = height || 600;
- renderer = renderer || Phaser.AUTO;
- parent = parent || '';
- state = state || null;
-
- if (typeof transparent == 'undefined') { transparent = false; }
- if (typeof antialias == 'undefined') { antialias = true; }
-
/**
* @property {number} id - Phaser Game ID (for when Pixi supports multiple instances).
*/
this.id = Phaser.GAMES.push(this) - 1;
/**
- * @property {HTMLElement} parent - The Games DOM parent.
+ * @property {object} config - The Phaser.Game configuration object.
*/
- this.parent = parent;
+ this.config = null;
- // Do some more intelligent size parsing here, so they can set "100%" for example, maybe pass the scale mode in here too?
+ /**
+ * @property {HTMLElement} parent - The Games DOM parent.
+ * @default
+ */
+ this.parent = '';
/**
* @property {number} width - The Game width (in pixels).
+ * @default
*/
- this.width = width;
+ this.width = 800;
/**
* @property {number} height - The Game height (in pixels).
+ * @default
*/
- this.height = height;
+ this.height = 600;
/**
* @property {boolean} transparent - Use a transparent canvas background or not.
+ * @default
*/
- this.transparent = transparent;
+ this.transparent = false;
/**
* @property {boolean} antialias - Anti-alias graphics (in WebGL this helps with edges, in Canvas2D it retains pixel-art quality).
+ * @default
*/
- this.antialias = antialias;
+ this.antialias = true;
/**
* @property {number} renderer - The Pixi Renderer
* @default
*/
- this.renderer = null;
+ this.renderer = Phaser.AUTO;
+
+ /**
+ * @property {number} renderType - The Renderer this Phaser.Game will use. Either Phaser.RENDERER_AUTO, Phaser.RENDERER_CANVAS or Phaser.RENDERER_WEBGL.
+ */
+ this.renderType = Phaser.AUTO;
/**
* @property {number} state - The StateManager.
*/
- this.state = new Phaser.StateManager(this, state);
+ this.state = null;
/**
* @property {boolean} _paused - Is game paused?
@@ -506,11 +504,6 @@ Phaser.Game = function (width, height, renderer, parent, state, transparent, ant
*/
this._paused = false;
- /**
- * @property {number} renderType - The Renderer this Phaser.Game will use. Either Phaser.RENDERER_AUTO, Phaser.RENDERER_CANVAS or Phaser.RENDERER_WEBGL.
- */
- this.renderType = renderer;
-
/**
* @property {boolean} _loadComplete - Whether load complete loading or not.
* @private
@@ -650,6 +643,68 @@ Phaser.Game = function (width, height, renderer, parent, state, transparent, ant
*/
this.particles = null;
+ /**
+ * @property {boolean} stepping - Enable core loop stepping with Game.enableStep().
+ * @default
+ * @readonly
+ */
+ this.stepping = false;
+
+ /**
+ * @property {boolean} stepping - An internal property used by enableStep, but also useful to query from your own game objects.
+ * @default
+ * @readonly
+ */
+ this.pendingStep = false;
+
+ /**
+ * @property {number} stepCount - When stepping is enabled this contains the current step cycle.
+ * @default
+ * @readonly
+ */
+ this.stepCount = 0;
+
+ // Parse the configuration object (if any)
+ if (arguments.length === 1 && typeof arguments[0] === 'object')
+ {
+ this.parseConfig(arguments[0]);
+ }
+ else
+ {
+ if (typeof width !== 'undefined')
+ {
+ this.width = width;
+ }
+
+ if (typeof height !== 'undefined')
+ {
+ this.height = height;
+ }
+
+ if (typeof renderer !== 'undefined')
+ {
+ this.renderer = renderer;
+ this.renderType = renderer;
+ }
+
+ if (typeof parent !== 'undefined')
+ {
+ this.parent = parent;
+ }
+
+ if (typeof transparent !== 'undefined')
+ {
+ this.transparent = transparent;
+ }
+
+ if (typeof antialias !== 'undefined')
+ {
+ this.antialias = antialias;
+ }
+
+ this.state = new Phaser.StateManager(this, state);
+ }
+
var _this = this;
this._onBoot = function () {
@@ -672,6 +727,99 @@ Phaser.Game = function (width, height, renderer, parent, state, transparent, ant
Phaser.Game.prototype = {
+ /**
+ * Parses a Game configuration object.
+ *
+ * @method Phaser.Game#parseConfig
+ * @protected
+ */
+ parseConfig: function (config) {
+
+ this.config = config;
+
+ if (config['width'])
+ {
+ this.width = this.parseDimension(config['width'], 0);
+ }
+
+ if (config['height'])
+ {
+ this.height = this.parseDimension(config['height'], 1);
+ }
+
+ if (config['renderer'])
+ {
+ this.renderer = config['renderer'];
+ this.renderType = config['renderer'];
+ }
+
+ if (config['parent'])
+ {
+ this.parent = config['parent'];
+ }
+
+ if (config['transparent'])
+ {
+ this.transparent = config['transparent'];
+ }
+
+ if (config['antialias'])
+ {
+ this.antialias = config['antialias'];
+ }
+
+ var state = null;
+
+ if (config['state'])
+ {
+ state = config['state'];
+ }
+
+ this.state = new Phaser.StateManager(this, state);
+
+ },
+
+ /**
+ * Get dimension.
+ *
+ * @method Phaser.Game#parseDimension
+ * @protected
+ */
+ parseDimension: function (size, dimension) {
+
+ var f = 0;
+ var px = 0;
+
+ if (typeof size === 'string')
+ {
+ // %?
+ if (size.substr(-1) === '%')
+ {
+ f = parseInt(size, 10) / 100;
+
+ if (dimension === 0)
+ {
+ px = window.innerWidth * f;
+ }
+ else
+ {
+ px = window.innerHeight * f;
+ }
+ }
+ else
+ {
+ px = parseInt(size, 10);
+ }
+ }
+ else
+ {
+ px = size;
+ }
+
+ return px;
+
+ },
+
/**
* Initialize engine sub modules and start the game.
*
@@ -721,6 +869,7 @@ Phaser.Game.prototype = {
this.net = new Phaser.Net(this);
this.debug = new Phaser.Utils.Debug(this);
+ this.time.boot();
this.stage.boot();
this.world.boot();
this.input.boot();
@@ -795,6 +944,14 @@ Phaser.Game.prototype = {
*/
setUpRenderer: function () {
+ /*
+ if (this.device.trident)
+ {
+ // Pixi WebGL renderer on IE11 doesn't work correctly with masks, if you need them you may want to comment this block out
+ this.renderType = Phaser.CANVAS;
+ }
+ */
+
if (this.renderType === Phaser.HEADLESS || this.renderType === Phaser.CANVAS || (this.renderType === Phaser.AUTO && this.device.webGL === false))
{
if (this.device.canvas)
@@ -861,20 +1018,28 @@ Phaser.Game.prototype = {
}
else
{
- this.plugins.preUpdate();
- this.physics.preUpdate();
+ if (!this.pendingStep)
+ {
+ if (this.stepping)
+ {
+ this.pendingStep = true;
+ }
- this.stage.update();
- this.input.update();
- this.tweens.update();
- this.sound.update();
- this.world.update();
- this.particles.update();
- this.state.update();
- this.plugins.update();
+ this.plugins.preUpdate();
+ this.world.preUpdate();
- this.world.postUpdate();
- this.plugins.postUpdate();
+ this.stage.update();
+ this.tweens.update();
+ this.sound.update();
+ this.input.update();
+ this.state.update();
+ this.world.update();
+ this.particles.update();
+ this.plugins.update();
+
+ this.world.postUpdate();
+ this.plugins.postUpdate();
+ }
if (this.renderType !== Phaser.HEADLESS)
{
@@ -884,11 +1049,49 @@ Phaser.Game.prototype = {
this.plugins.postRender();
}
-
}
},
+ /**
+ * Enable core game loop stepping. When enabled you must call game.step() directly (perhaps via a DOM button?)
+ * Calling step will advance the game loop by one frame. This is extremely useful to hard to track down errors!
+ *
+ * @method Phaser.Game#enableStep
+ */
+ enableStep: function () {
+
+ this.stepping = true;
+ this.pendingStep = false;
+ this.stepCount = 0;
+
+ },
+
+ /**
+ * Disables core game loop stepping.
+ *
+ * @method Phaser.Game#disableStep
+ */
+ disableStep: function () {
+
+ this.stepping = false;
+ this.pendingStep = false;
+
+ },
+
+ /**
+ * When stepping is enabled you must call this function directly (perhaps via a DOM button?) to advance the game loop by one frame.
+ * This is extremely useful to hard to track down errors! Use the internal stepCount property to monitor progress.
+ *
+ * @method Phaser.Game#step
+ */
+ step: function () {
+
+ this.pendingStep = false;
+ this.stepCount++;
+
+ },
+
/**
* Nuke the entire game from orbit
*
@@ -916,6 +1119,8 @@ Phaser.Game.prototype = {
};
+Phaser.Game.prototype.constructor = Phaser.Game;
+
/**
* The paused state of the Game. A paused game doesn't update any of its subsystems.
* When a game is paused the onPause event is dispatched. When it is resumed the onResume event is dispatched.
@@ -969,13 +1174,13 @@ Object.defineProperty(Phaser.Game.prototype, "paused", {
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:25 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/GameObjectFactory.js.html b/docs/GameObjectFactory.js.html
index d5083241..8665cdb7 100644
--- a/docs/GameObjectFactory.js.html
+++ b/docs/GameObjectFactory.js.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -423,7 +417,7 @@
/**
* @author Richard Davey <rich@photonstorm.com>
-* @copyright 2013 Photon Storm Ltd.
+* @copyright 2014 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -470,15 +464,19 @@ Phaser.GameObjectFactory.prototype = {
* @param {number} y - Y position of the new sprite.
* @param {string|Phaser.RenderTexture|PIXI.Texture} key - This is the image or texture used by the Sprite during rendering. It can be a string which is a reference to the Cache entry, or an instance of a RenderTexture or PIXI.Texture.
* @param {string|number} [frame] - If the sprite uses an image from a texture atlas or sprite sheet you can pass the frame here. Either a number for a frame ID or a string for a frame name.
+ * @param {Phaser.Group} [group] - Optional Group to add the object to. If not specified it will be added to the World group.
* @returns {Phaser.Sprite} the newly created sprite object.
*/
- sprite: function (x, y, key, frame) {
+ sprite: function (x, y, key, frame, group) {
- return this.world.create(x, y, key, frame);
+ if (typeof group === 'undefined') { group = this.world; }
+
+ return group.create(x, y, key, frame);
},
/**
+ * DEPRECATED - will be removed in Phaser 1.2
* Create a new Sprite with specific position and sprite sheet key that will automatically be added as a child of the given parent.
*
* @method Phaser.GameObjectFactory#child
@@ -512,8 +510,8 @@ Phaser.GameObjectFactory.prototype = {
* A Group is a container for display objects that allows for fast pooling, recycling and collision checks.
*
* @method Phaser.GameObjectFactory#group
- * @param {*} parent - The parent Group or DisplayObjectContainer that will hold this group, if any.
- * @param {string} [name=group] - A name for this Group. Not used internally but useful for debugging.
+ * @param {any} parent - The parent Group or DisplayObjectContainer that will hold this group, if any.
+ * @param {string} [name='group'] - A name for this Group. Not used internally but useful for debugging.
* @return {Phaser.Group} The newly created group.
*/
group: function (parent, name) {
@@ -523,7 +521,7 @@ Phaser.GameObjectFactory.prototype = {
},
/**
- * Creates a new instance of the Sound class.
+ * Creates a new Sound object.
*
* @method Phaser.GameObjectFactory#audio
* @param {string} key - The Game.cache key of the sound that this object will use.
@@ -539,7 +537,23 @@ Phaser.GameObjectFactory.prototype = {
},
/**
- * Creates a new <code>TileSprite</code>.
+ * Creates a new Sound object.
+ *
+ * @method Phaser.GameObjectFactory#sound
+ * @param {string} key - The Game.cache key of the sound that this object will use.
+ * @param {number} [volume=1] - The volume at which the sound will be played.
+ * @param {boolean} [loop=false] - Whether or not the sound will loop.
+ * @param {boolean} [connect=true] - Controls if the created Sound object will connect to the master gainNode of the SoundManager when running under WebAudio.
+ * @return {Phaser.Sound} The newly created text object.
+ */
+ sound: function (key, volume, loop, connect) {
+
+ return this.game.sound.add(key, volume, loop, connect);
+
+ },
+
+ /**
+ * Creates a new TileSprite object.
*
* @method Phaser.GameObjectFactory#tileSprite
* @param {number} x - X position of the new tileSprite.
@@ -547,33 +561,38 @@ Phaser.GameObjectFactory.prototype = {
* @param {number} width - the width of the tilesprite.
* @param {number} height - the height of the tilesprite.
* @param {string|Phaser.RenderTexture|PIXI.Texture} key - This is the image or texture used by the Sprite during rendering. It can be a string which is a reference to the Cache entry, or an instance of a RenderTexture or PIXI.Texture.
- * @param {string|number} frame - If this Sprite is using part of a sprite sheet or texture atlas you can specify the exact frame to use by giving a string or numeric index.
+ * @param {Phaser.Group} [group] - Optional Group to add the object to. If not specified it will be added to the World group.
* @return {Phaser.TileSprite} The newly created tileSprite object.
*/
- tileSprite: function (x, y, width, height, key, frame) {
+ tileSprite: function (x, y, width, height, key, group) {
- return this.world.add(new Phaser.TileSprite(this.game, x, y, width, height, key, frame));
+ if (typeof group === 'undefined') { group = this.world; }
+
+ return group.add(new Phaser.TileSprite(this.game, x, y, width, height, key));
},
/**
- * Creates a new <code>Text</code>.
+ * Creates a new Text object.
*
* @method Phaser.GameObjectFactory#text
* @param {number} x - X position of the new text object.
* @param {number} y - Y position of the new text object.
* @param {string} text - The actual text that will be written.
* @param {object} style - The style object containing style attributes like font, font size , etc.
+ * @param {Phaser.Group} [group] - Optional Group to add the object to. If not specified it will be added to the World group.
* @return {Phaser.Text} The newly created text object.
*/
- text: function (x, y, text, style) {
+ text: function (x, y, text, style, group) {
- return this.world.add(new Phaser.Text(this.game, x, y, text, style));
+ if (typeof group === 'undefined') { group = this.world; }
+
+ return group.add(new Phaser.Text(this.game, x, y, text, style));
},
/**
- * Creates a new <code>Button</code> object.
+ * Creates a new Button object.
*
* @method Phaser.GameObjectFactory#button
* @param {number} [x] X position of the new button object.
@@ -584,25 +603,32 @@ Phaser.GameObjectFactory.prototype = {
* @param {string|number} [overFrame] This is the frame or frameName that will be set when this button is in an over state. Give either a number to use a frame ID or a string for a frame name.
* @param {string|number} [outFrame] This is the frame or frameName that will be set when this button is in an out state. Give either a number to use a frame ID or a string for a frame name.
* @param {string|number} [downFrame] This is the frame or frameName that will be set when this button is in a down state. Give either a number to use a frame ID or a string for a frame name.
+ * @param {string|number} [upFrame] This is the frame or frameName that will be set when this button is in an up state. Give either a number to use a frame ID or a string for a frame name.
+ * @param {Phaser.Group} [group] - Optional Group to add the object to. If not specified it will be added to the World group.
* @return {Phaser.Button} The newly created button object.
*/
- button: function (x, y, key, callback, callbackContext, overFrame, outFrame, downFrame) {
+ button: function (x, y, key, callback, callbackContext, overFrame, outFrame, downFrame, upFrame, group) {
- return this.world.add(new Phaser.Button(this.game, x, y, key, callback, callbackContext, overFrame, outFrame, downFrame));
+ if (typeof group === 'undefined') { group = this.world; }
+
+ return group.add(new Phaser.Button(this.game, x, y, key, callback, callbackContext, overFrame, outFrame, downFrame, upFrame));
},
/**
- * Creates a new <code>Graphics</code> object.
+ * Creates a new Graphics object.
*
* @method Phaser.GameObjectFactory#graphics
* @param {number} x - X position of the new graphics object.
* @param {number} y - Y position of the new graphics object.
+ * @param {Phaser.Group} [group] - Optional Group to add the object to. If not specified it will be added to the World group.
* @return {Phaser.Graphics} The newly created graphics object.
*/
- graphics: function (x, y) {
+ graphics: function (x, y, group) {
- return this.world.add(new Phaser.Graphics(this.game, x, y));
+ if (typeof group === 'undefined') { group = this.world; }
+
+ return group.add(new Phaser.Graphics(this.game, x, y));
},
@@ -624,16 +650,19 @@ Phaser.GameObjectFactory.prototype = {
},
/**
- * * Create a new <code>BitmapText</code>.
+ * * Create a new BitmapText object.
*
* @method Phaser.GameObjectFactory#bitmapText
* @param {number} x - X position of the new bitmapText object.
* @param {number} y - Y position of the new bitmapText object.
* @param {string} text - The actual text that will be written.
* @param {object} style - The style object containing style attributes like font, font size , etc.
+ * @param {Phaser.Group} [group] - Optional Group to add the object to. If not specified it will be added to the World group.
* @return {Phaser.BitmapText} The newly created bitmapText object.
*/
- bitmapText: function (x, y, text, style) {
+ bitmapText: function (x, y, text, style, group) {
+
+ if (typeof group === 'undefined') { group = this.world; }
return this.world.add(new Phaser.BitmapText(this.game, x, y, text, style));
@@ -643,41 +672,13 @@ Phaser.GameObjectFactory.prototype = {
* Creates a new Tilemap object.
*
* @method Phaser.GameObjectFactory#tilemap
- * @param {string} key - Asset key for the JSON file.
+ * @param {string} key - Asset key for the JSON or CSV map data in the cache.
+ * @param {object|string} tilesets - An object mapping Cache.tileset keys with the tileset names in the JSON file. If a string is provided that will be used.
* @return {Phaser.Tilemap} The newly created tilemap object.
*/
- tilemap: function (key) {
+ tilemap: function (key, tilesets) {
- return new Phaser.Tilemap(this.game, key);
-
- },
-
- /**
- * Creates a new Tileset object.
- *
- * @method Phaser.GameObjectFactory#tileset
- * @param {string} key - The image key as defined in the Game.Cache to use as the tileset.
- * @return {Phaser.Tileset} The newly created tileset object.
- */
- tileset: function (key) {
-
- return this.game.cache.getTileset(key);
-
- },
-
- /**
- * Creates a new Tilemap Layer object.
- *
- * @method Phaser.GameObjectFactory#tilemapLayer
- * @param {number} x - X position of the new tilemapLayer.
- * @param {number} y - Y position of the new tilemapLayer.
- * @param {number} width - the width of the tilemapLayer.
- * @param {number} height - the height of the tilemapLayer.
- * @return {Phaser.TilemapLayer} The newly created tilemaplayer object.
- */
- tilemapLayer: function (x, y, width, height, tileset, tilemap, layer) {
-
- return this.world.add(new Phaser.TilemapLayer(this.game, x, y, width, height, tileset, tilemap, layer));
+ return new Phaser.Tilemap(this.game, key, tilesets);
},
@@ -701,7 +702,7 @@ Phaser.GameObjectFactory.prototype = {
},
/**
- * A BitmapData object which can be manipulated and drawn to like a traditional Canvas object and used to texture Sprites.
+ * Experimental: A BitmapData object which can be manipulated and drawn to like a traditional Canvas object and used to texture Sprites.
*
* @method Phaser.GameObjectFactory#bitmapData
* @param {number} [width=256] - The width of the BitmapData in pixels.
@@ -734,7 +735,10 @@ Phaser.GameObjectFactory.prototype = {
}
-};
+};
+
+Phaser.GameObjectFactory.prototype.constructor = Phaser.GameObjectFactory;
+
@@ -749,13 +753,13 @@ Phaser.GameObjectFactory.prototype = {
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:25 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Gamepad.js.html b/docs/Gamepad.js.html
new file mode 100644
index 00000000..54da0f92
--- /dev/null
+++ b/docs/Gamepad.js.html
@@ -0,0 +1,1057 @@
+
+
+
+
+
+ Phaser Source: input/Gamepad.js
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Source: input/Gamepad.js
+
+
+
+ /**
+* @author @karlmacklin <tacklemcclean@gmail.com>
+* @copyright 2014 Photon Storm Ltd.
+* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+*/
+
+/**
+* The Gamepad class handles looking after gamepad input for your game.
+* Remember to call gamepad.start(); expecting input!
+*
+* HTML5 GAMEPAD API SUPPORT IS AT AN EXPERIMENTAL STAGE!
+* At moment of writing this (end of 2013) only Chrome supports parts of it out of the box. Firefox supports it
+* via prefs flags (about:config, search gamepad). The browsers map the same controllers differently.
+* This class has constans for Windows 7 Chrome mapping of
+* XBOX 360 controller.
+*
+* @class Phaser.Gamepad
+* @constructor
+* @param {Phaser.Game} game - A reference to the currently running game.
+*/
+Phaser.Gamepad = function (game) {
+
+ /**
+ * @property {Phaser.Game} game - Local reference to game.
+ */
+ this.game = game;
+
+ /**
+ * @property {Array<Phaser.SinglePad>} _gamepads - The four Phaser Gamepads.
+ * @private
+ */
+ this._gamepads = [
+ new Phaser.SinglePad(game, this),
+ new Phaser.SinglePad(game, this),
+ new Phaser.SinglePad(game, this),
+ new Phaser.SinglePad(game, this)
+ ];
+
+ /**
+ * @property {Object} _gamepadIndexMap - Maps the browsers gamepad indices to our Phaser Gamepads
+ * @private
+ */
+ this._gamepadIndexMap = {};
+
+ /**
+ * @property {Array} _rawPads - The raw state of the gamepads from the browser
+ * @private
+ */
+ this._rawPads = [];
+
+ /**
+ * @property {boolean} _active - Private flag for whether or not the API is polled
+ * @private
+ * @default
+ */
+ this._active = false;
+
+ /**
+ * You can disable all Gamepad Input by setting disabled to true. While true all new input related events will be ignored.
+ * @property {boolean} disabled - The disabled state of the Gamepad.
+ * @default
+ */
+ this.disabled = false;
+
+ /**
+ * Whether or not gamepads are supported in the current browser. Note that as of Dec. 2013 this check is actually not accurate at all due to poor implementation.
+ * @property {boolean} _gamepadSupportAvailable - Are gamepads supported in this browser or not?
+ * @private
+ */
+ this._gamepadSupportAvailable = !!navigator.webkitGetGamepads || !!navigator.webkitGamepads || (navigator.userAgent.indexOf('Firefox/') != -1);
+
+ /**
+ * Used to check for differences between earlier polls and current state of gamepads.
+ * @property {Array} _prevRawGamepadTypes
+ * @private
+ * @default
+ */
+ this._prevRawGamepadTypes = [];
+
+ /**
+ * Used to check for differences between earlier polls and current state of gamepads.
+ * @property {Array} _prevTimestamps
+ * @private
+ * @default
+ */
+ this._prevTimestamps = [];
+
+ /**
+ * @property {Object} callbackContext - The context under which the callbacks are run.
+ */
+ this.callbackContext = this;
+
+ /**
+ * @property {function} onConnectCallback - This callback is invoked every time any gamepad is connected
+ */
+ this.onConnectCallback = null;
+
+ /**
+ * @property {function} onDisconnectCallback - This callback is invoked every time any gamepad is disconnected
+ */
+ this.onDisconnectCallback = null;
+
+ /**
+ * @property {function} onDownCallback - This callback is invoked every time any gamepad button is pressed down.
+ */
+ this.onDownCallback = null;
+
+ /**
+ * @property {function} onUpCallback - This callback is invoked every time any gamepad button is released.
+ */
+ this.onUpCallback = null;
+
+ /**
+ * @property {function} onAxisCallback - This callback is invoked every time any gamepad axis is changed.
+ */
+ this.onAxisCallback = null;
+
+ /**
+ * @property {function} onFloatCallback - This callback is invoked every time any gamepad button is changed to a value where value > 0 and value < 1.
+ */
+ this.onFloatCallback = null;
+
+ /**
+ * @property {function} _ongamepadconnected - Private callback for Firefox gamepad connection handling
+ * @private
+ */
+ this._ongamepadconnected = null;
+
+ /**
+ * @property {function} _gamepaddisconnected - Private callback for Firefox gamepad connection handling
+ * @private
+ */
+ this._gamepaddisconnected = null;
+};
+
+Phaser.Gamepad.prototype = {
+
+ /**
+ * Add callbacks to the main Gamepad handler to handle connect/disconnect/button down/button up/axis change/float value buttons
+ * @method Phaser.Gamepad#addCallbacks
+ * @param {Object} context - The context under which the callbacks are run.
+ * @param {Object} callbacks - Object that takes six different callback methods:
+ * onConnectCallback, onDisconnectCallback, onDownCallback, onUpCallback, onAxisCallback, onFloatCallback
+ */
+ addCallbacks: function (context, callbacks) {
+
+ if (typeof callbacks !== 'undefined')
+ {
+ this.onConnectCallback = (typeof callbacks.onConnect === 'function') ? callbacks.onConnect : this.onConnectCallback;
+ this.onDisconnectCallback = (typeof callbacks.onDisconnect === 'function') ? callbacks.onDisconnect : this.onDisconnectCallback;
+ this.onDownCallback = (typeof callbacks.onDown === 'function') ? callbacks.onDown : this.onDownCallback;
+ this.onUpCallback = (typeof callbacks.onUp === 'function') ? callbacks.onUp : this.onUpCallback;
+ this.onAxisCallback = (typeof callbacks.onAxis === 'function') ? callbacks.onAxis : this.onAxisCallback;
+ this.onFloatCallback = (typeof callbacks.onFloat === 'function') ? callbacks.onFloat : this.onFloatCallback;
+ }
+
+ },
+
+ /**
+ * Starts the Gamepad event handling.
+ * This MUST be called manually before Phaser will start polling the Gamepad API.
+ *
+ * @method Phaser.Gamepad#start
+ */
+ start: function () {
+
+ this._active = true;
+ var _this = this;
+
+ this._ongamepadconnected = function(event) {
+ var newPad = event.gamepad;
+ _this._rawPads.push(newPad);
+ _this._gamepads[newPad.index].connect(newPad);
+ };
+
+ window.addEventListener('gamepadconnected', this._ongamepadconnected, false);
+
+ this._ongamepaddisconnected = function(event) {
+
+ var removedPad = event.gamepad;
+
+ for (var i in _this._rawPads)
+ {
+ if (_this._rawPads[i].index === removedPad.index)
+ {
+ _this._rawPads.splice(i,1);
+ }
+ }
+ _this._gamepads[removedPad.index].disconnect();
+ };
+
+ window.addEventListener('gamepaddisconnected', this._ongamepaddisconnected, false);
+
+ },
+
+ /**
+ * Main gamepad update loop. Should not be called manually.
+ * @method Phaser.Gamepad#update
+ * @private
+ */
+ update: function () {
+
+ this._pollGamepads();
+
+ for (var i = 0; i < this._gamepads.length; i++)
+ {
+ if (this._gamepads[i]._connected)
+ {
+ this._gamepads[i].pollStatus();
+ }
+ }
+
+ },
+
+ /**
+ * Updating connected gamepads (for Google Chrome).
+ * Should not be called manually.
+ * @method Phaser.Gamepad#_pollGamepads
+ * @private
+ */
+ _pollGamepads: function () {
+
+ var rawGamepads = (navigator.webkitGetGamepads && navigator.webkitGetGamepads()) || navigator.webkitGamepads;
+
+ if (rawGamepads)
+ {
+ this._rawPads = [];
+
+ var gamepadsChanged = false;
+
+ for (var i = 0; i < rawGamepads.length; i++)
+ {
+ if (typeof rawGamepads[i] !== this._prevRawGamepadTypes[i])
+ {
+ gamepadsChanged = true;
+ this._prevRawGamepadTypes[i] = typeof rawGamepads[i];
+ }
+
+ if (rawGamepads[i])
+ {
+ this._rawPads.push(rawGamepads[i]);
+ }
+
+ // Support max 4 pads at the moment
+ if (i === 3)
+ {
+ break;
+ }
+ }
+
+ if (gamepadsChanged)
+ {
+ var validConnections = { rawIndices: {}, padIndices: {} };
+ var singlePad;
+
+ for (var j = 0; j < this._gamepads.length; j++)
+ {
+ singlePad = this._gamepads[j];
+
+ if (singlePad.connected)
+ {
+ for (var k = 0; k < this._rawPads.length; k++)
+ {
+ if (this._rawPads[k].index === singlePad.index)
+ {
+ validConnections.rawIndices[singlePad.index] = true;
+ validConnections.padIndices[j] = true;
+ }
+ }
+ }
+ }
+
+ for (var l = 0; l < this._gamepads.length; l++)
+ {
+ singlePad = this._gamepads[l];
+
+ if (validConnections.padIndices[l])
+ {
+ continue;
+ }
+
+ if (this._rawPads.length < 1)
+ {
+ singlePad.disconnect();
+ }
+
+ for (var m = 0; m < this._rawPads.length; m++)
+ {
+ if (validConnections.padIndices[l])
+ {
+ break;
+ }
+
+ var rawPad = this._rawPads[m];
+
+ if (rawPad)
+ {
+ if (validConnections.rawIndices[rawPad.index])
+ {
+ singlePad.disconnect();
+ continue;
+ }
+ else
+ {
+ singlePad.connect(rawPad);
+ validConnections.rawIndices[rawPad.index] = true;
+ validConnections.padIndices[l] = true;
+ }
+ }
+ else
+ {
+ singlePad.disconnect();
+ }
+ }
+ }
+ }
+ }
+ },
+
+ /**
+ * Sets the deadZone variable for all four gamepads
+ * @method Phaser.Gamepad#setDeadZones
+ */
+ setDeadZones: function (value) {
+
+ for (var i = 0; i < this._gamepads.length; i++)
+ {
+ this._gamepads[i].deadZone = value;
+ }
+
+ },
+
+ /**
+ * Stops the Gamepad event handling.
+ *
+ * @method Phaser.Gamepad#stop
+ */
+ stop: function () {
+
+ this._active = false;
+
+ window.removeEventListener('gamepadconnected', this._ongamepadconnected);
+ window.removeEventListener('gamepaddisconnected', this._ongamepaddisconnected);
+
+ },
+
+ /**
+ * Reset all buttons/axes of all gamepads
+ * @method Phaser.Gamepad#reset
+ */
+ reset: function () {
+
+ this.update();
+
+ for (var i = 0; i < this._gamepads.length; i++)
+ {
+ this._gamepads[i].reset();
+ }
+
+ },
+
+ /**
+ * Returns the "just pressed" state of a button from ANY gamepad connected. Just pressed is considered true if the button was pressed down within the duration given (default 250ms).
+ * @method Phaser.Gamepad#justPressed
+ * @param {number} buttonCode - The buttonCode of the button to check for.
+ * @param {number} [duration=250] - The duration below which the button is considered as being just pressed.
+ * @return {boolean} True if the button is just pressed otherwise false.
+ */
+ justPressed: function (buttonCode, duration) {
+
+ for (var i = 0; i < this._gamepads.length; i++)
+ {
+ if (this._gamepads[i].justPressed(buttonCode, duration) === true)
+ {
+ return true;
+ }
+ }
+
+ return false;
+
+ },
+
+ /**
+ * Returns the "just released" state of a button from ANY gamepad connected. Just released is considered as being true if the button was released within the duration given (default 250ms).
+ * @method Phaser.Gamepad#justPressed
+ * @param {number} buttonCode - The buttonCode of the button to check for.
+ * @param {number} [duration=250] - The duration below which the button is considered as being just released.
+ * @return {boolean} True if the button is just released otherwise false.
+ */
+ justReleased: function (buttonCode, duration) {
+
+ for (var i = 0; i < this._gamepads.length; i++)
+ {
+ if (this._gamepads[i].justReleased(buttonCode, duration) === true)
+ {
+ return true;
+ }
+ }
+
+ return false;
+
+ },
+
+ /**
+ * Returns true if the button is currently pressed down, on ANY gamepad.
+ * @method Phaser.Gamepad#isDown
+ * @param {number} buttonCode - The buttonCode of the button to check for.
+ * @return {boolean} True if a button is currently down.
+ */
+ isDown: function (buttonCode) {
+
+ for (var i = 0; i < this._gamepads.length; i++)
+ {
+ if (this._gamepads[i].isDown(buttonCode) === true)
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+};
+
+Phaser.Gamepad.prototype.constructor = Phaser.Gamepad;
+
+/**
+* If the gamepad input is active or not - if not active it should not be updated from Input.js
+* @name Phaser.Gamepad#active
+* @property {boolean} active - If the gamepad input is active or not.
+* @readonly
+*/
+Object.defineProperty(Phaser.Gamepad.prototype, "active", {
+
+ get: function () {
+ return this._active;
+ }
+
+});
+
+/**
+* Whether or not gamepads are supported in current browser.
+* @name Phaser.Gamepad#supported
+* @property {boolean} supported - Whether or not gamepads are supported in current browser.
+* @readonly
+*/
+Object.defineProperty(Phaser.Gamepad.prototype, "supported", {
+
+ get: function () {
+ return this._gamepadSupportAvailable;
+ }
+
+});
+
+/**
+* How many live gamepads are currently connected.
+* @name Phaser.Gamepad#padsConnected
+* @property {boolean} padsConnected - How many live gamepads are currently connected.
+* @readonly
+*/
+Object.defineProperty(Phaser.Gamepad.prototype, "padsConnected", {
+
+ get: function () {
+ return this._rawPads.length;
+ }
+
+});
+
+/**
+* Gamepad #1
+* @name Phaser.Gamepad#pad1
+* @property {boolean} pad1 - Gamepad #1;
+* @readonly
+*/
+Object.defineProperty(Phaser.Gamepad.prototype, "pad1", {
+
+ get: function () {
+ return this._gamepads[0];
+ }
+
+});
+
+/**
+* Gamepad #2
+* @name Phaser.Gamepad#pad2
+* @property {boolean} pad2 - Gamepad #2
+* @readonly
+*/
+Object.defineProperty(Phaser.Gamepad.prototype, "pad2", {
+
+ get: function () {
+ return this._gamepads[1];
+ }
+
+});
+
+/**
+* Gamepad #3
+* @name Phaser.Gamepad#pad3
+* @property {boolean} pad3 - Gamepad #3
+* @readonly
+*/
+Object.defineProperty(Phaser.Gamepad.prototype, "pad3", {
+
+ get: function () {
+ return this._gamepads[2];
+ }
+
+});
+
+/**
+* Gamepad #4
+* @name Phaser.Gamepad#pad4
+* @property {boolean} pad4 - Gamepad #4
+* @readonly
+*/
+Object.defineProperty(Phaser.Gamepad.prototype, "pad4", {
+
+ get: function () {
+ return this._gamepads[3];
+ }
+
+});
+
+Phaser.Gamepad.BUTTON_0 = 0;
+Phaser.Gamepad.BUTTON_1 = 1;
+Phaser.Gamepad.BUTTON_2 = 2;
+Phaser.Gamepad.BUTTON_3 = 3;
+Phaser.Gamepad.BUTTON_4 = 4;
+Phaser.Gamepad.BUTTON_5 = 5;
+Phaser.Gamepad.BUTTON_6 = 6;
+Phaser.Gamepad.BUTTON_7 = 7;
+Phaser.Gamepad.BUTTON_8 = 8;
+Phaser.Gamepad.BUTTON_9 = 9;
+Phaser.Gamepad.BUTTON_10 = 10;
+Phaser.Gamepad.BUTTON_11 = 11;
+Phaser.Gamepad.BUTTON_12 = 12;
+Phaser.Gamepad.BUTTON_13 = 13;
+Phaser.Gamepad.BUTTON_14 = 14;
+Phaser.Gamepad.BUTTON_15 = 15;
+
+Phaser.Gamepad.AXIS_0 = 0;
+Phaser.Gamepad.AXIS_1 = 1;
+Phaser.Gamepad.AXIS_2 = 2;
+Phaser.Gamepad.AXIS_3 = 3;
+Phaser.Gamepad.AXIS_4 = 4;
+Phaser.Gamepad.AXIS_5 = 5;
+Phaser.Gamepad.AXIS_6 = 6;
+Phaser.Gamepad.AXIS_7 = 7;
+Phaser.Gamepad.AXIS_8 = 8;
+Phaser.Gamepad.AXIS_9 = 9;
+
+// Below mapping applies to XBOX 360 Wired and Wireless controller on Google Chrome (tested on Windows 7).
+// - Firefox uses different map! Separate amount of buttons and axes. DPAD = axis and not a button.
+// In other words - discrepancies when using gamepads.
+
+Phaser.Gamepad.XBOX360_A = 0;
+Phaser.Gamepad.XBOX360_B = 1;
+Phaser.Gamepad.XBOX360_X = 2;
+Phaser.Gamepad.XBOX360_Y = 3;
+Phaser.Gamepad.XBOX360_LEFT_BUMPER = 4;
+Phaser.Gamepad.XBOX360_RIGHT_BUMPER = 5;
+Phaser.Gamepad.XBOX360_LEFT_TRIGGER = 6;
+Phaser.Gamepad.XBOX360_RIGHT_TRIGGER = 7;
+Phaser.Gamepad.XBOX360_BACK = 8;
+Phaser.Gamepad.XBOX360_START = 9;
+Phaser.Gamepad.XBOX360_STICK_LEFT_BUTTON = 10;
+Phaser.Gamepad.XBOX360_STICK_RIGHT_BUTTON = 11;
+
+Phaser.Gamepad.XBOX360_DPAD_LEFT = 14;
+Phaser.Gamepad.XBOX360_DPAD_RIGHT = 15;
+Phaser.Gamepad.XBOX360_DPAD_UP = 12;
+Phaser.Gamepad.XBOX360_DPAD_DOWN = 13;
+
+Phaser.Gamepad.XBOX360_STICK_LEFT_X = 0;
+Phaser.Gamepad.XBOX360_STICK_LEFT_Y = 1;
+Phaser.Gamepad.XBOX360_STICK_RIGHT_X = 2;
+Phaser.Gamepad.XBOX360_STICK_RIGHT_Y = 3;
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
+
+
+
+
+ Documentation generated by JSDoc 3.3.0-dev
+ on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template .
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/docs/GamepadButton.js.html b/docs/GamepadButton.js.html
new file mode 100644
index 00000000..e4982105
--- /dev/null
+++ b/docs/GamepadButton.js.html
@@ -0,0 +1,654 @@
+
+
+
+
+
+ Phaser Source: input/GamepadButton.js
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Source: input/GamepadButton.js
+
+
+
+ /**
+* @author @karlmacklin <tacklemcclean@gmail.com>
+* @copyright 2014 Photon Storm Ltd.
+* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+*/
+
+/**
+* @class Phaser.GamepadButton
+* @classdesc If you need more fine-grained control over the handling of specific buttons you can create and use Phaser.GamepadButton objects.
+* @constructor
+* @param {Phaser.Game} game - Current game instance.
+* @param {number} buttoncode - The button code this GamepadButton is responsible for.
+*/
+Phaser.GamepadButton = function (game, buttoncode) {
+
+ /**
+ * @property {Phaser.Game} game - A reference to the currently running game.
+ */
+ this.game = game;
+
+ /**
+ * @property {boolean} isDown - The "down" state of the button.
+ * @default
+ */
+ this.isDown = false;
+
+ /**
+ * @property {boolean} isUp - The "up" state of the button.
+ * @default
+ */
+ this.isUp = false;
+
+ /**
+ * @property {number} timeDown - The timestamp when the button was last pressed down.
+ * @default
+ */
+ this.timeDown = 0;
+
+ /**
+ * If the button is down this value holds the duration of that button press and is constantly updated.
+ * If the button is up it holds the duration of the previous down session.
+ * @property {number} duration - The number of milliseconds this button has been held down for.
+ * @default
+ */
+ this.duration = 0;
+
+ /**
+ * @property {number} timeUp - The timestamp when the button was last released.
+ * @default
+ */
+ this.timeUp = 0;
+
+ /**
+ * @property {number} repeats - If a button is held down this holds down the number of times the button has 'repeated'.
+ * @default
+ */
+ this.repeats = 0;
+
+ /**
+ * @property {number} value - Button value. Mainly useful for checking analog buttons (like shoulder triggers)
+ * @default
+ */
+ this.value = 0;
+
+ /**
+ * @property {number} buttonCode - The buttoncode of this button.
+ */
+ this.buttonCode = buttoncode;
+
+ /**
+ * @property {Phaser.Signal} onDown - This Signal is dispatched every time this GamepadButton is pressed down. It is only dispatched once (until the button is released again).
+ */
+ this.onDown = new Phaser.Signal();
+
+ /**
+ * @property {Phaser.Signal} onUp - This Signal is dispatched every time this GamepadButton is pressed down. It is only dispatched once (until the button is released again).
+ */
+ this.onUp = new Phaser.Signal();
+
+ /**
+ * @property {Phaser.Signal} onFloat - This Signal is dispatched every time this GamepadButton changes floating value (between (but not exactly) 0 and 1)
+ */
+ this.onFloat = new Phaser.Signal();
+
+};
+
+Phaser.GamepadButton.prototype = {
+
+ /**
+ * Called automatically by Phaser.SinglePad.
+ * @method Phaser.GamepadButton#processButtonDown
+ * @param {Object} value - Button value
+ * @protected
+ */
+ processButtonDown: function (value) {
+
+ if (this.isDown)
+ {
+ this.duration = this.game.time.now - this.timeDown;
+ this.repeats++;
+ }
+ else
+ {
+ this.isDown = true;
+ this.isUp = false;
+ this.timeDown = this.game.time.now;
+ this.duration = 0;
+ this.repeats = 0;
+ this.value = value;
+
+ this.onDown.dispatch(this, value);
+ }
+
+ },
+
+ /**
+ * Called automatically by Phaser.SinglePad.
+ * @method Phaser.GamepadButton#processButtonUp
+ * @param {Object} value - Button value
+ * @protected
+ */
+ processButtonUp: function (value) {
+
+ this.isDown = false;
+ this.isUp = true;
+ this.timeUp = this.game.time.now;
+ this.value = value;
+
+ this.onUp.dispatch(this, value);
+
+ },
+
+ /**
+ * Called automatically by Phaser.Gamepad.
+ * @method Phaser.GamepadButton#processButtonFloat
+ * @param {Object} value - Button value
+ * @protected
+ */
+ processButtonFloat: function (value) {
+
+ this.value = value;
+ this.onFloat.dispatch(this, value);
+
+ },
+
+ /**
+ * Returns the "just pressed" state of this button. Just pressed is considered true if the button was pressed down within the duration given (default 250ms).
+ * @method Phaser.GamepadButton#justPressed
+ * @param {number} [duration=250] - The duration below which the button is considered as being just pressed.
+ * @return {boolean} True if the button is just pressed otherwise false.
+ */
+ justPressed: function (duration) {
+
+ if (typeof duration === "undefined") { duration = 250; }
+
+ return (this.isDown && this.duration < duration);
+
+ },
+
+ /**
+ * Returns the "just released" state of this button. Just released is considered as being true if the button was released within the duration given (default 250ms).
+ * @method Phaser.GamepadButton#justPressed
+ * @param {number} [duration=250] - The duration below which the button is considered as being just released.
+ * @return {boolean} True if the button is just pressed otherwise false.
+ */
+ justReleased: function (duration) {
+
+ if (typeof duration === "undefined") { duration = 250; }
+
+ return (this.isDown === false && (this.game.time.now - this.timeUp < duration));
+ }
+
+};
+
+Phaser.GamepadButton.prototype.constructor = Phaser.GamepadButton;
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
+
+
+
+
+ Documentation generated by JSDoc 3.3.0-dev
+ on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template .
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/docs/Graphics.js.html b/docs/Graphics.js.html
index abb78deb..4c11d8b7 100644
--- a/docs/Graphics.js.html
+++ b/docs/Graphics.js.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -423,7 +417,7 @@
/**
* @author Richard Davey <rich@photonstorm.com>
-* @copyright 2013 Photon Storm Ltd.
+* @copyright 2014 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -540,13 +534,13 @@ Object.defineProperty(Phaser.Graphics.prototype, 'y', {
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:25 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Group.js.html b/docs/Group.js.html
index cfb22006..55d13f2c 100644
--- a/docs/Group.js.html
+++ b/docs/Group.js.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -423,7 +417,7 @@
/**
* @author Richard Davey <rich@photonstorm.com>
-* @copyright 2013 Photon Storm Ltd.
+* @copyright 2014 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -433,32 +427,32 @@
* @classdesc A Group is a container for display objects that allows for fast pooling, recycling and collision checks.
* @constructor
* @param {Phaser.Game} game - A reference to the currently running game.
-* @param {*} parent - The parent Group or DisplayObjectContainer that will hold this group, if any.
+* @param {*} parent - The parent Group or DisplayObjectContainer that will hold this group, if any. If undefined it will use game.world.
* @param {string} [name=group] - A name for this Group. Not used internally but useful for debugging.
* @param {boolean} [useStage=false] - Should the DisplayObjectContainer this Group creates be added to the World (default, false) or direct to the Stage (true).
*/
Phaser.Group = function (game, parent, name, useStage) {
- if (typeof parent === 'undefined' || typeof parent === null)
+ /**
+ * @property {Phaser.Game} game - A reference to the currently running Game.
+ */
+ this.game = game;
+
+ if (typeof parent === 'undefined')
{
parent = game.world;
}
+ /**
+ * @property {string} name - A name for this Group. Not used internally but useful for debugging.
+ */
+ this.name = name || 'group';
+
if (typeof useStage === 'undefined')
{
useStage = false;
}
- /**
- * @property {Phaser.Game} game - A reference to the currently running Game.
- */
- this.game = game;
-
- /**
- * @property {string} name - A name for this Group. Not used internally but useful for debugging.
- */
- this.name = name || 'group';
-
if (useStage)
{
this._container = this.game.stage._stage;
@@ -473,7 +467,6 @@ Phaser.Group = function (game, parent, name, useStage) {
if (parent instanceof Phaser.Group)
{
parent._container.addChild(this._container);
- parent._container.updateTransform();
}
else
{
@@ -494,6 +487,12 @@ Phaser.Group = function (game, parent, name, useStage) {
*/
this.type = Phaser.GROUP;
+ /**
+ * @property {boolean} alive - The alive property is useful for Groups that are children of other Groups and need to be included/excluded in checks like forEachAlive.
+ * @default
+ */
+ this.alive = true;
+
/**
* @property {boolean} exists - If exists is true the the Group is updated, otherwise it is skipped.
* @default
@@ -501,9 +500,22 @@ Phaser.Group = function (game, parent, name, useStage) {
this.exists = true;
/**
- * @property {Phaser.Point} scale - Replaces the PIXI.Point with a slightly more flexible one.
+ * @property {Phaser.Group} group - The parent Group of this Group, if a child of another.
*/
- this.scale = new Phaser.Point(1, 1);
+ this.group = null;
+
+ // Replaces the PIXI.Point with a slightly more flexible one.
+ this._container.scale = new Phaser.Point(1, 1);
+
+ /**
+ * @property {Phaser.Point} scale - The scane of the Group container.
+ */
+ this.scale = this._container.scale;
+
+ /**
+ * @property {Phaser.Point} pivot - The pivot point of the Group container.
+ */
+ this.pivot = this._container.pivot;
/**
* The cursor is a simple way to iterate through the objects in a Group using the Group.next and Group.previous functions.
@@ -561,16 +573,27 @@ Phaser.Group.prototype = {
if (child.group !== this)
{
- child.group = this;
-
- if (child.events)
+ if (child.type && child.type === Phaser.GROUP)
{
- child.events.onAddedToGroup.dispatch(child, this);
+ child.group = this;
+
+ this._container.addChild(child._container);
+
+ child._container.updateTransform();
}
+ else
+ {
+ child.group = this;
- this._container.addChild(child);
+ this._container.addChild(child);
- child.updateTransform();
+ child.updateTransform();
+
+ if (child.events)
+ {
+ child.events.onAddedToGroup.dispatch(child, this);
+ }
+ }
if (this.cursor === null)
{
@@ -595,16 +618,27 @@ Phaser.Group.prototype = {
if (child.group !== this)
{
- child.group = this;
-
- if (child.events)
+ if (child.type && child.type === Phaser.GROUP)
{
- child.events.onAddedToGroup.dispatch(child, this);
+ child.group = this;
+
+ this._container.addChildAt(child._container, index);
+
+ child._container.updateTransform();
}
+ else
+ {
+ child.group = this;
- this._container.addChildAt(child, index);
+ this._container.addChildAt(child, index);
- child.updateTransform();
+ child.updateTransform();
+
+ if (child.events)
+ {
+ child.events.onAddedToGroup.dispatch(child, this);
+ }
+ }
if (this.cursor === null)
{
@@ -643,7 +677,7 @@ Phaser.Group.prototype = {
*/
create: function (x, y, key, frame, exists) {
- if (typeof exists == 'undefined') { exists = true; }
+ if (typeof exists === 'undefined') { exists = true; }
var child = new Phaser.Sprite(this.game, x, y, key, frame);
@@ -652,15 +686,15 @@ Phaser.Group.prototype = {
child.visible = exists;
child.alive = exists;
+ this._container.addChild(child);
+
+ child.updateTransform();
+
if (child.events)
{
child.events.onAddedToGroup.dispatch(child, this);
}
- this._container.addChild(child);
-
- child.updateTransform();
-
if (this.cursor === null)
{
this.cursor = child;
@@ -683,7 +717,7 @@ Phaser.Group.prototype = {
*/
createMultiple: function (quantity, key, frame, exists) {
- if (typeof exists == 'undefined') { exists = false; }
+ if (typeof exists === 'undefined') { exists = false; }
for (var i = 0; i < quantity; i++)
{
@@ -694,14 +728,15 @@ Phaser.Group.prototype = {
child.visible = exists;
child.alive = exists;
+ this._container.addChild(child);
+
+ child.updateTransform();
+
if (child.events)
{
child.events.onAddedToGroup.dispatch(child, this);
}
- this._container.addChild(child);
- child.updateTransform();
-
if (this.cursor === null)
{
this.cursor = child;
@@ -755,6 +790,11 @@ Phaser.Group.prototype = {
},
+ /**
+ * Internal test.
+ *
+ * @method Phaser.Group#childTest
+ */
childTest: function (prefix, child) {
var s = prefix + ' next: ';
@@ -783,13 +823,16 @@ Phaser.Group.prototype = {
},
+ /**
+ * Internal test.
+ *
+ * @method Phaser.Group#swapIndex
+ */
swapIndex: function (index1, index2) {
var child1 = this.getAt(index1);
var child2 = this.getAt(index2);
- console.log('swapIndex ', index1, ' with ', index2);
-
this.swap(child1, child2);
},
@@ -1054,6 +1097,32 @@ Phaser.Group.prototype = {
},
+ /**
+ * This function allows you to quickly set a property on a single child of this Group to a new value.
+ * The operation parameter controls how the new value is assigned to the property, from simple replacement to addition and multiplication.
+ *
+ * @method Phaser.Group#set
+ * @param {Phaser.Sprite} child - The child to set the property on.
+ * @param {string} key - The property, as a string, to be set. For example: 'body.velocity.x'
+ * @param {*} value - The value that will be set.
+ * @param {boolean} [checkAlive=false] - If set then the child will only be updated if alive=true.
+ * @param {boolean} [checkVisible=false] - If set then the child will only be updated if visible=true.
+ * @param {number} [operation=0] - Controls how the value is assigned. A value of 0 replaces the value with the new one. A value of 1 adds it, 2 subtracts it, 3 multiplies it and 4 divides it.
+ */
+ set: function (child, key, value, checkAlive, checkVisible, operation) {
+
+ key = key.split('.');
+
+ if (typeof checkAlive === 'undefined') { checkAlive = false; }
+ if (typeof checkVisible === 'undefined') { checkVisible = false; }
+
+ if ((checkAlive === false || (checkAlive && child.alive)) && (checkVisible === false || (checkVisible && child.visible)))
+ {
+ this.setProperty(child, key, value, operation);
+ }
+
+ },
+
/**
* This function allows you to quickly set the same property across all children of this Group to a new value.
* The operation parameter controls how the new value is assigned to the property, from simple replacement to addition and multiplication.
@@ -1189,7 +1258,7 @@ Phaser.Group.prototype = {
},
/**
- * Calls a function on all of the children that have exists=true in this Group.
+ * Returns a reference to a function that exists on a child of the Group based on the given callback array.
*
* @method Phaser.Group#callbackFromArray
* @param {object} child - The object to inspect.
@@ -1247,7 +1316,7 @@ Phaser.Group.prototype = {
*
* @method Phaser.Group#callAll
* @param {string} method - A string containing the name of the function that will be called. The function must exist on the child.
- * @param {string} [context=''] - A string containing the context under which the method will be executed. Leave to '' to default to the child.
+ * @param {string} [context=null] - A string containing the context under which the method will be executed. Set to null to default to the child.
* @param {...*} parameter - Additional parameters that will be passed to the method.
*/
callAll: function (method, context) {
@@ -1314,6 +1383,7 @@ Phaser.Group.prototype = {
* Allows you to call your own function on each member of this Group. You must pass the callback and context in which it will run.
* After the checkExists parameter you can add as many parameters as you like, which will all be passed to the callback along with the child.
* For example: Group.forEach(awardBonusGold, this, true, 100, 500)
+ * Note: Currently this will skip any children which are Groups themselves.
*
* @method Phaser.Group#forEach
* @param {function} callback - The function that will be called. Each child of the Group will be passed to it as its first parameter.
@@ -1464,12 +1534,13 @@ Phaser.Group.prototype = {
* @param {number} returnType - How to return the data from this method. Either Phaser.Group.RETURN_NONE, Phaser.Group.RETURN_TOTAL or Phaser.Group.RETURN_CHILD.
* @param {function} [callback=null] - Optional function that will be called on each matching child. Each child of the Group will be passed to it as its first parameter.
* @param {Object} [callbackContext] - The context in which the function should be called (usually 'this').
+ * @return {any} Returns either a numeric total (if RETURN_TOTAL was specified) or the child object.
*/
iterate: function (key, value, returnType, callback, callbackContext, args) {
- if (returnType == Phaser.Group.RETURN_TOTAL && this._container.children.length === 0)
+ if (returnType === Phaser.Group.RETURN_TOTAL && this._container.children.length === 0)
{
- return -1;
+ return 0;
}
if (typeof callback === 'undefined')
@@ -1495,7 +1566,7 @@ Phaser.Group.prototype = {
callback.apply(callbackContext, args);
}
- if (returnType == Phaser.Group.RETURN_CHILD)
+ if (returnType === Phaser.Group.RETURN_CHILD)
{
return currentNode;
}
@@ -1506,11 +1577,11 @@ Phaser.Group.prototype = {
while (currentNode != this._container.last._iNext);
}
- if (returnType == Phaser.Group.RETURN_TOTAL)
+ if (returnType === Phaser.Group.RETURN_TOTAL)
{
return total;
}
- else if (returnType == Phaser.Group.RETURN_CHILD)
+ else if (returnType === Phaser.Group.RETURN_CHILD)
{
return null;
}
@@ -1565,7 +1636,7 @@ Phaser.Group.prototype = {
* Call this function to find out how many members of the group are alive.
*
* @method Phaser.Group#countLiving
- * @return {number} The number of children flagged as alive. Returns -1 if Group is empty.
+ * @return {number} The number of children flagged as alive.
*/
countLiving: function () {
@@ -1577,7 +1648,7 @@ Phaser.Group.prototype = {
* Call this function to find out how many members of the group are dead.
*
* @method Phaser.Group#countDead
- * @return {number} The number of children flagged as dead. Returns -1 if Group is empty.
+ * @return {number} The number of children flagged as dead.
*/
countDead: function () {
@@ -1721,11 +1792,31 @@ Phaser.Group.prototype = {
* Destroys this Group. Removes all children, then removes the container from the display list and nulls references.
*
* @method Phaser.Group#destroy
+ * @param {boolean} [destroyChildren=false] - Should every child of this Group have its destroy method called?
*/
- destroy: function () {
+ destroy: function (destroyChildren) {
- this.removeAll();
+ if (typeof destroyChildren === 'undefined') { destroyChildren = false; }
+ if (destroyChildren)
+ {
+ if (this._container.children.length > 0)
+ {
+ do
+ {
+ if (this._container.children[0].group)
+ {
+ this._container.children[0].destroy();
+ }
+ }
+ while (this._container.children.length > 0);
+ }
+ }
+ else
+ {
+ this.removeAll();
+ }
+
this._container.parent.removeChild(this._container);
this._container = null;
@@ -1778,130 +1869,52 @@ Phaser.Group.prototype = {
return true;
- },
-
- /**
- * Dumps out a list of Group children and their index positions to the browser console. Useful for group debugging.
- *
- * @method Phaser.Group#dump
- * @param {boolean} [full=false] - If full the dump will include the entire display list, start from the Stage. Otherwise it will only include this container.
- */
- dump: function (full) {
-
- if (typeof full == 'undefined')
- {
- full = false;
- }
-
- var spacing = 20;
- var output = "\n" + Phaser.Utils.pad('Node', spacing) + "|" + Phaser.Utils.pad('Next', spacing) + "|" + Phaser.Utils.pad('Previous', spacing) + "|" + Phaser.Utils.pad('First', spacing) + "|" + Phaser.Utils.pad('Last', spacing);
-
- console.log(output);
-
- var output = Phaser.Utils.pad('----------', spacing) + "|" + Phaser.Utils.pad('----------', spacing) + "|" + Phaser.Utils.pad('----------', spacing) + "|" + Phaser.Utils.pad('----------', spacing) + "|" + Phaser.Utils.pad('----------', spacing);
- console.log(output);
-
- if (full)
- {
- var testObject = this.game.stage._stage.last._iNext;
- var displayObject = this.game.stage._stage;
- }
- else
- {
- var testObject = this._container.last._iNext;
- var displayObject = this._container;
- }
-
- do
- {
- var name = displayObject.name || '*';
-
- if (this.cursor == displayObject)
- {
- var name = '> ' + name;
- }
-
- var nameNext = '-';
- var namePrev = '-';
- var nameFirst = '-';
- var nameLast = '-';
-
- if (displayObject._iNext)
- {
- nameNext = displayObject._iNext.name;
- }
-
- if (displayObject._iPrev)
- {
- namePrev = displayObject._iPrev.name;
- }
-
- if (displayObject.first)
- {
- nameFirst = displayObject.first.name;
- }
-
- if (displayObject.last)
- {
- nameLast = displayObject.last.name;
- }
-
- if (typeof nameNext === 'undefined')
- {
- nameNext = '-';
- }
-
- if (typeof namePrev === 'undefined')
- {
- namePrev = '-';
- }
-
- if (typeof nameFirst === 'undefined')
- {
- nameFirst = '-';
- }
-
- if (typeof nameLast === 'undefined')
- {
- nameLast = '-';
- }
-
- var output = Phaser.Utils.pad(name, spacing) + "|" + Phaser.Utils.pad(nameNext, spacing) + "|" + Phaser.Utils.pad(namePrev, spacing) + "|" + Phaser.Utils.pad(nameFirst, spacing) + "|" + Phaser.Utils.pad(nameLast, spacing);
- console.log(output);
-
- displayObject = displayObject._iNext;
-
- }
- while(displayObject != testObject)
-
}
};
+Phaser.Group.prototype.constructor = Phaser.Group;
+
/**
* @name Phaser.Group#total
-* @property {number} total - The total number of children in this Group, regardless of their alive state.
+* @property {number} total - The total number of children in this Group who have a state of exists = true.
* @readonly
*/
Object.defineProperty(Phaser.Group.prototype, "total", {
get: function () {
- return this.iterate('exists', true, Phaser.Group.RETURN_TOTAL);
- // return this._container.children.length;
+
+ if (this._container)
+ {
+ return this.iterate('exists', true, Phaser.Group.RETURN_TOTAL);
+ }
+ else
+ {
+ return 0;
+ }
+
}
});
/**
* @name Phaser.Group#length
-* @property {number} length - The number of children in this Group.
+* @property {number} length - The total number of children in this Group, regardless of their exists/alive status.
* @readonly
*/
Object.defineProperty(Phaser.Group.prototype, "length", {
get: function () {
- return this.iterate('exists', true, Phaser.Group.RETURN_TOTAL);
- // return this._container.children.length;
+
+ if (this._container)
+ {
+ return this._container.children.length;
+ }
+ else
+ {
+ return 0;
+ }
+
}
});
@@ -2024,13 +2037,13 @@ Object.defineProperty(Phaser.Group.prototype, "alpha", {
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:25 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Input.js.html b/docs/Input.js.html
index 8b01fbbb..962827b9 100644
--- a/docs/Input.js.html
+++ b/docs/Input.js.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -423,7 +417,7 @@
/**
* @author Richard Davey <rich@photonstorm.com>
-* @copyright 2013 Photon Storm Ltd.
+* @copyright 2014 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -453,6 +447,16 @@ Phaser.Input = function (game) {
* @default
*/
this.hitContext = null;
+
+ /**
+ * @property {function} moveCallback - An optional callback that will be fired every time the activePointer receives a move event from the DOM. Set to null to disable.
+ */
+ this.moveCallback = null;
+
+ /**
+ * @property {object} moveCallbackContext - The context in which the moveCallback will be sent. Defaults to Phaser.Input but can be set to any valid JS object.
+ */
+ this.moveCallbackContext = this;
};
@@ -729,6 +733,13 @@ Phaser.Input.prototype = {
*/
mspointer: null,
+ /**
+ * The Gamepad Input manager.
+ * @property {Phaser.Gamepad} gamepad - The Gamepad Input manager.
+ * @default
+ */
+ gamepad: null,
+
/**
* A Signal that is dispatched each time a pointer is pressed down.
* @property {Phaser.Signal} onDown
@@ -778,6 +789,7 @@ Phaser.Input.prototype = {
this.keyboard = new Phaser.Keyboard(this.game);
this.touch = new Phaser.Touch(this.game);
this.mspointer = new Phaser.MSPointer(this.game);
+ this.gamepad = new Phaser.Gamepad(this.game);
this.onDown = new Phaser.Signal();
this.onUp = new Phaser.Signal();
@@ -817,6 +829,24 @@ Phaser.Input.prototype = {
this.keyboard.stop();
this.touch.stop();
this.mspointer.stop();
+ this.gamepad.stop();
+
+ this.moveCallback = null;
+
+ },
+
+ /**
+ * Sets a callback that is fired every time the activePointer receives a DOM move event such as a mousemove or touchmove.
+ * It will be called every time the activePointer moves, which in a multi-touch game can be a lot of times, so this is best
+ * to only use if you've limited input to a single pointer (i.e. mouse or touch)
+ * @method Phaser.Input#setMoveCallback
+ * @param {function} callback - The callback that will be called each time the activePointer receives a DOM move event.
+ * @param {object} callbackContext - The context in which the callback will be called.
+ */
+ setMoveCallback: function (callback, callbackContext) {
+
+ this.moveCallback = callback;
+ this.moveCallbackContext = callbackContext;
},
@@ -870,6 +900,8 @@ Phaser.Input.prototype = {
this._oldPosition.copyFrom(this.position);
this.mousePointer.update();
+ if (this.gamepad.active) { this.gamepad.update(); }
+
this.pointer1.update();
this.pointer2.update();
@@ -901,6 +933,7 @@ Phaser.Input.prototype = {
this.keyboard.reset();
this.mousePointer.reset();
+ this.gamepad.reset();
for (var i = 1; i <= 10; i++)
{
@@ -911,7 +944,11 @@ Phaser.Input.prototype = {
}
this.currentPointers = 0;
- this.game.stage.canvas.style.cursor = "default";
+
+ if (this.game.canvas.style.cursor !== 'none')
+ {
+ this.game.canvas.style.cursor = 'default';
+ }
if (hard === true)
{
@@ -1108,6 +1145,8 @@ Phaser.Input.prototype = {
};
+Phaser.Input.prototype.constructor = Phaser.Input;
+
/**
* The X coordinate of the most recently active pointer. This value takes game scaling into account automatically. See Pointer.screenX/clientX for source values.
* @name Phaser.Input#x
@@ -1235,13 +1274,13 @@ Object.defineProperty(Phaser.Input.prototype, "worldY", {
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:25 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/InputHandler.js.html b/docs/InputHandler.js.html
index 519c7515..592d86d6 100644
--- a/docs/InputHandler.js.html
+++ b/docs/InputHandler.js.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -423,7 +417,7 @@
/**
* @author Richard Davey <rich@photonstorm.com>
-* @copyright 2013 Photon Storm Ltd.
+* @copyright 2014 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -451,36 +445,6 @@ Phaser.InputHandler = function (sprite) {
*/
this.enabled = false;
- /**
- * @property {Description} parent - Description.
- * @default
- */
- // this.parent = null;
-
- /**
- * @property {Description} next - Linked List
- * @default
- */
- // this.next = null;
-
- /**
- * @property {Description} prev - Description.
- * @default
- */
- // this.prev = null;
-
- /**
- * @property {Description} last - Description.
- * @default
- */
- // this.last = this;
-
- /**
- * @property {Description} first - Description.
- * @default
- */
- // this.first = this;
-
/**
* @property {number} priorityID - The PriorityID controls which Sprite receives an Input event first if they should overlap.
* @default
@@ -547,6 +511,18 @@ Phaser.InputHandler = function (sprite) {
*/
this.snapY = 0;
+ /**
+ * @property {number} snapOffsetX - This defines the top-left X coordinate of the snap grid.
+ * @default
+ */
+ this.snapOffsetX = 0;
+
+ /**
+ * @property {number} snapOffsetY - This defines the top-left Y coordinate of the snap grid..
+ * @default
+ */
+ this.snapOffsetY = 0;
+
/**
* @property {number} pixelPerfect - Should we use pixel perfect hit detection? Warning: expensive. Only enable if you really need it!
* @default
@@ -622,8 +598,6 @@ Phaser.InputHandler.prototype = {
*/
start: function (priority, useHandCursor) {
- console.log('InputHandler start');
-
priority = priority || 0;
if (typeof useHandCursor == 'undefined') { useHandCursor = false; }
@@ -1039,7 +1013,7 @@ Phaser.InputHandler.prototype = {
if (this.useHandCursor && this._pointerData[pointer.id].isDragged === false)
{
- this.game.stage.canvas.style.cursor = "pointer";
+ this.game.canvas.style.cursor = "pointer";
}
this.sprite.events.onInputOver.dispatch(this.sprite, pointer);
@@ -1060,7 +1034,7 @@ Phaser.InputHandler.prototype = {
if (this.useHandCursor && this._pointerData[pointer.id].isDragged === false)
{
- this.game.stage.canvas.style.cursor = "default";
+ this.game.canvas.style.cursor = "default";
}
if (this.sprite && this.sprite.events)
@@ -1121,15 +1095,18 @@ Phaser.InputHandler.prototype = {
// Only release the InputUp signal if the pointer is still over this sprite
if (this.checkPointerOver(pointer))
{
- //console.log('releasedHandler: ' + Date.now());
- this.sprite.events.onInputUp.dispatch(this.sprite, pointer);
+ // Release the inputUp signal and provide optional parameter if pointer is still over the sprite or not
+ this.sprite.events.onInputUp.dispatch(this.sprite, pointer, true);
}
else
{
+ // Release the inputUp signal and provide optional parameter if pointer is still over the sprite or not
+ this.sprite.events.onInputUp.dispatch(this.sprite, pointer, false);
+
// Pointer outside the sprite? Reset the cursor
if (this.useHandCursor)
{
- this.game.stage.canvas.style.cursor = "default";
+ this.game.canvas.style.cursor = "default";
}
}
@@ -1156,30 +1133,61 @@ Phaser.InputHandler.prototype = {
return false;
}
- if (this.allowHorizontalDrag)
+ if (this.sprite.fixedToCamera)
{
- this.sprite.x = pointer.x + this._dragPoint.x + this.dragOffset.x;
- }
+ if (this.allowHorizontalDrag)
+ {
+ this.sprite.cameraOffset.x = pointer.x + this._dragPoint.x + this.dragOffset.x;
+ }
- if (this.allowVerticalDrag)
- {
- this.sprite.y = pointer.y + this._dragPoint.y + this.dragOffset.y;
- }
+ if (this.allowVerticalDrag)
+ {
+ this.sprite.cameraOffset.y = pointer.y + this._dragPoint.y + this.dragOffset.y;
+ }
- if (this.boundsRect)
- {
- this.checkBoundsRect();
- }
+ if (this.boundsRect)
+ {
+ this.checkBoundsRect();
+ }
- if (this.boundsSprite)
- {
- this.checkBoundsSprite();
- }
+ if (this.boundsSprite)
+ {
+ this.checkBoundsSprite();
+ }
- if (this.snapOnDrag)
+ if (this.snapOnDrag)
+ {
+ this.sprite.cameraOffset.x = Math.round((this.sprite.cameraOffset.x - (this.snapOffsetX % this.snapX)) / this.snapX) * this.snapX + (this.snapOffsetX % this.snapX);
+ this.sprite.cameraOffset.y = Math.round((this.sprite.cameraOffset.y - (this.snapOffsetY % this.snapY)) / this.snapY) * this.snapY + (this.snapOffsetY % this.snapY);
+ }
+ }
+ else
{
- this.sprite.x = Math.round(this.sprite.x / this.snapX) * this.snapX;
- this.sprite.y = Math.round(this.sprite.y / this.snapY) * this.snapY;
+ if (this.allowHorizontalDrag)
+ {
+ this.sprite.x = pointer.x + this._dragPoint.x + this.dragOffset.x;
+ }
+
+ if (this.allowVerticalDrag)
+ {
+ this.sprite.y = pointer.y + this._dragPoint.y + this.dragOffset.y;
+ }
+
+ if (this.boundsRect)
+ {
+ this.checkBoundsRect();
+ }
+
+ if (this.boundsSprite)
+ {
+ this.checkBoundsSprite();
+ }
+
+ if (this.snapOnDrag)
+ {
+ this.sprite.x = Math.round((this.sprite.x - (this.snapOffsetX % this.snapX)) / this.snapX) * this.snapX + (this.snapOffsetX % this.snapX);
+ this.sprite.y = Math.round((this.sprite.y - (this.snapOffsetY % this.snapY)) / this.snapY) * this.snapY + (this.snapOffsetY % this.snapY);
+ }
}
return true;
@@ -1359,14 +1367,29 @@ Phaser.InputHandler.prototype = {
this._draggedPointerID = pointer.id;
this._pointerData[pointer.id].isDragged = true;
- if (this.dragFromCenter)
+ if (this.sprite.fixedToCamera)
{
- this.sprite.centerOn(pointer.x, pointer.y);
- this._dragPoint.setTo(this.sprite.x - pointer.x, this.sprite.y - pointer.y);
+ if (this.dragFromCenter)
+ {
+ this.sprite.centerOn(pointer.x, pointer.y);
+ this._dragPoint.setTo(this.sprite.cameraOffset.x - pointer.x, this.sprite.cameraOffset.y - pointer.y);
+ }
+ else
+ {
+ this._dragPoint.setTo(this.sprite.cameraOffset.x - pointer.x, this.sprite.cameraOffset.y - pointer.y);
+ }
}
else
{
- this._dragPoint.setTo(this.sprite.x - pointer.x, this.sprite.y - pointer.y);
+ if (this.dragFromCenter)
+ {
+ this.sprite.centerOn(pointer.x, pointer.y);
+ this._dragPoint.setTo(this.sprite.x - pointer.x, this.sprite.y - pointer.y);
+ }
+ else
+ {
+ this._dragPoint.setTo(this.sprite.x - pointer.x, this.sprite.y - pointer.y);
+ }
}
this.updateDrag(pointer);
@@ -1393,8 +1416,16 @@ Phaser.InputHandler.prototype = {
if (this.snapOnRelease)
{
- this.sprite.x = Math.round(this.sprite.x / this.snapX) * this.snapX;
- this.sprite.y = Math.round(this.sprite.y / this.snapY) * this.snapY;
+ if (this.sprite.fixedToCamera)
+ {
+ this.sprite.cameraOffset.x = Math.round((this.sprite.cameraOffset.x - (this.snapOffsetX % this.snapX)) / this.snapX) * this.snapX + (this.snapOffsetX % this.snapX);
+ this.sprite.cameraOffset.y = Math.round((this.sprite.cameraOffset.y - (this.snapOffsetY % this.snapY)) / this.snapY) * this.snapY + (this.snapOffsetY % this.snapY);
+ }
+ else
+ {
+ this.sprite.x = Math.round((this.sprite.x - (this.snapOffsetX % this.snapX)) / this.snapX) * this.snapX + (this.snapOffsetX % this.snapX);
+ this.sprite.y = Math.round((this.sprite.y - (this.snapOffsetY % this.snapY)) / this.snapY) * this.snapY + (this.snapOffsetY % this.snapY);
+ }
}
this.sprite.events.onDragStop.dispatch(this.sprite, pointer);
@@ -1431,14 +1462,20 @@ Phaser.InputHandler.prototype = {
* @param {number} snapY - The height of the grid cell to snap to.
* @param {boolean} [onDrag=true] - If true the sprite will snap to the grid while being dragged.
* @param {boolean} [onRelease=false] - If true the sprite will snap to the grid when released.
+ * @param {number} [snapOffsetX=0] - Used to offset the top-left starting point of the snap grid.
+ * @param {number} [snapOffsetX=0] - Used to offset the top-left starting point of the snap grid.
*/
- enableSnap: function (snapX, snapY, onDrag, onRelease) {
+ enableSnap: function (snapX, snapY, onDrag, onRelease, snappOffsetX, snappOffsetY) {
if (typeof onDrag == 'undefined') { onDrag = true; }
if (typeof onRelease == 'undefined') { onRelease = false; }
+ if (typeof snapOffsetX == 'undefined') { snapOffsetX = 0; }
+ if (typeof snapOffsetY == 'undefined') { snapOffsetY = 0; }
this.snapX = snapX;
this.snapY = snapY;
+ this.snapOffsetX = snapOffsetX;
+ this.snapOffsetY = snapOffsetY;
this.snapOnDrag = onDrag;
this.snapOnRelease = onRelease;
@@ -1461,22 +1498,45 @@ Phaser.InputHandler.prototype = {
*/
checkBoundsRect: function () {
- if (this.sprite.x < this.boundsRect.left)
+ if (this.sprite.fixedToCamera)
{
- this.sprite.x = this.boundsRect.x;
- }
- else if ((this.sprite.x + this.sprite.width) > this.boundsRect.right)
- {
- this.sprite.x = this.boundsRect.right - this.sprite.width;
- }
+ if (this.sprite.cameraOffset.x < this.boundsRect.left)
+ {
+ this.sprite.cameraOffset.x = this.boundsRect.cameraOffset.x;
+ }
+ else if ((this.sprite.cameraOffset.x + this.sprite.width) > this.boundsRect.right)
+ {
+ this.sprite.cameraOffset.x = this.boundsRect.right - this.sprite.width;
+ }
- if (this.sprite.y < this.boundsRect.top)
- {
- this.sprite.y = this.boundsRect.top;
+ if (this.sprite.cameraOffset.y < this.boundsRect.top)
+ {
+ this.sprite.cameraOffset.y = this.boundsRect.top;
+ }
+ else if ((this.sprite.cameraOffset.y + this.sprite.height) > this.boundsRect.bottom)
+ {
+ this.sprite.cameraOffset.y = this.boundsRect.bottom - this.sprite.height;
+ }
}
- else if ((this.sprite.y + this.sprite.height) > this.boundsRect.bottom)
+ else
{
- this.sprite.y = this.boundsRect.bottom - this.sprite.height;
+ if (this.sprite.x < this.boundsRect.left)
+ {
+ this.sprite.x = this.boundsRect.x;
+ }
+ else if ((this.sprite.x + this.sprite.width) > this.boundsRect.right)
+ {
+ this.sprite.x = this.boundsRect.right - this.sprite.width;
+ }
+
+ if (this.sprite.y < this.boundsRect.top)
+ {
+ this.sprite.y = this.boundsRect.top;
+ }
+ else if ((this.sprite.y + this.sprite.height) > this.boundsRect.bottom)
+ {
+ this.sprite.y = this.boundsRect.bottom - this.sprite.height;
+ }
}
},
@@ -1487,27 +1547,53 @@ Phaser.InputHandler.prototype = {
*/
checkBoundsSprite: function () {
- if (this.sprite.x < this.boundsSprite.x)
+ if (this.sprite.fixedToCamera && this.boundsSprite.fixedToCamera)
{
- this.sprite.x = this.boundsSprite.x;
- }
- else if ((this.sprite.x + this.sprite.width) > (this.boundsSprite.x + this.boundsSprite.width))
- {
- this.sprite.x = (this.boundsSprite.x + this.boundsSprite.width) - this.sprite.width;
- }
+ if (this.sprite.cameraOffset.x < this.boundsSprite.camerOffset.x)
+ {
+ this.sprite.cameraOffset.x = this.boundsSprite.camerOffset.x;
+ }
+ else if ((this.sprite.cameraOffset.x + this.sprite.width) > (this.boundsSprite.camerOffset.x + this.boundsSprite.width))
+ {
+ this.sprite.cameraOffset.x = (this.boundsSprite.camerOffset.x + this.boundsSprite.width) - this.sprite.width;
+ }
- if (this.sprite.y < this.boundsSprite.y)
- {
- this.sprite.y = this.boundsSprite.y;
+ if (this.sprite.cameraOffset.y < this.boundsSprite.camerOffset.y)
+ {
+ this.sprite.cameraOffset.y = this.boundsSprite.camerOffset.y;
+ }
+ else if ((this.sprite.cameraOffset.y + this.sprite.height) > (this.boundsSprite.camerOffset.y + this.boundsSprite.height))
+ {
+ this.sprite.cameraOffset.y = (this.boundsSprite.camerOffset.y + this.boundsSprite.height) - this.sprite.height;
+ }
}
- else if ((this.sprite.y + this.sprite.height) > (this.boundsSprite.y + this.boundsSprite.height))
+ else
{
- this.sprite.y = (this.boundsSprite.y + this.boundsSprite.height) - this.sprite.height;
+ if (this.sprite.x < this.boundsSprite.x)
+ {
+ this.sprite.x = this.boundsSprite.x;
+ }
+ else if ((this.sprite.x + this.sprite.width) > (this.boundsSprite.x + this.boundsSprite.width))
+ {
+ this.sprite.x = (this.boundsSprite.x + this.boundsSprite.width) - this.sprite.width;
+ }
+
+ if (this.sprite.y < this.boundsSprite.y)
+ {
+ this.sprite.y = this.boundsSprite.y;
+ }
+ else if ((this.sprite.y + this.sprite.height) > (this.boundsSprite.y + this.boundsSprite.height))
+ {
+ this.sprite.y = (this.boundsSprite.y + this.boundsSprite.height) - this.sprite.height;
+ }
}
}
-};
+};
+
+Phaser.InputHandler.prototype.constructor = Phaser.InputHandler;
+
@@ -1522,13 +1608,13 @@ Phaser.InputHandler.prototype = {
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:25 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/IntroDocs.js.html b/docs/IntroDocs.js.html
index 9efbd205..664fba12 100644
--- a/docs/IntroDocs.js.html
+++ b/docs/IntroDocs.js.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -381,7 +405,7 @@
-
- Global
-
-
-
-
@@ -423,7 +417,7 @@
/**
* @author Richard Davey <rich@photonstorm.com>
-* @copyright 2013 Photon Storm Ltd.
+* @copyright 2014 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -592,6 +586,8 @@ Phaser.Key.prototype = {
}
};
+
+Phaser.Key.prototype.constructor = Phaser.Key;
@@ -607,13 +603,13 @@ Phaser.Key.prototype = {
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:25 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Keyboard.js.html b/docs/Keyboard.js.html
index d7d6010a..4b428a4c 100644
--- a/docs/Keyboard.js.html
+++ b/docs/Keyboard.js.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -423,7 +417,7 @@
/**
* @author Richard Davey <rich@photonstorm.com>
-* @copyright 2013 Photon Storm Ltd.
+* @copyright 2014 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -523,7 +517,7 @@ Phaser.Keyboard.prototype = {
* The Key object can then be polled, have events attached to it, etc.
*
* @method Phaser.Keyboard#addKey
- * @param {number} keycode - The keycode of the key, i.e. Phaser.Keyboard.UP or Phaser.Keyboard.SPACE_BAR
+ * @param {number} keycode - The keycode of the key, i.e. Phaser.Keyboard.UP or Phaser.Keyboard.SPACEBAR
* @return {Phaser.Key} The Key object which you can store locally and reference directly.
*/
addKey: function (keycode) {
@@ -540,7 +534,7 @@ Phaser.Keyboard.prototype = {
* Removes a Key object from the Keyboard manager.
*
* @method Phaser.Keyboard#removeKey
- * @param {number} keycode - The keycode of the key to remove, i.e. Phaser.Keyboard.UP or Phaser.Keyboard.SPACE_BAR
+ * @param {number} keycode - The keycode of the key to remove, i.e. Phaser.Keyboard.UP or Phaser.Keyboard.SPACEBAR
*/
removeKey: function (keycode) {
@@ -762,7 +756,7 @@ Phaser.Keyboard.prototype = {
/**
* Returns the "just pressed" state of the key. Just pressed is considered true if the key was pressed down within the duration given (default 250ms)
* @method Phaser.Keyboard#justPressed
- * @param {number} keycode - The keycode of the key to remove, i.e. Phaser.Keyboard.UP or Phaser.Keyboard.SPACE_BAR
+ * @param {number} keycode - The keycode of the key to remove, i.e. Phaser.Keyboard.UP or Phaser.Keyboard.SPACEBAR
* @param {number} [duration=250] - The duration below which the key is considered as being just pressed.
* @return {boolean} True if the key is just pressed otherwise false.
*/
@@ -781,8 +775,8 @@ Phaser.Keyboard.prototype = {
/**
* Returns the "just released" state of the Key. Just released is considered as being true if the key was released within the duration given (default 250ms)
- * @method Phaser.Keyboard#justPressed
- * @param {number} keycode - The keycode of the key to remove, i.e. Phaser.Keyboard.UP or Phaser.Keyboard.SPACE_BAR
+ * @method Phaser.Keyboard#justReleased
+ * @param {number} keycode - The keycode of the key to remove, i.e. Phaser.Keyboard.UP or Phaser.Keyboard.SPACEBAR
* @param {number} [duration=250] - The duration below which the key is considered as being just released.
* @return {boolean} True if the key is just released otherwise false.
*/
@@ -802,7 +796,7 @@ Phaser.Keyboard.prototype = {
/**
* Returns true of the key is currently pressed down. Note that it can only detect key presses on the web browser.
* @method Phaser.Keyboard#isDown
- * @param {number} keycode - The keycode of the key to remove, i.e. Phaser.Keyboard.UP or Phaser.Keyboard.SPACE_BAR
+ * @param {number} keycode - The keycode of the key to remove, i.e. Phaser.Keyboard.UP or Phaser.Keyboard.SPACEBAR
* @return {boolean} True if the key is currently down.
*/
isDown: function (keycode) {
@@ -818,6 +812,8 @@ Phaser.Keyboard.prototype = {
};
+Phaser.Keyboard.prototype.constructor = Phaser.Keyboard;
+
Phaser.Keyboard.A = "A".charCodeAt(0);
Phaser.Keyboard.B = "B".charCodeAt(0);
Phaser.Keyboard.C = "C".charCodeAt(0);
@@ -931,13 +927,13 @@ Phaser.Keyboard.NUM_LOCK = 144;
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:25 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Line.js.html b/docs/Line.js.html
new file mode 100644
index 00000000..aa41210f
--- /dev/null
+++ b/docs/Line.js.html
@@ -0,0 +1,743 @@
+
+
+
+
+
+ Phaser Source: geom/Line.js
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Source: geom/Line.js
+
+
+
+ /**
+* @author Richard Davey <rich@photonstorm.com>
+* @copyright 2014 Photon Storm Ltd.
+* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+*/
+
+/**
+* Creates a new Line object with a start and an end point.
+* @class Line
+* @classdesc Phaser - Line
+* @constructor
+* @param {number} [x1=0] - The x coordinate of the start of the line.
+* @param {number} [y1=0] - The y coordinate of the start of the line.
+* @param {number} [x2=0] - The x coordinate of the end of the line.
+* @param {number} [y2=0] - The y coordinate of the end of the line.
+* @return {Phaser.Line} This line object
+*/
+Phaser.Line = function (x1, y1, x2, y2) {
+
+ x1 = x1 || 0;
+ y1 = y1 || 0;
+ x2 = x2 || 0;
+ y2 = y2 || 0;
+
+ /**
+ * @property {Phaser.Point} start - The start point of the line.
+ */
+ this.start = new Phaser.Point(x1, y1);
+
+ /**
+ * @property {Phaser.Point} end - The end point of the line.
+ */
+ this.end = new Phaser.Point(x2, y2);
+
+};
+
+Phaser.Line.prototype = {
+
+ /**
+ * Sets the components of the Line to the specified values.
+ * @method Phaser.Line#setTo
+ * @param {number} [x1=0] - The x coordinate of the start of the line.
+ * @param {number} [y1=0] - The y coordinate of the start of the line.
+ * @param {number} [x2=0] - The x coordinate of the end of the line.
+ * @param {number} [y2=0] - The y coordinate of the end of the line.
+ * @return {Phaser.Line} This line object
+ */
+ setTo: function (x1, y1, x2, y2) {
+
+ this.start.setTo(x1, y1);
+ this.end.setTo(x2, y2);
+
+ return this;
+
+ },
+
+ /**
+ * Sets the line to match the x/y coordinates of the two given sprites.
+ * Can optionally be calculated from their center coordinates.
+ * @method Phaser.Line#fromSprite
+ * @param {Phaser.Sprite} startSprite - The coordinates of this Sprite will be set to the Line.start point.
+ * @param {Phaser.Sprite} endSprite - The coordinates of this Sprite will be set to the Line.start point.
+ * @param {boolean} [useCenter=true] - If true it will use startSprite.center.x, if false startSprite.x.
+ * @return {Phaser.Line} This line object
+ */
+ fromSprite: function (startSprite, endSprite, useCenter) {
+
+ if (typeof useCenter === 'undefined') { useCenter = true; }
+
+ if (useCenter)
+ {
+ return this.setTo(startSprite.center.x, startSprite.center.y, endSprite.center.x, endSprite.center.y);
+ }
+ else
+ {
+ return this.setTo(startSprite.x, startSprite.y, endSprite.x, endSprite.y);
+ }
+
+ },
+
+ /**
+ * Checks for intersection between this line and another Line.
+ * If asSegment is true it will check for segment intersection. If asSegment is false it will check for line intersection.
+ * Returns the intersection segment of AB and EF as a Point, or null if there is no intersection.
+ *
+ * @method Phaser.Line#intersects
+ * @param {Phaser.Line} line - The line to check against this one.
+ * @param {boolean} [asSegment=true] - If true it will check for segment intersection, otherwise full line intersection.
+ * @param {Phaser.Point} [result] - A Point object to store the result in, if not given a new one will be created.
+ * @return {Phaser.Point} The intersection segment of the two lines as a Point, or null if there is no intersection.
+ */
+ intersects: function (line, asSegment, result) {
+
+ return Phaser.Line.intersectsPoints(this.start, this.end, line.start, line.end, asSegment, result);
+
+ },
+
+ /**
+ * Tests if the given coordinates fall on this line. See pointOnSegment to test against just the line segment.
+ * @method Phaser.Line#pointOnLine
+ * @param {number} x - The line to check against this one.
+ * @param {number} y - The line to check against this one.
+ * @return {boolean} True if the point is on the line, false if not.
+ */
+ pointOnLine: function (x, y) {
+
+ return ((x - this.start.x) * (this.end.y - this.end.y) === (this.end.x - this.start.x) * (y - this.end.y));
+
+ },
+
+ /**
+ * Tests if the given coordinates fall on this line and within the segment. See pointOnLine to test against just the line.
+ * @method Phaser.Line#pointOnSegment
+ * @param {number} x - The line to check against this one.
+ * @param {number} y - The line to check against this one.
+ * @return {boolean} True if the point is on the line and segment, false if not.
+ */
+ pointOnSegment: function (x, y) {
+
+ var xMin = Math.min(this.start.x, this.end.x);
+ var xMax = Math.max(this.start.x, this.end.x);
+ var yMin = Math.min(this.start.y, this.end.y);
+ var yMax = Math.max(this.start.y, this.end.y);
+
+ return (this.pointOnLine(x, y) && (x >= xMin && x <= xMax) && (y >= yMin && y <= yMax));
+
+ }
+
+};
+
+/**
+* @name Phaser.Line#length
+* @property {number} length - Gets the length of the line segment.
+* @readonly
+*/
+Object.defineProperty(Phaser.Line.prototype, "length", {
+
+ get: function () {
+ return Math.sqrt((this.end.x - this.start.x) * (this.end.x - this.start.x) + (this.end.y - this.start.y) * (this.end.y - this.start.y));
+ }
+
+});
+
+/**
+* @name Phaser.Line#angle
+* @property {number} angle - Gets the angle of the line.
+* @readonly
+*/
+Object.defineProperty(Phaser.Line.prototype, "angle", {
+
+ get: function () {
+ return Math.atan2(this.end.x - this.start.x, this.end.y - this.start.y);
+ }
+
+});
+
+/**
+* @name Phaser.Line#slope
+* @property {number} slope - Gets the slope of the line (y/x).
+* @readonly
+*/
+Object.defineProperty(Phaser.Line.prototype, "slope", {
+
+ get: function () {
+ return (this.end.y - this.start.y) / (this.end.x - this.start.x);
+ }
+
+});
+
+/**
+* @name Phaser.Line#perpSlope
+* @property {number} perpSlope - Gets the perpendicular slope of the line (x/y).
+* @readonly
+*/
+Object.defineProperty(Phaser.Line.prototype, "perpSlope", {
+
+ get: function () {
+ return -((this.end.x - this.start.x) / (this.end.y - this.start.y));
+ }
+
+});
+
+/**
+* Checks for intersection between two lines as defined by the given start and end points.
+* If asSegment is true it will check for line segment intersection. If asSegment is false it will check for line intersection.
+* Returns the intersection segment of AB and EF as a Point, or null if there is no intersection.
+* Adapted from code by Keith Hair
+*
+* @method Phaser.Line.intersects
+* @param {Phaser.Point} a - The start of the first Line to be checked.
+* @param {Phaser.Point} b - The end of the first line to be checked.
+* @param {Phaser.Point} e - The start of the second Line to be checked.
+* @param {Phaser.Point} f - The end of the second line to be checked.
+* @param {boolean} [asSegment=true] - If true it will check for segment intersection, otherwise full line intersection.
+* @param {Phaser.Point} [result] - A Point object to store the result in, if not given a new one will be created.
+* @return {Phaser.Point} The intersection segment of the two lines as a Point, or null if there is no intersection.
+*/
+Phaser.Line.intersectsPoints = function (a, b, e, f, asSegment, result) {
+
+ if (typeof asSegment === 'undefined') { asSegment = true; }
+ if (typeof result === 'undefined') { result = new Phaser.Point(); }
+
+ var a1 = b.y - a.y;
+ var a2 = f.y - e.y;
+ var b1 = a.x - b.x;
+ var b2 = e.x - f.x;
+ var c1 = (b.x * a.y) - (a.x * b.y);
+ var c2 = (f.x * e.y) - (e.x * f.y);
+ var denom = (a1 * b2) - (a2 * b1);
+
+ if (denom === 0)
+ {
+ return null;
+ }
+
+ result.x = ((b1 * c2) - (b2 * c1)) / denom;
+ result.y = ((a2 * c1) - (a1 * c2)) / denom;
+
+ if (asSegment)
+ {
+ if (Math.pow((result.x - b.x) + (result.y - b.y), 2) > Math.pow((a.x - b.x) + (a.y - b.y), 2))
+ {
+ return null;
+ }
+
+ if (Math.pow((result.x - a.x) + (result.y - a.y), 2) > Math.pow((a.x - b.x) + (a.y - b.y), 2))
+ {
+ return null;
+ }
+
+ if (Math.pow((result.x - f.x) + (result.y - f.y), 2) > Math.pow((e.x - f.x) + (e.y - f.y), 2))
+ {
+ return null;
+ }
+
+ if (Math.pow((result.x - e.x) + (result.y - e.y), 2) > Math.pow((e.x - f.x) + (e.y - f.y), 2))
+ {
+ return null;
+ }
+ }
+
+ return result;
+
+};
+
+/**
+* Checks for intersection between two lines.
+* If asSegment is true it will check for segment intersection.
+* If asSegment is false it will check for line intersection.
+* Returns the intersection segment of AB and EF as a Point, or null if there is no intersection.
+* Adapted from code by Keith Hair
+*
+* @method Phaser.Line.intersects
+* @param {Phaser.Line} a - The first Line to be checked.
+* @param {Phaser.Line} b - The second Line to be checked.
+* @param {boolean} [asSegment=true] - If true it will check for segment intersection, otherwise full line intersection.
+* @param {Phaser.Point} [result] - A Point object to store the result in, if not given a new one will be created.
+* @return {Phaser.Point} The intersection segment of the two lines as a Point, or null if there is no intersection.
+*/
+Phaser.Line.intersects = function (a, b, asSegment, result) {
+
+ return Phaser.Line.intersectsPoints(a.start, a.end, b.start, b.end, asSegment, result);
+
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
+
+
+
+
+ Documentation generated by JSDoc 3.3.0-dev
+ on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template .
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/docs/LinkedList.js.html b/docs/LinkedList.js.html
index 82354172..dce1bbe0 100644
--- a/docs/LinkedList.js.html
+++ b/docs/LinkedList.js.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -423,7 +417,7 @@
/**
* @author Richard Davey <rich@photonstorm.com>
-* @copyright 2013 Photon Storm Ltd.
+* @copyright 2014 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -574,7 +568,10 @@ Phaser.LinkedList.prototype = {
}
-};
+};
+
+Phaser.LinkedList.prototype.constructor = Phaser.LinkedList;
+
@@ -589,13 +586,13 @@ Phaser.LinkedList.prototype = {
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:25 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Loader.js.html b/docs/Loader.js.html
index bd0e0d33..6dde3054 100644
--- a/docs/Loader.js.html
+++ b/docs/Loader.js.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -423,7 +417,7 @@
/**
* @author Richard Davey <rich@photonstorm.com>
-* @copyright 2013 Photon Storm Ltd.
+* @copyright 2014 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -457,7 +451,7 @@ Phaser.Loader = function (game) {
this._fileIndex = 0;
/**
- * @property {number} _progressChunk - Indicates assets loading progress. (from 0 to 100)
+ * @property {number} _progressChunk - Indicates the size of 1 file in terms of a percentage out of 100.
* @private
* @default
*/
@@ -482,15 +476,21 @@ Phaser.Loader = function (game) {
this.hasLoaded = false;
/**
- * @property {number} progress - The Load progress percentage value (from 0 to 100)
+ * @property {number} progress - The rounded load progress percentage value (from 0 to 100)
* @default
*/
this.progress = 0;
+ /**
+ * @property {number} progressFloat - The non-rounded load progress value (from 0.0 to 100.0)
+ * @default
+ */
+ this.progressFloat = 0;
+
/**
* You can optionally link a sprite to the preloader.
* If you do so the Sprite's width or height will be cropped based on the percentage loaded.
- * @property {Description} preloadSprite
+ * @property {Phaser.Sprite} preloadSprite
* @default
*/
this.preloadSprite = null;
@@ -786,6 +786,29 @@ Phaser.Loader.prototype = {
},
+ /**
+ * Add a binary file to the Loader. It will be loaded via xhr with a responseType of "arraybuffer". You can specify an optional callback to process the file after load.
+ * When the callback is called it will be passed 2 parameters: the key of the file and the file data.
+ * WARNING: If you specify a callback, the file data will be set to whatever your callback returns. So always return the data object, even if you didn't modify it.
+ *
+ * @method Phaser.Loader#binary
+ * @param {string} key - Unique asset key of the binary file.
+ * @param {string} url - URL of the binary file.
+ * @param {function} [callback] - Optional callback that will be passed the file after loading, so you can perform additional processing on it.
+ * @param {function} [callbackContext] - The context under which the callback will be applied. If not specified it will use the callback itself as the context.
+ * @return {Phaser.Loader} This Loader instance.
+ */
+ binary: function (key, url, callback, callbackContext) {
+
+ if (typeof callback === 'undefined') { callback = false; }
+ if (callback !== false && typeof callbackContext === 'undefined') { callbackContext = callback; }
+
+ this.addToFileList('binary', key, url, { callback: callback, callbackContext: callbackContext });
+
+ return this;
+
+ },
+
/**
* Add a new sprite sheet to the loader.
*
@@ -795,38 +818,17 @@ Phaser.Loader.prototype = {
* @param {number} frameWidth - Width of each single frame.
* @param {number} frameHeight - Height of each single frame.
* @param {number} [frameMax=-1] - How many frames in this sprite sheet. If not specified it will divide the whole image into frames.
+ * @param {number} [margin=0] - If the frames have been drawn with a margin, specify the amount here.
+ * @param {number} [spacing=0] - If the frames have been drawn with spacing between them, specify the amount here.
* @return {Phaser.Loader} This Loader instance.
*/
- spritesheet: function (key, url, frameWidth, frameHeight, frameMax) {
+ spritesheet: function (key, url, frameWidth, frameHeight, frameMax, margin, spacing) {
if (typeof frameMax === "undefined") { frameMax = -1; }
+ if (typeof margin === "undefined") { margin = 0; }
+ if (typeof spacing === "undefined") { spacing = 0; }
- this.addToFileList('spritesheet', key, url, { frameWidth: frameWidth, frameHeight: frameHeight, frameMax: frameMax });
-
- return this;
-
- },
-
- /**
- * Add a new tile set to the loader. These are used in the rendering of tile maps.
- *
- * @method Phaser.Loader#tileset
- * @param {string} key - Unique asset key of the tileset file.
- * @param {string} url - URL of the tileset.
- * @param {number} tileWidth - Width of each single tile in pixels.
- * @param {number} tileHeight - Height of each single tile in pixels.
- * @param {number} [tileMax=-1] - How many tiles in this tileset. If not specified it will divide the whole image into tiles.
- * @param {number} [tileMargin=0] - If the tiles have been drawn with a margin, specify the amount here.
- * @param {number} [tileSpacing=0] - If the tiles have been drawn with spacing between them, specify the amount here.
- * @return {Phaser.Loader} This Loader instance.
- */
- tileset: function (key, url, tileWidth, tileHeight, tileMax, tileMargin, tileSpacing) {
-
- if (typeof tileMax === "undefined") { tileMax = -1; }
- if (typeof tileMargin === "undefined") { tileMargin = 0; }
- if (typeof tileSpacing === "undefined") { tileSpacing = 0; }
-
- this.addToFileList('tileset', key, url, { tileWidth: tileWidth, tileHeight: tileHeight, tileMax: tileMax, tileMargin: tileMargin, tileSpacing: tileSpacing });
+ this.addToFileList('spritesheet', key, url, { frameWidth: frameWidth, frameHeight: frameHeight, frameMax: frameMax, margin: margin, spacing: spacing });
return this;
@@ -1134,6 +1136,7 @@ Phaser.Loader.prototype = {
}
this.progress = 0;
+ this.progressFloat = 0;
this.hasLoaded = false;
this.isLoading = true;
@@ -1148,6 +1151,7 @@ Phaser.Loader.prototype = {
else
{
this.progress = 100;
+ this.progressFloat = 100;
this.hasLoaded = true;
this.onLoadComplete.dispatch();
}
@@ -1178,7 +1182,6 @@ Phaser.Loader.prototype = {
case 'spritesheet':
case 'textureatlas':
case 'bitmapfont':
- case 'tileset':
file.data = new Image();
file.data.name = file.key;
file.data.onload = function () {
@@ -1269,6 +1272,7 @@ Phaser.Loader.prototype = {
break;
case 'text':
+ case 'script':
this._xhr.open("GET", this.baseURL + file.url, true);
this._xhr.responseType = "text";
this._xhr.onload = function () {
@@ -1280,10 +1284,9 @@ Phaser.Loader.prototype = {
this._xhr.send();
break;
- case 'script':
-
+ case 'binary':
this._xhr.open("GET", this.baseURL + file.url, true);
- this._xhr.responseType = "text";
+ this._xhr.responseType = "arraybuffer";
this._xhr.onload = function () {
return _this.fileComplete(_this._fileIndex);
};
@@ -1356,7 +1359,6 @@ Phaser.Loader.prototype = {
console.warn('Phaser.Loader fileComplete invalid index ' + index);
return;
}
-
var file = this._fileList[index];
file.loaded = true;
@@ -1373,12 +1375,7 @@ Phaser.Loader.prototype = {
case 'spritesheet':
- this.game.cache.addSpriteSheet(file.key, file.url, file.data, file.frameWidth, file.frameHeight, file.frameMax);
- break;
-
- case 'tileset':
-
- this.game.cache.addTileset(file.key, file.url, file.data, file.tileWidth, file.tileHeight, file.tileMax, file.tileMargin, file.tileSpacing);
+ this.game.cache.addSpriteSheet(file.key, file.url, file.data, file.frameWidth, file.frameHeight, file.frameMax, file.margin, file.spacing);
break;
case 'textureatlas':
@@ -1461,6 +1458,7 @@ Phaser.Loader.prototype = {
if (buffer)
{
that.game.cache.decodedSound(key, buffer);
+ that.game.sound.onSoundDecode.dispatch(key, that.game.cache.getSound(key));
}
});
}
@@ -1481,10 +1479,24 @@ Phaser.Loader.prototype = {
file.data = document.createElement('script');
file.data.language = 'javascript';
file.data.type = 'text/javascript';
- file.data.defer = true;
+ file.data.defer = false;
file.data.text = this._xhr.responseText;
document.head.appendChild(file.data);
break;
+
+ case 'binary':
+ if (file.callback)
+ {
+ file.data = file.callback.call(file.callbackContext, file.key, this._xhr.response);
+ }
+ else
+ {
+ file.data = this._xhr.response;
+ }
+
+ this.game.cache.addBinary(file.key, file.data);
+
+ break;
}
if (loadNext)
@@ -1630,7 +1642,8 @@ Phaser.Loader.prototype = {
*/
nextFile: function (previousIndex, success) {
- this.progress = Math.round(this.progress + this._progressChunk);
+ this.progressFloat += this._progressChunk;
+ this.progress = Math.round(this.progressFloat);
if (this.progress > 100)
{
@@ -1713,6 +1726,8 @@ Phaser.Loader.prototype = {
}
};
+
+Phaser.Loader.prototype.constructor = Phaser.Loader;
@@ -1728,13 +1743,13 @@ Phaser.Loader.prototype = {
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:25 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/LoaderParser.js.html b/docs/LoaderParser.js.html
index eefdaba6..bd280b4c 100644
--- a/docs/LoaderParser.js.html
+++ b/docs/LoaderParser.js.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -423,7 +417,7 @@
/**
* @author Richard Davey <rich@photonstorm.com>
-* @copyright 2013 Photon Storm Ltd.
+* @copyright 2014 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -518,13 +512,13 @@ Phaser.LoaderParser = {
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:25 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/MSPointer.js.html b/docs/MSPointer.js.html
index 88f18043..014729ff 100644
--- a/docs/MSPointer.js.html
+++ b/docs/MSPointer.js.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -423,7 +417,7 @@
/**
* @author Richard Davey <rich@photonstorm.com>
-* @copyright 2013 Photon Storm Ltd.
+* @copyright 2014 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -588,7 +582,10 @@ Phaser.MSPointer.prototype = {
}
-};
+};
+
+Phaser.MSPointer.prototype.constructor = Phaser.MSPointer;
+
@@ -603,13 +600,13 @@ Phaser.MSPointer.prototype = {
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:25 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Math.js.html b/docs/Math.js.html
index 087509fe..166ea58e 100644
--- a/docs/Math.js.html
+++ b/docs/Math.js.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -423,7 +417,7 @@
/**
* @author Richard Davey <rich@photonstorm.com>
-* @copyright 2013 Photon Storm Ltd.
+* @copyright 2014 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -750,7 +744,7 @@ Phaser.Math = {
},
/**
- * Find the angle of a segment from (x1, y1) -> (x2, y2 ).
+ * Find the angle of a segment from (x1, y1) -> (x2, y2).
* @method Phaser.Math#angleBetween
* @param {number} x1
* @param {number} y1
@@ -763,24 +757,58 @@ Phaser.Math = {
},
/**
- * Set an angle within the bounds of -π toπ.
- * @method Phaser.Math#normalizeAngle
- * @param {number} angle
- * @param {boolean} radians - True if angle size is expressed in radians.
- * @return {number}
+ * Reverses an angle.
+ * @method Phaser.Math#reverseAngle
+ * @param {number} angleRad - The angle to reverse, in radians.
+ * @return {number} Returns the reverse angle, in radians.
*/
- normalizeAngle: function (angle, radians) {
+ reverseAngle: function (angleRad) {
+ return this.normalizeAngle(angleRad + Math.PI, true);
+ },
- if (typeof radians === "undefined") { radians = true; }
+ /**
+ * Normalizes an angle to the [0,2pi) range.
+ * @method Phaser.Math#normalizeAngle
+ * @param {number} angleRad - The angle to normalize, in radians.
+ * @return {number} Returns the angle, fit within the [0,2pi] range, in radians.
+ */
+ normalizeAngle: function (angleRad) {
- var rd = (radians) ? Math.PI : 180;
- return this.wrap(angle, -rd, rd);
+ angleRad = angleRad % (2 * Math.PI);
+ return angleRad >= 0 ? angleRad : angleRad + 2 * Math.PI;
},
/**
- * Closest angle between two angles from a1 to a2
- * absolute value the return for exact angle
+ * Normalizes a latitude to the [-90,90] range. Latitudes above 90 or below -90 are capped, not wrapped.
+ * @method Phaser.Math#normalizeLatitude
+ * @param {number} lat - The latitude to normalize, in degrees.
+ * @return {number} Returns the latitude, fit within the [-90,90] range.
+ */
+ normalizeLatitude: function (lat) {
+ return Math.max(-90, Math.min(90, lat));
+ },
+
+ /**
+ * Normalizes a longitude to the [-180,180] range. Longitudes above 180 or below -180 are wrapped.
+ * @method Phaser.Math#normalizeLongitude
+ * @param {number} lng - The longitude to normalize, in degrees.
+ * @return {number} Returns the longitude, fit within the [-180,180] range.
+ */
+ normalizeLongitude: function (lng) {
+
+ if (lng % 360 == 180)
+ {
+ return 180;
+ }
+
+ lng = lng % 360;
+ return lng < -180 ? lng + 360 : lng > 180 ? lng - 360 : lng;
+
+ },
+
+ /**
+ * Closest angle between two angles from a1 to a2 absolute value the return for exact angle
* @method Phaser.Math#nearestAngleBetween
* @param {number} a1
* @param {number} a2
@@ -934,13 +962,13 @@ Phaser.Math = {
/**
* Ensures that the value always stays between min and max, by wrapping the value around.
- * <p>max should be larger than min, or the function will return 0</p>
+ * max should be larger than min, or the function will return 0.
*
* @method Phaser.Math#wrap
- * @param value The value to wrap
- * @param min The minimum the value is allowed to be
- * @param max The maximum the value is allowed to be
- * @return {number} The wrapped value
+ * @param {number} value - The value to wrap.
+ * @param {number} min - The minimum the value is allowed to be.
+ * @param {number} max - The maximum the value is allowed to be.
+ * @return {number} The wrapped value.
*/
wrap: function (value, min, max) {
@@ -1049,7 +1077,7 @@ Phaser.Math = {
},
/**
- * Significantly faster version of Math.min
+ * Updated version of Math.min that can be passed either an array of numbers or the numbers as parameters.
* See http://jsperf.com/math-s-min-max-vs-homemade/5
*
* @method Phaser.Math#min
@@ -1057,15 +1085,113 @@ Phaser.Math = {
*/
min: function () {
- for (var i =1 , min = 0, len = arguments.length; i < len; i++)
+ if (arguments.length === 1 && typeof arguments[0] === 'object')
{
- if (arguments[i] < arguments[min])
+ var data = arguments[0];
+ }
+ else
+ {
+ var data = arguments;
+ }
+
+ for (var i = 1, min = 0, len = data.length; i < len; i++)
+ {
+ if (data[i] < data[min])
{
min = i;
}
}
- return arguments[min];
+ return data[min];
+
+ },
+
+ /**
+ * Updated version of Math.max that can be passed either an array of numbers or the numbers as parameters.
+ *
+ * @method Phaser.Math#max
+ * @return {number} The largest value from those given.
+ */
+ max: function () {
+
+ if (arguments.length === 1 && typeof arguments[0] === 'object')
+ {
+ var data = arguments[0];
+ }
+ else
+ {
+ var data = arguments;
+ }
+
+ for (var i = 1, max = 0, len = data.length; i < len; i++)
+ {
+ if (data[i] > data[max])
+ {
+ max = i;
+ }
+ }
+
+ return data[max];
+
+ },
+
+ /**
+ * Updated version of Math.min that can be passed a property and either an array of objects or the objects as parameters.
+ * It will find the lowest matching property value from the given objects.
+ *
+ * @method Phaser.Math#minProperty
+ * @return {number} The lowest value from those given.
+ */
+ minProperty: function (property) {
+
+ if (arguments.length === 2 && typeof arguments[1] === 'object')
+ {
+ var data = arguments[1];
+ }
+ else
+ {
+ var data = arguments.slice(1);
+ }
+
+ for (var i = 1, min = 0, len = data.length; i < len; i++)
+ {
+ if (data[i][property] < data[min][property])
+ {
+ min = i;
+ }
+ }
+
+ return data[min][property];
+
+ },
+
+ /**
+ * Updated version of Math.max that can be passed a property and either an array of objects or the objects as parameters.
+ * It will find the largest matching property value from the given objects.
+ *
+ * @method Phaser.Math#maxProperty
+ * @return {number} The largest value from those given.
+ */
+ maxProperty: function (property) {
+
+ if (arguments.length === 2 && typeof arguments[1] === 'object')
+ {
+ var data = arguments[1];
+ }
+ else
+ {
+ var data = arguments.slice(1);
+ }
+
+ for (var i = 1, max = 0, len = data.length; i < len; i++)
+ {
+ if (data[i][property] > data[max][property])
+ {
+ max = i;
+ }
+ }
+
+ return data[max][property];
},
@@ -1111,7 +1237,7 @@ Phaser.Math = {
},
/**
- * Description.
+ * A Linear Interpolation Method, mostly used by Phaser.Tween.
* @method Phaser.Math#linearInterpolation
* @param {number} v
* @param {number} k
@@ -1138,7 +1264,7 @@ Phaser.Math = {
},
/**
- * Description.
+ * A Bezier Interpolation Method, mostly used by Phaser.Tween.
* @method Phaser.Math#bezierInterpolation
* @param {number} v
* @param {number} k
@@ -1159,7 +1285,7 @@ Phaser.Math = {
},
/**
- * Description.
+ * A Catmull Rom Interpolation Method, mostly used by Phaser.Tween.
* @method Phaser.Math#catmullRomInterpolation
* @param {number} v
* @param {number} k
@@ -1394,7 +1520,7 @@ Phaser.Math = {
* @param {number} y1
* @param {number} x2
* @param {number} y2
- * @return {number} The distance between this Point object and the destination Point object.
+ * @return {number} The distance between the two sets of coordinates.
*/
distance: function (x1, y1, x2, y2) {
@@ -1405,6 +1531,25 @@ Phaser.Math = {
},
+ /**
+ * Returns the distance between the two given set of coordinates at the power given.
+ *
+ * @method Phaser.Math#distancePow
+ * @param {number} x1
+ * @param {number} y1
+ * @param {number} x2
+ * @param {number} y2
+ * @param {number} [pow=2]
+ * @return {number} The distance between the two sets of coordinates.
+ */
+ distancePow: function (x1, y1, x2, y2, pow) {
+
+ if (typeof pow === 'undefined') { pow = 2; }
+
+ return Math.sqrt(Math.pow(x2 - x1, pow) + Math.pow(y2 - y1, pow));
+
+ },
+
/**
* Returns the rounded distance between the two given set of coordinates.
*
@@ -1604,13 +1749,13 @@ Phaser.Math = {
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:25 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Mouse.js.html b/docs/Mouse.js.html
index 4dbbdc0f..c1518e11 100644
--- a/docs/Mouse.js.html
+++ b/docs/Mouse.js.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -423,7 +417,7 @@
/**
* @author Richard Davey <rich@photonstorm.com>
-* @copyright 2013 Photon Storm Ltd.
+* @copyright 2014 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -491,7 +485,8 @@ Phaser.Mouse = function (game) {
this.pointerLock = new Phaser.Signal();
/**
- * @property {MouseEvent} event - The browser mouse event.
+ * @property {MouseEvent} event - The browser mouse DOM event. Will be set to null if no mouse event has ever been received.
+ * @default
*/
this.event = null;
@@ -749,6 +744,8 @@ Phaser.Mouse.prototype = {
}
};
+
+Phaser.Mouse.prototype.constructor = Phaser.Mouse;
@@ -764,13 +761,13 @@ Phaser.Mouse.prototype = {
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:25 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Net.js.html b/docs/Net.js.html
index 8494000a..b9b79823 100644
--- a/docs/Net.js.html
+++ b/docs/Net.js.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -423,7 +417,7 @@
/**
* @author Richard Davey <rich@photonstorm.com>
-* @copyright 2013 Photon Storm Ltd.
+* @copyright 2014 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -551,8 +545,8 @@ Phaser.Net.prototype = {
var output = {};
var keyValues = location.search.substring(1).split('&');
- for (var i in keyValues) {
-
+ for (var i in keyValues)
+ {
var key = keyValues[i].split('=');
if (key.length > 1)
@@ -585,6 +579,8 @@ Phaser.Net.prototype = {
}
};
+
+Phaser.Net.prototype.constructor = Phaser.Net;
@@ -600,13 +596,13 @@ Phaser.Net.prototype = {
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:25 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Particles.js.html b/docs/Particles.js.html
index 501ff851..89d16184 100644
--- a/docs/Particles.js.html
+++ b/docs/Particles.js.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -423,7 +417,7 @@
/**
* @author Richard Davey <rich@photonstorm.com>
-* @copyright 2013 Photon Storm Ltd.
+* @copyright 2014 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -499,7 +493,10 @@ Phaser.Particles.prototype = {
}
-};
+};
+
+Phaser.Particles.prototype.constructor = Phaser.Particles;
+
@@ -514,13 +511,13 @@ Phaser.Particles.prototype = {
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:25 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Phaser.Animation.html b/docs/Phaser.Animation.html
index c2b32417..3ea9c67e 100644
--- a/docs/Phaser.Animation.html
+++ b/docs/Phaser.Animation.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -579,10 +573,10 @@ It is created by the AnimationManager, consists of Animation.Frame objects and b
-Array.<number>
+Array .<number>
|
-Array.<string>
+Array .<string>
@@ -798,7 +792,7 @@ It is created by the AnimationManager, consists of Animation.Frame objects and b
Source:
@@ -1002,7 +996,7 @@ It is created by the AnimationManager, consists of Animation.Frame objects and b
Source:
@@ -1104,7 +1098,7 @@ It is created by the AnimationManager, consists of Animation.Frame objects and b
Source:
@@ -1311,7 +1305,7 @@ It is created by the AnimationManager, consists of Animation.Frame objects and b
Source:
@@ -1416,7 +1410,7 @@ It is created by the AnimationManager, consists of Animation.Frame objects and b
Source:
@@ -1521,7 +1515,7 @@ It is created by the AnimationManager, consists of Animation.Frame objects and b
Source:
@@ -1578,7 +1572,7 @@ It is created by the AnimationManager, consists of Animation.Frame objects and b
- looped
+ killOnComplete
@@ -1594,7 +1588,7 @@ It is created by the AnimationManager, consists of Animation.Frame objects and b
- The loop state of the Animation.
+ Should the parent of this Animation be killed when the animation completes?
@@ -1619,11 +1613,14 @@ It is created by the AnimationManager, consists of Animation.Frame objects and b
+ Default Value:
+
+
Source:
@@ -1929,7 +1926,7 @@ It is created by the AnimationManager, consists of Animation.Frame objects and b
Source:
@@ -2209,7 +2206,7 @@ You could use this function to generate those by doing: Phaser.Animation.generat
Source:
@@ -2278,7 +2275,7 @@ You could use this function to generate those by doing: Phaser.Animation.generat
Source:
@@ -2347,7 +2344,7 @@ You could use this function to generate those by doing: Phaser.Animation.generat
Source:
@@ -2563,7 +2560,7 @@ You could use this function to generate those by doing: Phaser.Animation.generat
Source:
@@ -2657,7 +2654,7 @@ You could use this function to generate those by doing: Phaser.Animation.generat
Source:
@@ -2795,7 +2792,7 @@ You could use this function to generate those by doing: Phaser.Animation.generat
Source:
@@ -2864,7 +2861,7 @@ You could use this function to generate those by doing: Phaser.Animation.generat
Source:
@@ -2909,13 +2906,13 @@ You could use this function to generate those by doing: Phaser.Animation.generat
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:26 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:25 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Phaser.AnimationManager.html b/docs/Phaser.AnimationManager.html
index 344ada58..4609bb4a 100644
--- a/docs/Phaser.AnimationManager.html
+++ b/docs/Phaser.AnimationManager.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -762,7 +756,7 @@ Any Game Object such as Phaser.Sprite that supports animation contains a single
Source:
@@ -864,7 +858,7 @@ Any Game Object such as Phaser.Sprite that supports animation contains a single
Source:
@@ -966,7 +960,7 @@ Any Game Object such as Phaser.Sprite that supports animation contains a single
Source:
@@ -1068,7 +1062,7 @@ Any Game Object such as Phaser.Sprite that supports animation contains a single
Source:
@@ -1377,7 +1371,7 @@ Any Game Object such as Phaser.Sprite that supports animation contains a single
Source:
@@ -1696,7 +1690,7 @@ Animations added in this way are played back with the play function.
-Array
+Array
@@ -2801,7 +2795,7 @@ The currentAnim property of the AnimationManager is automatically set to the ani
-Array
+Array
@@ -2962,13 +2956,13 @@ The currentAnim property of the AnimationManager is automatically set to the ani
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:26 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:25 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Phaser.AnimationParser.html b/docs/Phaser.AnimationParser.html
index 97906828..ca5b0c11 100644
--- a/docs/Phaser.AnimationParser.html
+++ b/docs/Phaser.AnimationParser.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -659,7 +653,7 @@
Source:
@@ -846,7 +840,7 @@
Source:
@@ -897,7 +891,7 @@
- <static> spriteSheet(game, key, frameWidth, frameHeight, frameMax ) → {Phaser.FrameData }
+ <static> spriteSheet(game, key, frameWidth, frameHeight, frameMax , margin , spacing ) → {Phaser.FrameData }
@@ -1119,6 +1113,84 @@
+
+
+
+ margin
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ 0
+
+
+
+
+ If the frames have been drawn with a margin, specify the amount here.
+
+
+
+
+
+
+ spacing
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ 0
+
+
+
+
+ If the frames have been drawn with spacing between them, specify the amount here.
+
+
+
@@ -1334,7 +1406,7 @@
Source:
@@ -1402,13 +1474,13 @@
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:26 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:25 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Phaser.BitmapData.html b/docs/Phaser.BitmapData.html
index e561604f..b1f396be 100644
--- a/docs/Phaser.BitmapData.html
+++ b/docs/Phaser.BitmapData.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -1940,7 +1934,7 @@ for multiple Sprites. So if you need to dynamically create a Sprite texture then
Source:
@@ -2815,7 +2809,7 @@ going in the given direction by anticlockwise (defaulting to clockwise).
Source:
@@ -3034,7 +3028,7 @@ example, the following code defines a black to white vertical gradient ranging f
-Array
+Array
@@ -3057,7 +3051,7 @@ example, the following code defines a black to white vertical gradient ranging f
-Array
+Array
@@ -3293,7 +3287,7 @@ square to display it:
-Array
+Array
@@ -3316,7 +3310,7 @@ square to display it:
-Array
+Array
@@ -3645,7 +3639,7 @@ blue radial gradient centered at (100, 100), with a radius of 50, and draws a re
-Array
+Array
@@ -3668,7 +3662,7 @@ blue radial gradient centered at (100, 100), with a radius of 50, and draws a re
-Array
+Array
@@ -4337,7 +4331,7 @@ blue radial gradient centered at (100, 100), with a radius of 50, and draws a re
Source:
@@ -4406,7 +4400,7 @@ blue radial gradient centered at (100, 100), with a radius of 50, and draws a re
Source:
@@ -4475,7 +4469,7 @@ blue radial gradient centered at (100, 100), with a radius of 50, and draws a re
Source:
@@ -4544,7 +4538,7 @@ blue radial gradient centered at (100, 100), with a radius of 50, and draws a re
Source:
@@ -5263,7 +5257,7 @@ blue radial gradient centered at (100, 100), with a radius of 50, and draws a re
Source:
@@ -5799,7 +5793,7 @@ Once the gradient is created colors can be inserted using the addColorStop metho
Source:
@@ -5868,7 +5862,7 @@ Once the gradient is created colors can be inserted using the addColorStop metho
Source:
@@ -5937,7 +5931,7 @@ Once the gradient is created colors can be inserted using the addColorStop metho
Source:
@@ -6006,7 +6000,7 @@ Once the gradient is created colors can be inserted using the addColorStop metho
Source:
@@ -6075,7 +6069,7 @@ Once the gradient is created colors can be inserted using the addColorStop metho
Source:
@@ -6354,7 +6348,7 @@ Once the gradient is created colors can be inserted using the addColorStop metho
Source:
@@ -6423,7 +6417,7 @@ Once the gradient is created colors can be inserted using the addColorStop metho
Source:
@@ -7828,7 +7822,7 @@ source-over (default), destination-atop, destination-in, destination-out, destin
Source:
@@ -8625,7 +8619,7 @@ source-over (default), destination-atop, destination-in, destination-out, destin
Source:
@@ -8999,7 +8993,7 @@ source-over (default), destination-atop, destination-in, destination-out, destin
Source:
@@ -9068,7 +9062,7 @@ source-over (default), destination-atop, destination-in, destination-out, destin
Source:
@@ -9137,7 +9131,7 @@ source-over (default), destination-atop, destination-in, destination-out, destin
Source:
@@ -9416,7 +9410,7 @@ source-over (default), destination-atop, destination-in, destination-out, destin
Source:
@@ -9485,7 +9479,7 @@ source-over (default), destination-atop, destination-in, destination-out, destin
Source:
@@ -9926,7 +9920,7 @@ This is called automatically if the BitmapData is being used by a Sprite, otherw
Source:
@@ -10136,7 +10130,7 @@ This is called automatically if the BitmapData is being used by a Sprite, otherw
Source:
@@ -10205,7 +10199,7 @@ This is called automatically if the BitmapData is being used by a Sprite, otherw
Source:
@@ -10274,7 +10268,7 @@ This is called automatically if the BitmapData is being used by a Sprite, otherw
Source:
@@ -11451,7 +11445,7 @@ the stroke style and color in a single line of code like so:
Source:
@@ -11939,13 +11933,13 @@ the stroke style and color in a single line of code like so:
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:26 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:25 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Phaser.BitmapText.html b/docs/Phaser.BitmapText.html
index 069b9624..46ef4655 100644
--- a/docs/Phaser.BitmapText.html
+++ b/docs/Phaser.BitmapText.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -970,7 +964,7 @@ If you wish to work in radians instead of degrees use the property Sprite.rotati
Source:
@@ -1390,108 +1384,6 @@ If you wish to work in radians instead of degrees use the property Sprite.rotati
-
-
-
-
-
-
-
-
-
- renderable
-
-
-
-
-
-
-
-
-
-
-
-
- Properties:
-
-
-
-
-
-
-
- Name
-
-
- Type
-
-
-
-
-
- Description
-
-
-
-
-
-
-
-
- renderable
-
-
-
-
-
-boolean
-
-
-
-
-
-
-
-
-
- A renderable object will be rendered to the context each frame.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Source:
-
-
-
-
-
-
-
-
@@ -1793,7 +1685,7 @@ If you wish to work in radians instead of degrees use the property Sprite.rotati
Source:
@@ -1899,7 +1791,7 @@ If you wish to work in radians instead of degrees use the property Sprite.rotati
Source:
@@ -1964,7 +1856,7 @@ If you wish to work in radians instead of degrees use the property Sprite.rotati
Source:
@@ -2009,13 +1901,13 @@ If you wish to work in radians instead of degrees use the property Sprite.rotati
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:27 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:25 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Phaser.Button.html b/docs/Phaser.Button.html
index 6b04cc28..ac34735f 100644
--- a/docs/Phaser.Button.html
+++ b/docs/Phaser.Button.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -445,7 +439,7 @@
-
+
@@ -475,6 +469,8 @@
+ Default
+
Description
@@ -508,6 +504,10 @@
+
+
+
+
Current game instance.
@@ -541,6 +541,12 @@
+
+
+ 0
+
+
+
X position of the Button.
@@ -574,6 +580,12 @@
+
+
+ 0
+
+
+
Y position of the Button.
@@ -607,6 +619,10 @@
+
+
+
+
The image key as defined in the Game.Cache to use as the texture for this Button.
@@ -640,6 +656,10 @@
+
+
+
+
The function to call when this Button is pressed.
@@ -673,6 +693,10 @@
+
+
+
+
The context in which the callback will be called (usually 'this').
@@ -709,6 +733,10 @@
+
+
+
+
This is the frame or frameName that will be set when this button is in an over state. Give either a number to use a frame ID or a string for a frame name.
@@ -745,6 +773,10 @@
+
+
+
+
This is the frame or frameName that will be set when this button is in an out state. Give either a number to use a frame ID or a string for a frame name.
@@ -781,11 +813,55 @@
+
+
+
+
This is the frame or frameName that will be set when this button is in a down state. Give either a number to use a frame ID or a string for a frame name.
+
+
+
+ upFrame
+
+
+
+
+
+string
+|
+
+number
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ This is the frame or frameName that will be set when this button is in an up state. Give either a number to use a frame ID or a string for a frame name.
+
+
+
@@ -814,7 +890,7 @@
Source:
@@ -865,7 +941,7 @@
-
When the Button is clicked you can optionally force the state to "out".
+
When the Button is touched / clicked and then released you can force it to enter a state of "out" instead of "up".
@@ -943,13 +1019,13 @@
Default Value:
-
+
Source:
@@ -1051,7 +1127,7 @@
Source:
@@ -1156,7 +1232,7 @@
Source:
@@ -1258,7 +1334,7 @@
Source:
@@ -1360,7 +1436,7 @@
Source:
@@ -1462,7 +1538,7 @@
Source:
@@ -1564,7 +1640,7 @@
Source:
@@ -1666,7 +1742,7 @@
Source:
@@ -1771,7 +1847,7 @@
Source:
@@ -1873,7 +1949,7 @@
Source:
@@ -1978,7 +2054,7 @@
Source:
@@ -2080,7 +2156,7 @@
Source:
@@ -2185,7 +2261,7 @@
Source:
@@ -2287,7 +2363,7 @@
Source:
@@ -2389,7 +2465,7 @@
Source:
@@ -2413,7 +2489,76 @@
-
+ clearFrames()
+
+
+
+
+
+
+
+
Clears all of the frames set on this Button.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -2453,6 +2598,29 @@
+
+
+ sprite
+
+
+
+
+
+Phaser.Button
+
+
+
+
+
+
+
+
+
+ The Button that the event occured on.
+
+
+
+
pointer
@@ -2503,7 +2671,7 @@
Source:
@@ -2531,7 +2699,7 @@
-
+
@@ -2571,6 +2739,29 @@
+
+
+ sprite
+
+
+
+
+
+Phaser.Button
+
+
+
+
+
+
+
+
+
+ The Button that the event occured on.
+
+
+
+
pointer
@@ -2621,7 +2812,7 @@
Source:
@@ -2649,7 +2840,7 @@
-
+
@@ -2691,13 +2882,13 @@
- pointer
+ sprite
-Phaser.Pointer
+Phaser.Button
@@ -2707,105 +2898,10 @@
- The Pointer that activated the Button.
+ The Button that the event occured on.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Source:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Internal function that handles input events.
-
-
-
-
-
-
-
-
- Parameters:
-
-
-
-
-
-
- Name
-
-
- Type
-
-
-
-
-
- Description
-
-
-
-
-
@@ -2880,6 +2976,147 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Internal function that handles input events.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ sprite
+
+
+
+
+
+Phaser.Button
+
+
+
+
+
+
+
+
+
+ The Button that the event occured on.
+
+
+
+
+
+
+ pointer
+
+
+
+
+
+Phaser.Pointer
+
+
+
+
+
+
+
+
+
+ The Pointer that activated the Button.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -2893,7 +3130,7 @@
-
The Sound to be played when a Pointer clicks on this Button.
+
The Sound to be played when a Pointer presses down on this Button.
@@ -3018,7 +3255,7 @@
Source:
@@ -3046,7 +3283,7 @@
- setFrames(overFrame , outFrame , downFrame )
+ setFrames(overFrame , outFrame , downFrame , upFrame )
@@ -3054,8 +3291,7 @@
-
Used to manually set the frames that will be used for the different states of the button
-exactly like setting them in the constructor.
+
Used to manually set the frames that will be used for the different states of the Button.
@@ -3196,6 +3432,42 @@ exactly like setting them in the constructor.
+
+
+
+ upFrame
+
+
+
+
+
+string
+|
+
+number
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+ This is the frame or frameName that will be set when this button is in an up state. Give either a number to use a frame ID or a string for a frame name.
+
+
+
@@ -3224,7 +3496,7 @@ exactly like setting them in the constructor.
Source:
@@ -3385,7 +3657,7 @@ exactly like setting them in the constructor.
Source:
@@ -3546,7 +3818,7 @@ exactly like setting them in the constructor.
Source:
@@ -3909,7 +4181,125 @@ Call this function with no parameters at all to reset all sounds on this Button.
Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <protected> setState(newState)
+
+
+
+
+
+
+
+
Internal function that handles Button state changes.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ newState
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ The new State of the Button.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
@@ -3945,7 +4335,7 @@ Call this function with no parameters at all to reset all sounds on this Button.
-
The Sound to be played when a Pointer clicks on this Button.
+
The Sound to be played when a Pointer has pressed down and is released from this Button.
@@ -4070,7 +4460,7 @@ Call this function with no parameters at all to reset all sounds on this Button.
Source:
@@ -4115,13 +4505,13 @@ Call this function with no parameters at all to reset all sounds on this Button.
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:27 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:26 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Phaser.Cache.html b/docs/Phaser.Cache.html
index 48d2c327..ac9a8804 100644
--- a/docs/Phaser.Cache.html
+++ b/docs/Phaser.Cache.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -427,8 +421,7 @@
Cache
- A game only has one instance of a Cache and it is used to store all externally loaded assets such
-as images, sounds and data files as a result of Loader calls. Cache items use string based keys for look-up.
+ A game only has one instance of a Cache and it is used to store all externally loaded assets such as images, sounds and data files as a result of Loader calls. Cached items use string based keys for look-up.
@@ -529,7 +522,7 @@ as images, sounds and data files as a result of Loader calls. Cache items use st
Source:
@@ -657,7 +650,7 @@ as images, sounds and data files as a result of Loader calls. Cache items use st
Source:
@@ -759,7 +752,7 @@ as images, sounds and data files as a result of Loader calls. Cache items use st
Source:
@@ -782,6 +775,147 @@ as images, sounds and data files as a result of Loader calls. Cache items use st
+
+ addBinary(key, binaryData)
+
+
+
+
+
+
+
+
Add a binary object in to the cache.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ key
+
+
+
+
+
+string
+
+
+
+
+
+
+
+
+
+ Asset key for this binary data.
+
+
+
+
+
+
+ binaryData
+
+
+
+
+
+object
+
+
+
+
+
+
+
+
+
+ The binary object to be addded to the cache.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
addBitmapData(key, bitmapData) → {Phaser.BitmapData }
@@ -896,7 +1030,7 @@ as images, sounds and data files as a result of Loader calls. Cache items use st
Source:
@@ -1106,7 +1240,7 @@ as images, sounds and data files as a result of Loader calls. Cache items use st
Source:
@@ -1270,7 +1404,7 @@ as images, sounds and data files as a result of Loader calls. Cache items use st
Source:
@@ -1339,7 +1473,7 @@ as images, sounds and data files as a result of Loader calls. Cache items use st
Source:
@@ -1503,7 +1637,7 @@ as images, sounds and data files as a result of Loader calls. Cache items use st
Source:
@@ -1572,7 +1706,7 @@ as images, sounds and data files as a result of Loader calls. Cache items use st
Source:
@@ -1713,7 +1847,7 @@ as images, sounds and data files as a result of Loader calls. Cache items use st
Source:
@@ -1923,7 +2057,7 @@ as images, sounds and data files as a result of Loader calls. Cache items use st
Source:
@@ -1951,7 +2085,7 @@ as images, sounds and data files as a result of Loader calls. Cache items use st
- addSpriteSheet(key, url, data, frameWidth, frameHeight, frameMax)
+ addSpriteSheet(key, url, data, frameWidth, frameHeight, frameMax , margin , spacing )
@@ -1981,8 +2115,12 @@ as images, sounds and data files as a result of Loader calls. Cache items use st
Type
+ Argument
+
+ Default
+
Description
@@ -2006,7 +2144,19 @@ as images, sounds and data files as a result of Loader calls. Cache items use st
+
+
+
+
+
+
+
+
+
+
+
+
The unique key by which you will reference this object.
@@ -2029,7 +2179,19 @@ as images, sounds and data files as a result of Loader calls. Cache items use st
+
+
+
+
+
+
+
+
+
+
+
+
URL of this sprite sheet file.
@@ -2052,7 +2214,19 @@ as images, sounds and data files as a result of Loader calls. Cache items use st
+
+
+
+
+
+
+
+
+
+
+
+
Extra sprite sheet data.
@@ -2075,7 +2249,19 @@ as images, sounds and data files as a result of Loader calls. Cache items use st
+
+
+
+
+
+
+
+
+
+
+
+
Width of the sprite sheet.
@@ -2098,7 +2284,19 @@ as images, sounds and data files as a result of Loader calls. Cache items use st
+
+
+
+
+
+
+
+
+
+
+
+
Height of the sprite sheet.
@@ -2121,10 +2319,104 @@ as images, sounds and data files as a result of Loader calls. Cache items use st
+
+
+ <optional>
+
+
+
+
+
- How many frames stored in the sprite sheet.
+
+
+
+ -1
+
+
+
+
+ How many frames stored in the sprite sheet. If -1 then it divides the whole sheet evenly.
+
+
+
+
+
+
+ margin
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ 0
+
+
+
+
+ If the frames have been drawn with a margin, specify the amount here.
+
+
+
+
+
+
+ spacing
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ 0
+
+
+
+
+ If the frames have been drawn with spacing between them, specify the amount here.
@@ -2156,7 +2448,7 @@ as images, sounds and data files as a result of Loader calls. Cache items use st
Source:
@@ -2320,7 +2612,7 @@ as images, sounds and data files as a result of Loader calls. Cache items use st
Source:
@@ -2530,7 +2822,7 @@ as images, sounds and data files as a result of Loader calls. Cache items use st
Source:
@@ -2662,7 +2954,7 @@ as images, sounds and data files as a result of Loader calls. Cache items use st
- The tilemap data object.
+ The tilemap data object (either a CSV or JSON file).
@@ -2717,394 +3009,7 @@ as images, sounds and data files as a result of Loader calls. Cache items use st
Source:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- addTileset(key, url, data, tileWidth, tileHeight, tileMax, tileMargin , tileSpacing )
-
-
-
-
-
-
-
-
Add a new tile set in to the cache.
-
-
-
-
-
-
-
-
- Parameters:
-
-
-
-
-
-
- Name
-
-
- Type
-
-
- Argument
-
-
-
- Default
-
-
- Description
-
-
-
-
-
-
-
-
- key
-
-
-
-
-
-string
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- The unique key by which you will reference this object.
-
-
-
-
-
-
- url
-
-
-
-
-
-string
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- URL of this tile set file.
-
-
-
-
-
-
- data
-
-
-
-
-
-object
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Extra tile set data.
-
-
-
-
-
-
- tileWidth
-
-
-
-
-
-number
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Width of the sprite sheet.
-
-
-
-
-
-
- tileHeight
-
-
-
-
-
-number
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Height of the sprite sheet.
-
-
-
-
-
-
- tileMax
-
-
-
-
-
-number
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- How many tiles stored in the sprite sheet.
-
-
-
-
-
-
- tileMargin
-
-
-
-
-
-number
-
-
-
-
-
-
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
-
- 0
-
-
-
-
- If the tiles have been drawn with a margin, specify the amount here.
-
-
-
-
-
-
- tileSpacing
-
-
-
-
-
-number
-
-
-
-
-
-
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
-
- 0
-
-
-
-
- If the tiles have been drawn with spacing between them, specify the amount here.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Source:
-
@@ -3190,7 +3095,7 @@ as images, sounds and data files as a result of Loader calls. Cache items use st
- Asset key of the image you want.
+ Asset key of the image to check is in the Cache.
@@ -3222,7 +3127,7 @@ as images, sounds and data files as a result of Loader calls. Cache items use st
Source:
@@ -3386,7 +3291,7 @@ as images, sounds and data files as a result of Loader calls. Cache items use st
Source:
@@ -3455,7 +3360,7 @@ as images, sounds and data files as a result of Loader calls. Cache items use st
Source:
@@ -3478,6 +3383,147 @@ as images, sounds and data files as a result of Loader calls. Cache items use st
+
+
+
+
+
+ getBinary(key) → {object}
+
+
+
+
+
+
+
+
Get binary data by key.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ key
+
+
+
+
+
+string
+
+
+
+
+
+
+
+
+
+ Asset key of the binary data object to retrieve from the Cache.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+
+
+
The binary data object.
+
+
+
+
+
+
+ Type
+
+
+
+object
+
+
+
+
+
+
+
+
+
@@ -3541,7 +3587,7 @@ as images, sounds and data files as a result of Loader calls. Cache items use st
- Asset key of the BitmapData object you want.
+ Asset key of the BitmapData object to retrieve from the Cache.
@@ -3573,7 +3619,7 @@ as images, sounds and data files as a result of Loader calls. Cache items use st
Source:
@@ -3682,7 +3728,7 @@ as images, sounds and data files as a result of Loader calls. Cache items use st
- Asset key of the canvas you want.
+ Asset key of the canvas to retrieve from the Cache.
@@ -3714,7 +3760,7 @@ as images, sounds and data files as a result of Loader calls. Cache items use st
Source:
@@ -3739,7 +3785,7 @@ as images, sounds and data files as a result of Loader calls. Cache items use st
-
The canvas you want.
+
The canvas object.
@@ -3823,7 +3869,7 @@ as images, sounds and data files as a result of Loader calls. Cache items use st
- Asset key of the frame data you want.
+ Asset key of the frame data to retrieve from the Cache.
@@ -3855,7 +3901,7 @@ as images, sounds and data files as a result of Loader calls. Cache items use st
Source:
@@ -3880,7 +3926,7 @@ as images, sounds and data files as a result of Loader calls. Cache items use st
-
The frame data you want.
+
The frame data.
@@ -3964,7 +4010,7 @@ as images, sounds and data files as a result of Loader calls. Cache items use st
- Asset key of the frame data you want.
+ Asset key of the frame data to retrieve from the Cache.
@@ -3996,7 +4042,7 @@ as images, sounds and data files as a result of Loader calls. Cache items use st
Source:
@@ -4021,7 +4067,7 @@ as images, sounds and data files as a result of Loader calls. Cache items use st
-
The frame data you want.
+
The frame object.
@@ -4105,7 +4151,7 @@ as images, sounds and data files as a result of Loader calls. Cache items use st
- Asset key of the frame data you want.
+ Asset key of the frame data to retrieve from the Cache.
@@ -4137,7 +4183,7 @@ as images, sounds and data files as a result of Loader calls. Cache items use st
Source:
@@ -4162,7 +4208,7 @@ as images, sounds and data files as a result of Loader calls. Cache items use st
-
The frame data you want.
+
The frame object.
@@ -4246,7 +4292,7 @@ as images, sounds and data files as a result of Loader calls. Cache items use st
- Asset key of the frame data you want.
+ Asset key of the frame data to retrieve from the Cache.
@@ -4278,7 +4324,7 @@ as images, sounds and data files as a result of Loader calls. Cache items use st
Source:
@@ -4303,7 +4349,7 @@ as images, sounds and data files as a result of Loader calls. Cache items use st
-
The frame data you want.
+
The frame data.
@@ -4387,7 +4433,7 @@ as images, sounds and data files as a result of Loader calls. Cache items use st
- Asset key of the image you want.
+ Asset key of the image to retrieve from the Cache.
@@ -4419,7 +4465,7 @@ as images, sounds and data files as a result of Loader calls. Cache items use st
Source:
@@ -4444,7 +4490,7 @@ as images, sounds and data files as a result of Loader calls. Cache items use st
-
The image data you want.
+
The image data.
@@ -4470,7 +4516,7 @@ as images, sounds and data files as a result of Loader calls. Cache items use st
- getImageKeys() → {Array}
+ getImageKeys() → {Array }
@@ -4511,7 +4557,7 @@ as images, sounds and data files as a result of Loader calls. Cache items use st
Source:
@@ -4547,7 +4593,7 @@ as images, sounds and data files as a result of Loader calls. Cache items use st
-Array
+Array
@@ -4562,7 +4608,7 @@ as images, sounds and data files as a result of Loader calls. Cache items use st
- getKeys(array) → {Array}
+ getKeys(array) → {Array }
@@ -4611,7 +4657,7 @@ Normally you don't call this directly but instead use getImageKeys, getSoundKeys
-Array
+Array
@@ -4653,7 +4699,7 @@ Normally you don't call this directly but instead use getImageKeys, getSoundKeys
Source:
@@ -4689,7 +4735,7 @@ Normally you don't call this directly but instead use getImageKeys, getSoundKeys
-Array
+Array
@@ -4762,7 +4808,7 @@ Normally you don't call this directly but instead use getImageKeys, getSoundKeys
- Asset key of the sound you want.
+ Asset key of the sound to retrieve from the Cache.
@@ -4794,7 +4840,7 @@ Normally you don't call this directly but instead use getImageKeys, getSoundKeys
Source:
@@ -4819,7 +4865,7 @@ Normally you don't call this directly but instead use getImageKeys, getSoundKeys
-
The sound you want.
+
The sound object.
@@ -4903,7 +4949,7 @@ Normally you don't call this directly but instead use getImageKeys, getSoundKeys
- Asset key of the sound you want.
+ Asset key of the sound to retrieve from the Cache.
@@ -4935,7 +4981,7 @@ Normally you don't call this directly but instead use getImageKeys, getSoundKeys
Source:
@@ -4960,7 +5006,7 @@ Normally you don't call this directly but instead use getImageKeys, getSoundKeys
-
The sound data you want.
+
The sound data.
@@ -4986,7 +5032,7 @@ Normally you don't call this directly but instead use getImageKeys, getSoundKeys
- getSoundKeys() → {Array}
+ getSoundKeys() → {Array }
@@ -5027,7 +5073,7 @@ Normally you don't call this directly but instead use getImageKeys, getSoundKeys
Source:
@@ -5063,7 +5109,7 @@ Normally you don't call this directly but instead use getImageKeys, getSoundKeys
-Array
+Array
@@ -5136,7 +5182,7 @@ Normally you don't call this directly but instead use getImageKeys, getSoundKeys
- Asset key of the text data you want.
+ Asset key of the text data to retrieve from the Cache.
@@ -5168,7 +5214,7 @@ Normally you don't call this directly but instead use getImageKeys, getSoundKeys
Source:
@@ -5193,7 +5239,7 @@ Normally you don't call this directly but instead use getImageKeys, getSoundKeys
-
The text data you want.
+
The text data.
@@ -5219,7 +5265,7 @@ Normally you don't call this directly but instead use getImageKeys, getSoundKeys
- getTextKeys() → {Array}
+ getTextKeys() → {Array }
@@ -5260,7 +5306,7 @@ Normally you don't call this directly but instead use getImageKeys, getSoundKeys
Source:
@@ -5296,7 +5342,7 @@ Normally you don't call this directly but instead use getImageKeys, getSoundKeys
-Array
+Array
@@ -5369,7 +5415,7 @@ Normally you don't call this directly but instead use getImageKeys, getSoundKeys
- Asset key of the RenderTexture you want.
+ Asset key of the RenderTexture to retrieve from the Cache.
@@ -5401,7 +5447,7 @@ Normally you don't call this directly but instead use getImageKeys, getSoundKeys
Source:
@@ -5426,7 +5472,7 @@ Normally you don't call this directly but instead use getImageKeys, getSoundKeys
-
The RenderTexture you want.
+
The RenderTexture object.
@@ -5460,7 +5506,7 @@ Normally you don't call this directly but instead use getImageKeys, getSoundKeys
-
Get a single frame by key. You'd only do this to get the default Frame created for a non-atlas/spritesheet image.
+
Get a single texture frame by key. You'd only do this to get the default Frame created for a non-atlas/spritesheet image.
@@ -5510,7 +5556,7 @@ Normally you don't call this directly but instead use getImageKeys, getSoundKeys
- Asset key of the frame data you want.
+ Asset key of the frame to retrieve from the Cache.
@@ -5542,7 +5588,7 @@ Normally you don't call this directly but instead use getImageKeys, getSoundKeys
Source:
@@ -5567,7 +5613,7 @@ Normally you don't call this directly but instead use getImageKeys, getSoundKeys
-
The frame data you want.
+
The frame data.
@@ -5651,7 +5697,7 @@ Normally you don't call this directly but instead use getImageKeys, getSoundKeys
- Asset key of the tilemap you want.
+ Asset key of the tilemap data to retrieve from the Cache.
@@ -5683,7 +5729,7 @@ Normally you don't call this directly but instead use getImageKeys, getSoundKeys
Source:
@@ -5708,7 +5754,7 @@ Normally you don't call this directly but instead use getImageKeys, getSoundKeys
-
The tilemap data. The tileset image is in the data property, the map data in mapData.
+
The raw tilemap data in CSV or JSON format.
@@ -5729,288 +5775,6 @@ Normally you don't call this directly but instead use getImageKeys, getSoundKeys
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Get tile set image data by key.
-
-
-
-
-
-
-
-
- Parameters:
-
-
-
-
-
-
- Name
-
-
- Type
-
-
-
-
-
- Description
-
-
-
-
-
-
-
-
- key
-
-
-
-
-
-string
-
-
-
-
-
-
-
-
-
- Asset key of the image you want.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Source:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Returns:
-
-
-
-
The tileset data. The tileset image is in the data property, the tile data in tileData.
-
-
-
-
-
-
- Type
-
-
-
-Phaser.Tileset
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- getTileSetImage(key) → {object}
-
-
-
-
-
-
-
-
Get tile set image data by key.
-
-
-
-
-
-
-
-
- Parameters:
-
-
-
-
-
-
- Name
-
-
- Type
-
-
-
-
-
- Description
-
-
-
-
-
-
-
-
- key
-
-
-
-
-
-string
-
-
-
-
-
-
-
-
-
- Asset key of the image you want.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Source:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Returns:
-
-
-
-
The image data you want.
-
-
-
-
-
-
- Type
-
-
-
-object
-
-
-
-
-
-
-
-
-
@@ -6074,7 +5838,7 @@ Normally you don't call this directly but instead use getImageKeys, getSoundKeys
- Asset key of the sound you want.
+ Asset key of the sound in the Cache.
@@ -6106,7 +5870,7 @@ Normally you don't call this directly but instead use getImageKeys, getSoundKeys
Source:
@@ -6215,7 +5979,7 @@ Normally you don't call this directly but instead use getImageKeys, getSoundKeys
- Asset key of the sound you want.
+ Asset key of the sound in the Cache.
@@ -6247,7 +6011,7 @@ Normally you don't call this directly but instead use getImageKeys, getSoundKeys
Source:
@@ -6388,7 +6152,7 @@ Normally you don't call this directly but instead use getImageKeys, getSoundKeys
Source:
@@ -6529,7 +6293,7 @@ Normally you don't call this directly but instead use getImageKeys, getSoundKeys
Source:
@@ -6565,7 +6329,7 @@ Normally you don't call this directly but instead use getImageKeys, getSoundKeys
-
Description.
+
Fires the onSoundUnlock event when the sound has completed reloading.
@@ -6647,7 +6411,7 @@ Normally you don't call this directly but instead use getImageKeys, getSoundKeys
Source:
@@ -6765,7 +6529,7 @@ Normally you don't call this directly but instead use getImageKeys, getSoundKeys
Source:
@@ -6883,7 +6647,7 @@ Normally you don't call this directly but instead use getImageKeys, getSoundKeys
Source:
@@ -7001,7 +6765,7 @@ Normally you don't call this directly but instead use getImageKeys, getSoundKeys
Source:
@@ -7119,7 +6883,7 @@ Normally you don't call this directly but instead use getImageKeys, getSoundKeys
Source:
@@ -7155,7 +6919,7 @@ Normally you don't call this directly but instead use getImageKeys, getSoundKeys
-
Description.
+
Updates the sound object in the cache.
@@ -7237,7 +7001,7 @@ Normally you don't call this directly but instead use getImageKeys, getSoundKeys
Source:
@@ -7282,13 +7046,13 @@ Normally you don't call this directly but instead use getImageKeys, getSoundKeys
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:27 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:26 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Phaser.Camera.html b/docs/Phaser.Camera.html
index c999006b..9c78271a 100644
--- a/docs/Phaser.Camera.html
+++ b/docs/Phaser.Camera.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -730,7 +724,7 @@ The game automatically creates a single Stage sized camera on boot. Move the cam
Source:
@@ -790,7 +784,7 @@ The game automatically creates a single Stage sized camera on boot. Move the cam
Source:
@@ -850,7 +844,7 @@ The game automatically creates a single Stage sized camera on boot. Move the cam
Source:
@@ -910,7 +904,7 @@ The game automatically creates a single Stage sized camera on boot. Move the cam
Source:
@@ -1231,6 +1225,108 @@ at all then set this to null. The values can be anything and are in World coordi
+
+
+
+
+
+
+
+
+
+ displayObject
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ displayObject
+
+
+
+
+
+PIXI.DisplayObject
+
+
+
+
+
+
+
+
+
+ The display object to which all game objects are added. Set by World.boot
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
@@ -1430,7 +1526,7 @@ at all then set this to null. The values can be anything and are in World coordi
Source:
@@ -1770,7 +1866,7 @@ at all then set this to null. The values can be anything and are in World coordi
Camera view.
The view into the world we wish to render (by default the game dimensions).
The x/y values are in world coordinates, not screen coordinates, the width/height is how many pixels to render.
-Objects outside of this view are not rendered (unless set to ignore the Camera, i.e. UI?).
+Objects outside of this view are not rendered if set to camera cull.
@@ -2062,7 +2158,7 @@ Objects outside of this view are not rendered (unless set to ignore the Camera,
Source:
@@ -2270,7 +2366,7 @@ Objects outside of this view are not rendered (unless set to ignore the Camera,
Source:
@@ -2376,7 +2472,7 @@ Objects outside of this view are not rendered (unless set to ignore the Camera,
Source:
@@ -2441,7 +2537,7 @@ Objects outside of this view are not rendered (unless set to ignore the Camera,
Source:
@@ -2559,7 +2655,7 @@ Objects outside of this view are not rendered (unless set to ignore the Camera,
Source:
@@ -2700,7 +2796,7 @@ Objects outside of this view are not rendered (unless set to ignore the Camera,
Source:
@@ -2861,7 +2957,76 @@ Objects outside of this view are not rendered (unless set to ignore the Camera,
Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ setBoundsToWorld()
+
+
+
+
+
+
+
+
Update the Camera bounds to match the game world.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
@@ -3003,7 +3168,7 @@ without having to use game.camera.x and game.camera.y.
Source:
@@ -3144,7 +3309,7 @@ without having to use game.camera.x and game.camera.y.
Source:
@@ -3213,7 +3378,7 @@ without having to use game.camera.x and game.camera.y.
Source:
@@ -3258,13 +3423,13 @@ without having to use game.camera.x and game.camera.y.
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:27 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:26 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Phaser.Canvas.html b/docs/Phaser.Canvas.html
index 71bd9952..06f8a7ad 100644
--- a/docs/Phaser.Canvas.html
+++ b/docs/Phaser.Canvas.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -444,7 +438,7 @@
-
The Canvas class handles everything related to the <canvas> tag as a DOM Element, like styles, offset, aspect ratio
+
The Canvas class handles everything related to creating the canvas DOM tag that Phaser will use, including styles, offset and aspect ratio.
@@ -523,7 +517,7 @@
- <static> addToDOM(canvas, parent, overflowHidden) → {HTMLCanvasElement}
+ <static> addToDOM(canvas, parent, overflowHidden ) → {HTMLCanvasElement}
@@ -554,8 +548,12 @@ If no parent is given it will be added as a child of the document.body.
Type
+ Argument
+
+ Default
+
Description
@@ -579,7 +577,19 @@ If no parent is given it will be added as a child of the document.body.
+
+
+
+
+
+
+
+
+
+
+
+
The canvas to set the touch action on.
@@ -605,10 +615,22 @@ If no parent is given it will be added as a child of the document.body.
+
+
+
+
+
+
- The DOM element to add the canvas to. Defaults to ''.
+
+
+
+
+
+
+ The DOM element to add the canvas to.
@@ -628,7 +650,23 @@ If no parent is given it will be added as a child of the document.body.
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+ true
+
+
If set to true it will add the overflow='hidden' style to the parent DOM element.
@@ -663,7 +701,7 @@ If no parent is given it will be added as a child of the document.body.
Source:
@@ -714,7 +752,7 @@ If no parent is given it will be added as a child of the document.body.
- <static> create(width, height) → {HTMLCanvasElement}
+ <static> create(width , height , id ) → {HTMLCanvasElement}
@@ -722,7 +760,7 @@ If no parent is given it will be added as a child of the document.body.
-
Creates the <canvas> tag
+
Creates a canvas DOM element. The element is not automatically added to the document.
@@ -744,8 +782,12 @@ If no parent is given it will be added as a child of the document.body.
Type
+ Argument
+
+ Default
+
Description
@@ -769,10 +811,26 @@ If no parent is given it will be added as a child of the document.body.
+
+
+ <optional>
+
+
+
+
+
- The desired width.
+
+
+
+ 256
+
+
+
+
+ The width of the canvas element.
@@ -792,10 +850,65 @@ If no parent is given it will be added as a child of the document.body.
+
+
+ <optional>
+
+
+
+
+
- The desired height.
+
+
+
+ 256
+
+
+
+
+ The height of the canvas element..
+
+
+
+
+
+
+ id
+
+
+
+
+
+string
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ ''
+
+
+
+
+ If given this will be set as the ID of the canvas element, otherwise no ID will be set.
@@ -852,7 +965,7 @@ If no parent is given it will be added as a child of the document.body.
-
The newly created <canvas> tag.
+
The newly created canvas element.
@@ -968,7 +1081,7 @@ If no parent is given it will be added as a child of the document.body.
Source:
@@ -1152,7 +1265,7 @@ If no parent is given it will be added as a child of the document.body.
Source:
@@ -1338,7 +1451,7 @@ If no parent is given it will be added as a child of the document.body.
Source:
@@ -1480,7 +1593,7 @@ Note that if this doesn't given the desired result then see the CanvasUtils.setS
Source:
@@ -1622,7 +1735,7 @@ Note that if this doesn't given the desired result then see the setSmoothingEnab
Source:
@@ -1790,7 +1903,7 @@ patchy on earlier browsers, especially on mobile.
Source:
@@ -1974,7 +2087,7 @@ patchy on earlier browsers, especially on mobile.
Source:
@@ -2253,7 +2366,7 @@ patchy on earlier browsers, especially on mobile.
Source:
@@ -2437,7 +2550,7 @@ patchy on earlier browsers, especially on mobile.
Source:
@@ -2505,13 +2618,13 @@ patchy on earlier browsers, especially on mobile.
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:27 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:26 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Phaser.Circle.html b/docs/Phaser.Circle.html
index 36d2d5a0..9f4ff06b 100644
--- a/docs/Phaser.Circle.html
+++ b/docs/Phaser.Circle.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -472,6 +466,8 @@
+ Default
+
Description
@@ -507,6 +503,12 @@
+
+
+ 0
+
+
+
The x coordinate of the center of the circle.
@@ -540,6 +542,12 @@
+
+
+ 0
+
+
+
The y coordinate of the center of the circle.
@@ -573,6 +581,12 @@
+
+
+ 0
+
+
+
The diameter of the circle.
@@ -761,7 +775,7 @@
Source:
@@ -867,7 +881,7 @@
Source:
@@ -973,7 +987,7 @@
Source:
@@ -1080,7 +1094,7 @@ If set to true it will reset all of the Circle objects properties to 0. A Circle
Source:
@@ -1134,7 +1148,7 @@ If set to true it will reset all of the Circle objects properties to 0. A Circle
Source:
@@ -1240,7 +1254,7 @@ If set to true it will reset all of the Circle objects properties to 0. A Circle
Source:
@@ -1346,7 +1360,7 @@ If set to true it will reset all of the Circle objects properties to 0. A Circle
Source:
@@ -1452,7 +1466,7 @@ If set to true it will reset all of the Circle objects properties to 0. A Circle
Source:
@@ -1875,7 +1889,7 @@ If set to true it will reset all of the Circle objects properties to 0. A Circle
Source:
@@ -2062,7 +2076,7 @@ If set to true it will reset all of the Circle objects properties to 0. A Circle
Source:
@@ -2226,7 +2240,7 @@ If set to true it will reset all of the Circle objects properties to 0. A Circle
Source:
@@ -2391,7 +2405,7 @@ This method checks the radius distances between the two Circle objects to see if
Source:
@@ -2555,7 +2569,7 @@ This method checks the radius distances between the two Circle objects to see if
Source:
@@ -4282,13 +4296,13 @@ This method checks the radius distances between the two Circle objects to see if
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:27 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:26 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Phaser.Color.html b/docs/Phaser.Color.html
index 51379fd7..8db79737 100644
--- a/docs/Phaser.Color.html
+++ b/docs/Phaser.Color.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -3611,13 +3605,13 @@ Set the max value to restrict the maximum color used per channel.
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:27 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:26 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Phaser.DOMSprite.html b/docs/Phaser.DOMSprite.html
new file mode 100644
index 00000000..c7f3269d
--- /dev/null
+++ b/docs/Phaser.DOMSprite.html
@@ -0,0 +1,1476 @@
+
+
+
+
+
+ Phaser Class: DOMSprite
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Class: DOMSprite
+
+
+
+
+ Phaser .
+
+ DOMSprite
+
+
+
+
+
+
+
+
+
+
+
+
+
+ new DOMSprite(game, id, x, y, text, style)
+
+
+
+
+
+
+
+
Create a new DOMSprite.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ game
+
+
+
+
+
+Phaser.Game
+
+
+
+
+
+
+
+
+
+ Current game instance.
+
+
+
+
+
+
+ id
+
+
+
+
+
+string
+
+
+
+
+
+
+
+
+
+ DOM ID.
+
+
+
+
+
+
+ x
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ X position of the new text object.
+
+
+
+
+
+
+ y
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ Y position of the new text object.
+
+
+
+
+
+
+ text
+
+
+
+
+
+string
+
+
+
+
+
+
+
+
+
+ The actual text that will be written.
+
+
+
+
+
+
+ style
+
+
+
+
+
+object
+
+
+
+
+
+
+
+
+
+ The style object containing style attributes like font, font size ,
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Members
+
+
+
+
+ alive
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ alive
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+
+ This is a handy little var your game can use to determine if an object is alive or not, it doesn't effect rendering.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Default Value:
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ exists
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ exists
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+
+ If exists = false then the Text isn't updated by the core game loop.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Default Value:
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ game
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ game
+
+
+
+
+
+Phaser.Game
+
+
+
+
+
+
+
+
+
+ A reference to the currently running Game.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ group
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ group
+
+
+
+
+
+Phaser.Group
+
+
+
+
+
+
+
+
+
+ The parent Group of this Text object.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ name
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ name
+
+
+
+
+
+string
+
+
+
+
+
+
+
+
+
+ The user defined name given to this object.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ type
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ type
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ The const type of this object.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ visible
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ visible
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+
+ Sets the visible state of this DOMSprite.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Default Value:
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
+
+
+
+
+ Documentation generated by JSDoc 3.3.0-dev
+ on Wed Feb 05 2014 06:28:27 GMT-0000 (GMT) using the DocStrap template .
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/Phaser.Device.html b/docs/Phaser.Device.html
index 033bb1ac..7d231d36 100644
--- a/docs/Phaser.Device.html
+++ b/docs/Phaser.Device.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -610,7 +604,7 @@
Source:
@@ -715,7 +709,7 @@
Source:
@@ -820,7 +814,7 @@
Source:
@@ -925,7 +919,7 @@
Source:
@@ -1030,7 +1024,7 @@
Source:
@@ -1135,7 +1129,7 @@
Source:
@@ -1345,7 +1339,7 @@
Source:
@@ -1459,6 +1453,111 @@
+
+
+
+
+
+
+
+
+
+ ejecta
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ ejecta
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+
+ Is the game running under Ejecta?
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Default Value:
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
@@ -1555,7 +1654,7 @@
Source:
@@ -1660,7 +1759,7 @@
Source:
@@ -1765,7 +1864,7 @@
Source:
@@ -1870,7 +1969,7 @@
Source:
@@ -1975,7 +2074,7 @@
Source:
@@ -2080,7 +2179,7 @@
Source:
@@ -2290,7 +2389,7 @@
Source:
@@ -2395,7 +2494,7 @@
Source:
@@ -2500,7 +2599,7 @@
Source:
@@ -2605,7 +2704,7 @@
Source:
@@ -2710,7 +2809,7 @@
Source:
@@ -2815,7 +2914,7 @@
Source:
@@ -2924,7 +3023,7 @@
Source:
@@ -3029,7 +3128,7 @@
Source:
@@ -3134,7 +3233,7 @@
Source:
@@ -3239,7 +3338,7 @@
Source:
@@ -3344,7 +3443,7 @@
Source:
@@ -3449,7 +3548,7 @@
Source:
@@ -3554,7 +3653,7 @@
Source:
@@ -3659,7 +3758,7 @@
Source:
@@ -3764,7 +3863,7 @@
Source:
@@ -3978,7 +4077,7 @@
Source:
@@ -4083,7 +4182,112 @@
Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ quirksMode
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ quirksMode
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+
+ Is the browser running in strict mode (false) or quirks mode? (true)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Default Value:
+
+
+
+
+ Source:
+
@@ -4188,7 +4392,112 @@
Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ silk
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ silk
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+
+ Set to true if running in the Silk browser (as used on the Amazon Kindle)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Default Value:
+
+
+
+
+ Source:
+
@@ -4293,7 +4602,217 @@
Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ trident
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ trident
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+
+ Set to true if running a Trident version of Internet Explorer (IE11+)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Default Value:
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ tridentVersion
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Default Value:
+
+
+
+
+ Source:
+
@@ -4398,7 +4917,112 @@
Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ vibration
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ vibration
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+
+ Does the device support the Vibration API?
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Default Value:
+
+
+
+
+ Source:
+
@@ -4503,7 +5127,7 @@
Source:
@@ -4608,7 +5232,7 @@
Source:
@@ -4713,7 +5337,7 @@
Source:
@@ -4818,7 +5442,7 @@
Source:
@@ -4923,7 +5547,7 @@
Source:
@@ -5028,7 +5652,7 @@
Source:
@@ -5133,7 +5757,7 @@
Source:
@@ -5247,7 +5871,7 @@
Source:
@@ -5339,7 +5963,7 @@
Source:
@@ -5407,13 +6031,13 @@
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:27 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:27 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Phaser.Easing.Back.html b/docs/Phaser.Easing.Back.html
index 227caf6e..5cd5ceb8 100644
--- a/docs/Phaser.Easing.Back.html
+++ b/docs/Phaser.Easing.Back.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -963,13 +957,13 @@
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:28 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:27 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Phaser.Easing.Bounce.html b/docs/Phaser.Easing.Bounce.html
index eefc3a87..559da0c6 100644
--- a/docs/Phaser.Easing.Bounce.html
+++ b/docs/Phaser.Easing.Bounce.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -963,13 +957,13 @@
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:28 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:27 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Phaser.Easing.Circular.html b/docs/Phaser.Easing.Circular.html
index d8de3fde..423e8058 100644
--- a/docs/Phaser.Easing.Circular.html
+++ b/docs/Phaser.Easing.Circular.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -963,13 +957,13 @@
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:28 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:27 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Phaser.Easing.Cubic.html b/docs/Phaser.Easing.Cubic.html
index 029e55f0..56b6e2f3 100644
--- a/docs/Phaser.Easing.Cubic.html
+++ b/docs/Phaser.Easing.Cubic.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -963,13 +957,13 @@
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:28 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:27 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Phaser.Easing.Elastic.html b/docs/Phaser.Easing.Elastic.html
index a2032e2a..445528fa 100644
--- a/docs/Phaser.Easing.Elastic.html
+++ b/docs/Phaser.Easing.Elastic.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -963,13 +957,13 @@
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:28 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:27 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Phaser.Easing.Exponential.html b/docs/Phaser.Easing.Exponential.html
index d0f95ae5..2bec6a2d 100644
--- a/docs/Phaser.Easing.Exponential.html
+++ b/docs/Phaser.Easing.Exponential.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -963,13 +957,13 @@
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:28 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:28 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Phaser.Easing.Linear.html b/docs/Phaser.Easing.Linear.html
index 897f16f3..efd870b1 100644
--- a/docs/Phaser.Easing.Linear.html
+++ b/docs/Phaser.Easing.Linear.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -681,13 +675,13 @@
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:28 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:28 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Phaser.Easing.Quadratic.html b/docs/Phaser.Easing.Quadratic.html
index 9293bc3b..97dd1fb8 100644
--- a/docs/Phaser.Easing.Quadratic.html
+++ b/docs/Phaser.Easing.Quadratic.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -963,13 +957,13 @@
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:28 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:28 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Phaser.Easing.Quartic.html b/docs/Phaser.Easing.Quartic.html
index f0710356..d605c617 100644
--- a/docs/Phaser.Easing.Quartic.html
+++ b/docs/Phaser.Easing.Quartic.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -963,13 +957,13 @@
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:28 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:28 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Phaser.Easing.Quintic.html b/docs/Phaser.Easing.Quintic.html
index 38b69a8d..cae49a2f 100644
--- a/docs/Phaser.Easing.Quintic.html
+++ b/docs/Phaser.Easing.Quintic.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -963,13 +957,13 @@
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:29 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:28 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Phaser.Easing.Sinusoidal.html b/docs/Phaser.Easing.Sinusoidal.html
index 9f27d626..876ace73 100644
--- a/docs/Phaser.Easing.Sinusoidal.html
+++ b/docs/Phaser.Easing.Sinusoidal.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -963,13 +957,13 @@
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:29 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:28 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Phaser.Easing.html b/docs/Phaser.Easing.html
index 9b823c61..76cf08c7 100644
--- a/docs/Phaser.Easing.html
+++ b/docs/Phaser.Easing.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -573,13 +567,13 @@
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:28 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:27 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Phaser.Events.html b/docs/Phaser.Events.html
index 56989c5d..a3c813c2 100644
--- a/docs/Phaser.Events.html
+++ b/docs/Phaser.Events.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -587,13 +581,13 @@
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:29 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:28 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Phaser.Filter.html b/docs/Phaser.Filter.html
index f5ba4e84..20026212 100644
--- a/docs/Phaser.Filter.html
+++ b/docs/Phaser.Filter.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -532,7 +526,7 @@
-Array
+Array
@@ -1011,7 +1005,7 @@
Source:
@@ -1422,7 +1416,7 @@
Source:
@@ -1487,7 +1481,7 @@
Source:
@@ -1872,13 +1866,13 @@
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:29 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:28 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Phaser.Frame.html b/docs/Phaser.Frame.html
index 743e23ef..a7dd759c 100644
--- a/docs/Phaser.Frame.html
+++ b/docs/Phaser.Frame.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -2948,13 +2942,13 @@
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:29 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:28 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Phaser.FrameData.html b/docs/Phaser.FrameData.html
index 6a39c33a..e8a64653 100644
--- a/docs/Phaser.FrameData.html
+++ b/docs/Phaser.FrameData.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -607,7 +601,7 @@
Source:
@@ -1195,7 +1189,7 @@
- getFrameIndexes(frames, useNumericIndex , output ) → {Array}
+ getFrameIndexes(frames, useNumericIndex , output ) → {Array }
@@ -1248,7 +1242,7 @@ The frames indexes are returned in the output array, or if none is provided in a
-Array
+Array
@@ -1322,7 +1316,7 @@ The frames indexes are returned in the output array, or if none is provided in a
-Array
+Array
@@ -1414,7 +1408,7 @@ The frames indexes are returned in the output array, or if none is provided in a
-Array
+Array
@@ -1429,7 +1423,7 @@ The frames indexes are returned in the output array, or if none is provided in a
- getFrameRange(start, end, output ) → {Array}
+ getFrameRange(start, end, output ) → {Array }
@@ -1541,7 +1535,7 @@ The frames indexes are returned in the output array, or if none is provided in a
-Array
+Array
@@ -1629,7 +1623,7 @@ The frames indexes are returned in the output array, or if none is provided in a
-Array
+Array
@@ -1644,7 +1638,7 @@ The frames indexes are returned in the output array, or if none is provided in a
- getFrames(frames, useNumericIndex , output ) → {Array}
+ getFrames(frames, useNumericIndex , output ) → {Array }
@@ -1697,7 +1691,7 @@ The frames are returned in the output array, or if none is provided in a new Arr
-Array
+Array
@@ -1771,7 +1765,7 @@ The frames are returned in the output array, or if none is provided in a new Arr
-Array
+Array
@@ -1863,7 +1857,7 @@ The frames are returned in the output array, or if none is provided in a new Arr
-Array
+Array
@@ -1895,13 +1889,13 @@ The frames are returned in the output array, or if none is provided in a new Arr
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:29 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:28 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Phaser.Game.html b/docs/Phaser.Game.html
index 906478dd..5290e6ce 100644
--- a/docs/Phaser.Game.html
+++ b/docs/Phaser.Game.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -611,6 +605,9 @@ providing quick access to common functions and handling the boot process.
+string
+|
+
HTMLElement
@@ -637,7 +634,7 @@ providing quick access to common functions and handling the boot process.
- The Games DOM parent.
+ The DOM element into which this games canvas will be injected. Either a DOM ID (string) or the element itself.
@@ -650,7 +647,7 @@ providing quick access to common functions and handling the boot process.
-any
+object
@@ -676,7 +673,7 @@ providing quick access to common functions and handling the boot process.
- Description.
+ The default state object. A object consisting of Phaser.State functions (preload, create, update, render) or null.
@@ -917,7 +914,7 @@ providing quick access to common functions and handling the boot process.
Source:
@@ -1015,11 +1012,14 @@ providing quick access to common functions and handling the boot process.
+ Default Value:
+
+
Source:
@@ -1124,7 +1124,7 @@ providing quick access to common functions and handling the boot process.
Source:
@@ -1229,7 +1229,7 @@ providing quick access to common functions and handling the boot process.
Source:
@@ -1334,7 +1334,109 @@ providing quick access to common functions and handling the boot process.
Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ config
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ config
+
+
+
+
+
+object
+
+
+
+
+
+
+
+
+
+ The Phaser.Game configuration object.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
@@ -1439,7 +1541,7 @@ providing quick access to common functions and handling the boot process.
Source:
@@ -1544,7 +1646,7 @@ providing quick access to common functions and handling the boot process.
Source:
@@ -1649,7 +1751,7 @@ providing quick access to common functions and handling the boot process.
Source:
@@ -1747,11 +1849,14 @@ providing quick access to common functions and handling the boot process.
+ Default Value:
+
+
Source:
@@ -1853,7 +1958,7 @@ providing quick access to common functions and handling the boot process.
Source:
@@ -1958,7 +2063,7 @@ providing quick access to common functions and handling the boot process.
Source:
@@ -2063,7 +2168,7 @@ providing quick access to common functions and handling the boot process.
Source:
@@ -2168,7 +2273,7 @@ providing quick access to common functions and handling the boot process.
Source:
@@ -2273,7 +2378,7 @@ providing quick access to common functions and handling the boot process.
Source:
@@ -2378,7 +2483,7 @@ providing quick access to common functions and handling the boot process.
Source:
@@ -2483,7 +2588,7 @@ providing quick access to common functions and handling the boot process.
Source:
@@ -2585,7 +2690,7 @@ providing quick access to common functions and handling the boot process.
Source:
@@ -2690,7 +2795,7 @@ providing quick access to common functions and handling the boot process.
Source:
@@ -2797,7 +2902,112 @@ When a game is paused the onPause event is dispatched. When it is resumed the on
Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <readonly> pendingStep
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ stepping
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+
+ An internal property used by enableStep, but also useful to query from your own game objects.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Default Value:
+
+
+
+
+ Source:
+
@@ -2902,7 +3112,7 @@ When a game is paused the onPause event is dispatched. When it is resumed the on
Source:
@@ -3007,7 +3217,7 @@ When a game is paused the onPause event is dispatched. When it is resumed the on
Source:
@@ -3105,14 +3315,11 @@ When a game is paused the onPause event is dispatched. When it is resumed the on
- Default Value:
-
-
Source:
@@ -3214,7 +3421,7 @@ When a game is paused the onPause event is dispatched. When it is resumed the on
Source:
@@ -3319,7 +3526,7 @@ When a game is paused the onPause event is dispatched. When it is resumed the on
Source:
@@ -3424,7 +3631,7 @@ When a game is paused the onPause event is dispatched. When it is resumed the on
Source:
@@ -3529,7 +3736,7 @@ When a game is paused the onPause event is dispatched. When it is resumed the on
Source:
@@ -3631,7 +3838,217 @@ When a game is paused the onPause event is dispatched. When it is resumed the on
Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <readonly> stepCount
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ stepCount
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ When stepping is enabled this contains the current step cycle.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Default Value:
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <readonly> stepping
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ stepping
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+
+ Enable core loop stepping with Game.enableStep().
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Default Value:
+
+
+
+
+ Source:
+
@@ -3736,7 +4153,7 @@ When a game is paused the onPause event is dispatched. When it is resumed the on
Source:
@@ -3834,11 +4251,14 @@ When a game is paused the onPause event is dispatched. When it is resumed the on
+ Default Value:
+
+
Source:
@@ -3943,7 +4363,7 @@ When a game is paused the onPause event is dispatched. When it is resumed the on
Source:
@@ -4041,11 +4461,14 @@ When a game is paused the onPause event is dispatched. When it is resumed the on
+ Default Value:
+
+
Source:
@@ -4150,7 +4573,7 @@ When a game is paused the onPause event is dispatched. When it is resumed the on
Source:
@@ -4215,7 +4638,7 @@ When a game is paused the onPause event is dispatched. When it is resumed the on
Source:
@@ -4284,7 +4707,146 @@ When a game is paused the onPause event is dispatched. When it is resumed the on
Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ disableStep()
+
+
+
+
+
+
+
+
Disables core game loop stepping.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ enableStep()
+
+
+
+
+
+
+
+
Enable core game loop stepping. When enabled you must call game.step() directly (perhaps via a DOM button?)
+Calling step will advance the game loop by one frame. This is extremely useful to hard to track down errors!
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
@@ -4353,7 +4915,145 @@ When a game is paused the onPause event is dispatched. When it is resumed the on
Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <protected> parseConfig()
+
+
+
+
+
+
+
+
Parses a Game configuration object.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <protected> parseDimension()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
@@ -4422,7 +5122,7 @@ When a game is paused the onPause event is dispatched. When it is resumed the on
Source:
@@ -4491,7 +5191,77 @@ When a game is paused the onPause event is dispatched. When it is resumed the on
Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ step()
+
+
+
+
+
+
+
+
When stepping is enabled you must call this function directly (perhaps via a DOM button?) to advance the game loop by one frame.
+This is extremely useful to hard to track down errors! Use the internal stepCount property to monitor progress.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
@@ -4609,7 +5379,7 @@ When a game is paused the onPause event is dispatched. When it is resumed the on
Source:
@@ -4654,13 +5424,13 @@ When a game is paused the onPause event is dispatched. When it is resumed the on
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:29 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:29 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Phaser.GameObjectFactory.html b/docs/Phaser.GameObjectFactory.html
index f0dbb6f0..336b5ec6 100644
--- a/docs/Phaser.GameObjectFactory.html
+++ b/docs/Phaser.GameObjectFactory.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -790,7 +784,7 @@
-
Creates a new instance of the Sound class.
+
Creates a new Sound object.
@@ -1005,7 +999,7 @@
Source:
@@ -1064,7 +1058,7 @@
-
A BitmapData object which can be manipulated and drawn to like a traditional Canvas object and used to texture Sprites.
+
Experimental: A BitmapData object which can be manipulated and drawn to like a traditional Canvas object and used to texture Sprites.
@@ -1205,7 +1199,7 @@
Source:
@@ -1256,7 +1250,7 @@
-
+ bitmapText(x, y, text, style, group ) → {Phaser.BitmapText }
@@ -1265,7 +1259,7 @@
-Create a new <code>BitmapText</code>.
+Create a new BitmapText object.
@@ -1288,6 +1282,8 @@
Type
+ Argument
+
@@ -1313,6 +1309,14 @@
+
+
+
+
+
+
+
+
@@ -1336,6 +1340,14 @@
+
+
+
+
+
+
+
+
@@ -1359,6 +1371,14 @@
+
+
+
+
+
+
+
+
@@ -1382,6 +1402,14 @@
+
+
+
+
+
+
+
+
@@ -1389,6 +1417,39 @@
+
+
+
+ group
+
+
+
+
+
+Phaser.Group
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+ Optional Group to add the object to. If not specified it will be added to the World group.
+
+
+
@@ -1417,7 +1478,7 @@
Source:
@@ -1468,7 +1529,7 @@
-
+
@@ -1476,7 +1537,7 @@
-
Creates a new <code>Button</code> object.
+
Creates a new Button object.
@@ -1782,6 +1843,75 @@
+
+
+
+ upFrame
+
+
+
+
+
+string
+|
+
+number
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+ This is the frame or frameName that will be set when this button is in an up state. Give either a number to use a frame ID or a string for a frame name.
+
+
+
+
+
+
+ group
+
+
+
+
+
+Phaser.Group
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+ Optional Group to add the object to. If not specified it will be added to the World group.
+
+
+
@@ -1810,7 +1940,7 @@
Source:
@@ -1869,7 +1999,8 @@
-
Create a new Sprite with specific position and sprite sheet key that will automatically be added as a child of the given parent.
+
DEPRECATED - will be removed in Phaser 1.2
+Create a new Sprite with specific position and sprite sheet key that will automatically be added as a child of the given parent.
@@ -2095,7 +2226,7 @@
Source:
@@ -2336,7 +2467,7 @@ at set intervals, and fixes their positions and velocities accorindgly.
Source:
@@ -2641,7 +2772,7 @@ at set intervals, and fixes their positions and velocities accorindgly.
Source:
@@ -2692,7 +2823,7 @@ at set intervals, and fixes their positions and velocities accorindgly.
-
+
@@ -2700,7 +2831,7 @@ at set intervals, and fixes their positions and velocities accorindgly.
-
Creates a new <code>Graphics</code> object.
+
Creates a new Graphics object.
@@ -2722,6 +2853,8 @@ at set intervals, and fixes their positions and velocities accorindgly.
Type
+ Argument
+
@@ -2747,6 +2880,14 @@ at set intervals, and fixes their positions and velocities accorindgly.
+
+
+
+
+
+
+
+
@@ -2770,6 +2911,14 @@ at set intervals, and fixes their positions and velocities accorindgly.
+
+
+
+
+
+
+
+
@@ -2777,6 +2926,39 @@ at set intervals, and fixes their positions and velocities accorindgly.
+
+
+
+ group
+
+
+
+
+
+Phaser.Group
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+ Optional Group to add the object to. If not specified it will be added to the World group.
+
+
+
@@ -2805,7 +2987,7 @@ at set intervals, and fixes their positions and velocities accorindgly.
Source:
@@ -2908,7 +3090,7 @@ at set intervals, and fixes their positions and velocities accorindgly.
-*
+any
@@ -2964,7 +3146,7 @@ at set intervals, and fixes their positions and velocities accorindgly.
- group
+ 'group'
@@ -3001,7 +3183,7 @@ at set intervals, and fixes their positions and velocities accorindgly.
Source:
@@ -3188,7 +3370,7 @@ at set intervals, and fixes their positions and velocities accorindgly.
Source:
@@ -3239,7 +3421,281 @@ at set intervals, and fixes their positions and velocities accorindgly.
- sprite(x, y, key, frame ) → {Phaser.Sprite }
+ sound(key, volume , loop , connect ) → {Phaser.Sound }
+
+
+
+
+
+
+
+
Creates a new Sound object.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+ Argument
+
+
+
+ Default
+
+
+ Description
+
+
+
+
+
+
+
+
+ key
+
+
+
+
+
+string
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The Game.cache key of the sound that this object will use.
+
+
+
+
+
+
+ volume
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ 1
+
+
+
+
+ The volume at which the sound will be played.
+
+
+
+
+
+
+ loop
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ false
+
+
+
+
+ Whether or not the sound will loop.
+
+
+
+
+
+
+ connect
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ Controls if the created Sound object will connect to the master gainNode of the SoundManager when running under WebAudio.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+
+
+
The newly created text object.
+
+
+
+
+
+
+ Type
+
+
+
+Phaser.Sound
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ sprite(x, y, key, frame , group ) → {Phaser.Sprite }
@@ -3415,6 +3871,39 @@ at set intervals, and fixes their positions and velocities accorindgly.
+
+
+
+ group
+
+
+
+
+
+Phaser.Group
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+ Optional Group to add the object to. If not specified it will be added to the World group.
+
+
+
@@ -3494,7 +3983,7 @@ at set intervals, and fixes their positions and velocities accorindgly.
- text(x, y, text, style) → {Phaser.Text }
+ text(x, y, text, style, group ) → {Phaser.Text }
@@ -3502,7 +3991,7 @@ at set intervals, and fixes their positions and velocities accorindgly.
-
Creates a new <code>Text</code>.
+
Creates a new Text object.
@@ -3524,6 +4013,8 @@ at set intervals, and fixes their positions and velocities accorindgly.
Type
+ Argument
+
@@ -3549,6 +4040,14 @@ at set intervals, and fixes their positions and velocities accorindgly.
+
+
+
+
+
+
+
+
@@ -3572,6 +4071,14 @@ at set intervals, and fixes their positions and velocities accorindgly.
+
+
+
+
+
+
+
+
@@ -3595,6 +4102,14 @@ at set intervals, and fixes their positions and velocities accorindgly.
+
+
+
+
+
+
+
+
@@ -3618,6 +4133,14 @@ at set intervals, and fixes their positions and velocities accorindgly.
+
+
+
+
+
+
+
+
@@ -3625,6 +4148,39 @@ at set intervals, and fixes their positions and velocities accorindgly.
+
+
+
+ group
+
+
+
+
+
+Phaser.Group
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+ Optional Group to add the object to. If not specified it will be added to the World group.
+
+
+
@@ -3653,7 +4209,7 @@ at set intervals, and fixes their positions and velocities accorindgly.
Source:
@@ -3704,7 +4260,7 @@ at set intervals, and fixes their positions and velocities accorindgly.
-
+
@@ -3762,7 +4318,33 @@ at set intervals, and fixes their positions and velocities accorindgly.
- Asset key for the JSON file.
+ Asset key for the JSON or CSV map data in the cache.
+
+
+
+
+
+
+ tilesets
+
+
+
+
+
+object
+|
+
+string
+
+
+
+
+
+
+
+
+
+ An object mapping Cache.tileset keys with the tileset names in the JSON file. If a string is provided that will be used.
@@ -3794,7 +4376,7 @@ at set intervals, and fixes their positions and velocities accorindgly.
Source:
@@ -3845,7 +4427,7 @@ at set intervals, and fixes their positions and velocities accorindgly.
-
+ tileSprite(x, y, width, height, key, group ) → {Phaser.TileSprite }
@@ -3853,7 +4435,7 @@ at set intervals, and fixes their positions and velocities accorindgly.
-
Creates a new Tilemap Layer object.
+
Creates a new TileSprite object.
@@ -3875,6 +4457,8 @@ at set intervals, and fixes their positions and velocities accorindgly.
Type
+ Argument
+
@@ -3900,356 +4484,13 @@ at set intervals, and fixes their positions and velocities accorindgly.
-
-
-
- X position of the new tilemapLayer.
-
-
-
-
-
-
- y
-
-
-
-
+
-number
-
-
-
-
-
-
-
-
- Y position of the new tilemapLayer.
-
-
-
-
-
-
- width
-
-
-
-
-number
-
-
-
-
-
-
-
-
- the width of the tilemapLayer.
-
-
-
-
-
-
- height
-
-
-
-
-number
-
-
-
-
-
-
-
-
-
- the height of the tilemapLayer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Source:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Returns:
-
-
-
-
The newly created tilemaplayer object.
-
-
-
-
-
-
- Type
-
-
-
-Phaser.TilemapLayer
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Creates a new Tileset object.
-
-
-
-
-
-
-
-
- Parameters:
-
-
-
-
-
-
- Name
-
-
- Type
-
-
-
-
-
- Description
-
-
-
-
-
-
-
-
- key
-
-
-
-
-
-string
-
-
-
-
-
-
-
-
-
- The image key as defined in the Game.Cache to use as the tileset.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Source:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Returns:
-
-
-
-
The newly created tileset object.
-
-
-
-
-
-
- Type
-
-
-
-Phaser.Tileset
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- tileSprite(x, y, width, height, key, frame) → {Phaser.TileSprite }
-
-
-
-
-
-
-
-
Creates a new <code>TileSprite</code>.
-
-
-
-
-
-
-
-
- Parameters:
-
-
-
-
-
-
- Name
-
-
- Type
-
-
-
-
-
- Description
-
-
-
-
-
-
-
-
- x
-
-
-
-
-
-number
-
-
-
-
-
+
@@ -4274,6 +4515,14 @@ at set intervals, and fixes their positions and velocities accorindgly.
+
+
+
+
+
+
+
+
@@ -4297,6 +4546,14 @@ at set intervals, and fixes their positions and velocities accorindgly.
+
+
+
+
+
+
+
+
@@ -4320,6 +4577,14 @@ at set intervals, and fixes their positions and velocities accorindgly.
+
+
+
+
+
+
+
+
@@ -4349,6 +4614,14 @@ at set intervals, and fixes their positions and velocities accorindgly.
+
+
+
+
+
+
+
+
@@ -4359,26 +4632,33 @@ at set intervals, and fixes their positions and velocities accorindgly.
- frame
+ group
-string
-|
-
-number
+Phaser.Group
+
+
+ <optional>
+
+
+
+
+
+
+
- If this Sprite is using part of a sprite sheet or texture atlas you can specify the exact frame to use by giving a string or numeric index.
+ Optional Group to add the object to. If not specified it will be added to the World group.
@@ -4410,7 +4690,7 @@ at set intervals, and fixes their positions and velocities accorindgly.
Source:
@@ -4551,7 +4831,7 @@ at set intervals, and fixes their positions and velocities accorindgly.
Source:
@@ -4619,13 +4899,13 @@ at set intervals, and fixes their positions and velocities accorindgly.
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:29 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:29 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Phaser.Gamepad.html b/docs/Phaser.Gamepad.html
new file mode 100644
index 00000000..aeae4f64
--- /dev/null
+++ b/docs/Phaser.Gamepad.html
@@ -0,0 +1,3409 @@
+
+
+
+
+
+ Phaser Class: Gamepad
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Class: Gamepad
+
+
+
+
+ Phaser .
+
+ Gamepad
+
+
+
+
+
+
+
+
+
+
+
+
+
+ new Gamepad(game)
+
+
+
+
+
+
+
+
The Gamepad class handles looking after gamepad input for your game.
+Remember to call gamepad.start(); expecting input!
+
HTML5 GAMEPAD API SUPPORT IS AT AN EXPERIMENTAL STAGE!
+At moment of writing this (end of 2013) only Chrome supports parts of it out of the box. Firefox supports it
+via prefs flags (about:config, search gamepad). The browsers map the same controllers differently.
+This class has constans for Windows 7 Chrome mapping of
+XBOX 360 controller.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ game
+
+
+
+
+
+Phaser.Game
+
+
+
+
+
+
+
+
+
+ A reference to the currently running game.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Members
+
+
+
+
+ <readonly> active
+
+
+
+
+
+
+
If the gamepad input is active or not - if not active it should not be updated from Input.js
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ active
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+
+ If the gamepad input is active or not.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ callbackContext
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ callbackContext
+
+
+
+
+
+Object
+
+
+
+
+
+
+
+
+
+ The context under which the callbacks are run.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ disabled
+
+
+
+
+
+
+
You can disable all Gamepad Input by setting disabled to true. While true all new input related events will be ignored.
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ disabled
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+
+ The disabled state of the Gamepad.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Default Value:
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ game
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ game
+
+
+
+
+
+Phaser.Game
+
+
+
+
+
+
+
+
+
+ Local reference to game.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ onAxisCallback
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ onAxisCallback
+
+
+
+
+
+function
+
+
+
+
+
+
+
+
+
+ This callback is invoked every time any gamepad axis is changed.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ onConnectCallback
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ onConnectCallback
+
+
+
+
+
+function
+
+
+
+
+
+
+
+
+
+ This callback is invoked every time any gamepad is connected
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ onDisconnectCallback
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ onDisconnectCallback
+
+
+
+
+
+function
+
+
+
+
+
+
+
+
+
+ This callback is invoked every time any gamepad is disconnected
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ onDownCallback
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ onDownCallback
+
+
+
+
+
+function
+
+
+
+
+
+
+
+
+
+ This callback is invoked every time any gamepad button is pressed down.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ onFloatCallback
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ onFloatCallback
+
+
+
+
+
+function
+
+
+
+
+
+
+
+
+
+ This callback is invoked every time any gamepad button is changed to a value where value > 0 and value < 1.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ onUpCallback
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ onUpCallback
+
+
+
+
+
+function
+
+
+
+
+
+
+
+
+
+ This callback is invoked every time any gamepad button is released.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <readonly> pad1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ pad1
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+
+ Gamepad #1;
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <readonly> pad2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ pad2
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+
+ Gamepad #2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <readonly> pad3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ pad3
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+
+ Gamepad #3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <readonly> pad4
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ pad4
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+
+ Gamepad #4
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <readonly> padsConnected
+
+
+
+
+
+
+
How many live gamepads are currently connected.
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ padsConnected
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+
+ How many live gamepads are currently connected.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <readonly> supported
+
+
+
+
+
+
+
Whether or not gamepads are supported in current browser.
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ supported
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+
+ Whether or not gamepads are supported in current browser.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Methods
+
+
+
+
+ addCallbacks(context, callbacks)
+
+
+
+
+
+
+
+
Add callbacks to the main Gamepad handler to handle connect/disconnect/button down/button up/axis change/float value buttons
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ context
+
+
+
+
+
+Object
+
+
+
+
+
+
+
+
+
+ The context under which the callbacks are run.
+
+
+
+
+
+
+ callbacks
+
+
+
+
+
+Object
+
+
+
+
+
+
+
+
+
+ Object that takes six different callback methods:
+onConnectCallback, onDisconnectCallback, onDownCallback, onUpCallback, onAxisCallback, onFloatCallback
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ addCallbacks(context, callbacks)
+
+
+
+
+
+
+
+
Add callbacks to the this Gamepad to handle connect/disconnect/button down/button up/axis change/float value buttons
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ context
+
+
+
+
+
+Object
+
+
+
+
+
+
+
+
+
+ The context under which the callbacks are run.
+
+
+
+
+
+
+ callbacks
+
+
+
+
+
+Object
+
+
+
+
+
+
+
+
+
+ Object that takes six different callbak methods:
+onConnectCallback, onDisconnectCallback, onDownCallback, onUpCallback, onAxisCallback, onFloatCallback
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ isDown(buttonCode) → {boolean}
+
+
+
+
+
+
+
+
Returns true if the button is currently pressed down, on ANY gamepad.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ buttonCode
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ The buttonCode of the button to check for.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+
+
+
True if a button is currently down.
+
+
+
+
+
+
+ Type
+
+
+
+boolean
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ justPressed(buttonCode, duration ) → {boolean}
+
+
+
+
+
+
+
+
Returns the "just pressed" state of a button from ANY gamepad connected. Just pressed is considered true if the button was pressed down within the duration given (default 250ms).
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+ Argument
+
+
+
+ Default
+
+
+ Description
+
+
+
+
+
+
+
+
+ buttonCode
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The buttonCode of the button to check for.
+
+
+
+
+
+
+ duration
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ 250
+
+
+
+
+ The duration below which the button is considered as being just pressed.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+
+
+
True if the button is just pressed otherwise false.
+
+
+
+
+
+
+ Type
+
+
+
+boolean
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ justPressed(buttonCode, duration ) → {boolean}
+
+
+
+
+
+
+
+
Returns the "just released" state of a button from ANY gamepad connected. Just released is considered as being true if the button was released within the duration given (default 250ms).
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+ Argument
+
+
+
+ Default
+
+
+ Description
+
+
+
+
+
+
+
+
+ buttonCode
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The buttonCode of the button to check for.
+
+
+
+
+
+
+ duration
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ 250
+
+
+
+
+ The duration below which the button is considered as being just released.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+
+
+
True if the button is just released otherwise false.
+
+
+
+
+
+
+ Type
+
+
+
+boolean
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ reset()
+
+
+
+
+
+
+
+
Reset all buttons/axes of all gamepads
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ setDeadZones()
+
+
+
+
+
+
+
+
Sets the deadZone variable for all four gamepads
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ start()
+
+
+
+
+
+
+
+
Starts the Gamepad event handling.
+This MUST be called manually before Phaser will start polling the Gamepad API.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ stop()
+
+
+
+
+
+
+
+
Stops the Gamepad event handling.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
+
+
+
+
+ Documentation generated by JSDoc 3.3.0-dev
+ on Wed Feb 05 2014 06:28:29 GMT-0000 (GMT) using the DocStrap template .
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/Phaser.GamepadButton.html b/docs/Phaser.GamepadButton.html
new file mode 100644
index 00000000..8a741cdf
--- /dev/null
+++ b/docs/Phaser.GamepadButton.html
@@ -0,0 +1,2587 @@
+
+
+
+
+
+ Phaser Class: GamepadButton
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Class: GamepadButton
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ game
+
+
+
+
+
+Phaser.Game
+
+
+
+
+
+
+
+
+
+ Current game instance.
+
+
+
+
+
+
+ buttoncode
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ The button code this GamepadButton is responsible for.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Members
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ buttonCode
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ The buttoncode of this button.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ duration
+
+
+
+
+
+
+
If the button is down this value holds the duration of that button press and is constantly updated.
+If the button is up it holds the duration of the previous down session.
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ duration
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ The number of milliseconds this button has been held down for.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Default Value:
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ game
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ game
+
+
+
+
+
+Phaser.Game
+
+
+
+
+
+
+
+
+
+ A reference to the currently running game.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ isDown
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ isDown
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+
+ The "down" state of the button.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Default Value:
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ isUp
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ isUp
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+
+ The "up" state of the button.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Default Value:
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ onDown
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ onDown
+
+
+
+
+
+Phaser.Signal
+
+
+
+
+
+
+
+
+
+ This Signal is dispatched every time this GamepadButton is pressed down. It is only dispatched once (until the button is released again).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ onFloat
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ onFloat
+
+
+
+
+
+Phaser.Signal
+
+
+
+
+
+
+
+
+
+ This Signal is dispatched every time this GamepadButton changes floating value (between (but not exactly) 0 and 1)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ onUp
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ onUp
+
+
+
+
+
+Phaser.Signal
+
+
+
+
+
+
+
+
+
+ This Signal is dispatched every time this GamepadButton is pressed down. It is only dispatched once (until the button is released again).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ repeats
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ repeats
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ If a button is held down this holds down the number of times the button has 'repeated'.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Default Value:
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ timeDown
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ timeDown
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ The timestamp when the button was last pressed down.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Default Value:
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ timeUp
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ timeUp
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ The timestamp when the button was last released.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Default Value:
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ value
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ value
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ Button value. Mainly useful for checking analog buttons (like shoulder triggers)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Default Value:
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Methods
+
+
+
+
+ justPressed(duration ) → {boolean}
+
+
+
+
+
+
+
+
Returns the "just pressed" state of this button. Just pressed is considered true if the button was pressed down within the duration given (default 250ms).
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+ Argument
+
+
+
+ Default
+
+
+ Description
+
+
+
+
+
+
+
+
+ duration
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ 250
+
+
+
+
+ The duration below which the button is considered as being just pressed.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+
+
+
True if the button is just pressed otherwise false.
+
+
+
+
+
+
+ Type
+
+
+
+boolean
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ justPressed(duration ) → {boolean}
+
+
+
+
+
+
+
+
Returns the "just released" state of this button. Just released is considered as being true if the button was released within the duration given (default 250ms).
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+ Argument
+
+
+
+ Default
+
+
+ Description
+
+
+
+
+
+
+
+
+ duration
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ 250
+
+
+
+
+ The duration below which the button is considered as being just released.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+
+
+
True if the button is just pressed otherwise false.
+
+
+
+
+
+
+ Type
+
+
+
+boolean
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Called automatically by Phaser.SinglePad.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ value
+
+
+
+
+
+Object
+
+
+
+
+
+
+
+
+
+ Button value
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Called automatically by Phaser.Gamepad.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ value
+
+
+
+
+
+Object
+
+
+
+
+
+
+
+
+
+ Button value
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Called automatically by Phaser.SinglePad.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ value
+
+
+
+
+
+Object
+
+
+
+
+
+
+
+
+
+ Button value
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
+
+
+
+
+ Documentation generated by JSDoc 3.3.0-dev
+ on Wed Feb 05 2014 06:28:29 GMT-0000 (GMT) using the DocStrap template .
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/Phaser.Graphics.html b/docs/Phaser.Graphics.html
index 8d98e7fc..75ae9f33 100644
--- a/docs/Phaser.Graphics.html
+++ b/docs/Phaser.Graphics.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -739,13 +733,13 @@
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:29 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:29 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Phaser.Group.html b/docs/Phaser.Group.html
index 4d4e8b21..79bcc812 100644
--- a/docs/Phaser.Group.html
+++ b/docs/Phaser.Group.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -547,7 +541,7 @@
- The parent Group or DisplayObjectContainer that will hold this group, if any.
+ The parent Group or DisplayObjectContainer that will hold this group, if any. If undefined it will use game.world.
@@ -743,7 +737,7 @@
Source:
@@ -803,7 +797,7 @@
Source:
@@ -863,7 +857,7 @@
Source:
@@ -923,7 +917,7 @@
Source:
@@ -983,7 +977,112 @@
Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ alive
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ alive
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+
+ The alive property is useful for Groups that are children of other Groups and need to be included/excluded in checks like forEachAlive.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Default Value:
+
+
+
+
+ Source:
+
@@ -1085,7 +1184,7 @@
Source:
@@ -1192,7 +1291,7 @@ This will have no impact on the rotation value of its children, but it will upda
Source:
@@ -1299,7 +1398,7 @@ The cursor is set to the first child added to the Group and doesn't change unles
Source:
@@ -1404,7 +1503,7 @@ The cursor is set to the first child added to the Group and doesn't change unles
Source:
@@ -1506,7 +1605,109 @@ The cursor is set to the first child added to the Group and doesn't change unles
Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ group
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ group
+
+
+
+
+
+Phaser.Group
+
+
+
+
+
+
+
+
+
+ The parent Group of this Group, if a child of another.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
@@ -1579,7 +1780,7 @@ The cursor is set to the first child added to the Group and doesn't change unles
- The number of children in this Group.
+ The total number of children in this Group, regardless of their exists/alive status.
@@ -1608,7 +1809,7 @@ The cursor is set to the first child added to the Group and doesn't change unles
Source:
@@ -1710,7 +1911,109 @@ The cursor is set to the first child added to the Group and doesn't change unles
Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ pivot
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ pivot
+
+
+
+
+
+Phaser.Point
+
+
+
+
+
+
+
+
+
+ The pivot point of the Group container.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
@@ -1817,7 +2120,7 @@ This will have no impact on the rotation value of its children, but it will upda
Source:
@@ -1890,7 +2193,7 @@ This will have no impact on the rotation value of its children, but it will upda
- Replaces the PIXI.Point with a slightly more flexible one.
+ The scane of the Group container.
@@ -1919,7 +2222,7 @@ This will have no impact on the rotation value of its children, but it will upda
Source:
@@ -1992,7 +2295,7 @@ This will have no impact on the rotation value of its children, but it will upda
- The total number of children in this Group, regardless of their alive state.
+ The total number of children in this Group who have a state of exists = true.
@@ -2021,7 +2324,7 @@ This will have no impact on the rotation value of its children, but it will upda
Source:
@@ -2123,7 +2426,7 @@ This will have no impact on the rotation value of its children, but it will upda
Source:
@@ -2225,7 +2528,7 @@ This will have no impact on the rotation value of its children, but it will upda
Source:
@@ -2332,7 +2635,7 @@ This will have no impact on the x/y coordinates of its children, but it will upd
Source:
@@ -2439,7 +2742,7 @@ This will have no impact on the x/y coordinates of its children, but it will upd
Source:
@@ -2555,7 +2858,7 @@ that then see the addAt method.
Source:
@@ -2775,7 +3078,7 @@ Group.addAll('x', 10) will add 10 to the child.x value.
Source:
@@ -2917,7 +3220,7 @@ The child is added to the Group at the location specified by the index value, th
Source:
@@ -3058,7 +3361,7 @@ The child is added to the Group at the location specified by the index value, th
Source:
@@ -3218,12 +3521,12 @@ After the method parameter and context you can add as many extra parameters as y
- ''
+ null
- A string containing the context under which the method will be executed. Leave to '' to default to the child.
+ A string containing the context under which the method will be executed. Set to null to default to the child.
@@ -3292,7 +3595,7 @@ After the method parameter and context you can add as many extra parameters as y
Source:
@@ -3485,7 +3788,7 @@ After the existsValue parameter you can add as many parameters as you like, whic
Source:
@@ -3521,7 +3824,7 @@ After the existsValue parameter you can add as many parameters as you like, whic
-
Calls a function on all of the children that have exists=true in this Group.
+
Returns a reference to a function that exists on a child of the Group based on the given callback array.
@@ -3649,7 +3952,76 @@ After the existsValue parameter you can add as many parameters as you like, whic
Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ childTest()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
@@ -3718,7 +4090,7 @@ After the existsValue parameter you can add as many parameters as you like, whic
Source:
@@ -3743,7 +4115,7 @@ After the existsValue parameter you can add as many parameters as you like, whic
-
The number of children flagged as dead. Returns -1 if Group is empty.
+
The number of children flagged as dead.
@@ -3810,7 +4182,7 @@ After the existsValue parameter you can add as many parameters as you like, whic
Source:
@@ -3835,7 +4207,7 @@ After the existsValue parameter you can add as many parameters as you like, whic
-
The number of children flagged as alive. Returns -1 if Group is empty.
+
The number of children flagged as alive.
@@ -4117,7 +4489,7 @@ Useful if you don't need to create the Sprite instances before-hand.
Source:
@@ -4390,7 +4762,7 @@ and will be positioned at 0, 0 (relative to the Group.x/y)
Source:
@@ -4418,7 +4790,7 @@ and will be positioned at 0, 0 (relative to the Group.x/y)
- destroy()
+ destroy(destroyChildren )
@@ -4435,6 +4807,75 @@ and will be positioned at 0, 0 (relative to the Group.x/y)
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+ Argument
+
+
+
+ Default
+
+
+ Description
+
+
+
+
+
+
+
+
+ destroyChildren
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ false
+
+
+
+
+ Should every child of this Group have its destroy method called?
+
+
+
+
+
+
+
@@ -4459,7 +4900,7 @@ and will be positioned at 0, 0 (relative to the Group.x/y)
Source:
@@ -4647,145 +5088,7 @@ Group.divideAll('x', 2) will half the child.x value.
Source:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- dump(full )
-
-
-
-
-
-
-
-
Dumps out a list of Group children and their index positions to the browser console. Useful for group debugging.
-
-
-
-
-
-
-
-
- Parameters:
-
-
-
-
-
-
- Name
-
-
- Type
-
-
- Argument
-
-
-
- Default
-
-
- Description
-
-
-
-
-
-
-
-
- full
-
-
-
-
-
-boolean
-
-
-
-
-
-
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
-
- false
-
-
-
-
- If full the dump will include the entire display list, start from the Stage. Otherwise it will only include this container.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Source:
-
@@ -4823,7 +5126,8 @@ Group.divideAll('x', 2) will half the child.x value.
Allows you to call your own function on each member of this Group. You must pass the callback and context in which it will run.
After the checkExists parameter you can add as many parameters as you like, which will all be passed to the callback along with the child.
-For example: Group.forEach(awardBonusGold, this, true, 100, 500)
+For example: Group.forEach(awardBonusGold, this, true, 100, 500)
+Note: Currently this will skip any children which are Groups themselves.
@@ -4951,7 +5255,7 @@ For example: Group.forEach(awardBonusGold, this, true, 100, 500)
Source:
@@ -5094,7 +5398,7 @@ For example: Group.forEachAlive(causeDamage, this, 500)
Source:
@@ -5237,7 +5541,7 @@ For example: Group.forEachAlive(causeDamage, this, 500)
Source:
@@ -5380,7 +5684,7 @@ For example: Group.forEachDead(bringToLife, this)
Source:
@@ -5498,7 +5802,7 @@ For example: Group.forEachDead(bringToLife, this)
Source:
@@ -5591,7 +5895,7 @@ This is handy for checking if everything has been wiped out, or choosing a squad
Source:
@@ -5684,7 +5988,7 @@ This is handy for checking if everything has been wiped out, or choosing a squad
Source:
@@ -5825,7 +6129,7 @@ This is handy for checking if everything has been wiped out, or choosing a squad
Source:
@@ -5966,7 +6270,7 @@ This is handy for checking if everything has been wiped out, or choosing a squad
Source:
@@ -6130,7 +6434,7 @@ This is handy for checking if everything has been wiped out, or choosing a squad
Source:
@@ -6181,7 +6485,7 @@ This is handy for checking if everything has been wiped out, or choosing a squad
- iterate(key, value, returnType, callback , callbackContext )
+ iterate(key, value, returnType, callback , callbackContext ) → {any}
@@ -6435,7 +6739,7 @@ You can add as many callback parameters as you like, which will all be passed to
Source:
@@ -6456,6 +6760,29 @@ You can add as many callback parameters as you like, which will all be passed to
+ Returns:
+
+
+
+
Returns either a numeric total (if RETURN_TOTAL was specified) or the child object.
+
+
+
+
+
+
+ Type
+
+
+
+any
+
+
+
+
+
+
+
@@ -6623,7 +6950,7 @@ Group.multiplyAll('x', 2) will x2 the child.x value.
Source:
@@ -6692,7 +7019,7 @@ Group.multiplyAll('x', 2) will x2 the child.x value.
Source:
@@ -6761,7 +7088,7 @@ Group.multiplyAll('x', 2) will x2 the child.x value.
Source:
@@ -6879,7 +7206,7 @@ Group.multiplyAll('x', 2) will x2 the child.x value.
Source:
@@ -6972,7 +7299,7 @@ The Group container remains on the display list.
Source:
@@ -7113,7 +7440,7 @@ The Group container remains on the display list.
Source:
@@ -7254,7 +7581,329 @@ The Group container remains on the display list.
Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ set(child, key, value, checkAlive , checkVisible , operation )
+
+
+
+
+
+
+
+
This function allows you to quickly set a property on a single child of this Group to a new value.
+The operation parameter controls how the new value is assigned to the property, from simple replacement to addition and multiplication.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+ Argument
+
+
+
+ Default
+
+
+ Description
+
+
+
+
+
+
+
+
+ child
+
+
+
+
+
+Phaser.Sprite
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The child to set the property on.
+
+
+
+
+
+
+ key
+
+
+
+
+
+string
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The property, as a string, to be set. For example: 'body.velocity.x'
+
+
+
+
+
+
+ value
+
+
+
+
+
+*
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The value that will be set.
+
+
+
+
+
+
+ checkAlive
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ false
+
+
+
+
+ If set then the child will only be updated if alive=true.
+
+
+
+
+
+
+ checkVisible
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ false
+
+
+
+
+ If set then the child will only be updated if visible=true.
+
+
+
+
+
+
+ operation
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ 0
+
+
+
+
+ Controls how the value is assigned. A value of 0 replaces the value with the new one. A value of 1 adds it, 2 subtracts it, 3 multiplies it and 4 divides it.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
@@ -7541,7 +8190,7 @@ The operation parameter controls how the new value is assigned to the property,
Source:
@@ -7784,7 +8433,7 @@ The operation parameter controls how the new value is assigned to the property,
Source:
@@ -7962,7 +8611,7 @@ For example to depth sort Sprites for Zelda-style game you might call grou
Source:
@@ -8150,7 +8799,7 @@ Group.subAll('x', 10) will minus 10 from the child.x value.
Source:
@@ -8292,7 +8941,7 @@ You cannot swap a child with itself, or swap un-parented children, doing so will
Source:
@@ -8338,6 +8987,75 @@ You cannot swap a child with itself, or swap un-parented children, doing so will
+
+
+
+
+
+ swapIndex()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -8360,13 +9078,13 @@ You cannot swap a child with itself, or swap un-parented children, doing so will
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:30 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:29 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Phaser.Input.html b/docs/Phaser.Input.html
index 524d8463..66d143c8 100644
--- a/docs/Phaser.Input.html
+++ b/docs/Phaser.Input.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -615,7 +609,7 @@ The Input manager is updated automatically by the core game loop.
Source:
@@ -675,7 +669,7 @@ The Input manager is updated automatically by the core game loop.
Source:
@@ -735,7 +729,7 @@ The Input manager is updated automatically by the core game loop.
Source:
@@ -845,7 +839,7 @@ When you've limited max pointers to 1 this will accurately be either the first f
Source:
@@ -952,7 +946,7 @@ Default size of 44px (Apples recommended "finger tip" size) but can be
Source:
@@ -1061,7 +1055,7 @@ Default size of 44px (Apples recommended "finger tip" size) but can be
Source:
@@ -1171,7 +1165,7 @@ If you need to disable just one type of input, for example mouse, use Input.mous
Source:
@@ -1280,7 +1274,7 @@ If you need to disable just one type of input, for example mouse, use Input.mous
Source:
@@ -1391,6 +1385,115 @@ If you need to disable just one type of input, for example mouse, use Input.mous
+
+
+
+
+
+
+
+
+
+ gamepad
+
+
+
+
+
+
+
The Gamepad Input manager.
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ gamepad
+
+
+
+
+
+Phaser.Gamepad
+
+
+
+
+
+
+
+
+
+ The Gamepad Input manager.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Default Value:
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
@@ -1701,7 +1804,7 @@ If you need to disable just one type of input, for example mouse, use Input.mous
Source:
@@ -1807,7 +1910,7 @@ If you need to disable just one type of input, for example mouse, use Input.mous
Source:
@@ -1916,7 +2019,7 @@ If you need to disable just one type of input, for example mouse, use Input.mous
Source:
@@ -2025,7 +2128,7 @@ If you need to disable just one type of input, for example mouse, use Input.mous
Source:
@@ -2134,7 +2237,7 @@ If you need to disable just one type of input, for example mouse, use Input.mous
Source:
@@ -2244,7 +2347,7 @@ For lots of games it's useful to set this to 1.
Source:
@@ -2353,7 +2456,7 @@ For lots of games it's useful to set this to 1.
Source:
@@ -2462,7 +2565,211 @@ For lots of games it's useful to set this to 1.
Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ moveCallback
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ moveCallback
+
+
+
+
+
+function
+
+
+
+
+
+
+
+
+
+ An optional callback that will be fired every time the activePointer receives a move event from the DOM. Set to null to disable.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ moveCallbackContext
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ moveCallbackContext
+
+
+
+
+
+object
+
+
+
+
+
+
+
+
+
+ The context in which the moveCallback will be sent. Defaults to Phaser.Input but can be set to any valid JS object.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
@@ -2571,7 +2878,7 @@ For lots of games it's useful to set this to 1.
Source:
@@ -2677,7 +2984,7 @@ For lots of games it's useful to set this to 1.
Source:
@@ -2786,7 +3093,7 @@ For lots of games it's useful to set this to 1.
Source:
@@ -2895,7 +3202,7 @@ For lots of games it's useful to set this to 1.
Source:
@@ -3004,7 +3311,7 @@ For lots of games it's useful to set this to 1.
Source:
@@ -3113,7 +3420,7 @@ For lots of games it's useful to set this to 1.
Source:
@@ -3219,7 +3526,7 @@ For lots of games it's useful to set this to 1.
Source:
@@ -3325,7 +3632,7 @@ For lots of games it's useful to set this to 1.
Source:
@@ -3431,7 +3738,7 @@ For lots of games it's useful to set this to 1.
Source:
@@ -3537,7 +3844,7 @@ For lots of games it's useful to set this to 1.
Source:
@@ -3643,7 +3950,7 @@ For lots of games it's useful to set this to 1.
Source:
@@ -3749,7 +4056,7 @@ For lots of games it's useful to set this to 1.
Source:
@@ -3855,7 +4162,7 @@ For lots of games it's useful to set this to 1.
Source:
@@ -3961,7 +4268,7 @@ For lots of games it's useful to set this to 1.
Source:
@@ -4067,7 +4374,7 @@ For lots of games it's useful to set this to 1.
Source:
@@ -4173,7 +4480,7 @@ For lots of games it's useful to set this to 1.
Source:
@@ -4275,7 +4582,7 @@ For lots of games it's useful to set this to 1.
Source:
@@ -4385,7 +4692,7 @@ A value of 0 means every single frame (60fps), a value of 1 means every other fr
Source:
@@ -4490,7 +4797,7 @@ A value of 0 means every single frame (60fps), a value of 1 means every other fr
Source:
@@ -4600,7 +4907,7 @@ If the Pointer is tracking one event every 100ms, then a trackLimit of 100 would
Source:
@@ -4711,7 +5018,7 @@ The history is updated at the rate specified in Input.pollRate
Source:
@@ -4820,7 +5127,7 @@ The history is updated at the rate specified in Input.pollRate
Source:
@@ -4927,7 +5234,7 @@ In an un-scaled game the values will be x: 1 and y: 1.
Source:
@@ -5033,7 +5340,7 @@ In an un-scaled game the values will be x: 1 and y: 1.
Source:
@@ -5142,7 +5449,7 @@ In an un-scaled game the values will be x: 1 and y: 1.
Source:
@@ -5248,7 +5555,7 @@ In an un-scaled game the values will be x: 1 and y: 1.
Source:
@@ -5354,7 +5661,7 @@ In an un-scaled game the values will be x: 1 and y: 1.
Source:
@@ -5463,7 +5770,7 @@ In an un-scaled game the values will be x: 1 and y: 1.
Source:
@@ -5569,7 +5876,7 @@ In an un-scaled game the values will be x: 1 and y: 1.
Source:
@@ -5675,7 +5982,7 @@ In an un-scaled game the values will be x: 1 and y: 1.
Source:
@@ -5781,7 +6088,7 @@ In an un-scaled game the values will be x: 1 and y: 1.
Source:
@@ -5887,7 +6194,7 @@ In an un-scaled game the values will be x: 1 and y: 1.
Source:
@@ -5953,7 +6260,7 @@ If you need more then use this to create a new one, up to a maximum of 10.
Source:
@@ -6045,7 +6352,7 @@ If you need more then use this to create a new one, up to a maximum of 10.
Source:
@@ -6114,7 +6421,7 @@ If you need more then use this to create a new one, up to a maximum of 10.
Source:
@@ -6232,7 +6539,7 @@ If you need more then use this to create a new one, up to a maximum of 10.
Source:
@@ -6373,7 +6680,7 @@ If you need more then use this to create a new one, up to a maximum of 10.
Source:
@@ -6514,7 +6821,7 @@ If you need more then use this to create a new one, up to a maximum of 10.
Source:
@@ -6655,7 +6962,150 @@ If you need more then use this to create a new one, up to a maximum of 10.
Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ setMoveCallback(callback, callbackContext)
+
+
+
+
+
+
+
+
Sets a callback that is fired every time the activePointer receives a DOM move event such as a mousemove or touchmove.
+It will be called every time the activePointer moves, which in a multi-touch game can be a lot of times, so this is best
+to only use if you've limited input to a single pointer (i.e. mouse or touch)
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ callback
+
+
+
+
+
+function
+
+
+
+
+
+
+
+
+
+ The callback that will be called each time the activePointer receives a DOM move event.
+
+
+
+
+
+
+ callbackContext
+
+
+
+
+
+object
+
+
+
+
+
+
+
+
+
+ The context in which the callback will be called.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
@@ -6773,7 +7223,7 @@ If you need more then use this to create a new one, up to a maximum of 10.
Source:
@@ -6914,7 +7364,7 @@ If you need more then use this to create a new one, up to a maximum of 10.
Source:
@@ -7006,7 +7456,7 @@ If you need more then use this to create a new one, up to a maximum of 10.
Source:
@@ -7124,7 +7574,7 @@ If you need more then use this to create a new one, up to a maximum of 10.
Source:
@@ -7192,13 +7642,13 @@ If you need more then use this to create a new one, up to a maximum of 10.
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:30 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:30 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Phaser.InputHandler.html b/docs/Phaser.InputHandler.html
index 07ac1b8b..d9e43038 100644
--- a/docs/Phaser.InputHandler.html
+++ b/docs/Phaser.InputHandler.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -659,7 +653,7 @@
Source:
@@ -764,7 +758,7 @@
Source:
@@ -869,7 +863,7 @@
Source:
@@ -974,7 +968,7 @@
Source:
@@ -1079,7 +1073,7 @@
Source:
@@ -1189,7 +1183,7 @@ For example if you had a stack of 6 sprites with the same priority IDs and one c
Source:
@@ -1294,7 +1288,7 @@ For example if you had a stack of 6 sprites with the same priority IDs and one c
Source:
@@ -1606,7 +1600,7 @@ For example if you had a stack of 6 sprites with the same priority IDs and one c
Source:
@@ -1711,7 +1705,7 @@ For example if you had a stack of 6 sprites with the same priority IDs and one c
Source:
@@ -1816,7 +1810,7 @@ For example if you had a stack of 6 sprites with the same priority IDs and one c
Source:
@@ -1921,7 +1915,7 @@ For example if you had a stack of 6 sprites with the same priority IDs and one c
Source:
@@ -2024,6 +2018,111 @@ For example if you had a stack of 6 sprites with the same priority IDs and one c
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ snapOffsetX
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ snapOffsetX
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ This defines the top-left X coordinate of the snap grid.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Default Value:
+
+
+
+
Source:
+
+
+
+
+
+
+
+
+ snapOffsetY
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ snapOffsetY
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ This defines the top-left Y coordinate of the snap grid..
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Default Value:
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
@@ -2131,7 +2335,7 @@ For example if you had a stack of 6 sprites with the same priority IDs and one c
Source:
@@ -2236,7 +2440,7 @@ For example if you had a stack of 6 sprites with the same priority IDs and one c
Source:
@@ -2341,7 +2545,7 @@ For example if you had a stack of 6 sprites with the same priority IDs and one c
Source:
@@ -2446,7 +2650,7 @@ For example if you had a stack of 6 sprites with the same priority IDs and one c
Source:
@@ -2653,7 +2857,7 @@ For example if you had a stack of 6 sprites with the same priority IDs and one c
Source:
@@ -2718,7 +2922,7 @@ For example if you had a stack of 6 sprites with the same priority IDs and one c
Source:
@@ -2787,7 +2991,7 @@ For example if you had a stack of 6 sprites with the same priority IDs and one c
Source:
@@ -2929,7 +3133,7 @@ It compares the alpha value of the pixel and if >= InputHandler.pixelPerfectA
Source:
@@ -3070,7 +3274,7 @@ It compares the alpha value of the pixel and if >= InputHandler.pixelPerfectA
Source:
@@ -3158,7 +3362,7 @@ It compares the alpha value of the pixel and if >= InputHandler.pixelPerfectA
Source:
@@ -3227,7 +3431,7 @@ It compares the alpha value of the pixel and if >= InputHandler.pixelPerfectA
Source:
@@ -3296,7 +3500,7 @@ It compares the alpha value of the pixel and if >= InputHandler.pixelPerfectA
Source:
@@ -3414,7 +3618,7 @@ It compares the alpha value of the pixel and if >= InputHandler.pixelPerfectA
Source:
@@ -3770,7 +3974,7 @@ It compares the alpha value of the pixel and if >= InputHandler.pixelPerfectA
Source:
@@ -3798,7 +4002,7 @@ It compares the alpha value of the pixel and if >= InputHandler.pixelPerfectA
- enableSnap(snapX, snapY, onDrag , onRelease )
+ enableSnap(snapX, snapY, onDrag , onRelease , snapOffsetX , snapOffsetX )
@@ -3990,6 +4194,84 @@ For example 16x16 as the snapX and snapY would make the sprite snap to every 16
+
+
+
+ snapOffsetX
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ 0
+
+
+
+
+ Used to offset the top-left starting point of the snap grid.
+
+
+
+
+
+
+ snapOffsetX
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ 0
+
+
+
+
+ Used to offset the top-left starting point of the snap grid.
+
+
+
@@ -4018,7 +4300,7 @@ For example 16x16 as the snapX and snapY would make the sprite snap to every 16
Source:
@@ -4159,7 +4441,7 @@ For example 16x16 as the snapX and snapY would make the sprite snap to every 16
Source:
@@ -4319,7 +4601,7 @@ For example 16x16 as the snapX and snapY would make the sprite snap to every 16
Source:
@@ -4479,7 +4761,7 @@ For example 16x16 as the snapX and snapY would make the sprite snap to every 16
Source:
@@ -4639,7 +4921,7 @@ For example 16x16 as the snapX and snapY would make the sprite snap to every 16
Source:
@@ -4776,7 +5058,7 @@ For example 16x16 as the snapX and snapY would make the sprite snap to every 16
Source:
@@ -4917,7 +5199,7 @@ For example 16x16 as the snapX and snapY would make the sprite snap to every 16
Source:
@@ -5066,7 +5348,7 @@ For example 16x16 as the snapX and snapY would make the sprite snap to every 16
Source:
@@ -5219,7 +5501,7 @@ For example 16x16 as the snapX and snapY would make the sprite snap to every 16
Source:
@@ -5360,7 +5642,7 @@ For example 16x16 as the snapX and snapY would make the sprite snap to every 16
Source:
@@ -5497,7 +5779,7 @@ For example 16x16 as the snapX and snapY would make the sprite snap to every 16
Source:
@@ -5634,7 +5916,7 @@ For example 16x16 as the snapX and snapY would make the sprite snap to every 16
Source:
@@ -5771,7 +6053,7 @@ For example 16x16 as the snapX and snapY would make the sprite snap to every 16
Source:
@@ -5908,7 +6190,7 @@ For example 16x16 as the snapX and snapY would make the sprite snap to every 16
Source:
@@ -6045,7 +6327,7 @@ For example 16x16 as the snapX and snapY would make the sprite snap to every 16
Source:
@@ -6183,7 +6465,7 @@ This value is only set when the pointer is over this Sprite.
Source:
@@ -6325,7 +6607,7 @@ This value is only set when the pointer is over this Sprite.
Source:
@@ -6417,7 +6699,7 @@ This value is only set when the pointer is over this Sprite.
Source:
@@ -6594,7 +6876,7 @@ This value is only set when the pointer is over this Sprite.
Source:
@@ -6735,7 +7017,7 @@ This value is only set when the pointer is over this Sprite.
Source:
@@ -6876,7 +7158,7 @@ This value is only set when the pointer is over this Sprite.
Source:
@@ -6945,7 +7227,7 @@ This value is only set when the pointer is over this Sprite.
Source:
@@ -7063,7 +7345,7 @@ This value is only set when the pointer is over this Sprite.
Source:
@@ -7181,7 +7463,7 @@ This value is only set when the pointer is over this Sprite.
Source:
@@ -7299,7 +7581,7 @@ This value is only set when the pointer is over this Sprite.
Source:
@@ -7363,13 +7645,13 @@ This value is only set when the pointer is over this Sprite.
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:30 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:30 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Phaser.Key.html b/docs/Phaser.Key.html
index 0c7e96ca..1f8e66e1 100644
--- a/docs/Phaser.Key.html
+++ b/docs/Phaser.Key.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -2530,13 +2524,13 @@ If the key is up it holds the duration of the previous down session.
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:30 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:30 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Phaser.Keyboard.html b/docs/Phaser.Keyboard.html
index 3d97273c..3e720486 100644
--- a/docs/Phaser.Keyboard.html
+++ b/docs/Phaser.Keyboard.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -1362,7 +1356,7 @@ The Key object can then be polled, have events attached to it, etc.
- The keycode of the key, i.e. Phaser.Keyboard.UP or Phaser.Keyboard.SPACE_BAR
+ The keycode of the key, i.e. Phaser.Keyboard.UP or Phaser.Keyboard.SPACEBAR
@@ -1785,7 +1779,7 @@ Pass in either a single keycode or an array/hash of keycodes.
- The keycode of the key to remove, i.e. Phaser.Keyboard.UP or Phaser.Keyboard.SPACE_BAR
+ The keycode of the key to remove, i.e. Phaser.Keyboard.UP or Phaser.Keyboard.SPACEBAR
@@ -1942,7 +1936,7 @@ Pass in either a single keycode or an array/hash of keycodes.
- The keycode of the key to remove, i.e. Phaser.Keyboard.UP or Phaser.Keyboard.SPACE_BAR
+ The keycode of the key to remove, i.e. Phaser.Keyboard.UP or Phaser.Keyboard.SPACEBAR
@@ -2064,7 +2058,7 @@ Pass in either a single keycode or an array/hash of keycodes.
- justPressed(keycode, duration ) → {boolean}
+ justReleased(keycode, duration ) → {boolean}
@@ -2138,7 +2132,7 @@ Pass in either a single keycode or an array/hash of keycodes.
- The keycode of the key to remove, i.e. Phaser.Keyboard.UP or Phaser.Keyboard.SPACE_BAR
+ The keycode of the key to remove, i.e. Phaser.Keyboard.UP or Phaser.Keyboard.SPACEBAR
@@ -2554,7 +2548,7 @@ Pass in either a single keycode or an array/hash of keycodes.
- The keycode of the key to remove, i.e. Phaser.Keyboard.UP or Phaser.Keyboard.SPACE_BAR
+ The keycode of the key to remove, i.e. Phaser.Keyboard.UP or Phaser.Keyboard.SPACEBAR
@@ -2957,13 +2951,13 @@ This is called automatically by Phaser.Input and should not normally be invoked
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:30 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:30 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Phaser.Line.html b/docs/Phaser.Line.html
new file mode 100644
index 00000000..5f974cbf
--- /dev/null
+++ b/docs/Phaser.Line.html
@@ -0,0 +1,3100 @@
+
+
+
+
+
+ Phaser Class: Line
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Class: Line
+
+
+
+
+ Phaser .
+
+ Line
+
+
+
+
+
+
+
+
+
+
+
+
+
+ new Line(x1 , y1 , x2 , y2 ) → {Phaser.Line }
+
+
+
+
+
+
+
+
Creates a new Line object with a start and an end point.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+ Argument
+
+
+
+ Default
+
+
+ Description
+
+
+
+
+
+
+
+
+ x1
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ 0
+
+
+
+
+ The x coordinate of the start of the line.
+
+
+
+
+
+
+ y1
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ 0
+
+
+
+
+ The y coordinate of the start of the line.
+
+
+
+
+
+
+ x2
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ 0
+
+
+
+
+ The x coordinate of the end of the line.
+
+
+
+
+
+
+ y2
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ 0
+
+
+
+
+ The y coordinate of the end of the line.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+
+
+
+
+
+
+
+ Type
+
+
+
+Phaser.Line
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Members
+
+
+
+
+ <readonly> angle
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ angle
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ Gets the angle of the line.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ end
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ end
+
+
+
+
+
+Phaser.Point
+
+
+
+
+
+
+
+
+
+ The end point of the line.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <readonly> length
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ length
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ Gets the length of the line segment.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <readonly> perpSlope
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ perpSlope
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ Gets the perpendicular slope of the line (x/y).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <readonly> slope
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ slope
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ Gets the slope of the line (y/x).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ start
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ start
+
+
+
+
+
+Phaser.Point
+
+
+
+
+
+
+
+
+
+ The start point of the line.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Methods
+
+
+
+
+ <static> intersects(a, b, e, f, asSegment , result ) → {Phaser.Point }
+
+
+
+
+
+
+
+
Checks for intersection between two lines as defined by the given start and end points.
+If asSegment is true it will check for line segment intersection. If asSegment is false it will check for line intersection.
+Returns the intersection segment of AB and EF as a Point, or null if there is no intersection.
+Adapted from code by Keith Hair
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+ Argument
+
+
+
+ Default
+
+
+ Description
+
+
+
+
+
+
+
+
+ a
+
+
+
+
+
+Phaser.Point
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The start of the first Line to be checked.
+
+
+
+
+
+
+ b
+
+
+
+
+
+Phaser.Point
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The end of the first line to be checked.
+
+
+
+
+
+
+ e
+
+
+
+
+
+Phaser.Point
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The start of the second Line to be checked.
+
+
+
+
+
+
+ f
+
+
+
+
+
+Phaser.Point
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The end of the second line to be checked.
+
+
+
+
+
+
+ asSegment
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ If true it will check for segment intersection, otherwise full line intersection.
+
+
+
+
+
+
+ result
+
+
+
+
+
+Phaser.Point
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ A Point object to store the result in, if not given a new one will be created.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+
+
+
The intersection segment of the two lines as a Point, or null if there is no intersection.
+
+
+
+
+
+
+ Type
+
+
+
+Phaser.Point
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <static> intersects(a, b, asSegment , result ) → {Phaser.Point }
+
+
+
+
+
+
+
+
Checks for intersection between two lines.
+If asSegment is true it will check for segment intersection.
+If asSegment is false it will check for line intersection.
+Returns the intersection segment of AB and EF as a Point, or null if there is no intersection.
+Adapted from code by Keith Hair
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+ Argument
+
+
+
+ Default
+
+
+ Description
+
+
+
+
+
+
+
+
+ a
+
+
+
+
+
+Phaser.Line
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The first Line to be checked.
+
+
+
+
+
+
+ b
+
+
+
+
+
+Phaser.Line
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The second Line to be checked.
+
+
+
+
+
+
+ asSegment
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ If true it will check for segment intersection, otherwise full line intersection.
+
+
+
+
+
+
+ result
+
+
+
+
+
+Phaser.Point
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ A Point object to store the result in, if not given a new one will be created.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+
+
+
The intersection segment of the two lines as a Point, or null if there is no intersection.
+
+
+
+
+
+
+ Type
+
+
+
+Phaser.Point
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ fromSprite(startSprite, endSprite, useCenter ) → {Phaser.Line }
+
+
+
+
+
+
+
+
Sets the line to match the x/y coordinates of the two given sprites.
+Can optionally be calculated from their center coordinates.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+ Argument
+
+
+
+ Default
+
+
+ Description
+
+
+
+
+
+
+
+
+ startSprite
+
+
+
+
+
+Phaser.Sprite
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The coordinates of this Sprite will be set to the Line.start point.
+
+
+
+
+
+
+ endSprite
+
+
+
+
+
+Phaser.Sprite
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The coordinates of this Sprite will be set to the Line.start point.
+
+
+
+
+
+
+ useCenter
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ If true it will use startSprite.center.x, if false startSprite.x.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+
+
+
+
+
+
+
+ Type
+
+
+
+Phaser.Line
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ intersects(line, asSegment , result ) → {Phaser.Point }
+
+
+
+
+
+
+
+
Checks for intersection between this line and another Line.
+If asSegment is true it will check for segment intersection. If asSegment is false it will check for line intersection.
+Returns the intersection segment of AB and EF as a Point, or null if there is no intersection.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+ Argument
+
+
+
+ Default
+
+
+ Description
+
+
+
+
+
+
+
+
+ line
+
+
+
+
+
+Phaser.Line
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The line to check against this one.
+
+
+
+
+
+
+ asSegment
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ If true it will check for segment intersection, otherwise full line intersection.
+
+
+
+
+
+
+ result
+
+
+
+
+
+Phaser.Point
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ A Point object to store the result in, if not given a new one will be created.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+
+
+
The intersection segment of the two lines as a Point, or null if there is no intersection.
+
+
+
+
+
+
+ Type
+
+
+
+Phaser.Point
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ pointOnLine(x, y) → {boolean}
+
+
+
+
+
+
+
+
Tests if the given coordinates fall on this line. See pointOnSegment to test against just the line segment.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ x
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ The line to check against this one.
+
+
+
+
+
+
+ y
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ The line to check against this one.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+
+
+
True if the point is on the line, false if not.
+
+
+
+
+
+
+ Type
+
+
+
+boolean
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ pointOnSegment(x, y) → {boolean}
+
+
+
+
+
+
+
+
Tests if the given coordinates fall on this line and within the segment. See pointOnLine to test against just the line.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ x
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ The line to check against this one.
+
+
+
+
+
+
+ y
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ The line to check against this one.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+
+
+
True if the point is on the line and segment, false if not.
+
+
+
+
+
+
+ Type
+
+
+
+boolean
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ setTo(x1 , y1 , x2 , y2 ) → {Phaser.Line }
+
+
+
+
+
+
+
+
Sets the components of the Line to the specified values.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+ Argument
+
+
+
+ Default
+
+
+ Description
+
+
+
+
+
+
+
+
+ x1
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ 0
+
+
+
+
+ The x coordinate of the start of the line.
+
+
+
+
+
+
+ y1
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ 0
+
+
+
+
+ The y coordinate of the start of the line.
+
+
+
+
+
+
+ x2
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ 0
+
+
+
+
+ The x coordinate of the end of the line.
+
+
+
+
+
+
+ y2
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ 0
+
+
+
+
+ The y coordinate of the end of the line.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+
+
+
+
+
+
+
+ Type
+
+
+
+Phaser.Line
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
+
+
+
+
+ Documentation generated by JSDoc 3.3.0-dev
+ on Wed Feb 05 2014 06:28:30 GMT-0000 (GMT) using the DocStrap template .
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/Phaser.LinkedList.html b/docs/Phaser.LinkedList.html
index 20f03dc3..8f1018e0 100644
--- a/docs/Phaser.LinkedList.html
+++ b/docs/Phaser.LinkedList.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -1449,13 +1443,13 @@ The function must exist on the member.
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:30 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:30 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Phaser.Loader.html b/docs/Phaser.Loader.html
index 77f5cf83..eca96ed4 100644
--- a/docs/Phaser.Loader.html
+++ b/docs/Phaser.Loader.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -617,7 +611,7 @@ It uses a combination of Image() loading and xhr and provides progress and compl
Source:
@@ -677,7 +671,7 @@ It uses a combination of Image() loading and xhr and provides progress and compl
Source:
@@ -737,7 +731,7 @@ It uses a combination of Image() loading and xhr and provides progress and compl
Source:
@@ -845,7 +839,7 @@ MUST have / on the end of it!
Source:
@@ -947,7 +941,7 @@ MUST have / on the end of it!
Source:
@@ -1361,7 +1355,7 @@ MUST have / on the end of it!
Source:
@@ -1463,7 +1457,7 @@ MUST have / on the end of it!
Source:
@@ -1565,7 +1559,7 @@ MUST have / on the end of it!
Source:
@@ -1667,7 +1661,7 @@ MUST have / on the end of it!
Source:
@@ -1735,7 +1729,7 @@ If you do so the Sprite's width or height will be cropped based on the percentag
-Description
+Phaser.Sprite
@@ -1777,7 +1771,7 @@ If you do so the Sprite's width or height will be cropped based on the percentag
Source:
@@ -1850,7 +1844,7 @@ If you do so the Sprite's width or height will be cropped based on the percentag
- The Load progress percentage value (from 0 to 100)
+ The rounded load progress percentage value (from 0 to 100)
@@ -1891,6 +1885,111 @@ If you do so the Sprite's width or height will be cropped based on the percentag
+
+
+
+
+
+
+
+
+
+ progressFloat
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ progressFloat
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ The non-rounded load progress value (from 0.0 to 100.0)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Default Value:
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
@@ -2065,7 +2164,7 @@ If you do so the Sprite's width or height will be cropped based on the percentag
Source:
@@ -2323,7 +2422,7 @@ If you do so the Sprite's width or height will be cropped based on the percentag
Source:
@@ -2571,7 +2670,7 @@ If you do so the Sprite's width or height will be cropped based on the percentag
Source:
@@ -2819,7 +2918,7 @@ If you do so the Sprite's width or height will be cropped based on the percentag
Source:
@@ -3067,7 +3166,7 @@ If you do so the Sprite's width or height will be cropped based on the percentag
Source:
@@ -3189,7 +3288,7 @@ If you do so the Sprite's width or height will be cropped based on the percentag
-Array
+Array
|
string
@@ -3257,7 +3356,257 @@ If you do so the Sprite's width or height will be cropped based on the percentag
Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+
+
+
This Loader instance.
+
+
+
+
+
+
+ Type
+
+
+
+Phaser.Loader
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ binary(key, url, callback , callbackContext ) → {Phaser.Loader }
+
+
+
+
+
+
+
+
Add a binary file to the Loader. It will be loaded via xhr with a responseType of "arraybuffer". You can specify an optional callback to process the file after load.
+When the callback is called it will be passed 2 parameters: the key of the file and the file data.
+WARNING: If you specify a callback, the file data will be set to whatever your callback returns. So always return the data object, even if you didn't modify it.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+ Argument
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ key
+
+
+
+
+
+string
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Unique asset key of the binary file.
+
+
+
+
+
+
+ url
+
+
+
+
+
+string
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ URL of the binary file.
+
+
+
+
+
+
+ callback
+
+
+
+
+
+function
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+ Optional callback that will be passed the file after loading, so you can perform additional processing on it.
+
+
+
+
+
+
+ callbackContext
+
+
+
+
+
+function
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+ The context under which the callback will be applied. If not specified it will use the callback itself as the context.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
@@ -3505,7 +3854,7 @@ If you do so the Sprite's width or height will be cropped based on the percentag
Source:
@@ -3669,7 +4018,7 @@ If you do so the Sprite's width or height will be cropped based on the percentag
Source:
@@ -3810,7 +4159,7 @@ If you do so the Sprite's width or height will be cropped based on the percentag
Source:
@@ -3928,7 +4277,7 @@ If you do so the Sprite's width or height will be cropped based on the percentag
Source:
@@ -4046,7 +4395,7 @@ If you do so the Sprite's width or height will be cropped based on the percentag
Source:
@@ -4164,7 +4513,7 @@ If you do so the Sprite's width or height will be cropped based on the percentag
Source:
@@ -4305,7 +4654,7 @@ If you do so the Sprite's width or height will be cropped based on the percentag
Source:
@@ -4536,7 +4885,7 @@ If you do so the Sprite's width or height will be cropped based on the percentag
Source:
@@ -4677,7 +5026,7 @@ If you do so the Sprite's width or height will be cropped based on the percentag
Source:
@@ -4746,7 +5095,7 @@ If you do so the Sprite's width or height will be cropped based on the percentag
Source:
@@ -4887,7 +5236,7 @@ If you do so the Sprite's width or height will be cropped based on the percentag
Source:
@@ -5074,7 +5423,7 @@ If you do so the Sprite's width or height will be cropped based on the percentag
Source:
@@ -5143,7 +5492,7 @@ If you do so the Sprite's width or height will be cropped based on the percentag
Source:
@@ -5284,7 +5633,7 @@ If you do so the Sprite's width or height will be cropped based on the percentag
Source:
@@ -5482,7 +5831,7 @@ This allows you to easily make loading bars for games.
Source:
@@ -5510,7 +5859,7 @@ This allows you to easily make loading bars for games.
- spritesheet(key, url, frameWidth, frameHeight, frameMax ) → {Phaser.Loader }
+ spritesheet(key, url, frameWidth, frameHeight, frameMax , margin , spacing ) → {Phaser.Loader }
@@ -5732,6 +6081,84 @@ This allows you to easily make loading bars for games.
+
+
+
+ margin
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ 0
+
+
+
+
+ If the frames have been drawn with a margin, specify the amount here.
+
+
+
+
+
+
+ spacing
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ 0
+
+
+
+
+ If the frames have been drawn with spacing between them, specify the amount here.
+
+
+
@@ -5760,7 +6187,7 @@ This allows you to easily make loading bars for games.
Source:
@@ -5852,7 +6279,7 @@ This allows you to easily make loading bars for games.
Source:
@@ -6060,7 +6487,7 @@ This allows you to easily make loading bars for games.
Source:
@@ -6330,386 +6757,7 @@ This allows you to easily make loading bars for games.
Source:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Returns:
-
-
-
-
This Loader instance.
-
-
-
-
-
-
- Type
-
-
-
-Phaser.Loader
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- tileset(key, url, tileWidth, tileHeight, tileMax , tileMargin , tileSpacing ) → {Phaser.Loader }
-
-
-
-
-
-
-
-
Add a new tile set to the loader. These are used in the rendering of tile maps.
-
-
-
-
-
-
-
-
- Parameters:
-
-
-
-
-
-
- Name
-
-
- Type
-
-
- Argument
-
-
-
- Default
-
-
- Description
-
-
-
-
-
-
-
-
- key
-
-
-
-
-
-string
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Unique asset key of the tileset file.
-
-
-
-
-
-
- url
-
-
-
-
-
-string
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- URL of the tileset.
-
-
-
-
-
-
- tileWidth
-
-
-
-
-
-number
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Width of each single tile in pixels.
-
-
-
-
-
-
- tileHeight
-
-
-
-
-
-number
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Height of each single tile in pixels.
-
-
-
-
-
-
- tileMax
-
-
-
-
-
-number
-
-
-
-
-
-
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
-
- -1
-
-
-
-
- How many tiles in this tileset. If not specified it will divide the whole image into tiles.
-
-
-
-
-
-
- tileMargin
-
-
-
-
-
-number
-
-
-
-
-
-
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
-
- 0
-
-
-
-
- If the tiles have been drawn with a margin, specify the amount here.
-
-
-
-
-
-
- tileSpacing
-
-
-
-
-
-number
-
-
-
-
-
-
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
-
- 0
-
-
-
-
- If the tiles have been drawn with spacing between them, specify the amount here.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Source:
-
@@ -6801,7 +6849,7 @@ This allows you to easily make loading bars for games.
Source:
@@ -6893,7 +6941,7 @@ This allows you to easily make loading bars for games.
Source:
@@ -7034,7 +7082,7 @@ This allows you to easily make loading bars for games.
Source:
@@ -7079,13 +7127,13 @@ This allows you to easily make loading bars for games.
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:30 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:30 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Phaser.LoaderParser.html b/docs/Phaser.LoaderParser.html
index 01765371..e5052246 100644
--- a/docs/Phaser.LoaderParser.html
+++ b/docs/Phaser.LoaderParser.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -681,13 +675,13 @@
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:31 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:31 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Phaser.MSPointer.html b/docs/Phaser.MSPointer.html
index b3a18ed0..1726c1aa 100644
--- a/docs/Phaser.MSPointer.html
+++ b/docs/Phaser.MSPointer.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -1399,13 +1393,13 @@ It will work only in Internet Explorer 10 and Windows Store or Windows Phone 8 a
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:31 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:31 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Phaser.Math.html b/docs/Phaser.Math.html
index 155a841e..41f67fbc 100644
--- a/docs/Phaser.Math.html
+++ b/docs/Phaser.Math.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -531,7 +525,7 @@
-
Find the angle of a segment from (x1, y1) -> (x2, y2 ).
+
Find the angle of a segment from (x1, y1) -> (x2, y2).
@@ -865,7 +859,7 @@
Source:
@@ -1117,7 +1111,7 @@
Source:
@@ -1172,7 +1166,7 @@
-
Description.
+
A Bezier Interpolation Method, mostly used by Phaser.Tween.
@@ -1277,7 +1271,7 @@
Source:
@@ -1506,7 +1500,7 @@
Source:
@@ -1561,7 +1555,7 @@
-
Description.
+
A Catmull Rom Interpolation Method, mostly used by Phaser.Tween.
@@ -1666,7 +1660,7 @@
Source:
@@ -1803,7 +1797,7 @@
Source:
@@ -2127,7 +2121,7 @@ of getting a bonus, call chanceRoll(30) - true means the chance passed, false me
Source:
@@ -2315,7 +2309,7 @@ Clamp value to range <a, b>
Source:
@@ -2475,7 +2469,7 @@ Clamp value to range <a, b>
Source:
@@ -2563,7 +2557,7 @@ Clamp value to range <a, b>
Source:
@@ -2719,7 +2713,7 @@ Clamp value to range <a, b>
Source:
@@ -2925,7 +2919,7 @@ Clamp value to range <a, b>
Source:
@@ -2950,7 +2944,308 @@ Clamp value to range <a, b>
-
The distance between this Point object and the destination Point object.
+
The distance between the two sets of coordinates.
+
+
+
+
+
+
+ Type
+
+
+
+number
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ distancePow(x1, y1, x2, y2, pow ) → {number}
+
+
+
+
+
+
+
+
Returns the distance between the two given set of coordinates at the power given.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+ Argument
+
+
+
+ Default
+
+
+ Description
+
+
+
+
+
+
+
+
+ x1
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ y1
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ x2
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ y2
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ pow
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+
+
+
The distance between the two sets of coordinates.
@@ -3135,7 +3430,7 @@ Clamp value to range <a, b>
Source:
@@ -3276,7 +3571,7 @@ Clamp value to range <a, b>
Source:
@@ -4524,7 +4819,7 @@ Will return null if random selection is missing, or array has no entries.
Source:
@@ -4757,7 +5052,7 @@ Will return null if random selection is missing, or array has no entries.
Source:
@@ -5077,7 +5372,7 @@ Will return null if random selection is missing, or array has no entries.
Source:
@@ -5218,7 +5513,7 @@ Will return null if random selection is missing, or array has no entries.
Source:
@@ -5405,7 +5700,7 @@ Will return null if random selection is missing, or array has no entries.
Source:
@@ -5460,7 +5755,7 @@ Will return null if random selection is missing, or array has no entries.
-
Description.
+
A Linear Interpolation Method, mostly used by Phaser.Tween.
@@ -5565,7 +5860,7 @@ Will return null if random selection is missing, or array has no entries.
Source:
@@ -5817,7 +6112,7 @@ Will return null if random selection is missing, or array has no entries.
Source:
@@ -5906,7 +6201,7 @@ See http://jsperf.com/m
Source:
@@ -5952,6 +6247,98 @@ See http://jsperf.com/m
+
+
+
+
+
+ max() → {number}
+
+
+
+
+
+
+
+
Updated version of Math.max that can be passed either an array of numbers or the numbers as parameters.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+
+
+
The largest value from those given.
+
+
+
+
+
+
+ Type
+
+
+
+number
+
+
+
+
+
+
+
+
+
@@ -6093,7 +6480,7 @@ See http://jsperf.com/m
Source:
@@ -6135,6 +6522,99 @@ See http://jsperf.com/m
+
+
+
+
+
+ maxProperty() → {number}
+
+
+
+
+
+
+
+
Updated version of Math.max that can be passed a property and either an array of objects or the objects as parameters.
+It will find the largest matching property value from the given objects.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+
+
+
The largest value from those given.
+
+
+
+
+
+
+ Type
+
+
+
+number
+
+
+
+
+
+
+
+
+
@@ -6148,7 +6628,7 @@ See http://jsperf.com/m
@@ -6182,7 +6662,100 @@ See http://jsperf.com/m
Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+
+
+
The lowest value from those given.
+
+
+
+
+
+
+ Type
+
+
+
+number
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ minProperty() → {number}
+
+
+
+
+
+
+
+
Updated version of Math.min that can be passed a property and either an array of objects or the objects as parameters.
+It will find the lowest matching property value from the given objects.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
@@ -6369,7 +6942,7 @@ See http://jsperf.com/m
Source:
@@ -6428,8 +7001,7 @@ See http://jsperf.com/m
-
Closest angle between two angles from a1 to a2
-absolute value the return for exact angle
+
Closest angle between two angles from a1 to a2 absolute value the return for exact angle
@@ -6557,7 +7129,7 @@ absolute value the return for exact angle
Source:
@@ -6604,7 +7176,7 @@ absolute value the return for exact angle
- normalizeAngle(angle, radians) → {number}
+ normalizeAngle(angleRad) → {number}
@@ -6612,7 +7184,7 @@ absolute value the return for exact angle
-
Set an angle within the bounds of -π toπ.
+
Normalizes an angle to the [0,2pi) range.
@@ -6646,7 +7218,7 @@ absolute value the return for exact angle
- angle
+ angleRad
@@ -6662,30 +7234,7 @@ absolute value the return for exact angle
-
-
-
-
-
-
-
- radians
-
-
-
-
-
-boolean
-
-
-
-
-
-
-
-
-
- True if angle size is expressed in radians.
+ The angle to normalize, in radians.
@@ -6717,7 +7266,7 @@ absolute value the return for exact angle
Source:
@@ -6741,6 +7290,292 @@ absolute value the return for exact angle
Returns:
+
+
Returns the angle, fit within the [0,2pi] range, in radians.
+
+
+
+
+
+
+ Type
+
+
+
+number
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ normalizeLatitude(lat) → {number}
+
+
+
+
+
+
+
+
Normalizes a latitude to the [-90,90] range. Latitudes above 90 or below -90 are capped, not wrapped.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ lat
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ The latitude to normalize, in degrees.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+
+
+
Returns the latitude, fit within the [-90,90] range.
+
+
+
+
+
+
+ Type
+
+
+
+number
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ normalizeLongitude(lng) → {number}
+
+
+
+
+
+
+
+
Normalizes a longitude to the [-180,180] range. Longitudes above 180 or below -180 are wrapped.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ lng
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ The longitude to normalize, in degrees.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+
+
+
Returns the longitude, fit within the [-180,180] range.
+
+
@@ -6877,7 +7712,7 @@ absolute value the return for exact angle
Source:
@@ -7038,7 +7873,7 @@ absolute value the return for exact angle
Source:
@@ -7126,7 +7961,7 @@ absolute value the return for exact angle
Source:
@@ -7172,6 +8007,147 @@ absolute value the return for exact angle
+
+
+
+
+
+ reverseAngle(angleRad) → {number}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ angleRad
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ The angle to reverse, in radians.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+
+
+
Returns the reverse angle, in radians.
+
+
+
+
+
+
+ Type
+
+
+
+number
+
+
+
+
+
+
+
+
+
@@ -7611,7 +8587,7 @@ The original stack is modified in the process. This effectively moves the positi
Source:
@@ -7752,7 +8728,7 @@ The original stack is modified in the process. This effectively moves the positi
Source:
@@ -7894,7 +8870,7 @@ The original stack is modified in the process. This effectively moves the positi
Source:
@@ -7941,7 +8917,7 @@ The original stack is modified in the process. This effectively moves the positi
- sinCosGenerator(length, sinAmplitude, cosAmplitude, frequency) → {Array}
+ sinCosGenerator(length, sinAmplitude, cosAmplitude, frequency) → {Array }
@@ -8104,7 +9080,7 @@ you should get the results via getSinTable() and getCosTable(). This generator i
Source:
@@ -8140,7 +9116,7 @@ you should get the results via getSinTable() and getCosTable(). This generator i
-Array
+Array
@@ -8291,7 +9267,7 @@ you should get the results via getSinTable() and getCosTable(). This generator i
Source:
@@ -8474,7 +9450,7 @@ you should get the results via getSinTable() and getCosTable(). This generator i
Source:
@@ -9609,7 +10585,7 @@ you should get the results via getSinTable() and getCosTable(). This generator i
Source:
@@ -9668,8 +10644,8 @@ you should get the results via getSinTable() and getCosTable(). This generator i
-
Ensures that the value always stays between min and max, by wrapping the value around.
-
<p>max should be larger than min, or the function will return 0</p>
+
Ensures that the value always stays between min and max, by wrapping the value around.
+max should be larger than min, or the function will return 0.
@@ -9708,13 +10684,18 @@ you should get the results via getSinTable() and getCosTable(). This generator i
+
+number
+
+
+
- The value to wrap
+ The value to wrap.
@@ -9726,13 +10707,18 @@ you should get the results via getSinTable() and getCosTable(). This generator i
+
+number
+
+
+
- The minimum the value is allowed to be
+ The minimum the value is allowed to be.
@@ -9744,13 +10730,18 @@ you should get the results via getSinTable() and getCosTable(). This generator i
+
+number
+
+
+
- The maximum the value is allowed to be
+ The maximum the value is allowed to be.
@@ -9782,7 +10773,7 @@ you should get the results via getSinTable() and getCosTable(). This generator i
Source:
@@ -9807,7 +10798,7 @@ you should get the results via getSinTable() and getCosTable(). This generator i
-
The wrapped value
+
The wrapped value.
@@ -9924,7 +10915,7 @@ Should be called whenever the angle is updated on the Sprite to stop it from goi
Source:
@@ -10112,7 +11103,7 @@ Should be called whenever the angle is updated on the Sprite to stop it from goi
Source:
@@ -10180,13 +11171,13 @@ Should be called whenever the angle is updated on the Sprite to stop it from goi
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:31 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:31 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Phaser.Mouse.html b/docs/Phaser.Mouse.html
index f4b01f6c..03806212 100644
--- a/docs/Phaser.Mouse.html
+++ b/docs/Phaser.Mouse.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -614,7 +608,7 @@
Source:
@@ -674,7 +668,7 @@
Source:
@@ -734,7 +728,7 @@
Source:
@@ -794,7 +788,7 @@
Source:
@@ -1278,7 +1272,7 @@
- The browser mouse event.
+ The browser mouse DOM event. Will be set to null if no mouse event has ever been received.
@@ -1303,11 +1297,14 @@
+ Default Value:
+
+
Source:
@@ -2036,7 +2033,7 @@
Source:
@@ -2154,7 +2151,7 @@
Source:
@@ -2272,7 +2269,7 @@
Source:
@@ -2390,7 +2387,7 @@
Source:
@@ -2459,7 +2456,7 @@
Source:
@@ -2530,7 +2527,7 @@ If the browser successfully enters a locked state the event Phaser.Mouse.pointer
Source:
@@ -2599,7 +2596,7 @@ If the browser successfully enters a locked state the event Phaser.Mouse.pointer
Source:
@@ -2668,7 +2665,7 @@ If the browser successfully enters a locked state the event Phaser.Mouse.pointer
Source:
@@ -2713,13 +2710,13 @@ If the browser successfully enters a locked state the event Phaser.Mouse.pointer
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:31 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:31 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Phaser.Net.html b/docs/Phaser.Net.html
index 2bda1c19..5c69959d 100644
--- a/docs/Phaser.Net.html
+++ b/docs/Phaser.Net.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -1343,13 +1337,13 @@ Optionally you can redirect to the new url, or just return it as a string.
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:31 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:31 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Phaser.Particles.Arcade.Emitter.html b/docs/Phaser.Particles.Arcade.Emitter.html
index 31518443..bc65c282 100644
--- a/docs/Phaser.Particles.Arcade.Emitter.html
+++ b/docs/Phaser.Particles.Arcade.Emitter.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -710,6 +704,116 @@ at set intervals, and fixes their positions and velocities accorindgly.
+
+ alive
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ alive
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+
+ The alive property is useful for Groups that are children of other Groups and need to be included/excluded in checks like forEachAlive.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Inherited From:
+
+
+
+
+
+
+
+
+
+
+
+
+ Default Value:
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
alpha
@@ -799,7 +903,7 @@ at set intervals, and fixes their positions and velocities accorindgly.Source:
@@ -911,7 +1015,7 @@ This will have no impact on the rotation value of its children, but it will upda
Source:
@@ -935,10 +1039,6 @@ This will have no impact on the rotation value of its children, but it will upda
-
-
The angular drag component of particles launched from the emitter if they are rotating.
-
-
@@ -988,7 +1088,7 @@ This will have no impact on the rotation value of its children, but it will upda
-
+ The angular drag component of particles launched from the emitter if they are rotating.
@@ -1020,7 +1120,7 @@ This will have no impact on the rotation value of its children, but it will upda
Source:
@@ -1122,7 +1222,7 @@ This will have no impact on the rotation value of its children, but it will upda
Source:
@@ -1146,10 +1246,6 @@ This will have no impact on the rotation value of its children, but it will upda
-
-
How much each particle should bounce on each axis. 1 = full bounce, 0 = no bounce.
-
-
@@ -1199,7 +1295,7 @@ This will have no impact on the rotation value of its children, but it will upda
-
+ How much each particle should bounce on each axis. 1 = full bounce, 0 = no bounce.
@@ -1228,7 +1324,7 @@ This will have no impact on the rotation value of its children, but it will upda
Source:
@@ -1340,7 +1436,7 @@ The cursor is set to the first child added to the Group and doesn't change unles
Source:
@@ -1448,7 +1544,7 @@ Emitter.emitX and Emitter.emitY control the emission location relative to the x/
Source:
@@ -1556,7 +1652,7 @@ Emitter.emitX and Emitter.emitY control the emission location relative to the x/
Source:
@@ -1580,10 +1676,6 @@ Emitter.emitX and Emitter.emitY control the emission location relative to the x/
-
-
Determines whether the emitter is being updated by the core game loop.
-
-
@@ -1633,7 +1725,7 @@ Emitter.emitX and Emitter.emitY control the emission location relative to the x/
-
+ Determines whether the emitter is being updated by the core game loop.
@@ -1665,7 +1757,7 @@ Emitter.emitX and Emitter.emitY control the emission location relative to the x/
Source:
@@ -1689,10 +1781,6 @@ Emitter.emitX and Emitter.emitY control the emission location relative to the x/
-
-
How often a particle is emitted in ms (if emitter is started with Explode === false).
-
-
@@ -1742,7 +1830,7 @@ Emitter.emitX and Emitter.emitY control the emission location relative to the x/
-
+ How often a particle is emitted in ms (if emitter is started with Explode === false).
@@ -1774,7 +1862,7 @@ Emitter.emitX and Emitter.emitY control the emission location relative to the x/
Source:
@@ -1881,7 +1969,7 @@ Emitter.emitX and Emitter.emitY control the emission location relative to the x/
Source:
@@ -1905,10 +1993,6 @@ Emitter.emitX and Emitter.emitY control the emission location relative to the x/
-
-
Sets the <code>gravity.y</code> of each particle to this value on launch.
-
-
@@ -1958,7 +2042,7 @@ Emitter.emitX and Emitter.emitY control the emission location relative to the x/
-
+ Sets the body.gravity.y of each particle sprite to this value on launch.
@@ -1984,13 +2068,120 @@ Emitter.emitX and Emitter.emitY control the emission location relative to the x/
Default Value:
-
+
Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ group
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ group
+
+
+
+
+
+Phaser.Group
+
+
+
+
+
+
+
+
+
+ The parent Group of this Group, if a child of another.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Inherited From:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
@@ -2197,7 +2388,7 @@ Emitter.emitX and Emitter.emitY control the emission location relative to the x/
Source:
@@ -2270,7 +2461,7 @@ Emitter.emitX and Emitter.emitY control the emission location relative to the x/
- The number of children in this Group.
+ The total number of children in this Group, regardless of their exists/alive status.
@@ -2304,7 +2495,7 @@ Emitter.emitX and Emitter.emitY control the emission location relative to the x/
Source:
@@ -2328,11 +2519,6 @@ Emitter.emitX and Emitter.emitY control the emission location relative to the x/
-
-
How long each particle lives once it is emitted in ms. Default is 2 seconds.
-Set lifespan to 'zero' for particles to live forever.
-
-
@@ -2382,7 +2568,7 @@ Set lifespan to 'zero' for particles to live forever.
-
+ How long each particle lives once it is emitted in ms. Default is 2 seconds. Set lifespan to 'zero' for particles to live forever.
@@ -2414,7 +2600,7 @@ Set lifespan to 'zero' for particles to live forever.
Source:
@@ -2438,10 +2624,6 @@ Set lifespan to 'zero' for particles to live forever.
-
-
The total number of particles in this emitter.
-
-
@@ -2520,7 +2702,7 @@ Set lifespan to 'zero' for particles to live forever.
Source:
@@ -2544,11 +2726,6 @@ Set lifespan to 'zero' for particles to live forever.
-
-
The maximum possible scale of a particle.
-The default value is 1.
-
-
@@ -2598,7 +2775,7 @@ The default value is 1.
-
+ The maximum possible scale of a particle.
@@ -2630,7 +2807,7 @@ The default value is 1.
Source:
@@ -2654,11 +2831,6 @@ The default value is 1.
-
-
The maximum possible velocity of a particle.
-The default value is (100,100).
-
-
@@ -2708,7 +2880,7 @@ The default value is (100,100).
-
+ The maximum possible velocity of a particle.
@@ -2737,7 +2909,7 @@ The default value is (100,100).
Source:
@@ -2761,10 +2933,6 @@ The default value is (100,100).
-
-
The maximum possible angular velocity of a particle. The default value is 360.
-
-
@@ -2814,7 +2982,7 @@ The default value is (100,100).
-
+ The maximum possible angular velocity of a particle.
@@ -2846,7 +3014,7 @@ The default value is (100,100).
Source:
@@ -2870,11 +3038,6 @@ The default value is (100,100).
-
-
The minimum possible scale of a particle.
-The default value is 1.
-
-
@@ -2924,7 +3087,7 @@ The default value is 1.
-
+ The minimum possible scale of a particle.
@@ -2956,7 +3119,7 @@ The default value is 1.
Source:
@@ -2980,11 +3143,6 @@ The default value is 1.
-
-
The minimum possible velocity of a particle.
-The default value is (-100,-100).
-
-
@@ -3034,7 +3192,7 @@ The default value is (-100,-100).
-
+ The minimum possible velocity of a particle.
@@ -3063,7 +3221,7 @@ The default value is (-100,-100).
Source:
@@ -3087,10 +3245,6 @@ The default value is (-100,-100).
-
-
The minimum possible angular velocity of a particle. The default value is -360.
-
-
@@ -3140,7 +3294,7 @@ The default value is (-100,-100).
-
+ The minimum possible angular velocity of a particle.
@@ -3169,7 +3323,7 @@ The default value is (-100,-100).
Source:
@@ -3271,7 +3425,7 @@ The default value is (-100,-100).
Source:
@@ -3295,11 +3449,6 @@ The default value is (-100,-100).
-
-
Determines whether the emitter is currently emitting particles.
-It is totally safe to directly toggle this.
-
-
@@ -3349,7 +3498,7 @@ It is totally safe to directly toggle this.
-
+ Determines whether the emitter is currently emitting particles. It is totally safe to directly toggle this.
@@ -3381,7 +3530,7 @@ It is totally safe to directly toggle this.
Source:
@@ -3405,10 +3554,6 @@ It is totally safe to directly toggle this.
-
-
Set your own particle class type here.
-
-
@@ -3448,7 +3593,7 @@ It is totally safe to directly toggle this.
-Description
+any
@@ -3458,7 +3603,7 @@ It is totally safe to directly toggle this.
-
+ For emitting your own particle class types.
@@ -3490,7 +3635,7 @@ It is totally safe to directly toggle this.
Source:
@@ -3508,16 +3653,12 @@ It is totally safe to directly toggle this.
- particleDrag
+ particleFriction
-
-
The X and Y drag component of particles launched from the emitter.
-
-
@@ -3551,13 +3692,13 @@ It is totally safe to directly toggle this.
- particleDrag
+ particleFriction
-Phaser.Point
+number
@@ -3567,7 +3708,7 @@ It is totally safe to directly toggle this.
-
+ The friction component of particles launched from the emitter.
@@ -3592,11 +3733,121 @@ It is totally safe to directly toggle this.
+ Default Value:
+
+
Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ pivot
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ pivot
+
+
+
+
+
+Phaser.Point
+
+
+
+
+
+
+
+
+
+ The pivot point of the Group container.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Inherited From:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
@@ -3698,7 +3949,7 @@ It is totally safe to directly toggle this.
Source:
@@ -3810,7 +4061,7 @@ This will have no impact on the rotation value of its children, but it will upda
Source:
@@ -3883,7 +4134,7 @@ This will have no impact on the rotation value of its children, but it will upda
- Replaces the PIXI.Point with a slightly more flexible one.
+ The scane of the Group container.
@@ -3917,7 +4168,7 @@ This will have no impact on the rotation value of its children, but it will upda
Source:
@@ -4019,7 +4270,7 @@ This will have no impact on the rotation value of its children, but it will upda
Source:
@@ -4092,7 +4343,7 @@ This will have no impact on the rotation value of its children, but it will upda
- The total number of children in this Group, regardless of their alive state.
+ The total number of children in this Group who have a state of exists = true.
@@ -4126,7 +4377,7 @@ This will have no impact on the rotation value of its children, but it will upda
Source:
@@ -4144,7 +4395,7 @@ This will have no impact on the rotation value of its children, but it will upda
- type
+ <protected> type
@@ -4189,7 +4440,7 @@ This will have no impact on the rotation value of its children, but it will upda
-Description
+number
@@ -4199,7 +4450,7 @@ This will have no impact on the rotation value of its children, but it will upda
- Description.
+ Internal Phaser Type value.
@@ -4334,7 +4585,7 @@ This will have no impact on the rotation value of its children, but it will upda
Source:
@@ -4541,7 +4792,7 @@ This will have no impact on the rotation value of its children, but it will upda
Source:
@@ -4748,7 +4999,7 @@ This will have no impact on the rotation value of its children, but it will upda
Source:
@@ -4974,7 +5225,7 @@ that then see the addAt method.
Source:
@@ -5199,7 +5450,7 @@ Group.addAll('x', 10) will add 10 to the child.x value.
Source:
@@ -5346,7 +5597,7 @@ The child is added to the Group at the location specified by the index value, th
Source:
@@ -5405,7 +5656,7 @@ The child is added to the Group at the location specified by the index value, th
-
Change the emitter's midpoint to match the midpoint of a <code>Object</code>.
+
Change the emitters center to match the center of any object with a center property, such as a Sprite.
@@ -5446,6 +5697,9 @@ The child is added to the Group at the location specified by the index value, th
object
+|
+
+Phaser.Sprite
@@ -5455,7 +5709,7 @@ The child is added to the Group at the location specified by the index value, th
- The <code>Object</code> that you want to sync up with.
+ The object that you wish to match the center with.
@@ -5487,7 +5741,7 @@ The child is added to the Group at the location specified by the index value, th
Source:
@@ -5610,7 +5864,7 @@ The child is added to the Group at the location specified by the index value, th
Source:
@@ -5770,12 +6024,12 @@ After the method parameter and context you can add as many extra parameters as y
- ''
+ null
- A string containing the context under which the method will be executed. Leave to '' to default to the child.
+ A string containing the context under which the method will be executed. Set to null to default to the child.
@@ -5849,7 +6103,7 @@ After the method parameter and context you can add as many extra parameters as y
Source:
@@ -6047,7 +6301,7 @@ After the existsValue parameter you can add as many parameters as you like, whic
Source:
@@ -6083,7 +6337,7 @@ After the existsValue parameter you can add as many parameters as you like, whic
-
Calls a function on all of the children that have exists=true in this Group.
+
Returns a reference to a function that exists on a child of the Group based on the given callback array.
@@ -6216,7 +6470,81 @@ After the existsValue parameter you can add as many parameters as you like, whic
Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ childTest()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Inherited From:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
@@ -6290,7 +6618,7 @@ After the existsValue parameter you can add as many parameters as you like, whic
Source:
@@ -6315,7 +6643,7 @@ After the existsValue parameter you can add as many parameters as you like, whic
-
The number of children flagged as dead. Returns -1 if Group is empty.
+
The number of children flagged as dead.
@@ -6387,7 +6715,7 @@ After the existsValue parameter you can add as many parameters as you like, whic
Source:
@@ -6412,7 +6740,7 @@ After the existsValue parameter you can add as many parameters as you like, whic
-
The number of children flagged as alive. Returns -1 if Group is empty.
+
The number of children flagged as alive.
@@ -6699,7 +7027,7 @@ Useful if you don't need to create the Sprite instances before-hand.
Source:
@@ -6977,7 +7305,7 @@ and will be positioned at 0, 0 (relative to the Group.x/y)
Source:
@@ -7005,7 +7333,7 @@ and will be positioned at 0, 0 (relative to the Group.x/y)
- destroy()
+ destroy(destroyChildren )
@@ -7022,6 +7350,75 @@ and will be positioned at 0, 0 (relative to the Group.x/y)
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+ Argument
+
+
+
+ Default
+
+
+ Description
+
+
+
+
+
+
+
+
+ destroyChildren
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ false
+
+
+
+
+ Should every child of this Group have its destroy method called?
+
+
+
+
+
+
+
@@ -7051,7 +7448,7 @@ and will be positioned at 0, 0 (relative to the Group.x/y)
Source:
@@ -7244,150 +7641,7 @@ Group.divideAll('x', 2) will half the child.x value.
Source:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- dump(full )
-
-
-
-
-
-
-
-
Dumps out a list of Group children and their index positions to the browser console. Useful for group debugging.
-
-
-
-
-
-
-
-
- Parameters:
-
-
-
-
-
-
- Name
-
-
- Type
-
-
- Argument
-
-
-
- Default
-
-
- Description
-
-
-
-
-
-
-
-
- full
-
-
-
-
-
-boolean
-
-
-
-
-
-
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
-
- false
-
-
-
-
- If full the dump will include the entire display list, start from the Stage. Otherwise it will only include this container.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Inherited From:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Source:
-
@@ -7456,7 +7710,7 @@ Group.divideAll('x', 2) will half the child.x value.
Source:
@@ -7494,7 +7748,8 @@ Group.divideAll('x', 2) will half the child.x value.
Allows you to call your own function on each member of this Group. You must pass the callback and context in which it will run.
After the checkExists parameter you can add as many parameters as you like, which will all be passed to the callback along with the child.
-For example: Group.forEach(awardBonusGold, this, true, 100, 500)
+For example: Group.forEach(awardBonusGold, this, true, 100, 500)
+Note: Currently this will skip any children which are Groups themselves.
@@ -7627,7 +7882,7 @@ For example: Group.forEach(awardBonusGold, this, true, 100, 500)
Source:
@@ -7775,7 +8030,7 @@ For example: Group.forEachAlive(causeDamage, this, 500)
Source:
@@ -7923,7 +8178,7 @@ For example: Group.forEachAlive(causeDamage, this, 500)
Source:
@@ -8071,7 +8326,7 @@ For example: Group.forEachDead(bringToLife, this)
Source:
@@ -8194,7 +8449,7 @@ For example: Group.forEachDead(bringToLife, this)
Source:
@@ -8292,7 +8547,7 @@ This is handy for checking if everything has been wiped out, or choosing a squad
Source:
@@ -8390,7 +8645,7 @@ This is handy for checking if everything has been wiped out, or choosing a squad
Source:
@@ -8536,7 +8791,7 @@ This is handy for checking if everything has been wiped out, or choosing a squad
Source:
@@ -8682,7 +8937,7 @@ This is handy for checking if everything has been wiped out, or choosing a squad
Source:
@@ -8851,7 +9106,7 @@ This is handy for checking if everything has been wiped out, or choosing a squad
Source:
@@ -8902,7 +9157,7 @@ This is handy for checking if everything has been wiped out, or choosing a squad
- iterate(key, value, returnType, callback , callbackContext )
+ iterate(key, value, returnType, callback , callbackContext ) → {any}
@@ -9161,7 +9416,7 @@ You can add as many callback parameters as you like, which will all be passed to
Source:
@@ -9182,6 +9437,29 @@ You can add as many callback parameters as you like, which will all be passed to
+ Returns:
+
+
+
+
Returns either a numeric total (if RETURN_TOTAL was specified) or the child object.
+
+
+
+
+
+
+ Type
+
+
+
+any
+
+
+
+
+
+
+
@@ -9230,7 +9508,7 @@ You can add as many callback parameters as you like, which will all be passed to
Source:
@@ -9258,7 +9536,7 @@ You can add as many callback parameters as you like, which will all be passed to
- makeParticles(keys, frames, quantity, collide, collideWorldBounds)
+ makeParticles(keys, frames, quantity, collide , collideWorldBounds ) → {Phaser.Particles.Arcade.Emitter }
@@ -9288,8 +9566,12 @@ You can add as many callback parameters as you like, which will all be passed to
Type
+ Argument
+
+ Default
+
Description
@@ -9306,17 +9588,32 @@ You can add as many callback parameters as you like, which will all be passed to
-Description
+array
+|
+
+string
+
+
+
+
+
+
- Description.
+
+
+
+
+
+
+ A string or an array of strings that the particle sprites will use as their texture. If an array one is picked at random.
@@ -9329,6 +9626,9 @@ You can add as many callback parameters as you like, which will all be passed to
+array
+|
+
number
@@ -9336,10 +9636,22 @@ You can add as many callback parameters as you like, which will all be passed to
+
+
+
+
+
+
- Description.
+
+
+
+
+
+
+ A frame number, or array of frames that the sprite will use. If an array one is picked at random.
@@ -9359,10 +9671,22 @@ You can add as many callback parameters as you like, which will all be passed to
+
+
+
+
+
+
- The number of particles to generate when using the "create from image" option.
+
+
+
+
+
+
+ The number of particles to generate.
@@ -9375,17 +9699,33 @@ You can add as many callback parameters as you like, which will all be passed to
-number
+boolean
+
+
+ <optional>
+
+
+
+
+
- Description.
+
+
+
+ false
+
+
+
+
+ Sets the checkCollision.none flag on the particle sprites body.
@@ -9405,10 +9745,26 @@ You can add as many callback parameters as you like, which will all be passed to
+
+
+ <optional>
+
+
+
+
+
- Description.
+
+
+
+ false
+
+
+
+
+ A particle can be set to collide against the World bounds automatically and rebound back into the World if this is set to true. Otherwise it will leave the World.
@@ -9440,7 +9796,7 @@ You can add as many callback parameters as you like, which will all be passed to
Source:
@@ -9465,11 +9821,23 @@ You can add as many callback parameters as you like, which will all be passed to
-
This Emitter instance (nice for chaining stuff together, if you're into that).
+
This Emitter instance.
+
+
+ Type
+
+
+
+Phaser.Particles.Arcade.Emitter
+
+
+
+
+
@@ -9644,7 +10012,7 @@ Group.multiplyAll('x', 2) will x2 the child.x value.
Source:
@@ -9718,7 +10086,7 @@ Group.multiplyAll('x', 2) will x2 the child.x value.
Source:
@@ -9792,7 +10160,7 @@ Group.multiplyAll('x', 2) will x2 the child.x value.
Source:
@@ -9915,7 +10283,7 @@ Group.multiplyAll('x', 2) will x2 the child.x value.
Source:
@@ -10013,7 +10381,7 @@ The Group container remains on the display list.
Source:
@@ -10159,7 +10527,7 @@ The Group container remains on the display list.
Source:
@@ -10305,7 +10673,7 @@ The Group container remains on the display list.
Source:
@@ -10341,8 +10709,7 @@ The Group container remains on the display list.
-
Handy for bringing game objects "back to life". Just sets alive and exists back to true.
-In practice, this is most often called by <code>Object.reset()</code>.
+
Handy for bringing game objects "back to life". Just sets alive and exists back to true.
@@ -10375,7 +10742,334 @@ In practice, this is most often called by <code>Object.reset()</code>
Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ set(child, key, value, checkAlive , checkVisible , operation )
+
+
+
+
+
+
+
+
This function allows you to quickly set a property on a single child of this Group to a new value.
+The operation parameter controls how the new value is assigned to the property, from simple replacement to addition and multiplication.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+ Argument
+
+
+
+ Default
+
+
+ Description
+
+
+
+
+
+
+
+
+ child
+
+
+
+
+
+Phaser.Sprite
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The child to set the property on.
+
+
+
+
+
+
+ key
+
+
+
+
+
+string
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The property, as a string, to be set. For example: 'body.velocity.x'
+
+
+
+
+
+
+ value
+
+
+
+
+
+*
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The value that will be set.
+
+
+
+
+
+
+ checkAlive
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ false
+
+
+
+
+ If set then the child will only be updated if alive=true.
+
+
+
+
+
+
+ checkVisible
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ false
+
+
+
+
+ If set then the child will only be updated if visible=true.
+
+
+
+
+
+
+ operation
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ 0
+
+
+
+
+ Controls how the value is assigned. A value of 0 replaces the value with the new one. A value of 1 adds it, 2 subtracts it, 3 multiplies it and 4 divides it.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Inherited From:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
@@ -10667,7 +11361,7 @@ The operation parameter controls how the new value is assigned to the property,
Source:
@@ -10915,7 +11609,7 @@ The operation parameter controls how the new value is assigned to the property,
Source:
@@ -10943,7 +11637,7 @@ The operation parameter controls how the new value is assigned to the property,
- setRotation(min, max)
+ setRotation(min , max )
@@ -10973,8 +11667,12 @@ The operation parameter controls how the new value is assigned to the property,
Type
+ Argument
+
+ Default
+
Description
@@ -10998,7 +11696,23 @@ The operation parameter controls how the new value is assigned to the property,
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+ 0
+
+
The minimum value for this range.
@@ -11021,7 +11735,23 @@ The operation parameter controls how the new value is assigned to the property,
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+ 0
+
+
The maximum value for this range.
@@ -11056,7 +11786,7 @@ The operation parameter controls how the new value is assigned to the property,
Source:
@@ -11197,7 +11927,7 @@ The operation parameter controls how the new value is assigned to the property,
Source:
@@ -11225,7 +11955,7 @@ The operation parameter controls how the new value is assigned to the property,
- setXSpeed(min, max)
+ setXSpeed(min , max )
@@ -11255,8 +11985,12 @@ The operation parameter controls how the new value is assigned to the property,
Type
+ Argument
+
+ Default
+
Description
@@ -11280,7 +12014,23 @@ The operation parameter controls how the new value is assigned to the property,
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+ 0
+
+
The minimum value for this range.
@@ -11303,7 +12053,23 @@ The operation parameter controls how the new value is assigned to the property,
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+ 0
+
+
The maximum value for this range.
@@ -11338,7 +12104,7 @@ The operation parameter controls how the new value is assigned to the property,
Source:
@@ -11366,7 +12132,7 @@ The operation parameter controls how the new value is assigned to the property,
- setYSpeed(min, max)
+ setYSpeed(min , max )
@@ -11396,8 +12162,12 @@ The operation parameter controls how the new value is assigned to the property,
Type
+ Argument
+
+ Default
+
Description
@@ -11421,7 +12191,23 @@ The operation parameter controls how the new value is assigned to the property,
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+ 0
+
+
The minimum value for this range.
@@ -11444,7 +12230,23 @@ The operation parameter controls how the new value is assigned to the property,
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+ 0
+
+
The maximum value for this range.
@@ -11479,7 +12281,7 @@ The operation parameter controls how the new value is assigned to the property,
Source:
@@ -11662,7 +12464,7 @@ For example to depth sort Sprites for Zelda-style game you might call grou
Source:
@@ -11690,7 +12492,7 @@ For example to depth sort Sprites for Zelda-style game you might call grou
- start(explode, lifespan, frequency, quantity)
+ start(explode , lifespan , frequency , quantity )
@@ -11720,8 +12522,12 @@ For example to depth sort Sprites for Zelda-style game you might call grou
Type
+ Argument
+
+ Default
+
Description
@@ -11745,7 +12551,23 @@ For example to depth sort Sprites for Zelda-style game you might call grou
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+ true
+
+
Whether the particles should all burst out at once.
@@ -11768,7 +12590,23 @@ For example to depth sort Sprites for Zelda-style game you might call grou
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+ 0
+
+
How long each particle lives once emitted. 0 = forever.
@@ -11791,7 +12629,23 @@ For example to depth sort Sprites for Zelda-style game you might call grou
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+ 250
+
+
Ignored if Explode is set to true. Frequency is how often to emit a particle in ms.
@@ -11814,7 +12668,23 @@ For example to depth sort Sprites for Zelda-style game you might call grou
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+ 0
+
+
How many particles to launch. 0 = "all of the particles".
@@ -11849,7 +12719,7 @@ For example to depth sort Sprites for Zelda-style game you might call grou
Source:
@@ -12042,7 +12912,7 @@ Group.subAll('x', 10) will minus 10 from the child.x value.
Source:
@@ -12189,7 +13059,7 @@ You cannot swap a child with itself, or swap un-parented children, doing so will
Source:
@@ -12235,6 +13105,80 @@ You cannot swap a child with itself, or swap un-parented children, doing so will
+
+
+
+
+
+ swapIndex()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Inherited From:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -12281,7 +13225,7 @@ You cannot swap a child with itself, or swap un-parented children, doing so will
Source:
@@ -12326,13 +13270,13 @@ You cannot swap a child with itself, or swap un-parented children, doing so will
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:31 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:31 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Phaser.Particles.html b/docs/Phaser.Particles.html
index aeae5dca..293c88e1 100644
--- a/docs/Phaser.Particles.html
+++ b/docs/Phaser.Particles.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -1232,13 +1226,13 @@
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:31 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:31 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Phaser.Physics.Arcade.Body.html b/docs/Phaser.Physics.Arcade.Body.html
index 10e22248..fb9cd106 100644
--- a/docs/Phaser.Physics.Arcade.Body.html
+++ b/docs/Phaser.Physics.Arcade.Body.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -446,8 +440,9 @@
-
The Physics Body is linked to a single Sprite. All physics operations should be performed against the body rather than
-the Sprite itself. For example you can set the velocity, acceleration, bounce values etc all on the Body.
+
The Physics Body is linked to a single Sprite and defines properties that determine how the physics body is simulated.
+These properties affect how the body reacts to forces, what forces it generates on itself (to simulate friction), and how it reacts to collisions in the scene. In most cases, the properties are used to simulate physical effects.
+Each body also has its own property values that determine exactly how it reacts to forces and collisions in the scene.
@@ -529,7 +524,7 @@ the Sprite itself. For example you can set the velocity, acceleration, bounce va
Source:
@@ -628,7 +623,7 @@ the Sprite itself. For example you can set the velocity, acceleration, bounce va
- The velocity in pixels per second sq. of the Body.
+ The acceleration in pixels per second sq. of the Body.
@@ -657,114 +652,7 @@ the Sprite itself. For example you can set the velocity, acceleration, bounce va
Source:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- allowCollision
-
-
-
-
-
-
-
Set the allowCollision properties to control which directions collision is processed for this Body.
-For example allowCollision.up = false means it won't collide when the collision happened while moving up.
-
-
-
-
-
-
-
-
-
- Properties:
-
-
-
-
-
-
-
- Name
-
-
- Type
-
-
-
-
-
- Description
-
-
-
-
-
-
-
-
- allowCollision
-
-
-
-
-
-object
-
-
-
-
-
-
-
-
-
- An object containing allowed collision.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Source:
-
@@ -837,7 +725,7 @@ For example allowCollision.up = false means it won't collide when the collision
- Allow this Body to be influenced by the global Gravity?
+ Allow this Body to be influenced by the global Gravity value? Note: It will always be influenced by the local gravity if set.
@@ -869,7 +757,7 @@ For example allowCollision.up = false means it won't collide when the collision
Source:
@@ -942,7 +830,7 @@ For example allowCollision.up = false means it won't collide when the collision
- Allow this Body to be rotated? (via angularVelocity, etc)
+ Allow angular rotation? This will cause the Sprite to be rotated via angularVelocity, etc.
@@ -974,7 +862,109 @@ For example allowCollision.up = false means it won't collide when the collision
Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ angle
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ angle
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ The angle of the Body based on its velocity in radians.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
@@ -1047,7 +1037,7 @@ For example allowCollision.up = false means it won't collide when the collision
- The angular acceleration in pixels per second sq. of the Body.
+ The angular acceleration of the Body.
@@ -1079,7 +1069,7 @@ For example allowCollision.up = false means it won't collide when the collision
Source:
@@ -1152,7 +1142,7 @@ For example allowCollision.up = false means it won't collide when the collision
- The angular drag applied to the rotation of the Body.
+ angularDrag is used to calculate friction on the body as it rotates.
@@ -1184,7 +1174,7 @@ For example allowCollision.up = false means it won't collide when the collision
Source:
@@ -1257,7 +1247,7 @@ For example allowCollision.up = false means it won't collide when the collision
- The angular velocity in pixels per second sq. of the Body.
+ The angular velocity of the Body.
@@ -1289,7 +1279,7 @@ For example allowCollision.up = false means it won't collide when the collision
Source:
@@ -1307,7 +1297,114 @@ For example allowCollision.up = false means it won't collide when the collision
- bottom
+ blocked
+
+
+
+
+
+
+
This object is populated with boolean values when the Body collides with the World bounds or a Tile.
+For example if blocked.up is true then the Body cannot move up.
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ blocked
+
+
+
+
+
+object
+
+
+
+
+
+
+
+
+
+ An object containing on which faces this Body is blocked from moving, if any.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <readonly> bottom
@@ -1362,7 +1459,7 @@ For example allowCollision.up = false means it won't collide when the collision
- The bottom value of this Body (same as Body.y + Body.height)
+ The bottom-most point of this Body.
@@ -1391,7 +1488,7 @@ For example allowCollision.up = false means it won't collide when the collision
Source:
@@ -1464,7 +1561,7 @@ For example allowCollision.up = false means it won't collide when the collision
- The elasticitiy of the Body when colliding. bounce.x/y = 1 means full rebound, bounce.x/y = 0.5 means 50% rebound velocity.
+ The elasticitiy of the Body when colliding. This property determines how much energy a body maintains during a collision, i.e. its bounciness.
@@ -1493,7 +1590,7 @@ For example allowCollision.up = false means it won't collide when the collision
Source:
@@ -1511,7 +1608,114 @@ For example allowCollision.up = false means it won't collide when the collision
- center
+ checkCollision
+
+
+
+
+
+
+
Set the checkCollision properties to control which directions collision is processed for this Body.
+For example checkCollision.up = false means it won't collide when the collision happened while moving up.
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ checkCollision
+
+
+
+
+
+object
+
+
+
+
+
+
+
+
+
+ An object containing allowed collision.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ collideCallback
@@ -1550,13 +1754,13 @@ For example allowCollision.up = false means it won't collide when the collision
- center
+ collideCallback
-Phaser.Point
+function
@@ -1566,7 +1770,7 @@ For example allowCollision.up = false means it won't collide when the collision
- The center coordinate of the Physics Body.
+ If set this callback will be fired whenever this Body is hit (on any face). It will send three parameters, the face it hit on, this Body and the Body that hit it.
@@ -1591,11 +1795,119 @@ For example allowCollision.up = false means it won't collide when the collision
+ Default Value:
+
+
Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ collideCallbackContext
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ collideCallbackContext
+
+
+
+
+
+object
+
+
+
+
+
+
+
+
+
+ The context in which the collideCallback is called.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Default Value:
+
+
+
+
+ Source:
+
@@ -1701,7 +2013,7 @@ For example allowCollision.up = false means it won't collide when the collision
Source:
@@ -1719,17 +2031,12 @@ For example allowCollision.up = false means it won't collide when the collision
- customSeparateX
+
-
-
This flag allows you to disable the custom x separation that takes place by Physics.Arcade.separate.
-Used in combination with your own collision processHandler you can create whatever type of collision response you need.
-
-
@@ -1763,13 +2070,13 @@ Used in combination with your own collision processHandler you can create whatev
- customSeparateX
+ contacts
-boolean
+array.<Phaser.Physics.Arcade.Body >
@@ -1779,7 +2086,109 @@ Used in combination with your own collision processHandler you can create whatev
- Use a custom separation system or the built-in one?
+ Used to store references to bodies this Body is in contact with.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ customSeparateCallback
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ customSeparateCallback
+
+
+
+
+
+function
+
+
+
+
+
+
+
+
+
+ If set this callback will be used for Body separation instead of the built-in one. Callback should return true if separated, otherwise false.
@@ -1805,13 +2214,13 @@ Used in combination with your own collision processHandler you can create whatev
Default Value:
-
+
Source:
@@ -1829,17 +2238,12 @@ Used in combination with your own collision processHandler you can create whatev
- customSeparateY
+ customSeparateContext
-
-
This flag allows you to disable the custom y separation that takes place by Physics.Arcade.separate.
-Used in combination with your own collision processHandler you can create whatever type of collision response you need.
-
-
@@ -1873,13 +2277,13 @@ Used in combination with your own collision processHandler you can create whatev
- customSeparateY
+ customSeparateContext
-boolean
+object
@@ -1889,7 +2293,7 @@ Used in combination with your own collision processHandler you can create whatev
- Use a custom separation system or the built-in one?
+ The context in which the customSeparateCallback is called.
@@ -1915,221 +2319,13 @@ Used in combination with your own collision processHandler you can create whatev
Default Value:
-
+
Source:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- drag
-
-
-
-
-
-
-
-
-
-
-
-
- Properties:
-
-
-
-
-
-
-
- Name
-
-
- Type
-
-
-
-
-
- Description
-
-
-
-
-
-
-
-
- drag
-
-
-
-
-
-Phaser.Point
-
-
-
-
-
-
-
-
-
- The drag applied to the motion of the Body.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Source:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- embedded
-
-
-
-
-
-
-
If a body is overlapping with another body, but neither of them are moving (maybe they spawned on-top of each other?) this is set to true.
-
-
-
-
-
-
-
-
-
- Properties:
-
-
-
-
-
-
-
- Name
-
-
- Type
-
-
-
-
-
- Description
-
-
-
-
-
-
-
-
- embedded
-
-
-
-
-
-boolean
-
-
-
-
-
-
-
-
-
- Body embed value.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Source:
-
@@ -2231,7 +2427,7 @@ Used in combination with your own collision processHandler you can create whatev
Source:
@@ -2333,7 +2529,7 @@ Used in combination with your own collision processHandler you can create whatev
Source:
@@ -2406,7 +2602,7 @@ Used in combination with your own collision processHandler you can create whatev
- A private Gravity setting for the Body.
+ The gravity applied to the motion of the Body. This works in addition to any gravity set on the world.
@@ -2435,7 +2631,7 @@ Used in combination with your own collision processHandler you can create whatev
Source:
@@ -2453,7 +2649,7 @@ Used in combination with your own collision processHandler you can create whatev
- halfHeight
+ <readonly> height
@@ -2492,7 +2688,7 @@ Used in combination with your own collision processHandler you can create whatev
- halfHeight
+ height
@@ -2508,7 +2704,7 @@ Used in combination with your own collision processHandler you can create whatev
- The calculated height / 2 of the physics body.
+ The current height of the Body, taking into account the point rotation.
@@ -2537,410 +2733,7 @@ Used in combination with your own collision processHandler you can create whatev
Source:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- halfWidth
-
-
-
-
-
-
-
-
-
-
-
-
- Properties:
-
-
-
-
-
-
-
- Name
-
-
- Type
-
-
-
-
-
- Description
-
-
-
-
-
-
-
-
- halfWidth
-
-
-
-
-
-number
-
-
-
-
-
-
-
-
-
- The calculated width / 2 of the physics body.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Source:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- height
-
-
-
-
-
-
-
-
-
-
-
-
- Properties:
-
-
-
-
-
-
-
- Name
-
-
- Type
-
-
-
-
-
- Description
-
-
-
-
-
-
-
-
- .numInternal
-
-
-
-
-
-
-
-
-
-
- ID cache
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Source:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- hullX
-
-
-
-
-
-
-
-
-
-
-
-
- Properties:
-
-
-
-
-
-
-
- Name
-
-
- Type
-
-
-
-
-
- Description
-
-
-
-
-
-
-
-
- hullX
-
-
-
-
-
-Phaser.Rectangle
-
-
-
-
-
-
-
-
-
- The dynamically calculated hull used during collision.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Source:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- hullY
-
-
-
-
-
-
-
-
-
-
-
-
- Properties:
-
-
-
-
-
-
-
- Name
-
-
- Type
-
-
-
-
-
- Description
-
-
-
-
-
-
-
-
- hullY
-
-
-
-
-
-Phaser.Rectangle
-
-
-
-
-
-
-
-
-
- The dynamically calculated hull used during collision.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Source:
-
@@ -3013,7 +2806,7 @@ Used in combination with your own collision processHandler you can create whatev
- An immovable Body will not receive any impacts from other bodies.
+ An immovable Body will not receive any impacts or exchanges of velocity from other bodies.
@@ -3045,7 +2838,214 @@ Used in combination with your own collision processHandler you can create whatev
Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <readonly> left
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ left
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ The left-most point of this Body.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ linearDamping
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ linearDamping
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ linearDamping is used to calculate friction on the body as it moves through the world. For example, this might be used to simulate air or water friction.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Default Value:
+
+
+
+
+ Source:
+
@@ -3118,7 +3118,7 @@ Used in combination with your own collision processHandler you can create whatev
- The mass of the Body.
+ The mass property determines how forces affect the body, as well as how much momentum the body has when it is involved in a collision.
@@ -3150,7 +3150,7 @@ Used in combination with your own collision processHandler you can create whatev
Source:
@@ -3223,7 +3223,7 @@ Used in combination with your own collision processHandler you can create whatev
- The maximum angular velocity in pixels per second sq. that the Body can reach.
+ The maximum angular velocity that the Body can reach.
@@ -3255,7 +3255,7 @@ Used in combination with your own collision processHandler you can create whatev
Source:
@@ -3328,7 +3328,7 @@ Used in combination with your own collision processHandler you can create whatev
- The maximum velocity in pixels per second sq. that the Body can reach.
+ The maximum velocity that the Body can reach.
@@ -3357,7 +3357,109 @@ Used in combination with your own collision processHandler you can create whatev
Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ minVelocity
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ minVelocity
+
+
+
+
+
+Phaser.Point
+
+
+
+
+
+
+
+
+
+ When a body rebounds off another body or a wall the minVelocity is checked. If the new velocity is lower than minVelocity the body is stopped.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
@@ -3430,7 +3532,7 @@ Used in combination with your own collision processHandler you can create whatev
- Set to true to allow the Physics system to move this Body, other false to move it manually.
+ Set to true to allow the Physics system (such as velocity) to move this Body, or false to move it manually.
@@ -3462,7 +3564,7 @@ Used in combination with your own collision processHandler you can create whatev
Source:
@@ -3564,7 +3666,7 @@ Used in combination with your own collision processHandler you can create whatev
Source:
@@ -3582,16 +3684,12 @@ Used in combination with your own collision processHandler you can create whatev
- overlapX
+ <protected> overlapX
-
-
When this body collides with another, the amount of overlap is stored here.
-
-
@@ -3641,7 +3739,7 @@ Used in combination with your own collision processHandler you can create whatev
- The amount of horizontal overlap during the collision.
+ Mostly used internally to store the overlap values from Tile seperation.
@@ -3670,7 +3768,7 @@ Used in combination with your own collision processHandler you can create whatev
Source:
@@ -3688,16 +3786,12 @@ Used in combination with your own collision processHandler you can create whatev
- overlapY
+ <protected> overlapY
-
-
When this body collides with another, the amount of overlap is stored here.
-
-
@@ -3747,7 +3841,7 @@ Used in combination with your own collision processHandler you can create whatev
- The amount of vertical overlap during the collision.
+ Mostly used internally to store the overlap values from Tile seperation.
@@ -3776,7 +3870,109 @@ Used in combination with your own collision processHandler you can create whatev
Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ polygon
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ polygon
+
+
+
+
+
+SAT.Polygon
+
+
+
+
+
+
+
+
+
+ The SAT Polygons, as derived from the Shape.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
@@ -3878,7 +4074,7 @@ Used in combination with your own collision processHandler you can create whatev
Source:
@@ -3980,7 +4176,7 @@ Used in combination with your own collision processHandler you can create whatev
Source:
@@ -4082,7 +4278,7 @@ Used in combination with your own collision processHandler you can create whatev
Source:
@@ -4100,7 +4296,7 @@ Used in combination with your own collision processHandler you can create whatev
- <protected> quadTreeIDs
+ rebound
@@ -4139,13 +4335,13 @@ Used in combination with your own collision processHandler you can create whatev
- quadTreeIDs
+ rebound
-Array
+boolean
@@ -4155,7 +4351,7 @@ Used in combination with your own collision processHandler you can create whatev
- Internal ID cache.
+ A Body set to rebound will exchange velocity with another Body during collision. Set to false to allow this body to be 'pushed' rather than exchange velocity.
@@ -4180,11 +4376,14 @@ Used in combination with your own collision processHandler you can create whatev
+ Default Value:
+
+
Source:
@@ -4202,109 +4401,7 @@ Used in combination with your own collision processHandler you can create whatev
- <protected> quadTreeIndex
-
-
-
-
-
-
-
-
-
-
-
-
- Properties:
-
-
-
-
-
-
-
- Name
-
-
- Type
-
-
-
-
-
- Description
-
-
-
-
-
-
-
-
- quadTreeIndex
-
-
-
-
-
-number
-
-
-
-
-
-
-
-
-
- Internal ID cache.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Source:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- right
+ <readonly> right
@@ -4359,7 +4456,7 @@ Used in combination with your own collision processHandler you can create whatev
- The right value of this Body (same as Body.x + Body.width)
+ The right-most point of this Body.
@@ -4388,7 +4485,7 @@ Used in combination with your own collision processHandler you can create whatev
Source:
@@ -4461,7 +4558,7 @@ Used in combination with your own collision processHandler you can create whatev
- The amount the Body is rotated.
+ The amount the parent Sprite is rotated.
@@ -4493,7 +4590,7 @@ Used in combination with your own collision processHandler you can create whatev
Source:
@@ -4511,7 +4608,7 @@ Used in combination with your own collision processHandler you can create whatev
- <readonly> screenX
+ shape
@@ -4550,7 +4647,115 @@ Used in combination with your own collision processHandler you can create whatev
- screenX
+ shape
+
+
+
+
+
+SAT.Box
+|
+
+SAT.Circle
+|
+
+SAT.Polygon
+
+
+
+
+
+
+
+
+
+ The SAT Collision shape.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ speed
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ speed
@@ -4566,7 +4771,7 @@ Used in combination with your own collision processHandler you can create whatev
- The x position of the physics body translated to screen space.
+ The speed in pixels per second sq. of the Body.
@@ -4595,418 +4800,7 @@ Used in combination with your own collision processHandler you can create whatev
Source:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <readonly> screenY
-
-
-
-
-
-
-
-
-
-
-
-
- Properties:
-
-
-
-
-
-
-
- Name
-
-
- Type
-
-
-
-
-
- Description
-
-
-
-
-
-
-
-
- screenY
-
-
-
-
-
-number
-
-
-
-
-
-
-
-
-
- The y position of the physics body translated to screen space.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Source:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- skipQuadTree
-
-
-
-
-
-
-
-
-
-
-
-
- Properties:
-
-
-
-
-
-
-
- Name
-
-
- Type
-
-
-
-
-
- Description
-
-
-
-
-
-
-
-
- skipQuadTree
-
-
-
-
-
-boolean
-
-
-
-
-
-
-
-
-
- If the Body is an irregular shape you can set this to true to avoid it being added to the World quad tree.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Default Value:
-
-
-
-
- Source:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <readonly> sourceHeight
-
-
-
-
-
-
-
-
-
-
-
-
- Properties:
-
-
-
-
-
-
-
- Name
-
-
- Type
-
-
-
-
-
- Description
-
-
-
-
-
-
-
-
- sourceHeight
-
-
-
-
-
-number
-
-
-
-
-
-
-
-
-
- The un-scaled original size.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Source:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <readonly> sourceWidth
-
-
-
-
-
-
-
-
-
-
-
-
- Properties:
-
-
-
-
-
-
-
- Name
-
-
- Type
-
-
-
-
-
- Description
-
-
-
-
-
-
-
-
- sourceWidth
-
-
-
-
-
-number
-
-
-
-
-
-
-
-
-
- The un-scaled original size.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Source:
-
@@ -5108,7 +4902,109 @@ Used in combination with your own collision processHandler you can create whatev
Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <readonly> top
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ top
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ The top-most point of this Body.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
@@ -5215,7 +5111,112 @@ touching.up = true means the collision happened to the top of this Body for exam
Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ type
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
@@ -5288,7 +5289,7 @@ touching.up = true means the collision happened to the top of this Body for exam
- The velocity in pixels per second sq. of the Body.
+ The velocity of the Body.
@@ -5317,7 +5318,7 @@ touching.up = true means the collision happened to the top of this Body for exam
Source:
@@ -5335,113 +5336,7 @@ touching.up = true means the collision happened to the top of this Body for exam
- wasTouching
-
-
-
-
-
-
-
This object is populated with previous touching values from the bodies previous collision.
-
-
-
-
-
-
-
-
-
- Properties:
-
-
-
-
-
-
-
- Name
-
-
- Type
-
-
-
-
-
- Description
-
-
-
-
-
-
-
-
- wasTouching
-
-
-
-
-
-object
-
-
-
-
-
-
-
-
-
- An object containing previous touching results.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Source:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- width
+ <readonly> width
@@ -5496,7 +5391,7 @@ touching.up = true means the collision happened to the top of this Body for exam
- The calculated width of the physics body.
+ The current width of the Body, taking into account the point rotation.
@@ -5525,7 +5420,7 @@ touching.up = true means the collision happened to the top of this Body for exam
Source:
@@ -5543,7 +5438,7 @@ touching.up = true means the collision happened to the top of this Body for exam
- <readonly> x
+ x
@@ -5598,7 +5493,7 @@ touching.up = true means the collision happened to the top of this Body for exam
- The x position of the physics body.
+ The x coordinate of this Body.
@@ -5627,7 +5522,7 @@ touching.up = true means the collision happened to the top of this Body for exam
Source:
@@ -5645,7 +5540,7 @@ touching.up = true means the collision happened to the top of this Body for exam
- <readonly> y
+ y
@@ -5700,7 +5595,7 @@ touching.up = true means the collision happened to the top of this Body for exam
- The y position of the physics body.
+ The y coordinate of this Body.
@@ -5729,7 +5624,7 @@ touching.up = true means the collision happened to the top of this Body for exam
Source:
@@ -5753,7 +5648,7 @@ touching.up = true means the collision happened to the top of this Body for exam
- deltaAbsX() → {number}
+ <protected> add(v)
@@ -5761,7 +5656,7 @@ touching.up = true means the collision happened to the top of this Body for exam
-
Returns the absolute delta x value.
+
Adds the given Vector to this Body.
@@ -5770,6 +5665,55 @@ touching.up = true means the collision happened to the top of this Body for exam
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ v
+
+
+
+
+
+SAT.Vector
+
+
+
+
+
+
+
+
+
+ The vector to add to this Body.
+
+
+
+
+
+
+
@@ -5794,7 +5738,125 @@ touching.up = true means the collision happened to the top of this Body for exam
Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Adds the given Body to the contact list of this Body. Also adds this Body to the contact list of the given Body.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ body
+
+
+
+
+
+Phaser.Physics.Arcade.Body
+
+
+
+
+
+
+
+
+
+ The Body to be added.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
@@ -5819,7 +5881,7 @@ touching.up = true means the collision happened to the top of this Body for exam
-
The absolute delta value.
+
True if the given Body was added to this contact list, false if already on it.
@@ -5830,7 +5892,7 @@ touching.up = true means the collision happened to the top of this Body for exam
-number
+boolean
@@ -5845,7 +5907,7 @@ touching.up = true means the collision happened to the top of this Body for exam
- deltaAbsY() → {number}
+ <protected> applyDamping()
@@ -5853,7 +5915,7 @@ touching.up = true means the collision happened to the top of this Body for exam
-
Returns the absolute delta y value.
+
Internal method that checks the acceleration and applies damping if not set.
@@ -5886,7 +5948,7 @@ touching.up = true means the collision happened to the top of this Body for exam
Source:
@@ -5907,29 +5969,75 @@ touching.up = true means the collision happened to the top of this Body for exam
- Returns:
-
-
-
The absolute delta value.
-
-
-
-
-
-
- Type
-
-
-
-number
-
-
-
-
-
+
+
+
+
+ <protected> checkBlocked()
+
+
+
+
+
+
+
+
Internal method that checks and potentially resets the blocked status flags.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -5945,7 +6053,7 @@ touching.up = true means the collision happened to the top of this Body for exam
-
Returns the delta x value. The difference between Body.x now and in the previous step.
+
Returns the delta x value. The amount the Body has moved horizontally in the current step.
@@ -5978,7 +6086,7 @@ touching.up = true means the collision happened to the top of this Body for exam
Source:
@@ -6003,7 +6111,7 @@ touching.up = true means the collision happened to the top of this Body for exam
-
The delta value.
+
The delta value. Positive if the motion was to the right, negative if to the left.
@@ -6037,7 +6145,7 @@ touching.up = true means the collision happened to the top of this Body for exam
-
Returns the delta y value. The difference between Body.y now and in the previous step.
+
Returns the delta y value. The amount the Body has moved vertically in the current step.
@@ -6070,7 +6178,99 @@ touching.up = true means the collision happened to the top of this Body for exam
Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+
+
+
The delta value. Positive if the motion was downwards, negative if upwards.
+
+
+
+
+
+
+ Type
+
+
+
+number
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ deltaZ() → {number}
+
+
+
+
+
+
+
+
Returns the delta z value. The amount the Body has rotated in the current step.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
@@ -6116,6 +6316,3776 @@ touching.up = true means the collision happened to the top of this Body for exam
+
+
+
+
+
+ destroy()
+
+
+
+
+
+
+
+
Destroys this Body and all references it holds to other objects.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <protected> exchange(body)
+
+
+
+
+
+
+
+
Exchange velocity with the given Body.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ body
+
+
+
+
+
+Phaser.Physics.Arcade.Body
+
+
+
+
+
+
+
+
+
+ The Body that collided.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ getDownwardForce() → {number}
+
+
+
+
+
+
+
+
Gets the total force being applied on the X axis, including gravity and velocity.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+
+
+
The total force being applied on the Y axis.
+
+
+
+
+
+
+ Type
+
+
+
+number
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ getUpwardForce() → {number}
+
+
+
+
+
+
+
+
Gets the total force being applied on the X axis, including gravity and velocity.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+
+
+
The total force being applied on the X axis.
+
+
+
+
+
+
+ Type
+
+
+
+number
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <protected> give(body, response)
+
+
+
+
+
+
+
+
Separation response handler.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ body
+
+
+
+
+
+Phaser.Physics.Arcade.Body
+
+
+
+
+
+
+
+
+
+ The Body that collided.
+
+
+
+
+
+
+ response
+
+
+
+
+
+SAT.Response
+
+
+
+
+
+
+
+
+
+ The SAT Response object containing the collision data.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <protected> hitBottom(body, response)
+
+
+
+
+
+
+
+
Process a collision with the bottom face of this Body.
+Collision and separation can be further checked by setting a collideCallback.
+This callback will be sent 4 parameters: The face of collision, this Body, the colliding Body and the SAT Response.
+If the callback returns true then separation, rebounds and the touching flags will all be set.
+If it returns false this will be skipped and must be handled manually.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ body
+
+
+
+
+
+Phaser.Physics.Arcade.Body
+
+
+
+
+
+
+
+
+
+ The Body that collided.
+
+
+
+
+
+
+ response
+
+
+
+
+
+SAT.Response
+
+
+
+
+
+
+
+
+
+ The SAT Response object containing the collision data.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <protected> hitLeft(body, response)
+
+
+
+
+
+
+
+
Process a collision with the left face of this Body.
+Collision and separation can be further checked by setting a collideCallback.
+This callback will be sent 4 parameters: The face of collision, this Body, the colliding Body and the SAT Response.
+If the callback returns true then separation, rebounds and the touching flags will all be set.
+If it returns false this will be skipped and must be handled manually.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ body
+
+
+
+
+
+Phaser.Physics.Arcade.Body
+
+
+
+
+
+
+
+
+
+ The Body that collided.
+
+
+
+
+
+
+ response
+
+
+
+
+
+SAT.Response
+
+
+
+
+
+
+
+
+
+ The SAT Response object containing the collision data.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <protected> hitRight(body, response)
+
+
+
+
+
+
+
+
Process a collision with the right face of this Body.
+Collision and separation can be further checked by setting a collideCallback.
+This callback will be sent 4 parameters: The face of collision, this Body, the colliding Body and the SAT Response.
+If the callback returns true then separation, rebounds and the touching flags will all be set.
+If it returns false this will be skipped and must be handled manually.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ body
+
+
+
+
+
+Phaser.Physics.Arcade.Body
+
+
+
+
+
+
+
+
+
+ The Body that collided.
+
+
+
+
+
+
+ response
+
+
+
+
+
+SAT.Response
+
+
+
+
+
+
+
+
+
+ The SAT Response object containing the collision data.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <protected> hitTop(body, response)
+
+
+
+
+
+
+
+
Process a collision with the top face of this Body.
+Collision and separation can be further checked by setting a collideCallback.
+This callback will be sent 4 parameters: The face of collision, this Body, the colliding Body and the SAT Response.
+If the callback returns true then separation, rebounds and the touching flags will all be set.
+If it returns false this will be skipped and must be handled manually.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ body
+
+
+
+
+
+Phaser.Physics.Arcade.Body
+
+
+
+
+
+
+
+
+
+ The Body that collided.
+
+
+
+
+
+
+ response
+
+
+
+
+
+SAT.Response
+
+
+
+
+
+
+
+
+
+ The SAT Response object containing the collision data.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Checks if this Body is already in contact with the given Body.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ body
+
+
+
+
+
+Phaser.Physics.Arcade.Body
+
+
+
+
+
+
+
+
+
+ The Body to be checked.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+
+
+
True if the given Body is already in contact with this Body.
+
+
+
+
+
+
+ Type
+
+
+
+boolean
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <protected> integrateVelocity()
+
+
+
+
+
+
+
+
Internal method. Integrates velocity, global gravity and the delta timer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ onFloor() → {boolean}
+
+
+
+
+
+
+
+
Determines if this Body is 'on the floor', which means in contact with a Tile or World bounds, or other object that has set 'down' as blocked.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+
+
+
True if this Body is 'on the floor', which means in contact with a Tile or World bounds, or object that has set 'down' as blocked.
+
+
+
+
+
+
+ Type
+
+
+
+boolean
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ onWall() → {boolean}
+
+
+
+
+
+
+
+
Determins if this Body is 'on a wall', which means horizontally in contact with a Tile or World bounds, or other object but not the ground.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+
+
+
True if this Body is 'on a wall', which means horizontally in contact with a Tile or World bounds, or other object but not the ground.
+
+
+
+
+
+
+ Type
+
+
+
+boolean
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ overlap(body, response) → {boolean}
+
+
+
+
+
+
+
+
Checks for an overlap between this Body and the given Body.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ body
+
+
+
+
+
+Phaser.Physics.Arcade.Body
+
+
+
+
+
+
+
+
+
+ The Body that is being checked against this Body.
+
+
+
+
+
+
+ response
+
+
+
+
+
+SAT.Response
+
+
+
+
+
+
+
+
+
+ SAT Response handler.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+
+
+
True if the two bodies overlap, otherwise false.
+
+
+
+
+
+
+ Type
+
+
+
+boolean
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <protected> postUpdate()
+
+
+
+
+
+
+
+
Internal method. This is called directly before the sprites are sent to the renderer and after the update function has finished.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <protected> preUpdate()
+
+
+
+
+
+
+
+
Internal method that updates the Body position in relation to the parent Sprite.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <protected> processRebound(body)
+
+
+
+
+
+
+
+
Rebound the velocity of this Body.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ body
+
+
+
+
+
+Phaser.Physics.Arcade.Body
+
+
+
+
+
+
+
+
+
+ The Body that collided.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <protected> reboundCheck(x, y, rebound)
+
+
+
+
+
+
+
+
Check if we're below minVelocity and gravity isn't trying to drag us in the opposite direction.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ x
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+
+ Check the X axis?
+
+
+
+
+
+
+ y
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+
+ Check the Y axis?
+
+
+
+
+
+
+ rebound
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+
+ If true it will reverse the velocity on the given axis
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Removes the given Body from the contact list of this Body. Also removes this Body from the contact list of the given Body.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ body
+
+
+
+
+
+Phaser.Physics.Arcade.Body
+
+
+
+
+
+
+
+
+
+ The Body to be removed.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+
+
+
True if the given Body was removed from this contact list, false if wasn't on it.
+
+
+
+
+
+
+ Type
+
+
+
+boolean
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ reset(full )
+
+
+
+
+
+
+
+
Resets the Body motion values: velocity, acceleration, angularVelocity and angularAcceleration.
+Also resets the forces to defaults: gravity, bounce, minVelocity,maxVelocity, angularDrag, maxAngular, mass, friction and checkCollision if 'full' specified.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+ Argument
+
+
+
+ Default
+
+
+ Description
+
+
+
+
+
+
+
+
+ full
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ false
+
+
+
+
+ A full reset clears down settings you may have set, such as gravity, bounce and drag. A non-full reset just clears motion values.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <protected> separate(body, response) → {boolean}
+
+
+
+
+
+
+
+
This separates this Body from the given Body unless a customSeparateCallback is set.
+It assumes they have already been overlap checked and the resulting overlap is stored in the SAT response.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ body
+
+
+
+
+
+Phaser.Physics.Arcade.Body
+
+
+
+
+
+
+
+
+
+ The Body to be separated from this one.
+
+
+
+
+
+
+ response
+
+
+
+
+
+SAT.Response
+
+
+
+
+
+
+
+
+
+ SAT Response handler.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+
+
+
True if the bodies were separated, false if not (for example checkCollide allows them to pass through)
+
+
+
+
+
+
+ Type
+
+
+
+boolean
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ setCircle(radius, offsetX , offsetY )
+
+
+
+
+
+
+
+
Sets this Body to use a circle of the given radius for all collision.
+The Circle will be centered on the center of the Sprite by default, but can be adjusted via the Body.offset property and the setCircle x/y parameters.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+ Argument
+
+
+
+ Default
+
+
+ Description
+
+
+
+
+
+
+
+
+ radius
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The radius of this circle (in pixels)
+
+
+
+
+
+
+ offsetX
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ 0
+
+
+
+
+ The x amount the circle will be offset from the Sprites center.
+
+
+
+
+
+
+ offsetY
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ 0
+
+
+
+
+ The y amount the circle will be offset from the Sprites center.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ setPolygon(points)
+
+
+
+
+
+
+
+
Sets this Body to use a convex polygon for collision.
+The points are specified in a counter-clockwise direction and must create a convex polygon.
+Use Body.translate and/or Body.offset to re-position the polygon from the Sprite origin.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ points
+
+
+
+
+
+Array .<SAT.Vector>
+|
+
+Array .<number>
+|
+
+SAT.Vector
+|
+
+number
+
+
+
+
+
+
+
+
+
+ This can be an array of Vectors that form the polygon,
+ a flat array of numbers that will be interpreted as [x,y, x,y, ...], or the arguments passed can be
+ all the points of the polygon e.g. setPolygon(new SAT.Vector(), new SAT.Vector(), ...), or the
+ arguments passed can be flat x,y values e.g. setPolygon(x,y, x,y, x,y, ...) where x and y are Numbers.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ setRectangle(width , height , translateX , translateY )
+
+
+
+
+
+
+
+
Sets this Body to use a rectangle for all collision.
+If you don't specify any parameters it will be sized to match the parent Sprites current width and height (including scale factor) and centered on the sprite.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+ Argument
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ width
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+ The width of the rectangle. If not specified it will default to the width of the parent Sprite.
+
+
+
+
+
+
+ height
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+ The height of the rectangle. If not specified it will default to the height of the parent Sprite.
+
+
+
+
+
+
+ translateX
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+ The x amount the rectangle will be translated from the Sprites center.
+
+
+
+
+
+
+ translateY
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+ The y amount the rectangle will be translated from the Sprites center.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <protected> split(body, response)
+
+
+
+
+
+
+
+
Split the collision response evenly between the two bodies.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ body
+
+
+
+
+
+Phaser.Physics.Arcade.Body
+
+
+
+
+
+
+
+
+
+ The Body that collided.
+
+
+
+
+
+
+ response
+
+
+
+
+
+SAT.Response
+
+
+
+
+
+
+
+
+
+ The SAT Response object containing the collision data.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <protected> sub(v)
+
+
+
+
+
+
+
+
Subtracts the given Vector from this Body.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ v
+
+
+
+
+
+SAT.Vector
+
+
+
+
+
+
+
+
+
+ The vector to substract from this Body.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <protected> take(body, response)
+
+
+
+
+
+
+
+
Separation response handler.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ body
+
+
+
+
+
+Phaser.Physics.Arcade.Body
+
+
+
+
+
+
+
+
+
+ The Body that collided.
+
+
+
+
+
+
+ response
+
+
+
+
+
+SAT.Response
+
+
+
+
+
+
+
+
+
+ The SAT Response object containing the collision data.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ translate(x, y)
+
+
+
+
+
+
+
+
Used for translating rectangle and polygon bodies from the Sprite parent. Doesn't apply to Circles.
+See also the Body.offset property.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ x
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ The x amount the polygon or rectangle will be translated by from the Sprite.
+
+
+
+
+
+
+ y
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ The y amount the polygon or rectangle will be translated by from the Sprite.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <protected> updateBounds()
+
+
+
+
+
+
+
+
Internal method that updates the left, right, top, bottom, width and height properties.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <protected> updateScale()
+
+
+
+
+
+
+
+
Internal method that updates the Body scale in relation to the parent Sprite.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -6138,13 +10108,13 @@ touching.up = true means the collision happened to the top of this Body for exam
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:32 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:32 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Phaser.Physics.Arcade.html b/docs/Phaser.Physics.Arcade.html
index 3b00f559..b048804c 100644
--- a/docs/Phaser.Physics.Arcade.html
+++ b/docs/Phaser.Physics.Arcade.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -579,7 +573,7 @@
- bounds
+ <static, constant> CIRCLE :number
@@ -587,63 +581,21 @@
+ Type:
+
+
- Properties:
-
-
-
-
-
-
-
- Name
-
-
- Type
-
-
-
-
-
- Description
-
-
-
-
-
-
-
-
- bounds
-
-
-
-
-
-Phaser.Rectangle
-
-
-
-
-
-
-
-
-
- The bounds inside of which the physics world exists. Defaults to match the world bounds.
-
-
-
-
-
-
-
-
-
@@ -663,7 +615,127 @@
Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <static, constant> POLYGON :number
+
+
+
+
+
+
+
+ Type:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <static, constant> RECT :number
+
+
+
+
+
+
+
+ Type:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
@@ -969,7 +1041,7 @@
Source:
@@ -1071,109 +1143,7 @@
Source:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- OVERLAP_BIAS
-
-
-
-
-
-
-
-
-
-
-
-
- Properties:
-
-
-
-
-
-
-
- Name
-
-
- Type
-
-
-
-
-
- Description
-
-
-
-
-
-
-
-
- OVERLAP_BIAS
-
-
-
-
-
-number
-
-
-
-
-
-
-
-
-
- A value added to the delta values during collision checks.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Source:
-
@@ -1275,7 +1245,7 @@
Source:
@@ -1293,7 +1263,7 @@
- quadTreeID
+ worldBottom
@@ -1332,13 +1302,13 @@
- quadTreeID
+ worldBottom
-number
+SAT.Box
@@ -1348,7 +1318,7 @@
- The QuadTree ID.
+ The bottom of the physics bounds.
@@ -1377,7 +1347,415 @@
Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ worldLeft
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ worldLeft
+
+
+
+
+
+SAT.Box
+
+
+
+
+
+
+
+
+
+ The left hand side of the physics bounds.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ worldPolys
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ worldPolys
+
+
+
+
+
+array.<SAT.Polygon>
+
+
+
+
+
+
+
+
+
+ An array of the polygon data from the physics bounds.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ worldRight
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ worldRight
+
+
+
+
+
+SAT.Box
+
+
+
+
+
+
+
+
+
+ The right hand side of the physics bounds.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ worldTop
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ worldTop
+
+
+
+
+
+SAT.Box
+
+
+
+
+
+
+
+
+
+ The top side of the physics bounds.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
@@ -1662,7 +2040,7 @@ Note: The display object doesn't stop moving once it reaches the destination coo
Source:
@@ -1976,7 +2354,7 @@ Note: The display object doesn't stop moving once it reaches the destination coo
Source:
@@ -2323,7 +2701,7 @@ Note: The display object doesn't stop moving once it reaches the destination coo
Source:
@@ -2383,7 +2761,7 @@ Note: The display object doesn't stop moving once it reaches the destination coo
Given the rotation (in radians) and speed calculate the acceleration and return it as a Point object, or set it to the given point object.
-One way to use this is: velocityFromRotation(rotation, 200, sprite.velocity) which will set the values directly to the sprites velocity and not create a new Point object.
+One way to use this is: accelerationFromRotation(rotation, 200, sprite.acceleration) which will set the values directly to the sprites acceleration and not create a new Point object.
@@ -2560,7 +2938,7 @@ One way to use this is: velocityFromRotation(rotation, 200, sprite.velocity) whi
Source:
@@ -2726,7 +3104,7 @@ One way to use this is: velocityFromRotation(rotation, 200, sprite.velocity) whi
Source:
@@ -2910,7 +3288,7 @@ One way to use this is: velocityFromRotation(rotation, 200, sprite.velocity) whi
Source:
@@ -3097,7 +3475,7 @@ One way to use this is: velocityFromRotation(rotation, 200, sprite.velocity) whi
Source:
@@ -3148,7 +3526,7 @@ One way to use this is: velocityFromRotation(rotation, 200, sprite.velocity) whi
- <protected> checkWorldBounds()
+ checkBounds(The) → {boolean}
@@ -3156,7 +3534,7 @@ One way to use this is: velocityFromRotation(rotation, 200, sprite.velocity) whi
-
Internal method.
+
Checks the given Physics.Body against the Physics Bounds, if any are set, and separates them, setting the blocked flags on the Body as it does so.
@@ -3165,6 +3543,55 @@ One way to use this is: velocityFromRotation(rotation, 200, sprite.velocity) whi
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ The
+
+
+
+
+
+Phaser.Physics.Arcade.Body
+
+
+
+
+
+
+
+
+
+ Body object to be checked.
+
+
+
+
+
+
+
@@ -3189,7 +3616,7 @@ One way to use this is: velocityFromRotation(rotation, 200, sprite.velocity) whi
Source:
@@ -3210,6 +3637,29 @@ One way to use this is: velocityFromRotation(rotation, 200, sprite.velocity) whi
+ Returns:
+
+
+
+
True if the body hit the bounds, otherwise false.
+
+
+
+
+
+
+ Type
+
+
+
+boolean
+
+
+
+
+
+
+
@@ -3225,9 +3675,12 @@ One way to use this is: velocityFromRotation(rotation, 200, sprite.velocity) whi
-
Checks for collision between two game objects. The objects can be Sprites, Groups, Emitters or Tilemap Layers.
-You can perform Sprite vs. Sprite, Sprite vs. Group, Group vs. Group, Sprite vs. Tilemap Layer or Group vs. Tilemap Layer collisions.
-The objects are also automatically separated.
+
Checks for collision between two game objects. You can perform Sprite vs. Sprite, Sprite vs. Group, Group vs. Group, Sprite vs. Tilemap Layer or Group vs. Tilemap Layer collisions.
+The second parameter can be an array of objects, of differing types.
+The objects are also automatically separated. If you don't require separation then use ArcadePhysics.overlap instead.
+An optional processCallback can be provided. If given this function will be called when two sprites are found to be colliding. It is called before any separation takes place,
+giving you the chance to perform additional checks. If the function returns true then the collision and separation is carried out. If it returns false it is skipped.
+The collideCallback is an optional function that is only called if two sprites collide. If a processCallback has been set then it needs to return true for collideCallback to be called.
@@ -3302,7 +3755,7 @@ The objects are also automatically separated.
- The first object to check. Can be an instance of Phaser.Sprite, Phaser.Group, Phaser.Particles.Emitter, or Phaser.Tilemap
+ The first object to check. Can be an instance of Phaser.Sprite, Phaser.Group, Phaser.Particles.Emitter, or Phaser.Tilemap.
@@ -3325,6 +3778,9 @@ The objects are also automatically separated.
|
Phaser.Tilemap
+|
+
+array
@@ -3346,7 +3802,7 @@ The objects are also automatically separated.
- The second object to check. Can be an instance of Phaser.Sprite, Phaser.Group, Phaser.Particles.Emitter or Phaser.Tilemap
+ The second object or array of objects to check. Can be Phaser.Sprite, Phaser.Group, Phaser.Particles.Emitter or Phaser.Tilemap.
@@ -3385,7 +3841,7 @@ The objects are also automatically separated.
- An optional callback function that is called if the objects overlap. The two objects will be passed to this function in the same order in which you specified them.
+ An optional callback function that is called if the objects collide. The two objects will be passed to this function in the same order in which you specified them.
@@ -3424,7 +3880,7 @@ The objects are also automatically separated.
- A callback function that lets you perform additional checks against the two objects if they overlap. If this is set then collideCallback will only be called if processCallback returns true.
+ A callback function that lets you perform additional checks against the two objects if they overlap. If this is set then collision will only happen if processCallback returns true. The two objects will be passed to this function in the same order in which you specified them.
@@ -3493,7 +3949,7 @@ The objects are also automatically separated.
Source:
@@ -3539,262 +3995,6 @@ The objects are also automatically separated.
-
-
-
-
-
- computeVelocity(axis, body, velocity, acceleration, drag, mMax) → {number}
-
-
-
-
-
-
-
-
A tween-like function that takes a starting velocity and some other factors and returns an altered velocity.
-
-
-
-
-
-
-
-
- Parameters:
-
-
-
-
-
-
- Name
-
-
- Type
-
-
-
-
-
- Description
-
-
-
-
-
-
-
-
- axis
-
-
-
-
-
-number
-
-
-
-
-
-
-
-
-
- 1 for horizontal, 2 for vertical.
-
-
-
-
-
-
- body
-
-
-
-
-
-Phaser.Physics.Arcade.Body
-
-
-
-
-
-
-
-
-
- The Body object to be updated.
-
-
-
-
-
-
- velocity
-
-
-
-
-
-number
-
-
-
-
-
-
-
-
-
- Any component of velocity (e.g. 20).
-
-
-
-
-
-
- acceleration
-
-
-
-
-
-number
-
-
-
-
-
-
-
-
-
- Rate at which the velocity is changing.
-
-
-
-
-
-
- drag
-
-
-
-
-
-number
-
-
-
-
-
-
-
-
-
- Really kind of a deceleration, this is how much the velocity changes if Acceleration is not set.
-
-
-
-
-
-
- mMax
-
-
-
-
-
-number
-
-
-
-
-
-
-
-
-
- An absolute value cap for the velocity.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Source:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Returns:
-
-
-
-
The altered Velocity value.
-
-
-
-
-
-
- Type
-
-
-
-number
-
-
-
-
-
-
-
-
-
@@ -3913,7 +4113,7 @@ The objects are also automatically separated.
Source:
@@ -4099,7 +4299,7 @@ If you need to calculate from the center of a display object instead use the met
Source:
@@ -4288,7 +4488,7 @@ If you need to calculate from the center of a display object instead use the met
Source:
@@ -4334,6 +4534,171 @@ If you need to calculate from the center of a display object instead use the met
+
+
+
+
+
+ intersects(a, b) → {boolean}
+
+
+
+
+
+
+
+
Performs a rect intersection test against the two objects.
+Objects must expose properties: width, height, left, right, top, bottom.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ a
+
+
+
+
+
+object
+
+
+
+
+
+
+
+
+
+ The first object to test.
+
+
+
+
+
+
+ b
+
+
+
+
+
+object
+
+
+
+
+
+
+
+
+
+ The second object to test.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+
+
+
Returns true if the objects intersect, otherwise false.
+
+
+
+
+
+
+ Type
+
+
+
+boolean
+
+
+
+
+
+
+
+
+
@@ -4563,7 +4928,7 @@ Note: Doesn't take into account acceleration, maxVelocity or drag (if you've set
Source:
@@ -4839,7 +5204,7 @@ Note: The display object doesn't stop moving once it reaches the destination coo
Source:
@@ -5149,7 +5514,7 @@ Note: Doesn't take into account acceleration, maxVelocity or drag (if you've set
Source:
@@ -5210,7 +5575,8 @@ Note: Doesn't take into account acceleration, maxVelocity or drag (if you've set
Checks for overlaps between two game objects. The objects can be Sprites, Groups or Emitters.
You can perform Sprite vs. Sprite, Sprite vs. Group and Group vs. Group overlap checks.
-Unlike collide the objects are NOT automatically separated or have any physics applied, they merely test for overlap results.
+Unlike collide the objects are NOT automatically separated or have any physics applied, they merely test for overlap results.
+The second parameter can be an array of objects, of differing types.
@@ -5302,6 +5668,9 @@ Unlike collide the objects are NOT automatically separated or have any physics a
|
Phaser.Particles.Emitter
+|
+
+array
@@ -5323,7 +5692,7 @@ Unlike collide the objects are NOT automatically separated or have any physics a
- The second object to check. Can be an instance of Phaser.Sprite, Phaser.Group or Phaser.Particles.Emitter.
+ The second object or array of objects to check. Can be Phaser.Sprite, Phaser.Group or Phaser.Particles.Emitter.
@@ -5470,7 +5839,7 @@ Unlike collide the objects are NOT automatically separated or have any physics a
Source:
@@ -5521,7 +5890,7 @@ Unlike collide the objects are NOT automatically separated or have any physics a
- <protected> postUpdate()
+ <protected> processTileSeparation(body1) → {boolean}
@@ -5529,352 +5898,7 @@ Unlike collide the objects are NOT automatically separated or have any physics a
-
Called automatically by the core game loop.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Source:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <protected> postUpdate()
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Source:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <protected> preUpdate()
-
-
-
-
-
-
-
-
Called automatically by the core game loop.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Source:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <protected> preUpdate()
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Source:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- reset()
-
-
-
-
-
-
-
-
Resets all Body values (velocity, acceleration, rotation, etc)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Source:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- separate(body1, body2) → {boolean}
-
-
-
-
-
-
-
-
The core separation function to separate two physics bodies.
+
Internal function to process the separation of a physics body from a tile.
@@ -5928,6 +5952,163 @@ Unlike collide the objects are NOT automatically separated or have any physics a
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+
+
+
Returns true if separated, false if not.
+
+
+
+
+
+
+ Type
+
+
+
+boolean
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ separate(body1, body2, processCallback , callbackContext ) → {boolean}
+
+
+
+
+
+
+
+
The core separation function to separate two physics bodies.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+ Argument
+
+
+
+ Default
+
+
+ Description
+
+
+
+
+
+
+
+
+ body1
+
+
+
+
+
+Phaser.Physics.Arcade.Body
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The Body object to separate.
+
+
+
@@ -5944,13 +6125,101 @@ Unlike collide the objects are NOT automatically separated or have any physics a
+
+
+
+
+
+
+
+
+
+
+
+
The Body object to separate.
+
+
+
+ processCallback
+
+
+
+
+
+function
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ null
+
+
+
+
+ A callback function that lets you perform additional checks against the two objects if they overlap. If this function is set then the sprites will only be collided if it returns true.
+
+
+
+
+
+
+ callbackContext
+
+
+
+
+
+object
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The context in which to run the process callback.
+
+
+
@@ -5979,7 +6248,7 @@ Unlike collide the objects are NOT automatically separated or have any physics a
Source:
@@ -6004,7 +6273,7 @@ Unlike collide the objects are NOT automatically separated or have any physics a
-
Returns true if the bodies were separated, otherwise false.
+
Returns true if the bodies collided, otherwise false.
@@ -6030,7 +6299,7 @@ Unlike collide the objects are NOT automatically separated or have any physics a
- separateTile(body1, tile) → {boolean}
+ separateTile(body, tile) → {boolean}
@@ -6072,7 +6341,7 @@ Unlike collide the objects are NOT automatically separated or have any physics a
- body1
+ body
@@ -6143,7 +6412,7 @@ Unlike collide the objects are NOT automatically separated or have any physics a
Source:
@@ -6168,7 +6437,7 @@ Unlike collide the objects are NOT automatically separated or have any physics a
-
Returns true if the bodies were separated, otherwise false.
+
Returns true if the body was separated, otherwise false.
@@ -6194,7 +6463,7 @@ Unlike collide the objects are NOT automatically separated or have any physics a
- separateTileX(body1, tile) → {boolean}
+ separateTiles(body, tiles) → {boolean}
@@ -6202,7 +6471,7 @@ Unlike collide the objects are NOT automatically separated or have any physics a
-
The core separation function to separate a physics body and a tile on the x axis.
+
The core separation function to separate a physics body and an array of tiles.
@@ -6236,7 +6505,7 @@ Unlike collide the objects are NOT automatically separated or have any physics a
- body1
+ body
@@ -6259,13 +6528,13 @@ Unlike collide the objects are NOT automatically separated or have any physics a
- tile
+ tiles
-Phaser.Tile
+array.<Phaser.Tile >
@@ -6275,7 +6544,7 @@ Unlike collide the objects are NOT automatically separated or have any physics a
- The tile to collide against.
+ The array of tiles to collide against.
@@ -6307,7 +6576,7 @@ Unlike collide the objects are NOT automatically separated or have any physics a
Source:
@@ -6332,7 +6601,7 @@ Unlike collide the objects are NOT automatically separated or have any physics a
-
Returns true if the bodies were separated, otherwise false.
+
Returns true if the body was separated, otherwise false.
@@ -6358,7 +6627,7 @@ Unlike collide the objects are NOT automatically separated or have any physics a
- separateTileY(body1, tile) → {boolean}
+ setBounds(x, y, width, height, left , right , top , bottom )
@@ -6366,7 +6635,8 @@ Unlike collide the objects are NOT automatically separated or have any physics a
-
The core separation function to separate a physics body and a tile on the x axis.
+
Sets the bounds of the Physics world to match the given world pixel dimensions.
+You can optionally set which 'walls' to create: left, right, top or bottom.
@@ -6388,8 +6658,12 @@ Unlike collide the objects are NOT automatically separated or have any physics a
Type
+ Argument
+
+ Default
+
Description
@@ -6400,497 +6674,73 @@ Unlike collide the objects are NOT automatically separated or have any physics a
- body1
+ x
-Phaser.Physics.Arcade.Body
+number
+
+
+
+
+
+
- The Body object to separate.
+
+
+
+
+
+
+ The x coordinate of the top-left corner of the bounds.
- tile
+ y
-Phaser.Tile
+number
-
-
-
- The tile to collide against.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Source:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Returns:
-
-
-
-
Returns true if the bodies were separated, otherwise false.
-
-
-
-
-
-
- Type
-
-
-
-boolean
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- separateX(body1, body2) → {boolean}
-
-
-
-
-
-
-
-
The core separation function to separate two physics bodies on the x axis.
-
-
-
-
-
-
-
-
- Parameters:
-
-
-
-
-
-
- Name
-
-
- Type
-
-
-
-
-
- Description
-
-
-
-
-
-
-
-
- body1
-
-
-
-
+
-Phaser.Physics.Arcade.Body
-
-
-
-
-
-
-
-
- The Body object to separate.
-
-
-
-
-
-
- body2
-
-
-
-
-Phaser.Physics.Arcade.Body
-
-
-
-
-
-
-
-
- The Body object to separate.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Source:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Returns:
-
-
-
-
Returns true if the bodies were separated, otherwise false.
-
-
-
-
-
-
- Type
-
-
-
-boolean
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- separateY(body1, body2) → {boolean}
-
-
-
-
-
-
-
-
The core separation function to separate two physics bodies on the y axis.
-
-
-
-
-
-
-
-
- Parameters:
-
-
-
-
-
-
- Name
-
-
- Type
-
-
-
-
-
- Description
-
-
-
-
-
-
-
-
- body1
-
-
-
-
-Phaser.Physics.Arcade.Body
-
-
-
-
-
+
-
- The Body object to separate.
-
-
-
-
-
-
- body2
-
-
-
-
+
-Phaser.Physics.Arcade.Body
-
-
-
-
-
+
-
-
- The Body object to separate.
+ The y coordinate of the top-left corner of the bounds.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Source:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Returns:
-
-
-
-
Returns true if the bodies were separated, otherwise false.
-
-
-
-
-
-
- Type
-
-
-
-boolean
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- setSize(width, height, offsetX, offsetY)
-
-
-
-
-
-
-
-
You can modify the size of the physics Body to be any dimension you need.
-So it could be smaller or larger than the parent Sprite. You can also control the x and y offset, which
-is the position of the Body relative to the top-left of the Sprite.
-
-
-
-
-
-
-
-
- Parameters:
-
-
-
-
-
-
- Name
-
-
- Type
-
-
-
-
-
- Description
-
-
-
-
-
@@ -6907,10 +6757,22 @@ is the position of the Body relative to the top-left of the Sprite.
+
+
+
+
+
+
- The width of the Body.
+
+
+
+
+
+
+ The width of the bounds.
@@ -6930,56 +6792,178 @@ is the position of the Body relative to the top-left of the Sprite.
+
+
+
+
+
+
- The height of the Body.
+
+
+
+
+
+
+ The height of the bounds.
- offsetX
+ left
-number
+boolean
+
+
+ <optional>
+
+
+
+
+
- The X offset of the Body from the Sprite position.
+
+
+
+ true
+
+
+
+
+ If true will create the left bounds wall.
- offsetY
+ right
-number
+boolean
+
+
+ <optional>
+
+
+
+
+
- The Y offset of the Body from the Sprite position.
+
+
+
+ true
+
+
+
+
+ If true will create the right bounds wall.
+
+
+
+
+
+
+ top
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ If true will create the top bounds wall.
+
+
+
+
+
+
+ bottom
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ If true will create the bottom bounds wall.
@@ -7011,7 +6995,7 @@ is the position of the Body relative to the top-left of the Sprite.
Source:
@@ -7039,7 +7023,7 @@ is the position of the Body relative to the top-left of the Sprite.
- <protected> updateBounds()
+ setBoundsToWorld(left , right , top , bottom )
@@ -7047,7 +7031,8 @@ is the position of the Body relative to the top-left of the Sprite.
-
Internal method.
+
Sets the bounds of the Physics world to match the Game.World.
+You can optionally set which 'walls' to create: left, right, top or bottom.
@@ -7056,6 +7041,192 @@ is the position of the Body relative to the top-left of the Sprite.
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+ Argument
+
+
+
+ Default
+
+
+ Description
+
+
+
+
+
+
+
+
+ left
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ If true will create the left bounds wall.
+
+
+
+
+
+
+ right
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ If true will create the right bounds wall.
+
+
+
+
+
+
+ top
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ If true will create the top bounds wall.
+
+
+
+
+
+
+ bottom
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ If true will create the bottom bounds wall.
+
+
+
+
+
+
+
@@ -7080,7 +7251,7 @@ is the position of the Body relative to the top-left of the Sprite.
Source:
@@ -7108,7 +7279,7 @@ is the position of the Body relative to the top-left of the Sprite.
- <protected> updateHulls()
+ tileIntersects(body, tile) → {boolean}
@@ -7116,7 +7287,8 @@ is the position of the Body relative to the top-left of the Sprite.
-
Internal method.
+
Performs a rect intersection test against the two objects.
+Objects must expose properties: width, height, left, right, top, bottom.
@@ -7125,6 +7297,78 @@ is the position of the Body relative to the top-left of the Sprite.
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ body
+
+
+
+
+
+object
+
+
+
+
+
+
+
+
+
+ The Body to test.
+
+
+
+
+
+
+ tile
+
+
+
+
+
+object
+
+
+
+
+
+
+
+
+
+ The Tile to test.
+
+
+
+
+
+
+
@@ -7149,7 +7393,7 @@ is the position of the Body relative to the top-left of the Sprite.
Source:
@@ -7170,6 +7414,29 @@ is the position of the Body relative to the top-left of the Sprite.
+ Returns:
+
+
+
+
Returns true if the objects intersect, otherwise false.
+
+
+
+
+
+
+ Type
+
+
+
+boolean
+
+
+
+
+
+
+
@@ -7267,7 +7534,7 @@ is the position of the Body relative to the top-left of the Sprite.
Source:
@@ -7481,7 +7748,7 @@ One way to use this is: velocityFromAngle(angle, 200, sprite.velocity) which wil
Source:
@@ -7720,7 +7987,7 @@ One way to use this is: velocityFromRotation(rotation, 200, sprite.velocity) whi
Source:
@@ -7790,13 +8057,13 @@ One way to use this is: velocityFromRotation(rotation, 200, sprite.velocity) whi
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:32 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:32 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Phaser.Physics.html b/docs/Phaser.Physics.html
index d52ac8e5..9379c4c4 100644
--- a/docs/Phaser.Physics.html
+++ b/docs/Phaser.Physics.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -539,13 +533,13 @@
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:31 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:32 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Phaser.Plugin.html b/docs/Phaser.Plugin.html
index eda6097c..4816bc54 100644
--- a/docs/Phaser.Plugin.html
+++ b/docs/Phaser.Plugin.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -1906,13 +1900,13 @@ It is only called if active is set to true.
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:32 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:32 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Phaser.PluginManager.html b/docs/Phaser.PluginManager.html
index 70d82f0c..8e608895 100644
--- a/docs/Phaser.PluginManager.html
+++ b/docs/Phaser.PluginManager.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -1571,13 +1565,13 @@ It only calls plugins who have active=true.
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:32 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:32 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Phaser.Point.html b/docs/Phaser.Point.html
index eac2ec37..3290f887 100644
--- a/docs/Phaser.Point.html
+++ b/docs/Phaser.Point.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -969,7 +963,7 @@
Source:
@@ -1184,7 +1178,7 @@
Source:
@@ -1399,7 +1393,7 @@
Source:
@@ -1563,7 +1557,7 @@
Source:
@@ -1778,7 +1772,7 @@
Source:
@@ -2034,7 +2028,7 @@
Source:
@@ -2249,7 +2243,7 @@
Source:
@@ -5267,13 +5261,13 @@
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:32 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:32 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Phaser.Pointer.html b/docs/Phaser.Pointer.html
index b83546a3..260e519c 100644
--- a/docs/Phaser.Pointer.html
+++ b/docs/Phaser.Pointer.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -1099,7 +1093,7 @@ The Circle size is 44px (Apples recommended "finger tip" size).
Source:
@@ -3065,7 +3059,7 @@ The Circle size is 44px (Apples recommended "finger tip" size).
Source:
@@ -3171,7 +3165,7 @@ The Circle size is 44px (Apples recommended "finger tip" size).
Source:
@@ -3503,7 +3497,7 @@ If you wish to check if the Pointer was pressed down just once then see the Spri
Source:
@@ -3658,7 +3652,7 @@ If you wish to check if the Pointer was released just once then see the Sprite.e
Source:
@@ -3805,7 +3799,7 @@ If you wish to check if the Pointer was released just once then see the Sprite.e
Source:
@@ -3998,7 +3992,7 @@ If you wish to check if the Pointer was released just once then see the Sprite.e
Source:
@@ -4240,7 +4234,7 @@ If you wish to check if the Pointer was released just once then see the Sprite.e
Source:
@@ -4276,7 +4270,7 @@ If you wish to check if the Pointer was released just once then see the Sprite.e
-
Called internall by the Input Manager.
+
Called by the Input Manager.
@@ -4354,13 +4348,13 @@ If you wish to check if the Pointer was released just once then see the Sprite.e
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:32 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:32 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Phaser.Polygon.html b/docs/Phaser.Polygon.html
index e2f43bb0..026558c8 100644
--- a/docs/Phaser.Polygon.html
+++ b/docs/Phaser.Polygon.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -489,10 +483,10 @@ arguments passed can be flat x,y values e.g. new PIXI.Polygon(x,y, x,y, x,
-Array.<Phaser.Point >
+Array .<Phaser.Point >
|
-Array.<number>
+Array .<number>
@@ -699,13 +693,13 @@ arguments passed can be flat x,y values e.g. new PIXI.Polygon(x,y, x,y, x,
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:32 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:33 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Phaser.QuadTree.html b/docs/Phaser.QuadTree.html
index b53274fc..83f23cd6 100644
--- a/docs/Phaser.QuadTree.html
+++ b/docs/Phaser.QuadTree.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -427,8 +421,9 @@
QuadTree
- A QuadTree implementation. The original code was a conversion of the Java code posted to GameDevTuts. However I've tweaked
-it massively to add node indexing, removed lots of temp. var creation and significantly increased performance as a result. Original version at https://github.com/timohausmann/quadtree-js/
+ A QuadTree implementation. The original code was a conversion of the Java code posted to GameDevTuts.
+However I've tweaked it massively to add node indexing, removed lots of temp. var creation and significantly increased performance as a result.
+Original version at https://github.com/timohausmann/quadtree-js/
@@ -439,7 +434,7 @@ it massively to add node indexing, removed lots of temp. var creation and signif
- new QuadTree(physicsManager, x, y, width, height, maxObjects, maxLevels, level)
+ new QuadTree(x, y, width, height, maxObjects , maxLevels , level )
@@ -469,8 +464,12 @@ it massively to add node indexing, removed lots of temp. var creation and signif
Type
+ Argument
+
+ Default
+
Description
@@ -479,29 +478,6 @@ it massively to add node indexing, removed lots of temp. var creation and signif
-
-
- physicsManager
-
-
-
-
-
-Description
-
-
-
-
-
-
-
-
-
- Description.
-
-
-
-
x
@@ -510,17 +486,29 @@ it massively to add node indexing, removed lots of temp. var creation and signif
-Description
+number
+
+
+
+
+
+
- Description.
+
+
+
+
+
+
+ The top left coordinate of the quadtree.
@@ -533,17 +521,29 @@ it massively to add node indexing, removed lots of temp. var creation and signif
-Description
+number
+
+
+
+
+
+
- Description.
+
+
+
+
+
+
+ The top left coordinate of the quadtree.
@@ -563,10 +563,22 @@ it massively to add node indexing, removed lots of temp. var creation and signif
+
+
+
+
+
+
- The width of your game in game pixels.
+
+
+
+
+
+
+ The width of the quadtree in pixels.
@@ -586,10 +598,22 @@ it massively to add node indexing, removed lots of temp. var creation and signif
+
+
+
+
+
+
- The height of your game in game pixels.
+
+
+
+
+
+
+ The height of the quadtree in pixels.
@@ -609,10 +633,26 @@ it massively to add node indexing, removed lots of temp. var creation and signif
+
+
+ <optional>
+
+
+
+
+
- Description.
+
+
+
+ 10
+
+
+
+
+ The maximum number of objects per node.
@@ -632,10 +672,26 @@ it massively to add node indexing, removed lots of temp. var creation and signif
+
+
+ <optional>
+
+
+
+
+
- Description.
+
+
+
+ 4
+
+
+
+
+ The maximum number of levels to iterate to.
@@ -655,10 +711,26 @@ it massively to add node indexing, removed lots of temp. var creation and signif
+
+
+ <optional>
+
+
+
+
+
- Description.
+
+
+
+ 0
+
+
+
+
+ Which level is this?
@@ -778,7 +850,7 @@ Clear the quadtree.
Source:
@@ -855,6 +927,9 @@ Determine which node the object belongs to.
+Phaser.Rectangle
+|
+
object
@@ -865,7 +940,7 @@ Determine which node the object belongs to.
- Description.
+ The bounds in which to check.
@@ -897,7 +972,7 @@ Determine which node the object belongs to.
Source:
@@ -957,9 +1032,7 @@ Determine which node the object belongs to.
/*
-Insert the object into the node. If the node
-exceeds the capacity, it will split and add all
-objects to their corresponding subnodes.
+Insert the object into the node. If the node exceeds the capacity, it will split and add all objects to their corresponding subnodes.
@@ -999,6 +1072,9 @@ objects to their corresponding subnodes.
+Phaser.Physics.Arcade.Body
+|
+
object
@@ -1009,7 +1085,7 @@ objects to their corresponding subnodes.
- Description.
+ The Body object to insert into the quadtree.
@@ -1041,7 +1117,7 @@ objects to their corresponding subnodes.
Source:
@@ -1069,7 +1145,7 @@ objects to their corresponding subnodes.
- retrieve(rect) → {array}
+ populate(group)
@@ -1078,7 +1154,7 @@ objects to their corresponding subnodes.
/*
-Return all objects that could collide with the given object.
+Populates this quadtree with the members of the given Group.
@@ -1112,13 +1188,13 @@ Return all objects that could collide with the given object.
- rect
+ group
-object
+Phaser.Group
@@ -1128,7 +1204,7 @@ Return all objects that could collide with the given object.
- Description.
+ The Group to add to the quadtree.
@@ -1160,7 +1236,245 @@ Return all objects that could collide with the given object.
Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ populateHandler(sprite)
+
+
+
+
+
+
+
+
/*
+Handler for the populate method.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ sprite
+
+
+
+
+
+Phaser.Sprite
+
+
+
+
+
+
+
+
+
+ The Sprite to check.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ retrieve(sprite) → {array}
+
+
+
+
+
+
+
+
/*
+Return all objects that could collide with the given Sprite.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ sprite
+
+
+
+
+
+Phaser.Sprite
+
+
+
+
+
+
+
+
+
+ The sprite to check against.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
@@ -1255,7 +1569,7 @@ Split the node into 4 subnodes
Source:
@@ -1300,13 +1614,13 @@ Split the node into 4 subnodes
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:32 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:33 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Phaser.RandomDataGenerator.html b/docs/Phaser.RandomDataGenerator.html
index 3671e6c9..6e2c5b66 100644
--- a/docs/Phaser.RandomDataGenerator.html
+++ b/docs/Phaser.RandomDataGenerator.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -1156,7 +1150,7 @@ Random number generator from
-Array
+Array
@@ -1927,7 +1921,7 @@ Random number generator from
-Array
+Array
@@ -2037,13 +2031,13 @@ Random number generator from
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:33 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:33 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Phaser.Rectangle.html b/docs/Phaser.Rectangle.html
index 7dba884f..0472e0e8 100644
--- a/docs/Phaser.Rectangle.html
+++ b/docs/Phaser.Rectangle.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -752,7 +746,7 @@
Source:
@@ -858,7 +852,7 @@
Source:
@@ -964,7 +958,7 @@
Source:
@@ -1070,7 +1064,7 @@
Source:
@@ -1177,7 +1171,7 @@ If set to true then all of the Rectangle properties are set to 0.
Source:
@@ -1279,7 +1273,7 @@ If set to true then all of the Rectangle properties are set to 0.
Source:
@@ -1381,7 +1375,7 @@ If set to true then all of the Rectangle properties are set to 0.
Source:
@@ -1589,7 +1583,7 @@ If set to true then all of the Rectangle properties are set to 0.
Source:
@@ -1695,7 +1689,7 @@ If set to true then all of the Rectangle properties are set to 0.
Source:
@@ -1801,7 +1795,7 @@ If set to true then all of the Rectangle properties are set to 0.
Source:
@@ -1908,7 +1902,7 @@ However it does affect the height property, whereas changing the y value does no
Source:
@@ -2014,7 +2008,7 @@ However it does affect the height property, whereas changing the y value does no
Source:
@@ -2120,7 +2114,7 @@ However it does affect the height property, whereas changing the y value does no
Source:
@@ -2583,7 +2577,7 @@ However it does affect the height property, whereas changing the y value does no
Source:
@@ -2766,7 +2760,7 @@ However it does affect the height property, whereas changing the y value does no
Source:
@@ -2930,7 +2924,7 @@ However it does affect the height property, whereas changing the y value does no
Source:
@@ -3095,7 +3089,7 @@ A Rectangle object is said to contain another if the second Rectangle object fal
Source:
@@ -3260,7 +3254,7 @@ This method compares the x, y, width and height properties of each Rectangle.Source:
@@ -3447,7 +3441,7 @@ This method compares the x, y, width and height properties of each Rectangle.Source:
@@ -3611,7 +3605,7 @@ This method compares the x, y, width and height properties of each Rectangle.Source:
@@ -3826,7 +3820,7 @@ This method compares the x, y, width and height properties of each Rectangle.Source:
@@ -3991,7 +3985,7 @@ This method checks the x, y, width, and height properties of the Rectangles.
Source:
@@ -4224,7 +4218,7 @@ This method checks the x, y, width, and height properties of the Rectangles.
Source:
@@ -4408,7 +4402,7 @@ This method checks the x, y, width, and height properties of the Rectangles.
Source:
@@ -4623,7 +4617,7 @@ This method checks the x, y, width, and height properties of the Rectangles.
Source:
@@ -7378,13 +7372,13 @@ This method checks the x, y, width, and height properties of the Rectangles.
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:33 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:33 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Phaser.RenderTexture.html b/docs/Phaser.RenderTexture.html
index 223d59e0..d3854fb4 100644
--- a/docs/Phaser.RenderTexture.html
+++ b/docs/Phaser.RenderTexture.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -1356,6 +1350,612 @@
+ Methods
+
+
+
+
+ render(displayObject, position , clear , renderHidden )
+
+
+
+
+
+
+
+
This function will draw the display object to the texture. If the display object is a Group or has children it will
+draw all children as well.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+ Argument
+
+
+
+ Default
+
+
+ Description
+
+
+
+
+
+
+
+
+ displayObject
+
+
+
+
+
+DisplayObject
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The display object to render this texture on.
+
+
+
+
+
+
+ position
+
+
+
+
+
+Phaser.Point
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Where to draw the display object.
+
+
+
+
+
+
+ clear
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ false
+
+
+
+
+ If true the texture will be cleared before the displayObject is drawn.
+
+
+
+
+
+
+ renderHidden
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ false
+
+
+
+
+ If true displayObjects that have their visible property set to false will still be rendered.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ renderXY(displayObject, x, y, clear , renderHidden )
+
+
+
+
+
+
+
+
This function will draw the display object to the texture at the given x/y coordinates.
+If the display object is a Group or has children it will draw all children as well.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+ Argument
+
+
+
+ Default
+
+
+ Description
+
+
+
+
+
+
+
+
+ displayObject
+
+
+
+
+
+DisplayObject
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The display object to render this texture on.
+
+
+
+
+
+
+ x
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The x coordinate to draw the display object at.
+
+
+
+
+
+
+ y
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The y coordinate to draw the display object at.
+
+
+
+
+
+
+ clear
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ false
+
+
+
+
+ If true the texture will be cleared before the displayObject is drawn.
+
+
+
+
+
+
+ renderHidden
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ false
+
+
+
+
+ If true displayObjects that have their visible property set to false will still be rendered.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ resize()
+
+
+
+
+
+
+
+
Resizes the RenderTexture.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -1374,13 +1974,13 @@
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:33 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:33 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Phaser.RequestAnimationFrame.html b/docs/Phaser.RequestAnimationFrame.html
index d22978ad..724525ad 100644
--- a/docs/Phaser.RequestAnimationFrame.html
+++ b/docs/Phaser.RequestAnimationFrame.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -969,7 +963,7 @@
-
Starts the requestAnimatioFrame running or setTimeout if unavailable in browser
+
Starts the requestAnimationFrame running or setTimeout if unavailable in browser
@@ -1303,13 +1297,13 @@
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:33 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:33 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Phaser.Signal.html b/docs/Phaser.Signal.html
index 795afa0f..176d68b9 100644
--- a/docs/Phaser.Signal.html
+++ b/docs/Phaser.Signal.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -2288,13 +2282,13 @@ IMPORTANT: should be called only during signal dispatch, calling it before/after
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:33 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:33 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Phaser.SinglePad.html b/docs/Phaser.SinglePad.html
new file mode 100644
index 00000000..5452d373
--- /dev/null
+++ b/docs/Phaser.SinglePad.html
@@ -0,0 +1,3822 @@
+
+
+
+
+
+ Phaser Class: SinglePad
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Class: SinglePad
+
+
+
+
+ Phaser .
+
+ SinglePad
+
+
+
+
+
+
+
+
+
+
+
+
+
+ new SinglePad(game, padParent)
+
+
+
+
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ game
+
+
+
+
+
+Phaser.Game
+
+
+
+
+
+
+
+
+
+ Current game instance.
+
+
+
+
+
+
+ padParent
+
+
+
+
+
+Object
+
+
+
+
+
+
+
+
+
+ The parent Phaser.Gamepad object (all gamepads reside under this)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Members
+
+
+
+
+ _index
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ index
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ The gamepad index as per browsers data
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Default Value:
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _padParent
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ padParent
+
+
+
+
+
+Phaser.Gamepad
+
+
+
+
+
+
+
+
+
+ Main Phaser Gamepad object
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ callbackContext
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ callbackContext
+
+
+
+
+
+Object
+
+
+
+
+
+
+
+
+
+ The context under which the callbacks are run.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <readonly> connected
+
+
+
+
+
+
+
Whether or not this particular gamepad is connected or not.
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ connected
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+
+ Whether or not this particular gamepad is connected or not.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ deadZone
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ deadZone
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ Dead zone for axis feedback - within this value you won't trigger updates.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ game
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ game
+
+
+
+
+
+Phaser.Game
+
+
+
+
+
+
+
+
+
+ Local reference to game.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <readonly> index
+
+
+
+
+
+
+
Gamepad index as per browser data
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ index
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ The gamepad index, used to identify specific gamepads in the browser
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ onAxisCallback
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ onAxisCallback
+
+
+
+
+
+function
+
+
+
+
+
+
+
+
+
+ This callback is invoked every time an axis is changed.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ onConnectCallback
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ onConnectCallback
+
+
+
+
+
+function
+
+
+
+
+
+
+
+
+
+ This callback is invoked every time this gamepad is connected
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ onDisconnectCallback
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ onDisconnectCallback
+
+
+
+
+
+function
+
+
+
+
+
+
+
+
+
+ This callback is invoked every time this gamepad is disconnected
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ onDownCallback
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ onDownCallback
+
+
+
+
+
+function
+
+
+
+
+
+
+
+
+
+ This callback is invoked every time a button is pressed down.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ onFloatCallback
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ onFloatCallback
+
+
+
+
+
+function
+
+
+
+
+
+
+
+
+
+ This callback is invoked every time a button is changed to a value where value > 0 and value < 1.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ onUpCallback
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ onUpCallback
+
+
+
+
+
+function
+
+
+
+
+
+
+
+
+
+ This callback is invoked every time a gamepad button is released.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Methods
+
+
+
+
+
+
+
+
+
+
+
+
+
If you need more fine-grained control over a Key you can create a new Phaser.Key object via this method.
+The Key object can then be polled, have events attached to it, etc.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ buttonCode
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ The buttonCode of the button, i.e. Phaser.Gamepad.BUTTON_0 or Phaser.Gamepad.BUTTON_1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+
+
+
The GamepadButton object which you can store locally and reference directly.
+
+
+
+
+
+
+ Type
+
+
+
+Phaser.GamepadButton
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Returns the value of a gamepad button. Intended mainly for cases when you have floating button values, for example
+analog trigger buttons on the XBOX 360 controller
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ buttonCode
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ The buttonCode of the button to check.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+
+
+
Button value if available otherwise false.
+
+
+
+
+
+
+ Type
+
+
+
+boolean
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ connect(rawPad)
+
+
+
+
+
+
+
+
Gamepad connect function, should be called by Phaser.Gamepad
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ rawPad
+
+
+
+
+
+Object
+
+
+
+
+
+
+
+
+
+ The raw gamepad object
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ disconnect()
+
+
+
+
+
+
+
+
Gamepad disconnect function, should be called by Phaser.Gamepad
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ isDown(axisCode) → {number}
+
+
+
+
+
+
+
+
Returns value of requested axis
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ axisCode
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ The index of the axis to check
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+
+
+
Axis value if available otherwise false
+
+
+
+
+
+
+ Type
+
+
+
+number
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ isDown(buttonCode) → {boolean}
+
+
+
+
+
+
+
+
Returns true if the button is currently pressed down.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ buttonCode
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ The buttonCode of the key to check.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+
+
+
True if the key is currently down.
+
+
+
+
+
+
+ Type
+
+
+
+boolean
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ justPressed(buttonCode, duration ) → {boolean}
+
+
+
+
+
+
+
+
Returns the "just released" state of a button from this gamepad. Just released is considered as being true if the button was released within the duration given (default 250ms).
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+ Argument
+
+
+
+ Default
+
+
+ Description
+
+
+
+
+
+
+
+
+ buttonCode
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The buttonCode of the button to check for.
+
+
+
+
+
+
+ duration
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ 250
+
+
+
+
+ The duration below which the button is considered as being just released.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+
+
+
True if the button is just released otherwise false.
+
+
+
+
+
+
+ Type
+
+
+
+boolean
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ justPressed(buttonCode, duration ) → {boolean}
+
+
+
+
+
+
+
+
Returns the "just pressed" state of a button from this gamepad. Just pressed is considered true if the button was pressed down within the duration given (default 250ms).
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+ Argument
+
+
+
+ Default
+
+
+ Description
+
+
+
+
+
+
+
+
+ buttonCode
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The buttonCode of the button to check for.
+
+
+
+
+
+
+ duration
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ 250
+
+
+
+
+ The duration below which the button is considered as being just pressed.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+
+
+
True if the button is just pressed otherwise false.
+
+
+
+
+
+
+ Type
+
+
+
+boolean
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ pollStatus()
+
+
+
+
+
+
+
+
Main update function, should be called by Phaser.Gamepad
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ processAxisChange(axisState)
+
+
+
+
+
+
+
+
Handles changes in axis
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ axisState
+
+
+
+
+
+Object
+
+
+
+
+
+
+
+
+
+ State of the relevant axis
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Handles button down press
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ buttonCode
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ Which buttonCode of this button
+
+
+
+
+
+
+ value
+
+
+
+
+
+Object
+
+
+
+
+
+
+
+
+
+ Button value
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Handles buttons with floating values (like analog buttons that acts almost like an axis but still registers like a button)
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ buttonCode
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ Which buttonCode of this button
+
+
+
+
+
+
+ value
+
+
+
+
+
+Object
+
+
+
+
+
+
+
+
+
+ Button value (will range somewhere between 0 and 1, but not specifically 0 or 1.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Handles button release
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ buttonCode
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ Which buttonCode of this button
+
+
+
+
+
+
+ value
+
+
+
+
+
+Object
+
+
+
+
+
+
+
+
+
+ Button value
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ reset()
+
+
+
+
+
+
+
+
Reset all buttons/axes of this gamepad
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
+
+
+
+
+ Documentation generated by JSDoc 3.3.0-dev
+ on Wed Feb 05 2014 06:28:33 GMT-0000 (GMT) using the DocStrap template .
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/Phaser.Sound.html b/docs/Phaser.Sound.html
index df0232b4..c8bf2e3f 100644
--- a/docs/Phaser.Sound.html
+++ b/docs/Phaser.Sound.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -1503,7 +1497,7 @@
Source:
@@ -1605,7 +1599,7 @@
Source:
@@ -2118,7 +2112,7 @@
Source:
@@ -4167,7 +4161,7 @@
Source:
@@ -5685,7 +5679,7 @@ This allows you to bundle multiple sounds together into a single audio file and
Source:
@@ -5799,13 +5793,13 @@ This allows you to bundle multiple sounds together into a single audio file and
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:33 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:34 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Phaser.SoundManager.html b/docs/Phaser.SoundManager.html
index 98fb3406..4c50e2f2 100644
--- a/docs/Phaser.SoundManager.html
+++ b/docs/Phaser.SoundManager.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -1075,7 +1069,7 @@ Note: On Firefox 25+ on Linux if you have media.gstreamer disabled in about:conf
Source:
@@ -1693,7 +1687,7 @@ Note: On Firefox 25+ on Linux if you have media.gstreamer disabled in about:conf
Source:
@@ -2857,13 +2851,13 @@ Note: On Firefox 25+ on Linux if you have media.gstreamer disabled in about:conf
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:33 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:34 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Phaser.Sprite.html b/docs/Phaser.Sprite.html
index 0f01f12b..8338ac67 100644
--- a/docs/Phaser.Sprite.html
+++ b/docs/Phaser.Sprite.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -979,7 +973,7 @@ If you wish to work in radians instead of degrees use the property Sprite.rotati
Source:
@@ -1293,7 +1287,7 @@ A culled sprite has its renderable property set to 'false'.
Source:
@@ -1395,7 +1389,7 @@ A culled sprite has its renderable property set to 'false'.
Source:
@@ -1497,7 +1491,7 @@ A culled sprite has its renderable property set to 'false'.
Source:
@@ -1605,7 +1599,7 @@ It's used for Camera culling and physics body alignment.
Source:
@@ -1707,7 +1701,7 @@ It's used for Camera culling and physics body alignment.
Source:
@@ -1809,7 +1803,7 @@ It's used for Camera culling and physics body alignment.
Source:
@@ -1916,7 +1910,7 @@ The crop is only applied if you have set Sprite.cropEnabled to true.
Source:
@@ -2021,7 +2015,7 @@ The crop is only applied if you have set Sprite.cropEnabled to true.
Source:
@@ -2132,6 +2126,323 @@ The crop is only applied if you have set Sprite.cropEnabled to true.
+
+
+
+
+
+
+
+
+
+ debug
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ debug
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+
+ Handy flag to use with Game.enableStep
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Default Value:
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <readonly> deltaX
+
+
+
+
+
+
+
Returns the delta x value. The difference between Sprite.x now and in the previous step.
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ deltaX
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ The delta value. Positive if the motion was to the right, negative if to the left.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <readonly> deltaY
+
+
+
+
+
+
+
Returns the delta x value. The difference between Sprite.y now and in the previous step.
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ deltaY
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ The delta value. Positive if the motion was downwards, negative if upwards.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
@@ -2439,7 +2750,7 @@ The crop is only applied if you have set Sprite.cropEnabled to true.
Source:
@@ -2541,7 +2852,7 @@ The crop is only applied if you have set Sprite.cropEnabled to true.
Source:
@@ -2643,7 +2954,7 @@ The crop is only applied if you have set Sprite.cropEnabled to true.
Source:
@@ -2949,7 +3260,7 @@ The crop is only applied if you have set Sprite.cropEnabled to true.
Source:
@@ -3056,7 +3367,7 @@ If you wish to crop the Sprite instead see the Sprite.crop value.
Source:
@@ -3158,7 +3469,7 @@ If you wish to crop the Sprite instead see the Sprite.crop value.
Source:
@@ -3367,7 +3678,7 @@ activated for this Sprite instance and it will then start to process click/touch
Source:
@@ -3469,7 +3780,7 @@ activated for this Sprite instance and it will then start to process click/touch
Source:
@@ -3574,7 +3885,7 @@ activated for this Sprite instance and it will then start to process click/touch
Source:
@@ -3999,7 +4310,7 @@ The lifespan is decremented by game.time.elapsed each update, once it reaches ze
Source:
@@ -4104,7 +4415,7 @@ The lifespan is decremented by game.time.elapsed each update, once it reaches ze
Source:
@@ -4516,7 +4827,7 @@ The lifespan is decremented by game.time.elapsed each update, once it reaches ze
Source:
@@ -4618,7 +4929,7 @@ The lifespan is decremented by game.time.elapsed each update, once it reaches ze
Source:
@@ -4827,7 +5138,7 @@ If you wish to crop the Sprite instead see the Sprite.crop value.
Source:
@@ -4938,6 +5249,210 @@ If you wish to crop the Sprite instead see the Sprite.crop value.
+
+
+
+
+
+
+
+
+
+ <readonly> worldCenterX
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ worldCenterX
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ The center of the Sprite in world coordinates.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <readonly> worldCenterY
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ worldCenterY
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ The center of the Sprite in world coordinates.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
@@ -5199,7 +5714,7 @@ bought to the top of that Group, not the entire display list.
Source:
@@ -5352,7 +5867,7 @@ Doesn't change the anchor point of the sprite.
Source:
@@ -5482,7 +5997,7 @@ If health is then taken below zero Sprite.kill is called.
Source:
@@ -5632,7 +6147,7 @@ and nulls its reference to game, freeing it up for garbage collection.
Source:
@@ -5660,7 +6175,7 @@ and nulls its reference to game, freeing it up for garbage collection.
- getLocalPosition(p, x, y, sx, sy) → {Phaser.Point }
+ getLocalPosition(p, x, y) → {Phaser.Point }
@@ -5765,53 +6280,7 @@ Mostly only used internally.
- x coordinate within the Sprite to translate.
-
-
-
-
-
-
- sx
-
-
-
-
-
-number
-
-
-
-
-
-
-
-
-
- Scale factor to be applied.
-
-
-
-
-
-
- sy
-
-
-
-
-
-number
-
-
-
-
-
-
-
-
-
- Scale factor to be applied.
+ y coordinate within the Sprite to translate.
@@ -5843,7 +6312,7 @@ Mostly only used internally.
Source:
@@ -5894,7 +6363,7 @@ Mostly only used internally.
- getLocalUnmodifiedPosition(p, x, y) → {Phaser.Point }
+ getLocalUnmodifiedPosition(p, gx, gy) → {Phaser.Point }
@@ -5960,7 +6429,7 @@ Mostly only used internally by the Input Manager, but also useful for custom hit
- x
+ gx
@@ -5983,7 +6452,7 @@ Mostly only used internally by the Input Manager, but also useful for custom hit
- y
+ gy
@@ -5999,7 +6468,7 @@ Mostly only used internally by the Input Manager, but also useful for custom hit
- x coordinate within the Sprite to translate.
+ y coordinate within the Sprite to translate.
@@ -6031,7 +6500,7 @@ Mostly only used internally by the Input Manager, but also useful for custom hit
Source:
@@ -6126,7 +6595,7 @@ If you don't need this Sprite any more you should call Sprite.destroy instead.
Source:
@@ -6291,7 +6760,7 @@ This causes a WebGL texture update, so use sparingly or in low-intensity portion
Source:
@@ -6543,7 +7012,7 @@ If the requested animation is already playing this request will be ignored. If y
Source:
@@ -6635,7 +7104,7 @@ If the requested animation is already playing this request will be ignored. If y
Source:
@@ -6704,7 +7173,7 @@ If the requested animation is already playing this request will be ignored. If y
Source:
@@ -6914,7 +7383,7 @@ If the Sprite has a physics body that too is reset.
Source:
@@ -6994,7 +7463,7 @@ If the Sprite has a physics body that too is reset.
Source:
@@ -7134,7 +7603,7 @@ It will dispatch the onRevived event, you can listen to Sprite.events.onRevived
Source:
@@ -7214,7 +7683,7 @@ It will dispatch the onRevived event, you can listen to Sprite.events.onRevived
Source:
@@ -7283,7 +7752,7 @@ It will dispatch the onRevived event, you can listen to Sprite.events.onRevived
Source:
@@ -7352,7 +7821,7 @@ It will dispatch the onRevived event, you can listen to Sprite.events.onRevived
Source:
@@ -7421,7 +7890,7 @@ It will dispatch the onRevived event, you can listen to Sprite.events.onRevived
Source:
@@ -7466,13 +7935,13 @@ It will dispatch the onRevived event, you can listen to Sprite.events.onRevived
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:33 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:34 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Phaser.Stage.html b/docs/Phaser.Stage.html
index 02c2381b..bace5b63 100644
--- a/docs/Phaser.Stage.html
+++ b/docs/Phaser.Stage.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -703,7 +697,7 @@ focus handling, game resizing, scaling and the pause, boot and orientation scree
Source:
@@ -808,7 +802,7 @@ focus handling, game resizing, scaling and the pause, boot and orientation scree
Source:
@@ -881,7 +875,7 @@ focus handling, game resizing, scaling and the pause, boot and orientation scree
- Reference to the newly created <canvas> element.
+ Reference to the newly created canvas element.
@@ -910,7 +904,7 @@ focus handling, game resizing, scaling and the pause, boot and orientation scree
Source:
@@ -1018,7 +1012,214 @@ focus handling, game resizing, scaling and the pause, boot and orientation scree
Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ disableVisibilityChange
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ disableVisibilityChange
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+
+ By default if the browser tab loses focus the game will pause. You can stop that behaviour by setting this property to true.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Default Value:
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ display
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ display
+
+
+
+
+
+PIXI.Stage
+
+
+
+
+
+
+
+
+
+ The Pixi Stage which is hooked to the renderer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
@@ -1222,7 +1423,7 @@ focus handling, game resizing, scaling and the pause, boot and orientation scree
Source:
@@ -1324,7 +1525,7 @@ focus handling, game resizing, scaling and the pause, boot and orientation scree
Source:
@@ -1426,7 +1627,7 @@ focus handling, game resizing, scaling and the pause, boot and orientation scree
Source:
@@ -1449,6 +1650,75 @@ focus handling, game resizing, scaling and the pause, boot and orientation scree
+
+ <protected> parseConfig()
+
+
+
+
+
+
+
+
Parses a Game configuration object.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
update()
@@ -1491,7 +1761,7 @@ focus handling, game resizing, scaling and the pause, boot and orientation scree
Source:
@@ -1609,7 +1879,7 @@ focus handling, game resizing, scaling and the pause, boot and orientation scree
Source:
@@ -1654,13 +1924,13 @@ focus handling, game resizing, scaling and the pause, boot and orientation scree
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:34 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:34 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Phaser.StageScaleMode.html b/docs/Phaser.StageScaleMode.html
index 33c6baa3..72ea2c10 100644
--- a/docs/Phaser.StageScaleMode.html
+++ b/docs/Phaser.StageScaleMode.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -2016,7 +2010,7 @@
Source:
@@ -2118,7 +2112,7 @@
Source:
@@ -2220,7 +2214,7 @@
Source:
@@ -3690,7 +3684,7 @@ It doesn't care about any other DOM element that may be on the page, it literall
Source:
@@ -3759,7 +3753,7 @@ It doesn't care about any other DOM element that may be on the page, it literall
Source:
@@ -3877,7 +3871,7 @@ It doesn't care about any other DOM element that may be on the page, it literall
Source:
@@ -4090,7 +4084,7 @@ The optional orientationImage is displayed when the game is in the incorrect ori
Source:
@@ -4208,7 +4202,7 @@ The optional orientationImage is displayed when the game is in the incorrect ori
Source:
@@ -4277,7 +4271,7 @@ The optional orientationImage is displayed when the game is in the incorrect ori
Source:
@@ -4346,7 +4340,7 @@ The optional orientationImage is displayed when the game is in the incorrect ori
Source:
@@ -4415,7 +4409,7 @@ The optional orientationImage is displayed when the game is in the incorrect ori
Source:
@@ -4533,7 +4527,7 @@ The optional orientationImage is displayed when the game is in the incorrect ori
Source:
@@ -4602,7 +4596,7 @@ The optional orientationImage is displayed when the game is in the incorrect ori
Source:
@@ -4671,7 +4665,7 @@ The optional orientationImage is displayed when the game is in the incorrect ori
Source:
@@ -4859,7 +4853,7 @@ Please note that this needs to be supported by the web browser and isn't the sam
Source:
@@ -4904,13 +4898,13 @@ Please note that this needs to be supported by the web browser and isn't the sam
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:34 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:34 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Phaser.State.html b/docs/Phaser.State.html
index 4abb2f28..d0a995ce 100644
--- a/docs/Phaser.State.html
+++ b/docs/Phaser.State.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -2568,13 +2562,13 @@ If you need to use the loader, you may need to use them here.
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:34 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:34 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Phaser.StateManager.html b/docs/Phaser.StateManager.html
index 5443e918..bd5daaaf 100644
--- a/docs/Phaser.StateManager.html
+++ b/docs/Phaser.StateManager.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -2134,7 +2128,8 @@
-
Description.
+
Checks i a given phaser state is valid.
+State must exist and have at least one callback function registered..
@@ -2308,7 +2303,7 @@
Source:
@@ -2331,6 +2326,86 @@
+
+
+
+
+
+ getCurrentState()
+
+
+
+
+
+
+
+
Gets the current State.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+
+
+
+
+
+
+
+
+
@@ -2426,7 +2501,7 @@
Source:
@@ -2491,7 +2566,7 @@
Source:
@@ -2556,7 +2631,7 @@
Source:
@@ -2621,7 +2696,7 @@
Source:
@@ -2804,7 +2879,7 @@
Source:
@@ -2869,125 +2944,7 @@
Source:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <protected> setCurrentState(key)
-
-
-
-
-
-
-
-
Sets the current State. Should not be called directly (use StateManager.start)
-
-
-
-
-
-
-
-
- Parameters:
-
-
-
-
-
-
- Name
-
-
- Type
-
-
-
-
-
- Description
-
-
-
-
-
-
-
-
- key
-
-
-
-
-
-string
-
-
-
-
-
-
-
-
-
- State key.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Source:
-
@@ -3246,7 +3203,7 @@
Source:
@@ -3291,13 +3248,13 @@
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:34 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:34 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Phaser.Text.html b/docs/Phaser.Text.html
index 7fe0b27d..ea84a034 100644
--- a/docs/Phaser.Text.html
+++ b/docs/Phaser.Text.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -446,7 +440,7 @@
-
Create a new <code>Text</code>.
+
Create a new Text object.
@@ -968,7 +962,109 @@ If you wish to work in radians instead of degrees use the property Sprite.rotati
Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ cameraOffset
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ cameraOffset
+
+
+
+
+
+Phaser.Point
+
+
+
+
+
+
+
+
+
+ If this object is fixed to the camera then use this Point to specify how far away from the Camera x/y it's rendered.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
@@ -1074,7 +1170,7 @@ If you wish to work in radians instead of degrees use the property Sprite.rotati
Source:
@@ -1188,6 +1284,115 @@ If you wish to work in radians instead of degrees use the property Sprite.rotati
+
+
+
+
+
+
+
+
+
+ fixedToCamera
+
+
+
+
+
+
+
An object that is fixed to the camera ignores the position of any ancestors in the display list and uses its x/y coordinates as offsets from the top left of the camera.
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ fixedToCamera
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+
+ Fixes this object to the Camera.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Default Value:
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
@@ -1285,7 +1490,7 @@ If you wish to work in radians instead of degrees use the property Sprite.rotati
Source:
@@ -1693,7 +1898,7 @@ If you wish to work in radians instead of degrees use the property Sprite.rotati
Source:
@@ -2003,7 +2208,7 @@ If you wish to work in radians instead of degrees use the property Sprite.rotati
Source:
@@ -2109,7 +2314,7 @@ If you wish to work in radians instead of degrees use the property Sprite.rotati
Source:
@@ -2170,7 +2375,7 @@ If you wish to work in radians instead of degrees use the property Sprite.rotati
Source:
@@ -2235,7 +2440,7 @@ If you wish to work in radians instead of degrees use the property Sprite.rotati
Source:
@@ -2304,7 +2509,7 @@ If you wish to work in radians instead of degrees use the property Sprite.rotati
Source:
@@ -2349,13 +2554,13 @@ If you wish to work in radians instead of degrees use the property Sprite.rotati
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:34 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:35 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Phaser.Tile.html b/docs/Phaser.Tile.html
index 699e5fa3..c6710c82 100644
--- a/docs/Phaser.Tile.html
+++ b/docs/Phaser.Tile.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -427,7 +421,7 @@
Tile
- A Tile is a single representation of a tile within a Tilemap.
+ A Tile is a representation of a single tile within the Tilemap.
@@ -438,7 +432,7 @@
- new Tile(tileset, index, x, y, width, height)
+ new Tile(layer, index, x, y, width, height)
@@ -446,7 +440,7 @@
-
Create a new Tile object. Tiles live inside of Tilesets and are rendered via TilemapLayers.
+
Create a new Tile object.
@@ -480,13 +474,13 @@
- tileset
+ layer
-Phaser.Tileset
+object
@@ -496,7 +490,7 @@
- The tileset this tile belongs to.
+ The layer in the Tilemap data that this tile belongs to.
@@ -686,6 +680,108 @@
+
+ alpha
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ alpha
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ The alpha value at which this tile is drawn to the canvas.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<readonly> bottom
@@ -771,7 +867,316 @@
Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ callback
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ callback
+
+
+
+
+
+function
+
+
+
+
+
+
+
+
+
+ Tile collision callback.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Default Value:
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ callbackContext
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ callbackContext
+
+
+
+
+
+object
+
+
+
+
+
+
+
+
+
+ The context in which the collision callback will be called.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <readonly> canCollide
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ canCollide
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+
+ True if this tile can collide or has a collision callback.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
@@ -876,7 +1281,7 @@
Source:
@@ -981,7 +1386,7 @@
Source:
@@ -1086,7 +1491,7 @@
Source:
@@ -1191,7 +1596,109 @@
Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ collides
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ collides
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+
+ Does this tile collide at all?
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
@@ -1296,7 +1803,7 @@
Source:
@@ -1314,7 +1821,7 @@
- collisionCallback
+ faceBottom
@@ -1353,7 +1860,7 @@
- collisionCallback
+ faceBottom
@@ -1369,7 +1876,7 @@
- Tilemap collision callback.
+ Is the bottom of this tile an interesting edge?
@@ -1394,14 +1901,11 @@
- Default Value:
-
-
Source:
@@ -1419,7 +1923,7 @@
- collisionCallbackContext
+ faceLeft
@@ -1458,7 +1962,7 @@
- collisionCallback
+ faceLeft
@@ -1474,7 +1978,7 @@
- Tilemap collision callback.
+ Is the left of this tile an interesting edge?
@@ -1503,7 +2007,211 @@
Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ faceRight
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ faceRight
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+
+ Is the right of this tile an interesting edge?
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ faceTop
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ faceTop
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+
+ Is the top of this tile an interesting edge?
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
@@ -1605,7 +2313,7 @@
Source:
@@ -1678,7 +2386,7 @@
- The index of this tile within the tileset.
+ The index of this tile within the map data corresponding to the tileset.
@@ -1725,7 +2433,7 @@
- mass
+ layer
@@ -1764,13 +2472,13 @@
- mass
+ layer
-number
+object
@@ -1780,7 +2488,7 @@
- The virtual mass of the tile.
+ The layer in the Tilemap data that this tile belongs to.
@@ -1805,14 +2513,215 @@
- Default Value:
-
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <readonly> left
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ left
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ The x value.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ properties
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ properties
+
+
+
+
+
+object
+
+
+
+
+
+
+
+
+
+ Tile specific properties.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
@@ -1914,7 +2823,7 @@
Source:
@@ -1932,7 +2841,7 @@
- separateX
+ scanned
@@ -1971,7 +2880,7 @@
- separateX
+ scanned
@@ -1987,7 +2896,7 @@
- Enable separation at x-axis.
+ Has this tile been walked / turned into a poly?
@@ -2012,14 +2921,11 @@
- Default Value:
-
-
Source:
@@ -2037,7 +2943,7 @@
- separateY
+ <readonly> top
@@ -2076,13 +2982,13 @@
- separateY
+ top
-boolean
+number
@@ -2092,112 +2998,7 @@
- Enable separation at y-axis.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Default Value:
-
-
-
-
- Source:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- tileset
-
-
-
-
-
-
-
-
-
-
-
-
- Properties:
-
-
-
-
-
-
-
- Name
-
-
- Type
-
-
-
-
-
- Description
-
-
-
-
-
-
-
-
- tileset
-
-
-
-
-
-Phaser.Tileset
-
-
-
-
-
-
-
-
-
- The tileset this tile belongs to.
+ The y value.
@@ -2226,7 +3027,7 @@
Source:
@@ -2328,7 +3129,7 @@
Source:
@@ -2401,7 +3202,7 @@
- The top-left corner of the tile within the tileset.
+ The x map coordinate of this tile.
@@ -2430,7 +3231,7 @@
Source:
@@ -2503,7 +3304,7 @@
- The top-left corner of the tile within the tileset.
+ The y map coordinate of this tile.
@@ -2532,7 +3333,7 @@
Source:
@@ -2555,6 +3356,124 @@
+
+ copy(tile)
+
+
+
+
+
+
+
+
Copies the tile data and properties from the given tile to this tile.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ tile
+
+
+
+
+
+Phaser.Tile
+
+
+
+
+
+
+
+
+
+ The tile to copy from.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
destroy()
@@ -2597,7 +3516,7 @@
Source:
@@ -2666,7 +3585,7 @@
Source:
@@ -2853,7 +3772,7 @@
Source:
@@ -2889,7 +3808,8 @@
-
Set callback to be called when this tilemap collides.
+
Set a callback to be called when this tile is hit by an object.
+The callback must true true for collision processing to take place.
@@ -2994,7 +3914,7 @@
Source:
@@ -3039,13 +3959,13 @@
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:34 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:35 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Phaser.TileSprite.html b/docs/Phaser.TileSprite.html
index 2f95aca9..04e6138a 100644
--- a/docs/Phaser.TileSprite.html
+++ b/docs/Phaser.TileSprite.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -438,7 +432,7 @@
- new TileSprite(game, x, y, width, height, key, frame)
+ new TileSprite(game, x, y, width, height, key)
@@ -621,32 +615,6 @@
-
-
-
- frame
-
-
-
-
-
-string
-|
-
-number
-
-
-
-
-
-
-
-
-
- If this Sprite is using part of a sprite sheet or texture atlas you can specify the exact frame to use by giving a string or numeric index.
-
-
-
@@ -675,7 +643,7 @@
Source:
@@ -1025,11 +993,6 @@ If you wish to work in radians instead of degrees use the property Sprite.rotati
- Inherited From:
-
-
@@ -1044,7 +1007,7 @@ If you wish to work in radians instead of degrees use the property Sprite.rotati
Source:
@@ -1373,7 +1336,7 @@ A culled sprite has its renderable property set to 'false'.
Source:
@@ -1480,7 +1443,7 @@ A culled sprite has its renderable property set to 'false'.
Source:
@@ -1587,7 +1550,7 @@ A culled sprite has its renderable property set to 'false'.
Source:
@@ -1700,7 +1663,7 @@ It's used for Camera culling and physics body alignment.
Source:
@@ -1807,7 +1770,7 @@ It's used for Camera culling and physics body alignment.
Source:
@@ -1914,7 +1877,7 @@ It's used for Camera culling and physics body alignment.
Source:
@@ -2026,7 +1989,7 @@ The crop is only applied if you have set Sprite.cropEnabled to true.
Source:
@@ -2136,7 +2099,7 @@ The crop is only applied if you have set Sprite.cropEnabled to true.
Source:
@@ -2252,6 +2215,338 @@ The crop is only applied if you have set Sprite.cropEnabled to true.
+
+
+
+
+
+
+
+
+
+ debug
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ debug
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+
+ Handy flag to use with Game.enableStep
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Inherited From:
+
+
+
+
+
+
+
+
+
+
+
+
+ Default Value:
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <readonly> deltaX
+
+
+
+
+
+
+
Returns the delta x value. The difference between Sprite.x now and in the previous step.
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ deltaX
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ The delta value. Positive if the motion was to the right, negative if to the left.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Inherited From:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <readonly> deltaY
+
+
+
+
+
+
+
Returns the delta x value. The difference between Sprite.y now and in the previous step.
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ deltaY
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ The delta value. Positive if the motion was downwards, negative if upwards.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Inherited From:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
@@ -2574,7 +2869,7 @@ The crop is only applied if you have set Sprite.cropEnabled to true.
Source:
@@ -2662,11 +2957,6 @@ The crop is only applied if you have set Sprite.cropEnabled to true.
- Inherited From:
-
-
@@ -2681,7 +2971,7 @@ The crop is only applied if you have set Sprite.cropEnabled to true.
Source:
@@ -2769,11 +3059,6 @@ The crop is only applied if you have set Sprite.cropEnabled to true.
- Inherited From:
-
-
@@ -2788,7 +3073,7 @@ The crop is only applied if you have set Sprite.cropEnabled to true.
Source:
@@ -3109,7 +3394,7 @@ The crop is only applied if you have set Sprite.cropEnabled to true.
Source:
@@ -3221,7 +3506,7 @@ If you wish to crop the Sprite instead see the Sprite.crop value.
Source:
@@ -3309,11 +3594,6 @@ If you wish to crop the Sprite instead see the Sprite.crop value.
- Inherited From:
-
-
@@ -3328,7 +3608,7 @@ If you wish to crop the Sprite instead see the Sprite.crop value.
Source:
@@ -3528,11 +3808,6 @@ activated for this Sprite instance and it will then start to process click/touch
- Inherited From:
-
-
@@ -3547,7 +3822,7 @@ activated for this Sprite instance and it will then start to process click/touch
Source:
@@ -3654,7 +3929,7 @@ activated for this Sprite instance and it will then start to process click/touch
Source:
@@ -3764,7 +4039,7 @@ activated for this Sprite instance and it will then start to process click/touch
Source:
@@ -4209,7 +4484,7 @@ The lifespan is decremented by game.time.elapsed each update, once it reaches ze
Source:
@@ -4319,7 +4594,7 @@ The lifespan is decremented by game.time.elapsed each update, once it reaches ze
Source:
@@ -4635,7 +4910,7 @@ The lifespan is decremented by game.time.elapsed each update, once it reaches ze
Source:
@@ -4848,7 +5123,7 @@ The lifespan is decremented by game.time.elapsed each update, once it reaches ze
Source:
@@ -4950,7 +5225,7 @@ The lifespan is decremented by game.time.elapsed each update, once it reaches ze
Source:
@@ -5057,7 +5332,7 @@ The lifespan is decremented by game.time.elapsed each update, once it reaches ze
Source:
@@ -5164,7 +5439,7 @@ The lifespan is decremented by game.time.elapsed each update, once it reaches ze
Source:
@@ -5266,7 +5541,7 @@ The lifespan is decremented by game.time.elapsed each update, once it reaches ze
Source:
@@ -5378,7 +5653,7 @@ If you wish to crop the Sprite instead see the Sprite.crop value.
Source:
@@ -5494,6 +5769,220 @@ If you wish to crop the Sprite instead see the Sprite.crop value.
+
+
+
+
+
+
+
+
+
+ <readonly> worldCenterX
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ worldCenterX
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ The center of the Sprite in world coordinates.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Inherited From:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <readonly> worldCenterY
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ worldCenterY
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ The center of the Sprite in world coordinates.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Inherited From:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
@@ -5770,7 +6259,7 @@ bought to the top of that Group, not the entire display list.
Source:
@@ -5928,7 +6417,7 @@ Doesn't change the anchor point of the sprite.
Source:
@@ -6063,7 +6552,7 @@ If health is then taken below zero Sprite.kill is called.
Source:
@@ -6223,7 +6712,7 @@ and nulls its reference to game, freeing it up for garbage collection.
Source:
@@ -6251,7 +6740,7 @@ and nulls its reference to game, freeing it up for garbage collection.
- getLocalPosition(p, x, y, sx, sy) → {Phaser.Point }
+ getLocalPosition(p, x, y) → {Phaser.Point }
@@ -6356,53 +6845,7 @@ Mostly only used internally.
- x coordinate within the Sprite to translate.
-
-
-
-
-
-
- sx
-
-
-
-
-
-number
-
-
-
-
-
-
-
-
-
- Scale factor to be applied.
-
-
-
-
-
-
- sy
-
-
-
-
-
-number
-
-
-
-
-
-
-
-
-
- Scale factor to be applied.
+ y coordinate within the Sprite to translate.
@@ -6439,7 +6882,7 @@ Mostly only used internally.
Source:
@@ -6490,7 +6933,7 @@ Mostly only used internally.
- getLocalUnmodifiedPosition(p, x, y) → {Phaser.Point }
+ getLocalUnmodifiedPosition(p, gx, gy) → {Phaser.Point }
@@ -6556,7 +6999,7 @@ Mostly only used internally by the Input Manager, but also useful for custom hit
- x
+ gx
@@ -6579,7 +7022,7 @@ Mostly only used internally by the Input Manager, but also useful for custom hit
- y
+ gy
@@ -6595,7 +7038,7 @@ Mostly only used internally by the Input Manager, but also useful for custom hit
- x coordinate within the Sprite to translate.
+ y coordinate within the Sprite to translate.
@@ -6632,7 +7075,7 @@ Mostly only used internally by the Input Manager, but also useful for custom hit
Source:
@@ -6732,7 +7175,7 @@ If you don't need this Sprite any more you should call Sprite.destroy instead.
Source:
@@ -6902,7 +7345,7 @@ This causes a WebGL texture update, so use sparingly or in low-intensity portion
Source:
@@ -7159,7 +7602,7 @@ If the requested animation is already playing this request will be ignored. If y
Source:
@@ -7256,7 +7699,7 @@ If the requested animation is already playing this request will be ignored. If y
Source:
@@ -7330,7 +7773,7 @@ If the requested animation is already playing this request will be ignored. If y
Source:
@@ -7545,7 +7988,7 @@ If the Sprite has a physics body that too is reset.
Source:
@@ -7630,7 +8073,7 @@ If the Sprite has a physics body that too is reset.
Source:
@@ -7775,7 +8218,7 @@ It will dispatch the onRevived event, you can listen to Sprite.events.onRevived
Source:
@@ -7860,7 +8303,7 @@ It will dispatch the onRevived event, you can listen to Sprite.events.onRevived
Source:
@@ -7934,7 +8377,7 @@ It will dispatch the onRevived event, you can listen to Sprite.events.onRevived
Source:
@@ -8008,7 +8451,7 @@ It will dispatch the onRevived event, you can listen to Sprite.events.onRevived
Source:
@@ -8082,7 +8525,7 @@ It will dispatch the onRevived event, you can listen to Sprite.events.onRevived
Source:
@@ -8127,13 +8570,13 @@ It will dispatch the onRevived event, you can listen to Sprite.events.onRevived
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:35 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:35 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Phaser.Tilemap.html b/docs/Phaser.Tilemap.html
index 2d0976e6..feae7e2e 100644
--- a/docs/Phaser.Tilemap.html
+++ b/docs/Phaser.Tilemap.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -658,7 +652,7 @@ A map may have multiple layers. You can perform operations on the map data such
Source:
@@ -718,7 +712,7 @@ A map may have multiple layers. You can perform operations on the map data such
Source:
@@ -820,7 +814,7 @@ A map may have multiple layers. You can perform operations on the map data such
Source:
@@ -922,109 +916,7 @@ A map may have multiple layers. You can perform operations on the map data such
Source:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- dirty
-
-
-
-
-
-
-
-
-
-
-
-
- Properties:
-
-
-
-
-
-
-
- Name
-
-
- Type
-
-
-
-
-
- Description
-
-
-
-
-
-
-
-
- dirty
-
-
-
-
-
-boolean
-
-
-
-
-
-
-
-
-
- Internal rendering related flag.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Source:
-
@@ -1135,6 +1027,210 @@ A map may have multiple layers. You can perform operations on the map data such
+
+
+
+
+
+
+
+
+
+ images
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ images
+
+
+
+
+
+array
+
+
+
+
+
+
+
+
+
+ An array of Tiled Image Layers.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ key
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ key
+
+
+
+
+
+string
+
+
+
+
+
+
+
+
+
+ The key of this map data in the Phaser.Cache.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
@@ -1199,7 +1295,7 @@ A map may have multiple layers. You can perform operations on the map data such
- An array of Tilemap layers.
+ An array of Tilemap layer data.
@@ -1228,7 +1324,313 @@ A map may have multiple layers. You can perform operations on the map data such
Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ objects
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ objects
+
+
+
+
+
+array
+
+
+
+
+
+
+
+
+
+ An array of Tiled Object Layers.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ tiles
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ tiles
+
+
+
+
+
+array
+
+
+
+
+
+
+
+
+
+ The super array of Tiles.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ tilesets
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ tilesets
+
+
+
+
+
+array
+
+
+
+
+
+
+
+
+
+ An array of Tilesets.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
@@ -1252,7 +1654,7 @@ A map may have multiple layers. You can perform operations on the map data such
- calculateIndexes()
+ addTilesetImage(tileset, key )
@@ -1260,7 +1662,8 @@ A map may have multiple layers. You can perform operations on the map data such
-
Internal function that calculates the tile indexes for the map data.
+
Adds an image to the map to be used as a tileset. A single map may use multiple tilesets.
+Note that the tileset name can be found in the JSON file exported from Tiled, or in the Tiled editor.
@@ -1269,6 +1672,98 @@ A map may have multiple layers. You can perform operations on the map data such
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+ Argument
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ tileset
+
+
+
+
+
+string
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The name of the tileset as specified in the map data.
+
+
+
+
+
+
+ key
+
+
+
+
+
+string
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+ The key of the Phaser.Cache image used for this tileset. If not specified it will look for an image with a key matching the tileset parameter.
+
+
+
+
+
+
+
@@ -1293,7 +1788,7 @@ A map may have multiple layers. You can perform operations on the map data such
Source:
@@ -1496,6 +1991,12 @@ A map may have multiple layers. You can perform operations on the map data such
number
+|
+
+string
+|
+
+Phaser.TilemapLayer
@@ -1515,7 +2016,7 @@ A map may have multiple layers. You can perform operations on the map data such
- The Tilemap Layer to operate on.
+ The layer to copy the tiles from.
@@ -1547,7 +2048,7 @@ A map may have multiple layers. You can perform operations on the map data such
Source:
@@ -1734,7 +2235,7 @@ A map may have multiple layers. You can perform operations on the map data such
Source:
@@ -1803,7 +2304,7 @@ A map may have multiple layers. You can perform operations on the map data such
Source:
@@ -1872,7 +2373,7 @@ A map may have multiple layers. You can perform operations on the map data such
Source:
@@ -1908,7 +2409,7 @@ A map may have multiple layers. You can perform operations on the map data such
-
Fill a block with a specific tile index.
+
Fills the given area with the specified tile.
@@ -1968,7 +2469,7 @@ A map may have multiple layers. You can perform operations on the map data such
- Index of tiles you want to fill with.
+ The index of the tile that the area will be filled with.
@@ -2106,6 +2607,12 @@ A map may have multiple layers. You can perform operations on the map data such
number
+|
+
+string
+|
+
+Phaser.TilemapLayer
@@ -2125,7 +2632,7 @@ A map may have multiple layers. You can perform operations on the map data such
- The Tilemap Layer to operate on.
+ The layer to operate on.
@@ -2157,7 +2664,7 @@ A map may have multiple layers. You can perform operations on the map data such
Source:
@@ -2193,7 +2700,7 @@ A map may have multiple layers. You can perform operations on the map data such
-
For each tile in the given area (defined by x/y and width/height) run the given callback.
+
For each tile in the given area defined by x/y and width/height run the given callback.
@@ -2422,6 +2929,12 @@ A map may have multiple layers. You can perform operations on the map data such
number
+|
+
+string
+|
+
+Phaser.TilemapLayer
@@ -2441,7 +2954,7 @@ A map may have multiple layers. You can perform operations on the map data such
- The Tilemap Layer to operate on.
+ The layer to operate on.
@@ -2473,7 +2986,7 @@ A map may have multiple layers. You can perform operations on the map data such
Source:
@@ -2501,7 +3014,7 @@ A map may have multiple layers. You can perform operations on the map data such
- getTile(x, y, layer ) → {number}
+ getTile(x, y, layer ) → {Phaser.Tile }
@@ -2614,6 +3127,12 @@ A map may have multiple layers. You can perform operations on the map data such
number
+|
+
+string
+|
+
+Phaser.TilemapLayer
@@ -2633,7 +3152,7 @@ A map may have multiple layers. You can perform operations on the map data such
- The Tilemap Layer to operate on.
+ The layer to get the tile from.
@@ -2665,7 +3184,7 @@ A map may have multiple layers. You can perform operations on the map data such
Source:
@@ -2690,7 +3209,7 @@ A map may have multiple layers. You can perform operations on the map data such
-
The index of the tile at the given coordinates.
+
The tile at the given coordinates.
@@ -2701,7 +3220,7 @@ A map may have multiple layers. You can perform operations on the map data such
-number
+Phaser.Tile
@@ -2716,7 +3235,7 @@ A map may have multiple layers. You can perform operations on the map data such
- getTileWorldXY(x, y, layer ) → {number}
+ getTileWorldXY(x, y, layer ) → {Phaser.Tile }
@@ -2829,6 +3348,12 @@ A map may have multiple layers. You can perform operations on the map data such
number
+|
+
+string
+|
+
+Phaser.TilemapLayer
@@ -2848,7 +3373,7 @@ A map may have multiple layers. You can perform operations on the map data such
- The Tilemap Layer to operate on.
+ The layer to get the tile from.
@@ -2880,7 +3405,7 @@ A map may have multiple layers. You can perform operations on the map data such
Source:
@@ -2905,7 +3430,7 @@ A map may have multiple layers. You can perform operations on the map data such
-
The index of the tile at the given coordinates.
+
The tile at the given coordinates.
@@ -2916,7 +3441,7 @@ A map may have multiple layers. You can perform operations on the map data such
-number
+Phaser.Tile
@@ -2931,7 +3456,7 @@ A map may have multiple layers. You can perform operations on the map data such
- paste(x, y, tileblock, layer)
+ paste(x, y, tileblock, layer )
@@ -2961,6 +3486,8 @@ A map may have multiple layers. You can perform operations on the map data such
Type
+ Argument
+
@@ -2986,6 +3513,14 @@ A map may have multiple layers. You can perform operations on the map data such
+
+
+
+
+
+
+
+
@@ -3009,6 +3544,14 @@ A map may have multiple layers. You can perform operations on the map data such
+
+
+
+
+
+
+
+
@@ -3032,6 +3575,14 @@ A map may have multiple layers. You can perform operations on the map data such
+
+
+
+
+
+
+
+
@@ -3049,16 +3600,32 @@ A map may have multiple layers. You can perform operations on the map data such
number
+|
+
+string
+|
+
+Phaser.TilemapLayer
+
+
+ <optional>
+
+
+
+
+
+
+
- The Tilemap Layer to operate on.
+ The layer to paste the tiles into.
@@ -3090,7 +3657,7 @@ A map may have multiple layers. You can perform operations on the map data such
Source:
@@ -3118,7 +3685,7 @@ A map may have multiple layers. You can perform operations on the map data such
- putTile(index, x, y, layer )
+ putTile(tile, x, y, layer )
@@ -3162,12 +3729,15 @@ A map may have multiple layers. You can perform operations on the map data such
- index
+ tile
+Phaser.Tile
+|
+
number
@@ -3186,7 +3756,7 @@ A map may have multiple layers. You can perform operations on the map data such
- The index of this tile to set.
+ The index of this tile to set or a Phaser.Tile object.
@@ -3262,6 +3832,12 @@ A map may have multiple layers. You can perform operations on the map data such
number
+|
+
+string
+|
+
+Phaser.TilemapLayer
@@ -3281,7 +3857,7 @@ A map may have multiple layers. You can perform operations on the map data such
- The Tilemap Layer to operate on.
+ The layer to modify.
@@ -3313,7 +3889,7 @@ A map may have multiple layers. You can perform operations on the map data such
Source:
@@ -3341,7 +3917,7 @@ A map may have multiple layers. You can perform operations on the map data such
- putTileWorldXY(index, x, y, tileWidth, tileHeight, layer )
+ putTileWorldXY(tile, x, y, tileWidth, tileHeight, layer )
@@ -3385,12 +3961,15 @@ A map may have multiple layers. You can perform operations on the map data such
- index
+ tile
+Phaser.Tile
+|
+
number
@@ -3409,7 +3988,7 @@ A map may have multiple layers. You can perform operations on the map data such
- The index of the tile to put into the layer.
+ The index of this tile to set or a Phaser.Tile object.
@@ -3547,6 +4126,12 @@ A map may have multiple layers. You can perform operations on the map data such
number
+|
+
+string
+|
+
+Phaser.TilemapLayer
@@ -3566,7 +4151,7 @@ A map may have multiple layers. You can perform operations on the map data such
- The Tilemap Layer to operate on.
+ The layer to modify.
@@ -3598,7 +4183,7 @@ A map may have multiple layers. You can perform operations on the map data such
Source:
@@ -3626,7 +4211,7 @@ A map may have multiple layers. You can perform operations on the map data such
- random(tileA, tileB, x, y, width, height, layer )
+ random(x, y, width, height, layer )
@@ -3668,68 +4253,6 @@ A map may have multiple layers. You can perform operations on the map data such
-
-
- tileA
-
-
-
-
-
-number
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- First tile index.
-
-
-
-
-
-
- tileB
-
-
-
-
-
-number
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Second tile index.
-
-
-
-
x
@@ -3863,6 +4386,12 @@ A map may have multiple layers. You can perform operations on the map data such
number
+|
+
+string
+|
+
+Phaser.TilemapLayer
@@ -3882,7 +4411,7 @@ A map may have multiple layers. You can perform operations on the map data such
- The Tilemap Layer to operate on.
+ The layer to operate on.
@@ -3914,7 +4443,7 @@ A map may have multiple layers. You can perform operations on the map data such
Source:
@@ -3983,7 +4512,7 @@ A map may have multiple layers. You can perform operations on the map data such
Source:
@@ -4011,7 +4540,7 @@ A map may have multiple layers. You can perform operations on the map data such
- replace(tileA, tileB, x, y, width, height, layer )
+ replace(source, dest, x, y, width, height, layer )
@@ -4019,7 +4548,7 @@ A map may have multiple layers. You can perform operations on the map data such
-
Replaces one type of tile with another in the given area (defined by x/y and width/height).
+
Scans the given area for tiles with an index matching source and updates their index to match dest.
@@ -4055,7 +4584,7 @@ A map may have multiple layers. You can perform operations on the map data such
- tileA
+ source
@@ -4079,14 +4608,14 @@ A map may have multiple layers. You can perform operations on the map data such
- First tile index.
+ The tile index value to scan for.
- tileB
+ dest
@@ -4110,7 +4639,7 @@ A map may have multiple layers. You can perform operations on the map data such
- Second tile index.
+ The tile index value to replace found tiles with.
@@ -4248,6 +4777,12 @@ A map may have multiple layers. You can perform operations on the map data such
number
+|
+
+string
+|
+
+Phaser.TilemapLayer
@@ -4267,7 +4802,7 @@ A map may have multiple layers. You can perform operations on the map data such
- The Tilemap Layer to operate on.
+ The layer to operate on.
@@ -4299,7 +4834,7 @@ A map may have multiple layers. You can perform operations on the map data such
Source:
@@ -4376,6 +4911,12 @@ A map may have multiple layers. You can perform operations on the map data such
number
+|
+
+string
+|
+
+Phaser.TilemapLayer
@@ -4385,7 +4926,7 @@ A map may have multiple layers. You can perform operations on the map data such
- Sets the current layer to the given index.
+ The layer to set as current.
@@ -4417,7 +4958,7 @@ A map may have multiple layers. You can perform operations on the map data such
Source:
@@ -4445,7 +4986,7 @@ A map may have multiple layers. You can perform operations on the map data such
- shuffle(tileA, tileB, x, y, width, height, layer )
+ shuffle(x, y, width, height, layer )
@@ -4462,6 +5003,266 @@ A map may have multiple layers. You can perform operations on the map data such
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+ Argument
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ x
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ X position of the top left of the area to operate one, given in tiles, not pixels.
+
+
+
+
+
+
+ y
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Y position of the top left of the area to operate one, given in tiles, not pixels.
+
+
+
+
+
+
+ width
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The width in tiles of the area to operate on.
+
+
+
+
+
+
+ height
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The height in tiles of the area to operate on.
+
+
+
+
+
+
+ layer
+
+
+
+
+
+number
+|
+
+string
+|
+
+Phaser.TilemapLayer
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+ The layer to operate on.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ swapTile(tileA, tileB, x, y, width, height, layer )
+
+
+
+
+
+
+
+
Scans the given area for tiles with an index matching tileA and swaps them with tileB.
+
+
+
+
+
+
+
+
Parameters:
@@ -4682,6 +5483,12 @@ A map may have multiple layers. You can perform operations on the map data such
number
+|
+
+string
+|
+
+Phaser.TilemapLayer
@@ -4701,7 +5508,7 @@ A map may have multiple layers. You can perform operations on the map data such
- The Tilemap Layer to operate on.
+ The layer to operate on.
@@ -4733,381 +5540,7 @@ A map may have multiple layers. You can perform operations on the map data such
Source:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- swapHandler(value, index)
-
-
-
-
-
-
-
-
Internal function that handles the swapping of tiles.
-
-
-
-
-
-
-
-
- Parameters:
-
-
-
-
-
-
- Name
-
-
- Type
-
-
-
-
-
- Description
-
-
-
-
-
-
-
-
- value
-
-
-
-
-
-number
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- index
-
-
-
-
-
-number
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Source:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- swapTile(tileA, tileB, x, y, width, height)
-
-
-
-
-
-
-
-
Swap tiles with 2 kinds of indexes.
-
-
-
-
-
-
-
-
- Parameters:
-
-
-
-
-
-
- Name
-
-
- Type
-
-
-
-
-
- Description
-
-
-
-
-
-
-
-
- tileA
-
-
-
-
-
-number
-
-
-
-
-
-
-
-
-
- First tile index.
-
-
-
-
-
-
- tileB
-
-
-
-
-
-number
-
-
-
-
-
-
-
-
-
- Second tile index.
-
-
-
-
-
-
- x
-
-
-
-
-
-number
-
-
-
-
-
-
-
-
-
- X position of the top left of the area to operate one, given in tiles, not pixels.
-
-
-
-
-
-
- y
-
-
-
-
-
-number
-
-
-
-
-
-
-
-
-
- Y position of the top left of the area to operate one, given in tiles, not pixels.
-
-
-
-
-
-
- width
-
-
-
-
-
-number
-
-
-
-
-
-
-
-
-
- The width in tiles of the area to operate on.
-
-
-
-
-
-
- height
-
-
-
-
-
-number
-
-
-
-
-
-
-
-
-
- The height in tiles of the area to operate on.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Source:
-
@@ -5152,13 +5585,13 @@ A map may have multiple layers. You can perform operations on the map data such
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:34 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:35 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Phaser.TilemapLayer.html b/docs/Phaser.TilemapLayer.html
index 074bbadf..6324e83e 100644
--- a/docs/Phaser.TilemapLayer.html
+++ b/docs/Phaser.TilemapLayer.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -438,7 +432,7 @@
- new TilemapLayer(game, x, y, renderWidth, renderHeight, tileset, tilemap, layer)
+ new TilemapLayer(game, tilemap, index, width, height)
@@ -501,124 +495,6 @@
-
-
- x
-
-
-
-
-
-number
-
-
-
-
-
-
-
-
-
- The x coordinate of this layer.
-
-
-
-
-
-
- y
-
-
-
-
-
-number
-
-
-
-
-
-
-
-
-
- The y coordinate of this layer.
-
-
-
-
-
-
- renderWidth
-
-
-
-
-
-number
-
-
-
-
-
-
-
-
-
- Width of the layer.
-
-
-
-
-
-
- renderHeight
-
-
-
-
-
-number
-
-
-
-
-
-
-
-
-
- Height of the layer.
-
-
-
-
-
-
- tileset
-
-
-
-
-
-Phaser.Tileset
-|
-
-string
-
-
-
-
-
-
-
-
-
- The tile set used for rendering.
-
-
-
-
tilemap
@@ -644,7 +520,7 @@
- layer
+ index
@@ -660,7 +536,53 @@
- The layer index within the map.
+ The layer index within the map that this TilemapLayer represents.
+
+
+
+
+
+
+ width
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ Width of the renderable area of the layer.
+
+
+
+
+
+
+ height
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ Height of the renderable area of the layer.
@@ -692,7 +614,7 @@
Source:
@@ -820,7 +742,109 @@
Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ cameraOffset
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ cameraOffset
+
+
+
+
+
+Phaser.Point
+
+
+
+
+
+
+
+
+
+ If this object is fixed to the camera then use this Point to specify how far away from the Camera x/y it's rendered.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
@@ -893,7 +917,7 @@
- The canvas to which this BitmapData draws.
+ The canvas to which this TilemapLayer draws.
@@ -922,7 +946,211 @@
Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ collisionHeight
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ collisionHeight
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ The height of the collision tiles.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ collisionWidth
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ collisionWidth
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ The width of the collision tiles.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
@@ -1024,7 +1252,637 @@
Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ debug
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ debug
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+
+ If set to true the collideable tile edges path will be rendered. Only works when game is running in Phaser.CANVAS mode.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Default Value:
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ debugAlpha
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ debugAlpha
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ If debug is true then the tileset is rendered with this alpha level, to make the tile edges clearer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Default Value:
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ debugCallbackColor
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ debugCallbackColor
+
+
+
+
+
+string
+
+
+
+
+
+
+
+
+
+ If debug is true this is the color used to outline the edges of tiles that have collision callbacks. Provide in hex or rgb/rgba string format.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Default Value:
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ debugColor
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ debugColor
+
+
+
+
+
+string
+
+
+
+
+
+
+
+
+
+ If debug is true this is the color used to outline the edges of collidable tiles. Provide in hex or rgb/rgba string format.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Default Value:
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ debugFill
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ debugFill
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+
+ If true the debug tiles are filled with debugFillColor AND stroked around.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Default Value:
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ debugFillColor
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ debugFillColor
+
+
+
+
+
+string
+
+
+
+
+
+
+
+
+
+ If debugFill is true this is the color used to fill the tiles. Provide in hex or rgb/rgba string format.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Default Value:
+
+
+
+
+ Source:
+
@@ -1126,7 +1984,7 @@
Source:
@@ -1151,7 +2009,7 @@
-
A layer that is fixed to the camera ignores the position of any ancestors in the display list and uses its x/y coordinates as offsets from the top left of the camera.
+
An object that is fixed to the camera ignores the position of any ancestors in the display list and uses its x/y coordinates as offsets from the top left of the camera.
@@ -1203,7 +2061,7 @@
- Fixes this layer to the Camera.
+ Fixes this object to the Camera.
@@ -1235,7 +2093,7 @@
Source:
@@ -1337,109 +2195,7 @@
Source:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <readonly> heightInPixels
-
-
-
-
-
-
-
-
-
-
-
-
- Properties:
-
-
-
-
-
-
-
- Name
-
-
- Type
-
-
-
-
-
- Description
-
-
-
-
-
-
-
-
- heightInPixels
-
-
-
-
-
-number
-
-
-
-
-
-
-
-
-
- Do NOT recommend changing after the map is loaded!
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Source:
-
@@ -1512,7 +2268,7 @@
-
+ The index of this layer within the Tilemap.
@@ -1541,7 +2297,7 @@
Source:
@@ -1604,7 +2360,7 @@
-number
+object
@@ -1614,7 +2370,7 @@
- Tilemap layer index.
+ The layer object within the Tilemap that this layer represents.
@@ -1643,7 +2399,7 @@
Source:
@@ -1661,7 +2417,7 @@
- renderHeight
+ map
@@ -1700,13 +2456,13 @@
- renderHeight
+ map
-number
+Phaser.Tilemap
@@ -1716,7 +2472,7 @@
- The height of the area being rendered.
+ The Tilemap to which this layer is bound.
@@ -1745,7 +2501,7 @@
Source:
@@ -1763,7 +2519,7 @@
- renderWidth
+ name
@@ -1802,13 +2558,13 @@
- renderWidth
+ name
-number
+string
@@ -1818,7 +2574,7 @@
- The width of the area being rendered.
+ The name of the layer.
@@ -1847,7 +2603,7 @@
Source:
@@ -1954,7 +2710,7 @@ half as quickly as the 'normal' camera-locked layers do)
Source:
@@ -2061,7 +2817,7 @@ half as quickly as the 'normal' camera-locked layers do)
Source:
@@ -2163,7 +2919,7 @@ half as quickly as the 'normal' camera-locked layers do)
Source:
@@ -2265,7 +3021,7 @@ half as quickly as the 'normal' camera-locked layers do)
Source:
@@ -2367,7 +3123,7 @@ half as quickly as the 'normal' camera-locked layers do)
Source:
@@ -2469,7 +3225,7 @@ half as quickly as the 'normal' camera-locked layers do)
Source:
@@ -2487,7 +3243,7 @@ half as quickly as the 'normal' camera-locked layers do)
- tileHeight
+ tileColor
@@ -2526,13 +3282,13 @@ half as quickly as the 'normal' camera-locked layers do)
- tileHeight
+ tileColor
-number
+string
@@ -2542,7 +3298,7 @@ half as quickly as the 'normal' camera-locked layers do)
- The height of a single tile in pixels.
+ If no tileset is given the tiles will be rendered as rectangles in this color. Provide in hex or rgb/rgba string format.
@@ -2567,521 +3323,14 @@ half as quickly as the 'normal' camera-locked layers do)
-
-
- Source:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- tilemap
-
-
-
-
-
-
-
-
-
-
-
-
- Properties:
-
-
-
-
-
-
-
- Name
-
-
- Type
-
-
-
-
-
- Description
-
-
-
-
-
-
-
-
- tilemap
-
-
-
-
-
-Phaser.Tilemap
-
-
-
-
-
-
-
-
-
- The Tilemap to which this layer is bound.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ Default Value:
+
Source:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- tileMargin
-
-
-
-
-
-
-
-
-
-
-
-
- Properties:
-
-
-
-
-
-
-
- Name
-
-
- Type
-
-
-
-
-
- Description
-
-
-
-
-
-
-
-
- tileMargin
-
-
-
-
-
-number
-
-
-
-
-
-
-
-
-
- The margin around the tiles.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Source:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- tileset
-
-
-
-
-
-
-
-
-
-
-
-
- Properties:
-
-
-
-
-
-
-
- Name
-
-
- Type
-
-
-
-
-
- Description
-
-
-
-
-
-
-
-
- tileset
-
-
-
-
-
-Phaser.Tileset
-
-
-
-
-
-
-
-
-
- The tile set used for rendering.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Source:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- tileSpacing
-
-
-
-
-
-
-
-
-
-
-
-
- Properties:
-
-
-
-
-
-
-
- Name
-
-
- Type
-
-
-
-
-
- Description
-
-
-
-
-
-
-
-
- tileSpacing
-
-
-
-
-
-number
-
-
-
-
-
-
-
-
-
- The spacing around the tiles.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Source:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- tileWidth
-
-
-
-
-
-
-
-
-
-
-
-
- Properties:
-
-
-
-
-
-
-
- Name
-
-
- Type
-
-
-
-
-
- Description
-
-
-
-
-
-
-
-
- tileWidth
-
-
-
-
-
-number
-
-
-
-
-
-
-
-
-
- The width of a single tile in pixels.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Source:
-
@@ -3183,109 +3432,7 @@ half as quickly as the 'normal' camera-locked layers do)
Source:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <readonly> widthInPixels
-
-
-
-
-
-
-
-
-
-
-
-
- Properties:
-
-
-
-
-
-
-
- Name
-
-
- Type
-
-
-
-
-
- Description
-
-
-
-
-
-
-
-
- widthInPixels
-
-
-
-
-
-number
-
-
-
-
-
-
-
-
-
- Do NOT recommend changing after the map is loaded!
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Source:
-
@@ -3309,7 +3456,7 @@ half as quickly as the 'normal' camera-locked layers do)
- deltaAbsX() → {number}
+ getTiles(x, y, width, height, collides ) → {array}
@@ -3317,375 +3464,7 @@ half as quickly as the 'normal' camera-locked layers do)
-
Returns the absolute delta x value.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Source:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Returns:
-
-
-
-
Absolute delta X value
-
-
-
-
-
-
- Type
-
-
-
-number
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- deltaAbsY() → {number}
-
-
-
-
-
-
-
-
Returns the absolute delta y value.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Source:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Returns:
-
-
-
-
Absolute delta Y value
-
-
-
-
-
-
- Type
-
-
-
-number
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- deltaX() → {number}
-
-
-
-
-
-
-
-
Returns the delta x value.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Source:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Returns:
-
-
-
-
-
-
-
-
- Type
-
-
-
-number
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- deltaY() → {number}
-
-
-
-
-
-
-
-
Returns the delta y value.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Source:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Returns:
-
-
-
-
-
-
-
-
- Type
-
-
-
-number
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- getTiles(x, y, width, height, collides) → {array}
-
-
-
-
-
-
-
-
Get the tiles within the given area.
+
Get all tiles that exist within the given area, defined by the top-left corner, width and height. Values given are in pixels, not tiles.
@@ -3707,8 +3486,12 @@ half as quickly as the 'normal' camera-locked layers do)
Type
+ Argument
+
+ Default
+
Description
@@ -3732,10 +3515,22 @@ half as quickly as the 'normal' camera-locked layers do)
+
+
+
+
+
+
- X position of the top left of the area to copy (given in tiles, not pixels)
+
+
+
+
+
+
+ X position of the top left corner.
@@ -3755,10 +3550,22 @@ half as quickly as the 'normal' camera-locked layers do)
+
+
+
+
+
+
- Y position of the top left of the area to copy (given in tiles, not pixels)
+
+
+
+
+
+
+ Y position of the top left corner.
@@ -3778,10 +3585,22 @@ half as quickly as the 'normal' camera-locked layers do)
+
+
+
+
+
+
- The width of the area to copy (given in tiles, not pixels)
+
+
+
+
+
+
+ Width of the area to get.
@@ -3801,10 +3620,22 @@ half as quickly as the 'normal' camera-locked layers do)
+
+
+
+
+
+
- The height of the area to copy (given in tiles, not pixels)
+
+
+
+
+
+
+ Height of the area to get.
@@ -3824,7 +3655,23 @@ half as quickly as the 'normal' camera-locked layers do)
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+ false
+
+
If true only return tiles that collide on one or more faces.
@@ -3859,7 +3706,7 @@ half as quickly as the 'normal' camera-locked layers do)
Source:
@@ -4000,7 +3847,7 @@ half as quickly as the 'normal' camera-locked layers do)
Source:
@@ -4051,7 +3898,7 @@ half as quickly as the 'normal' camera-locked layers do)
-
+ getTileXY(x, y, point) → {Phaser.Point |object}
@@ -4136,6 +3983,32 @@ half as quickly as the 'normal' camera-locked layers do)
+
+
+
+ point
+
+
+
+
+
+Phaser.Point
+|
+
+object
+
+
+
+
+
+
+
+
+
+ The Point object to set the x and y values on.
+
+
+
@@ -4164,7 +4037,7 @@ half as quickly as the 'normal' camera-locked layers do)
Source:
@@ -4189,7 +4062,7 @@ half as quickly as the 'normal' camera-locked layers do)
-
The tile with specific properties.
+
A Point object with its x and y properties set.
@@ -4200,7 +4073,10 @@ half as quickly as the 'normal' camera-locked layers do)
-Phaser.Tile
+Phaser.Point
+|
+
+object
@@ -4305,7 +4181,7 @@ half as quickly as the 'normal' camera-locked layers do)
Source:
@@ -4351,6 +4227,75 @@ half as quickly as the 'normal' camera-locked layers do)
+
+
+
+
+
+ postUpdate()
+
+
+
+
+
+
+
+
Automatically called by World.postUpdate. Handles cache updates.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -4397,7 +4342,76 @@ half as quickly as the 'normal' camera-locked layers do)
Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ renderDebug()
+
+
+
+
+
+
+
+
Renders a collision debug overlay on-top of the canvas. Called automatically by render when debug = true.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
@@ -4466,217 +4480,7 @@ half as quickly as the 'normal' camera-locked layers do)
Source:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- update()
-
-
-
-
-
-
-
-
Automatically called by World.preUpdate. Handles cache updates.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Source:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- updateMapData(tilemap, layer)
-
-
-
-
-
-
-
-
Updates the Tilemap data.
-
-
-
-
-
-
-
-
- Parameters:
-
-
-
-
-
-
- Name
-
-
- Type
-
-
-
-
-
- Description
-
-
-
-
-
-
-
-
- tilemap
-
-
-
-
-
-Phaser.Tilemap
-
-
-
-
-
-
-
-
-
- The tilemap to which this layer belongs.
-
-
-
-
-
-
- layer
-
-
-
-
-
-number
-
-
-
-
-
-
-
-
-
- The layer index within the map.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Source:
-
@@ -4745,128 +4549,7 @@ half as quickly as the 'normal' camera-locked layers do)
Source:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- updateTileset(tileset)
-
-
-
-
-
-
-
-
Updates the Tileset data.
-
-
-
-
-
-
-
-
- Parameters:
-
-
-
-
-
-
- Name
-
-
- Type
-
-
-
-
-
- Description
-
-
-
-
-
-
-
-
- tileset
-
-
-
-
-
-Phaser.Tileset
-|
-
-string
-
-
-
-
-
-
-
-
-
- The tileset to use for this layer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Source:
-
@@ -4911,13 +4594,13 @@ half as quickly as the 'normal' camera-locked layers do)
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:34 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:35 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Phaser.TilemapParser.html b/docs/Phaser.TilemapParser.html
index 71bfaf31..8da89b64 100644
--- a/docs/Phaser.TilemapParser.html
+++ b/docs/Phaser.TilemapParser.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -523,7 +517,7 @@
- <static> parse(game, data, format) → {Phaser.Tileset }
+ <static> parse(game, key) → {object}
@@ -588,30 +582,7 @@
- data
-
-
-
-
-
-object
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- format
+ key
@@ -627,7 +598,7 @@
-
+ The key of the tilemap in the Cache.
@@ -659,7 +630,7 @@
Source:
@@ -684,7 +655,7 @@
-
Generated Tileset object.
+
The parsed map object.
@@ -695,7 +666,7 @@
-Phaser.Tileset
+object
@@ -800,7 +771,7 @@
Source:
@@ -851,7 +822,7 @@
- <static> parseJSON(json-) → {object}
+ <static> parseJSON(json) → {object}
@@ -893,7 +864,7 @@
- json-
+ json
@@ -909,7 +880,7 @@
- The Tiled JSON data.
+ The JSON map data.
@@ -941,7 +912,7 @@
Source:
@@ -966,7 +937,7 @@
-
Generated map data.
+
Generated and parsed map data.
@@ -992,7 +963,7 @@
- <static> tileset(game, key, tileWidth, tileHeight, tileMax, tileMargin, tileSpacing) → {Phaser.Tileset }
+ <static> tileset(game, key, tileWidth, tileHeight, tileMargin , tileSpacing , rows , columns , total ) → {Phaser.Tileset }
@@ -1022,8 +993,12 @@
Type
+ Argument
+
+ Default
+
Description
@@ -1047,7 +1022,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
Game reference to the currently running game.
@@ -1070,10 +1057,22 @@
+
+
+
+
+
+
-
+
+
+
+
+
+
+ The Cache key of this tileset.
@@ -1093,10 +1092,22 @@
+
+
+
+
+
+
-
+
+
+
+
+
+
+ Width of each single tile in pixels.
@@ -1116,33 +1127,22 @@
-
-
-
-
-
-
-
-
-
-
- tileMax
-
-
-
-
+
-number
+
-
-
-
+
+
+
+
+
+
-
+ Height of each single tile in pixels.
@@ -1162,10 +1162,26 @@
+
+
+ <optional>
+
+
+
+
+
-
+
+
+
+ 0
+
+
+
+
+ If the tiles have been drawn with a margin, specify the amount here.
@@ -1185,10 +1201,143 @@
+
+
+ <optional>
+
+
+
+
+
-
+
+
+
+ 0
+
+
+
+
+ If the tiles have been drawn with spacing between them, specify the amount here.
+
+
+
+
+
+
+ rows
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ -1
+
+
+
+
+ How many tiles are placed horizontally in each row? If -1 it will calculate rows by dividing the image width by tileWidth.
+
+
+
+
+
+
+ columns
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ -1
+
+
+
+
+ How many tiles are placed vertically in each column? If -1 it will calculate columns by dividing the image height by tileHeight.
+
+
+
+
+
+
+ total
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ -1
+
+
+
+
+ The maximum number of tiles to extract from the image. If -1 it will extract rows * columns worth. You can also set a value lower than the actual number of tiles.
@@ -1288,13 +1437,13 @@
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:35 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:35 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Phaser.Tileset.html b/docs/Phaser.Tileset.html
index cd4e1e56..2a1cd745 100644
--- a/docs/Phaser.Tileset.html
+++ b/docs/Phaser.Tileset.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -438,7 +432,7 @@
- new Tileset(image, key, tileWidth, tileHeight, tileMargin , tileSpacing )
+ new Tileset(name, firstgid, width, height, margin, spacing, properties)
@@ -446,7 +440,8 @@
-
A Tile set is a combination of an image containing the tiles and collision data per tile.
+
A Tile set is a combination of an image containing the tiles and collision data per tile.
+You should not normally instantiate this class directly.
@@ -468,8 +463,6 @@
Type
- Argument
-
@@ -482,38 +475,7 @@
- image
-
-
-
-
-
-Image
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- The Image object from the Cache.
-
-
-
-
-
-
- key
+ name
@@ -526,25 +488,17 @@
-
-
-
-
-
-
-
-
- The key of the tileset in the cache.
+ The name of the tileset in the map data.
- tileWidth
+ firstgid
@@ -557,25 +511,17 @@
-
-
-
-
-
-
-
-
- The width of the tile in pixels.
+ The Tiled firstgid value.
- tileHeight
+ width
@@ -588,25 +534,17 @@
-
-
-
-
-
-
-
-
- The height of the tile in pixels.
+ Width of each tile in pixels.
- tileMargin
+ height
@@ -619,27 +557,17 @@
-
-
- <optional>
-
-
-
-
-
-
-
- The margin around the tiles in the sheet.
+ Height of each tile in pixels.
- tileSpacing
+ margin
@@ -652,20 +580,56 @@
-
-
- <optional>
-
-
+
+ The amount of margin around the tilesheet.
+
+
+
+
+
+
+ spacing
+
+
+
+
-
+number
+
+
+
+
+
- The spacing between the tiles in the sheet.
+ The amount of spacing between each tile in the sheet.
+
+
+
+
+
+
+ properties
+
+
+
+
+
+object
+
+
+
+
+
+
+
+
+
+ Tileset properties.
@@ -697,7 +661,7 @@
Source:
@@ -740,6 +704,213 @@
+
+ columns
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ columns
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ The number of columns in the tile sheet.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ firstgid
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ firstgid
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ The Tiled firstgid value.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Default Value:
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
image
@@ -796,7 +967,7 @@
- The image used for rendering.
+ The image used for rendering. This is a reference to the image stored in Phaser.Cache.
@@ -825,7 +996,7 @@
Source:
@@ -843,7 +1014,7 @@
- key
+ name
@@ -882,7 +1053,7 @@
- key
+ name
@@ -898,7 +1069,7 @@
- The cache ID.
+ The name of the Tileset.
@@ -927,7 +1098,7 @@
Source:
@@ -945,7 +1116,7 @@
- margin
+ properties
@@ -984,13 +1155,13 @@
- tileMargin
+ properties
-number
+object
@@ -1000,7 +1171,7 @@
- The margin around the tiles in the sheet.
+ Tileset specific properties (typically defined in the Tiled editor).
@@ -1029,7 +1200,7 @@
Source:
@@ -1047,7 +1218,7 @@
- spacing
+ rows
@@ -1086,7 +1257,7 @@
- tileSpacing
+ rows
@@ -1102,7 +1273,7 @@
- The margin around the tiles in the sheet.
+ The number of rows in the tile sheet.
@@ -1131,7 +1302,7 @@
Source:
@@ -1251,7 +1422,7 @@
- tiles
+ tileMargin
@@ -1290,13 +1461,13 @@
- tiles
+ tileMargin
-array
+number
@@ -1306,7 +1477,7 @@
- An array of the tile collision data.
+ The margin around the tiles in the sheet.
@@ -1335,7 +1506,109 @@
Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ tileSpacing
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ tileSpacing
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ The margin around the tiles in the sheet.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
@@ -1455,7 +1728,7 @@
- <readonly> total
+ total
@@ -1510,7 +1783,7 @@
- The total number of tiles in this Tileset.
+ The total number of tiles in the tilesheet.
@@ -1539,7 +1812,7 @@
Source:
@@ -1563,7 +1836,7 @@
- addTile(tile)
+ <protected> calculateFaces(layer)
@@ -1571,7 +1844,7 @@
-
Adds a Tile into this set.
+
Internal function.
@@ -1605,125 +1878,7 @@
- tile
-
-
-
-
-
-Phaser.Tile
-
-
-
-
-
-
-
-
-
- The tile to add to this set.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Source:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- canCollide(index) → {boolean}
-
-
-
-
-
-
-
-
Checks if the tile at the given index can collide.
-
-
-
-
-
-
-
-
- Parameters:
-
-
-
-
-
-
- Name
-
-
- Type
-
-
-
-
-
- Description
-
-
-
-
-
-
-
-
- index
+ layer
@@ -1739,7 +1894,7 @@
- The index of the tile within the set.
+ The index of the TilemapLayer to operate on.
@@ -1771,7 +1926,7 @@
Source:
@@ -1792,29 +1947,6 @@
- Returns:
-
-
-
-
True or false depending on the tile collision or null if no tile was found at the given index.
-
-
-
-
-
-
- Type
-
-
-
-boolean
-
-
-
-
-
-
-
@@ -1912,7 +2044,7 @@
Source:
@@ -1937,7 +2069,11 @@
-
True if a tile exists at the given index otherwise false.
+
True if a tile exists at the given index otherwise false.
+ checkTileIndex: function (index) {
+
return (this.tiles[index]);
+
+}
@@ -1963,7 +2099,1356 @@
-
+ createFromObjects(name, gid, key, frame , exists , autoCull , group )
+
+
+
+
+
+
+
+
Creates a Sprite for every object matching the given gid in the map data. You can optionally specify the group that the Sprite will be created in. If none is
+given it will be created in the World. All properties from the map data objectgroup are copied across to the Sprite, so you can use this as an easy way to
+configure Sprite properties from within the map editor. For example giving an object a property if alpha: 0.5 in the map editor will duplicate that when the
+Sprite is created. You could also give it a value like: body.velocity.x: 100 to set it moving automatically.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+ Argument
+
+
+
+ Default
+
+
+ Description
+
+
+
+
+
+
+
+
+ name
+
+
+
+
+
+string
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The name of the Object Group to create Sprites from.
+
+
+
+
+
+
+ gid
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The layer array index value, or if a string is given the layer name, within the map data that this TilemapLayer represents.
+
+
+
+
+
+
+ key
+
+
+
+
+
+string
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The Game.cache key of the image that this Sprite will use.
+
+
+
+
+
+
+ frame
+
+
+
+
+
+number
+|
+
+string
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ If the Sprite image contains multiple frames you can specify which one to use here.
+
+
+
+
+
+
+ exists
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ The default exists state of the Sprite.
+
+
+
+
+
+
+ autoCull
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ The default autoCull state of the Sprite. Sprites that are autoCulled are culled from the camera if out of its range.
+
+
+
+
+
+
+ group
+
+
+
+
+
+Phaser.Group
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Optional Group to add the Sprite to. If not specified it will be added to the World group.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ createLayer(layer, width , height , group ) → {Phaser.TilemapLayer }
+
+
+
+
+
+
+
+
Creates a new TilemapLayer object. By default TilemapLayers are fixed to the camera.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+ Argument
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ layer
+
+
+
+
+
+number
+|
+
+string
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The layer array index value, or if a string is given the layer name, within the map data that this TilemapLayer represents.
+
+
+
+
+
+
+ width
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+ The rendered width of the layer, should never be wider than Game.width. If not given it will be set to Game.width.
+
+
+
+
+
+
+ height
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+ The rendered height of the layer, should never be wider than Game.height. If not given it will be set to Game.height.
+
+
+
+
+
+
+ group
+
+
+
+
+
+Phaser.Group
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+ Optional Group to add the object to. If not specified it will be added to the World group.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+
+
+
The TilemapLayer object. This is an extension of Phaser.Sprite and can be moved around the display list accordingly.
+
+
+
+
+
+
+ Type
+
+
+
+Phaser.TilemapLayer
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ getImageIndex(name) → {number}
+
+
+
+
+
+
+
+
Gets the image index based on its name.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ name
+
+
+
+
+
+string
+
+
+
+
+
+
+
+
+
+ The name of the image to get.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+
+
+
The index of the image in this tilemap, or null if not found.
+
+
+
+
+
+
+ Type
+
+
+
+number
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <protected> getIndex(location, name) → {number}
+
+
+
+
+
+
+
+
Gets the layer index based on the layers name.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ location
+
+
+
+
+
+array
+
+
+
+
+
+
+
+
+
+ The local array to search.
+
+
+
+
+
+
+ name
+
+
+
+
+
+string
+
+
+
+
+
+
+
+
+
+ The name of the array element to get.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+
+
+
The index of the element in the array, or null if not found.
+
+
+
+
+
+
+ Type
+
+
+
+number
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <protected> getLayer(layer) → {number}
+
+
+
+
+
+
+
+
Gets the TilemapLayer index as used in the setCollision calls.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ layer
+
+
+
+
+
+number
+|
+
+string
+|
+
+Phaser.TilemapLayer
+
+
+
+
+
+
+
+
+
+ The layer to operate on. If not given will default to this.currentLayer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+
+
+
The TilemapLayer index.
+
+
+
+
+
+
+ Type
+
+
+
+number
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ getLayerIndex(name) → {number}
+
+
+
+
+
+
+
+
Gets the layer index based on its name.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ name
+
+
+
+
+
+string
+
+
+
+
+
+
+
+
+
+ The name of the layer to get.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+
+
+
The index of the layer in this tilemap, or null if not found.
+
+
+
+
+
+
+ Type
+
+
+
+number
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ getObjectIndex(name) → {number}
+
+
+
+
+
+
+
+
Gets the object index based on its name.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ name
+
+
+
+
+
+string
+
+
+
+
+
+
+
+
+
+ The name of the object to get.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+
+
+
The index of the object in this tilemap, or null if not found.
+
+
+
+
+
+
+ Type
+
+
+
+number
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ getTile(index) → {object}
@@ -2053,7 +3538,7 @@
Source:
@@ -2078,7 +3563,11 @@
-
The tile.
+
The tile object.
+ getTile: function (index) {
+
return this.tiles[index];
+
+},
@@ -2089,7 +3578,7 @@
-Phaser.Tile
+object
@@ -2104,7 +3593,7 @@
- setCollision(index, left, right, up, down)
+ getTileAbove(layer, x, y)
@@ -2112,7 +3601,808 @@
-
Sets collision values on a tile in the set.
+
Gets the tile above the tile coordinates given.
+Mostly used as an internal function by calculateFaces.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ layer
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ The local layer index to get the tile from. Can be determined by Tilemap.getLayer().
+
+
+
+
+
+
+ x
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ The x coordinate to get the tile from. In tiles, not pixels.
+
+
+
+
+
+
+ y
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ The y coordinate to get the tile from. In tiles, not pixels.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ getTileBelow(layer, x, y)
+
+
+
+
+
+
+
+
Gets the tile below the tile coordinates given.
+Mostly used as an internal function by calculateFaces.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ layer
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ The local layer index to get the tile from. Can be determined by Tilemap.getLayer().
+
+
+
+
+
+
+ x
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ The x coordinate to get the tile from. In tiles, not pixels.
+
+
+
+
+
+
+ y
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ The y coordinate to get the tile from. In tiles, not pixels.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ getTileLeft(layer, x, y)
+
+
+
+
+
+
+
+
Gets the tile to the left of the tile coordinates given.
+Mostly used as an internal function by calculateFaces.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ layer
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ The local layer index to get the tile from. Can be determined by Tilemap.getLayer().
+
+
+
+
+
+
+ x
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ The x coordinate to get the tile from. In tiles, not pixels.
+
+
+
+
+
+
+ y
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ The y coordinate to get the tile from. In tiles, not pixels.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ getTileRight(layer, x, y)
+
+
+
+
+
+
+
+
Gets the tile to the right of the tile coordinates given.
+Mostly used as an internal function by calculateFaces.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ layer
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ The local layer index to get the tile from. Can be determined by Tilemap.getLayer().
+
+
+
+
+
+
+ x
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ The x coordinate to get the tile from. In tiles, not pixels.
+
+
+
+
+
+
+ y
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ The y coordinate to get the tile from. In tiles, not pixels.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ getTilesetIndex(name) → {number}
+
+
+
+
+
+
+
+
Gets the tileset index based on its name.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ name
+
+
+
+
+
+string
+
+
+
+
+
+
+
+
+
+ The name of the tileset to get.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+
+
+
The index of the tileset in this tilemap, or null if not found.
+
+
+
+
+
+
+ Type
+
+
+
+number
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ getTileX(index) → {object}
+
+
+
+
+
+
+
+
Gets a Tile from this set.
@@ -2166,98 +4456,6 @@
-
-
-
- left
-
-
-
-
-
-boolean
-
-
-
-
-
-
-
-
-
- Should the tile collide on the left?
-
-
-
-
-
-
- right
-
-
-
-
-
-boolean
-
-
-
-
-
-
-
-
-
- Should the tile collide on the right?
-
-
-
-
-
-
- up
-
-
-
-
-
-boolean
-
-
-
-
-
-
-
-
-
- Should the tile collide on the top?
-
-
-
-
-
-
- down
-
-
-
-
-
-boolean
-
-
-
-
-
-
-
-
-
- Should the tile collide on the bottom?
-
-
-
@@ -2286,7 +4484,7 @@
Source:
@@ -2307,6 +4505,33 @@
+ Returns:
+
+
+
+
The tile object.
+ getTileX: function (index) {
+
return this.tiles[index][0];
+
+},
+
+
+
+
+
+
+ Type
+
+
+
+object
+
+
+
+
+
+
+
@@ -2314,7 +4539,7 @@
- setCollisionRange(start, stop, left, right, up, down)
+ getTileY(index) → {object}
@@ -2322,7 +4547,7 @@
-
Sets collision values on a range of tiles in the set.
+
Gets a Tile from this set.
@@ -2356,7 +4581,7 @@
- start
+ index
@@ -2372,122 +4597,7 @@
- The index to start setting the collision data on.
-
-
-
-
-
-
- stop
-
-
-
-
-
-number
-
-
-
-
-
-
-
-
-
- The index to stop setting the collision data on.
-
-
-
-
-
-
- left
-
-
-
-
-
-boolean
-
-
-
-
-
-
-
-
-
- Should the tile collide on the left?
-
-
-
-
-
-
- right
-
-
-
-
-
-boolean
-
-
-
-
-
-
-
-
-
- Should the tile collide on the right?
-
-
-
-
-
-
- up
-
-
-
-
-
-boolean
-
-
-
-
-
-
-
-
-
- Should the tile collide on the top?
-
-
-
-
-
-
- down
-
-
-
-
-
-boolean
-
-
-
-
-
-
-
-
-
- Should the tile collide on the bottom?
+ The index of the tile within the set.
@@ -2519,7 +4629,974 @@
Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+
+
+
The tile object.
+ getTileY: function (index) {
+
return this.tiles[index][1];
+
+},
+
+
+
+
+
+
+ Type
+
+
+
+object
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ setCollision(indexes, collides , layer )
+
+
+
+
+
+
+
+
Sets collision the given tile or tiles. You can pass in either a single numeric index or an array of indexes: [ 2, 3, 15, 20].
+The collides parameter controls if collision will be enabled (true) or disabled (false).
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+ Argument
+
+
+
+ Default
+
+
+ Description
+
+
+
+
+
+
+
+
+ indexes
+
+
+
+
+
+number
+|
+
+array
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Either a single tile index, or an array of tile IDs to be checked for collision.
+
+
+
+
+
+
+ collides
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ If true it will enable collision. If false it will clear collision.
+
+
+
+
+
+
+ layer
+
+
+
+
+
+number
+|
+
+string
+|
+
+Phaser.TilemapLayer
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The layer to operate on. If not given will default to this.currentLayer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ setCollisionBetween(start, stop, collides , layer )
+
+
+
+
+
+
+
+
Sets collision on a range of tiles where the tile IDs increment sequentially.
+Calling this with a start value of 10 and a stop value of 14 would set collision for tiles 10, 11, 12, 13 and 14.
+The collides parameter controls if collision will be enabled (true) or disabled (false).
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+ Argument
+
+
+
+ Default
+
+
+ Description
+
+
+
+
+
+
+
+
+ start
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The first index of the tile to be set for collision.
+
+
+
+
+
+
+ stop
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The last index of the tile to be set for collision.
+
+
+
+
+
+
+ collides
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ If true it will enable collision. If false it will clear collision.
+
+
+
+
+
+
+ layer
+
+
+
+
+
+number
+|
+
+string
+|
+
+Phaser.TilemapLayer
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The layer to operate on. If not given will default to this.currentLayer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ setCollisionByExclusion(indexes, collides , layer )
+
+
+
+
+
+
+
+
Sets collision on all tiles in the given layer, except for the IDs of those in the given array.
+The collides parameter controls if collision will be enabled (true) or disabled (false).
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+ Argument
+
+
+
+ Default
+
+
+ Description
+
+
+
+
+
+
+
+
+ indexes
+
+
+
+
+
+array
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ An array of the tile IDs to not be counted for collision.
+
+
+
+
+
+
+ collides
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ If true it will enable collision. If false it will clear collision.
+
+
+
+
+
+
+ layer
+
+
+
+
+
+number
+|
+
+string
+|
+
+Phaser.TilemapLayer
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The layer to operate on. If not given will default to this.currentLayer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <protected> setCollisionByIndex(index, collides , layer , recalculate )
+
+
+
+
+
+
+
+
Sets collision values on a tile in the set.
+You shouldn't usually call this method directly, instead use setCollision, setCollisionBetween or setCollisionByExclusion.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+ Argument
+
+
+
+ Default
+
+
+ Description
+
+
+
+
+
+
+
+
+ index
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The index of the tile on the layer.
+
+
+
+
+
+
+ collides
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ If true it will enable collision on the tile. If false it will clear collision values from the tile.
+
+
+
+
+
+
+ layer
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The layer to operate on. If not given will default to this.currentLayer.
+
+
+
+
+
+
+ recalculate
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ Recalculates the tile faces after the update.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
@@ -2682,7 +5759,565 @@
Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ setTileIndexCallback(indexes, callback, callbackContext, layer )
+
+
+
+
+
+
+
+
Sets a global collision callback for the given tile index within the layer. This will affect all tiles on this layer that have the same index.
+If a callback is already set for the tile index it will be replaced. Set the callback to null to remove it.
+If you want to set a callback for a tile at a specific location on the map then see setTileLocationCallback.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+ Argument
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ indexes
+
+
+
+
+
+number
+|
+
+array
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Either a single tile index, or an array of tile indexes to have a collision callback set for.
+
+
+
+
+
+
+ callback
+
+
+
+
+
+function
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The callback that will be invoked when the tile is collided with.
+
+
+
+
+
+
+ callbackContext
+
+
+
+
+
+object
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The context under which the callback is called.
+
+
+
+
+
+
+ layer
+
+
+
+
+
+number
+|
+
+string
+|
+
+Phaser.TilemapLayer
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+ The layer to operate on. If not given will default to this.currentLayer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ setTileLocationCallback(x, y, width, height, callback, callbackContext, layer )
+
+
+
+
+
+
+
+
Sets a global collision callback for the given tile index within the layer. This will affect all tiles on this layer that have the same index.
+If a callback is already set for the tile index it will be replaced. Set the callback to null to remove it.
+If you want to set a callback for a tile at a specific location on the map then see setTileLocationCallback.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+ Argument
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ x
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ X position of the top left of the area to copy (given in tiles, not pixels)
+
+
+
+
+
+
+ y
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Y position of the top left of the area to copy (given in tiles, not pixels)
+
+
+
+
+
+
+ width
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The width of the area to copy (given in tiles, not pixels)
+
+
+
+
+
+
+ height
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The height of the area to copy (given in tiles, not pixels)
+
+
+
+
+
+
+ callback
+
+
+
+
+
+function
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The callback that will be invoked when the tile is collided with.
+
+
+
+
+
+
+ callbackContext
+
+
+
+
+
+object
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The context under which the callback is called.
+
+
+
+
+
+
+ layer
+
+
+
+
+
+number
+|
+
+string
+|
+
+Phaser.TilemapLayer
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+ The layer to operate on. If not given will default to this.currentLayer.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
@@ -2727,13 +6362,13 @@
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:35 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:35 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Phaser.Time.html b/docs/Phaser.Time.html
index 137d9d1e..8daece68 100644
--- a/docs/Phaser.Time.html
+++ b/docs/Phaser.Time.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -572,7 +566,7 @@
- elapsed
+ <protected> elapsed
@@ -627,7 +621,7 @@
- Elapsed time since the last frame.
+ Elapsed time since the last frame (in ms).
@@ -656,7 +650,7 @@
Source:
@@ -674,7 +668,109 @@
- fps
+ events
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ events
+
+
+
+
+
+Phaser.Timer
+
+
+
+
+
+
+
+
+
+ This is a Phaser.Timer object bound to the master clock to which you can add timed events.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <protected> fps
@@ -758,7 +854,7 @@
Source:
@@ -860,7 +956,7 @@
Source:
@@ -962,7 +1058,7 @@
Source:
@@ -1064,7 +1160,7 @@
Source:
@@ -1268,7 +1364,7 @@
Source:
@@ -1370,7 +1466,7 @@
Source:
@@ -1475,7 +1571,7 @@
Source:
@@ -1493,7 +1589,7 @@
- now
+ <protected> now
@@ -1577,7 +1673,7 @@
Source:
@@ -1595,7 +1691,7 @@
- pausedTime
+ <protected> pausedTime
@@ -1679,7 +1775,7 @@
Source:
@@ -1781,7 +1877,7 @@
Source:
@@ -1883,7 +1979,7 @@
Source:
@@ -1901,7 +1997,7 @@
- time
+ <protected> time
@@ -1956,7 +2052,7 @@
- Game time counter.
+ Game time counter. If you need a value for in-game calculation please use Phaser.Time.now instead.
@@ -1985,7 +2081,7 @@
Source:
@@ -2087,7 +2183,7 @@
Source:
@@ -2110,6 +2206,232 @@
+
+ boot()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Creates a new stand-alone Phaser.Timer object.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+ Argument
+
+
+
+ Default
+
+
+ Description
+
+
+
+
+
+
+
+
+ autoDestroy
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ A Timer that is set to automatically destroy itself will do so after all of its events have been dispatched (assuming no looping events).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+
+
+
The Timer object that was created.
+
+
+
+
+
+
+ Type
+
+
+
+Phaser.Timer
+
+
+
+
+
+
+
+
+
+
+
+
+
elapsedSecondsSince(since) → {number}
@@ -2201,7 +2523,7 @@
Source:
@@ -2342,7 +2664,7 @@
Source:
@@ -2388,6 +2710,75 @@
+
+
+
+
+
+ removeAll()
+
+
+
+
+
+
+
+
Remove all Timer objects, regardless of their state.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -2434,7 +2825,7 @@
Source:
@@ -2503,7 +2894,7 @@
Source:
@@ -2640,7 +3031,7 @@
Source:
@@ -2685,13 +3076,13 @@
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:35 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:36 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Phaser.Timer.html b/docs/Phaser.Timer.html
index fce8ebce..0457fc84 100644
--- a/docs/Phaser.Timer.html
+++ b/docs/Phaser.Timer.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -427,7 +421,7 @@
Timer
-
+ A Timer is a way to create small re-usable or disposable objects that do nothing but wait for a specific moment in time, and then dispatch an event.
@@ -438,7 +432,7 @@
- new Timer(game)
+ new Timer(game, autoDestroy )
@@ -446,7 +440,9 @@
-
Timer constructor.
+
A Timer is a way to create small re-usable or disposable objects that do nothing but wait for a specific moment in time, and then dispatch an event.
+You can add as many events to a Timer as you like, each with their own delays. A Timer uses milliseconds as its unit of time. There are 1000 ms in 1 second.
+So if you want to fire an event every quarter of a second you'd need to set the delay to 250.
@@ -468,8 +464,12 @@
Type
+ Argument
+
+ Default
+
Description
@@ -493,13 +493,64 @@
+
+
+
+
+
+
+
+
+
+
+
+
A reference to the currently running game.
+
+
+
+ autoDestroy
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ A Timer that is set to automatically destroy itself will do so after all of its events have been dispatched (assuming no looping events).
+
+
+
@@ -528,7 +579,7 @@
Source:
@@ -571,6 +622,657 @@
+
+ <static, constant> HALF :number
+
+
+
+
+
+
+
+ Type:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <static, constant> MINUTE :number
+
+
+
+
+
+
+
+ Type:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <static, constant> QUARTER :number
+
+
+
+
+
+
+
+ Type:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <static, constant> SECOND :number
+
+
+
+
+
+
+
+ Type:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ autoDestroy
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ autoDestroy
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+
+ A Timer that is set to automatically destroy itself will do so after all of its events have been dispatched (assuming no looping events).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <readonly> duration
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ duration
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ The duration in ms remaining until the next event will occur.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ events
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ events
+
+
+
+
+
+array.<Phaser.TimerEvent >
+
+
+
+
+
+
+
+
+
+ An array holding all of this timers Phaser.TimerEvent objects. Use the methods add, repeat and loop to populate it.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <readonly> expired
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ expired
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+
+ An expired Timer is one in which all of its events have been dispatched and none are pending.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Default Value:
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
game
@@ -656,7 +1358,829 @@
Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <readonly> length
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ length
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ The number of pending events in the queue.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <readonly> ms
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ ms
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ The duration in milliseconds that this Timer has been running for.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <readonly> next
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ next
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ The time at which the next event will occur.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <protected, readonly> nextTick
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ nextTick
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ The time the next tick will occur.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ onComplete
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ onComplete
+
+
+
+
+
+Phaser.Signal
+
+
+
+
+
+
+
+
+
+ This signal will be dispatched when this Timer has completed, meaning there are no more events in the queue.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <readonly> paused
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ paused
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+
+ The paused state of the Timer. You can pause the timer by calling Timer.pause() and Timer.resume() or by the game pausing.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Default Value:
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ running
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ running
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+
+ True if the Timer is actively running. Do not switch this boolean, if you wish to pause the timer then use Timer.pause() instead.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Default Value:
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <readonly> seconds
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ seconds
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ The duration in seconds that this Timer has been running for.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
@@ -675,6 +2199,1529 @@
+ Methods
+
+
+
+
+ add(delay, callback, callbackContext, arguments) → {Phaser.TimerEvent }
+
+
+
+
+
+
+
+
Adds a new Event to this Timer. The event will fire after the given amount of 'delay' in milliseconds has passed, once the Timer has started running.
+Call Timer.start() once you have added all of the Events you require for this Timer. The delay is in relation to when the Timer starts, not the time it was added.
+If the Timer is already running the delay will be calculated based on the timers current time.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+ Argument
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ delay
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The number of milliseconds that should elapse before the Timer will call the given callback.
+
+
+
+
+
+
+ callback
+
+
+
+
+
+function
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The callback that will be called when the Timer event occurs.
+
+
+
+
+
+
+ callbackContext
+
+
+
+
+
+object
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The context in which the callback will be called.
+
+
+
+
+
+
+ arguments
+
+
+
+
+
+*
+
+
+
+
+
+
+
+
+
+
+
+
+ <repeatable>
+
+
+
+
+
+
+ The values to be sent to your callback function when it is called.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+
+
+
The Phaser.TimerEvent object that was created.
+
+
+
+
+
+
+ Type
+
+
+
+Phaser.TimerEvent
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ destroy()
+
+
+
+
+
+
+
+
Destroys this Timer. Events are not dispatched.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ loop(delay, callback, callbackContext, arguments) → {Phaser.TimerEvent }
+
+
+
+
+
+
+
+
Adds a new looped Event to this Timer that will repeat forever or until the Timer is stopped.
+The event will fire after the given amount of 'delay' milliseconds has passed once the Timer has started running.
+Call Timer.start() once you have added all of the Events you require for this Timer. The delay is in relation to when the Timer starts, not the time it was added.
+If the Timer is already running the delay will be calculated based on the timers current time.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+ Argument
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ delay
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The number of milliseconds that should elapse before the Timer will call the given callback.
+
+
+
+
+
+
+ callback
+
+
+
+
+
+function
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The callback that will be called when the Timer event occurs.
+
+
+
+
+
+
+ callbackContext
+
+
+
+
+
+object
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The context in which the callback will be called.
+
+
+
+
+
+
+ arguments
+
+
+
+
+
+*
+
+
+
+
+
+
+
+
+
+
+
+
+ <repeatable>
+
+
+
+
+
+
+ The values to be sent to your callback function when it is called.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+
+
+
The Phaser.TimerEvent object that was created.
+
+
+
+
+
+
+ Type
+
+
+
+Phaser.TimerEvent
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ order()
+
+
+
+
+
+
+
+
Orders the events on this Timer so they are in tick order. This is called automatically when new events are created.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ pause()
+
+
+
+
+
+
+
+
Pauses the Timer and all events in the queue.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ remove(event)
+
+
+
+
+
+
+
+
Removes a pending TimerEvent from the queue.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ event
+
+
+
+
+
+Phaser.TimerEvent
+
+
+
+
+
+
+
+
+
+ The event to remove from the queue.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ repeat(delay, repeatCount, callback, callbackContext, arguments) → {Phaser.TimerEvent }
+
+
+
+
+
+
+
+
Adds a new Event to this Timer that will repeat for the given number of iterations.
+The event will fire after the given amount of 'delay' milliseconds has passed once the Timer has started running.
+Call Timer.start() once you have added all of the Events you require for this Timer. The delay is in relation to when the Timer starts, not the time it was added.
+If the Timer is already running the delay will be calculated based on the timers current time.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+ Argument
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ delay
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The number of milliseconds that should elapse before the Timer will call the given callback.
+
+
+
+
+
+
+ repeatCount
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The number of times the event will repeat.
+
+
+
+
+
+
+ callback
+
+
+
+
+
+function
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The callback that will be called when the Timer event occurs.
+
+
+
+
+
+
+ callbackContext
+
+
+
+
+
+object
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The context in which the callback will be called.
+
+
+
+
+
+
+ arguments
+
+
+
+
+
+*
+
+
+
+
+
+
+
+
+
+
+
+
+ <repeatable>
+
+
+
+
+
+
+ The values to be sent to your callback function when it is called.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+
+
+
The Phaser.TimerEvent object that was created.
+
+
+
+
+
+
+ Type
+
+
+
+Phaser.TimerEvent
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ resume()
+
+
+
+
+
+
+
+
Resumes the Timer and updates all pending events.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <protected> sortHandler()
+
+
+
+
+
+
+
+
Sort handler used by Phaser.Timer.order.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ start()
+
+
+
+
+
+
+
+
Starts this Timer running.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ stop()
+
+
+
+
+
+
+
+
Stops this Timer from running. Does not cause it to be destroyed if autoDestroy is set to true.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <protected> update(time) → {boolean}
+
+
+
+
+
+
+
+
The main Timer update event, called automatically by the Game clock.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ time
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ The time from the core game clock.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+
+
+
True if there are still events waiting to be dispatched, otherwise false if this Timer can be destroyed.
+
+
+
+
+
+
+ Type
+
+
+
+boolean
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -693,13 +3740,13 @@
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:35 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:36 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Phaser.TimerEvent.html b/docs/Phaser.TimerEvent.html
new file mode 100644
index 00000000..ca35f0e0
--- /dev/null
+++ b/docs/Phaser.TimerEvent.html
@@ -0,0 +1,1616 @@
+
+
+
+
+
+ Phaser Class: TimerEvent
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Class: TimerEvent
+
+
+
+
+
+
+
+
+
+
+
+ new TimerEvent(timer, delay, tick, repeatCount, loop, callback, callbackContext, arguments)
+
+
+
+
+
+
+
+
A TimerEvent is a single event that is processed by a Phaser.Timer. It consists of a delay, which is a value in milliseconds after which the event will fire.
+It can call a specific callback, passing in optional parameters.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ timer
+
+
+
+
+
+Phaser.Timer
+
+
+
+
+
+
+
+
+
+ The Timer object that this TimerEvent belongs to.
+
+
+
+
+
+
+ delay
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ The delay in ms at which this TimerEvent fires.
+
+
+
+
+
+
+ tick
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ The tick is the next game clock time that this event will fire at.
+
+
+
+
+
+
+ repeatCount
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ If this TimerEvent repeats it will do so this many times.
+
+
+
+
+
+
+ loop
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+
+ True if this TimerEvent loops, otherwise false.
+
+
+
+
+
+
+ callback
+
+
+
+
+
+function
+
+
+
+
+
+
+
+
+
+ The callback that will be called when the TimerEvent occurs.
+
+
+
+
+
+
+ callbackContext
+
+
+
+
+
+object
+
+
+
+
+
+
+
+
+
+ The context in which the callback will be called.
+
+
+
+
+
+
+ arguments
+
+
+
+
+
+array
+
+
+
+
+
+
+
+
+
+ The values to be passed to the callback.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Members
+
+
+
+
+ args
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ arguments
+
+
+
+
+
+array
+
+
+
+
+
+
+
+
+
+ The values to be passed to the callback.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ callback
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ callback
+
+
+
+
+
+function
+
+
+
+
+
+
+
+
+
+ The callback that will be called when the TimerEvent occurs.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ callbackContext
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ callbackContext
+
+
+
+
+
+object
+
+
+
+
+
+
+
+
+
+ The context in which the callback will be called.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ delay
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ delay
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ The delay in ms at which this TimerEvent fires.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ loop
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ loop
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+
+ True if this TimerEvent loops, otherwise false.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ repeatCount
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ repeatCount
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ If this TimerEvent repeats it will do so this many times.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ tick
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ tick
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ The tick is the next game clock time that this event will fire at.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ timer
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ timer
+
+
+
+
+
+Phaser.Timer
+
+
+
+
+
+
+
+
+
+ The Timer object that this TimerEvent belongs to.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
+
+
+
+
+ Documentation generated by JSDoc 3.3.0-dev
+ on Wed Feb 05 2014 06:28:36 GMT-0000 (GMT) using the DocStrap template .
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/Phaser.Touch.html b/docs/Phaser.Touch.html
index f91cd182..0bcca464 100644
--- a/docs/Phaser.Touch.html
+++ b/docs/Phaser.Touch.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -831,7 +825,7 @@
- The browser touch event.
+ The browser touch DOM event. Will be set to null if no touch event has ever been received.
@@ -856,11 +850,14 @@
+ Default Value:
+
+
Source:
@@ -1744,7 +1741,7 @@
Source:
@@ -1863,7 +1860,7 @@ Occurs for example on iOS when you put down 4 fingers and the app selector UI ap
Source:
@@ -1981,7 +1978,7 @@ Occurs for example on iOS when you put down 4 fingers and the app selector UI ap
Source:
@@ -2100,7 +2097,7 @@ Doesn't appear to be supported by most browsers on a canvas element yet.
Source:
@@ -2219,7 +2216,7 @@ Doesn't appear to be supported by most browsers on a canvas element yet.
Source:
@@ -2337,7 +2334,7 @@ Doesn't appear to be supported by most browsers on a canvas element yet.
Source:
@@ -2455,7 +2452,7 @@ Doesn't appear to be supported by most browsers on a canvas element yet.
Source:
@@ -2524,7 +2521,7 @@ Doesn't appear to be supported by most browsers on a canvas element yet.
Source:
@@ -2593,7 +2590,7 @@ Doesn't appear to be supported by most browsers on a canvas element yet.
Source:
@@ -2638,13 +2635,13 @@ Doesn't appear to be supported by most browsers on a canvas element yet.
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:35 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:36 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Phaser.Tween.html b/docs/Phaser.Tween.html
index c5c498ce..1730684c 100644
--- a/docs/Phaser.Tween.html
+++ b/docs/Phaser.Tween.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -753,7 +747,7 @@ Create a new <code>Tween</code>.
- Description.
+ If the tween is running this is set to true, otherwise false. Tweens that are in a delayed state, waiting to start, are considered as being running.
@@ -785,7 +779,7 @@ Create a new <code>Tween</code>.
Source:
@@ -858,7 +852,7 @@ Create a new <code>Tween</code>.
- Description.
+ The onComplete event is fired when the Tween completes. Does not fire if the Tween is set to loop.
@@ -887,7 +881,109 @@ Create a new <code>Tween</code>.
Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ onLoop
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ onLoop
+
+
+
+
+
+Phaser.Signal
+
+
+
+
+
+
+
+
+
+ The onLoop event is fired if the Tween loops.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
@@ -960,7 +1056,7 @@ Create a new <code>Tween</code>.
- Description.
+ The onStart event is fired when the Tween begins.
@@ -989,7 +1085,7 @@ Create a new <code>Tween</code>.
Source:
@@ -1094,7 +1190,7 @@ Create a new <code>Tween</code>.
Source:
@@ -1160,7 +1256,7 @@ You can pass as many tweens as you like to this function, they will each be chai
Source:
@@ -1301,7 +1397,7 @@ You can pass as many tweens as you like to this function, they will each be chai
Source:
@@ -1442,7 +1538,7 @@ You can pass as many tweens as you like to this function, they will each be chai
Source:
@@ -1501,7 +1597,8 @@ You can pass as many tweens as you like to this function, they will each be chai
-
Set interpolation function the tween will use, by default it uses Phaser.Math.linearInterpolation.
+
Set interpolation function the tween will use, by default it uses Phaser.Math.linearInterpolation.
+Also available: Phaser.Math.bezierInterpolation and Phaser.Math.catmullRomInterpolation.
@@ -1583,7 +1680,7 @@ You can pass as many tweens as you like to this function, they will each be chai
Source:
@@ -1681,289 +1778,7 @@ game.add.tween(p).to({ x: 700 }, 1000, Phaser.Easing.Linear.None, true)
Source:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Returns:
-
-
-
-
-
-
-
-
- Type
-
-
-
-Phaser.Tween
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- onCompleteCallback(callback) → {Phaser.Tween }
-
-
-
-
-
-
-
-
Sets a callback to be fired when the tween completes. Note: callback will be called in the context of the global scope.
-
-
-
-
-
-
-
-
- Parameters:
-
-
-
-
-
-
- Name
-
-
- Type
-
-
-
-
-
- Description
-
-
-
-
-
-
-
-
- callback
-
-
-
-
-
-function
-
-
-
-
-
-
-
-
-
- The callback to invoke on completion.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Source:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Returns:
-
-
-
-
-
-
-
-
- Type
-
-
-
-Phaser.Tween
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- onStartCallback(callback) → {Phaser.Tween }
-
-
-
-
-
-
-
-
Sets a callback to be fired when the tween starts. Note: callback will be called in the context of the global scope.
-
-
-
-
-
-
-
-
- Parameters:
-
-
-
-
-
-
- Name
-
-
- Type
-
-
-
-
-
- Description
-
-
-
-
-
-
-
-
- callback
-
-
-
-
-
-function
-
-
-
-
-
-
-
-
-
- The callback to invoke on start.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Source:
-
@@ -2104,7 +1919,7 @@ game.add.tween(p).to({ x: 700 }, 1000, Phaser.Easing.Linear.None, true)
Source:
@@ -2196,7 +2011,7 @@ game.add.tween(p).to({ x: 700 }, 1000, Phaser.Easing.Linear.None, true)
Source:
@@ -2314,7 +2129,7 @@ game.add.tween(p).to({ x: 700 }, 1000, Phaser.Easing.Linear.None, true)
Source:
@@ -2406,7 +2221,7 @@ game.add.tween(p).to({ x: 700 }, 1000, Phaser.Easing.Linear.None, true)
Source:
@@ -2475,7 +2290,7 @@ game.add.tween(p).to({ x: 700 }, 1000, Phaser.Easing.Linear.None, true)
Source:
@@ -2567,7 +2382,7 @@ game.add.tween(p).to({ x: 700 }, 1000, Phaser.Easing.Linear.None, true)
Source:
@@ -2618,7 +2433,7 @@ game.add.tween(p).to({ x: 700 }, 1000, Phaser.Easing.Linear.None, true)
- to(properties, duration, ease, autoStart, delay, repeat, yoyo) → {Phaser.Tween }
+ to(properties, duration , ease , autoStart , delay , repeat , yoyo ) → {Phaser.Tween }
@@ -2648,8 +2463,12 @@ game.add.tween(p).to({ x: 700 }, 1000, Phaser.Easing.Linear.None, true)
Type
+ Argument
+
+ Default
+
Description
@@ -2673,7 +2492,19 @@ game.add.tween(p).to({ x: 700 }, 1000, Phaser.Easing.Linear.None, true)
+
+
+
+
+
+
+
+
+
+
+
+
Properties you want to tween.
@@ -2696,10 +2527,26 @@ game.add.tween(p).to({ x: 700 }, 1000, Phaser.Easing.Linear.None, true)
+
+
+ <optional>
+
+
+
+
+
- Duration of this tween.
+
+
+
+ 1000
+
+
+
+
+ Duration of this tween in ms.
@@ -2719,10 +2566,26 @@ game.add.tween(p).to({ x: 700 }, 1000, Phaser.Easing.Linear.None, true)
+
+
+ <optional>
+
+
+
+
+
- Easing function.
+
+
+
+ null
+
+
+
+
+ Easing function. If not set it will default to Phaser.Easing.Linear.None.
@@ -2742,7 +2605,23 @@ game.add.tween(p).to({ x: 700 }, 1000, Phaser.Easing.Linear.None, true)
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+ false
+
+
Whether this tween will start automatically or not.
@@ -2765,10 +2644,26 @@ game.add.tween(p).to({ x: 700 }, 1000, Phaser.Easing.Linear.None, true)
+
+
+ <optional>
+
+
+
+
+
- Delay before this tween will start, defaults to 0 (no delay).
+
+
+
+ 0
+
+
+
+
+ Delay before this tween will start, defaults to 0 (no delay). Value given is in ms.
@@ -2788,7 +2683,23 @@ game.add.tween(p).to({ x: 700 }, 1000, Phaser.Easing.Linear.None, true)
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+ 0
+
+
Should the tween automatically restart once complete? (ignores any chained tweens).
@@ -2804,17 +2715,33 @@ game.add.tween(p).to({ x: 700 }, 1000, Phaser.Easing.Linear.None, true)
-Phaser.Tween
+boolean
+
+
+ <optional>
+
+
+
+
+
- Description.
+
+
+
+ false
+
+
+
+
+ A tween that yoyos will reverse itself when it completes.
@@ -2846,7 +2773,7 @@ game.add.tween(p).to({ x: 700 }, 1000, Phaser.Easing.Linear.None, true)
Source:
@@ -2871,7 +2798,7 @@ game.add.tween(p).to({ x: 700 }, 1000, Phaser.Easing.Linear.None, true)
-
Itself.
+
This Tween object.
@@ -2987,7 +2914,7 @@ game.add.tween(p).to({ x: 700 }, 1000, Phaser.Easing.Linear.None, true)
Source:
@@ -3129,7 +3056,7 @@ Used in combination with repeat you can create endless loops.
Source:
@@ -3197,13 +3124,13 @@ Used in combination with repeat you can create endless loops.
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:35 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:36 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Phaser.TweenManager.html b/docs/Phaser.TweenManager.html
index c78babfb..93737650 100644
--- a/docs/Phaser.TweenManager.html
+++ b/docs/Phaser.TweenManager.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -670,115 +664,6 @@ Please see https://github.com/sole/tw
-
-
-
-
-
-
-
-
-
- REVISION
-
-
-
-
-
-
-
Version number of this library.
-
-
-
-
-
-
-
-
-
- Properties:
-
-
-
-
-
-
-
- Name
-
-
- Type
-
-
-
-
-
- Description
-
-
-
-
-
-
-
-
- REVISION
-
-
-
-
-
-string
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Default Value:
-
-
-
-
- Source:
-
-
-
-
-
-
-
-
@@ -884,7 +769,7 @@ Please see https://github.com/sole/tw
Source:
@@ -1025,7 +910,7 @@ Please see https://github.com/sole/tw
Source:
@@ -1117,7 +1002,7 @@ Please see https://github.com/sole/tw
Source:
@@ -1258,7 +1143,7 @@ Please see https://github.com/sole/tw
Source:
@@ -1399,7 +1284,7 @@ Please see https://github.com/sole/tw
Source:
@@ -1435,7 +1320,7 @@ Please see https://github.com/sole/tw
-
Remove all tween objects.
+
Remove all tweens running and in the queue. Doesn't call any of the tween onComplete events.
@@ -1468,7 +1353,7 @@ Please see https://github.com/sole/tw
Source:
@@ -1537,7 +1422,7 @@ Please see https://github.com/sole/tw
Source:
@@ -1606,7 +1491,7 @@ Please see https://github.com/sole/tw
Source:
@@ -1698,7 +1583,7 @@ Please see https://github.com/sole/tw
Source:
@@ -1743,13 +1628,13 @@ Please see https://github.com/sole/tw
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:35 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:36 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Phaser.Utils.Debug.html b/docs/Phaser.Utils.Debug.html
index 0159e5d0..f4c4033c 100644
--- a/docs/Phaser.Utils.Debug.html
+++ b/docs/Phaser.Utils.Debug.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -572,6 +566,108 @@ your game set to use Phaser.AUTO then swap it for Phaser.CANVAS to ensure WebGL
+
+ columnWidth
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ columnWidth
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ The spacing between columns.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
context
@@ -762,7 +858,7 @@ your game set to use Phaser.AUTO then swap it for Phaser.CANVAS to ensure WebGL
Source:
@@ -867,7 +963,7 @@ your game set to use Phaser.AUTO then swap it for Phaser.CANVAS to ensure WebGL
Source:
@@ -972,7 +1068,7 @@ your game set to use Phaser.AUTO then swap it for Phaser.CANVAS to ensure WebGL
Source:
@@ -1281,7 +1377,7 @@ your game set to use Phaser.AUTO then swap it for Phaser.CANVAS to ensure WebGL
Source:
@@ -1383,7 +1479,7 @@ your game set to use Phaser.AUTO then swap it for Phaser.CANVAS to ensure WebGL
Source:
@@ -1407,7 +1503,7 @@ your game set to use Phaser.AUTO then swap it for Phaser.CANVAS to ensure WebGL
- line(text, x, y)
+ line(text, x , y )
@@ -1437,6 +1533,8 @@ your game set to use Phaser.AUTO then swap it for Phaser.CANVAS to ensure WebGL
Type
+ Argument
+
@@ -1462,6 +1560,14 @@ your game set to use Phaser.AUTO then swap it for Phaser.CANVAS to ensure WebGL
+
+
+
+
+
+
+
+
@@ -1485,6 +1591,16 @@ your game set to use Phaser.AUTO then swap it for Phaser.CANVAS to ensure WebGL
+
+
+ <optional>
+
+
+
+
+
+
+
@@ -1508,6 +1624,16 @@ your game set to use Phaser.AUTO then swap it for Phaser.CANVAS to ensure WebGL
+
+
+ <optional>
+
+
+
+
+
+
+
@@ -1543,7 +1669,250 @@ your game set to use Phaser.AUTO then swap it for Phaser.CANVAS to ensure WebGL
Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ renderBodyInfo(sprite, x, y, color )
+
+
+
+
+
+
+
+
Render Sprite Body Physics Data as text.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+ Argument
+
+
+
+ Default
+
+
+ Description
+
+
+
+
+
+
+
+
+ sprite
+
+
+
+
+
+Phaser.Sprite
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The sprite to be rendered.
+
+
+
+
+
+
+ x
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ X position of the debug info to be rendered.
+
+
+
+
+
+
+ y
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Y position of the debug info to be rendered.
+
+
+
+
+
+
+ color
+
+
+
+
+
+string
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ 'rgb(255,255,255)'
+
+
+
+
+ color of the debug info to be rendered. (format is css color string).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
@@ -1786,7 +2155,7 @@ your game set to use Phaser.AUTO then swap it for Phaser.CANVAS to ensure WebGL
Source:
@@ -1947,7 +2316,7 @@ your game set to use Phaser.AUTO then swap it for Phaser.CANVAS to ensure WebGL
Source:
@@ -2155,7 +2524,7 @@ your game set to use Phaser.AUTO then swap it for Phaser.CANVAS to ensure WebGL
Source:
@@ -2183,7 +2552,7 @@ your game set to use Phaser.AUTO then swap it for Phaser.CANVAS to ensure WebGL
-
+ renderLine(line, color )
@@ -2191,7 +2560,7 @@ your game set to use Phaser.AUTO then swap it for Phaser.CANVAS to ensure WebGL
-
Render the Local Transform information of the given Sprite.
+
Renders a Line object in the given color.
@@ -2229,13 +2598,13 @@ your game set to use Phaser.AUTO then swap it for Phaser.CANVAS to ensure WebGL
- sprite
+ line
-Phaser.Sprite
+Phaser.Line
@@ -2257,7 +2626,180 @@ your game set to use Phaser.AUTO then swap it for Phaser.CANVAS to ensure WebGL
- Description.
+ The Line to render.
+
+
+
+
+
+
+ color
+
+
+
+
+
+string
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ 'rgb(255,255,255)'
+
+
+
+
+ color of the debug info to be rendered. (format is css color string).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ renderLineInfo(line, x, y, color )
+
+
+
+
+
+
+
+
Renders Line information in the given color.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+ Argument
+
+
+
+ Default
+
+
+ Description
+
+
+
+
+
+
+
+
+ line
+
+
+
+
+
+Phaser.Line
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The Line to render.
@@ -2398,7 +2940,176 @@ your game set to use Phaser.AUTO then swap it for Phaser.CANVAS to ensure WebGL
Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ renderPhysicsBody(body, color )
+
+
+
+
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+ Argument
+
+
+
+ Default
+
+
+ Description
+
+
+
+
+
+
+
+
+ body
+
+
+
+
+
+array
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ color
+
+
+
+
+
+string
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ 'rgb(255,255,255)'
+
+
+
+
+ The color the polygon is stroked in.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
@@ -2590,7 +3301,7 @@ your game set to use Phaser.AUTO then swap it for Phaser.CANVAS to ensure WebGL
Source:
@@ -2751,7 +3462,7 @@ your game set to use Phaser.AUTO then swap it for Phaser.CANVAS to ensure WebGL
Source:
@@ -3041,7 +3752,7 @@ your game set to use Phaser.AUTO then swap it for Phaser.CANVAS to ensure WebGL
Source:
@@ -3284,7 +3995,176 @@ your game set to use Phaser.AUTO then swap it for Phaser.CANVAS to ensure WebGL
Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ renderPolygon(polygon, color )
+
+
+
+
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+ Argument
+
+
+
+ Default
+
+
+ Description
+
+
+
+
+
+
+
+
+ polygon
+
+
+
+
+
+array
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ color
+
+
+
+
+
+string
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ 'rgb(255,255,255)'
+
+
+
+
+ The color the polygon is stroked in.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
@@ -3425,7 +4305,7 @@ your game set to use Phaser.AUTO then swap it for Phaser.CANVAS to ensure WebGL
Source:
@@ -3586,7 +4466,7 @@ your game set to use Phaser.AUTO then swap it for Phaser.CANVAS to ensure WebGL
Source:
@@ -3829,168 +4709,7 @@ your game set to use Phaser.AUTO then swap it for Phaser.CANVAS to ensure WebGL
Source:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- renderSpriteBody(sprite, color )
-
-
-
-
-
-
-
-
Renders just the Sprite.body bounds.
-
-
-
-
-
-
-
-
- Parameters:
-
-
-
-
-
-
- Name
-
-
- Type
-
-
- Argument
-
-
-
-
- Description
-
-
-
-
-
-
-
-
- sprite
-
-
-
-
-
-Phaser.Sprite
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Description.
-
-
-
-
-
-
- color
-
-
-
-
-
-string
-
-
-
-
-
-
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
- Color of the debug info to be rendered (format is css color string).
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Source:
-
@@ -4200,7 +4919,7 @@ your game set to use Phaser.AUTO then swap it for Phaser.CANVAS to ensure WebGL
Source:
@@ -4228,7 +4947,7 @@ your game set to use Phaser.AUTO then swap it for Phaser.CANVAS to ensure WebGL
- renderSpriteCollision(sprite, x, y, color )
+ renderSpriteBounds(sprite, color , fill )
@@ -4236,7 +4955,7 @@ your game set to use Phaser.AUTO then swap it for Phaser.CANVAS to ensure WebGL
-
Render Sprite collision.
+
Renders just the full Sprite bounds.
@@ -4302,7 +5021,217 @@ your game set to use Phaser.AUTO then swap it for Phaser.CANVAS to ensure WebGL
- The sprite to be rendered.
+ Description.
+
+
+
+
+
+
+ color
+
+
+
+
+
+string
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Color of the debug info to be rendered (format is css color string).
+
+
+
+
+
+
+ fill
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ false
+
+
+
+
+ If false the bounds outline is rendered, if true the whole rectangle is rendered.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ renderSpriteCoords(line, x, y, color )
+
+
+
+
+
+
+
+
Renders the sprite coordinates in local, positional and world space.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+ Argument
+
+
+
+ Default
+
+
+ Description
+
+
+
+
+
+
+
+
+ line
+
+
+
+
+
+Phaser.Sprite
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The sprite to inspect.
@@ -4443,7 +5372,7 @@ your game set to use Phaser.AUTO then swap it for Phaser.CANVAS to ensure WebGL
Source:
@@ -4694,7 +5623,7 @@ your game set to use Phaser.AUTO then swap it for Phaser.CANVAS to ensure WebGL
Source:
@@ -4937,7 +5866,7 @@ your game set to use Phaser.AUTO then swap it for Phaser.CANVAS to ensure WebGL
Source:
@@ -5180,7 +6109,7 @@ your game set to use Phaser.AUTO then swap it for Phaser.CANVAS to ensure WebGL
Source:
@@ -5434,7 +6363,7 @@ your game set to use Phaser.AUTO then swap it for Phaser.CANVAS to ensure WebGL
Source:
@@ -5462,7 +6391,7 @@ your game set to use Phaser.AUTO then swap it for Phaser.CANVAS to ensure WebGL
-
+ splitline(text)
@@ -5470,7 +6399,125 @@ your game set to use Phaser.AUTO then swap it for Phaser.CANVAS to ensure WebGL
-
Render the World Transform information of the given Sprite.
+
Internal method that outputs a single line of text split over as many columns as needed, one per parameter.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ text
+
+
+
+
+
+string
+
+
+
+
+
+
+
+
+
+ The text to render. You can have as many columns of text as you want, just pass them as additional parameters.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ start(x , y , color , columnWidth )
+
+
+
+
+
+
+
+
Internal method that resets and starts the debug output values.
@@ -5506,41 +6553,6 @@ your game set to use Phaser.AUTO then swap it for Phaser.CANVAS to ensure WebGL
-
-
- sprite
-
-
-
-
-
-Phaser.Sprite
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Description.
-
-
-
-
x
@@ -5558,6 +6570,8 @@ your game set to use Phaser.AUTO then swap it for Phaser.CANVAS to ensure WebGL
+ <optional>
+
@@ -5568,10 +6582,12 @@ your game set to use Phaser.AUTO then swap it for Phaser.CANVAS to ensure WebGL
+ 0
+
- X position of the debug info to be rendered.
+ The X value the debug info will start from.
@@ -5593,6 +6609,8 @@ your game set to use Phaser.AUTO then swap it for Phaser.CANVAS to ensure WebGL
+ <optional>
+
@@ -5603,10 +6621,12 @@ your game set to use Phaser.AUTO then swap it for Phaser.CANVAS to ensure WebGL
+ 0
+
- Y position of the debug info to be rendered.
+ The Y value the debug info will start from.
@@ -5645,7 +6665,46 @@ your game set to use Phaser.AUTO then swap it for Phaser.CANVAS to ensure WebGL
- color of the debug info to be rendered. (format is css color string).
+ The color the debug text will drawn in.
+
+
+
+
+
+
+ columnWidth
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ 0
+
+
+
+
+ The spacing between columns.
@@ -5677,171 +6736,7 @@ your game set to use Phaser.AUTO then swap it for Phaser.CANVAS to ensure WebGL
Source:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- start(x, y, color)
-
-
-
-
-
-
-
-
Internal method that resets and starts the debug output values.
-
-
-
-
-
-
-
-
- Parameters:
-
-
-
-
-
-
- Name
-
-
- Type
-
-
-
-
-
- Description
-
-
-
-
-
-
-
-
- x
-
-
-
-
-
-number
-
-
-
-
-
-
-
-
-
- The X value the debug info will start from.
-
-
-
-
-
-
- y
-
-
-
-
-
-number
-
-
-
-
-
-
-
-
-
- The Y value the debug info will start from.
-
-
-
-
-
-
- color
-
-
-
-
-
-string
-
-
-
-
-
-
-
-
-
- The color the debug info will drawn in.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Source:
-
@@ -5910,7 +6805,7 @@ your game set to use Phaser.AUTO then swap it for Phaser.CANVAS to ensure WebGL
Source:
@@ -5955,13 +6850,13 @@ your game set to use Phaser.AUTO then swap it for Phaser.CANVAS to ensure WebGL
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:36 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:36 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Phaser.Utils.html b/docs/Phaser.Utils.html
index 9297b0dc..840f9c11 100644
--- a/docs/Phaser.Utils.html
+++ b/docs/Phaser.Utils.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -1259,13 +1253,13 @@ dir = 1 (left), 2 (right), 3 (both)
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:35 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:36 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Phaser.World.html b/docs/Phaser.World.html
index 47136911..2328e0fa 100644
--- a/docs/Phaser.World.html
+++ b/docs/Phaser.World.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -531,7 +525,7 @@ the world at world-based coordinates. By default a world is created the same siz
Source:
@@ -560,6 +554,12 @@ the world at world-based coordinates. By default a world is created the same siz
+ Extends
+
+
+
@@ -574,6 +574,335 @@ the world at world-based coordinates. By default a world is created the same siz
+
+ alive
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ alive
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+
+ The alive property is useful for Groups that are children of other Groups and need to be included/excluded in checks like forEachAlive.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Inherited From:
+
+
+
+
+
+
+
+
+
+
+
+
+ Default Value:
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ alpha
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ alpha
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ The alpha value of the Group container.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Inherited From:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ angle
+
+
+
+
+
+
+
The angle of rotation of the Group container. This will adjust the Group container itself by modifying its rotation.
+This will have no impact on the rotation value of its children, but it will update their worldTransform and on-screen position.
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ angle
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ The angle of rotation given in degrees, where 0 degrees = to the right.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Inherited From:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
bounds
@@ -666,7 +995,7 @@ So if you want to make a game in which the world itself will rotate you should a
Source:
@@ -768,7 +1097,7 @@ So if you want to make a game in which the world itself will rotate you should a
Source:
@@ -870,7 +1199,7 @@ So if you want to make a game in which the world itself will rotate you should a
Source:
@@ -972,7 +1301,7 @@ So if you want to make a game in which the world itself will rotate you should a
Source:
@@ -1074,7 +1403,443 @@ So if you want to make a game in which the world itself will rotate you should a
Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ cursor
+
+
+
+
+
+
+
The cursor is a simple way to iterate through the objects in a Group using the Group.next and Group.previous functions.
+The cursor is set to the first child added to the Group and doesn't change unless you call next, previous or set it directly with Group.cursor.
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ cursor
+
+
+
+
+
+any
+
+
+
+
+
+
+
+
+
+ The current display object that the Group cursor is pointing to.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Inherited From:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ exists
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ exists
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+
+ If exists is true the the Group is updated, otherwise it is skipped.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Inherited From:
+
+
+
+
+
+
+
+
+
+
+
+
+ Default Value:
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ game
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ game
+
+
+
+
+
+Phaser.Game
+
+
+
+
+
+
+
+
+
+ A reference to the currently running Game.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Inherited From:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ group
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ group
+
+
+
+
+
+Phaser.Group
+
+
+
+
+
+
+
+
+
+ The parent Group of this Group, if a child of another.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Inherited From:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
@@ -1176,7 +1941,328 @@ So if you want to make a game in which the world itself will rotate you should a
Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <readonly> length
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ length
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ The total number of children in this Group, regardless of their exists/alive status.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Inherited From:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ name
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ name
+
+
+
+
+
+string
+
+
+
+
+
+
+
+
+
+ A name for this Group. Not used internally but useful for debugging.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Inherited From:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ pivot
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ pivot
+
+
+
+
+
+Phaser.Point
+
+
+
+
+
+
+
+
+
+ The pivot point of the Group container.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Inherited From:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
@@ -1278,7 +2364,7 @@ So if you want to make a game in which the world itself will rotate you should a
Source:
@@ -1380,7 +2466,119 @@ So if you want to make a game in which the world itself will rotate you should a
Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ rotation
+
+
+
+
+
+
+
The angle of rotation of the Group container. This will adjust the Group container itself by modifying its rotation.
+This will have no impact on the rotation value of its children, but it will update their worldTransform and on-screen position.
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ rotation
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ The angle of rotation given in radians.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Inherited From:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
@@ -1453,7 +2651,7 @@ So if you want to make a game in which the world itself will rotate you should a
- Replaces the PIXI.Point with a slightly more flexible one.
+ The scane of the Group container.
@@ -1468,6 +2666,11 @@ So if you want to make a game in which the world itself will rotate you should a
+ Inherited From:
+
+
@@ -1482,7 +2685,221 @@ So if you want to make a game in which the world itself will rotate you should a
Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <readonly> total
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ total
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ The total number of children in this Group who have a state of exists = true.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Inherited From:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <protected> type
+
+
+
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ type
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ Internal Phaser Type value.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Inherited From:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
@@ -1584,7 +3001,7 @@ So if you want to make a game in which the world itself will rotate you should a
Source:
@@ -1686,7 +3103,231 @@ So if you want to make a game in which the world itself will rotate you should a
Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ x
+
+
+
+
+
+
+
The x coordinate of the Group container. You can adjust the Group container itself by modifying its coordinates.
+This will have no impact on the x/y coordinates of its children, but it will update their worldTransform and on-screen position.
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ x
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ The x coordinate of the Group container.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Inherited From:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ y
+
+
+
+
+
+
+
The y coordinate of the Group container. You can adjust the Group container itself by modifying its coordinates.
+This will have no impact on the x/y coordinates of its children, but it will update their worldTransform and on-screen position.
+
+
+
+
+
+
+
+
+
+ Properties:
+
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ y
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ The y coordinate of the Group container.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Inherited From:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
@@ -1709,6 +3350,526 @@ So if you want to make a game in which the world itself will rotate you should a
+
+ add(child) → {*}
+
+
+
+
+
+
+
+
Adds an existing object to this Group. The object can be an instance of Phaser.Sprite, Phaser.Button or any other display object.
+The child is automatically added to the top of the Group, so renders on-top of everything else within the Group. If you need to control
+that then see the addAt method.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ child
+
+
+
+
+
+*
+
+
+
+
+
+
+
+
+
+ An instance of Phaser.Sprite, Phaser.Button or any other display object..
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Inherited From:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+ See:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+
+
+
The child that was added to the Group.
+
+
+
+
+
+
+ Type
+
+
+
+*
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ addAll(property, amount, checkAlive, checkVisible)
+
+
+
+
+
+
+
+
Adds the amount to the given property on all children in this Group.
+Group.addAll('x', 10) will add 10 to the child.x value.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ property
+
+
+
+
+
+string
+
+
+
+
+
+
+
+
+
+ The property to increment, for example 'body.velocity.x' or 'angle'.
+
+
+
+
+
+
+ amount
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ The amount to increment the property by. If child.x = 10 then addAll('x', 40) would make child.x = 50.
+
+
+
+
+
+
+ checkAlive
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+
+ If true the property will only be changed if the child is alive.
+
+
+
+
+
+
+ checkVisible
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+
+ If true the property will only be changed if the child is visible.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Inherited From:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ addAt(child, index) → {*}
+
+
+
+
+
+
+
+
Adds an existing object to this Group. The object can be an instance of Phaser.Sprite, Phaser.Button or any other display object.
+The child is added to the Group at the location specified by the index value, this allows you to control child ordering.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ child
+
+
+
+
+
+*
+
+
+
+
+
+
+
+
+
+ An instance of Phaser.Sprite, Phaser.Button or any other display object..
+
+
+
+
+
+
+ index
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ The index within the Group to insert the child to.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Inherited From:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+
+
+
The child that was added to the Group.
+
+
+
+
+
+
+ Type
+
+
+
+*
+
+
+
+
+
+
+
+
+
+
+
+
+
<protected> boot()
@@ -1751,7 +3912,1571 @@ So if you want to make a game in which the world itself will rotate you should a
Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ bringToTop(child) → {*}
+
+
+
+
+
+
+
+
Brings the given child to the top of this Group so it renders above all other children.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ child
+
+
+
+
+
+*
+
+
+
+
+
+
+
+
+
+ The child to bring to the top of this Group.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Inherited From:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+
+
+
The child that was moved.
+
+
+
+
+
+
+ Type
+
+
+
+*
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ callAll(method, context , parameter)
+
+
+
+
+
+
+
+
Calls a function on all of the children regardless if they are dead or alive (see callAllExists if you need control over that)
+After the method parameter and context you can add as many extra parameters as you like, which will all be passed to the child.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+ Argument
+
+
+
+ Default
+
+
+ Description
+
+
+
+
+
+
+
+
+ method
+
+
+
+
+
+string
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ A string containing the name of the function that will be called. The function must exist on the child.
+
+
+
+
+
+
+ context
+
+
+
+
+
+string
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ null
+
+
+
+
+ A string containing the context under which the method will be executed. Set to null to default to the child.
+
+
+
+
+
+
+ parameter
+
+
+
+
+
+*
+
+
+
+
+
+
+
+
+
+
+
+
+ <repeatable>
+
+
+
+
+
+
+
+
+
+
+ Additional parameters that will be passed to the method.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Inherited From:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ callAllExists(callback, existsValue, parameter)
+
+
+
+
+
+
+
+
Calls a function on all of the children that have exists=true in this Group.
+After the existsValue parameter you can add as many parameters as you like, which will all be passed to the child callback.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+ Argument
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ callback
+
+
+
+
+
+function
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The function that exists on the children that will be called.
+
+
+
+
+
+
+ existsValue
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Only children with exists=existsValue will be called.
+
+
+
+
+
+
+ parameter
+
+
+
+
+
+*
+
+
+
+
+
+
+
+
+
+
+
+
+ <repeatable>
+
+
+
+
+
+
+ Additional parameters that will be passed to the callback.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Inherited From:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <protected> callbackFromArray(child, callback, length)
+
+
+
+
+
+
+
+
Returns a reference to a function that exists on a child of the Group based on the given callback array.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ child
+
+
+
+
+
+object
+
+
+
+
+
+
+
+
+
+ The object to inspect.
+
+
+
+
+
+
+ callback
+
+
+
+
+
+array
+
+
+
+
+
+
+
+
+
+ The array of function names.
+
+
+
+
+
+
+ length
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ The size of the array (pre-calculated in callAll).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Inherited From:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ childTest()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Inherited From:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ countDead() → {number}
+
+
+
+
+
+
+
+
Call this function to find out how many members of the group are dead.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Inherited From:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+
+
+
The number of children flagged as dead.
+
+
+
+
+
+
+ Type
+
+
+
+number
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ countLiving() → {number}
+
+
+
+
+
+
+
+
Call this function to find out how many members of the group are alive.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Inherited From:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+
+
+
The number of children flagged as alive.
+
+
+
+
+
+
+ Type
+
+
+
+number
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ create(x, y, key, frame , exists ) → {Phaser.Sprite }
+
+
+
+
+
+
+
+
Automatically creates a new Phaser.Sprite object and adds it to the top of this Group.
+Useful if you don't need to create the Sprite instances before-hand.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+ Argument
+
+
+
+ Default
+
+
+ Description
+
+
+
+
+
+
+
+
+ x
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The x coordinate to display the newly created Sprite at. The value is in relation to the Group.x point.
+
+
+
+
+
+
+ y
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The y coordinate to display the newly created Sprite at. The value is in relation to the Group.y point.
+
+
+
+
+
+
+ key
+
+
+
+
+
+string
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The Game.cache key of the image that this Sprite will use.
+
+
+
+
+
+
+ frame
+
+
+
+
+
+number
+|
+
+string
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ If the Sprite image contains multiple frames you can specify which one to use here.
+
+
+
+
+
+
+ exists
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+ The default exists state of the Sprite.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Inherited From:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+
+
+
The child that was created.
+
+
+
+
+
+
+ Type
+
+
+
+Phaser.Sprite
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ createMultiple(quantity, key, frame , exists )
+
+
+
+
+
+
+
+
Automatically creates multiple Phaser.Sprite objects and adds them to the top of this Group.
+Useful if you need to quickly generate a pool of identical sprites, such as bullets. By default the sprites will be set to not exist
+and will be positioned at 0, 0 (relative to the Group.x/y)
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+ Argument
+
+
+
+ Default
+
+
+ Description
+
+
+
+
+
+
+
+
+ quantity
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The number of Sprites to create.
+
+
+
+
+
+
+ key
+
+
+
+
+
+string
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The Game.cache key of the image that this Sprite will use.
+
+
+
+
+
+
+ frame
+
+
+
+
+
+number
+|
+
+string
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ If the Sprite image contains multiple frames you can specify which one to use here.
+
+
+
+
+
+
+ exists
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ false
+
+
+
+
+ The default exists state of the Sprite.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Inherited From:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
@@ -1820,7 +5545,2196 @@ So if you want to make a game in which the world itself will rotate you should a
Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ divideAll(property, amount, checkAlive, checkVisible)
+
+
+
+
+
+
+
+
Divides the given property by the amount on all children in this Group.
+Group.divideAll('x', 2) will half the child.x value.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ property
+
+
+
+
+
+string
+
+
+
+
+
+
+
+
+
+ The property to divide, for example 'body.velocity.x' or 'angle'.
+
+
+
+
+
+
+ amount
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ The amount to divide the property by. If child.x = 100 then divideAll('x', 2) would make child.x = 50.
+
+
+
+
+
+
+ checkAlive
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+
+ If true the property will only be changed if the child is alive.
+
+
+
+
+
+
+ checkVisible
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+
+ If true the property will only be changed if the child is visible.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Inherited From:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ forEach(callback, callbackContext, checkExists)
+
+
+
+
+
+
+
+
Allows you to call your own function on each member of this Group. You must pass the callback and context in which it will run.
+After the checkExists parameter you can add as many parameters as you like, which will all be passed to the callback along with the child.
+For example: Group.forEach(awardBonusGold, this, true, 100, 500)
+Note: Currently this will skip any children which are Groups themselves.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ callback
+
+
+
+
+
+function
+
+
+
+
+
+
+
+
+
+ The function that will be called. Each child of the Group will be passed to it as its first parameter.
+
+
+
+
+
+
+ callbackContext
+
+
+
+
+
+Object
+
+
+
+
+
+
+
+
+
+ The context in which the function should be called (usually 'this').
+
+
+
+
+
+
+ checkExists
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+
+ If set only children with exists=true will be passed to the callback, otherwise all children will be passed.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Inherited From:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ forEachAlive(callback, callbackContext)
+
+
+
+
+
+
+
+
Allows you to call your own function on each alive member of this Group (where child.alive=true). You must pass the callback and context in which it will run.
+You can add as many parameters as you like, which will all be passed to the callback along with the child.
+For example: Group.forEachAlive(causeDamage, this, 500)
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ callback
+
+
+
+
+
+function
+
+
+
+
+
+
+
+
+
+ The function that will be called. Each child of the Group will be passed to it as its first parameter.
+
+
+
+
+
+
+ callbackContext
+
+
+
+
+
+Object
+
+
+
+
+
+
+
+
+
+ The context in which the function should be called (usually 'this').
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Inherited From:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ forEachAlive(callback, callbackContext)
+
+
+
+
+
+
+
+
Allows you to call your own function on each alive member of this Group (where child.alive=true). You must pass the callback and context in which it will run.
+You can add as many parameters as you like, which will all be passed to the callback along with the child.
+For example: Group.forEachAlive(causeDamage, this, 500)
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ callback
+
+
+
+
+
+function
+
+
+
+
+
+
+
+
+
+ The function that will be called. Each child of the Group will be passed to it as its first parameter.
+
+
+
+
+
+
+ callbackContext
+
+
+
+
+
+Object
+
+
+
+
+
+
+
+
+
+ The context in which the function should be called (usually 'this').
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Inherited From:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ forEachDead(callback, callbackContext)
+
+
+
+
+
+
+
+
Allows you to call your own function on each dead member of this Group (where alive=false). You must pass the callback and context in which it will run.
+You can add as many parameters as you like, which will all be passed to the callback along with the child.
+For example: Group.forEachDead(bringToLife, this)
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ callback
+
+
+
+
+
+function
+
+
+
+
+
+
+
+
+
+ The function that will be called. Each child of the Group will be passed to it as its first parameter.
+
+
+
+
+
+
+ callbackContext
+
+
+
+
+
+Object
+
+
+
+
+
+
+
+
+
+ The context in which the function should be called (usually 'this').
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Inherited From:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ getAt(index) → {*}
+
+
+
+
+
+
+
+
Returns the child found at the given index within this Group.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ index
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ The index to return the child from.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Inherited From:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+
+
+
The child that was found at the given index.
+
+
+
+
+
+
+ Type
+
+
+
+*
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ getFirstAlive() → {Any}
+
+
+
+
+
+
+
+
Call this function to retrieve the first object with alive === true in the group.
+This is handy for checking if everything has been wiped out, or choosing a squad leader, etc.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Inherited From:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+
+
+
The first alive child, or null if none found.
+
+
+
+
+
+
+ Type
+
+
+
+Any
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ getFirstDead() → {Any}
+
+
+
+
+
+
+
+
Call this function to retrieve the first object with alive === false in the group.
+This is handy for checking if everything has been wiped out, or choosing a squad leader, etc.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Inherited From:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+
+
+
The first dead child, or null if none found.
+
+
+
+
+
+
+ Type
+
+
+
+Any
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ getFirstExists(state) → {Any}
+
+
+
+
+
+
+
+
Call this function to retrieve the first object with exists == (the given state) in the Group.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ state
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+
+ True or false.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Inherited From:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+
+
+
The first child, or null if none found.
+
+
+
+
+
+
+ Type
+
+
+
+Any
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ getIndex(child) → {number}
+
+
+
+
+
+
+
+
Get the index position of the given child in this Group.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ child
+
+
+
+
+
+*
+
+
+
+
+
+
+
+
+
+ The child to get the index for.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Inherited From:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+
+
+
The index of the child or -1 if it's not a member of this Group.
+
+
+
+
+
+
+ Type
+
+
+
+number
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ getRandom(startIndex, length) → {Any}
+
+
+
+
+
+
+
+
Returns a member at random from the group.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ startIndex
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ Optional offset off the front of the array. Default value is 0, or the beginning of the array.
+
+
+
+
+
+
+ length
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ Optional restriction on the number of values you want to randomly select from.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Inherited From:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+
+
+
A random child of this Group.
+
+
+
+
+
+
+ Type
+
+
+
+Any
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ iterate(key, value, returnType, callback , callbackContext ) → {any}
+
+
+
+
+
+
+
+
Iterates over the children of the Group. When a child has a property matching key that equals the given value, it is considered as a match.
+Matched children can be sent to the optional callback, or simply returned or counted.
+You can add as many callback parameters as you like, which will all be passed to the callback along with the child, after the callbackContext parameter.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+ Argument
+
+
+
+ Default
+
+
+ Description
+
+
+
+
+
+
+
+
+ key
+
+
+
+
+
+string
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The child property to check, i.e. 'exists', 'alive', 'health'
+
+
+
+
+
+
+ value
+
+
+
+
+
+any
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ If child.key === this value it will be considered a match. Note that a strict comparison is used.
+
+
+
+
+
+
+ returnType
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ How to return the data from this method. Either Phaser.Group.RETURN_NONE, Phaser.Group.RETURN_TOTAL or Phaser.Group.RETURN_CHILD.
+
+
+
+
+
+
+ callback
+
+
+
+
+
+function
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ null
+
+
+
+
+ Optional function that will be called on each matching child. Each child of the Group will be passed to it as its first parameter.
+
+
+
+
+
+
+ callbackContext
+
+
+
+
+
+Object
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The context in which the function should be called (usually 'this').
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Inherited From:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+
+
+
Returns either a numeric total (if RETURN_TOTAL was specified) or the child object.
+
+
+
+
+
+
+ Type
+
+
+
+any
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ multiplyAll(property, amount, checkAlive, checkVisible)
+
+
+
+
+
+
+
+
Multiplies the given property by the amount on all children in this Group.
+Group.multiplyAll('x', 2) will x2 the child.x value.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ property
+
+
+
+
+
+string
+
+
+
+
+
+
+
+
+
+ The property to multiply, for example 'body.velocity.x' or 'angle'.
+
+
+
+
+
+
+ amount
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ The amount to multiply the property by. If child.x = 10 then multiplyAll('x', 2) would make child.x = 20.
+
+
+
+
+
+
+ checkAlive
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+
+ If true the property will only be changed if the child is alive.
+
+
+
+
+
+
+ checkVisible
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+
+ If true the property will only be changed if the child is visible.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Inherited From:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ next()
+
+
+
+
+
+
+
+
Advances the Group cursor to the next object in the Group. If it's at the end of the Group it wraps around to the first object.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Inherited From:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
@@ -1856,7 +7770,10 @@ So if you want to make a game in which the world itself will rotate you should a
-
This is called automatically every frame, and is where main logic happens.
+
This is called automatically before the renderer runs and after the plugins have updated.
+In postUpdate this is where all the final physics calculatations and object positioning happens.
+The objects are processed in the order of the display list.
+The only exception to this is if the camera is following an object, in which case that is updated first.
@@ -1889,7 +7806,1213 @@ So if you want to make a game in which the world itself will rotate you should a
Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ previous()
+
+
+
+
+
+
+
+
Moves the Group cursor to the previous object in the Group. If it's at the start of the Group it wraps around to the last object.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Inherited From:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ remove(child) → {boolean}
+
+
+
+
+
+
+
+
Removes the given child from this Group and sets its group property to null.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ child
+
+
+
+
+
+Any
+
+
+
+
+
+
+
+
+
+ The child to remove.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Inherited From:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+
+
+
true if the child was removed from this Group, otherwise false.
+
+
+
+
+
+
+ Type
+
+
+
+boolean
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ removeAll()
+
+
+
+
+
+
+
+
Removes all children from this Group, setting all group properties to null.
+The Group container remains on the display list.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Inherited From:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ removeBetween(startIndex, endIndex)
+
+
+
+
+
+
+
+
Removes all children from this Group whos index falls beteen the given startIndex and endIndex values.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ startIndex
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ The index to start removing children from.
+
+
+
+
+
+
+ endIndex
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ The index to stop removing children from. Must be higher than startIndex and less than the length of the Group.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Inherited From:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ replace(oldChild, newChild)
+
+
+
+
+
+
+
+
Replaces a child of this Group with the given newChild. The newChild cannot be a member of this Group.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ oldChild
+
+
+
+
+
+*
+
+
+
+
+
+
+
+
+
+ The child in this Group that will be replaced.
+
+
+
+
+
+
+ newChild
+
+
+
+
+
+*
+
+
+
+
+
+
+
+
+
+ The child to be inserted into this group.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Inherited From:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ set(child, key, value, checkAlive , checkVisible , operation )
+
+
+
+
+
+
+
+
This function allows you to quickly set a property on a single child of this Group to a new value.
+The operation parameter controls how the new value is assigned to the property, from simple replacement to addition and multiplication.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+ Argument
+
+
+
+ Default
+
+
+ Description
+
+
+
+
+
+
+
+
+ child
+
+
+
+
+
+Phaser.Sprite
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The child to set the property on.
+
+
+
+
+
+
+ key
+
+
+
+
+
+string
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The property, as a string, to be set. For example: 'body.velocity.x'
+
+
+
+
+
+
+ value
+
+
+
+
+
+*
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The value that will be set.
+
+
+
+
+
+
+ checkAlive
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ false
+
+
+
+
+ If set then the child will only be updated if alive=true.
+
+
+
+
+
+
+ checkVisible
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ false
+
+
+
+
+ If set then the child will only be updated if visible=true.
+
+
+
+
+
+
+ operation
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ 0
+
+
+
+
+ Controls how the value is assigned. A value of 0 replaces the value with the new one. A value of 1 adds it, 2 subtracts it, 3 multiplies it and 4 divides it.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Inherited From:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ setAll(key, value, checkAlive , checkVisible , operation )
+
+
+
+
+
+
+
+
This function allows you to quickly set the same property across all children of this Group to a new value.
+The operation parameter controls how the new value is assigned to the property, from simple replacement to addition and multiplication.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+ Argument
+
+
+
+ Default
+
+
+ Description
+
+
+
+
+
+
+
+
+ key
+
+
+
+
+
+string
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The property, as a string, to be set. For example: 'body.velocity.x'
+
+
+
+
+
+
+ value
+
+
+
+
+
+*
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The value that will be set.
+
+
+
+
+
+
+ checkAlive
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ false
+
+
+
+
+ If set then only children with alive=true will be updated.
+
+
+
+
+
+
+ checkVisible
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ false
+
+
+
+
+ If set then only children with visible=true will be updated.
+
+
+
+
+
+
+ operation
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ 0
+
+
+
+
+ Controls how the value is assigned. A value of 0 replaces the value with the new one. A value of 1 adds it, 2 subtracts it, 3 multiplies it and 4 divides it.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Inherited From:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
@@ -1925,8 +9048,7 @@ So if you want to make a game in which the world itself will rotate you should a
-
Updates the size of this world. Note that this doesn't modify the world x/y coordinates, just the width and height.
-If you need to adjust the bounds of the world
+
Updates the size of this world. Note that this doesn't modify the world x/y coordinates, just the width and height.
@@ -2022,7 +9144,7 @@ If you need to adjust the bounds of the world
- New width of the world.
+ New width of the world. Can never be smaller than the Game.width.
@@ -2045,7 +9167,7 @@ If you need to adjust the bounds of the world
- New height of the world.
+ New height of the world. Can never be smaller than the Game.height.
@@ -2077,7 +9199,875 @@ If you need to adjust the bounds of the world
Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ setProperty(child, key, value, operation )
+
+
+
+
+
+
+
+
Sets the given property to the given value on the child. The operation controls the assignment of the value.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+ Argument
+
+
+
+ Default
+
+
+ Description
+
+
+
+
+
+
+
+
+ child
+
+
+
+
+
+*
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The child to set the property value on.
+
+
+
+
+
+
+ key
+
+
+
+
+
+array
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ An array of strings that make up the property that will be set.
+
+
+
+
+
+
+ value
+
+
+
+
+
+*
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The value that will be set.
+
+
+
+
+
+
+ operation
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ 0
+
+
+
+
+ Controls how the value is assigned. A value of 0 replaces the value with the new one. A value of 1 adds it, 2 subtracts it, 3 multiplies it and 4 divides it.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Inherited From:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ sort(index , order )
+
+
+
+
+
+
+
+
Call this function to sort the group according to a particular value and order.
+For example to depth sort Sprites for Zelda-style game you might call group.sort('y', Phaser.Group.SORT_ASCENDING) at the bottom of your State.update().
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+ Argument
+
+
+
+ Default
+
+
+ Description
+
+
+
+
+
+
+
+
+ index
+
+
+
+
+
+string
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ 'y'
+
+
+
+
+ The string name of the property you want to sort on.
+
+
+
+
+
+
+ order
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ Phaser.Group.SORT_ASCENDING
+
+
+
+
+ The Group constant that defines the sort order. Possible values are Phaser.Group.SORT_ASCENDING and Phaser.Group.SORT_DESCENDING.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Inherited From:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ subAll(property, amount, checkAlive, checkVisible)
+
+
+
+
+
+
+
+
Subtracts the amount from the given property on all children in this Group.
+Group.subAll('x', 10) will minus 10 from the child.x value.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ property
+
+
+
+
+
+string
+
+
+
+
+
+
+
+
+
+ The property to decrement, for example 'body.velocity.x' or 'angle'.
+
+
+
+
+
+
+ amount
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+ The amount to subtract from the property. If child.x = 50 then subAll('x', 40) would make child.x = 10.
+
+
+
+
+
+
+ checkAlive
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+
+ If true the property will only be changed if the child is alive.
+
+
+
+
+
+
+ checkVisible
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+
+ If true the property will only be changed if the child is visible.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Inherited From:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ swap(child1, child2) → {boolean}
+
+
+
+
+
+
+
+
Swaps the position of two children in this Group. Both children must be in this Group.
+You cannot swap a child with itself, or swap un-parented children, doing so will return false.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ child1
+
+
+
+
+
+*
+
+
+
+
+
+
+
+
+
+ The first child to swap.
+
+
+
+
+
+
+ child2
+
+
+
+
+
+*
+
+
+
+
+
+
+
+
+
+ The second child to swap.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Inherited From:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+
+
+
True if the swap was successful, otherwise false.
+
+
+
+
+
+
+ Type
+
+
+
+boolean
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ swapIndex()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Inherited From:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
@@ -2113,7 +10103,8 @@ If you need to adjust the bounds of the world
-
This is called automatically every frame, and is where main logic happens.
+
This is called automatically after the plugins preUpdate and before the State.update.
+Most objects have preUpdate methods and it's where initial movement, drawing and calculations are done.
@@ -2146,7 +10137,77 @@ If you need to adjust the bounds of the world
Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ update()
+
+
+
+
+
+
+
+
This is called automatically after the State.update, but before particles or plugins update.
+Most objects won't have an update method set unless explicitly given one.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
@@ -2191,13 +10252,13 @@ If you need to adjust the bounds of the world
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:36 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:37 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Phaser.html b/docs/Phaser.html
index 59718ca0..ecf95de5 100644
--- a/docs/Phaser.html
+++ b/docs/Phaser.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -519,6 +513,9 @@
Device
+ DOMSprite
+
+
Easing
@@ -540,6 +537,12 @@
GameObjectFactory
+ Gamepad
+
+
+ GamepadButton
+
+
Graphics
@@ -558,6 +561,9 @@
Keyboard
+ Line
+
+
LinkedList
@@ -618,6 +624,9 @@
Signal
+ SinglePad
+
+
Sound
@@ -666,6 +675,9 @@
Timer
+ TimerEvent
+
+
Touch
@@ -706,13 +718,13 @@
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:26 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:25 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Phaser.js.html b/docs/Phaser.js.html
index 6736abc8..0c5ebf0e 100644
--- a/docs/Phaser.js.html
+++ b/docs/Phaser.js.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -423,7 +417,7 @@
/**
* @author Richard Davey <rich@photonstorm.com>
-* @copyright 2013 Photon Storm Ltd.
+* @copyright 2014 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -433,7 +427,7 @@
var Phaser = Phaser || {
VERSION: '<%= version %>',
- DEV_VERSION: '1.1.3',
+ DEV_VERSION: '1.1.4',
GAMES: [],
AUTO: 0,
@@ -462,7 +456,10 @@ var Phaser = Phaser || {
LEFT: 1,
RIGHT: 2,
UP: 3,
- DOWN: 4
+ DOWN: 4,
+
+ CANVAS_PX_ROUND: false,
+ CANVAS_CLEAR_RECT: true
};
@@ -485,13 +482,13 @@ PIXI.InteractionManager = function (dummy) {
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:25 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Plugin.js.html b/docs/Plugin.js.html
index 9b26cad5..8302d705 100644
--- a/docs/Plugin.js.html
+++ b/docs/Plugin.js.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -423,7 +417,7 @@
/**
* @author Richard Davey <rich@photonstorm.com>
-* @copyright 2013 Photon Storm Ltd.
+* @copyright 2014 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -542,6 +536,8 @@ Phaser.Plugin.prototype = {
}
};
+
+Phaser.Plugin.prototype.constructor = Phaser.Plugin;
@@ -557,13 +553,13 @@ Phaser.Plugin.prototype = {
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:25 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/PluginManager.js.html b/docs/PluginManager.js.html
index 5fad2dfe..b2bd4a46 100644
--- a/docs/PluginManager.js.html
+++ b/docs/PluginManager.js.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -425,7 +419,7 @@
/**
* @author Richard Davey <rich@photonstorm.com>
-* @copyright 2013 Photon Storm Ltd.
+* @copyright 2014 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -718,6 +712,8 @@ Phaser.PluginManager.prototype = {
}
};
+
+Phaser.PluginManager.prototype.constructor = Phaser.PluginManager;
@@ -733,13 +729,13 @@ Phaser.PluginManager.prototype = {
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:25 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Point.js.html b/docs/Point.js.html
index 41c1972f..34a3fe53 100644
--- a/docs/Point.js.html
+++ b/docs/Point.js.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -423,7 +417,7 @@
/**
* @author Richard Davey <rich@photonstorm.com>
-* @copyright 2013 Photon Storm Ltd.
+* @copyright 2014 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -711,6 +705,8 @@ Phaser.Point.prototype = {
};
+Phaser.Point.prototype.constructor = Phaser.Point;
+
/**
* Adds the coordinates of two points together to create a new point.
* @method Phaser.Point.add
@@ -866,13 +862,13 @@ Phaser.Point.rotate = function (a, x, y, angle, asDegrees, distance) {
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:25 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Pointer.js.html b/docs/Pointer.js.html
index 769805ec..12357a84 100644
--- a/docs/Pointer.js.html
+++ b/docs/Pointer.js.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -423,7 +417,7 @@
/**
* @author Richard Davey <rich@photonstorm.com>
-* @copyright 2013 Photon Storm Ltd.
+* @copyright 2014 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -630,7 +624,7 @@ Phaser.Pointer.prototype = {
}
// Fix to stop rogue browser plugins from blocking the visibility state event
- if (this.game.paused === true && this.game.stage.scale.incorrectOrientation === false)
+ if (this.game.stage.disableVisibilityChange === false && this.game.paused && this.game.stage.scale.incorrectOrientation === false)
{
this.game.paused = false;
return this;
@@ -680,7 +674,7 @@ Phaser.Pointer.prototype = {
},
/**
- * Called internall by the Input Manager.
+ * Called by the Input Manager.
* @method Phaser.Pointer#update
*/
update: function () {
@@ -759,12 +753,17 @@ Phaser.Pointer.prototype = {
this.game.input.circle.y = this.game.input.y;
}
- // If the game is paused we don't process any target objects
+ // If the game is paused we don't process any target objects or callbacks
if (this.game.paused)
{
return this;
}
+ if (this.game.input.moveCallback)
+ {
+ this.game.input.moveCallback.call(this.game.input.moveCallbackContext, this, this.x, this.y);
+ }
+
// Easy out if we're dragging something and it still exists
if (this.targetObject !== null && this.targetObject.isDragged === true)
{
@@ -1006,6 +1005,8 @@ Phaser.Pointer.prototype = {
};
+Phaser.Pointer.prototype.constructor = Phaser.Pointer;
+
/**
* How long the Pointer has been depressed on the touchscreen. If not currently down it returns -1.
* @name Phaser.Pointer#duration
@@ -1073,13 +1074,13 @@ Object.defineProperty(Phaser.Pointer.prototype, "worldY", {
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:25 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Polygon.js.html b/docs/Polygon.js.html
index f6b45bb7..2a9440c0 100644
--- a/docs/Polygon.js.html
+++ b/docs/Polygon.js.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -423,7 +417,7 @@
/**
* @author Richard Davey <rich@photonstorm.com>
-* @copyright 2013 Photon Storm Ltd.
+* @copyright 2014 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -465,13 +459,13 @@ Phaser.Polygon.prototype.constructor = Phaser.Polygon;
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:25 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/QuadTree.js.html b/docs/QuadTree.js.html
index c1774604..856ca076 100644
--- a/docs/QuadTree.js.html
+++ b/docs/QuadTree.js.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -423,23 +417,23 @@
/**
* @author Richard Davey <rich@photonstorm.com>
-* @copyright 2013 Photon Storm Ltd.
+* @copyright 2014 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
/**
- * Javascript QuadTree
- * @version 1.0
- * @author Timo Hausmann
- *
- * @version 1.2, September 4th 2013
- * @author Richard Davey
- * The original code was a conversion of the Java code posted to GameDevTuts. However I've tweaked
- * it massively to add node indexing, removed lots of temp. var creation and significantly
- * increased performance as a result.
- *
- * Original version at https://github.com/timohausmann/quadtree-js/
- */
+* Javascript QuadTree
+* @version 1.0
+* @author Timo Hausmann
+*
+* @version 1.2, September 4th 2013
+* @author Richard Davey
+* The original code was a conversion of the Java code posted to GameDevTuts. However I've tweaked
+* it massively to add node indexing, removed lots of temp. var creation and significantly
+* increased performance as a result.
+*
+* Original version at https://github.com/timohausmann/quadtree-js/
+*/
/**
* @copyright © 2012 Timo Hausmann
@@ -465,27 +459,23 @@
*/
/**
- * QuadTree Constructor
- *
- * @class Phaser.QuadTree
- * @classdesc A QuadTree implementation. The original code was a conversion of the Java code posted to GameDevTuts. However I've tweaked
- * it massively to add node indexing, removed lots of temp. var creation and significantly increased performance as a result. Original version at https://github.com/timohausmann/quadtree-js/
- * @constructor
- * @param {Description} physicsManager - Description.
- * @param {Description} x - Description.
- * @param {Description} y - Description.
- * @param {number} width - The width of your game in game pixels.
- * @param {number} height - The height of your game in game pixels.
- * @param {number} maxObjects - Description.
- * @param {number} maxLevels - Description.
- * @param {number} level - Description.
- */
-Phaser.QuadTree = function (physicsManager, x, y, width, height, maxObjects, maxLevels, level) {
+* QuadTree Constructor
+*
+* @class Phaser.QuadTree
+* @classdesc A QuadTree implementation. The original code was a conversion of the Java code posted to GameDevTuts.
+* However I've tweaked it massively to add node indexing, removed lots of temp. var creation and significantly increased performance as a result.
+* Original version at https://github.com/timohausmann/quadtree-js/
+* @constructor
+* @param {number} x - The top left coordinate of the quadtree.
+* @param {number} y - The top left coordinate of the quadtree.
+* @param {number} width - The width of the quadtree in pixels.
+* @param {number} height - The height of the quadtree in pixels.
+* @param {number} [maxObjects=10] - The maximum number of objects per node.
+* @param {number} [maxLevels=4] - The maximum number of levels to iterate to.
+* @param {number} [level=0] - Which level is this?
+*/
+Phaser.QuadTree = function (x, y, width, height, maxObjects, maxLevels, level) {
- this.physicsManager = physicsManager;
- this.ID = physicsManager.quadTreeID;
- physicsManager.quadTreeID++;
-
this.maxObjects = maxObjects || 10;
this.maxLevels = maxLevels || 4;
this.level = level || 0;
@@ -509,35 +499,60 @@ Phaser.QuadTree = function (physicsManager, x, y, width, height, maxObjects, max
Phaser.QuadTree.prototype = {
/*
- * Split the node into 4 subnodes
+ * Populates this quadtree with the members of the given Group.
*
- * @method Phaser.QuadTree#split
+ * @method Phaser.QuadTree#populate
+ * @param {Phaser.Group} group - The Group to add to the quadtree.
*/
- split: function() {
+ populate: function (group) {
- this.level++;
-
- // top right node
- this.nodes[0] = new Phaser.QuadTree(this.physicsManager, this.bounds.right, this.bounds.y, this.bounds.subWidth, this.bounds.subHeight, this.maxObjects, this.maxLevels, this.level);
-
- // top left node
- this.nodes[1] = new Phaser.QuadTree(this.physicsManager, this.bounds.x, this.bounds.y, this.bounds.subWidth, this.bounds.subHeight, this.maxObjects, this.maxLevels, this.level);
-
- // bottom left node
- this.nodes[2] = new Phaser.QuadTree(this.physicsManager, this.bounds.x, this.bounds.bottom, this.bounds.subWidth, this.bounds.subHeight, this.maxObjects, this.maxLevels, this.level);
-
- // bottom right node
- this.nodes[3] = new Phaser.QuadTree(this.physicsManager, this.bounds.right, this.bounds.bottom, this.bounds.subWidth, this.bounds.subHeight, this.maxObjects, this.maxLevels, this.level);
+ group.forEach(this.populateHandler, this, true);
},
/*
- * Insert the object into the node. If the node
- * exceeds the capacity, it will split and add all
- * objects to their corresponding subnodes.
+ * Handler for the populate method.
+ *
+ * @method Phaser.QuadTree#populateHandler
+ * @param {Phaser.Sprite} sprite - The Sprite to check.
+ */
+ populateHandler: function (sprite) {
+
+ if (sprite.body && sprite.body.checkCollision.none === false && sprite.alive)
+ {
+ this.insert(sprite.body);
+ }
+
+ },
+
+ /*
+ * Split the node into 4 subnodes
+ *
+ * @method Phaser.QuadTree#split
+ */
+ split: function () {
+
+ this.level++;
+
+ // top right node
+ this.nodes[0] = new Phaser.QuadTree(this.bounds.right, this.bounds.y, this.bounds.subWidth, this.bounds.subHeight, this.maxObjects, this.maxLevels, this.level);
+
+ // top left node
+ this.nodes[1] = new Phaser.QuadTree(this.bounds.x, this.bounds.y, this.bounds.subWidth, this.bounds.subHeight, this.maxObjects, this.maxLevels, this.level);
+
+ // bottom left node
+ this.nodes[2] = new Phaser.QuadTree(this.bounds.x, this.bounds.bottom, this.bounds.subWidth, this.bounds.subHeight, this.maxObjects, this.maxLevels, this.level);
+
+ // bottom right node
+ this.nodes[3] = new Phaser.QuadTree(this.bounds.right, this.bounds.bottom, this.bounds.subWidth, this.bounds.subHeight, this.maxObjects, this.maxLevels, this.level);
+
+ },
+
+ /*
+ * Insert the object into the node. If the node exceeds the capacity, it will split and add all objects to their corresponding subnodes.
*
* @method Phaser.QuadTree#insert
- * @param {object} body - Description.
+ * @param {Phaser.Physics.Arcade.Body|object} body - The Body object to insert into the quadtree.
*/
insert: function (body) {
@@ -589,7 +604,7 @@ Phaser.QuadTree.prototype = {
* Determine which node the object belongs to.
*
* @method Phaser.QuadTree#getIndex
- * @param {object} rect - Description.
+ * @param {Phaser.Rectangle|object} rect - The bounds in which to check.
* @return {number} index - Index of the subnode (0-3), or -1 if rect cannot completely fit within a subnode and is part of the parent node.
*/
getIndex: function (rect) {
@@ -629,12 +644,12 @@ Phaser.QuadTree.prototype = {
},
- /*
- * Return all objects that could collide with the given object.
+ /*
+ * Return all objects that could collide with the given Sprite.
*
* @method Phaser.QuadTree#retrieve
- * @param {object} rect - Description.
- * @Return {array} - Array with all detected objects.
+ * @param {Phaser.Sprite} sprite - The sprite to check against.
+ * @return {array} - Array with all detected objects.
*/
retrieve: function (sprite) {
@@ -643,7 +658,7 @@ Phaser.QuadTree.prototype = {
sprite.body.quadTreeIndex = this.getIndex(sprite.body);
// Temp store for the node IDs this sprite is in, we can use this for fast elimination later
- sprite.body.quadTreeIDs.push(this.ID);
+ // sprite.body.quadTreeIDs.push(this.ID);
if (this.nodes[0])
{
@@ -676,7 +691,6 @@ Phaser.QuadTree.prototype = {
for (var i = 0, len = this.nodes.length; i < len; i++)
{
- // if (typeof this.nodes[i] !== 'undefined')
if (this.nodes[i])
{
this.nodes[i].clear();
@@ -686,6 +700,8 @@ Phaser.QuadTree.prototype = {
}
};
+
+Phaser.QuadTree.prototype.constructor = Phaser.QuadTree;
@@ -701,13 +717,13 @@ Phaser.QuadTree.prototype = {
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:25 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/RandomDataGenerator.js.html b/docs/RandomDataGenerator.js.html
index 5e49be91..20d38246 100644
--- a/docs/RandomDataGenerator.js.html
+++ b/docs/RandomDataGenerator.js.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -425,7 +419,7 @@
/**
* @author Richard Davey <rich@photonstorm.com>
-* @copyright 2013 Photon Storm Ltd.
+* @copyright 2014 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -668,6 +662,8 @@ Phaser.RandomDataGenerator.prototype = {
}
};
+
+Phaser.RandomDataGenerator.prototype.constructor = Phaser.RandomDataGenerator;
@@ -683,13 +679,13 @@ Phaser.RandomDataGenerator.prototype = {
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:25 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Rectangle.js.html b/docs/Rectangle.js.html
index f9559709..4b5a9635 100644
--- a/docs/Rectangle.js.html
+++ b/docs/Rectangle.js.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -423,7 +417,7 @@
/**
* @author Richard Davey <rich@photonstorm.com>
-* @copyright 2013 Photon Storm Ltd.
+* @copyright 2014 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -689,6 +683,8 @@ Phaser.Rectangle.prototype = {
};
+Phaser.Rectangle.prototype.constructor = Phaser.Rectangle;
+
/**
* @name Phaser.Rectangle#halfWidth
* @property {number} halfWidth - Half of the width of the Rectangle.
@@ -1067,12 +1063,12 @@ Phaser.Rectangle.intersection = function (a, b, out) {
*/
Phaser.Rectangle.intersects = function (a, b) {
- return (a.x < b.right && b.x < a.right && a.y < b.bottom && b.y < a.bottom);
+ if (a.width <= 0 || a.height <= 0 || b.width <= 0 || b.height <= 0)
+ {
+ return false;
+ }
- // return (a.x <= b.right && b.x <= a.right && a.y <= b.bottom && b.y <= a.bottom);
-
- // return (a.left <= b.right && b.left <= a.right && a.top <= b.bottom && b.top <= a.bottom);
- // return !(a.x > b.right + tolerance || a.right < b.x - tolerance || a.y > b.bottom + tolerance || a.bottom < b.y - tolerance);
+ return !(a.right < b.x || a.bottom < b.y || a.x > b.right || a.y > b.bottom);
};
@@ -1124,13 +1120,13 @@ Phaser.Rectangle.union = function (a, b, out) {
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:25 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/RenderTexture.js.html b/docs/RenderTexture.js.html
index ef4b643d..b85fcadd 100644
--- a/docs/RenderTexture.js.html
+++ b/docs/RenderTexture.js.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -423,7 +417,7 @@
/**
* @author Richard Davey <rich@photonstorm.com>
-* @copyright 2013 Photon Storm Ltd.
+* @copyright 2014 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -494,16 +488,19 @@ Phaser.RenderTexture.prototype.constructor = PIXI.RenderTexture;
/**
* This function will draw the display object to the texture. If the display object is a Group or has children it will
* draw all children as well.
-*
-* @method render
+*
+* @method Phaser.RenderTexture#render
+* @memberof Phaser.RenderTexture
* @param {DisplayObject} displayObject - The display object to render this texture on.
* @param {Phaser.Point} [position] - Where to draw the display object.
* @param {boolean} [clear=false] - If true the texture will be cleared before the displayObject is drawn.
+* @param {boolean} [renderHidden=false] - If true displayObjects that have their visible property set to false will still be rendered.
*/
-Phaser.RenderTexture.prototype.render = function(displayObject, position, clear) {
+Phaser.RenderTexture.prototype.render = function(displayObject, position, clear, renderHidden) {
if (typeof position === 'undefined') { position = false; }
if (typeof clear === 'undefined') { clear = false; }
+ if (typeof renderHidden === 'undefined') { renderHidden = false; }
if (displayObject instanceof Phaser.Group)
{
@@ -512,11 +509,11 @@ Phaser.RenderTexture.prototype.render = function(displayObject, position, clear)
if (PIXI.gl)
{
- this.renderWebGL(displayObject, position, clear);
+ this.renderWebGL(displayObject, position, clear, renderHidden);
}
else
{
- this.renderCanvas(displayObject, position, clear);
+ this.renderCanvas(displayObject, position, clear, renderHidden);
}
}
@@ -525,29 +522,32 @@ Phaser.RenderTexture.prototype.render = function(displayObject, position, clear)
* This function will draw the display object to the texture at the given x/y coordinates.
* If the display object is a Group or has children it will draw all children as well.
*
-* @method renderXY
+* @method Phaser.RenderTexture#renderXY
+* @memberof Phaser.RenderTexture
* @param {DisplayObject} displayObject - The display object to render this texture on.
* @param {number} x - The x coordinate to draw the display object at.
* @param {number} y - The y coordinate to draw the display object at.
* @param {boolean} [clear=false] - If true the texture will be cleared before the displayObject is drawn.
+* @param {boolean} [renderHidden=false] - If true displayObjects that have their visible property set to false will still be rendered.
*/
-Phaser.RenderTexture.prototype.renderXY = function(displayObject, x, y, clear) {
+Phaser.RenderTexture.prototype.renderXY = function(displayObject, x, y, clear, renderHidden) {
this._tempPoint.x = x;
this._tempPoint.y = y;
- this.render(displayObject, this._tempPoint, clear);
+ this.render(displayObject, this._tempPoint, clear, renderHidden);
}
/**
- * Initializes the webgl data for this texture
- *
- * @method initWebGL
- * @private
- */
-Phaser.RenderTexture.prototype.initWebGL = function()
-{
+* Initializes the webgl data for this texture
+*
+* @method Phaser.RenderTexture#initWebGL
+* @memberof Phaser.RenderTexture
+* @private
+*/
+Phaser.RenderTexture.prototype.initWebGL = function() {
+
var gl = PIXI.gl;
this.glFramebuffer = gl.createFramebuffer();
@@ -583,7 +583,12 @@ Phaser.RenderTexture.prototype.initWebGL = function()
// this.render = this.renderWebGL;
}
-
+/**
+* Resizes the RenderTexture.
+*
+* @method Phaser.RenderTexture#resize
+* @memberof Phaser.RenderTexture
+*/
Phaser.RenderTexture.prototype.resize = function(width, height)
{
@@ -609,11 +614,12 @@ Phaser.RenderTexture.prototype.resize = function(width, height)
}
/**
- * Initializes the canvas data for this texture
- *
- * @method initCanvas
- * @private
- */
+* Initializes the canvas data for this texture
+*
+* @method Phaser.RenderTexture#initCanvas
+* @memberof Phaser.RenderTexture
+* @private
+*/
Phaser.RenderTexture.prototype.initCanvas = function()
{
this.renderer = new PIXI.CanvasRenderer(this.width, this.height, null, 0);
@@ -625,14 +631,17 @@ Phaser.RenderTexture.prototype.initCanvas = function()
}
/**
- * This function will draw the display object to the texture.
- *
- * @method renderWebGL
- * @param displayObject {DisplayObject} The display object to render this texture on
- * @param clear {Boolean} If true the texture will be cleared before the displayObject is drawn
- * @private
- */
-Phaser.RenderTexture.prototype.renderWebGL = function(displayObject, position, clear)
+* This function will draw the display object to the texture.
+*
+* @method Phaser.RenderTexture#renderWebGL
+* @memberof Phaser.RenderTexture
+* @private
+* @param {DisplayObject} displayObject - The display object to render this texture on.
+* @param {Phaser.Point} [position] - Where to draw the display object.
+* @param {boolean} [clear=false] - If true the texture will be cleared before the displayObject is drawn.
+* @param {boolean} [renderHidden=false] - If true displayObjects that have their visible property set to false will still be rendered.
+*/
+Phaser.RenderTexture.prototype.renderWebGL = function(displayObject, position, clear, renderHidden)
{
var gl = PIXI.gl;
@@ -703,12 +712,15 @@ Phaser.RenderTexture.prototype.renderWebGL = function(displayObject, position, c
/**
* This function will draw the display object to the texture.
*
- * @method renderCanvas
- * @param displayObject {DisplayObject} The display object to render this texture on
- * @param clear {Boolean} If true the texture will be cleared before the displayObject is drawn
- * @private
- */
-Phaser.RenderTexture.prototype.renderCanvas = function(displayObject, position, clear)
+* @method Phaser.RenderTexture#renderCanvas
+* @memberof Phaser.RenderTexture
+* @private
+* @param {DisplayObject} displayObject - The display object to render this texture on.
+* @param {Phaser.Point} [position] - Where to draw the display object.
+* @param {boolean} [clear=false] - If true the texture will be cleared before the displayObject is drawn.
+* @param {boolean} [renderHidden=false] - If true displayObjects that have their visible property set to false will still be rendered.
+*/
+Phaser.RenderTexture.prototype.renderCanvas = function(displayObject, position, clear, renderHidden)
{
var children = displayObject.children;
@@ -729,12 +741,11 @@ Phaser.RenderTexture.prototype.renderCanvas = function(displayObject, position,
{
this.renderer.context.clearRect(0, 0, this.width, this.height);
}
-
- this.renderer.renderDisplayObject(displayObject);
+
+ this.renderer.renderDisplayObject(displayObject, renderHidden);
this.renderer.context.setTransform(1, 0, 0, 1, 0, 0);
- // PIXI.texturesToUpdate.push(this.baseTexture);
}
@@ -751,13 +762,13 @@ Phaser.RenderTexture.prototype.renderCanvas = function(displayObject, position,
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:25 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/RequestAnimationFrame.js.html b/docs/RequestAnimationFrame.js.html
index f78cb6cf..c47f23db 100644
--- a/docs/RequestAnimationFrame.js.html
+++ b/docs/RequestAnimationFrame.js.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -423,7 +417,7 @@
/**
* @author Richard Davey <rich@photonstorm.com>
-* @copyright 2013 Photon Storm Ltd.
+* @copyright 2014 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -483,7 +477,7 @@ Phaser.RequestAnimationFrame = function(game) {
Phaser.RequestAnimationFrame.prototype = {
/**
- * Starts the requestAnimatioFrame running or setTimeout if unavailable in browser
+ * Starts the requestAnimationFrame running or setTimeout if unavailable in browser
* @method Phaser.RequestAnimationFrame#start
*/
start: function () {
@@ -577,7 +571,10 @@ Phaser.RequestAnimationFrame.prototype = {
return (this._isSetTimeOut === false);
}
-};
+};
+
+Phaser.RequestAnimationFrame.prototype.constructor = Phaser.RequestAnimationFrame;
+
@@ -592,13 +589,13 @@ Phaser.RequestAnimationFrame.prototype = {
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:25 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/SAT.js.html b/docs/SAT.js.html
new file mode 100644
index 00000000..daffcd9a
--- /dev/null
+++ b/docs/SAT.js.html
@@ -0,0 +1,1340 @@
+
+
+
+
+
+ Phaser Source: physics/arcade/SAT.js
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Source: physics/arcade/SAT.js
+
+
+
+ // Version 0.2 - Copyright 2013 - Jim Riecken <jimr@jimr.ca>
+//
+// Released under the MIT License - https://github.com/jriecken/sat-js
+//
+// A simple library for determining intersections of circles and
+// polygons using the Separating Axis Theorem.
+/** @preserve SAT.js - Version 0.2 - Copyright 2013 - Jim Riecken <jimr@jimr.ca> - released under the MIT License. https://github.com/jriecken/sat-js */
+
+/*global define: false, module: false*/
+/*jshint shadow:true, sub:true, forin:true, noarg:true, noempty:true,
+ eqeqeq:true, bitwise:true, strict:true, undef:true,
+ curly:true, browser:true */
+
+// Create a UMD wrapper for SAT. Works in:
+//
+// - Plain browser via global SAT variable
+// - AMD loader (like require.js)
+// - Node.js
+//
+// The quoted properties all over the place are used so that the Closure Compiler
+// does not mangle the exposed API in advanced mode.
+/**
+ * @param {*} root - The global scope
+ * @param {Function} factory - Factory that creates SAT module
+ */
+(function (root, factory) {
+ "use strict";
+ if (typeof define === 'function' && define['amd']) {
+ define(factory);
+ } else if (typeof exports === 'object') {
+ module['exports'] = factory();
+ } else {
+ root['SAT'] = factory();
+ }
+}(this, function () {
+ "use strict";
+
+ var SAT = {};
+
+ //
+ // ## Vector
+ //
+ // Represents a vector in two dimensions with `x` and `y` properties.
+
+
+ // Create a new Vector, optionally passing in the `x` and `y` coordinates. If
+ // a coordinate is not specified, it will be set to `0`
+ /**
+ * @param {?number=} x The x position.
+ * @param {?number=} y The y position.
+ * @constructor
+ */
+ function Vector(x, y) {
+ this['x'] = x || 0;
+ this['y'] = y || 0;
+ }
+ SAT['Vector'] = Vector;
+ // Alias `Vector` as `V`
+ SAT['V'] = Vector;
+
+
+ // Copy the values of another Vector into this one.
+ /**
+ * @param {Vector} other The other Vector.
+ * @return {Vector} This for chaining.
+ */
+ Vector.prototype['copy'] = Vector.prototype.copy = function(other) {
+ this['x'] = other['x'];
+ this['y'] = other['y'];
+ return this;
+ };
+
+ // Change this vector to be perpendicular to what it was before. (Effectively
+ // roatates it 90 degrees in a clockwise direction)
+ /**
+ * @return {Vector} This for chaining.
+ */
+ Vector.prototype['perp'] = Vector.prototype.perp = function() {
+ var x = this['x'];
+ this['x'] = this['y'];
+ this['y'] = -x;
+ return this;
+ };
+
+ // Rotate this vector (counter-clockwise) by the specified angle (in radians).
+ /**
+ * @param {number} angle The angle to rotate (in radians)
+ * @return {Vector} This for chaining.
+ */
+ Vector.prototype['rotate'] = Vector.prototype.rotate = function (angle) {
+ var x = this['x'];
+ var y = this['y'];
+ this['x'] = x * Math.cos(angle) - y * Math.sin(angle);
+ this['y'] = x * Math.sin(angle) + y * Math.cos(angle);
+ return this;
+ };
+
+ // Rotate this vector (counter-clockwise) by the specified angle (in radians) which has already been calculated into sin and cos.
+ /**
+ * @param {number} sin - The Math.sin(angle)
+ * @param {number} cos - The Math.cos(angle)
+ * @return {Vector} This for chaining.
+ */
+ Vector.prototype['rotatePrecalc'] = Vector.prototype.rotatePrecalc = function (sin, cos) {
+ var x = this['x'];
+ var y = this['y'];
+ this['x'] = x * cos - y * sin;
+ this['y'] = x * sin + y * cos;
+ return this;
+ };
+
+ // Reverse this vector.
+ /**
+ * @return {Vector} This for chaining.
+ */
+ Vector.prototype['reverse'] = Vector.prototype.reverse = function() {
+ this['x'] = -this['x'];
+ this['y'] = -this['y'];
+ return this;
+ };
+
+
+ // Normalize this vector. (make it have length of `1`)
+ /**
+ * @return {Vector} This for chaining.
+ */
+ Vector.prototype['normalize'] = Vector.prototype.normalize = function() {
+ var d = this.len();
+ if(d > 0) {
+ this['x'] = this['x'] / d;
+ this['y'] = this['y'] / d;
+ }
+ return this;
+ };
+
+ // Add another vector to this one.
+ /**
+ * @param {Vector} other The other Vector.
+ * @return {Vector} This for chaining.
+ */
+ Vector.prototype['add'] = Vector.prototype.add = function(other) {
+ this['x'] += other['x'];
+ this['y'] += other['y'];
+ return this;
+ };
+
+ // Subtract another vector from this one.
+ /**
+ * @param {Vector} other The other Vector.
+ * @return {Vector} This for chaiing.
+ */
+ Vector.prototype['sub'] = Vector.prototype.sub = function(other) {
+ this['x'] -= other['x'];
+ this['y'] -= other['y'];
+ return this;
+ };
+
+ // Scale this vector. An independant scaling factor can be provided
+ // for each axis, or a single scaling factor that will scale both `x` and `y`.
+ /**
+ * @param {number} x The scaling factor in the x direction.
+ * @param {?number=} y The scaling factor in the y direction. If this
+ * is not specified, the x scaling factor will be used.
+ * @return {Vector} This for chaining.
+ */
+ Vector.prototype['scale'] = Vector.prototype.scale = function(x,y) {
+ this['x'] *= x;
+ this['y'] *= y || x;
+ return this;
+ };
+
+ // Project this vector on to another vector.
+ /**
+ * @param {Vector} other The vector to project onto.
+ * @return {Vector} This for chaining.
+ */
+ Vector.prototype['project'] = Vector.prototype.project = function(other) {
+ var amt = this.dot(other) / other.len2();
+ this['x'] = amt * other['x'];
+ this['y'] = amt * other['y'];
+ return this;
+ };
+
+ // Project this vector onto a vector of unit length. This is slightly more efficient
+ // than `project` when dealing with unit vectors.
+ /**
+ * @param {Vector} other The unit vector to project onto.
+ * @return {Vector} This for chaining.
+ */
+ Vector.prototype['projectN'] = Vector.prototype.projectN = function(other) {
+ var amt = this.dot(other);
+ this['x'] = amt * other['x'];
+ this['y'] = amt * other['y'];
+ return this;
+ };
+
+ // Reflect this vector on an arbitrary axis.
+ /**
+ * @param {Vector} axis The vector representing the axis.
+ * @return {Vector} This for chaining.
+ */
+ Vector.prototype['reflect'] = Vector.prototype.reflect = function(axis) {
+ var x = this['x'];
+ var y = this['y'];
+ this.project(axis).scale(2);
+ this['x'] -= x;
+ this['y'] -= y;
+ return this;
+ };
+
+ // Reflect this vector on an arbitrary axis (represented by a unit vector). This is
+ // slightly more efficient than `reflect` when dealing with an axis that is a unit vector.
+ /**
+ * @param {Vector} axis The unit vector representing the axis.
+ * @return {Vector} This for chaining.
+ */
+ Vector.prototype['reflectN'] = Vector.prototype.reflectN = function(axis) {
+ var x = this['x'];
+ var y = this['y'];
+ this.projectN(axis).scale(2);
+ this['x'] -= x;
+ this['y'] -= y;
+ return this;
+ };
+
+ // Get the dot product of this vector and another.
+ /**
+ * @param {Vector} other The vector to dot this one against.
+ * @return {number} The dot product.
+ */
+ Vector.prototype['dot'] = Vector.prototype.dot = function(other) {
+ return this['x'] * other['x'] + this['y'] * other['y'];
+ };
+
+ // Get the squared length of this vector.
+ /**
+ * @return {number} The length^2 of this vector.
+ */
+ Vector.prototype['len2'] = Vector.prototype.len2 = function() {
+ return this.dot(this);
+ };
+
+ // Get the length of this vector.
+ /**
+ * @return {number} The length of this vector.
+ */
+ Vector.prototype['len'] = Vector.prototype.len = function() {
+ return Math.sqrt(this.len2());
+ };
+
+ // ## Circle
+ //
+ // Represents a circle with a position and a radius.
+
+ // Create a new circle, optionally passing in a position and/or radius. If no position
+ // is given, the circle will be at `(0,0)`. If no radius is provided, the circle will
+ // have a radius of `0`.
+ /**
+ * @param {Vector=} pos A vector representing the position of the center of the circle
+ * @param {?number=} r The radius of the circle
+ * @constructor
+ */
+ function Circle(pos, r) {
+ this['pos'] = pos || new Vector();
+ this['r'] = r || 0;
+ }
+ SAT['Circle'] = Circle;
+
+ // ## Polygon
+ //
+ // Represents a *convex* polygon with any number of points (specified in counter-clockwise order)
+ //
+ // The edges/normals of the polygon will be calculated on creation and stored in the
+ // `edges` and `normals` properties. If you change the polygon's points, you will need
+ // to call `recalc` to recalculate the edges/normals.
+
+ // Create a new polygon, passing in a position vector, and an array of points (represented
+ // by vectors relative to the position vector). If no position is passed in, the position
+ // of the polygon will be `(0,0)`.
+ /**
+ * @param {Vector=} pos A vector representing the origin of the polygon. (all other
+ * points are relative to this one)
+ * @param {Array.<Vector>=} points An array of vectors representing the points in the polygon,
+ * in counter-clockwise order.
+ * @constructor
+ */
+ function Polygon(pos, points) {
+ this['pos'] = pos || new Vector();
+ this['points'] = points || [];
+ this.recalc();
+ }
+ SAT['Polygon'] = Polygon;
+
+ // Recalculates the edges and normals of the polygon. This **must** be called
+ // if the `points` array is modified at all and the edges or normals are to be
+ // accessed.
+ /**
+ * @return {Polygon} This for chaining.
+ */
+ Polygon.prototype['recalc'] = Polygon.prototype.recalc = function() {
+ // The edges here are the direction of the `n`th edge of the polygon, relative to
+ // the `n`th point. If you want to draw a given edge from the edge value, you must
+ // first translate to the position of the starting point.
+ this['edges'] = [];
+ // The normals here are the direction of the normal for the `n`th edge of the polygon, relative
+ // to the position of the `n`th point. If you want to draw an edge normal, you must first
+ // translate to the position of the starting point.
+ this['normals'] = [];
+ var points = this['points'];
+ var len = points.length;
+ for (var i = 0; i < len; i++) {
+ var p1 = points[i];
+ var p2 = i < len - 1 ? points[i + 1] : points[0];
+ var e = new Vector().copy(p2).sub(p1);
+ var n = new Vector().copy(e).perp().normalize();
+ this['edges'].push(e);
+ this['normals'].push(n);
+ }
+ return this;
+ };
+
+ // Rotates this polygon counter-clockwise around the origin of *its local coordinate system* (i.e. `pos`).
+ //
+ // Note: You do **not** need to call `recalc` after rotation.
+ /**
+ * @param {number} angle The angle to rotate (in radians)
+ * @return {Polygon} This for chaining.
+ */
+ Polygon.prototype['rotate'] = Polygon.prototype.rotate = function(angle) {
+ var i;
+ var points = this['points'];
+ var edges = this['edges'];
+ var normals = this['normals'];
+ var len = points.length;
+
+ // Calc it just the once, rather than 4 times per array element
+ var cos = Math.cos(angle);
+ var sin = Math.sin(angle);
+
+ for (i = 0; i < len; i++) {
+ points[i].rotatePrecalc(sin, cos);
+ edges[i].rotatePrecalc(sin, cos);
+ normals[i].rotatePrecalc(sin, cos);
+ }
+ return this;
+ };
+
+ // Rotates this polygon counter-clockwise around the origin of *its local coordinate system* (i.e. `pos`).
+ //
+ // Note: You do **not** need to call `recalc` after rotation.
+ /**
+ * @param {number} angle The angle to rotate (in radians)
+ * @return {Polygon} This for chaining.
+ */
+ Polygon.prototype['scale'] = Polygon.prototype.scale = function(x, y) {
+ var i;
+ var points = this['points'];
+ var edges = this['edges'];
+ var normals = this['normals'];
+ var len = points.length;
+ for (i = 0; i < len; i++) {
+ points[i].scale(x,y);
+ edges[i].scale(x,y);
+ normals[i].scale(x,y);
+ }
+ return this;
+ };
+
+ // Translates the points of this polygon by a specified amount relative to the origin of *its own coordinate
+ // system* (i.e. `pos`).
+ //
+ // This is most useful to change the "center point" of a polygon.
+ //
+ // Note: You do **not** need to call `recalc` after translation.
+ /**
+ * @param {number} x The horizontal amount to translate.
+ * @param {number} y The vertical amount to translate.
+ * @return {Polygon} This for chaining.
+ */
+ Polygon.prototype['translate'] = Polygon.prototype.translate = function (x, y) {
+ var i;
+ var points = this['points'];
+ var len = points.length;
+ for (i = 0; i < len; i++) {
+ points[i].x += x;
+ points[i].y += y;
+ }
+ return this;
+ };
+
+ // ## Box
+ //
+ // Represents an axis-aligned box, with a width and height.
+
+
+ // Create a new box, with the specified position, width, and height. If no position
+ // is given, the position will be `(0,0)`. If no width or height are given, they will
+ // be set to `0`.
+ /**
+ * @param {Vector=} pos A vector representing the top-left of the box.
+ * @param {?number=} w The width of the box.
+ * @param {?number=} h The height of the box.
+ * @constructor
+ */
+ function Box(pos, w, h) {
+ this['pos'] = pos || new Vector();
+ this['w'] = w || 0;
+ this['h'] = h || 0;
+ }
+ SAT['Box'] = Box;
+
+ // Returns a polygon whose edges are the same as this box.
+ /**
+ * @return {Polygon} A new Polygon that represents this box.
+ */
+ Box.prototype['toPolygon'] = Box.prototype.toPolygon = function() {
+ var pos = this['pos'];
+ var w = this['w'];
+ var h = this['h'];
+ return new Polygon(new Vector(pos['x'], pos['y']), [
+ new Vector(), new Vector(w, 0),
+ new Vector(w,h), new Vector(0,h)
+ ]);
+ };
+
+ // ## Response
+ //
+ // An object representing the result of an intersection. Contains:
+ // - The two objects participating in the intersection
+ // - The vector representing the minimum change necessary to extract the first object
+ // from the second one (as well as a unit vector in that direction and the magnitude
+ // of the overlap)
+ // - Whether the first object is entirely inside the second, and vice versa.
+ /**
+ * @constructor
+ */
+ function Response() {
+ this['a'] = null;
+ this['b'] = null;
+ this['overlapN'] = new Vector();
+ this['overlapV'] = new Vector();
+ this.clear();
+ }
+ SAT['Response'] = Response;
+
+ // Set some values of the response back to their defaults. Call this between tests if
+ // you are going to reuse a single Response object for multiple intersection tests (recommented
+ // as it will avoid allcating extra memory)
+ /**
+ * @return {Response} This for chaining
+ */
+ Response.prototype['clear'] = Response.prototype.clear = function() {
+ this['aInB'] = true;
+ this['bInA'] = true;
+ this['overlap'] = Number.MAX_VALUE;
+ return this;
+ };
+
+ // ## Object Pools
+
+ // A pool of `Vector` objects that are used in calculations to avoid
+ // allocating memory.
+ /**
+ * @type {Array.<Vector>}
+ */
+ var T_VECTORS = [];
+ for (var i = 0; i < 10; i++) { T_VECTORS.push(new Vector()); }
+
+ // A pool of arrays of numbers used in calculations to avoid allocating
+ // memory.
+ /**
+ * @type {Array.<Array.<number>>}
+ */
+ var T_ARRAYS = [];
+ for (var i = 0; i < 5; i++) { T_ARRAYS.push([]); }
+
+ // ## Helper Functions
+
+ // Flattens the specified array of points onto a unit vector axis,
+ // resulting in a one dimensional range of the minimum and
+ // maximum value on that axis.
+ /**
+ * @param {Array.<Vector>} points The points to flatten.
+ * @param {Vector} normal The unit vector axis to flatten on.
+ * @param {Array.<number>} result An array. After calling this function,
+ * result[0] will be the minimum value,
+ * result[1] will be the maximum value.
+ */
+ function flattenPointsOn(points, normal, result) {
+ var min = Number.MAX_VALUE;
+ var max = -Number.MAX_VALUE;
+ var len = points.length;
+ for (var i = 0; i < len; i++ ) {
+ // The magnitude of the projection of the point onto the normal
+ var dot = points[i].dot(normal);
+ if (dot < min) { min = dot; }
+ if (dot > max) { max = dot; }
+ }
+ result[0] = min; result[1] = max;
+ }
+
+ // Check whether two convex polygons are separated by the specified
+ // axis (must be a unit vector).
+ /**
+ * @param {Vector} aPos The position of the first polygon.
+ * @param {Vector} bPos The position of the second polygon.
+ * @param {Array.<Vector>} aPoints The points in the first polygon.
+ * @param {Array.<Vector>} bPoints The points in the second polygon.
+ * @param {Vector} axis The axis (unit sized) to test against. The points of both polygons
+ * will be projected onto this axis.
+ * @param {Response=} response A Response object (optional) which will be populated
+ * if the axis is not a separating axis.
+ * @return {boolean} true if it is a separating axis, false otherwise. If false,
+ * and a response is passed in, information about how much overlap and
+ * the direction of the overlap will be populated.
+ */
+ function isSeparatingAxis(aPos, bPos, aPoints, bPoints, axis, response) {
+ var rangeA = T_ARRAYS.pop();
+ var rangeB = T_ARRAYS.pop();
+ // The magnitude of the offset between the two polygons
+ var offsetV = T_VECTORS.pop().copy(bPos).sub(aPos);
+ var projectedOffset = offsetV.dot(axis);
+ // Project the polygons onto the axis.
+ flattenPointsOn(aPoints, axis, rangeA);
+ flattenPointsOn(bPoints, axis, rangeB);
+ // Move B's range to its position relative to A.
+ rangeB[0] += projectedOffset;
+ rangeB[1] += projectedOffset;
+ // Check if there is a gap. If there is, this is a separating axis and we can stop
+ if (rangeA[0] > rangeB[1] || rangeB[0] > rangeA[1]) {
+ T_VECTORS.push(offsetV);
+ T_ARRAYS.push(rangeA);
+ T_ARRAYS.push(rangeB);
+ return true;
+ }
+ // This is not a separating axis. If we're calculating a response, calculate the overlap.
+ if (response) {
+ var overlap = 0;
+ // A starts further left than B
+ if (rangeA[0] < rangeB[0]) {
+ response['aInB'] = false;
+ // A ends before B does. We have to pull A out of B
+ if (rangeA[1] < rangeB[1]) {
+ overlap = rangeA[1] - rangeB[0];
+ response['bInA'] = false;
+ // B is fully inside A. Pick the shortest way out.
+ } else {
+ var option1 = rangeA[1] - rangeB[0];
+ var option2 = rangeB[1] - rangeA[0];
+ overlap = option1 < option2 ? option1 : -option2;
+ }
+ // B starts further left than A
+ } else {
+ response['bInA'] = false;
+ // B ends before A ends. We have to push A out of B
+ if (rangeA[1] > rangeB[1]) {
+ overlap = rangeA[0] - rangeB[1];
+ response['aInB'] = false;
+ // A is fully inside B. Pick the shortest way out.
+ } else {
+ var option1 = rangeA[1] - rangeB[0];
+ var option2 = rangeB[1] - rangeA[0];
+ overlap = option1 < option2 ? option1 : -option2;
+ }
+ }
+ // If this is the smallest amount of overlap we've seen so far, set it as the minimum overlap.
+ var absOverlap = Math.abs(overlap);
+ if (absOverlap < response['overlap']) {
+ response['overlap'] = absOverlap;
+ response['overlapN'].copy(axis);
+ if (overlap < 0) {
+ response['overlapN'].reverse();
+ }
+ }
+ }
+ T_VECTORS.push(offsetV);
+ T_ARRAYS.push(rangeA);
+ T_ARRAYS.push(rangeB);
+ return false;
+ }
+
+ // Calculates which Vornoi region a point is on a line segment.
+ // It is assumed that both the line and the point are relative to `(0,0)`
+ //
+ // | (0) |
+ // (-1) [S]--------------[E] (1)
+ // | (0) |
+ /**
+ * @param {Vector} line The line segment.
+ * @param {Vector} point The point.
+ * @return {number} LEFT_VORNOI_REGION (-1) if it is the left region,
+ * MIDDLE_VORNOI_REGION (0) if it is the middle region,
+ * RIGHT_VORNOI_REGION (1) if it is the right region.
+ */
+ function vornoiRegion(line, point) {
+ var len2 = line.len2();
+ var dp = point.dot(line);
+ // If the point is beyond the start of the line, it is in the
+ // left vornoi region.
+ if (dp < 0) { return LEFT_VORNOI_REGION; }
+ // If the point is beyond the end of the line, it is in the
+ // right vornoi region.
+ else if (dp > len2) { return RIGHT_VORNOI_REGION; }
+ // Otherwise, it's in the middle one.
+ else { return MIDDLE_VORNOI_REGION; }
+ }
+ // Constants for Vornoi regions
+ /**
+ * @const
+ */
+ var LEFT_VORNOI_REGION = -1;
+ /**
+ * @const
+ */
+ var MIDDLE_VORNOI_REGION = 0;
+ /**
+ * @const
+ */
+ var RIGHT_VORNOI_REGION = 1;
+
+ // ## Collision Tests
+
+ // Check if two circles collide.
+ /**
+ * @param {Circle} a The first circle.
+ * @param {Circle} b The second circle.
+ * @param {Response=} response Response object (optional) that will be populated if
+ * the circles intersect.
+ * @return {boolean} true if the circles intersect, false if they don't.
+ */
+ function testCircleCircle(a, b, response) {
+ // Check if the distance between the centers of the two
+ // circles is greater than their combined radius.
+ var differenceV = T_VECTORS.pop().copy(b['pos']).sub(a['pos']);
+ var totalRadius = a['r'] + b['r'];
+ var totalRadiusSq = totalRadius * totalRadius;
+ var distanceSq = differenceV.len2();
+ // If the distance is bigger than the combined radius, they don't intersect.
+ if (distanceSq > totalRadiusSq) {
+ T_VECTORS.push(differenceV);
+ return false;
+ }
+ // They intersect. If we're calculating a response, calculate the overlap.
+ if (response) {
+ var dist = Math.sqrt(distanceSq);
+ response['a'] = a;
+ response['b'] = b;
+ response['overlap'] = totalRadius - dist;
+ response['overlapN'].copy(differenceV.normalize());
+ response['overlapV'].copy(differenceV).scale(response['overlap']);
+ response['aInB']= a['r'] <= b['r'] && dist <= b['r'] - a['r'];
+ response['bInA'] = b['r'] <= a['r'] && dist <= a['r'] - b['r'];
+ }
+ T_VECTORS.push(differenceV);
+ return true;
+ }
+ SAT['testCircleCircle'] = testCircleCircle;
+
+ // Check if a polygon and a circle collide.
+ /**
+ * @param {Polygon} polygon The polygon.
+ * @param {Circle} circle The circle.
+ * @param {Response=} response Response object (optional) that will be populated if
+ * they interset.
+ * @return {boolean} true if they intersect, false if they don't.
+ */
+ function testPolygonCircle(polygon, circle, response) {
+ // Get the position of the circle relative to the polygon.
+ var circlePos = T_VECTORS.pop().copy(circle['pos']).sub(polygon['pos']);
+ var radius = circle['r'];
+ var radius2 = radius * radius;
+ var points = polygon['points'];
+ var len = points.length;
+ var edge = T_VECTORS.pop();
+ var point = T_VECTORS.pop();
+
+ // For each edge in the polygon:
+ for (var i = 0; i < len; i++) {
+ var next = i === len - 1 ? 0 : i + 1;
+ var prev = i === 0 ? len - 1 : i - 1;
+ var overlap = 0;
+ var overlapN = null;
+
+ // Get the edge.
+ edge.copy(polygon['edges'][i]);
+ // Calculate the center of the circle relative to the starting point of the edge.
+ point.copy(circlePos).sub(points[i]);
+
+ // If the distance between the center of the circle and the point
+ // is bigger than the radius, the polygon is definitely not fully in
+ // the circle.
+ if (response && point.len2() > radius2) {
+ response['aInB'] = false;
+ }
+
+ // Calculate which Vornoi region the center of the circle is in.
+ var region = vornoiRegion(edge, point);
+ // If it's the left region:
+ if (region === LEFT_VORNOI_REGION) {
+ // We need to make sure we're in the RIGHT_VORNOI_REGION of the previous edge.
+ edge.copy(polygon['edges'][prev]);
+ // Calculate the center of the circle relative the starting point of the previous edge
+ var point2 = T_VECTORS.pop().copy(circlePos).sub(points[prev]);
+ region = vornoiRegion(edge, point2);
+ if (region === RIGHT_VORNOI_REGION) {
+ // It's in the region we want. Check if the circle intersects the point.
+ var dist = point.len();
+ if (dist > radius) {
+ // No intersection
+ T_VECTORS.push(circlePos);
+ T_VECTORS.push(edge);
+ T_VECTORS.push(point);
+ T_VECTORS.push(point2);
+ return false;
+ } else if (response) {
+ // It intersects, calculate the overlap.
+ response['bInA'] = false;
+ overlapN = point.normalize();
+ overlap = radius - dist;
+ }
+ }
+ T_VECTORS.push(point2);
+ // If it's the right region:
+ } else if (region === RIGHT_VORNOI_REGION) {
+ // We need to make sure we're in the left region on the next edge
+ edge.copy(polygon['edges'][next]);
+ // Calculate the center of the circle relative to the starting point of the next edge.
+ point.copy(circlePos).sub(points[next]);
+ region = vornoiRegion(edge, point);
+ if (region === LEFT_VORNOI_REGION) {
+ // It's in the region we want. Check if the circle intersects the point.
+ var dist = point.len();
+ if (dist > radius) {
+ // No intersection
+ T_VECTORS.push(circlePos);
+ T_VECTORS.push(edge);
+ T_VECTORS.push(point);
+ return false;
+ } else if (response) {
+ // It intersects, calculate the overlap.
+ response['bInA'] = false;
+ overlapN = point.normalize();
+ overlap = radius - dist;
+ }
+ }
+ // Otherwise, it's the middle region:
+ } else {
+ // Need to check if the circle is intersecting the edge,
+ // Change the edge into its "edge normal".
+ var normal = edge.perp().normalize();
+ // Find the perpendicular distance between the center of the
+ // circle and the edge.
+ var dist = point.dot(normal);
+ var distAbs = Math.abs(dist);
+ // If the circle is on the outside of the edge, there is no intersection.
+ if (dist > 0 && distAbs > radius) {
+ // No intersection
+ T_VECTORS.push(circlePos);
+ T_VECTORS.push(normal);
+ T_VECTORS.push(point);
+ return false;
+ } else if (response) {
+ // It intersects, calculate the overlap.
+ overlapN = normal;
+ overlap = radius - dist;
+ // If the center of the circle is on the outside of the edge, or part of the
+ // circle is on the outside, the circle is not fully inside the polygon.
+ if (dist >= 0 || overlap < 2 * radius) {
+ response['bInA'] = false;
+ }
+ }
+ }
+
+ // If this is the smallest overlap we've seen, keep it.
+ // (overlapN may be null if the circle was in the wrong Vornoi region).
+ if (overlapN && response && Math.abs(overlap) < Math.abs(response['overlap'])) {
+ response['overlap'] = overlap;
+ response['overlapN'].copy(overlapN);
+ }
+ }
+
+ // Calculate the final overlap vector - based on the smallest overlap.
+ if (response) {
+ response['a'] = polygon;
+ response['b'] = circle;
+ response['overlapV'].copy(response['overlapN']).scale(response['overlap']);
+ }
+ T_VECTORS.push(circlePos);
+ T_VECTORS.push(edge);
+ T_VECTORS.push(point);
+ return true;
+ }
+ SAT['testPolygonCircle'] = testPolygonCircle;
+
+ // Check if a circle and a polygon collide.
+ //
+ // **NOTE:** This is slightly less efficient than polygonCircle as it just
+ // runs polygonCircle and reverses everything at the end.
+ /**
+ * @param {Circle} circle The circle.
+ * @param {Polygon} polygon The polygon.
+ * @param {Response=} response Response object (optional) that will be populated if
+ * they interset.
+ * @return {boolean} true if they intersect, false if they don't.
+ */
+ function testCirclePolygon(circle, polygon, response) {
+ // Test the polygon against the circle.
+ var result = testPolygonCircle(polygon, circle, response);
+ if (result && response) {
+ // Swap A and B in the response.
+ var a = response['a'];
+ var aInB = response['aInB'];
+ response['overlapN'].reverse();
+ response['overlapV'].reverse();
+ response['a'] = response['b'];
+ response['b'] = a;
+ response['aInB'] = response['bInA'];
+ response['bInA'] = aInB;
+ }
+ return result;
+ }
+ SAT['testCirclePolygon'] = testCirclePolygon;
+
+ // Checks whether polygons collide.
+ /**
+ * @param {Polygon} a The first polygon.
+ * @param {Polygon} b The second polygon.
+ * @param {Response=} response Response object (optional) that will be populated if
+ * they interset.
+ * @return {boolean} true if they intersect, false if they don't.
+ */
+ function testPolygonPolygon(a, b, response) {
+ var aPoints = a['points'];
+ var aLen = aPoints.length;
+ var bPoints = b['points'];
+ var bLen = bPoints.length;
+ // If any of the edge normals of A is a separating axis, no intersection.
+ for (var i = 0; i < aLen; i++) {
+ if (isSeparatingAxis(a['pos'], b['pos'], aPoints, bPoints, a['normals'][i], response)) {
+ return false;
+ }
+ }
+ // If any of the edge normals of B is a separating axis, no intersection.
+ for (var i = 0;i < bLen; i++) {
+ if (isSeparatingAxis(a['pos'], b['pos'], aPoints, bPoints, b['normals'][i], response)) {
+ return false;
+ }
+ }
+ // Since none of the edge normals of A or B are a separating axis, there is an intersection
+ // and we've already calculated the smallest overlap (in isSeparatingAxis). Calculate the
+ // final overlap vector.
+ if (response) {
+ response['a'] = a;
+ response['b'] = b;
+ response['overlapV'].copy(response['overlapN']).scale(response['overlap']);
+ }
+ return true;
+ }
+ SAT['testPolygonPolygon'] = testPolygonPolygon;
+
+ return SAT;
+}));
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
+
+
+
+
+ Documentation generated by JSDoc 3.3.0-dev
+ on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template .
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/docs/Signal.js.html b/docs/Signal.js.html
index da14fe14..02fe379b 100644
--- a/docs/Signal.js.html
+++ b/docs/Signal.js.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -423,7 +417,7 @@
/**
* @author Richard Davey <rich@photonstorm.com>
-* @copyright 2013 Photon Storm Ltd.
+* @copyright 2014 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -723,6 +717,8 @@ Phaser.Signal.prototype = {
}
};
+
+Phaser.Signal.prototype.constructor = Phaser.Signal;
@@ -738,13 +734,13 @@ Phaser.Signal.prototype = {
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:25 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/SignalBinding.html b/docs/SignalBinding.html
index 08019875..b3c0f540 100644
--- a/docs/SignalBinding.html
+++ b/docs/SignalBinding.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -733,13 +727,13 @@ Inspired by Joa Ebert AS3 SignalBinding and Robert Penner's Slot classes.
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:36 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:37 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/SignalBinding.js.html b/docs/SignalBinding.js.html
index 795bcae8..8bc0854f 100644
--- a/docs/SignalBinding.js.html
+++ b/docs/SignalBinding.js.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -423,7 +417,7 @@
/**
* @author Richard Davey <rich@photonstorm.com>
-* @copyright 2013 Photon Storm Ltd.
+* @copyright 2014 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -583,6 +577,8 @@ Phaser.SignalBinding.prototype = {
}
};
+
+Phaser.SignalBinding.prototype.constructor = Phaser.SignalBinding;
@@ -598,13 +594,13 @@ Phaser.SignalBinding.prototype = {
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:25 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/SinglePad.js.html b/docs/SinglePad.js.html
new file mode 100644
index 00000000..af2fdfca
--- /dev/null
+++ b/docs/SinglePad.js.html
@@ -0,0 +1,1048 @@
+
+
+
+
+
+ Phaser Source: input/SinglePad.js
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Source: input/SinglePad.js
+
+
+
+ /**
+* @author @karlmacklin <tacklemcclean@gmail.com>
+* @copyright 2014 Photon Storm Ltd.
+* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+*/
+
+/**
+* @class Phaser.SinglePad
+* @classdesc A single Phaser Gamepad
+* @constructor
+* @param {Phaser.Game} game - Current game instance.
+* @param {Object} padParent - The parent Phaser.Gamepad object (all gamepads reside under this)
+*/
+Phaser.SinglePad = function (game, padParent) {
+
+ /**
+ * @property {Phaser.Game} game - Local reference to game.
+ */
+ this.game = game;
+
+ /**
+ * @property {Phaser.Gamepad} padParent - Main Phaser Gamepad object
+ */
+ this._padParent = padParent;
+
+ /**
+ * @property {number} index - The gamepad index as per browsers data
+ * @default
+ */
+ this._index = null;
+
+ /**
+ * @property {Object} _rawPad - The 'raw' gamepad data.
+ * @private
+ */
+ this._rawPad = null;
+
+ /**
+ * @property {boolean} _connected - Is this pad connected or not.
+ * @private
+ */
+ this._connected = false;
+
+ /**
+ * @property {number} _prevTimestamp - Used to check for differences between earlier polls and current state of gamepads.
+ * @private
+ */
+ this._prevTimestamp = null;
+
+ /**
+ * @property {Array} _rawButtons - The 'raw' button state.
+ * @private
+ */
+ this._rawButtons = [];
+
+ /**
+ * @property {Array} _buttons - Current Phaser state of the buttons.
+ * @private
+ */
+ this._buttons = [];
+
+ /**
+ * @property {Array} _axes - Current axes state.
+ * @private
+ */
+ this._axes = [];
+
+ /**
+ * @property {Array} _hotkeys - Hotkey buttons.
+ * @private
+ */
+ this._hotkeys = [];
+
+ /**
+ * @property {Object} callbackContext - The context under which the callbacks are run.
+ */
+ this.callbackContext = this;
+
+ /**
+ * @property {function} onConnectCallback - This callback is invoked every time this gamepad is connected
+ */
+ this.onConnectCallback = null;
+
+ /**
+ * @property {function} onDisconnectCallback - This callback is invoked every time this gamepad is disconnected
+ */
+ this.onDisconnectCallback = null;
+
+ /**
+ * @property {function} onDownCallback - This callback is invoked every time a button is pressed down.
+ */
+ this.onDownCallback = null;
+
+ /**
+ * @property {function} onUpCallback - This callback is invoked every time a gamepad button is released.
+ */
+ this.onUpCallback = null;
+
+ /**
+ * @property {function} onAxisCallback - This callback is invoked every time an axis is changed.
+ */
+ this.onAxisCallback = null;
+
+ /**
+ * @property {function} onFloatCallback - This callback is invoked every time a button is changed to a value where value > 0 and value < 1.
+ */
+ this.onFloatCallback = null;
+
+ /**
+ * @property {number} deadZone - Dead zone for axis feedback - within this value you won't trigger updates.
+ */
+ this.deadZone = 0.26;
+
+};
+
+Phaser.SinglePad.prototype = {
+
+ /**
+ * Add callbacks to the this Gamepad to handle connect/disconnect/button down/button up/axis change/float value buttons
+ * @method Phaser.Gamepad#addCallbacks
+ * @param {Object} context - The context under which the callbacks are run.
+ * @param {Object} callbacks - Object that takes six different callbak methods:
+ * onConnectCallback, onDisconnectCallback, onDownCallback, onUpCallback, onAxisCallback, onFloatCallback
+ */
+ addCallbacks: function (context, callbacks) {
+
+ if (typeof callbacks !== 'undefined')
+ {
+ this.onConnectCallback = (typeof callbacks.onConnect === 'function') ? callbacks.onConnect : this.onConnectCallback;
+ this.onDisconnectCallback = (typeof callbacks.onDisconnect === 'function') ? callbacks.onDisconnect : this.onDisconnectCallback;
+ this.onDownCallback = (typeof callbacks.onDown === 'function') ? callbacks.onDown : this.onDownCallback;
+ this.onUpCallback = (typeof callbacks.onUp === 'function') ? callbacks.onUp : this.onUpCallback;
+ this.onAxisCallback = (typeof callbacks.onAxis === 'function') ? callbacks.onAxis : this.onAxisCallback;
+ this.onFloatCallback = (typeof callbacks.onFloat === 'function') ? callbacks.onFloat : this.onFloatCallback;
+ }
+
+ },
+
+ /**
+ * If you need more fine-grained control over a Key you can create a new Phaser.Key object via this method.
+ * The Key object can then be polled, have events attached to it, etc.
+ *
+ * @method Phaser.SinglePad#addButton
+ * @param {number} buttonCode - The buttonCode of the button, i.e. Phaser.Gamepad.BUTTON_0 or Phaser.Gamepad.BUTTON_1
+ * @return {Phaser.GamepadButton} The GamepadButton object which you can store locally and reference directly.
+ */
+ addButton: function (buttonCode) {
+
+ this._hotkeys[buttonCode] = new Phaser.GamepadButton(this.game, buttonCode);
+ return this._hotkeys[buttonCode];
+
+ },
+
+ /**
+ * Main update function, should be called by Phaser.Gamepad
+ * @method Phaser.SinglePad#pollStatus
+ */
+ pollStatus: function () {
+
+ if (this._rawPad.timestamp && (this._rawPad.timestamp == this._prevTimestamp))
+ {
+ return;
+ }
+
+ for (var i = 0; i < this._rawPad.buttons.length; i += 1)
+ {
+ var buttonValue = this._rawPad.buttons[i];
+
+ if (this._rawButtons[i] !== buttonValue)
+ {
+ if (buttonValue === 1)
+ {
+ this.processButtonDown(i, buttonValue);
+ }
+ else if (buttonValue === 0)
+ {
+ this.processButtonUp(i, buttonValue);
+ }
+ else
+ {
+ this.processButtonFloat(i, buttonValue);
+ }
+
+ this._rawButtons[i] = buttonValue;
+ }
+ }
+
+ var axes = this._rawPad.axes;
+
+ for (var j = 0; j < axes.length; j += 1)
+ {
+ var axis = axes[j];
+
+ if (axis > 0 && axis > this.deadZone || axis < 0 && axis < -this.deadZone)
+ {
+ this.processAxisChange({axis: j, value: axis});
+ }
+ else
+ {
+ this.processAxisChange({axis: j, value: 0});
+ }
+ }
+
+ this._prevTimestamp = this._rawPad.timestamp;
+
+ },
+
+ /**
+ * Gamepad connect function, should be called by Phaser.Gamepad
+ * @param {Object} rawPad - The raw gamepad object
+ * @method Phaser.SinglePad#connect
+ */
+ connect: function (rawPad) {
+
+ var triggerCallback = !this._connected;
+
+ this._index = rawPad.index;
+ this._connected = true;
+ this._rawPad = rawPad;
+ this._rawButtons = rawPad.buttons;
+ this._axes = rawPad.axes;
+
+ if (triggerCallback && this._padParent.onConnectCallback)
+ {
+ this._padParent.onConnectCallback.call(this._padParent.callbackContext, this._index);
+ }
+
+ if (triggerCallback && this.onConnectCallback)
+ {
+ this.onConnectCallback.call(this.callbackContext);
+ }
+
+ },
+
+ /**
+ * Gamepad disconnect function, should be called by Phaser.Gamepad
+ * @method Phaser.SinglePad#disconnect
+ */
+ disconnect: function () {
+
+ var triggerCallback = this._connected;
+ this._connected = false;
+ this._rawPad = undefined;
+ this._rawButtons = [];
+ this._buttons = [];
+ var disconnectingIndex = this._index;
+ this._index = null;
+
+ if (triggerCallback && this._padParent.onDisconnectCallback)
+ {
+ this._padParent.onDisconnectCallback.call(this._padParent.callbackContext, disconnectingIndex);
+ }
+
+ if (triggerCallback && this.onDisconnectCallback)
+ {
+ this.onDisconnectCallback.call(this.callbackContext);
+ }
+
+ },
+
+ /**
+ * Handles changes in axis
+ * @param {Object} axisState - State of the relevant axis
+ * @method Phaser.SinglePad#processAxisChange
+ */
+ processAxisChange: function (axisState) {
+
+ if (this.game.input.disabled || this.game.input.gamepad.disabled)
+ {
+ return;
+ }
+
+ if (this._axes[axisState.axis] === axisState.value)
+ {
+ return;
+ }
+
+ this._axes[axisState.axis] = axisState.value;
+
+ if (this._padParent.onAxisCallback)
+ {
+ this._padParent.onAxisCallback.call(this._padParent.callbackContext, axisState, this._index);
+ }
+
+ if (this.onAxisCallback)
+ {
+ this.onAxisCallback.call(this.callbackContext, axisState);
+ }
+
+ },
+
+ /**
+ * Handles button down press
+ * @param {number} buttonCode - Which buttonCode of this button
+ * @param {Object} value - Button value
+ * @method Phaser.SinglePad#processButtonDown
+ */
+ processButtonDown: function (buttonCode, value) {
+
+ if (this.game.input.disabled || this.game.input.gamepad.disabled)
+ {
+ return;
+ }
+
+ if (this._padParent.onDownCallback)
+ {
+ this._padParent.onDownCallback.call(this._padParent.callbackContext, buttonCode, value, this._index);
+ }
+
+ if (this.onDownCallback)
+ {
+ this.onDownCallback.call(this.callbackContext, buttonCode, value);
+ }
+
+ if (this._buttons[buttonCode] && this._buttons[buttonCode].isDown)
+ {
+ // Key already down and still down, so update
+ this._buttons[buttonCode].duration = this.game.time.now - this._buttons[buttonCode].timeDown;
+ }
+ else
+ {
+ if (!this._buttons[buttonCode])
+ {
+ // Not used this button before, so register it
+ this._buttons[buttonCode] = {
+ isDown: true,
+ timeDown: this.game.time.now,
+ timeUp: 0,
+ duration: 0,
+ value: value
+ };
+ }
+ else
+ {
+ // Button used before but freshly down
+ this._buttons[buttonCode].isDown = true;
+ this._buttons[buttonCode].timeDown = this.game.time.now;
+ this._buttons[buttonCode].duration = 0;
+ this._buttons[buttonCode].value = value;
+ }
+ }
+
+ if (this._hotkeys[buttonCode])
+ {
+ this._hotkeys[buttonCode].processButtonDown(value);
+ }
+
+ },
+
+ /**
+ * Handles button release
+ * @param {number} buttonCode - Which buttonCode of this button
+ * @param {Object} value - Button value
+ * @method Phaser.SinglePad#processButtonUp
+ */
+ processButtonUp: function (buttonCode, value) {
+
+ if (this.game.input.disabled || this.game.input.gamepad.disabled)
+ {
+ return;
+ }
+
+ if (this._padParent.onUpCallback)
+ {
+ this._padParent.onUpCallback.call(this._padParent.callbackContext, buttonCode, value, this._index);
+ }
+
+ if (this.onUpCallback)
+ {
+ this.onUpCallback.call(this.callbackContext, buttonCode, value);
+ }
+
+ if (this._hotkeys[buttonCode])
+ {
+ this._hotkeys[buttonCode].processButtonUp(value);
+ }
+
+ if (this._buttons[buttonCode])
+ {
+ this._buttons[buttonCode].isDown = false;
+ this._buttons[buttonCode].timeUp = this.game.time.now;
+ this._buttons[buttonCode].value = value;
+ }
+ else
+ {
+ // Not used this button before, so register it
+ this._buttons[buttonCode] = {
+ isDown: false,
+ timeDown: this.game.time.now,
+ timeUp: this.game.time.now,
+ duration: 0,
+ value: value
+ };
+ }
+
+ },
+
+ /**
+ * Handles buttons with floating values (like analog buttons that acts almost like an axis but still registers like a button)
+ * @param {number} buttonCode - Which buttonCode of this button
+ * @param {Object} value - Button value (will range somewhere between 0 and 1, but not specifically 0 or 1.
+ * @method Phaser.SinglePad#processButtonFloat
+ */
+ processButtonFloat: function (buttonCode, value) {
+
+ if (this.game.input.disabled || this.game.input.gamepad.disabled)
+ {
+ return;
+ }
+
+ if (this._padParent.onFloatCallback)
+ {
+ this._padParent.onFloatCallback.call(this._padParent.callbackContext, buttonCode, value, this._index);
+ }
+
+ if (this.onFloatCallback)
+ {
+ this.onFloatCallback.call(this.callbackContext, buttonCode, value);
+ }
+
+ if (!this._buttons[buttonCode])
+ {
+ // Not used this button before, so register it
+ this._buttons[buttonCode] = { value: value };
+ }
+ else
+ {
+ // Button used before but freshly down
+ this._buttons[buttonCode].value = value;
+ }
+
+ if (this._hotkeys[buttonCode])
+ {
+ this._hotkeys[buttonCode].processButtonFloat(value);
+ }
+
+ },
+
+ /**
+ * Returns value of requested axis
+ * @method Phaser.SinglePad#isDown
+ * @param {number} axisCode - The index of the axis to check
+ * @return {number} Axis value if available otherwise false
+ */
+ axis: function (axisCode) {
+
+ if (this._axes[axisCode])
+ {
+ return this._axes[axisCode];
+ }
+
+ return false;
+
+ },
+
+ /**
+ * Returns true if the button is currently pressed down.
+ * @method Phaser.SinglePad#isDown
+ * @param {number} buttonCode - The buttonCode of the key to check.
+ * @return {boolean} True if the key is currently down.
+ */
+ isDown: function (buttonCode) {
+
+ if (this._buttons[buttonCode])
+ {
+ return this._buttons[buttonCode].isDown;
+ }
+
+ return false;
+
+ },
+
+ /**
+ * Returns the "just released" state of a button from this gamepad. Just released is considered as being true if the button was released within the duration given (default 250ms).
+ * @method Phaser.SinglePad#justPressed
+ * @param {number} buttonCode - The buttonCode of the button to check for.
+ * @param {number} [duration=250] - The duration below which the button is considered as being just released.
+ * @return {boolean} True if the button is just released otherwise false.
+ */
+ justReleased: function (buttonCode, duration) {
+
+ if (typeof duration === "undefined") { duration = 250; }
+
+ return (this._buttons[buttonCode] && this._buttons[buttonCode].isDown === false && (this.game.time.now - this._buttons[buttonCode].timeUp < duration));
+
+ },
+
+ /**
+ * Returns the "just pressed" state of a button from this gamepad. Just pressed is considered true if the button was pressed down within the duration given (default 250ms).
+ * @method Phaser.SinglePad#justPressed
+ * @param {number} buttonCode - The buttonCode of the button to check for.
+ * @param {number} [duration=250] - The duration below which the button is considered as being just pressed.
+ * @return {boolean} True if the button is just pressed otherwise false.
+ */
+ justPressed: function (buttonCode, duration) {
+
+ if (typeof duration === "undefined") { duration = 250; }
+
+ return (this._buttons[buttonCode] && this._buttons[buttonCode].isDown && this._buttons[buttonCode].duration < duration);
+
+ },
+
+ /**
+ * Returns the value of a gamepad button. Intended mainly for cases when you have floating button values, for example
+ * analog trigger buttons on the XBOX 360 controller
+ * @method Phaser.SinglePad#buttonValue
+ * @param {number} buttonCode - The buttonCode of the button to check.
+ * @return {boolean} Button value if available otherwise false.
+ */
+ buttonValue: function (buttonCode) {
+
+ if (this._buttons[buttonCode])
+ {
+ return this._buttons[buttonCode].value;
+ }
+
+ return false;
+
+ },
+
+ /**
+ * Reset all buttons/axes of this gamepad
+ * @method Phaser.SinglePad#reset
+ */
+ reset: function () {
+
+ for (var i = 0; i < this._buttons.length; i++)
+ {
+ this._buttons[i] = 0;
+ }
+
+ for (var j = 0; j < this._axes.length; j++)
+ {
+ this._axes[j] = 0;
+ }
+
+ }
+
+};
+
+Phaser.SinglePad.prototype.constructor = Phaser.SinglePad;
+
+/**
+ * Whether or not this particular gamepad is connected or not.
+ * @name Phaser.SinglePad#connected
+ * @property {boolean} connected - Whether or not this particular gamepad is connected or not.
+ * @readonly
+ */
+Object.defineProperty(Phaser.SinglePad.prototype, "connected", {
+
+ get: function () {
+ return this._connected;
+ }
+
+});
+
+/**
+ * Gamepad index as per browser data
+ * @name Phaser.SinglePad#index
+ * @property {number} index - The gamepad index, used to identify specific gamepads in the browser
+ * @readonly
+ */
+Object.defineProperty(Phaser.SinglePad.prototype, "index", {
+
+ get: function () {
+ return this._index;
+ }
+
+});
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
+
+
+
+
+ Documentation generated by JSDoc 3.3.0-dev
+ on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template .
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/docs/Sound.js.html b/docs/Sound.js.html
index 7db91a13..03167d6d 100644
--- a/docs/Sound.js.html
+++ b/docs/Sound.js.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -423,7 +417,7 @@
/**
* @author Richard Davey <rich@photonstorm.com>
-* @copyright 2013 Photon Storm Ltd.
+* @copyright 2014 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -769,25 +763,25 @@ Phaser.Sound.prototype = {
{
if (this.loop)
{
- //console.log('loop1');
+ // console.log('loop1');
// won't work with markers, needs to reset the position
this.onLoop.dispatch(this);
if (this.currentMarker === '')
{
- //console.log('loop2');
+ // console.log('loop2');
this.currentTime = 0;
this.startTime = this.game.time.now;
}
else
{
- //console.log('loop3');
+ // console.log('loop3');
this.play(this.currentMarker, 0, this.volume, true, true);
}
}
else
{
- //console.log('stopping, no loop for marker');
+ // console.log('stopping, no loop for marker');
this.stop();
}
}
@@ -975,7 +969,7 @@ Phaser.Sound.prototype = {
else
{
// console.log('sound not locked, state?', this._sound.readyState);
- if (this._sound && this._sound.readyState == 4)
+ if (this._sound && (this.game.device.cocoonJS || this._sound.readyState === 4))
{
this._sound.play();
// This doesn't become available until you call play(), wonderful ...
@@ -1065,7 +1059,20 @@ Phaser.Sound.prototype = {
this._sound = this.context.createBufferSource();
this._sound.buffer = this._buffer;
- this._sound.connect(this.gainNode);
+
+ if (this.externalNode)
+ {
+ this._sound.connect(this.externalNode.input);
+ }
+ else
+ {
+ this._sound.connect(this.gainNode);
+ }
+
+ if (this.loop)
+ {
+ this._sound.loop = true;
+ }
if (typeof this._sound.start === 'undefined')
{
@@ -1126,6 +1133,8 @@ Phaser.Sound.prototype = {
};
+Phaser.Sound.prototype.constructor = Phaser.Sound;
+
/**
* @name Phaser.Sound#isDecoding
* @property {boolean} isDecoding - Returns true if the sound file is still decoding.
@@ -1246,13 +1255,13 @@ Object.defineProperty(Phaser.Sound.prototype, "volume", {
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:25 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/SoundManager.js.html b/docs/SoundManager.js.html
index ef9762a0..6fa385c5 100644
--- a/docs/SoundManager.js.html
+++ b/docs/SoundManager.js.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -423,7 +417,7 @@
/**
* @author Richard Davey <rich@photonstorm.com>
-* @copyright 2013 Photon Storm Ltd.
+* @copyright 2014 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -711,7 +705,7 @@ Phaser.SoundManager.prototype = {
that.game.cache.decodedSound(key, buffer);
if (sound)
{
- that.onSoundDecode.dispatch(sound);
+ that.onSoundDecode.dispatch(key, sound);
}
});
}
@@ -792,6 +786,8 @@ Phaser.SoundManager.prototype = {
};
+Phaser.SoundManager.prototype.constructor = Phaser.SoundManager;
+
/**
* @name Phaser.SoundManager#mute
* @property {boolean} mute - Gets or sets the muted state of the SoundManager. This effects all sounds in the game.
@@ -916,13 +912,13 @@ Object.defineProperty(Phaser.SoundManager.prototype, "volume", {
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:25 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Sprite.js.html b/docs/Sprite.js.html
index 41ff5ec3..cce3609a 100644
--- a/docs/Sprite.js.html
+++ b/docs/Sprite.js.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -423,7 +417,7 @@
/**
* @author Richard Davey <rich@photonstorm.com>
-* @copyright 2013 Photon Storm Ltd.
+* @copyright 2014 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -632,6 +626,7 @@ Phaser.Sprite = function (game, x, y, key, frame) {
*/
this._cache = {
+ fresh: true,
dirty: false,
// Transform cache
@@ -777,7 +772,7 @@ Phaser.Sprite = function (game, x, y, key, frame) {
/**
* @property {Phaser.Point} cameraOffset - If this Sprite is fixed to the camera then use this Point to specify how far away from the Camera x/y it's rendered.
*/
- this.cameraOffset = new Phaser.Point();
+ this.cameraOffset = new Phaser.Point(x, y);
/**
* You can crop the Sprites texture by modifying the crop properties. For example crop.width = 50 would set the Sprite to only render 50px wide.
@@ -793,9 +788,19 @@ Phaser.Sprite = function (game, x, y, key, frame) {
*/
this.cropEnabled = false;
+ /**
+ * @property {boolean} debug - Handy flag to use with Game.enableStep
+ * @default
+ */
+ this.debug = false;
+
this.updateCache();
this.updateBounds();
+ /**
+ * @property {PIXI.Point} pivot - The pivot point of the displayObject that it rotates around.
+ */
+
};
// Needed to keep the PIXI.Sprite constructor in the prototype chain (as the core pixi renderer uses an instanceof check sadly)
@@ -810,6 +815,24 @@ Phaser.Sprite.prototype.constructor = Phaser.Sprite;
*/
Phaser.Sprite.prototype.preUpdate = function() {
+ if (this._cache.fresh)
+ {
+ this.world.setTo(this.parent.position.x + this.x, this.parent.position.y + this.y);
+ this.worldTransform[2] = this.world.x;
+ this.worldTransform[5] = this.world.y;
+ this._cache.fresh = false;
+
+ if (this.body)
+ {
+ this.body.x = (this.world.x - (this.anchor.x * this.width)) + this.body.offset.x;
+ this.body.y = (this.world.y - (this.anchor.y * this.height)) + this.body.offset.y;
+ this.body.preX = this.body.x;
+ this.body.preY = this.body.y;
+ }
+
+ return;
+ }
+
if (!this.exists || (this.group && !this.group.exists))
{
this.renderOrderID = -1;
@@ -925,7 +948,6 @@ Phaser.Sprite.prototype.updateAnimation = function() {
this._cache.halfHeight = Math.floor(this._cache.height / 2);
this._cache.dirty = true;
-
}
};
@@ -1020,12 +1042,6 @@ Phaser.Sprite.prototype.updateBounds = function() {
this.renderable = this._cache.cameraVisible;
}
- // Update our physics bounds
- if (this.body)
- {
- this.body.updateBounds(this.center.x, this.center.y, this._cache.scaleX, this._cache.scaleY);
- }
-
};
/**
@@ -1036,9 +1052,7 @@ Phaser.Sprite.prototype.updateBounds = function() {
* @memberof Phaser.Sprite
* @param {Phaser.Point} p - The Point object to store the results in.
* @param {number} x - x coordinate within the Sprite to translate.
-* @param {number} y - x coordinate within the Sprite to translate.
-* @param {number} sx - Scale factor to be applied.
-* @param {number} sy - Scale factor to be applied.
+* @param {number} y - y coordinate within the Sprite to translate.
* @return {Phaser.Point} The translated point.
*/
Phaser.Sprite.prototype.getLocalPosition = function(p, x, y) {
@@ -1057,8 +1071,8 @@ Phaser.Sprite.prototype.getLocalPosition = function(p, x, y) {
* @method Phaser.Sprite#getLocalUnmodifiedPosition
* @memberof Phaser.Sprite
* @param {Phaser.Point} p - The Point object to store the results in.
-* @param {number} x - x coordinate within the Sprite to translate.
-* @param {number} y - x coordinate within the Sprite to translate.
+* @param {number} gx - x coordinate within the Sprite to translate.
+* @param {number} gy - y coordinate within the Sprite to translate.
* @return {Phaser.Point} The translated point.
*/
Phaser.Sprite.prototype.getLocalUnmodifiedPosition = function(p, gx, gy) {
@@ -1099,7 +1113,6 @@ Phaser.Sprite.prototype.postUpdate = function() {
if (this.exists)
{
- // The sprite is positioned in this call, after taking into consideration motion updates and collision
if (this.body)
{
this.body.postUpdate();
@@ -1116,8 +1129,6 @@ Phaser.Sprite.prototype.postUpdate = function() {
this._cache.y = this.y;
}
- this.world.setTo(this.game.camera.x + this.worldTransform[2], this.game.camera.y + this.worldTransform[5]);
-
this.position.x = this._cache.x;
this.position.y = this._cache.y;
}
@@ -1195,8 +1206,17 @@ Phaser.Sprite.prototype.loadTexture = function (key, frame) {
*/
Phaser.Sprite.prototype.centerOn = function(x, y) {
- this.x = x + (this.x - this.center.x);
- this.y = y + (this.y - this.center.y);
+ if (this.fixedToCamera)
+ {
+ this.cameraOffset.x = x + (this.cameraOffset.x - this.center.x);
+ this.cameraOffset.y = y + (this.cameraOffset.y - this.center.y);
+ }
+ else
+ {
+ this.x = x + (this.x - this.center.x);
+ this.y = y + (this.y - this.center.y);
+ }
+
return this;
};
@@ -1263,6 +1283,11 @@ Phaser.Sprite.prototype.kill = function() {
*/
Phaser.Sprite.prototype.destroy = function() {
+ if (this.filters)
+ {
+ this.filters = null;
+ }
+
if (this.group)
{
this.group.remove(this);
@@ -1283,6 +1308,11 @@ Phaser.Sprite.prototype.destroy = function() {
this.animations.destroy();
}
+ if (this.body)
+ {
+ this.body.destroy();
+ }
+
this.alive = false;
this.exists = false;
this.visible = false;
@@ -1334,6 +1364,7 @@ Phaser.Sprite.prototype.reset = function(x, y, health) {
this.x = x;
this.y = y;
+ this.world.setTo(x, y);
this.position.x = this.x;
this.position.y = this.y;
this.alive = true;
@@ -1346,7 +1377,7 @@ Phaser.Sprite.prototype.reset = function(x, y, health) {
if (this.body)
{
- this.body.reset();
+ this.body.reset(false);
}
return this;
@@ -1397,6 +1428,34 @@ Phaser.Sprite.prototype.play = function (name, frameRate, loop, killOnComplete)
};
+/**
+* Returns the delta x value. The difference between Sprite.x now and in the previous step.
+* @name Phaser.Sprite#deltaX
+* @property {number} deltaX - The delta value. Positive if the motion was to the right, negative if to the left.
+* @readonly
+*/
+Object.defineProperty(Phaser.Sprite.prototype, 'deltaX', {
+
+ get: function() {
+ return this.world.x - this._cache.prevX;
+ }
+
+});
+
+/**
+* Returns the delta x value. The difference between Sprite.y now and in the previous step.
+* @name Phaser.Sprite#deltaY
+* @property {number} deltaY - The delta value. Positive if the motion was downwards, negative if upwards.
+* @readonly
+*/
+Object.defineProperty(Phaser.Sprite.prototype, 'deltaY', {
+
+ get: function() {
+ return this.world.y - this._cache.prevY;
+ }
+
+});
+
/**
* Indicates the rotation of the Sprite, in degrees, from its original orientation. Values from 0 to 180 represent clockwise rotation; values from 0 to -180 represent counterclockwise rotation.
* Values outside this range are added to or subtracted from 360 to obtain a value within the range. For example, the statement player.angle = 450 is the same as player.angle = 90.
@@ -1461,6 +1520,32 @@ Object.defineProperty(Phaser.Sprite.prototype, "inCamera", {
});
+/**
+* @name Phaser.Sprite#worldCenterX
+* @property {number} worldCenterX - The center of the Sprite in world coordinates.
+* @readonly
+*/
+Object.defineProperty(Phaser.Sprite.prototype, "worldCenterX", {
+
+ get: function () {
+ return this.game.camera.x + this.center.x;
+ }
+
+});
+
+/**
+* @name Phaser.Sprite#worldCenterY
+* @property {number} worldCenterY - The center of the Sprite in world coordinates.
+* @readonly
+*/
+Object.defineProperty(Phaser.Sprite.prototype, "worldCenterY", {
+
+ get: function () {
+ return this.game.camera.y + this.center.y;
+ }
+
+});
+
/**
* The width of the sprite in pixels, setting this will actually modify the scale to acheive the value desired.
* If you wish to crop the Sprite instead see the Sprite.crop value.
@@ -1524,8 +1609,6 @@ Object.defineProperty(Phaser.Sprite.prototype, "inputEnabled", {
set: function (value) {
- console.log('inputEnabled', value, this.input);
-
if (value)
{
if (this.input.enabled === false)
@@ -1559,13 +1642,13 @@ Object.defineProperty(Phaser.Sprite.prototype, "inputEnabled", {
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:25 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Stage.js.html b/docs/Stage.js.html
index ea337d27..61e45c67 100644
--- a/docs/Stage.js.html
+++ b/docs/Stage.js.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -423,7 +417,7 @@
/**
* @author Richard Davey <rich@photonstorm.com>
-* @copyright 2013 Photon Storm Ltd.
+* @copyright 2014 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -447,7 +441,6 @@ Phaser.Stage = function (game, width, height) {
/**
* @property {string} game - Background color of the stage (defaults to black). Set via the public backgroundColor property.
* @private
- * @default 'rgb(0,0,0)'
*/
this._backgroundColor = 'rgb(0,0,0)';
@@ -457,10 +450,9 @@ Phaser.Stage = function (game, width, height) {
this.offset = new Phaser.Point();
/**
- * @property {HTMLCanvasElement} canvas - Reference to the newly created <canvas> element.
+ * @property {HTMLCanvasElement} canvas - Reference to the newly created `canvas` element.
*/
- this.canvas = Phaser.Canvas.create(width, height);
- this.canvas.style['-webkit-full-screen'] = 'width: 100%; height: 100%';
+ this.canvas = null;
/**
* @property {PIXI.Stage} _stage - The Pixi Stage which is hooked to the renderer.
@@ -470,11 +462,21 @@ Phaser.Stage = function (game, width, height) {
this._stage.name = '_stage_root';
this._stage.interactive = false;
+ /**
+ * @property {PIXI.Stage} display - The Pixi Stage which is hooked to the renderer.
+ */
+ this.display = this._stage;
+
/**
* @property {number} scaleMode - The current scaleMode.
*/
this.scaleMode = Phaser.StageScaleMode.NO_SCALE;
+ /*
+ * @property {number} fullScreenScaleMode - Scale mode to be used in fullScreen
+ */
+ this.fullScreenScaleMode = Phaser.StageScaleMode.NO_SCALE;
+
/**
* @property {Phaser.StageScaleMode} scale - The scale of the current running game.
*/
@@ -485,6 +487,12 @@ Phaser.Stage = function (game, width, height) {
*/
this.aspectRatio = width / height;
+ /**
+ * @property {boolean} disableVisibilityChange - By default if the browser tab loses focus the game will pause. You can stop that behaviour by setting this property to true.
+ * @default
+ */
+ this.disableVisibilityChange = false;
+
/**
* @property {number} _nextOffsetCheck - The time to run the next offset check.
* @private
@@ -497,10 +505,73 @@ Phaser.Stage = function (game, width, height) {
*/
this.checkOffsetInterval = 2500;
+ if (game.config)
+ {
+ this.parseConfig(game.config);
+ }
+ else
+ {
+ this.canvas = Phaser.Canvas.create(width, height);
+ this.canvas.style['-webkit-full-screen'] = 'width: 100%; height: 100%';
+ }
+
};
Phaser.Stage.prototype = {
+ /**
+ * Parses a Game configuration object.
+ *
+ * @method Phaser.Stage#parseConfig
+ * @protected
+ */
+ parseConfig: function (config) {
+
+ if (config['canvasID'])
+ {
+ this.canvas = Phaser.Canvas.create(this.game.width, this.game.height, config['canvasID']);
+ }
+ else
+ {
+ this.canvas = Phaser.Canvas.create(this.game.width, this.game.height);
+ }
+
+ if (config['canvasStyle'])
+ {
+ this.canvas.stlye = config['canvasStyle'];
+ }
+ else
+ {
+ this.canvas.style['-webkit-full-screen'] = 'width: 100%; height: 100%';
+ }
+
+ if (config['checkOffsetInterval'])
+ {
+ this.checkOffsetInterval = config['checkOffsetInterval'];
+ }
+
+ if (config['disableVisibilityChange'])
+ {
+ this.disableVisibilityChange = config['disableVisibilityChange'];
+ }
+
+ if (config['fullScreenScaleMode'])
+ {
+ this.fullScreenScaleMode = config['fullScreenScaleMode'];
+ }
+
+ if (config['scaleMode'])
+ {
+ this.scaleMode = config['scaleMode'];
+ }
+
+ if (config['backgroundColor'])
+ {
+ this.backgroundColor = config['backgroundColor'];
+ }
+
+ },
+
/**
* Initialises the stage and adds the event listeners.
* @method Phaser.Stage#boot
@@ -563,7 +634,7 @@ Phaser.Stage.prototype = {
return;
}
- if (event.type == 'pagehide' || event.type == 'blur' || document['hidden'] === true || document['webkitHidden'] === true)
+ if (this.game.paused === false && (event.type == 'pagehide' || event.type == 'blur' || document['hidden'] === true || document['webkitHidden'] === true))
{
this.game.paused = true;
}
@@ -576,6 +647,8 @@ Phaser.Stage.prototype = {
};
+Phaser.Stage.prototype.constructor = Phaser.Stage;
+
/**
* @name Phaser.Stage#backgroundColor
* @property {number|string} backgroundColor - Gets and sets the background color of the stage. The color can be given as a number: 0xff0000 or a hex string: '#ff0000'
@@ -627,13 +700,13 @@ Object.defineProperty(Phaser.Stage.prototype, "backgroundColor", {
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:25 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/StageScaleMode.js.html b/docs/StageScaleMode.js.html
index 93f2d900..156a13d6 100644
--- a/docs/StageScaleMode.js.html
+++ b/docs/StageScaleMode.js.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -423,7 +417,7 @@
/**
* @author Richard Davey <rich@photonstorm.com>
-* @copyright 2013 Photon Storm Ltd.
+* @copyright 2014 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -683,7 +677,8 @@ Phaser.StageScaleMode.prototype = {
this._width = this.width;
this._height = this.height;
- console.log('startFullScreen', this._width, this._height);
+ // This needs updating to match the final spec:
+ // http://generatedcontent.org/post/70347573294/is-your-fullscreen-api-code-up-to-date-find-out-how-to
if (element['requestFullScreen'])
{
@@ -691,7 +686,7 @@ Phaser.StageScaleMode.prototype = {
}
else if (element['mozRequestFullScreen'])
{
- element['mozRequestFullScreen']();
+ element.parentNode['mozRequestFullScreen']();
}
else if (element['webkitRequestFullScreen'])
{
@@ -733,16 +728,24 @@ Phaser.StageScaleMode.prototype = {
if (this.isFullScreen)
{
- this.game.stage.canvas.style['width'] = '100%';
- this.game.stage.canvas.style['height'] = '100%';
+ if (this.game.stage.fullScreenScaleMode === Phaser.StageScaleMode.EXACT_FIT)
+ {
+ this.game.stage.canvas.style['width'] = '100%';
+ this.game.stage.canvas.style['height'] = '100%';
- this.setMaximum();
+ this.setMaximum();
- this.game.input.scale.setTo(this.game.width / this.width, this.game.height / this.height);
+ this.game.input.scale.setTo(this.game.width / this.width, this.game.height / this.height);
- this.aspectRatio = this.width / this.height;
- this.scaleFactor.x = this.game.width / this.width;
- this.scaleFactor.y = this.game.height / this.height;
+ this.aspectRatio = this.width / this.height;
+ this.scaleFactor.x = this.game.width / this.width;
+ this.scaleFactor.y = this.game.height / this.height;
+ }
+ else if (this.game.stage.fullScreenScaleMode === Phaser.StageScaleMode.SHOW_ALL)
+ {
+ this.game.stage.scale.setShowAll();
+ this.game.stage.scale.refresh();
+ }
}
else
{
@@ -983,13 +986,27 @@ Phaser.StageScaleMode.prototype = {
{
this.setMaximum();
}
- else if (this.game.stage.scaleMode == Phaser.StageScaleMode.EXACT_FIT)
+ else if (!this.isFullScreen)
{
- this.setExactFit();
+ if (this.game.stage.scaleMode == Phaser.StageScaleMode.EXACT_FIT)
+ {
+ this.setExactFit();
+ }
+ else if (this.game.stage.scaleMode == Phaser.StageScaleMode.SHOW_ALL)
+ {
+ this.setShowAll();
+ }
}
- else if (this.game.stage.scaleMode == Phaser.StageScaleMode.SHOW_ALL)
+ else
{
- this.setShowAll();
+ if (this.game.stage.fullScreenScaleMode == Phaser.StageScaleMode.EXACT_FIT)
+ {
+ this.setExactFit();
+ }
+ else if (this.game.stage.fullScreenScaleMode == Phaser.StageScaleMode.SHOW_ALL)
+ {
+ this.setShowAll();
+ }
}
this.setSize();
@@ -1110,8 +1127,6 @@ Phaser.StageScaleMode.prototype = {
var availableWidth = window.innerWidth;
var availableHeight = window.innerHeight;
- // console.log('available', availableWidth, availableHeight);
-
if (this.maxWidth && availableWidth > this.maxWidth)
{
this.width = this.maxWidth;
@@ -1134,6 +1149,8 @@ Phaser.StageScaleMode.prototype = {
};
+Phaser.StageScaleMode.prototype.constructor = Phaser.StageScaleMode;
+
/**
* @name Phaser.StageScaleMode#isFullScreen
* @property {boolean} isFullScreen - Returns true if the browser is in full screen mode, otherwise false.
@@ -1189,13 +1206,13 @@ Object.defineProperty(Phaser.StageScaleMode.prototype, "isLandscape", {
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:25 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/State.js.html b/docs/State.js.html
index db95688b..b20515cf 100644
--- a/docs/State.js.html
+++ b/docs/State.js.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -423,7 +417,7 @@
/**
* @author Richard Davey <rich@photonstorm.com>
-* @copyright 2013 Photon Storm Ltd.
+* @copyright 2014 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -590,6 +584,8 @@ Phaser.State.prototype = {
}
};
+
+Phaser.State.prototype.constructor = Phaser.State;
@@ -605,13 +601,13 @@ Phaser.State.prototype = {
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:25 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/StateManager.js.html b/docs/StateManager.js.html
index aa2184db..e3b8a73f 100644
--- a/docs/StateManager.js.html
+++ b/docs/StateManager.js.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -425,7 +419,7 @@
/**
* @author Richard Davey <rich@photonstorm.com>
-* @copyright 2013 Photon Storm Ltd.
+* @copyright 2014 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -455,7 +449,7 @@ Phaser.StateManager = function (game, pendingState) {
*/
this._pendingState = null;
- if (pendingState !== null)
+ if (typeof pendingState !== 'undefined' && pendingState !== null)
{
this._pendingState = pendingState;
}
@@ -703,7 +697,8 @@ Phaser.StateManager.prototype = {
},
/**
- * Description.
+ * Checks i a given phaser state is valid.
+ * State must exist and have at least one callback function registered..
* @method Phaser.StateManager#checkState
* @param {string} key - The key of the state you want to check.
* @return {boolean} Description.
@@ -770,7 +765,7 @@ Phaser.StateManager.prototype = {
* Sets the current State. Should not be called directly (use StateManager.start)
* @method Phaser.StateManager#setCurrentState
* @param {string} key - State key.
- * @protected
+ * @private
*/
setCurrentState: function (key) {
@@ -800,6 +795,17 @@ Phaser.StateManager.prototype = {
},
+ /**
+ * Gets the current State.
+ *
+ * @method Phaser.StateManager#getCurrentState
+ * @return Phaser.State
+ * @public
+ */
+ getCurrentState: function() {
+ return this.states[this.current];
+ },
+
/**
* @method Phaser.StateManager#loadComplete
* @protected
@@ -935,6 +941,8 @@ Phaser.StateManager.prototype = {
}
};
+
+Phaser.StateManager.prototype.constructor = Phaser.StateManager;
@@ -950,13 +958,13 @@ Phaser.StateManager.prototype = {
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:25 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Text.js.html b/docs/Text.js.html
index 84b4a4f7..9376f7f1 100644
--- a/docs/Text.js.html
+++ b/docs/Text.js.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -423,12 +417,12 @@
/**
* @author Richard Davey <rich@photonstorm.com>
-* @copyright 2013 Photon Storm Ltd.
+* @copyright 2014 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
/**
-* Create a new <code>Text</code>.
+* Create a new `Text` object.
* @class Phaser.Text
* @constructor
* @param {Phaser.Game} game - Current game instance.
@@ -513,6 +507,18 @@ Phaser.Text = function (game, x, y, text, style) {
*/
this.scale = new Phaser.Point(1, 1);
+ /**
+ * An object that is fixed to the camera ignores the position of any ancestors in the display list and uses its x/y coordinates as offsets from the top left of the camera.
+ * @property {boolean} fixedToCamera - Fixes this object to the Camera.
+ * @default
+ */
+ this.fixedToCamera = false;
+
+ /**
+ * @property {Phaser.Point} cameraOffset - If this object is fixed to the camera then use this Point to specify how far away from the Camera x/y it's rendered.
+ */
+ this.cameraOffset = new Phaser.Point(x, y);
+
/**
* @property {object} _cache - A mini cache for storing all of the calculated values.
* @private
@@ -564,6 +570,12 @@ Phaser.Text.prototype.update = function() {
return;
}
+ if (this.fixedToCamera)
+ {
+ this.x = this.game.camera.view.x + this.cameraOffset.x;
+ this.y = this.game.camera.view.y + this.cameraOffset.y;
+ }
+
this._cache.dirty = false;
this._cache.x = this.x;
@@ -719,13 +731,13 @@ Object.defineProperty(Phaser.Text.prototype, 'font', {
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:25 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Tile.js.html b/docs/Tile.js.html
index 548be967..0dc8af7a 100644
--- a/docs/Tile.js.html
+++ b/docs/Tile.js.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -423,35 +417,45 @@
/**
* @author Richard Davey <rich@photonstorm.com>
-* @copyright 2013 Photon Storm Ltd.
+* @copyright 2014 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
/**
-* Create a new `Tile` object. Tiles live inside of Tilesets and are rendered via TilemapLayers.
+* Create a new `Tile` object.
*
* @class Phaser.Tile
-* @classdesc A Tile is a single representation of a tile within a Tilemap.
+* @classdesc A Tile is a representation of a single tile within the Tilemap.
* @constructor
-* @param {Phaser.Tileset} tileset - The tileset this tile belongs to.
+* @param {object} layer - The layer in the Tilemap data that this tile belongs to.
* @param {number} index - The index of this tile type in the core map data.
* @param {number} x - The x coordinate of this tile.
* @param {number} y - The y coordinate of this tile.
* @param {number} width - Width of the tile.
* @param {number} height - Height of the tile.
*/
-Phaser.Tile = function (tileset, index, x, y, width, height) {
+Phaser.Tile = function (layer, index, x, y, width, height) {
/**
- * @property {Phaser.Tileset} tileset - The tileset this tile belongs to.
+ * @property {object} layer - The layer in the Tilemap data that this tile belongs to.
*/
- this.tileset = tileset;
-
+ this.layer = layer;
+
/**
- * @property {number} index - The index of this tile within the tileset.
+ * @property {number} index - The index of this tile within the map data corresponding to the tileset.
*/
this.index = index;
+ /**
+ * @property {number} x - The x map coordinate of this tile.
+ */
+ this.x = x;
+
+ /**
+ * @property {number} y - The y map coordinate of this tile.
+ */
+ this.y = y;
+
/**
* @property {number} width - The width of the tile in pixels.
*/
@@ -463,22 +467,44 @@ Phaser.Tile = function (tileset, index, x, y, width, height) {
this.height = height;
/**
- * @property {number} x - The top-left corner of the tile within the tileset.
+ * @property {number} alpha - The alpha value at which this tile is drawn to the canvas.
*/
- this.x = x;
-
- /**
- * @property {number} y - The top-left corner of the tile within the tileset.
- */
- this.y = y;
-
- // Any extra meta data info we need here
+ this.alpha = 1;
/**
- * @property {number} mass - The virtual mass of the tile.
- * @default
+ * @property {object} properties - Tile specific properties.
*/
- this.mass = 1.0;
+ this.properties = {};
+
+ /**
+ * @property {boolean} scanned - Has this tile been walked / turned into a poly?
+ */
+ this.scanned = false;
+
+ /**
+ * @property {boolean} faceTop - Is the top of this tile an interesting edge?
+ */
+ this.faceTop = false;
+
+ /**
+ * @property {boolean} faceBottom - Is the bottom of this tile an interesting edge?
+ */
+ this.faceBottom = false;
+
+ /**
+ * @property {boolean} faceLeft - Is the left of this tile an interesting edge?
+ */
+ this.faceLeft = false;
+
+ /**
+ * @property {boolean} faceRight - Is the right of this tile an interesting edge?
+ */
+ this.faceRight = false;
+
+ /**
+ * @property {boolean} collides - Does this tile collide at all?
+ */
+ this.collides = false;
/**
* @property {boolean} collideNone - Indicating this Tile doesn't collide at all.
@@ -511,38 +537,27 @@ Phaser.Tile = function (tileset, index, x, y, width, height) {
this.collideDown = false;
/**
- * @property {boolean} separateX - Enable separation at x-axis.
+ * @property {function} callback - Tile collision callback.
* @default
*/
- this.separateX = true;
+ this.callback = null;
/**
- * @property {boolean} separateY - Enable separation at y-axis.
+ * @property {object} callbackContext - The context in which the collision callback will be called.
* @default
*/
- this.separateY = true;
-
- /**
- * @property {boolean} collisionCallback - Tilemap collision callback.
- * @default
- */
- this.collisionCallback = null;
-
- /**
- * @property {boolean} collisionCallback - Tilemap collision callback.
- * @default
- */
- this.collisionCallbackContext = this;
+ this.callbackContext = this;
};
Phaser.Tile.prototype = {
/**
- * Set callback to be called when this tilemap collides.
+ * Set a callback to be called when this tile is hit by an object.
+ * The callback must true true for collision processing to take place.
*
* @method Phaser.Tile#setCollisionCallback
- * @param {Function} callback - Callback function.
+ * @param {function} callback - Callback function.
* @param {object} context - Callback will be called with this context.
*/
setCollisionCallback: function (callback, context) {
@@ -558,7 +573,9 @@ Phaser.Tile.prototype = {
*/
destroy: function () {
- this.tileset = null;
+ this.collisionCallback = null;
+ this.collisionCallbackContext = null;
+ this.properties = null;
},
@@ -600,19 +617,55 @@ Phaser.Tile.prototype = {
this.collideUp = false;
this.collideDown = false;
+ },
+
+ /**
+ * Copies the tile data and properties from the given tile to this tile.
+ * @method Phaser.Tile#copy
+ * @param {Phaser.Tile} tile - The tile to copy from.
+ */
+ copy: function (tile) {
+
+ this.index = tile.index;
+ this.alpha = tile.alpha;
+ this.properties = tile.properties;
+ this.collides = tile.collides;
+ this.collideNone = tile.collideNone;
+ this.collideUp = tile.collideUp;
+ this.collideDown = tile.collideDown;
+ this.collideLeft = tile.collideLeft;
+ this.collideRight = tile.collideRight;
+ this.collisionCallback = tile.collisionCallback;
+ this.collisionCallbackContext = tile.collisionCallbackContext;
+
}
};
+Phaser.Tile.prototype.constructor = Phaser.Tile;
+
/**
-* @name Phaser.Tile#bottom
-* @property {number} bottom - The sum of the y and height properties.
+* @name Phaser.Tile#canCollide
+* @property {boolean} canCollide - True if this tile can collide or has a collision callback.
* @readonly
*/
-Object.defineProperty(Phaser.Tile.prototype, "bottom", {
+Object.defineProperty(Phaser.Tile.prototype, "canCollide", {
get: function () {
- return this.y + this.height;
+ return (this.collides || this.collisionCallback || this.layer.callbacks[this.index]);
+ }
+
+});
+
+/**
+* @name Phaser.Tile#left
+* @property {number} left - The x value.
+* @readonly
+*/
+Object.defineProperty(Phaser.Tile.prototype, "left", {
+
+ get: function () {
+ return this.x;
}
});
@@ -628,6 +681,32 @@ Object.defineProperty(Phaser.Tile.prototype, "right", {
return this.x + this.width;
}
+});
+
+/**
+* @name Phaser.Tile#top
+* @property {number} top - The y value.
+* @readonly
+*/
+Object.defineProperty(Phaser.Tile.prototype, "top", {
+
+ get: function () {
+ return this.y;
+ }
+
+});
+
+/**
+* @name Phaser.Tile#bottom
+* @property {number} bottom - The sum of the y and height properties.
+* @readonly
+*/
+Object.defineProperty(Phaser.Tile.prototype, "bottom", {
+
+ get: function () {
+ return this.y + this.height;
+ }
+
});
@@ -644,13 +723,13 @@ Object.defineProperty(Phaser.Tile.prototype, "right", {
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:25 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/TileSprite.js.html b/docs/TileSprite.js.html
index ac778ade..a9fdfd0d 100644
--- a/docs/TileSprite.js.html
+++ b/docs/TileSprite.js.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -423,7 +417,7 @@
/**
* @author Richard Davey <rich@photonstorm.com>
-* @copyright 2013 Photon Storm Ltd.
+* @copyright 2014 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -438,18 +432,16 @@
* @param {number} width - the width of the tilesprite.
* @param {number} height - the height of the tilesprite.
* @param {string|Phaser.RenderTexture|PIXI.Texture} key - This is the image or texture used by the Sprite during rendering. It can be a string which is a reference to the Cache entry, or an instance of a RenderTexture or PIXI.Texture.
-* @param {string|number} frame - If this Sprite is using part of a sprite sheet or texture atlas you can specify the exact frame to use by giving a string or numeric index.
*/
-Phaser.TileSprite = function (game, x, y, width, height, key, frame) {
+Phaser.TileSprite = function (game, x, y, width, height, key) {
x = x || 0;
y = y || 0;
width = width || 256;
height = height || 256;
key = key || null;
- frame = frame || null;
- Phaser.Sprite.call(this, game, x, y, key, frame);
+ Phaser.Sprite.call(this, game, x, y, key);
/**
* @property {PIXI.Texture} texture - The texture that the sprite renders with.
@@ -474,11 +466,113 @@ Phaser.TileSprite = function (game, x, y, width, height, key, frame) {
*/
this.tilePosition = new Phaser.Point(0, 0);
+ this.body.width = width;
+ this.body.height = height;
+
};
Phaser.TileSprite.prototype = Phaser.Utils.extend(true, PIXI.TilingSprite.prototype, Phaser.Sprite.prototype);
Phaser.TileSprite.prototype.constructor = Phaser.TileSprite;
+/**
+* Indicates the rotation of the Sprite, in degrees, from its original orientation. Values from 0 to 180 represent clockwise rotation; values from 0 to -180 represent counterclockwise rotation.
+* Values outside this range are added to or subtracted from 360 to obtain a value within the range. For example, the statement player.angle = 450 is the same as player.angle = 90.
+* If you wish to work in radians instead of degrees use the property Sprite.rotation instead.
+* @name Phaser.TileSprite#angle
+* @property {number} angle - Gets or sets the Sprites angle of rotation in degrees.
+*/
+Object.defineProperty(Phaser.TileSprite.prototype, 'angle', {
+
+ get: function() {
+ return Phaser.Math.wrapAngle(Phaser.Math.radToDeg(this.rotation));
+ },
+
+ set: function(value) {
+ this.rotation = Phaser.Math.degToRad(Phaser.Math.wrapAngle(value));
+ }
+
+});
+
+/**
+* @name Phaser.TileSprite#frame
+* @property {number} frame - Gets or sets the current frame index and updates the Texture Cache for display.
+*/
+Object.defineProperty(Phaser.TileSprite.prototype, "frame", {
+
+ get: function () {
+ return this.animations.frame;
+ },
+
+ set: function (value) {
+ this.animations.frame = value;
+ }
+
+});
+
+/**
+* @name Phaser.TileSprite#frameName
+* @property {string} frameName - Gets or sets the current frame name and updates the Texture Cache for display.
+*/
+Object.defineProperty(Phaser.TileSprite.prototype, "frameName", {
+
+ get: function () {
+ return this.animations.frameName;
+ },
+
+ set: function (value) {
+ this.animations.frameName = value;
+ }
+
+});
+
+/**
+* @name Phaser.TileSprite#inCamera
+* @property {boolean} inCamera - Is this sprite visible to the camera or not?
+* @readonly
+*/
+Object.defineProperty(Phaser.TileSprite.prototype, "inCamera", {
+
+ get: function () {
+ return this._cache.cameraVisible;
+ }
+
+});
+
+/**
+* By default a Sprite won't process any input events at all. By setting inputEnabled to true the Phaser.InputHandler is
+* activated for this Sprite instance and it will then start to process click/touch events and more.
+*
+* @name Phaser.TileSprite#inputEnabled
+* @property {boolean} inputEnabled - Set to true to allow this Sprite to receive input events, otherwise false.
+*/
+Object.defineProperty(Phaser.TileSprite.prototype, "inputEnabled", {
+
+ get: function () {
+
+ return (this.input.enabled);
+
+ },
+
+ set: function (value) {
+
+ if (value)
+ {
+ if (this.input.enabled === false)
+ {
+ this.input.start();
+ }
+ }
+ else
+ {
+ if (this.input.enabled)
+ {
+ this.input.stop();
+ }
+ }
+
+ }
+
+});
@@ -494,13 +588,13 @@ Phaser.TileSprite.prototype.constructor = Phaser.TileSprite;
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:25 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Tilemap.js.html b/docs/Tilemap.js.html
index e82c2655..ed75f137 100644
--- a/docs/Tilemap.js.html
+++ b/docs/Tilemap.js.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -423,7 +417,7 @@
/**
* @author Richard Davey <rich@photonstorm.com>
-* @copyright 2013 Photon Storm Ltd.
+* @copyright 2014 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -444,22 +438,52 @@ Phaser.Tilemap = function (game, key) {
this.game = game;
/**
- * @property {array} layers - An array of Tilemap layers.
+ * @property {string} key - The key of this map data in the Phaser.Cache.
*/
- this.layers = null;
+ this.key = key;
- if (typeof key === 'string')
- {
- this.key = key;
+ var data = Phaser.TilemapParser.parse(this.game, key);
- this.layers = game.cache.getTilemapData(key).layers;
- this.calculateIndexes();
- }
- else
+ if (data === null)
{
- this.layers = [];
+ return;
}
+ this.width = data.width;
+ this.height = data.height;
+ this.tileWidth = data.tileWidth;
+ this.tileHeight = data.tileHeight;
+ this.orientation = data.orientation;
+ this.version = data.version;
+ this.properties = data.properties;
+ this.widthInPixels = data.widthInPixels;
+ this.heightInPixels = data.heightInPixels;
+
+ /**
+ * @property {array} layers - An array of Tilemap layer data.
+ */
+ this.layers = data.layers;
+
+ /**
+ * @property {array} tilesets - An array of Tilesets.
+ */
+ this.tilesets = data.tilesets;
+
+ /**
+ * @property {array} tiles - The super array of Tiles.
+ */
+ this.tiles = data.tiles;
+
+ /**
+ * @property {array} objects - An array of Tiled Object Layers.
+ */
+ this.objects = data.objects;
+
+ /**
+ * @property {array} images - An array of Tiled Image Layers.
+ */
+ this.images = data.images;
+
/**
* @property {number} currentLayer - The current layer.
*/
@@ -468,14 +492,8 @@ Phaser.Tilemap = function (game, key) {
/**
* @property {array} debugMap - Map data used for debug values only.
*/
-
this.debugMap = [];
- /**
- * @property {boolean} dirty - Internal rendering related flag.
- */
- this.dirty = false;
-
/**
* @property {array} _results - Internal var.
* @private
@@ -543,36 +561,500 @@ Phaser.Tilemap.prototype = {
tileSpacing: 0,
format: Phaser.Tilemap.CSV,
data: data,
- indexes: []
+ indexes: [],
+ dirty: true
});
this.currentLayer = this.layers.length - 1;
- this.dirty = true;
+ },
+
+ /**
+ * Adds an image to the map to be used as a tileset. A single map may use multiple tilesets.
+ * Note that the tileset name can be found in the JSON file exported from Tiled, or in the Tiled editor.
+ *
+ * @method Phaser.Tilemap#addTilesetImage
+ * @param {string} tileset - The name of the tileset as specified in the map data.
+ * @param {string} [key] - The key of the Phaser.Cache image used for this tileset. If not specified it will look for an image with a key matching the tileset parameter.
+ */
+ addTilesetImage: function (tileset, key) {
+
+ if (typeof key === 'undefined')
+ {
+ if (typeof tileset === 'string')
+ {
+ key = tileset;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ if (typeof tileset === 'string')
+ {
+ tileset = this.getTilesetIndex(tileset);
+ }
+
+ if (this.tilesets[tileset])
+ {
+ this.tilesets[tileset].image = this.game.cache.getImage(key);
+
+ return true;
+ }
+
+ return false;
+
+ },
+
+ // Region? Remove tile from map data?
+ createFromTiles: function (layer, tileIndex, key, frame, group) {
+
+ if (typeof group === 'undefined') { group = this.game.world; }
},
/**
- * Internal function that calculates the tile indexes for the map data.
+ * Creates a Sprite for every object matching the given gid in the map data. You can optionally specify the group that the Sprite will be created in. If none is
+ * given it will be created in the World. All properties from the map data objectgroup are copied across to the Sprite, so you can use this as an easy way to
+ * configure Sprite properties from within the map editor. For example giving an object a property if alpha: 0.5 in the map editor will duplicate that when the
+ * Sprite is created. You could also give it a value like: body.velocity.x: 100 to set it moving automatically.
*
- * @method Phaser.Tilemap#calculateIndexes
+ * @method Phaser.Tileset#createFromObjects
+ * @param {string} name - The name of the Object Group to create Sprites from.
+ * @param {number} gid - The layer array index value, or if a string is given the layer name, within the map data that this TilemapLayer represents.
+ * @param {string} key - The Game.cache key of the image that this Sprite will use.
+ * @param {number|string} [frame] - If the Sprite image contains multiple frames you can specify which one to use here.
+ * @param {boolean} [exists=true] - The default exists state of the Sprite.
+ * @param {boolean} [autoCull=true] - The default autoCull state of the Sprite. Sprites that are autoCulled are culled from the camera if out of its range.
+ * @param {Phaser.Group} [group] - Optional Group to add the Sprite to. If not specified it will be added to the World group.
*/
- calculateIndexes: function () {
+ createFromObjects: function (name, gid, key, frame, exists, autoCull, group) {
- for (var layer = 0; layer < this.layers.length; layer++)
+ if (typeof exists === 'undefined') { exists = true; }
+ if (typeof autoCull === 'undefined') { autoCull = true; }
+ if (typeof group === 'undefined') { group = this.game.world; }
+
+ if (!this.objects[name])
{
- this.layers[layer].indexes = [];
+ console.warn('Tilemap.createFromObjects: Invalid objectgroup name given: ' + name);
+ return;
+ }
- for (var y = 0; y < this.layers[layer].height ; y++)
+ var sprite;
+
+ for (var i = 0, len = this.objects[name].length; i < len; i++)
+ {
+ if (this.objects[name][i].gid === gid)
{
- for (var x = 0; x < this.layers[layer].width; x++)
- {
- var idx = this.layers[layer].data[y][x];
+ sprite = group.create(this.objects[name][i].x, this.objects[name][i].y, key, frame, exists);
- if (this.layers[layer].indexes.indexOf(idx) === -1)
+ sprite.anchor.setTo(0, 1);
+ sprite.name = this.objects[name][i].name;
+ sprite.visible = this.objects[name][i].visible;
+ sprite.autoCull = autoCull;
+
+ for (property in this.objects[name][i].properties)
+ {
+ group.set(sprite, property, this.objects[name][i].properties[property], false, false, 0);
+ }
+ }
+ }
+
+ },
+
+ /**
+ * Creates a new TilemapLayer object. By default TilemapLayers are fixed to the camera.
+ *
+ * @method Phaser.Tileset#createLayer
+ * @param {number|string} layer - The layer array index value, or if a string is given the layer name, within the map data that this TilemapLayer represents.
+ * @param {number} [width] - The rendered width of the layer, should never be wider than Game.width. If not given it will be set to Game.width.
+ * @param {number} [height] - The rendered height of the layer, should never be wider than Game.height. If not given it will be set to Game.height.
+ * @param {Phaser.Group} [group] - Optional Group to add the object to. If not specified it will be added to the World group.
+ * @return {Phaser.TilemapLayer} The TilemapLayer object. This is an extension of Phaser.Sprite and can be moved around the display list accordingly.
+ */
+ createLayer: function (layer, width, height, group) {
+
+ // Add Buffer support for the left of the canvas
+
+ if (typeof width === 'undefined') { width = this.game.width; }
+ if (typeof height === 'undefined') { height = this.game.height; }
+ if (typeof group === 'undefined') { group = this.game.world; }
+
+ var index = layer;
+
+ if (typeof layer === 'string')
+ {
+ index = this.getLayerIndex(layer);
+ }
+
+ if (index === null || index > this.layers.length)
+ {
+ console.warn('Tilemap.createLayer: Invalid layer ID given: ' + index);
+ return;
+ }
+
+ return group.add(new Phaser.TilemapLayer(this.game, this, index, width, height));
+
+ },
+
+ /**
+ * Gets the layer index based on the layers name.
+ *
+ * @method Phaser.Tileset#getIndex
+ * @protected
+ * @param {array} location - The local array to search.
+ * @param {string} name - The name of the array element to get.
+ * @return {number} The index of the element in the array, or null if not found.
+ */
+ getIndex: function (location, name) {
+
+ for (var i = 0; i < location.length; i++)
+ {
+ if (location[i].name === name)
+ {
+ return i;
+ }
+ }
+
+ return null;
+
+ },
+
+ /**
+ * Gets the layer index based on its name.
+ *
+ * @method Phaser.Tileset#getLayerIndex
+ * @param {string} name - The name of the layer to get.
+ * @return {number} The index of the layer in this tilemap, or null if not found.
+ */
+ getLayerIndex: function (name) {
+
+ return this.getIndex(this.layers, name);
+
+ },
+
+ /**
+ * Gets the tileset index based on its name.
+ *
+ * @method Phaser.Tileset#getTilesetIndex
+ * @param {string} name - The name of the tileset to get.
+ * @return {number} The index of the tileset in this tilemap, or null if not found.
+ */
+ getTilesetIndex: function (name) {
+
+ return this.getIndex(this.tilesets, name);
+
+ },
+
+ /**
+ * Gets the image index based on its name.
+ *
+ * @method Phaser.Tileset#getImageIndex
+ * @param {string} name - The name of the image to get.
+ * @return {number} The index of the image in this tilemap, or null if not found.
+ */
+ getImageIndex: function (name) {
+
+ return this.getIndex(this.images, name);
+
+ },
+
+ /**
+ * Gets the object index based on its name.
+ *
+ * @method Phaser.Tileset#getObjectIndex
+ * @param {string} name - The name of the object to get.
+ * @return {number} The index of the object in this tilemap, or null if not found.
+ */
+ getObjectIndex: function (name) {
+
+ return this.getIndex(this.objects, name);
+
+ },
+
+ /**
+ * Sets a global collision callback for the given tile index within the layer. This will affect all tiles on this layer that have the same index.
+ * If a callback is already set for the tile index it will be replaced. Set the callback to null to remove it.
+ * If you want to set a callback for a tile at a specific location on the map then see setTileLocationCallback.
+ *
+ * @method Phaser.Tileset#setTileIndexCallback
+ * @param {number|array} indexes - Either a single tile index, or an array of tile indexes to have a collision callback set for.
+ * @param {function} callback - The callback that will be invoked when the tile is collided with.
+ * @param {object} callbackContext - The context under which the callback is called.
+ * @param {number|string|Phaser.TilemapLayer} [layer] - The layer to operate on. If not given will default to this.currentLayer.
+ */
+ setTileIndexCallback: function (indexes, callback, callbackContext, layer) {
+
+ layer = this.getLayer(layer);
+
+ if (typeof indexes === 'number')
+ {
+ // This may seem a bit wasteful, because it will cause empty array elements to be created, but the look-up cost is much
+ // less than having to iterate through the callbacks array hunting down tile indexes each time, so I'll take the small memory hit.
+ this.layers[layer].callbacks[indexes] = { callback: callback, callbackContext: callbackContext };
+ }
+ else
+ {
+ for (var i = 0, len = indexes.length; i < len; i++)
+ {
+ this.layers[layer].callbacks[indexes[i]] = { callback: callback, callbackContext: callbackContext };
+ }
+ }
+
+ },
+
+ /**
+ * Sets a global collision callback for the given tile index within the layer. This will affect all tiles on this layer that have the same index.
+ * If a callback is already set for the tile index it will be replaced. Set the callback to null to remove it.
+ * If you want to set a callback for a tile at a specific location on the map then see setTileLocationCallback.
+ *
+ * @method Phaser.Tileset#setTileLocationCallback
+ * @param {number} x - X position of the top left of the area to copy (given in tiles, not pixels)
+ * @param {number} y - Y position of the top left of the area to copy (given in tiles, not pixels)
+ * @param {number} width - The width of the area to copy (given in tiles, not pixels)
+ * @param {number} height - The height of the area to copy (given in tiles, not pixels)
+ * @param {function} callback - The callback that will be invoked when the tile is collided with.
+ * @param {object} callbackContext - The context under which the callback is called.
+ * @param {number|string|Phaser.TilemapLayer} [layer] - The layer to operate on. If not given will default to this.currentLayer.
+ */
+ setTileLocationCallback: function (x, y, width, height, callback, callbackContext, layer) {
+
+ layer = this.getLayer(layer);
+
+ this.copy(x, y, width, height, layer);
+
+ if (this._results.length < 2)
+ {
+ return;
+ }
+
+ for (var i = 1; i < this._results.length; i++)
+ {
+ this._results[i].setCollisionCallback(callback, callbackContext);
+ }
+
+ },
+
+ /**
+ * Sets collision the given tile or tiles. You can pass in either a single numeric index or an array of indexes: [ 2, 3, 15, 20].
+ * The `collides` parameter controls if collision will be enabled (true) or disabled (false).
+ *
+ * @method Phaser.Tileset#setCollision
+ * @param {number|array} indexes - Either a single tile index, or an array of tile IDs to be checked for collision.
+ * @param {boolean} [collides=true] - If true it will enable collision. If false it will clear collision.
+ * @param {number|string|Phaser.TilemapLayer} [layer] - The layer to operate on. If not given will default to this.currentLayer.
+ */
+ setCollision: function (indexes, collides, layer) {
+
+ if (typeof collides === 'undefined') { collides = true; }
+
+ layer = this.getLayer(layer);
+
+ if (typeof indexes === 'number')
+ {
+ return this.setCollisionByIndex(indexes, collides, layer, true);
+ }
+ else
+ {
+ // Collide all of the IDs given in the indexes array
+ for (var i = 0, len = indexes.length; i < len; i++)
+ {
+ this.setCollisionByIndex(indexes[i], collides, layer, false);
+ }
+
+ // Now re-calculate interesting faces
+ this.calculateFaces(layer);
+ }
+
+ },
+
+ /**
+ * Sets collision on a range of tiles where the tile IDs increment sequentially.
+ * Calling this with a start value of 10 and a stop value of 14 would set collision for tiles 10, 11, 12, 13 and 14.
+ * The `collides` parameter controls if collision will be enabled (true) or disabled (false).
+ *
+ * @method Phaser.Tileset#setCollisionBetween
+ * @param {number} start - The first index of the tile to be set for collision.
+ * @param {number} stop - The last index of the tile to be set for collision.
+ * @param {boolean} [collides=true] - If true it will enable collision. If false it will clear collision.
+ * @param {number|string|Phaser.TilemapLayer} [layer] - The layer to operate on. If not given will default to this.currentLayer.
+ */
+ setCollisionBetween: function (start, stop, collides, layer) {
+
+ if (typeof collides === 'undefined') { collides = true; }
+
+ layer = this.getLayer(layer);
+
+ if (start > stop)
+ {
+ return;
+ }
+
+ for (var index = start; index <= stop; index++)
+ {
+ this.setCollisionByIndex(index, collides, layer, false);
+ }
+
+ // Now re-calculate interesting faces
+ this.calculateFaces(layer);
+
+ },
+
+ /**
+ * Sets collision on all tiles in the given layer, except for the IDs of those in the given array.
+ * The `collides` parameter controls if collision will be enabled (true) or disabled (false).
+ *
+ * @method Phaser.Tileset#setCollisionByExclusion
+ * @param {array} indexes - An array of the tile IDs to not be counted for collision.
+ * @param {boolean} [collides=true] - If true it will enable collision. If false it will clear collision.
+ * @param {number|string|Phaser.TilemapLayer} [layer] - The layer to operate on. If not given will default to this.currentLayer.
+ */
+ setCollisionByExclusion: function (indexes, collides, layer) {
+
+ if (typeof collides === 'undefined') { collides = true; }
+
+ layer = this.getLayer(layer);
+
+ // Collide everything, except the IDs given in the indexes array
+ for (var i = 0, len = this.tiles.length; i < len; i++)
+ {
+ if (indexes.indexOf(i) === -1)
+ {
+ this.setCollisionByIndex(i, collides, layer, false);
+ }
+ }
+
+ // Now re-calculate interesting faces
+ this.calculateFaces(layer);
+
+ },
+
+ /**
+ * Sets collision values on a tile in the set.
+ * You shouldn't usually call this method directly, instead use setCollision, setCollisionBetween or setCollisionByExclusion.
+ *
+ * @method Phaser.Tileset#setCollisionByIndex
+ * @protected
+ * @param {number} index - The index of the tile on the layer.
+ * @param {boolean} [collides=true] - If true it will enable collision on the tile. If false it will clear collision values from the tile.
+ * @param {number} [layer] - The layer to operate on. If not given will default to this.currentLayer.
+ * @param {boolean} [recalculate=true] - Recalculates the tile faces after the update.
+ */
+ setCollisionByIndex: function (index, collides, layer, recalculate) {
+
+ if (typeof collides === 'undefined') { collides = true; }
+ if (typeof layer === 'undefined') { layer = this.currentLayer; }
+ if (typeof recalculate === 'undefined') { recalculate = true; }
+
+ for (var y = 0; y < this.layers[layer].height ; y++)
+ {
+ for (var x = 0; x < this.layers[layer].width; x++)
+ {
+ var tile = this.layers[layer].data[y][x];
+
+ if (tile && tile.index === index)
+ {
+ tile.collides = collides;
+ tile.faceTop = collides;
+ tile.faceBottom = collides;
+ tile.faceLeft = collides;
+ tile.faceRight = collides;
+ }
+ }
+ }
+
+ if (recalculate)
+ {
+ // Now re-calculate interesting faces
+ this.calculateFaces(layer);
+ }
+
+ return layer;
+
+ },
+
+ /**
+ * Gets the TilemapLayer index as used in the setCollision calls.
+ *
+ * @method Phaser.Tileset#getLayer
+ * @protected
+ * @param {number|string|Phaser.TilemapLayer} layer - The layer to operate on. If not given will default to this.currentLayer.
+ * @return {number} The TilemapLayer index.
+ */
+ getLayer: function (layer) {
+
+ if (typeof layer === 'undefined')
+ {
+ layer = this.currentLayer;
+ }
+ // else if (typeof layer === 'number')
+ // {
+ // layer = layer;
+ // }
+ else if (typeof layer === 'string')
+ {
+ layer = this.getLayerIndex(layer);
+ }
+ else if (layer instanceof Phaser.TilemapLayer)
+ {
+ layer = layer.index;
+ }
+
+ return layer;
+
+ },
+
+ /**
+ * Internal function.
+ *
+ * @method Phaser.Tileset#calculateFaces
+ * @protected
+ * @param {number} layer - The index of the TilemapLayer to operate on.
+ */
+ calculateFaces: function (layer) {
+
+ var above = null;
+ var below = null;
+ var left = null;
+ var right = null;
+
+ for (var y = 0, h = this.layers[layer].height; y < h; y++)
+ {
+ for (var x = 0, w = this.layers[layer].width; x < w; x++)
+ {
+ var tile = this.layers[layer].data[y][x];
+
+ if (tile)
+ {
+ above = this.getTileAbove(layer, x, y);
+ below = this.getTileBelow(layer, x, y);
+ left = this.getTileLeft(layer, x, y);
+ right = this.getTileRight(layer, x, y);
+
+ if (above && above.collides)
{
- this.layers[layer].indexes.push(idx);
+ // There is a tile above this one that also collides, so the top of this tile is no longer interesting
+ tile.faceTop = false;
+ }
+
+ if (below && below.collides)
+ {
+ // There is a tile below this one that also collides, so the bottom of this tile is no longer interesting
+ tile.faceBottom = false;
+ }
+
+ if (left && left.collides)
+ {
+ // There is a tile left this one that also collides, so the left of this tile is no longer interesting
+ tile.faceLeft = false;
+ }
+
+ if (right && right.collides)
+ {
+ // There is a tile right this one that also collides, so the right of this tile is no longer interesting
+ tile.faceRight = false;
}
}
}
@@ -580,14 +1062,96 @@ Phaser.Tilemap.prototype = {
},
+ /**
+ * Gets the tile above the tile coordinates given.
+ * Mostly used as an internal function by calculateFaces.
+ *
+ * @method Phaser.Tileset#getTileAbove
+ * @param {number} layer - The local layer index to get the tile from. Can be determined by Tilemap.getLayer().
+ * @param {number} x - The x coordinate to get the tile from. In tiles, not pixels.
+ * @param {number} y - The y coordinate to get the tile from. In tiles, not pixels.
+ */
+ getTileAbove: function (layer, x, y) {
+
+ if (y > 0)
+ {
+ return this.layers[layer].data[y - 1][x];
+ }
+
+ return null;
+
+ },
+
+ /**
+ * Gets the tile below the tile coordinates given.
+ * Mostly used as an internal function by calculateFaces.
+ *
+ * @method Phaser.Tileset#getTileBelow
+ * @param {number} layer - The local layer index to get the tile from. Can be determined by Tilemap.getLayer().
+ * @param {number} x - The x coordinate to get the tile from. In tiles, not pixels.
+ * @param {number} y - The y coordinate to get the tile from. In tiles, not pixels.
+ */
+ getTileBelow: function (layer, x, y) {
+
+ if (y < this.layers[layer].height - 1)
+ {
+ return this.layers[layer].data[y + 1][x];
+ }
+
+ return null;
+
+ },
+
+ /**
+ * Gets the tile to the left of the tile coordinates given.
+ * Mostly used as an internal function by calculateFaces.
+ *
+ * @method Phaser.Tileset#getTileLeft
+ * @param {number} layer - The local layer index to get the tile from. Can be determined by Tilemap.getLayer().
+ * @param {number} x - The x coordinate to get the tile from. In tiles, not pixels.
+ * @param {number} y - The y coordinate to get the tile from. In tiles, not pixels.
+ */
+ getTileLeft: function (layer, x, y) {
+
+ if (x > 0)
+ {
+ return this.layers[layer].data[y][x - 1];
+ }
+
+ return null;
+
+ },
+
+ /**
+ * Gets the tile to the right of the tile coordinates given.
+ * Mostly used as an internal function by calculateFaces.
+ *
+ * @method Phaser.Tileset#getTileRight
+ * @param {number} layer - The local layer index to get the tile from. Can be determined by Tilemap.getLayer().
+ * @param {number} x - The x coordinate to get the tile from. In tiles, not pixels.
+ * @param {number} y - The y coordinate to get the tile from. In tiles, not pixels.
+ */
+ getTileRight: function (layer, x, y) {
+
+ if (x < this.layers[layer].width - 1)
+ {
+ return this.layers[layer].data[y][x + 1];
+ }
+
+ return null;
+
+ },
+
/**
* Sets the current layer to the given index.
*
* @method Phaser.Tilemap#setLayer
- * @param {number} layer - Sets the current layer to the given index.
+ * @param {number|string|Phaser.TilemapLayer} layer - The layer to set as current.
*/
setLayer: function (layer) {
+ layer = this.getLayer(layer);
+
if (this.layers[layer])
{
this.currentLayer = layer;
@@ -597,36 +1161,68 @@ Phaser.Tilemap.prototype = {
/**
* Puts a tile of the given index value at the coordinate specified.
+ *
* @method Phaser.Tilemap#putTile
- * @param {number} index - The index of this tile to set.
+ * @param {Phaser.Tile|number} tile - The index of this tile to set or a Phaser.Tile object.
* @param {number} x - X position to place the tile (given in tile units, not pixels)
* @param {number} y - Y position to place the tile (given in tile units, not pixels)
- * @param {number} [layer] - The Tilemap Layer to operate on.
+ * @param {number|string|Phaser.TilemapLayer} [layer] - The layer to modify.
*/
- putTile: function (index, x, y, layer) {
+ putTile: function (tile, x, y, layer) {
- if (typeof layer === "undefined") { layer = this.currentLayer; }
+ layer = this.getLayer(layer);
if (x >= 0 && x < this.layers[layer].width && y >= 0 && y < this.layers[layer].height)
{
- this.layers[layer].data[y][x] = index;
+ if (tile instanceof Phaser.Tile)
+ {
+ this.layers[layer].data[y][x].copy(tile);
+ }
+ else
+ {
+ this.layers[layer].data[y][x].index = tile;
+ }
+
+ this.layers[layer].dirty = true;
+ this.calculateFaces(layer);
}
- this.dirty = true;
+ },
+
+ /**
+ * Puts a tile into the Tilemap layer. The coordinates are given in pixel values.
+ *
+ * @method Phaser.Tilemap#putTileWorldXY
+ * @param {Phaser.Tile|number} tile - The index of this tile to set or a Phaser.Tile object.
+ * @param {number} x - X position to insert the tile (given in pixels)
+ * @param {number} y - Y position to insert the tile (given in pixels)
+ * @param {number} tileWidth - The width of the tile in pixels.
+ * @param {number} tileHeight - The height of the tile in pixels.
+ * @param {number|string|Phaser.TilemapLayer} [layer] - The layer to modify.
+ */
+ putTileWorldXY: function (tile, x, y, tileWidth, tileHeight, layer) {
+
+ layer = this.getLayer(layer);
+
+ x = this.game.math.snapToFloor(x, tileWidth) / tileWidth;
+ y = this.game.math.snapToFloor(y, tileHeight) / tileHeight;
+
+ this.putTile(tile, x, y, layer);
},
/**
* Gets a tile from the Tilemap Layer. The coordinates are given in tile values.
+ *
* @method Phaser.Tilemap#getTile
* @param {number} x - X position to get the tile from (given in tile units, not pixels)
* @param {number} y - Y position to get the tile from (given in tile units, not pixels)
- * @param {number} [layer] - The Tilemap Layer to operate on.
- * @return {number} The index of the tile at the given coordinates.
+ * @param {number|string|Phaser.TilemapLayer} [layer] - The layer to get the tile from.
+ * @return {Phaser.Tile} The tile at the given coordinates.
*/
getTile: function (x, y, layer) {
- if (typeof layer === "undefined") { layer = this.currentLayer; }
+ layer = this.getLayer(layer);
if (x >= 0 && x < this.layers[layer].width && y >= 0 && y < this.layers[layer].height)
{
@@ -637,65 +1233,38 @@ Phaser.Tilemap.prototype = {
/**
* Gets a tile from the Tilemap layer. The coordinates are given in pixel values.
+ *
* @method Phaser.Tilemap#getTileWorldXY
* @param {number} x - X position to get the tile from (given in pixels)
* @param {number} y - Y position to get the tile from (given in pixels)
- * @param {number} [layer] - The Tilemap Layer to operate on.
- * @return {number} The index of the tile at the given coordinates.
+ * @param {number|string|Phaser.TilemapLayer} [layer] - The layer to get the tile from.
+ * @return {Phaser.Tile} The tile at the given coordinates.
*/
getTileWorldXY: function (x, y, tileWidth, tileHeight, layer) {
- if (typeof layer === "undefined") { layer = this.currentLayer; }
+ layer = this.getLayer(layer);
x = this.game.math.snapToFloor(x, tileWidth) / tileWidth;
y = this.game.math.snapToFloor(y, tileHeight) / tileHeight;
- if (x >= 0 && x < this.layers[layer].width && y >= 0 && y < this.layers[layer].height)
- {
- return this.layers[layer].data[y][x];
- }
-
- },
-
- /**
- * Puts a tile into the Tilemap layer. The coordinates are given in pixel values.
- * @method Phaser.Tilemap#putTileWorldXY
- * @param {number} index - The index of the tile to put into the layer.
- * @param {number} x - X position to insert the tile (given in pixels)
- * @param {number} y - Y position to insert the tile (given in pixels)
- * @param {number} tileWidth - The width of the tile in pixels.
- * @param {number} tileHeight - The height of the tile in pixels.
- * @param {number} [layer] - The Tilemap Layer to operate on.
- */
- putTileWorldXY: function (index, x, y, tileWidth, tileHeight, layer) {
-
- if (typeof layer === "undefined") { layer = this.currentLayer; }
-
- x = this.game.math.snapToFloor(x, tileWidth) / tileWidth;
- y = this.game.math.snapToFloor(y, tileHeight) / tileHeight;
-
- if (x >= 0 && x < this.layers[layer].width && y >= 0 && y < this.layers[layer].height)
- {
- this.layers[layer].data[y][x] = index;
- }
-
- this.dirty = true;
+ return this.getTile(x, y, layer);
},
/**
* Copies all of the tiles in the given rectangular block into the tilemap data buffer.
+ *
* @method Phaser.Tilemap#copy
* @param {number} x - X position of the top left of the area to copy (given in tiles, not pixels)
* @param {number} y - Y position of the top left of the area to copy (given in tiles, not pixels)
* @param {number} width - The width of the area to copy (given in tiles, not pixels)
* @param {number} height - The height of the area to copy (given in tiles, not pixels)
- * @param {number} [layer] - The Tilemap Layer to operate on.
+ * @param {number|string|Phaser.TilemapLayer} [layer] - The layer to copy the tiles from.
* @return {array} An array of the tiles that were copied.
*/
copy: function (x, y, width, height, layer) {
- if (typeof layer === "undefined") { layer = this.currentLayer; }
+ layer = this.getLayer(layer);
if (!this.layers[layer])
{
@@ -736,7 +1305,7 @@ Phaser.Tilemap.prototype = {
{
for (var tx = x; tx < x + width; tx++)
{
- this._results.push({ x: tx, y: ty, index: this.layers[layer].data[ty][tx] });
+ this._results.push(this.layers[layer].data[ty][tx]);
}
}
@@ -746,17 +1315,19 @@ Phaser.Tilemap.prototype = {
/**
* Pastes a previously copied block of tile data into the given x/y coordinates. Data should have been prepared with Tilemap.copy.
+ *
* @method Phaser.Tilemap#paste
* @param {number} x - X position of the top left of the area to paste to (given in tiles, not pixels)
* @param {number} y - Y position of the top left of the area to paste to (given in tiles, not pixels)
* @param {array} tileblock - The block of tiles to paste.
- * @param {number} layer - The Tilemap Layer to operate on.
+ * @param {number|string|Phaser.TilemapLayer} [layer] - The layer to paste the tiles into.
*/
paste: function (x, y, tileblock, layer) {
if (typeof x === "undefined") { x = 0; }
if (typeof y === "undefined") { y = 0; }
- if (typeof layer === "undefined") { layer = this.currentLayer; }
+
+ layer = this.getLayer(layer);
if (!tileblock || tileblock.length < 2)
{
@@ -769,15 +1340,17 @@ Phaser.Tilemap.prototype = {
for (var i = 1; i < tileblock.length; i++)
{
- this.layers[layer].data[ diffY + tileblock[i].y ][ diffX + tileblock[i].x ] = tileblock[i].index;
+ this.layers[layer].data[ diffY + tileblock[i].y ][ diffX + tileblock[i].x ].copy(tileblock[i]);
}
- this.dirty = true;
+ this.layers[layer].dirty = true;
+ this.calculateFaces(layer);
},
/**
- * Swap tiles with 2 kinds of indexes.
+ * Scans the given area for tiles with an index matching tileA and swaps them with tileB.
+ *
* @method Phaser.Tilemap#swapTile
* @param {number} tileA - First tile index.
* @param {number} tileB - Second tile index.
@@ -785,9 +1358,12 @@ Phaser.Tilemap.prototype = {
* @param {number} y - Y position of the top left of the area to operate one, given in tiles, not pixels.
* @param {number} width - The width in tiles of the area to operate on.
* @param {number} height - The height in tiles of the area to operate on.
+ * @param {number|string|Phaser.TilemapLayer} [layer] - The layer to operate on.
*/
swap: function (tileA, tileB, x, y, width, height, layer) {
+ layer = this.getLayer(layer);
+
this.copy(x, y, width, height, layer);
if (this._results.length < 2)
@@ -800,13 +1376,15 @@ Phaser.Tilemap.prototype = {
this._results.forEach(this.swapHandler, this);
- this.paste(x, y, this._results);
+ this.paste(x, y, this._results, layer);
},
/**
* Internal function that handles the swapping of tiles.
+ *
* @method Phaser.Tilemap#swapHandler
+ * @private
* @param {number} value
* @param {number} index
*/
@@ -824,7 +1402,8 @@ Phaser.Tilemap.prototype = {
},
/**
- * For each tile in the given area (defined by x/y and width/height) run the given callback.
+ * For each tile in the given area defined by x/y and width/height run the given callback.
+ *
* @method Phaser.Tilemap#forEach
* @param {number} callback - The callback. Each tile in the given area will be passed to this callback as the first and only parameter.
* @param {number} context - The context under which the callback should be run.
@@ -832,10 +1411,12 @@ Phaser.Tilemap.prototype = {
* @param {number} y - Y position of the top left of the area to operate one, given in tiles, not pixels.
* @param {number} width - The width in tiles of the area to operate on.
* @param {number} height - The height in tiles of the area to operate on.
- * @param {number} [layer] - The Tilemap Layer to operate on.
+ * @param {number|string|Phaser.TilemapLayer} [layer] - The layer to operate on.
*/
forEach: function (callback, context, x, y, width, height, layer) {
+ layer = this.getLayer(layer);
+
this.copy(x, y, width, height, layer);
if (this._results.length < 2)
@@ -845,22 +1426,25 @@ Phaser.Tilemap.prototype = {
this._results.forEach(callback, context);
- this.paste(x, y, this._results);
+ this.paste(x, y, this._results, layer);
},
/**
- * Replaces one type of tile with another in the given area (defined by x/y and width/height).
+ * Scans the given area for tiles with an index matching `source` and updates their index to match `dest`.
+ *
* @method Phaser.Tilemap#replace
- * @param {number} tileA - First tile index.
- * @param {number} tileB - Second tile index.
+ * @param {number} source - The tile index value to scan for.
+ * @param {number} dest - The tile index value to replace found tiles with.
* @param {number} x - X position of the top left of the area to operate one, given in tiles, not pixels.
* @param {number} y - Y position of the top left of the area to operate one, given in tiles, not pixels.
* @param {number} width - The width in tiles of the area to operate on.
* @param {number} height - The height in tiles of the area to operate on.
- * @param {number} [layer] - The Tilemap Layer to operate on.
+ * @param {number|string|Phaser.TilemapLayer} [layer] - The layer to operate on.
*/
- replace: function (tileA, tileB, x, y, width, height, layer) {
+ replace: function (source, dest, x, y, width, height, layer) {
+
+ layer = this.getLayer(layer);
this.copy(x, y, width, height, layer);
@@ -871,30 +1455,29 @@ Phaser.Tilemap.prototype = {
for (var i = 1; i < this._results.length; i++)
{
- if (this._results[i].index === tileA)
+ if (this._results[i].index === source)
{
- this._results[i].index = tileB;
+ this._results[i].index = dest;
}
}
- this.paste(x, y, this._results);
+ this.paste(x, y, this._results, layer);
},
/**
* Randomises a set of tiles in a given area.
+ *
* @method Phaser.Tilemap#random
- * @param {number} tileA - First tile index.
- * @param {number} tileB - Second tile index.
* @param {number} x - X position of the top left of the area to operate one, given in tiles, not pixels.
* @param {number} y - Y position of the top left of the area to operate one, given in tiles, not pixels.
* @param {number} width - The width in tiles of the area to operate on.
* @param {number} height - The height in tiles of the area to operate on.
- * @param {number} [layer] - The Tilemap Layer to operate on.
+ * @param {number|string|Phaser.TilemapLayer} [layer] - The layer to operate on.
*/
random: function (x, y, width, height, layer) {
- if (typeof layer === "undefined") { layer = this.currentLayer; }
+ layer = this.getLayer(layer);
this.copy(x, y, width, height, layer);
@@ -907,11 +1490,14 @@ Phaser.Tilemap.prototype = {
for (var t = 1; t < this._results.length; t++)
{
- var idx = this._results[t].index;
-
- if (indexes.indexOf(idx) === -1)
+ if (this._results[t].index)
{
- indexes.push(idx);
+ var idx = this._results[t].index;
+
+ if (indexes.indexOf(idx) === -1)
+ {
+ indexes.push(idx);
+ }
}
}
@@ -920,24 +1506,23 @@ Phaser.Tilemap.prototype = {
this._results[i].index = this.game.rnd.pick(indexes);
}
- this.paste(x, y, this._results);
+ this.paste(x, y, this._results, layer);
},
/**
* Shuffles a set of tiles in a given area. It will only randomise the tiles in that area, so if they're all the same nothing will appear to have changed!
+ *
* @method Phaser.Tilemap#shuffle
- * @param {number} tileA - First tile index.
- * @param {number} tileB - Second tile index.
* @param {number} x - X position of the top left of the area to operate one, given in tiles, not pixels.
* @param {number} y - Y position of the top left of the area to operate one, given in tiles, not pixels.
* @param {number} width - The width in tiles of the area to operate on.
* @param {number} height - The height in tiles of the area to operate on.
- * @param {number} [layer] - The Tilemap Layer to operate on.
+ * @param {number|string|Phaser.TilemapLayer} [layer] - The layer to operate on.
*/
shuffle: function (x, y, width, height, layer) {
- if (typeof layer === "undefined") { layer = this.currentLayer; }
+ layer = this.getLayer(layer);
this.copy(x, y, width, height, layer);
@@ -946,28 +1531,42 @@ Phaser.Tilemap.prototype = {
return;
}
- var header = this._results.shift();
+ var indexes = [];
- Phaser.Utils.shuffle(this._results);
+ for (var t = 1; t < this._results.length; t++)
+ {
+ if (this._results[t].index)
+ {
+ indexes.push(this._results[t].index);
+ }
+ }
- this._results.unshift(header);
+ Phaser.Utils.shuffle(indexes);
- this.paste(x, y, this._results);
+ for (var i = 1; i < this._results.length; i++)
+ {
+ this._results[i].index = indexes[i - 1];
+ }
+
+ this.paste(x, y, this._results, layer);
},
/**
- * Fill a block with a specific tile index.
+ * Fills the given area with the specified tile.
+ *
* @method Phaser.Tilemap#fill
- * @param {number} index - Index of tiles you want to fill with.
+ * @param {number} index - The index of the tile that the area will be filled with.
* @param {number} x - X position of the top left of the area to operate one, given in tiles, not pixels.
* @param {number} y - Y position of the top left of the area to operate one, given in tiles, not pixels.
* @param {number} width - The width in tiles of the area to operate on.
* @param {number} height - The height in tiles of the area to operate on.
- * @param {number} [layer] - The Tilemap Layer to operate on.
+ * @param {number|string|Phaser.TilemapLayer} [layer] - The layer to operate on.
*/
fill: function (index, x, y, width, height, layer) {
+ layer = this.getLayer(layer);
+
this.copy(x, y, width, height, layer);
if (this._results.length < 2)
@@ -980,12 +1579,13 @@ Phaser.Tilemap.prototype = {
this._results[i].index = index;
}
- this.paste(x, y, this._results);
+ this.paste(x, y, this._results, layer);
},
/**
* Removes all layers from this tile map.
+ *
* @method Phaser.Tilemap#removeAllLayers
*/
removeAllLayers: function () {
@@ -997,6 +1597,7 @@ Phaser.Tilemap.prototype = {
/**
* Dumps the tilemap data out to the console.
+ *
* @method Phaser.Tilemap#dump
*/
dump: function () {
@@ -1037,16 +1638,20 @@ Phaser.Tilemap.prototype = {
/**
* Removes all layers from this tile map and nulls the game reference.
+ *
* @method Phaser.Tilemap#destroy
*/
destroy: function () {
this.removeAllLayers();
+ this.data = [];
this.game = null;
}
};
+
+Phaser.Tilemap.prototype.constructor = Phaser.Tilemap;
@@ -1062,13 +1667,13 @@ Phaser.Tilemap.prototype = {
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:25 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/TilemapLayer.js.html b/docs/TilemapLayer.js.html
index 88cf9a57..e92aa009 100644
--- a/docs/TilemapLayer.js.html
+++ b/docs/TilemapLayer.js.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -423,7 +417,7 @@
/**
* @author Richard Davey <rich@photonstorm.com>
-* @copyright 2013 Photon Storm Ltd.
+* @copyright 2014 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -433,25 +427,37 @@
* @class Phaser.TilemapLayer
* @constructor
* @param {Phaser.Game} game - Game reference to the currently running game.
-* @param {number} x - The x coordinate of this layer.
-* @param {number} y - The y coordinate of this layer.
-* @param {number} renderWidth - Width of the layer.
-* @param {number} renderHeight - Height of the layer.
-* @param {Phaser.Tileset|string} tileset - The tile set used for rendering.
* @param {Phaser.Tilemap} tilemap - The tilemap to which this layer belongs.
-* @param {number} layer - The layer index within the map.
+* @param {number} index - The layer index within the map that this TilemapLayer represents.
+* @param {number} width - Width of the renderable area of the layer.
+* @param {number} height - Height of the renderable area of the layer.
*/
-Phaser.TilemapLayer = function (game, x, y, renderWidth, renderHeight, tileset, tilemap, layer) {
+Phaser.TilemapLayer = function (game, tilemap, index, width, height) {
/**
* @property {Phaser.Game} game - A reference to the currently running Game.
*/
this.game = game;
-
+
/**
- * @property {HTMLCanvasElement} canvas - The canvas to which this BitmapData draws.
+ * @property {Phaser.Tilemap} map - The Tilemap to which this layer is bound.
*/
- this.canvas = Phaser.Canvas.create(renderWidth, renderHeight);
+ this.map = tilemap;
+
+ /**
+ * @property {number} index - The index of this layer within the Tilemap.
+ */
+ this.index = index;
+
+ /**
+ * @property {object} layer - The layer object within the Tilemap that this layer represents.
+ */
+ this.layer = tilemap.layers[index];
+
+ /**
+ * @property {HTMLCanvasElement} canvas - The canvas to which this TilemapLayer draws.
+ */
+ this.canvas = Phaser.Canvas.create(width, height);
/**
* @property {CanvasRenderingContext2D} context - The 2d context of the canvas.
@@ -471,9 +477,14 @@ Phaser.TilemapLayer = function (game, x, y, renderWidth, renderHeight, tileset,
/**
* @property {Phaser.Frame} textureFrame - Dimensions of the renderable area.
*/
- this.textureFrame = new Phaser.Frame(0, 0, 0, renderWidth, renderHeight, 'tilemaplayer', game.rnd.uuid());
+ this.textureFrame = new Phaser.Frame(0, 0, 0, width, height, 'tilemapLayer', game.rnd.uuid());
- Phaser.Sprite.call(this, this.game, x, y, this.texture, this.textureFrame);
+ Phaser.Sprite.call(this, this.game, 0, 0, this.texture, this.textureFrame);
+
+ /**
+ * @property {string} name - The name of the layer.
+ */
+ this.name = '';
/**
* @property {number} type - The const type of this object.
@@ -482,58 +493,91 @@ Phaser.TilemapLayer = function (game, x, y, renderWidth, renderHeight, tileset,
this.type = Phaser.TILEMAPLAYER;
/**
- * A layer that is fixed to the camera ignores the position of any ancestors in the display list and uses its x/y coordinates as offsets from the top left of the camera.
- * @property {boolean} fixedToCamera - Fixes this layer to the Camera.
+ * An object that is fixed to the camera ignores the position of any ancestors in the display list and uses its x/y coordinates as offsets from the top left of the camera.
+ * @property {boolean} fixedToCamera - Fixes this object to the Camera.
* @default
*/
this.fixedToCamera = true;
/**
- * @property {Phaser.Tileset} tileset - The tile set used for rendering.
+ * @property {Phaser.Point} cameraOffset - If this object is fixed to the camera then use this Point to specify how far away from the Camera x/y it's rendered.
*/
- this.tileset = null;
+ this.cameraOffset = new Phaser.Point(0, 0);
/**
- * @property {number} tileWidth - The width of a single tile in pixels.
+ * @property {string} tileColor - If no tileset is given the tiles will be rendered as rectangles in this color. Provide in hex or rgb/rgba string format.
+ * @default
*/
- this.tileWidth = 0;
+ this.tileColor = 'rgb(255, 255, 255)';
/**
- * @property {number} tileHeight - The height of a single tile in pixels.
+ * @property {boolean} debug - If set to true the collideable tile edges path will be rendered. Only works when game is running in Phaser.CANVAS mode.
+ * @default
*/
- this.tileHeight = 0;
+ this.debug = false;
/**
- * @property {number} tileMargin - The margin around the tiles.
+ * @property {number} debugAlpha - If debug is true then the tileset is rendered with this alpha level, to make the tile edges clearer.
+ * @default
*/
- this.tileMargin = 0;
+ this.debugAlpha = 0.5;
/**
- * @property {number} tileSpacing - The spacing around the tiles.
+ * @property {string} debugColor - If debug is true this is the color used to outline the edges of collidable tiles. Provide in hex or rgb/rgba string format.
+ * @default
*/
- this.tileSpacing = 0;
+ this.debugColor = 'rgba(0, 255, 0, 1)';
/**
- * @property {number} widthInPixels - Do NOT recommend changing after the map is loaded!
- * @readonly
+ * @property {boolean} debugFill - If true the debug tiles are filled with debugFillColor AND stroked around.
+ * @default
*/
- this.widthInPixels = 0;
+ this.debugFill = false;
/**
- * @property {number} heightInPixels - Do NOT recommend changing after the map is loaded!
- * @readonly
+ * @property {string} debugFillColor - If debugFill is true this is the color used to fill the tiles. Provide in hex or rgb/rgba string format.
+ * @default
*/
- this.heightInPixels = 0;
+ this.debugFillColor = 'rgba(0, 255, 0, 0.2)';
/**
- * @property {number} renderWidth - The width of the area being rendered.
+ * @property {string} debugCallbackColor - If debug is true this is the color used to outline the edges of tiles that have collision callbacks. Provide in hex or rgb/rgba string format.
+ * @default
*/
- this.renderWidth = renderWidth;
+ this.debugCallbackColor = 'rgba(255, 0, 0, 1)';
/**
- * @property {number} renderHeight - The height of the area being rendered.
+ * @property {number} scrollFactorX - speed at which this layer scrolls
+ * horizontally, relative to the camera (e.g. scrollFactorX of 0.5 scrolls
+ * half as quickly as the 'normal' camera-locked layers do)
+ * @default 1
*/
- this.renderHeight = renderHeight;
+ this.scrollFactorX = 1;
+
+ /**
+ * @property {number} scrollFactorY - speed at which this layer scrolls
+ * vertically, relative to the camera (e.g. scrollFactorY of 0.5 scrolls
+ * half as quickly as the 'normal' camera-locked layers do)
+ * @default 1
+ */
+ this.scrollFactorY = 1;
+
+ /**
+ * @property {boolean} dirty - Flag controlling when to re-render the layer.
+ */
+ this.dirty = true;
+
+ /**
+ * @property {number} _cw - Local collision var.
+ * @private
+ */
+ this._cw = tilemap.tileWidth;
+
+ /**
+ * @property {number} _ch - Local collision var.
+ * @private
+ */
+ this._ch = tilemap.tileHeight;
/**
* @property {number} _ga - Local render loop var to help avoid gc spikes.
@@ -649,51 +693,7 @@ Phaser.TilemapLayer = function (game, x, y, renderWidth, renderHeight, tileset,
*/
this._prevY = 0;
- /**
- * @property {number} scrollFactorX - speed at which this layer scrolls
- * horizontally, relative to the camera (e.g. scrollFactorX of 0.5 scrolls
- * half as quickly as the 'normal' camera-locked layers do)
- * @default 1
- */
- this.scrollFactorX = 1;
-
- /**
- * @property {number} scrollFactorY - speed at which this layer scrolls
- * vertically, relative to the camera (e.g. scrollFactorY of 0.5 scrolls
- * half as quickly as the 'normal' camera-locked layers do)
- * @default 1
- */
- this.scrollFactorY = 1;
-
- /**
- * @property {Phaser.Tilemap} tilemap - The Tilemap to which this layer is bound.
- */
- this.tilemap = null;
-
- /**
- * @property {number} layer - Tilemap layer index.
- */
- this.layer = null;
-
- /**
- * @property {number} index
- */
- this.index = 0;
-
- /**
- * @property {boolean} dirty - Flag controlling when to re-render the layer.
- */
- this.dirty = true;
-
- if (tileset instanceof Phaser.Tileset || typeof tileset === 'string')
- {
- this.updateTileset(tileset);
- }
-
- if (tilemap instanceof Phaser.Tilemap)
- {
- this.updateMapData(tilemap, layer);
- }
+ this.updateMax();
};
@@ -702,13 +702,16 @@ Phaser.TilemapLayer.prototype = Phaser.Utils.extend(true, Phaser.TilemapLayer.pr
Phaser.TilemapLayer.prototype.constructor = Phaser.TilemapLayer;
/**
-* Automatically called by World.preUpdate. Handles cache updates.
+* Automatically called by World.postUpdate. Handles cache updates.
*
-* @method Phaser.TilemapLayer#update
+* @method Phaser.TilemapLayer#postUpdate
* @memberof Phaser.TilemapLayer
*/
-Phaser.TilemapLayer.prototype.update = function () {
+Phaser.TilemapLayer.prototype.postUpdate = function () {
+ Phaser.Sprite.prototype.postUpdate.call(this);
+
+ // Stops you being able to auto-scroll the camera if it's not following a sprite
this.scrollX = this.game.camera.x * this.scrollFactorX;
this.scrollY = this.game.camera.y * this.scrollFactorY;
@@ -724,69 +727,12 @@ Phaser.TilemapLayer.prototype.update = function () {
*/
Phaser.TilemapLayer.prototype.resizeWorld = function () {
- this.game.world.setBounds(0, 0, this.widthInPixels, this.heightInPixels);
+ this.game.world.setBounds(0, 0, this.layer.widthInPixels, this.layer.heightInPixels);
}
/**
-* Updates the Tileset data.
-*
-* @method Phaser.TilemapLayer#updateTileset
-* @memberof Phaser.TilemapLayer
-* @param {Phaser.Tileset|string} tileset - The tileset to use for this layer.
-*/
-Phaser.TilemapLayer.prototype.updateTileset = function (tileset) {
-
- if (tileset instanceof Phaser.Tileset)
- {
- this.tileset = tileset;
- }
- else if (typeof tileset === 'string')
- {
- this.tileset = this.game.cache.getTileset('tiles');
- }
- else
- {
- return;
- }
-
- this.tileWidth = this.tileset.tileWidth;
- this.tileHeight = this.tileset.tileHeight;
- this.tileMargin = this.tileset.tileMargin;
- this.tileSpacing = this.tileset.tileSpacing;
-
- this.updateMax();
-
-}
-
-/**
-* Updates the Tilemap data.
-*
-* @method Phaser.TilemapLayer#updateMapData
-* @memberof Phaser.TilemapLayer
-* @param {Phaser.Tilemap} tilemap - The tilemap to which this layer belongs.
-* @param {number} layer - The layer index within the map.
-*/
-Phaser.TilemapLayer.prototype.updateMapData = function (tilemap, layer) {
-
- if (typeof layer === 'undefined')
- {
- layer = 0;
- }
-
- if (tilemap instanceof Phaser.Tilemap)
- {
- this.tilemap = tilemap;
- this.layer = this.tilemap.layers[layer];
- this.index = layer;
- this.updateMax();
- this.tilemap.dirty = true;
- }
-
-}
-
-/**
-* Take an x coordinate that doesn't account for scrollFactorY and 'fix' it
+* Take an x coordinate that doesn't account for scrollFactorX and 'fix' it
* into a scrolled local space. Used primarily internally
* @method Phaser.TilemapLayer#_fixX
* @memberof Phaser.TilemapLayer
@@ -796,19 +742,22 @@ Phaser.TilemapLayer.prototype.updateMapData = function (tilemap, layer) {
*/
Phaser.TilemapLayer.prototype._fixX = function(x) {
+ if (x < 0)
+ {
+ x = 0;
+ }
+
if (this.scrollFactorX === 1)
{
return x;
}
- var leftEdge = x - (this._x / this.scrollFactorX);
-
- return this._x + leftEdge;
+ return this._x + (x - (this._x / this.scrollFactorX));
}
/**
-* Take an x coordinate that _does_ account for scrollFactorY and 'unfix' it
+* Take an x coordinate that _does_ account for scrollFactorX and 'unfix' it
* back to camera space. Used primarily internally
* @method Phaser.TilemapLayer#_unfixX
* @memberof Phaser.TilemapLayer
@@ -823,9 +772,7 @@ Phaser.TilemapLayer.prototype._unfixX = function(x) {
return x;
}
- var leftEdge = x - this._x;
-
- return (this._x / this.scrollFactorX) + leftEdge;
+ return (this._x / this.scrollFactorX) + (x - this._x);
}
@@ -840,14 +787,17 @@ Phaser.TilemapLayer.prototype._unfixX = function(x) {
*/
Phaser.TilemapLayer.prototype._fixY = function(y) {
+ if (y < 0)
+ {
+ y = 0;
+ }
+
if (this.scrollFactorY === 1)
{
return y;
}
- var topEdge = y - (this._y / this.scrollFactorY);
-
- return this._y + topEdge;
+ return this._y + (y - (this._y / this.scrollFactorY));
}
@@ -867,9 +817,7 @@ Phaser.TilemapLayer.prototype._unfixY = function(y) {
return y;
}
- var topEdge = y - this._y;
-
- return (this._y / this.scrollFactorY) + topEdge;
+ return (this._y / this.scrollFactorY) + (y - this._y);
}
@@ -882,9 +830,9 @@ Phaser.TilemapLayer.prototype._unfixY = function(y) {
*/
Phaser.TilemapLayer.prototype.getTileX = function (x) {
- var tileWidth = this.tileWidth * this.scale.x;
+ // var tileWidth = this.tileWidth * this.scale.x;
- return this.game.math.snapToFloor(this._fixX(x), tileWidth) / tileWidth;
+ return this.game.math.snapToFloor(this._fixX(x), this.map.tileWidth) / this.map.tileWidth;
}
@@ -897,9 +845,9 @@ Phaser.TilemapLayer.prototype.getTileX = function (x) {
*/
Phaser.TilemapLayer.prototype.getTileY = function (y) {
- var tileHeight = this.tileHeight * this.scale.y;
+ // var tileHeight = this.tileHeight * this.scale.y;
- return this.game.math.snapToFloor(this._fixY(y), tileHeight) / tileHeight;
+ return this.game.math.snapToFloor(this._fixY(y), this.map.tileHeight) / this.map.tileHeight;
}
@@ -909,7 +857,8 @@ Phaser.TilemapLayer.prototype.getTileY = function (y) {
* @memberof Phaser.TilemapLayer
* @param {number} x - X position of the point in target tile.
* @param {number} y - Y position of the point in target tile.
-* @return {Phaser.Tile} The tile with specific properties.
+* @param {Phaser.Point|object} point - The Point object to set the x and y values on.
+* @return {Phaser.Point|object} A Point object with its x and y properties set.
*/
Phaser.TilemapLayer.prototype.getTileXY = function (x, y, point) {
@@ -921,73 +870,43 @@ Phaser.TilemapLayer.prototype.getTileXY = function (x, y, point) {
}
/**
-* Get the tiles within the given area.
+* Get all tiles that exist within the given area, defined by the top-left corner, width and height. Values given are in pixels, not tiles.
* @method Phaser.TilemapLayer#getTiles
* @memberof Phaser.TilemapLayer
-* @param {number} x - X position of the top left of the area to copy (given in tiles, not pixels)
-* @param {number} y - Y position of the top left of the area to copy (given in tiles, not pixels)
-* @param {number} width - The width of the area to copy (given in tiles, not pixels)
-* @param {number} height - The height of the area to copy (given in tiles, not pixels)
-* @param {boolean} collides - If true only return tiles that collide on one or more faces.
+* @param {number} x - X position of the top left corner.
+* @param {number} y - Y position of the top left corner.
+* @param {number} width - Width of the area to get.
+* @param {number} height - Height of the area to get.
+* @param {boolean} [collides=false] - If true only return tiles that collide on one or more faces.
* @return {array} Array with tiles informations (each contains x, y, and the tile).
*/
Phaser.TilemapLayer.prototype.getTiles = function (x, y, width, height, collides) {
- if (this.tilemap === null)
- {
- return;
- }
-
// Should we only get tiles that have at least one of their collision flags set? (true = yes, false = no just get them all)
if (typeof collides === 'undefined') { collides = false; }
- // Cap the values
-
- if (x < 0)
- {
- x = 0;
- }
-
- if (y < 0)
- {
- y = 0;
- }
-
// adjust the x,y coordinates for scrollFactor
- x = this._fixX( x );
- y = this._fixY( y );
+ x = this._fixX(x);
+ y = this._fixY(y);
- if (width > this.widthInPixels)
+ if (width > this.layer.widthInPixels)
{
- width = this.widthInPixels;
+ width = this.layer.widthInPixels;
}
- if (height > this.heightInPixels)
+ if (height > this.layer.heightInPixels)
{
- height = this.heightInPixels;
+ height = this.layer.heightInPixels;
}
- var tileWidth = this.tileWidth * this.scale.x;
- var tileHeight = this.tileHeight * this.scale.y;
-
// Convert the pixel values into tile coordinates
- this._tx = this.game.math.snapToFloor(x, tileWidth) / tileWidth;
- this._ty = this.game.math.snapToFloor(y, tileHeight) / tileHeight;
- this._tw = (this.game.math.snapToCeil(width, tileWidth) + tileWidth) / tileWidth;
- this._th = (this.game.math.snapToCeil(height, tileHeight) + tileHeight) / tileHeight;
+ this._tx = this.game.math.snapToFloor(x, this._cw) / this._cw;
+ this._ty = this.game.math.snapToFloor(y, this._ch) / this._ch;
+ this._tw = (this.game.math.snapToCeil(width, this._cw) + this._cw) / this._cw;
+ this._th = (this.game.math.snapToCeil(height, this._ch) + this._ch) / this._ch;
// This should apply the layer x/y here
-
- // this._results.length = 0;
- this._results = [];
-
- // pretty sure we don't use this any more?
- // this._results.push( { x: x, y: y, width: width, height: height, tx: this._tx, ty: this._ty, tw: this._tw, th: this._th });
-
- var _index = 0;
- var _tile = null;
- var sx = 0;
- var sy = 0;
+ this._results.length = 0;
for (var wy = this._ty; wy < this._ty + this._th; wy++)
{
@@ -995,19 +914,20 @@ Phaser.TilemapLayer.prototype.getTiles = function (x, y, width, height, collides
{
if (this.layer.data[wy] && this.layer.data[wy][wx])
{
- // Could combine
- _index = this.layer.data[wy][wx] - 1;
- _tile = this.tileset.getTile(_index);
-
- sx = _tile.width * this.scale.x;
- sy = _tile.height * this.scale.y;
-
- if (collides === false || (collides && _tile.collideNone === false))
+ if (collides === false || (collides && this.layer.data[wy][wx].canCollide))
{
- // convert tile coordinates back to camera space for return
- var _wx = this._unfixX( wx*sx ) / tileWidth;
- var _wy = this._unfixY( wy*sy ) / tileHeight;
- this._results.push({ x: _wx * sx, right: (_wx * sx) + sx, y: _wy * sy, bottom: (_wy * sy) + sy, width: sx, height: sy, tx: _wx, ty: _wy, tile: _tile });
+ // Convert tile coordinates back to camera space for return
+ var _wx = this._unfixX(wx * this._cw) / this._cw;
+ var _wy = this._unfixY(wy * this._ch) / this._ch;
+
+ this._results.push({
+ x: _wx * this._cw,
+ y: _wy * this._ch,
+ right: (_wx * this._cw) + this._cw,
+ bottom: (_wy * this._ch) + this._ch,
+ tile: this.layer.data[wy][wx],
+ layer: this.layer.data[wy][wx].layer
+ });
}
}
}
@@ -1024,8 +944,8 @@ Phaser.TilemapLayer.prototype.getTiles = function (x, y, width, height, collides
*/
Phaser.TilemapLayer.prototype.updateMax = function () {
- this._maxX = this.game.math.ceil(this.canvas.width / this.tileWidth) + 1;
- this._maxY = this.game.math.ceil(this.canvas.height / this.tileHeight) + 1;
+ this._maxX = this.game.math.ceil(this.canvas.width / this.map.tileWidth) + 1;
+ this._maxY = this.game.math.ceil(this.canvas.height / this.map.tileHeight) + 1;
if (this.layer)
{
@@ -1038,9 +958,6 @@ Phaser.TilemapLayer.prototype.updateMax = function () {
{
this._maxY = this.layer.height;
}
-
- this.widthInPixels = this.layer.width * this.tileWidth;
- this.heightInPixels = this.layer.height * this.tileHeight;
}
this.dirty = true;
@@ -1054,12 +971,12 @@ Phaser.TilemapLayer.prototype.updateMax = function () {
*/
Phaser.TilemapLayer.prototype.render = function () {
- if (this.tilemap && this.tilemap.dirty)
+ if (this.layer.dirty)
{
this.dirty = true;
}
- if (!this.dirty || !this.tileset || !this.tilemap || !this.visible)
+ if (!this.dirty || !this.visible)
{
return;
}
@@ -1067,101 +984,194 @@ Phaser.TilemapLayer.prototype.render = function () {
this._prevX = this._dx;
this._prevY = this._dy;
- this._dx = -(this._x - (this._startX * this.tileWidth));
- this._dy = -(this._y - (this._startY * this.tileHeight));
+ this._dx = -(this._x - (this._startX * this.map.tileWidth));
+ this._dy = -(this._y - (this._startY * this.map.tileHeight));
this._tx = this._dx;
this._ty = this._dy;
this.context.clearRect(0, 0, this.canvas.width, this.canvas.height);
- for (var y = this._startY; y < this._startY + this._maxY; y++)
+ this.context.fillStyle = this.tileColor;
+
+ var tile;
+ var set;
+ var ox = 0;
+ var oy = 0;
+
+ if (this.debug)
+ {
+ this.context.globalAlpha = this.debugAlpha;
+ }
+
+ for (var y = this._startY, lenY = this._startY + this._maxY; y < lenY; y++)
{
this._column = this.layer.data[y];
- for (var x = this._startX; x < this._startX + this._maxX; x++)
+ for (var x = this._startX, lenX = this._startX + this._maxX; x < lenX; x++)
{
- // only -1 on TILED maps, not CSV
- var tile = this.tileset.tiles[this._column[x]-1];
-
- if (tile)
+ if (this._column[x])
{
- this.context.drawImage(
- this.tileset.image,
- tile.x,
- tile.y,
- this.tileWidth,
- this.tileHeight,
- Math.floor(this._tx),
- Math.floor(this._ty),
- this.tileWidth,
- this.tileHeight
- );
+ tile = this._column[x];
+
+ if (this.map.tiles[tile.index])
+ {
+ set = this.map.tilesets[this.map.tiles[tile.index][2]]
+
+ if (set.image)
+ {
+ if (this.debug === false && tile.alpha !== this.context.globalAlpha)
+ {
+ this.context.globalAlpha = tile.alpha;
+ }
+
+ if (set.tileWidth !== this.map.tileWidth || set.tileHeight !== this.map.tileHeight)
+ {
+ // TODO: Smaller sized tile check
+ this.context.drawImage(
+ this.map.tilesets[this.map.tiles[tile.index][2]].image,
+ this.map.tiles[tile.index][0],
+ this.map.tiles[tile.index][1],
+ set.tileWidth,
+ set.tileHeight,
+ Math.floor(this._tx),
+ Math.floor(this._ty) - (set.tileHeight - this.map.tileHeight),
+ set.tileWidth,
+ set.tileHeight
+ );
+ }
+ else
+ {
+ this.context.drawImage(
+ this.map.tilesets[this.map.tiles[tile.index][2]].image,
+ this.map.tiles[tile.index][0],
+ this.map.tiles[tile.index][1],
+ this.map.tileWidth,
+ this.map.tileHeight,
+ Math.floor(this._tx),
+ Math.floor(this._ty),
+ this.map.tileWidth,
+ this.map.tileHeight
+ );
+ }
+
+ if (tile.debug)
+ {
+ this.context.fillStyle = 'rgba(0, 255, 0, 0.4)';
+ this.context.fillRect(Math.floor(this._tx), Math.floor(this._ty), this.map.tileWidth, this.map.tileHeight);
+ }
+ }
+ else
+ {
+ this.context.fillRect(Math.floor(this._tx), Math.floor(this._ty), this.map.tileWidth, this.map.tileHeight);
+ }
+ }
}
- this._tx += this.tileWidth;
+ this._tx += this.map.tileWidth;
}
this._tx = this._dx;
- this._ty += this.tileHeight;
+ this._ty += this.map.tileHeight;
+
+ }
+
+ if (this.debug)
+ {
+ this.context.globalAlpha = 1;
+ this.renderDebug();
}
// Only needed if running in WebGL, otherwise this array will never get cleared down I don't think!
- if (this.game.renderType == Phaser.WEBGL)
+ if (this.game.renderType === Phaser.WEBGL)
{
PIXI.texturesToUpdate.push(this.baseTexture);
}
this.dirty = false;
-
- if (this.tilemap.dirty)
- {
- this.tilemap.dirty = false;
- }
+ this.layer.dirty = false;
return true;
}
/**
-* Returns the absolute delta x value.
-* @method Phaser.TilemapLayer#deltaAbsX
+* Renders a collision debug overlay on-top of the canvas. Called automatically by render when debug = true.
+* @method Phaser.TilemapLayer#renderDebug
* @memberof Phaser.TilemapLayer
-* @return {number} Absolute delta X value
*/
-Phaser.TilemapLayer.prototype.deltaAbsX = function () {
- return (this.deltaX() > 0 ? this.deltaX() : -this.deltaX());
-}
+Phaser.TilemapLayer.prototype.renderDebug = function () {
-/**
-* Returns the absolute delta y value.
-* @method Phaser.TilemapLayer#deltaAbsY
-* @memberof Phaser.TilemapLayer
-* @return {number} Absolute delta Y value
-*/
-Phaser.TilemapLayer.prototype.deltaAbsY = function () {
- return (this.deltaY() > 0 ? this.deltaY() : -this.deltaY());
-}
+ this._tx = this._dx;
+ this._ty = this._dy;
-/**
-* Returns the delta x value.
-* @method Phaser.TilemapLayer#deltaX
-* @memberof Phaser.TilemapLayer
-* @return {number} Delta X value
-*/
-Phaser.TilemapLayer.prototype.deltaX = function () {
- return this._dx - this._prevX;
-}
+ this.context.strokeStyle = this.debugColor;
+ this.context.fillStyle = this.debugFillColor;
+
+ for (var y = this._startY, lenY = this._startY + this._maxY; y < lenY; y++)
+ {
+ this._column = this.layer.data[y];
+
+ for (var x = this._startX, lenX = this._startX + this._maxX; x < lenX; x++)
+ {
+ var tile = this._column[x];
+
+ if (tile && (tile.faceTop || tile.faceBottom || tile.faceLeft || tile.faceRight))
+ {
+ this._tx = Math.floor(this._tx);
+
+ if (this.debugFill)
+ {
+ this.context.fillRect(this._tx, this._ty, this._cw, this._ch);
+ }
+
+ this.context.beginPath();
+
+ if (tile.faceTop)
+ {
+ this.context.moveTo(this._tx, this._ty);
+ this.context.lineTo(this._tx + this._cw, this._ty);
+ }
+
+ if (tile.faceBottom)
+ {
+ this.context.moveTo(this._tx, this._ty + this._ch);
+ this.context.lineTo(this._tx + this._cw, this._ty + this._ch);
+ }
+
+ if (tile.faceLeft)
+ {
+ this.context.moveTo(this._tx, this._ty);
+ this.context.lineTo(this._tx, this._ty + this._ch);
+ }
+
+ if (tile.faceRight)
+ {
+ this.context.moveTo(this._tx + this._cw, this._ty);
+ this.context.lineTo(this._tx + this._cw, this._ty + this._ch);
+ }
+
+ this.context.stroke();
+ }
+
+ // Collision callback
+ if (tile && (tile.collisionCallback || tile.layer.callbacks[tile.index]))
+ {
+ this.context.fillStyle = this.debugCallbackColor;
+ this.context.fillRect(this._tx, this._ty, this._cw, this._ch);
+ this.context.fillStyle = this.debugFillColor;
+ }
+
+ this._tx += this.map.tileWidth;
+
+ }
+
+ this._tx = this._dx;
+ this._ty += this.map.tileHeight;
+
+ }
-/**
-* Returns the delta y value.
-* @method Phaser.TilemapLayer#deltaY
-* @memberof Phaser.TilemapLayer
-* @return {number} Delta Y value
-*/
-Phaser.TilemapLayer.prototype.deltaY = function () {
- return this._dy - this._prevY;
}
/**
@@ -1176,16 +1186,17 @@ Object.defineProperty(Phaser.TilemapLayer.prototype, "scrollX", {
set: function (value) {
- if (value !== this._x && value >= 0 && this.layer)
+ // if (value !== this._x && value >= 0 && this.layer && this.layer.widthInPixels > this.width)
+ if (value !== this._x && value >= 0 && this.layer.widthInPixels > this.width)
{
this._x = value;
-
- if (this._x > (this.widthInPixels - this.renderWidth))
+
+ if (this._x > (this.layer.widthInPixels - this.width))
{
- this._x = this.widthInPixels - this.renderWidth;
+ this._x = this.layer.widthInPixels - this.width;
}
- this._startX = this.game.math.floor(this._x / this.tileWidth);
+ this._startX = this.game.math.floor(this._x / this.map.tileWidth);
if (this._startX < 0)
{
@@ -1216,16 +1227,17 @@ Object.defineProperty(Phaser.TilemapLayer.prototype, "scrollY", {
set: function (value) {
- if (value !== this._y && value >= 0 && this.layer)
+ // if (value !== this._y && value >= 0 && this.layer && this.heightInPixels > this.renderHeight)
+ if (value !== this._y && value >= 0 && this.layer.heightInPixels > this.height)
{
this._y = value;
- if (this._y > (this.heightInPixels - this.renderHeight))
+ if (this._y > (this.layer.heightInPixels - this.height))
{
- this._y = this.heightInPixels - this.renderHeight;
+ this._y = this.layer.heightInPixels - this.height;
}
- this._startY = this.game.math.floor(this._y / this.tileHeight);
+ this._startY = this.game.math.floor(this._y / this.map.tileHeight);
if (this._startY < 0)
{
@@ -1242,6 +1254,46 @@ Object.defineProperty(Phaser.TilemapLayer.prototype, "scrollY", {
}
+});
+
+/**
+* @name Phaser.TilemapLayer#collisionWidth
+* @property {number} collisionWidth - The width of the collision tiles.
+*/
+Object.defineProperty(Phaser.TilemapLayer.prototype, "collisionWidth", {
+
+ get: function () {
+ return this._cw;
+ },
+
+ set: function (value) {
+
+ this._cw = value;
+
+ this.dirty = true;
+
+ }
+
+});
+
+/**
+* @name Phaser.TilemapLayer#collisionHeight
+* @property {number} collisionHeight - The height of the collision tiles.
+*/
+Object.defineProperty(Phaser.TilemapLayer.prototype, "collisionHeight", {
+
+ get: function () {
+ return this._ch;
+ },
+
+ set: function (value) {
+
+ this._ch = value;
+
+ this.dirty = true;
+
+ }
+
});
@@ -1258,13 +1310,13 @@ Object.defineProperty(Phaser.TilemapLayer.prototype, "scrollY", {
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:25 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/TilemapParser.js.html b/docs/TilemapParser.js.html
index c4f1ddb2..8bd6058b 100644
--- a/docs/TilemapParser.js.html
+++ b/docs/TilemapParser.js.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -423,7 +417,7 @@
/**
* @author Richard Davey <rich@photonstorm.com>
-* @copyright 2013 Photon Storm Ltd.
+* @copyright 2014 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -438,47 +432,45 @@ Phaser.TilemapParser = {
* Creates a Tileset object.
* @method Phaser.TilemapParser.tileset
* @param {Phaser.Game} game - Game reference to the currently running game.
- * @param {string} key
- * @param {number} tileWidth
- * @param {number} tileHeight
- * @param {number} tileMax
- * @param {number} tileMargin
- * @param {number} tileSpacing
+ * @param {string} key - The Cache key of this tileset.
+ * @param {number} tileWidth - Width of each single tile in pixels.
+ * @param {number} tileHeight - Height of each single tile in pixels.
+ * @param {number} [tileMargin=0] - If the tiles have been drawn with a margin, specify the amount here.
+ * @param {number} [tileSpacing=0] - If the tiles have been drawn with spacing between them, specify the amount here.
+ * @param {number} [rows=-1] - How many tiles are placed horizontally in each row? If -1 it will calculate rows by dividing the image width by tileWidth.
+ * @param {number} [columns=-1] - How many tiles are placed vertically in each column? If -1 it will calculate columns by dividing the image height by tileHeight.
+ * @param {number} [total=-1] - The maximum number of tiles to extract from the image. If -1 it will extract `rows * columns` worth. You can also set a value lower than the actual number of tiles.
* @return {Phaser.Tileset} Generated Tileset object.
*/
- tileset: function (game, key, tileWidth, tileHeight, tileMax, tileMargin, tileSpacing) {
+ tileset: function (game, key, tileWidth, tileHeight, tileMargin, tileSpacing, rows, columns, total) {
// How big is our image?
var img = game.cache.getTilesetImage(key);
- if (img == null)
+ if (img === null)
{
+ console.warn("Phaser.TilemapParser.tileSet: Invalid image key given");
return null;
}
var width = img.width;
var height = img.height;
- // If no tile width/height is given, try and figure it out (won't work if the tileset has margin/spacing)
- if (tileWidth <= 0)
+ if (rows === -1)
{
- tileWidth = Math.floor(-width / Math.min(-1, tileWidth));
+ rows = Math.round(width / tileWidth);
}
- if (tileHeight <= 0)
+ if (columns === -1)
{
- tileHeight = Math.floor(-height / Math.min(-1, tileHeight));
+ columns = Math.round(height / tileHeight);
}
- var row = Math.round(width / tileWidth);
- var column = Math.round(height / tileHeight);
- var total = row * column;
+ if (total === -1)
+ {
+ total = rows * columns;
+ }
- if (tileMax !== -1)
- {
- total = tileMax;
- }
-
// Zero or smaller than tile sizes?
if (width === 0 || height === 0 || width < tileWidth || height < tileHeight || total === 0)
{
@@ -486,26 +478,7 @@ Phaser.TilemapParser = {
return null;
}
- // Let's create some tiles
- var x = tileMargin;
- var y = tileMargin;
-
- var tileset = new Phaser.Tileset(img, key, tileWidth, tileHeight, tileMargin, tileSpacing);
-
- for (var i = 0; i < total; i++)
- {
- tileset.addTile(new Phaser.Tile(tileset, i, x, y, tileWidth, tileHeight));
-
- x += tileWidth + tileSpacing;
-
- if (x === width)
- {
- x = tileMargin;
- y += tileHeight + tileSpacing;
- }
- }
-
- return tileset;
+ return new Phaser.Tileset(img, key, tileWidth, tileHeight, tileMargin, tileSpacing, rows, columns, total);
},
@@ -513,19 +486,27 @@ Phaser.TilemapParser = {
* Parse tileset data from the cache and creates a Tileset object.
* @method Phaser.TilemapParser.parse
* @param {Phaser.Game} game - Game reference to the currently running game.
- * @param {object} data
- * @param {string} format
- * @return {Phaser.Tileset} Generated Tileset object.
+ * @param {string} key - The key of the tilemap in the Cache.
+ * @return {object} The parsed map object.
*/
- parse: function (game, data, format) {
+ parse: function (game, key) {
- if (format === Phaser.Tilemap.CSV)
+ var map = game.cache.getTilemapData(key);
+
+ if (map)
{
- return this.parseCSV(data);
+ if (map.format === Phaser.Tilemap.CSV)
+ {
+ return this.parseCSV(map.data);
+ }
+ else if (map.format === Phaser.Tilemap.TILED_JSON)
+ {
+ return this.parseTiledJSON(map.data);
+ }
}
- else if (format === Phaser.Tilemap.TILED_JSON)
+ else
{
- return this.parseTiledJSON(data);
+ return { layers: [], objects: [], images: [], tilesets: [] };
}
},
@@ -563,6 +544,8 @@ Phaser.TilemapParser = {
}
}
+ // Build collision map
+
return [{ name: 'csv', width: width, height: height, alpha: 1, visible: true, indexes: [], tileMargin: 0, tileSpacing: 0, data: output }];
},
@@ -570,66 +553,242 @@ Phaser.TilemapParser = {
/**
* Parses a Tiled JSON file into valid map data.
* @method Phaser.TilemapParser.parseJSON
- * @param {object} json- The Tiled JSON data.
- * @return {object} Generated map data.
+ * @param {object} json - The JSON map data.
+ * @return {object} Generated and parsed map data.
*/
parseTiledJSON: function (json) {
+ if (json.orientation !== 'orthogonal')
+ {
+ console.warn('TilemapParser.parseTiledJSON: Only orthogonal map types are supported in this version of Phaser');
+ return null;
+ }
+
+ // Map data will consist of: layers, objects, images, tilesets, sizes
+ var map = {};
+
+ map.width = json.width;
+ map.height = json.height;
+ map.tileWidth = json.tilewidth;
+ map.tileHeight = json.tileheight;
+ map.orientation = json.orientation;
+ map.version = json.version;
+ map.properties = json.properties;
+ map.widthInPixels = map.width * map.tileWidth;
+ map.heightInPixels = map.height * map.tileHeight;
+
+ // Tile Layers
var layers = [];
for (var i = 0; i < json.layers.length; i++)
{
- // Check it's a data layer
- if (!json.layers[i].data)
+ if (json.layers[i].type !== 'tilelayer')
{
continue;
}
- // json.tilewidth
- // json.tileheight
-
var layer = {
name: json.layers[i].name,
+ x: json.layers[i].x,
+ y: json.layers[i].y,
width: json.layers[i].width,
height: json.layers[i].height,
+ widthInPixels: json.layers[i].width * json.tilewidth,
+ heightInPixels: json.layers[i].height * json.tileheight,
alpha: json.layers[i].opacity,
visible: json.layers[i].visible,
+ properties: {},
indexes: [],
-
- tileMargin: json.tilesets[0].margin,
- tileSpacing: json.tilesets[0].spacing
+ callbacks: []
};
- var output = [];
- var c = 0;
- var row;
-
- for (var t = 0; t < json.layers[i].data.length; t++)
+ if (json.layers[i].properties)
{
- if (c === 0)
+ layer.properties = json.layers[i].properties;
+ }
+
+ var x = 0;
+ var row = [];
+ var output = [];
+
+ // Loop through the data field in the JSON.
+
+ // This is an array containing the tile indexes, one after the other. 0 = no tile, everything else = the tile index (starting at 1)
+ // If the map contains multiple tilesets then the indexes are relative to that which the set starts from.
+ // Need to set which tileset in the cache = which tileset in the JSON, if you do this manually it means you can use the same map data but a new tileset.
+
+ for (var t = 0, len = json.layers[i].data.length; t < len; t++)
+ {
+ // index, x, y, width, height
+ if (json.layers[i].data[t] > 0)
{
- row = [];
+ row.push(new Phaser.Tile(layer, json.layers[i].data[t], x, output.length, json.tilewidth, json.tileheight));
+ }
+ else
+ {
+ row.push(null);
}
- row.push(json.layers[i].data[t]);
- c++;
+ x++;
- if (c == json.layers[i].width)
+ if (x === json.layers[i].width)
{
output.push(row);
- c = 0;
+ x = 0;
+ row = [];
}
}
layer.data = output;
-
+
layers.push(layer);
}
- return layers;
+ map.layers = layers;
+
+ // Images
+ var images = [];
+
+ for (var i = 0; i < json.layers.length; i++)
+ {
+ if (json.layers[i].type !== 'imagelayer')
+ {
+ continue;
+ }
+
+ var image = {
+
+ name: json.layers[i].name,
+ image: json.layers[i].image,
+ x: json.layers[i].x,
+ y: json.layers[i].y,
+ alpha: json.layers[i].opacity,
+ visible: json.layers[i].visible,
+ properties: {}
+
+ };
+
+ if (json.layers[i].properties)
+ {
+ image.properties = json.layers[i].properties;
+ }
+
+ images.push(image);
+
+ }
+
+ map.images = images;
+
+ // Objects
+ var objects = {};
+
+ for (var i = 0; i < json.layers.length; i++)
+ {
+ if (json.layers[i].type !== 'objectgroup')
+ {
+ continue;
+ }
+
+ objects[json.layers[i].name] = [];
+
+ for (var v = 0, len = json.layers[i].objects.length; v < len; v++)
+ {
+ // For now we'll just support object tiles
+ if (json.layers[i].objects[v].gid)
+ {
+ var object = {
+
+ gid: json.layers[i].objects[v].gid,
+ name: json.layers[i].objects[v].name,
+ x: json.layers[i].objects[v].x,
+ y: json.layers[i].objects[v].y,
+ visible: json.layers[i].objects[v].visible,
+ properties: json.layers[i].objects[v].properties
+
+ };
+
+ objects[json.layers[i].name].push(object);
+ }
+
+ }
+ }
+
+ map.objects = objects;
+
+ // Tilesets
+ var tilesets = [];
+
+ for (var i = 0; i < json.tilesets.length; i++)
+ {
+ // name, firstgid, width, height, margin, spacing, properties
+ var set = json.tilesets[i];
+ var newSet = new Phaser.Tileset(set.name, set.firstgid, set.tilewidth, set.tileheight, set.margin, set.spacing, set.properties);
+
+ if (set.tileproperties)
+ {
+ newSet.tileProperties = set.tileproperties;
+ }
+
+ newSet.rows = (set.imageheight - set.margin) / (set.tileheight + set.spacing);
+ newSet.columns = (set.imagewidth - set.margin) / (set.tilewidth + set.spacing);
+ newSet.total = newSet.rows * newSet.columns;
+
+ tilesets.push(newSet);
+ }
+
+ map.tilesets = tilesets;
+
+ map.tiles = [];
+
+ // Finally lets build our super tileset index
+ for (var i = 0; i < map.tilesets.length; i++)
+ {
+ var set = map.tilesets[i];
+
+ var x = set.tileMargin;
+ var y = set.tileMargin;
+
+ var count = 0;
+ var countX = 0;
+ var countY = 0;
+
+ for (var t = set.firstgid; t < set.firstgid + set.total; t++)
+ {
+ // Can add extra properties here as needed
+ map.tiles[t] = [x, y, i];
+
+ x += set.tileWidth + set.tileSpacing;
+
+ count++;
+
+ if (count === set.total)
+ {
+ break;
+ }
+
+ countX++;
+
+ if (countX === set.columns)
+ {
+ x = set.tileMargin;
+ y += set.tileHeight + set.tileSpacing;
+
+ countX = 0;
+ countY++;
+
+ if (countY === set.rows)
+ {
+ break;
+ }
+ }
+ }
+
+ }
+
+ return map;
}
@@ -649,13 +808,13 @@ Phaser.TilemapParser = {
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:25 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Tileset.js.html b/docs/Tileset.js.html
index faf94c4d..56d573a1 100644
--- a/docs/Tileset.js.html
+++ b/docs/Tileset.js.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -423,97 +417,129 @@
/**
* @author Richard Davey <rich@photonstorm.com>
-* @copyright 2013 Photon Storm Ltd.
+* @copyright 2014 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
/**
* A Tile set is a combination of an image containing the tiles and collision data per tile.
+* You should not normally instantiate this class directly.
*
* @class Phaser.Tileset
* @constructor
-* @param {Image} image - The Image object from the Cache.
-* @param {string} key - The key of the tileset in the cache.
-* @param {number} tileWidth - The width of the tile in pixels.
-* @param {number} tileHeight - The height of the tile in pixels.
-* @param {number} [tileMargin] - The margin around the tiles in the sheet.
-* @param {number} [tileSpacing] - The spacing between the tiles in the sheet.
+* @param {string} name - The name of the tileset in the map data.
+* @param {number} firstgid - The Tiled firstgid value.
+* @param {number} width - Width of each tile in pixels.
+* @param {number} height - Height of each tile in pixels.
+* @param {number} margin - The amount of margin around the tilesheet.
+* @param {number} spacing - The amount of spacing between each tile in the sheet.
+* @param {object} properties - Tileset properties.
*/
-Phaser.Tileset = function (image, key, tileWidth, tileHeight, tileMargin, tileSpacing) {
-
- if (typeof tileMargin === "undefined") { tileMargin = 0; }
- if (typeof tileSpacing === "undefined") { tileSpacing = 0; }
+Phaser.Tileset = function (name, firstgid, width, height, margin, spacing, properties) {
/**
- * @property {string} key - The cache ID.
+ * @property {string} name - The name of the Tileset.
*/
- this.key = key;
+ this.name = name;
/**
- * @property {object} image - The image used for rendering.
+ * @property {number} firstgid - The Tiled firstgid value.
+ * @default
*/
- this.image = image;
+ this.firstgid = firstgid;
/**
* @property {number} tileWidth - The width of a tile in pixels.
*/
- this.tileWidth = tileWidth;
+ this.tileWidth = width;
/**
* @property {number} tileHeight - The height of a tile in pixels.
*/
- this.tileHeight = tileHeight;
+ this.tileHeight = height;
/**
* @property {number} tileMargin - The margin around the tiles in the sheet.
*/
- this.margin = tileMargin;
+ this.tileMargin = margin;
/**
* @property {number} tileSpacing - The margin around the tiles in the sheet.
*/
- this.spacing = tileSpacing;
+ this.tileSpacing = spacing;
/**
- * @property {array} tiles - An array of the tile collision data.
+ * @property {object} properties - Tileset specific properties (typically defined in the Tiled editor).
*/
- this.tiles = [];
+ this.properties = properties;
-}
+ /**
+ * @property {object} tilePproperties - Tile specific properties (typically defined in the Tiled editor).
+ */
+ // this.tileProperties = {};
+
+ /**
+ * @property {object} image - The image used for rendering. This is a reference to the image stored in Phaser.Cache.
+ */
+ this.image = null;
+
+ /**
+ * @property {number} rows - The number of rows in the tile sheet.
+ */
+ this.rows = 0;
+
+ /**
+ * @property {number} columns - The number of columns in the tile sheet.
+ */
+ this.columns = 0;
+
+ /**
+ * @property {number} total - The total number of tiles in the tilesheet.
+ */
+ this.total = 0;
+
+};
Phaser.Tileset.prototype = {
- /**
- * Adds a Tile into this set.
- *
- * @method Phaser.Tileset#addTile
- * @param {Phaser.Tile} tile - The tile to add to this set.
- */
- addTile: function (tile) {
-
- this.tiles.push(tile);
-
- return tile;
-
- },
-
/**
* Gets a Tile from this set.
*
* @method Phaser.Tileset#getTile
* @param {number} index - The index of the tile within the set.
- * @return {Phaser.Tile} The tile.
- */
+ * @return {object} The tile object.
getTile: function (index) {
- if (this.tiles[index])
- {
- return this.tiles[index];
- }
-
- return null;
+ return this.tiles[index];
},
+ */
+
+ /**
+ * Gets a Tile from this set.
+ *
+ * @method Phaser.Tileset#getTileX
+ * @param {number} index - The index of the tile within the set.
+ * @return {object} The tile object.
+ getTileX: function (index) {
+
+ return this.tiles[index][0];
+
+ },
+ */
+
+ /**
+ * Gets a Tile from this set.
+ *
+ * @method Phaser.Tileset#getTileY
+ * @param {number} index - The index of the tile within the set.
+ * @return {object} The tile object.
+ getTileY: function (index) {
+
+ return this.tiles[index][1];
+
+ },
+ */
/**
* Sets tile spacing and margins.
@@ -529,93 +555,22 @@ Phaser.Tileset.prototype = {
},
- /**
- * Checks if the tile at the given index can collide.
- *
- * @method Phaser.Tileset#canCollide
- * @param {number} index - The index of the tile within the set.
- * @return {boolean} True or false depending on the tile collision or null if no tile was found at the given index.
- */
- canCollide: function (index) {
-
- if (this.tiles[index])
- {
- return this.tiles[index].collideNone;
- }
-
- return null;
-
- },
-
/**
* Checks if the tile at the given index exists.
*
* @method Phaser.Tileset#checkTileIndex
* @param {number} index - The index of the tile within the set.
* @return {boolean} True if a tile exists at the given index otherwise false.
- */
checkTileIndex: function (index) {
return (this.tiles[index]);
- },
-
- /**
- * Sets collision values on a range of tiles in the set.
- *
- * @method Phaser.Tileset#setCollisionRange
- * @param {number} start - The index to start setting the collision data on.
- * @param {number} stop - The index to stop setting the collision data on.
- * @param {boolean} left - Should the tile collide on the left?
- * @param {boolean} right - Should the tile collide on the right?
- * @param {boolean} up - Should the tile collide on the top?
- * @param {boolean} down - Should the tile collide on the bottom?
- */
- setCollisionRange: function (start, stop, left, right, up, down) {
-
- if (this.tiles[start] && this.tiles[stop] && start < stop)
- {
- for (var i = start; i <= stop; i++)
- {
- this.tiles[i].setCollision(left, right, up, down);
- }
- }
-
- },
-
- /**
- * Sets collision values on a tile in the set.
- *
- * @method Phaser.Tileset#setCollision
- * @param {number} index - The index of the tile within the set.
- * @param {boolean} left - Should the tile collide on the left?
- * @param {boolean} right - Should the tile collide on the right?
- * @param {boolean} up - Should the tile collide on the top?
- * @param {boolean} down - Should the tile collide on the bottom?
- */
- setCollision: function (index, left, right, up, down) {
-
- if (this.tiles[index])
- {
- this.tiles[index].setCollision(left, right, up, down);
- }
-
}
+ */
-}
+};
-/**
-* @name Phaser.Tileset#total
-* @property {number} total - The total number of tiles in this Tileset.
-* @readonly
-*/
-Object.defineProperty(Phaser.Tileset.prototype, "total", {
-
- get: function () {
- return this.tiles.length;
- }
-
-});
+Phaser.Tileset.prototype.constructor = Phaser.Tileset;
@@ -631,13 +586,13 @@ Object.defineProperty(Phaser.Tileset.prototype, "total", {
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:25 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Time.js.html b/docs/Time.js.html
index 07640993..91ac8c29 100644
--- a/docs/Time.js.html
+++ b/docs/Time.js.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -423,7 +417,7 @@
/**
* @author Richard Davey <rich@photonstorm.com>
-* @copyright 2013 Photon Storm Ltd.
+* @copyright 2014 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -437,228 +431,338 @@
*/
Phaser.Time = function (game) {
- /**
- * @property {Phaser.Game} game - Local reference to game.
- */
- this.game = game;
+ /**
+ * @property {Phaser.Game} game - Local reference to game.
+ */
+ this.game = game;
- /**
- * @property {number} _started - The time at which the Game instance started.
- * @private
- */
- this._started = 0;
+ /**
+ * @property {number} time - Game time counter. If you need a value for in-game calculation please use Phaser.Time.now instead.
+ * @protected
+ */
+ this.time = 0;
- /**
- * @property {number} _timeLastSecond - The time (in ms) that the last second counter ticked over.
- * @private
- */
- this._timeLastSecond = 0;
+ /**
+ * @property {number} now - The time right now.
+ * @protected
+ */
+ this.now = 0;
- /**
- * @property {number} _pauseStarted - The time the game started being paused.
- * @private
- */
- this._pauseStarted = 0;
+ /**
+ * @property {number} elapsed - Elapsed time since the last frame (in ms).
+ * @protected
+ */
+ this.elapsed = 0;
- /**
- * @property {number} physicsElapsed - The elapsed time calculated for the physics motion updates.
- */
- this.physicsElapsed = 0;
+ /**
+ * @property {number} pausedTime - Records how long the game has been paused for. Is reset each time the game pauses.
+ * @protected
+ */
+ this.pausedTime = 0;
- /**
- * @property {number} time - Game time counter.
- */
- this.time = 0;
+ /**
+ * @property {number} fps - Frames per second.
+ * @protected
+ */
+ this.fps = 0;
- /**
- * @property {number} pausedTime - Records how long the game has been paused for. Is reset each time the game pauses.
- */
- this.pausedTime = 0;
+ /**
+ * @property {number} fpsMin - The lowest rate the fps has dropped to.
+ */
+ this.fpsMin = 1000;
- /**
- * @property {number} now - The time right now.
- */
- this.now = 0;
+ /**
+ * @property {number} fpsMax - The highest rate the fps has reached (usually no higher than 60fps).
+ */
+ this.fpsMax = 0;
- /**
- * @property {number} elapsed - Elapsed time since the last frame.
- */
- this.elapsed = 0;
+ /**
+ * @property {number} msMin - The minimum amount of time the game has taken between two frames.
+ * @default
+ */
+ this.msMin = 1000;
- /**
- * @property {number} fps - Frames per second.
- */
- this.fps = 0;
+ /**
+ * @property {number} msMax - The maximum amount of time the game has taken between two frames.
+ */
+ this.msMax = 0;
- /**
- * @property {number} fpsMin - The lowest rate the fps has dropped to.
- */
- this.fpsMin = 1000;
+ /**
+ * @property {number} physicsElapsed - The elapsed time calculated for the physics motion updates.
+ */
+ this.physicsElapsed = 0;
- /**
- * @property {number} fpsMax - The highest rate the fps has reached (usually no higher than 60fps).
- */
- this.fpsMax = 0;
+ /**
+ * @property {number} frames - The number of frames record in the last second.
+ */
+ this.frames = 0;
- /**
- * @property {number} msMin - The minimum amount of time the game has taken between two frames.
- * @default
- */
- this.msMin = 1000;
+ /**
+ * @property {number} pauseDuration - Records how long the game was paused for in miliseconds.
+ */
+ this.pauseDuration = 0;
- /**
- * @property {number} msMax - The maximum amount of time the game has taken between two frames.
- */
- this.msMax = 0;
+ /**
+ * @property {number} timeToCall - The value that setTimeout needs to work out when to next update
+ */
+ this.timeToCall = 0;
- /**
- * @property {number} frames - The number of frames record in the last second.
- */
- this.frames = 0;
+ /**
+ * @property {number} lastTime - Internal value used by timeToCall as part of the setTimeout loop
+ */
+ this.lastTime = 0;
- /**
- * @property {number} pauseDuration - Records how long the game was paused for in miliseconds.
- */
- this.pauseDuration = 0;
+ /**
+ * @property {Phaser.Timer} events - This is a Phaser.Timer object bound to the master clock to which you can add timed events.
+ */
+ this.events = new Phaser.Timer(this.game, false);
- /**
- * @property {number} timeToCall - The value that setTimeout needs to work out when to next update
- */
- this.timeToCall = 0;
-
- /**
- * @property {number} lastTime - Internal value used by timeToCall as part of the setTimeout loop
- */
- this.lastTime = 0;
-
- // Listen for game pause/resume events
- this.game.onPause.add(this.gamePaused, this);
- this.game.onResume.add(this.gameResumed, this);
-
- /**
- * @property {boolean} _justResumed - Internal value used to recover from the game pause state.
+ /**
+ * @property {number} _started - The time at which the Game instance started.
* @private
- */
- this._justResumed = false;
+ */
+ this._started = 0;
+
+ /**
+ * @property {number} _timeLastSecond - The time (in ms) that the last second counter ticked over.
+ * @private
+ */
+ this._timeLastSecond = 0;
+
+ /**
+ * @property {number} _pauseStarted - The time the game started being paused.
+ * @private
+ */
+ this._pauseStarted = 0;
+
+ /**
+ * @property {boolean} _justResumed - Internal value used to recover from the game pause state.
+ * @private
+ */
+ this._justResumed = false;
+
+ /**
+ * @property {array} _timers - Internal store of Phaser.Timer objects.
+ * @private
+ */
+ this._timers = [];
+
+ /**
+ * @property {number} _len - Temp. array length variable.
+ * @private
+ */
+ this._len = 0;
+
+ /**
+ * @property {number} _i - Temp. array counter variable.
+ * @private
+ */
+ this._i = 0;
+
+ // Listen for game pause/resume events
+ this.game.onPause.add(this.gamePaused, this);
+ this.game.onResume.add(this.gameResumed, this);
};
Phaser.Time.prototype = {
- /**
- * Updates the game clock and calculate the fps. This is called automatically by Phaser.Game.
- * @method Phaser.Time#update
- * @param {number} time - The current timestamp, either performance.now or Date.now depending on the browser.
- */
- update: function (time) {
+ /**
+ * @method Phaser.Time#boot
+ */
+ boot: function () {
- this.now = time;
+ this.events.start();
- if (this._justResumed)
- {
- this.time = this.now;
- this._justResumed = false;
- }
+ },
- this.timeToCall = this.game.math.max(0, 16 - (time - this.lastTime));
+ /**
+ * Creates a new stand-alone Phaser.Timer object.
+ * @method Phaser.Time#create
+ * @param {boolean} [autoDestroy=true] - A Timer that is set to automatically destroy itself will do so after all of its events have been dispatched (assuming no looping events).
+ * @return {Phaser.Timer} The Timer object that was created.
+ */
+ create: function (autoDestroy) {
- this.elapsed = this.now - this.time;
+ if (typeof autoDestroy === 'undefined') { autoDestroy = true; }
- this.msMin = this.game.math.min(this.msMin, this.elapsed);
- this.msMax = this.game.math.max(this.msMax, this.elapsed);
+ var timer = new Phaser.Timer(this.game, autoDestroy);
- this.frames++;
+ this._timers.push(timer);
- if (this.now > this._timeLastSecond + 1000)
- {
- this.fps = Math.round((this.frames * 1000) / (this.now - this._timeLastSecond));
- this.fpsMin = this.game.math.min(this.fpsMin, this.fps);
- this.fpsMax = this.game.math.max(this.fpsMax, this.fps);
- this._timeLastSecond = this.now;
- this.frames = 0;
- }
+ return timer;
- this.time = this.now;
+ },
+
+ /**
+ * Remove all Timer objects, regardless of their state.
+ * @method Phaser.Time#removeAll
+ */
+ removeAll: function () {
+
+ for (var i = 0; i < this._timers.length; i++)
+ {
+ this._timers[i].destroy();
+ }
+
+ this._timers = [];
+
+ },
+
+ /**
+ * Updates the game clock and calculate the fps. This is called automatically by Phaser.Game.
+ * @method Phaser.Time#update
+ * @param {number} time - The current timestamp, either performance.now or Date.now depending on the browser.
+ */
+ update: function (time) {
+
+ this.now = time;
+
+ if (this._justResumed)
+ {
+ this.time = this.now;
+ this._justResumed = false;
+
+ this.events.resume();
+
+ for (var i = 0; i < this._timers.length; i++)
+ {
+ this._timers[i].resume();
+ }
+ }
+
+ this.timeToCall = this.game.math.max(0, 16 - (time - this.lastTime));
+
+ this.elapsed = this.now - this.time;
+
+ this.msMin = this.game.math.min(this.msMin, this.elapsed);
+ this.msMax = this.game.math.max(this.msMax, this.elapsed);
+
+ this.frames++;
+
+ if (this.now > this._timeLastSecond + 1000)
+ {
+ this.fps = Math.round((this.frames * 1000) / (this.now - this._timeLastSecond));
+ this.fpsMin = this.game.math.min(this.fpsMin, this.fps);
+ this.fpsMax = this.game.math.max(this.fpsMax, this.fps);
+ this._timeLastSecond = this.now;
+ this.frames = 0;
+ }
+
+ this.time = this.now;
this.lastTime = time + this.timeToCall;
- this.physicsElapsed = 1.0 * (this.elapsed / 1000);
+ this.physicsElapsed = 1.0 * (this.elapsed / 1000);
- // Clamp the delta
- if (this.physicsElapsed > 1)
- {
- this.physicsElapsed = 1;
- }
+ // Clamp the delta
+ if (this.physicsElapsed > 0.05)
+ {
+ this.physicsElapsed = 0.05;
+ }
- // Paused?
- if (this.game.paused)
- {
- this.pausedTime = this.now - this._pauseStarted;
- }
+ // Paused?
+ if (this.game.paused)
+ {
+ this.pausedTime = this.now - this._pauseStarted;
+ }
+ else
+ {
+ // Our internal Phaser.Timer
+ this.events.update(this.now);
- },
+ // Any game level timers
+ this._i = 0;
+ this._len = this._timers.length;
- /**
- * Called when the game enters a paused state.
- * @method Phaser.Time#gamePaused
- * @private
- */
- gamePaused: function () {
-
- this._pauseStarted = this.now;
+ while (this._i < this._len)
+ {
+ if (this._timers[this._i].update(this.now))
+ {
+ this._i++;
+ }
+ else
+ {
+ this._timers.splice(this._i, 1);
- },
+ this._len--;
+ }
+ }
+ }
- /**
- * Called when the game resumes from a paused state.
- * @method Phaser.Time#gameResumed
- * @private
- */
- gameResumed: function () {
+ },
- // Level out the elapsed timer to avoid spikes
- this.time = Date.now();
- this.pauseDuration = this.pausedTime;
- this._justResumed = true;
+ /**
+ * Called when the game enters a paused state.
+ * @method Phaser.Time#gamePaused
+ * @private
+ */
+ gamePaused: function () {
+
+ this._pauseStarted = this.now;
- },
+ this.events.pause();
- /**
- * The number of seconds that have elapsed since the game was started.
- * @method Phaser.Time#totalElapsedSeconds
- * @return {number}
- */
- totalElapsedSeconds: function() {
- return (this.now - this._started) * 0.001;
- },
+ for (var i = 0; i < this._timers.length; i++)
+ {
+ this._timers[i].pause();
+ }
- /**
- * How long has passed since the given time.
- * @method Phaser.Time#elapsedSince
- * @param {number} since - The time you want to measure against.
- * @return {number} The difference between the given time and now.
- */
- elapsedSince: function (since) {
- return this.now - since;
- },
+ },
- /**
- * How long has passed since the given time (in seconds).
- * @method Phaser.Time#elapsedSecondsSince
- * @param {number} since - The time you want to measure (in seconds).
- * @return {number} Duration between given time and now (in seconds).
- */
- elapsedSecondsSince: function (since) {
- return (this.now - since) * 0.001;
- },
+ /**
+ * Called when the game resumes from a paused state.
+ * @method Phaser.Time#gameResumed
+ * @private
+ */
+ gameResumed: function () {
- /**
- * Resets the private _started value to now.
- * @method Phaser.Time#reset
- */
- reset: function () {
- this._started = this.now;
- }
+ // Level out the elapsed timer to avoid spikes
+ this.time = Date.now();
+ this.pauseDuration = this.pausedTime;
+ this._justResumed = true;
-};
+ },
+
+ /**
+ * The number of seconds that have elapsed since the game was started.
+ * @method Phaser.Time#totalElapsedSeconds
+ * @return {number}
+ */
+ totalElapsedSeconds: function() {
+ return (this.now - this._started) * 0.001;
+ },
+
+ /**
+ * How long has passed since the given time.
+ * @method Phaser.Time#elapsedSince
+ * @param {number} since - The time you want to measure against.
+ * @return {number} The difference between the given time and now.
+ */
+ elapsedSince: function (since) {
+ return this.now - since;
+ },
+
+ /**
+ * How long has passed since the given time (in seconds).
+ * @method Phaser.Time#elapsedSecondsSince
+ * @param {number} since - The time you want to measure (in seconds).
+ * @return {number} Duration between given time and now (in seconds).
+ */
+ elapsedSecondsSince: function (since) {
+ return (this.now - since) * 0.001;
+ },
+
+ /**
+ * Resets the private _started value to now.
+ * @method Phaser.Time#reset
+ */
+ reset: function () {
+ this._started = this.now;
+ }
+
+};
+
+Phaser.Time.prototype.constructor = Phaser.Time;
+
@@ -673,13 +777,13 @@ Phaser.Time.prototype = {
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:25 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Timer.js.html b/docs/Timer.js.html
index b61fefbe..fd8151d7 100644
--- a/docs/Timer.js.html
+++ b/docs/Timer.js.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -423,19 +417,24 @@
/**
* @author Richard Davey <rich@photonstorm.com>
-* @copyright 2013 Photon Storm Ltd.
+* @copyright 2014 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
/**
-* Timer constructor.
+* A Timer is a way to create small re-usable or disposable objects that do nothing but wait for a specific moment in time, and then dispatch an event.
+* You can add as many events to a Timer as you like, each with their own delays. A Timer uses milliseconds as its unit of time. There are 1000 ms in 1 second.
+* So if you want to fire an event every quarter of a second you'd need to set the delay to 250.
*
* @class Phaser.Timer
-* @classdesc A Timer
+* @classdesc A Timer is a way to create small re-usable or disposable objects that do nothing but wait for a specific moment in time, and then dispatch an event.
* @constructor
* @param {Phaser.Game} game A reference to the currently running game.
+* @param {boolean} [autoDestroy=true] - A Timer that is set to automatically destroy itself will do so after all of its events have been dispatched (assuming no looping events).
*/
-Phaser.Timer = function (game) {
+Phaser.Timer = function (game, autoDestroy) {
+
+ if (typeof autoDestroy === 'undefined') { autoDestroy = true; }
/**
* @property {Phaser.Game} game - Local reference to game.
@@ -443,67 +442,208 @@ Phaser.Timer = function (game) {
this.game = game;
/**
- * The time at which this Timer instance started.
- * @property {number} _started
+ * @property {boolean} running - True if the Timer is actively running. Do not switch this boolean, if you wish to pause the timer then use Timer.pause() instead.
+ * @default
+ */
+ this.running = false;
+
+ /**
+ * @property {boolean} autoDestroy - A Timer that is set to automatically destroy itself will do so after all of its events have been dispatched (assuming no looping events).
+ */
+ this.autoDestroy = autoDestroy;
+
+ /**
+ * @property {boolean} expired - An expired Timer is one in which all of its events have been dispatched and none are pending.
+ * @readonly
+ * @default
+ */
+ this.expired = false;
+
+ /**
+ * @property {array<Phaser.TimerEvent>} events - An array holding all of this timers Phaser.TimerEvent objects. Use the methods add, repeat and loop to populate it.
+ */
+ this.events = [];
+
+ /**
+ * @property {Phaser.Signal} onComplete - This signal will be dispatched when this Timer has completed, meaning there are no more events in the queue.
+ */
+ this.onComplete = new Phaser.Signal();
+
+ /**
+ * @property {number} nextTick - The time the next tick will occur.
+ * @readonly
+ * @protected
+ */
+ this.nextTick = 0;
+
+ /**
+ * @property {boolean} paused - The paused state of the Timer. You can pause the timer by calling Timer.pause() and Timer.resume() or by the game pausing.
+ * @readonly
+ * @default
+ */
+ this.paused = false;
+
+ /**
+ * @property {number} _started - The time at which this Timer instance started running.
* @private
* @default
*/
this._started = 0;
/**
- * The time (in ms) that the last second counter ticked over.
- * @property {number} _timeLastSecond
+ * @property {number} _pauseStarted - The time the game started being paused.
* @private
- * @default
*/
- this._timeLastSecond = 0;
+ this._pauseStarted = 0;
- this.running = false;
+ /**
+ * @property {number} _now - The current start-time adjusted time.
+ * @private
+ */
+ this._now = 0;
- this.events = [];
+ /**
+ * @property {number} _len - Temp. array length variable.
+ * @private
+ */
+ this._len = 0;
- this.onEvent = new Phaser.Signal();
+ /**
+ * @property {number} _i - Temp. array counter variable.
+ * @private
+ */
+ this._i = 0;
- // Need to add custom FPS rate, for now we'll just use seconds
+};
-}
+/**
+* @constant
+* @type {number}
+*/
+Phaser.Timer.MINUTE = 60000;
+
+/**
+* @constant
+* @type {number}
+*/
+Phaser.Timer.SECOND = 1000;
+
+/**
+* @constant
+* @type {number}
+*/
+Phaser.Timer.HALF = 500;
+
+/**
+* @constant
+* @type {number}
+*/
+Phaser.Timer.QUARTER = 250;
Phaser.Timer.prototype = {
- // delay could be from now, when the timer is created, or relative to an already running timer
+ /**
+ * Creates a new TimerEvent on this Timer. Use the methods add, repeat or loop instead of this.
+ * @method Phaser.Timer#create
+ * @private
+ * @param {number} delay - The number of milliseconds that should elapse before the Timer will call the given callback.
+ * @param {boolean} loop - Should the event loop or not?
+ * @param {number} repeatCount - The number of times the event will repeat.
+ * @param {function} callback - The callback that will be called when the Timer event occurs.
+ * @param {object} callbackContext - The context in which the callback will be called.
+ * @param {array} arguments - The values to be sent to your callback function when it is called.
+ * @return {Phaser.TimerEvent} The Phaser.TimerEvent object that was created.
+ */
+ create: function (delay, loop, repeatCount, callback, callbackContext, args) {
- // add: function (delay, callback, callbackContext) {
- add: function (delay) {
+ var tick = delay;
- this.events.push({
- delay: delay,
- dispatched: false,
- args: Array.prototype.splice.call(arguments, 1)
- });
+ if (this.running)
+ {
+ tick += this._now;
+ }
- // this.events.push({
- // delay: delay,
- // dispatched: false,
- // callback: callback,
- // callbackContext: callbackContext,
- // args: Array.prototype.splice.call(arguments, 3)
- // });
+ var event = new Phaser.TimerEvent(this, delay, tick, repeatCount, loop, callback, callbackContext, args);
+
+ this.events.push(event);
+
+ this.order();
+
+ this.expired = false;
+
+ return event;
},
+ /**
+ * Adds a new Event to this Timer. The event will fire after the given amount of 'delay' in milliseconds has passed, once the Timer has started running.
+ * Call Timer.start() once you have added all of the Events you require for this Timer. The delay is in relation to when the Timer starts, not the time it was added.
+ * If the Timer is already running the delay will be calculated based on the timers current time.
+ * @method Phaser.Timer#add
+ * @param {number} delay - The number of milliseconds that should elapse before the Timer will call the given callback.
+ * @param {function} callback - The callback that will be called when the Timer event occurs.
+ * @param {object} callbackContext - The context in which the callback will be called.
+ * @param {...*} arguments - The values to be sent to your callback function when it is called.
+ * @return {Phaser.TimerEvent} The Phaser.TimerEvent object that was created.
+ */
+ add: function (delay, callback, callbackContext) {
+
+ return this.create(delay, false, 0, callback, callbackContext, Array.prototype.splice.call(arguments, 3));
+
+ },
+
+ /**
+ * Adds a new Event to this Timer that will repeat for the given number of iterations.
+ * The event will fire after the given amount of 'delay' milliseconds has passed once the Timer has started running.
+ * Call Timer.start() once you have added all of the Events you require for this Timer. The delay is in relation to when the Timer starts, not the time it was added.
+ * If the Timer is already running the delay will be calculated based on the timers current time.
+ * @method Phaser.Timer#repeat
+ * @param {number} delay - The number of milliseconds that should elapse before the Timer will call the given callback.
+ * @param {number} repeatCount - The number of times the event will repeat.
+ * @param {function} callback - The callback that will be called when the Timer event occurs.
+ * @param {object} callbackContext - The context in which the callback will be called.
+ * @param {...*} arguments - The values to be sent to your callback function when it is called.
+ * @return {Phaser.TimerEvent} The Phaser.TimerEvent object that was created.
+ */
+ repeat: function (delay, repeatCount, callback, callbackContext) {
+
+ return this.create(delay, false, repeatCount, callback, callbackContext, Array.prototype.splice.call(arguments, 4));
+
+ },
+
+ /**
+ * Adds a new looped Event to this Timer that will repeat forever or until the Timer is stopped.
+ * The event will fire after the given amount of 'delay' milliseconds has passed once the Timer has started running.
+ * Call Timer.start() once you have added all of the Events you require for this Timer. The delay is in relation to when the Timer starts, not the time it was added.
+ * If the Timer is already running the delay will be calculated based on the timers current time.
+ * @method Phaser.Timer#loop
+ * @param {number} delay - The number of milliseconds that should elapse before the Timer will call the given callback.
+ * @param {function} callback - The callback that will be called when the Timer event occurs.
+ * @param {object} callbackContext - The context in which the callback will be called.
+ * @param {...*} arguments - The values to be sent to your callback function when it is called.
+ * @return {Phaser.TimerEvent} The Phaser.TimerEvent object that was created.
+ */
+ loop: function (delay, callback, callbackContext) {
+
+ return this.create(delay, true, 0, callback, callbackContext, Array.prototype.splice.call(arguments, 3));
+
+ },
+
+ /**
+ * Starts this Timer running.
+ * @method Phaser.Timer#start
+ */
start: function() {
this._started = this.game.time.now;
this.running = true;
- // sort the events based on delay here, also don't run unless events is populated
- // add ability to auto-stop once all events are done
- // add support for maximum duration
- // add support for delay before starting
- // add signals?
-
},
+ /**
+ * Stops this Timer from running. Does not cause it to be destroyed if autoDestroy is set to true.
+ * @method Phaser.Timer#stop
+ */
stop: function() {
this.running = false;
@@ -511,33 +651,258 @@ Phaser.Timer.prototype = {
},
- update: function() {
+ /**
+ * Removes a pending TimerEvent from the queue.
+ * @param {Phaser.TimerEvent} event - The event to remove from the queue.
+ * @method Phaser.Timer#remove
+ */
+ remove: function(event) {
- // TODO: Game Paused support
-
- if (this.running)
+ for (var i = 0; i < this.events.length; i++)
{
- var seconds = this.seconds();
-
- for (var i = 0, len = this.events.length; i < len; i++)
+ if (this.events[i] === event)
{
- if (this.events[i].dispatched === false && seconds >= this.events[i].delay)
- {
- this.events[i].dispatched = true;
- // this.events[i].callback.apply(this.events[i].callbackContext, this.events[i].args);
- this.onEvent.dispatch.apply(this, this.events[i].args);
- // ought to slice it now
- }
+ this.events.splice(i, 1);
+ return true;
}
}
+ return false;
+
+ },
+
+ /**
+ * Orders the events on this Timer so they are in tick order. This is called automatically when new events are created.
+ * @method Phaser.Timer#order
+ */
+ order: function () {
+
+ if (this.events.length > 0)
+ {
+ // Sort the events so the one with the lowest tick is first
+ this.events.sort(this.sortHandler);
+
+ this.nextTick = this.events[0].tick;
+ }
+
},
- seconds: function() {
- return (this.game.time.now - this._started) * 0.001;
+ /**
+ * Sort handler used by Phaser.Timer.order.
+ * @method Phaser.Timer#sortHandler
+ * @protected
+ */
+ sortHandler: function (a, b) {
+
+ if (a.tick < b.tick)
+ {
+ return -1;
+ }
+ else if (a.tick > b.tick)
+ {
+ return 1;
+ }
+
+ return 0;
+
+ },
+
+ /**
+ * The main Timer update event, called automatically by the Game clock.
+ * @method Phaser.Timer#update
+ * @protected
+ * @param {number} time - The time from the core game clock.
+ * @return {boolean} True if there are still events waiting to be dispatched, otherwise false if this Timer can be destroyed.
+ */
+ update: function(time) {
+
+ if (this.paused)
+ {
+ return true;
+ }
+
+ this._now = time - this._started;
+
+ this._len = this.events.length;
+
+ if (this.running && this._now >= this.nextTick && this._len > 0)
+ {
+ this._i = 0;
+
+ while (this._i < this._len)
+ {
+ if (this._now >= this.events[this._i].tick)
+ {
+ if (this.events[this._i].loop === true)
+ {
+ this.events[this._i].tick += this.events[this._i].delay - (this._now - this.events[this._i].tick);
+ this.events[this._i].callback.apply(this.events[this._i].callbackContext, this.events[this._i].args);
+ }
+ else if (this.events[this._i].repeatCount > 0)
+ {
+ this.events[this._i].repeatCount--;
+ this.events[this._i].tick += this.events[this._i].delay - (this._now - this.events[this._i].tick);
+ this.events[this._i].callback.apply(this.events[this._i].callbackContext, this.events[this._i].args);
+ }
+ else
+ {
+ this.events[this._i].callback.apply(this.events[this._i].callbackContext, this.events[this._i].args);
+ this.events.splice(this._i, 1);
+ this._len--;
+ }
+
+ this._i++;
+ }
+ else
+ {
+ break;
+ }
+ }
+
+ // Are there any events left?
+ if (this.events.length > 0)
+ {
+ this.order();
+ }
+ else
+ {
+ this.expired = true;
+ this.onComplete.dispatch(this);
+ }
+ }
+
+ if (this.expired && this.autoDestroy)
+ {
+ return false;
+ }
+ else
+ {
+ return true;
+ }
+
+ },
+
+ /**
+ * Pauses the Timer and all events in the queue.
+ * @method Phaser.Timer#pause
+ */
+ pause: function () {
+
+ this._pauseStarted = this.game.time.now;
+
+ this.paused = true;
+
+ },
+
+ /**
+ * Resumes the Timer and updates all pending events.
+ * @method Phaser.Timer#resume
+ */
+ resume: function () {
+
+ var pauseDuration = this.game.time.now - this._pauseStarted;
+
+ for (var i = 0; i < this.events.length; i++)
+ {
+ this.events[i].tick += pauseDuration;
+ }
+
+ this.nextTick += pauseDuration;
+
+ this.paused = false;
+
+ },
+
+ /**
+ * Destroys this Timer. Events are not dispatched.
+ * @method Phaser.Timer#destroy
+ */
+ destroy: function() {
+
+ this.onComplete.removeAll();
+ this.running = false;
+ this.events = [];
+
}
-}
+};
+
+/**
+* @name Phaser.Timer#next
+* @property {number} next - The time at which the next event will occur.
+* @readonly
+*/
+Object.defineProperty(Phaser.Timer.prototype, "next", {
+
+ get: function () {
+ return this.nextTick;
+ }
+
+});
+
+/**
+* @name Phaser.Timer#duration
+* @property {number} duration - The duration in ms remaining until the next event will occur.
+* @readonly
+*/
+Object.defineProperty(Phaser.Timer.prototype, "duration", {
+
+ get: function () {
+
+ if (this.running && this.nextTick > this._now)
+ {
+ return this.nextTick - this._now;
+ }
+ else
+ {
+ return 0;
+ }
+
+ }
+
+});
+
+/**
+* @name Phaser.Timer#length
+* @property {number} length - The number of pending events in the queue.
+* @readonly
+*/
+Object.defineProperty(Phaser.Timer.prototype, "length", {
+
+ get: function () {
+ return this.events.length;
+ }
+
+});
+
+/**
+* @name Phaser.Timer#ms
+* @property {number} ms - The duration in milliseconds that this Timer has been running for.
+* @readonly
+*/
+Object.defineProperty(Phaser.Timer.prototype, "ms", {
+
+ get: function () {
+ return this._now;
+ }
+
+});
+
+/**
+* @name Phaser.Timer#seconds
+* @property {number} seconds - The duration in seconds that this Timer has been running for.
+* @readonly
+*/
+Object.defineProperty(Phaser.Timer.prototype, "seconds", {
+
+ get: function () {
+ return this._now * 0.001;
+ }
+
+});
+
+Phaser.Timer.prototype.constructor = Phaser.Timer;
+
@@ -552,13 +917,13 @@ Phaser.Timer.prototype = {
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:25 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/TimerEvent.js.html b/docs/TimerEvent.js.html
new file mode 100644
index 00000000..d0a9f1e5
--- /dev/null
+++ b/docs/TimerEvent.js.html
@@ -0,0 +1,546 @@
+
+
+
+
+
+ Phaser Source: time/TimerEvent.js
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Source: time/TimerEvent.js
+
+
+
+ /**
+* @author Richard Davey <rich@photonstorm.com>
+* @copyright 2014 Photon Storm Ltd.
+* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+*/
+
+/**
+* A TimerEvent is a single event that is processed by a Phaser.Timer. It consists of a delay, which is a value in milliseconds after which the event will fire.
+* It can call a specific callback, passing in optional parameters.
+*
+* @class Phaser.TimerEvent
+* @classdesc A TimerEvent is a single event that is processed by a Phaser.Timer. It consists of a delay, which is a value in milliseconds after which the event will fire.
+* @constructor
+* @param {Phaser.Timer} timer - The Timer object that this TimerEvent belongs to.
+* @param {number} delay - The delay in ms at which this TimerEvent fires.
+* @param {number} tick - The tick is the next game clock time that this event will fire at.
+* @param {number} repeatCount - If this TimerEvent repeats it will do so this many times.
+* @param {boolean} loop - True if this TimerEvent loops, otherwise false.
+* @param {function} callback - The callback that will be called when the TimerEvent occurs.
+* @param {object} callbackContext - The context in which the callback will be called.
+* @param {array} arguments - The values to be passed to the callback.
+*/
+Phaser.TimerEvent = function (timer, delay, tick, repeatCount, loop, callback, callbackContext, args) {
+
+ /**
+ * @property {Phaser.Timer} timer - The Timer object that this TimerEvent belongs to.
+ */
+ this.timer = timer;
+
+ /**
+ * @property {number} delay - The delay in ms at which this TimerEvent fires.
+ */
+ this.delay = delay;
+
+ /**
+ * @property {number} tick - The tick is the next game clock time that this event will fire at.
+ */
+ this.tick = tick;
+
+ /**
+ * @property {number} repeatCount - If this TimerEvent repeats it will do so this many times.
+ */
+ this.repeatCount = repeatCount - 1;
+
+ /**
+ * @property {boolean} loop - True if this TimerEvent loops, otherwise false.
+ */
+ this.loop = loop;
+
+ /**
+ * @property {function} callback - The callback that will be called when the TimerEvent occurs.
+ */
+ this.callback = callback;
+
+ /**
+ * @property {object} callbackContext - The context in which the callback will be called.
+ */
+ this.callbackContext = callbackContext;
+
+ /**
+ * @property {array} arguments - The values to be passed to the callback.
+ */
+ this.args = args;
+
+};
+
+Phaser.TimerEvent.prototype.constructor = Phaser.TimerEvent;
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
+
+
+
+
+ Documentation generated by JSDoc 3.3.0-dev
+ on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template .
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/docs/Touch.js.html b/docs/Touch.js.html
index a03f5f91..3c6bfc6b 100644
--- a/docs/Touch.js.html
+++ b/docs/Touch.js.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -423,7 +417,7 @@
/**
* @author Richard Davey <rich@photonstorm.com>
-* @copyright 2013 Photon Storm Ltd.
+* @copyright 2014 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -490,7 +484,8 @@ Phaser.Touch = function (game) {
this.preventDefault = true;
/**
- * @property {TouchEvent} event - The browser touch event.
+ * @property {TouchEvent} event - The browser touch DOM event. Will be set to null if no touch event has ever been received.
+ * @default
*/
this.event = null;
@@ -691,13 +686,6 @@ Phaser.Touch.prototype = {
event.preventDefault();
}
- /*
- for (var i = 0; i < event.changedTouches.length; i++)
- {
- //console.log('touch enter');
- }
- */
-
},
/**
@@ -720,13 +708,6 @@ Phaser.Touch.prototype = {
event.preventDefault();
}
- /*
- for (var i = 0; i < event.changedTouches.length; i++)
- {
- //console.log('touch leave');
- }
- */
-
},
/**
@@ -802,7 +783,10 @@ Phaser.Touch.prototype = {
}
-};
+};
+
+Phaser.Touch.prototype.constructor = Phaser.Touch;
+
@@ -817,13 +801,13 @@ Phaser.Touch.prototype = {
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:25 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Tween.js.html b/docs/Tween.js.html
index 352a9b05..9b4e0de5 100644
--- a/docs/Tween.js.html
+++ b/docs/Tween.js.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -423,7 +417,7 @@
/**
* @author Richard Davey <rich@photonstorm.com>
-* @copyright 2013 Photon Storm Ltd.
+* @copyright 2014 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -451,119 +445,112 @@ Phaser.Tween = function (object, game) {
this.game = game;
/**
- * @property {object} _manager - Description.
+ * @property {Phaser.TweenManager} _manager - Reference to the TweenManager.
* @private
*/
this._manager = this.game.tweens;
/**
- * @property {object} _valuesStart - Description.
+ * @property {object} _valuesStart - Private value object.
* @private
*/
this._valuesStart = {};
/**
- * @property {object} _valuesEnd - Description.
+ * @property {object} _valuesEnd - Private value object.
* @private
*/
this._valuesEnd = {};
/**
- * @property {object} _valuesStartRepeat - Description.
+ * @property {object} _valuesStartRepeat - Private value object.
* @private
*/
this._valuesStartRepeat = {};
/**
- * @property {number} _duration - Description.
+ * @property {number} _duration - Private duration counter.
* @private
* @default
*/
this._duration = 1000;
/**
- * @property {number} _repeat - Description.
+ * @property {number} _repeat - Private repeat counter.
* @private
* @default
*/
this._repeat = 0;
/**
- * @property {boolean} _yoyo - Description.
+ * @property {boolean} _yoyo - Private yoyo flag.
* @private
* @default
*/
this._yoyo = false;
/**
- * @property {boolean} _reversed - Description.
+ * @property {boolean} _reversed - Private reversed flag.
* @private
* @default
*/
this._reversed = false;
/**
- * @property {number} _delayTime - Description.
+ * @property {number} _delayTime - Private delay counter.
* @private
* @default
*/
this._delayTime = 0;
/**
- * @property {Description} _startTime - Description.
+ * @property {number} _startTime - Private start time counter.
* @private
* @default null
*/
this._startTime = null;
/**
- * @property {Description} _easingFunction - Description.
+ * @property {function} _easingFunction - The easing function used for the tween.
* @private
*/
this._easingFunction = Phaser.Easing.Linear.None;
/**
- * @property {Description} _interpolationFunction - Description.
+ * @property {function} _interpolationFunction - The interpolation function used for the tween.
* @private
*/
this._interpolationFunction = Phaser.Math.linearInterpolation;
/**
- * @property {Description} _chainedTweens - Description.
+ * @property {array} _chainedTweens - A private array of chained tweens.
* @private
*/
this._chainedTweens = [];
/**
- * @property {Description} _onStartCallback - Description.
- * @private
- * @default
- */
- this._onStartCallback = null;
-
- /**
- * @property {boolean} _onStartCallbackFired - Description.
+ * @property {boolean} _onStartCallbackFired - Private flag.
* @private
* @default
*/
this._onStartCallbackFired = false;
/**
- * @property {Description} _onUpdateCallback - Description.
+ * @property {function} _onUpdateCallback - An onUpdate callback.
* @private
* @default null
*/
this._onUpdateCallback = null;
-
+
/**
- * @property {Description} _onCompleteCallback - Description.
+ * @property {object} _onUpdateCallbackContext - The context in which to call the onUpdate callback.
* @private
* @default null
*/
- this._onCompleteCallback = null;
-
+ this._onUpdateCallbackContext = null;
+
/**
- * @property {number} _pausedTime - Description.
+ * @property {number} _pausedTime - Private pause timer.
* @private
* @default
*/
@@ -576,22 +563,28 @@ Phaser.Tween = function (object, game) {
this.pendingDelete = false;
// Set all starting values present on the target object
- for ( var field in object ) {
- this._valuesStart[ field ] = parseFloat(object[field], 10);
+ for (var field in object)
+ {
+ this._valuesStart[field] = parseFloat(object[field], 10);
}
/**
- * @property {Phaser.Signal} onStart - Description.
+ * @property {Phaser.Signal} onStart - The onStart event is fired when the Tween begins.
*/
this.onStart = new Phaser.Signal();
/**
- * @property {Phaser.Signal} onComplete - Description.
+ * @property {Phaser.Signal} onLoop - The onLoop event is fired if the Tween loops.
+ */
+ this.onLoop = new Phaser.Signal();
+
+ /**
+ * @property {Phaser.Signal} onComplete - The onComplete event is fired when the Tween completes. Does not fire if the Tween is set to loop.
*/
this.onComplete = new Phaser.Signal();
/**
- * @property {boolean} isRunning - Description.
+ * @property {boolean} isRunning - If the tween is running this is set to true, otherwise false. Tweens that are in a delayed state, waiting to start, are considered as being running.
* @default
*/
this.isRunning = false;
@@ -605,15 +598,15 @@ Phaser.Tween.prototype = {
*
* @method Phaser.Tween#to
* @param {object} properties - Properties you want to tween.
- * @param {number} duration - Duration of this tween.
- * @param {function} ease - Easing function.
- * @param {boolean} autoStart - Whether this tween will start automatically or not.
- * @param {number} delay - Delay before this tween will start, defaults to 0 (no delay).
- * @param {boolean} repeat - Should the tween automatically restart once complete? (ignores any chained tweens).
- * @param {Phaser.Tween} yoyo - Description.
- * @return {Phaser.Tween} Itself.
+ * @param {number} [duration=1000] - Duration of this tween in ms.
+ * @param {function} [ease=null] - Easing function. If not set it will default to Phaser.Easing.Linear.None.
+ * @param {boolean} [autoStart=false] - Whether this tween will start automatically or not.
+ * @param {number} [delay=0] - Delay before this tween will start, defaults to 0 (no delay). Value given is in ms.
+ * @param {boolean} [repeat=0] - Should the tween automatically restart once complete? (ignores any chained tweens).
+ * @param {boolean} [yoyo=false] - A tween that yoyos will reverse itself when it completes.
+ * @return {Phaser.Tween} This Tween object.
*/
- to: function ( properties, duration, ease, autoStart, delay, repeat, yoyo ) {
+ to: function (properties, duration, ease, autoStart, delay, repeat, yoyo) {
duration = duration || 1000;
ease = ease || null;
@@ -623,6 +616,7 @@ Phaser.Tween.prototype = {
yoyo = yoyo || false;
var self;
+
if (this._parent)
{
self = this._manager.create(this._object);
@@ -652,9 +646,12 @@ Phaser.Tween.prototype = {
self._yoyo = yoyo;
- if (autoStart) {
+ if (autoStart)
+ {
return this.start();
- } else {
+ }
+ else
+ {
return this;
}
@@ -668,43 +665,41 @@ Phaser.Tween.prototype = {
*/
start: function () {
- if (this.game === null || this._object === null) {
+ if (this.game === null || this._object === null)
+ {
return;
}
this._manager.add(this);
- this.onStart.dispatch(this._object);
-
this.isRunning = true;
this._onStartCallbackFired = false;
this._startTime = this.game.time.now + this._delayTime;
- for ( var property in this._valuesEnd ) {
-
+ for (var property in this._valuesEnd)
+ {
// check if an Array was provided as property value
- if ( this._valuesEnd[ property ] instanceof Array ) {
-
- if ( this._valuesEnd[ property ].length === 0 ) {
-
+ if (this._valuesEnd[property] instanceof Array)
+ {
+ if (this._valuesEnd[property].length === 0)
+ {
continue;
-
}
// create a local copy of the Array with the start value at the front
- this._valuesEnd[ property ] = [ this._object[ property ] ].concat( this._valuesEnd[ property ] );
-
+ this._valuesEnd[property] = [this._object[property]].concat(this._valuesEnd[property]);
}
- this._valuesStart[ property ] = this._object[ property ];
+ this._valuesStart[property] = this._object[property];
- if ( ( this._valuesStart[ property ] instanceof Array ) === false ) {
- this._valuesStart[ property ] *= 1.0; // Ensures we're using numbers, not strings
+ if ((this._valuesStart[property] instanceof Array) === false)
+ {
+ this._valuesStart[property] *= 1.0; // Ensures we're using numbers, not strings
}
- this._valuesStartRepeat[ property ] = this._valuesStart[ property ] || 0;
+ this._valuesStartRepeat[property] = this._valuesStart[property] || 0;
}
@@ -722,6 +717,8 @@ Phaser.Tween.prototype = {
this.isRunning = false;
+ this._onUpdateCallback = null;
+
this._manager.remove(this);
return this;
@@ -735,7 +732,7 @@ Phaser.Tween.prototype = {
* @param {number} amount - The amount of the delay in ms.
* @return {Phaser.Tween} Itself.
*/
- delay: function ( amount ) {
+ delay: function (amount) {
this._delayTime = amount;
return this;
@@ -749,7 +746,7 @@ Phaser.Tween.prototype = {
* @param {number} times - How many times to repeat.
* @return {Phaser.Tween} Itself.
*/
- repeat: function ( times ) {
+ repeat: function (times) {
this._repeat = times;
return this;
@@ -764,7 +761,7 @@ Phaser.Tween.prototype = {
* @param {boolean} yoyo - Set to true to yoyo this tween.
* @return {Phaser.Tween} Itself.
*/
- yoyo: function( yoyo ) {
+ yoyo: function(yoyo) {
this._yoyo = yoyo;
return this;
@@ -778,7 +775,7 @@ Phaser.Tween.prototype = {
* @param {function} easing - The easing function this tween will use, i.e. Phaser.Easing.Linear.None.
* @return {Phaser.Tween} Itself.
*/
- easing: function ( easing ) {
+ easing: function (easing) {
this._easingFunction = easing;
return this;
@@ -787,12 +784,13 @@ Phaser.Tween.prototype = {
/**
* Set interpolation function the tween will use, by default it uses Phaser.Math.linearInterpolation.
+ * Also available: Phaser.Math.bezierInterpolation and Phaser.Math.catmullRomInterpolation.
*
* @method Phaser.Tween#interpolation
* @param {function} interpolation - The interpolation function to use (Phaser.Math.linearInterpolation by default)
* @return {Phaser.Tween} Itself.
*/
- interpolation: function ( interpolation ) {
+ interpolation: function (interpolation) {
this._interpolationFunction = interpolation;
return this;
@@ -832,20 +830,6 @@ Phaser.Tween.prototype = {
},
- /**
- * Sets a callback to be fired when the tween starts. Note: callback will be called in the context of the global scope.
- *
- * @method Phaser.Tween#onStartCallback
- * @param {function} callback - The callback to invoke on start.
- * @return {Phaser.Tween} Itself.
- */
- onStartCallback: function ( callback ) {
-
- this._onStartCallback = callback;
- return this;
-
- },
-
/**
* Sets a callback to be fired each time this tween updates. Note: callback will be called in the context of the global scope.
*
@@ -853,23 +837,11 @@ Phaser.Tween.prototype = {
* @param {function} callback - The callback to invoke each time this tween is updated.
* @return {Phaser.Tween} Itself.
*/
- onUpdateCallback: function ( callback ) {
+ onUpdateCallback: function (callback, callbackContext) {
this._onUpdateCallback = callback;
- return this;
+ this._onUpdateCallbackContext = callbackContext;
- },
-
- /**
- * Sets a callback to be fired when the tween completes. Note: callback will be called in the context of the global scope.
- *
- * @method Phaser.Tween#onCompleteCallback
- * @param {function} callback - The callback to invoke on completion.
- * @return {Phaser.Tween} Itself.
- */
- onCompleteCallback: function ( callback ) {
-
- this._onCompleteCallback = callback;
return this;
},
@@ -880,8 +852,10 @@ Phaser.Tween.prototype = {
* @method Phaser.Tween#pause
*/
pause: function () {
+
this._paused = true;
this._pausedTime = this.game.time.now;
+
},
/**
@@ -890,8 +864,10 @@ Phaser.Tween.prototype = {
* @method Phaser.Tween#resume
*/
resume: function () {
+
this._paused = false;
this._startTime += (this.game.time.now - this._pausedTime);
+
},
/**
@@ -901,127 +877,112 @@ Phaser.Tween.prototype = {
* @param {number} time - A timestamp passed in by the TweenManager.
* @return {boolean} false if the tween has completed and should be deleted from the manager, otherwise true (still active).
*/
- update: function ( time ) {
+ update: function (time) {
if (this.pendingDelete)
{
return false;
}
- if (this._paused || time < this._startTime) {
-
+ if (this._paused || time < this._startTime)
+ {
return true;
-
}
var property;
- if ( time < this._startTime ) {
-
+ if (time < this._startTime)
+ {
return true;
-
}
- if ( this._onStartCallbackFired === false ) {
-
- if ( this._onStartCallback !== null ) {
-
- this._onStartCallback.call( this._object );
-
- }
-
+ if (this._onStartCallbackFired === false)
+ {
+ this.onStart.dispatch(this._object);
this._onStartCallbackFired = true;
-
}
- var elapsed = ( time - this._startTime ) / this._duration;
+ var elapsed = (time - this._startTime) / this._duration;
elapsed = elapsed > 1 ? 1 : elapsed;
- var value = this._easingFunction( elapsed );
+ var value = this._easingFunction(elapsed);
- for ( property in this._valuesEnd ) {
-
- var start = this._valuesStart[ property ] || 0;
- var end = this._valuesEnd[ property ];
-
- if ( end instanceof Array ) {
-
- this._object[ property ] = this._interpolationFunction( end, value );
-
- } else {
+ for (property in this._valuesEnd)
+ {
+ var start = this._valuesStart[property] || 0;
+ var end = this._valuesEnd[property];
+ if (end instanceof Array)
+ {
+ this._object[property] = this._interpolationFunction(end, value);
+ }
+ else
+ {
// Parses relative end values with start as base (e.g.: +10, -3)
- if ( typeof(end) === "string" ) {
+ if (typeof(end) === 'string')
+ {
end = start + parseFloat(end, 10);
}
// protect against non numeric properties.
- if ( typeof(end) === "number" ) {
- this._object[ property ] = start + ( end - start ) * value;
+ if (typeof(end) === 'number')
+ {
+ this._object[property] = start + ( end - start ) * value;
}
-
}
-
}
- if ( this._onUpdateCallback !== null ) {
-
- this._onUpdateCallback.call( this._object, value );
-
+ if (this._onUpdateCallback !== null)
+ {
+ this._onUpdateCallback.call(this._onUpdateCallbackContext, this, value);
}
- if ( elapsed == 1 ) {
-
- if ( this._repeat > 0 ) {
-
- if ( isFinite( this._repeat ) ) {
+ if (elapsed == 1)
+ {
+ if (this._repeat > 0)
+ {
+ if (isFinite(this._repeat))
+ {
this._repeat--;
}
// reassign starting values, restart by making startTime = now
- for ( property in this._valuesStartRepeat ) {
-
- if ( typeof( this._valuesEnd[ property ] ) === "string" ) {
- this._valuesStartRepeat[ property ] = this._valuesStartRepeat[ property ] + parseFloat(this._valuesEnd[ property ], 10);
+ for (property in this._valuesStartRepeat)
+ {
+ if (typeof(this._valuesEnd[property]) === 'string')
+ {
+ this._valuesStartRepeat[property] = this._valuesStartRepeat[property] + parseFloat(this._valuesEnd[property], 10);
}
- if (this._yoyo) {
- var tmp = this._valuesStartRepeat[ property ];
- this._valuesStartRepeat[ property ] = this._valuesEnd[ property ];
- this._valuesEnd[ property ] = tmp;
+ if (this._yoyo)
+ {
+ var tmp = this._valuesStartRepeat[property];
+ this._valuesStartRepeat[property] = this._valuesEnd[property];
+ this._valuesEnd[property] = tmp;
this._reversed = !this._reversed;
}
- this._valuesStart[ property ] = this._valuesStartRepeat[ property ];
+ this._valuesStart[property] = this._valuesStartRepeat[property];
}
this._startTime = time + this._delayTime;
- this.onComplete.dispatch(this._object);
-
- if ( this._onCompleteCallback !== null ) {
- this._onCompleteCallback.call( this._object );
- }
+ this.onLoop.dispatch(this._object);
return true;
- } else {
-
+ }
+ else
+ {
this.isRunning = false;
this.onComplete.dispatch(this._object);
- if ( this._onCompleteCallback !== null ) {
- this._onCompleteCallback.call( this._object );
- }
-
- for ( var i = 0, numChainedTweens = this._chainedTweens.length; i < numChainedTweens; i ++ ) {
-
- this._chainedTweens[ i ].start( time );
-
+ for (var i = 0, numChainedTweens = this._chainedTweens.length; i < numChainedTweens; i ++)
+ {
+ this._chainedTweens[i].start(time);
}
return false;
-
}
}
@@ -1031,6 +992,8 @@ Phaser.Tween.prototype = {
}
};
+
+Phaser.Tween.prototype.constructor = Phaser.Tween;
@@ -1046,13 +1009,13 @@ Phaser.Tween.prototype = {
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:25 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/TweenManager.js.html b/docs/TweenManager.js.html
index b705ba69..07e47e17 100644
--- a/docs/TweenManager.js.html
+++ b/docs/TweenManager.js.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -423,7 +417,7 @@
/**
* @author Richard Davey <rich@photonstorm.com>
-* @copyright 2013 Photon Storm Ltd.
+* @copyright 2014 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -451,13 +445,13 @@ Phaser.TweenManager = function (game) {
this.game = game;
/**
- * @property {array} _tweens - Description.
+ * @property {array<Phaser.Tween>} _tweens - All of the currently running tweens.
* @private
*/
this._tweens = [];
/**
- * @property {array} _add - Description.
+ * @property {array<Phaser.Tween>} _add - All of the tweens queued to be added in the next update.
* @private
*/
this._add = [];
@@ -469,13 +463,6 @@ Phaser.TweenManager = function (game) {
Phaser.TweenManager.prototype = {
- /**
- * Version number of this library.
- * @property {string} REVISION
- * @default
- */
- REVISION: '11dev',
-
/**
* Get all the tween objects in an array.
* @method Phaser.TweenManager#getAll
@@ -488,12 +475,17 @@ Phaser.TweenManager.prototype = {
},
/**
- * Remove all tween objects.
+ * Remove all tweens running and in the queue. Doesn't call any of the tween onComplete events.
* @method Phaser.TweenManager#removeAll
*/
removeAll: function () {
- this._tweens = [];
+ for (var i = 0; i < this._tweens.length; i++)
+ {
+ this._tweens[i].pendingDelete = true;
+ }
+
+ this._add = [];
},
@@ -504,9 +496,9 @@ Phaser.TweenManager.prototype = {
* @param {Phaser.Tween} tween - The tween object you want to add.
* @returns {Phaser.Tween} The tween object you added to the manager.
*/
- add: function ( tween ) {
+ add: function (tween) {
- this._add.push( tween );
+ this._add.push(tween);
},
@@ -529,14 +521,13 @@ Phaser.TweenManager.prototype = {
* @method Phaser.TweenManager#remove
* @param {Phaser.Tween} tween - The tween object you want to remove.
*/
- remove: function ( tween ) {
+ remove: function (tween) {
- var i = this._tweens.indexOf( tween );
-
- if ( i !== -1 ) {
+ var i = this._tweens.indexOf(tween);
+ if (i !== -1)
+ {
this._tweens[i].pendingDelete = true;
-
}
},
@@ -549,7 +540,7 @@ Phaser.TweenManager.prototype = {
*/
update: function () {
- if ( this._tweens.length === 0 && this._add.length === 0 )
+ if (this._tweens.length === 0 && this._add.length === 0)
{
return false;
}
@@ -557,20 +548,18 @@ Phaser.TweenManager.prototype = {
var i = 0;
var numTweens = this._tweens.length;
- while ( i < numTweens ) {
-
- if ( this._tweens[ i ].update( this.game.time.now ) ) {
-
+ while (i < numTweens)
+ {
+ if (this._tweens[i].update(this.game.time.now))
+ {
i++;
-
- } else {
-
- this._tweens.splice( i, 1 );
+ }
+ else
+ {
+ this._tweens.splice(i, 1);
numTweens--;
-
}
-
}
// If there are any new tweens to be added, do so now - otherwise they can be spliced out of the array before ever running
@@ -606,7 +595,8 @@ Phaser.TweenManager.prototype = {
*/
pauseAll: function () {
- for (var i = this._tweens.length - 1; i >= 0; i--) {
+ for (var i = this._tweens.length - 1; i >= 0; i--)
+ {
this._tweens[i].pause();
}
@@ -619,13 +609,17 @@ Phaser.TweenManager.prototype = {
*/
resumeAll: function () {
- for (var i = this._tweens.length - 1; i >= 0; i--) {
+ for (var i = this._tweens.length - 1; i >= 0; i--)
+ {
this._tweens[i].resume();
}
}
-};
+};
+
+Phaser.TweenManager.prototype.constructor = Phaser.TweenManager;
+
@@ -640,13 +634,13 @@ Phaser.TweenManager.prototype = {
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:25 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/Utils.js.html b/docs/Utils.js.html
index 4dd4ef8d..abbfff1f 100644
--- a/docs/Utils.js.html
+++ b/docs/Utils.js.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -425,7 +419,7 @@
/**
* @author Richard Davey <rich@photonstorm.com>
-* @copyright 2013 Photon Storm Ltd.
+* @copyright 2014 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -620,53 +614,14 @@ Phaser.Utils = {
};
-// Global functions that PIXI needs
-
-(function() {
- var consoleDisabled = false;
- if (consoleDisabled) {
- window.console = undefined;
- }
- if (window.console === undefined) {
- window.console = {
- debug: function() {
- return true;
- },
- info: function() {
- return false;
- },
- warn: function() {
- return false;
- },
- log: function() {
- return false;
- }
- }
- }
- debug = (function(args) {
- window.console.debug(args);
- });
- info = (function(args) {
- window.console.info(args);
- });
- warn = (function(args) {
- window.console.warn(args);
- });
- log = (function(args) {
- window.console.log(args);
- });
-})();
-
-/**
-* Converts a hex color number to an [R, G, B] array
-*
-* @param {number} hex
-* @return {array}
-*/
function HEXtoRGB(hex) {
return [(hex >> 16 & 0xFF) / 255, ( hex >> 8 & 0xFF) / 255, (hex & 0xFF)/ 255];
}
+PIXI.hex2rgb = function hex2rgb(hex) {
+ return [(hex >> 16 & 0xFF) / 255, ( hex >> 8 & 0xFF) / 255, (hex & 0xFF)/ 255];
+};
+
/**
* A polyfill for Function.prototype.bind
*/
@@ -703,6 +658,16 @@ if (typeof Function.prototype.bind != 'function') {
};
})();
}
+
+/**
+* A polyfill for Array.isArray
+*/
+if (!Array.isArray) {
+ Array.isArray = function (arg) {
+ return Object.prototype.toString.call(arg) == '[object Array]';
+ };
+}
+
@@ -718,13 +683,13 @@ if (typeof Function.prototype.bind != 'function') {
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:25 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/World.js.html b/docs/World.js.html
index 94cc8e92..dc04dbad 100644
--- a/docs/World.js.html
+++ b/docs/World.js.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -423,7 +417,7 @@
/**
* @author Richard Davey <rich@photonstorm.com>
-* @copyright 2013 Photon Storm Ltd.
+* @copyright 2014 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -435,6 +429,7 @@
* the world at world-based coordinates. By default a world is created the same size as your Stage.
*
* @class Phaser.World
+* @extends Phaser.Group
* @constructor
* @param {Phaser.Game} game - Reference to the current game instance.
*/
@@ -442,11 +437,6 @@ Phaser.World = function (game) {
Phaser.Group.call(this, game, null, '__world', false);
- /**
- * @property {Phaser.Point} scale - Replaces the PIXI.Point with a slightly more flexible one.
- */
- this.scale = new Phaser.Point(1, 1);
-
/**
* The World has no fixed size, but it does have a bounds outside of which objects are no longer considered as being "in world" and you should use this to clean-up the display list and purge dead objects.
* By default we set the Bounds to be from 0,0 to Game.width,Game.height. I.e. it will match the size given to the game constructor with 0,0 representing the top-left of the display.
@@ -488,34 +478,21 @@ Phaser.World.prototype.boot = function () {
}
/**
-* This is called automatically every frame, and is where main logic happens.
+* This is called automatically after the plugins preUpdate and before the State.update.
+* Most objects have preUpdate methods and it's where initial movement, drawing and calculations are done.
*
* @method Phaser.World#update
*/
-Phaser.World.prototype.update = function () {
-
- this.currentRenderOrderID = 0;
+Phaser.World.prototype.preUpdate = function () {
if (this.game.stage._stage.first._iNext)
{
var currentNode = this.game.stage._stage.first._iNext;
- var skipChildren;
do
{
- skipChildren = false;
-
- if (currentNode['preUpdate'])
- {
- skipChildren = (currentNode.preUpdate() === false);
- }
-
- if (currentNode['update'])
- {
- skipChildren = (currentNode.update() === false) || skipChildren;
- }
-
- if (skipChildren)
+ // If preUpdate exists, and it returns false, skip PIXI child objects
+ if (currentNode['preUpdate'] && !currentNode.preUpdate())
{
currentNode = currentNode.last._iNext;
}
@@ -531,48 +508,123 @@ Phaser.World.prototype.update = function () {
}
/**
-* This is called automatically every frame, and is where main logic happens.
-* @method Phaser.World#postUpdate
+* This is called automatically after the State.update, but before particles or plugins update.
+* Most objects won't have an update method set unless explicitly given one.
+*
+* @method Phaser.World#update
*/
-Phaser.World.prototype.postUpdate = function () {
+Phaser.World.prototype.update = function () {
+ this.currentRenderOrderID = 0;
+
if (this.game.stage._stage.first._iNext)
{
var currentNode = this.game.stage._stage.first._iNext;
do
{
- if (currentNode['postUpdate'])
+ // If update exists, and it returns false, skip PIXI child objects
+ if (currentNode['update'] && !currentNode.update())
{
- currentNode.postUpdate();
+ currentNode = currentNode.last._iNext;
+ }
+ else
+ {
+ currentNode = currentNode._iNext;
}
- currentNode = currentNode._iNext;
}
while (currentNode != this.game.stage._stage.last._iNext)
}
- this.camera.update();
+}
+
+/**
+* This is called automatically before the renderer runs and after the plugins have updated.
+* In postUpdate this is where all the final physics calculatations and object positioning happens.
+* The objects are processed in the order of the display list.
+* The only exception to this is if the camera is following an object, in which case that is updated first.
+*
+* @method Phaser.World#postUpdate
+*/
+Phaser.World.prototype.postUpdate = function () {
+
+ if (this.camera.target && this.camera.target['postUpdate'])
+ {
+ this.camera.target.postUpdate();
+
+ this.camera.update();
+
+ if (this.game.stage._stage.first._iNext)
+ {
+ var currentNode = this.game.stage._stage.first._iNext;
+
+ do
+ {
+ if (currentNode['postUpdate'] && currentNode !== this.camera.target)
+ {
+ currentNode.postUpdate();
+ }
+
+ currentNode = currentNode._iNext;
+ }
+ while (currentNode != this.game.stage._stage.last._iNext)
+ }
+ }
+ else
+ {
+ this.camera.update();
+
+ if (this.game.stage._stage.first._iNext)
+ {
+ var currentNode = this.game.stage._stage.first._iNext;
+
+ do
+ {
+ if (currentNode['postUpdate'])
+ {
+ currentNode.postUpdate();
+ }
+
+ currentNode = currentNode._iNext;
+ }
+ while (currentNode != this.game.stage._stage.last._iNext)
+ }
+ }
+
}
/**
* Updates the size of this world. Note that this doesn't modify the world x/y coordinates, just the width and height.
-* If you need to adjust the bounds of the world
+*
* @method Phaser.World#setBounds
* @param {number} x - Top left most corner of the world.
* @param {number} y - Top left most corner of the world.
-* @param {number} width - New width of the world.
-* @param {number} height - New height of the world.
+* @param {number} width - New width of the world. Can never be smaller than the Game.width.
+* @param {number} height - New height of the world. Can never be smaller than the Game.height.
*/
Phaser.World.prototype.setBounds = function (x, y, width, height) {
+ if (width < this.game.width)
+ {
+ width = this.game.width;
+ }
+
+ if (height < this.game.height)
+ {
+ height = this.game.height;
+ }
+
this.bounds.setTo(x, y, width, height);
if (this.camera.bounds)
{
+ // The Camera can never be smaller than the game size
this.camera.bounds.setTo(x, y, width, height);
}
+ this.game.physics.setBoundsToWorld();
+
}
/**
@@ -722,13 +774,13 @@ Object.defineProperty(Phaser.World.prototype, "visible", {
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:25 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/build/build dev.bat b/docs/build/build dev.bat
deleted file mode 100644
index 144602f1..00000000
--- a/docs/build/build dev.bat
+++ /dev/null
@@ -1 +0,0 @@
-jsdoc -c conf_dev.json
\ No newline at end of file
diff --git a/docs/build/build master.bat b/docs/build/build master.bat
index 25b9d2c4..a1279222 100644
--- a/docs/build/build master.bat
+++ b/docs/build/build master.bat
@@ -1 +1 @@
-jsdoc -c conf.json
\ No newline at end of file
+jsdoc -c conf.json ../../README.md
\ No newline at end of file
diff --git a/docs/build/conf.json b/docs/build/conf.json
index 95acdf2a..b965156b 100644
--- a/docs/build/conf.json
+++ b/docs/build/conf.json
@@ -5,7 +5,6 @@
"source": {
"include": [
"../../src/Phaser.js",
- "../../src/IntroDocs.js",
"../../src/animation/",
"../../src/core/",
"../../src/gameobjects/",
@@ -36,7 +35,7 @@
},
"systemName" : "Phaser",
"footer" : "",
- "copyright" : "Phaser Copyright © 2012-2013 Photon Storm Ltd.",
+ "copyright" : "Phaser Copyright © 2012-2014 Photon Storm Ltd.",
"navType" : "vertical",
"theme" : "cerulean",
"linenums" : true,
diff --git a/docs/build/conf_dev.json b/docs/build/conf_dev.json
deleted file mode 100644
index 95acdf2a..00000000
--- a/docs/build/conf_dev.json
+++ /dev/null
@@ -1,58 +0,0 @@
-{
- "tags": {
- "allowUnknownTags": true
- },
- "source": {
- "include": [
- "../../src/Phaser.js",
- "../../src/IntroDocs.js",
- "../../src/animation/",
- "../../src/core/",
- "../../src/gameobjects/",
- "../../src/geom/",
- "../../src/input/",
- "../../src/loader/",
- "../../src/math/",
- "../../src/net/",
- "../../src/particles/",
- "../../src/physics/arcade/",
- "../../src/sound/",
- "../../src/system/",
- "../../src/tilemap/",
- "../../src/time/",
- "../../src/tween/",
- "../../src/utils/"
- ],
- "exclude": [],
- "includePattern": ".+\\.js(doc)?$",
- "excludePattern": "(^|\\/|\\\\)_"
- },
- "plugins" : ["plugins/markdown"],
- "templates": {
- "cleverLinks" : false,
- "monospaceLinks" : false,
- "default" : {
- "outputSourceFiles" : true
- },
- "systemName" : "Phaser",
- "footer" : "",
- "copyright" : "Phaser Copyright © 2012-2013 Photon Storm Ltd.",
- "navType" : "vertical",
- "theme" : "cerulean",
- "linenums" : true,
- "collapseSymbols" : false,
- "inverseNav" : true
- },
- "markdown" : {
- "parser" : "gfm",
- "hardwrap" : true
- },
- "opts": {
- "template": "docstrap-master/template/",
- "encoding": "utf8",
- "destination": "../",
- "recurse": true,
- "private": false,
- "lenient": true
- }
-}
\ No newline at end of file
diff --git a/docs/classes.list.html b/docs/classes.list.html
index 6dc2e9d4..411a0665 100644
--- a/docs/classes.list.html
+++ b/docs/classes.list.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -374,36 +398,6 @@
-
- Global
-
-
-
-
@@ -514,6 +508,9 @@
Device
+ DOMSprite
+
+
Easing
@@ -568,6 +565,12 @@
GameObjectFactory
+ Gamepad
+
+
+ GamepadButton
+
+
Graphics
@@ -586,6 +589,9 @@
Keyboard
+ Line
+
+
LinkedList
@@ -655,6 +661,9 @@
Signal
+ SinglePad
+
+
Sound
@@ -703,6 +712,9 @@
Timer
+ TimerEvent
+
+
Touch
@@ -756,13 +768,13 @@
- Phaser Copyright © 2012-2013 Photon Storm Ltd.
+ Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev
- on Thu Nov 28 2013 15:56:25 GMT-0000 (GMT) using the DocStrap template .
+ on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template .
diff --git a/docs/global.html b/docs/global.html
index d6ada66d..36df3ad4 100644
--- a/docs/global.html
+++ b/docs/global.html
@@ -90,6 +90,10 @@
Device
+
+ DOMSprite
+
+
Easing
@@ -162,6 +166,14 @@
GameObjectFactory
+
+ Gamepad
+
+
+
+ GamepadButton
+
+
Graphics
@@ -186,6 +198,10 @@
Keyboard
+
+ Line
+
+
LinkedList
@@ -278,6 +294,10 @@
Signal
+
+ SinglePad
+
+
Sound
@@ -342,6 +362,10 @@
Timer
+
+ TimerEvent
+
+
Touch
@@ -381,7 +405,7 @@