From b2303c64a37c52d0ea6881e718fedae35163881f Mon Sep 17 00:00:00 2001
From: Georgios Kaleadis
Date: Thu, 20 Feb 2014 13:26:10 +0100
Subject: [PATCH 01/27] endless loop when in Phaser.Group when destroy children
fixed (use parent not group)
---
src/core/Group.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/core/Group.js b/src/core/Group.js
index f5a0a3fa..e4b0530c 100644
--- a/src/core/Group.js
+++ b/src/core/Group.js
@@ -1147,7 +1147,7 @@ Phaser.Group.prototype.destroy = function (destroyChildren) {
{
do
{
- if (this.children[0].group)
+ if (this.children[0].parent)
{
this.children[0].destroy();
}
From 251b819bdb2ee260425526d277ee8ddcfd53ac37 Mon Sep 17 00:00:00 2001
From: photonstorm
Date: Fri, 21 Feb 2014 10:06:53 +0000
Subject: [PATCH 02/27] Fixed InputHandler group check #463
---
src/input/InputHandler.js | 2 +-
src/tilemap/TilemapParser.js | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/input/InputHandler.js b/src/input/InputHandler.js
index a42ca770..210f34c2 100644
--- a/src/input/InputHandler.js
+++ b/src/input/InputHandler.js
@@ -628,7 +628,7 @@ Phaser.InputHandler.prototype = {
return;
}
- if (this.enabled === false || this.sprite.visible === false || (this.sprite.group && this.sprite.group.visible === false))
+ if (!this.enabled || !this.sprite.visible || !this.sprite.parent.visible)
{
this._pointerOutHandler(pointer);
return false;
diff --git a/src/tilemap/TilemapParser.js b/src/tilemap/TilemapParser.js
index e325cf8c..f3691eb0 100644
--- a/src/tilemap/TilemapParser.js
+++ b/src/tilemap/TilemapParser.js
@@ -66,7 +66,7 @@ Phaser.TilemapParser = {
},
/**
- * Parse tileset data from the cache and creates a Tileset object.
+ * Parse tilemap data from the cache and creates a Tilemap object.
* @method Phaser.TilemapParser.parse
* @param {Phaser.Game} game - Game reference to the currently running game.
* @param {string} key - The key of the tilemap in the Cache.
From cf3796d60c31cca4727c920a7698ca3dedbe0bf1 Mon Sep 17 00:00:00 2001
From: photonstorm
Date: Fri, 21 Feb 2014 10:31:17 +0000
Subject: [PATCH 03/27] Phaser.Animation.frame now returns the frame of the
current animation, rather than the global frame from the sprite sheet / atlas
(fix #466)
---
README.md | 1 +
src/animation/Animation.js | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 4e5daaae..fc5d607b 100644
--- a/README.md
+++ b/README.md
@@ -90,6 +90,7 @@ Significant API changes:
* Cache.getImageKeys and similar has been removed, please use Cache.getKeys(Phaser.Cache.IMAGE) instead, this now supports all 10 Cache data types.
* After defining tiles that collide on a Tilemap, you need to call Tilemap.generateCollisionData(layer) to populate the physics world with the data required.
* Phaser.QuadTree has been removed from core and moved to a plugin. It's no longer required, nor works with the physics system.
+* Phaser.Animation.frame now returns the frame of the current animation, rather than the global frame from the sprite sheet / atlas.
New features:
diff --git a/src/animation/Animation.js b/src/animation/Animation.js
index a6193421..03f0d555 100644
--- a/src/animation/Animation.js
+++ b/src/animation/Animation.js
@@ -416,7 +416,7 @@ Object.defineProperty(Phaser.Animation.prototype, 'frame', {
set: function (value) {
- this.currentFrame = this._frameData.getFrame(value);
+ this.currentFrame = this._frameData.getFrame(this._frames[value]);
if (this.currentFrame !== null)
{
From efd760479d7cb7310f13282834982e3141e68b53 Mon Sep 17 00:00:00 2001
From: photonstorm
Date: Fri, 21 Feb 2014 12:18:23 +0000
Subject: [PATCH 04/27] Sprite and Image now remove any masks that may have
been set when they are destroyed.
---
src/gameobjects/Image.js | 7 ++-----
src/gameobjects/Sprite.js | 7 ++-----
2 files changed, 4 insertions(+), 10 deletions(-)
diff --git a/src/gameobjects/Image.js b/src/gameobjects/Image.js
index 65679081..2e6d7ee4 100644
--- a/src/gameobjects/Image.js
+++ b/src/gameobjects/Image.js
@@ -369,11 +369,6 @@ Phaser.Image.prototype.kill = function() {
*/
Phaser.Image.prototype.destroy = function() {
- if (this.filters)
- {
- this.filters = null;
- }
-
if (this.parent)
{
this.parent.remove(this);
@@ -393,6 +388,8 @@ Phaser.Image.prototype.destroy = function() {
this.exists = false;
this.visible = false;
+ this.filters = null;
+ this.mask = null;
this.game = null;
}
diff --git a/src/gameobjects/Sprite.js b/src/gameobjects/Sprite.js
index 232c94ef..9e260810 100644
--- a/src/gameobjects/Sprite.js
+++ b/src/gameobjects/Sprite.js
@@ -491,11 +491,6 @@ Phaser.Sprite.prototype.kill = function() {
*/
Phaser.Sprite.prototype.destroy = function() {
- if (this.filters)
- {
- this.filters = null;
- }
-
if (this.parent)
{
this.parent.remove(this);
@@ -525,6 +520,8 @@ Phaser.Sprite.prototype.destroy = function() {
this.exists = false;
this.visible = false;
+ this.filters = null;
+ this.mask = null;
this.game = null;
};
From 5f6fc9db05acbda20b544bbffa8fbda7745b4b7f Mon Sep 17 00:00:00 2001
From: photonstorm
Date: Fri, 21 Feb 2014 12:33:15 +0000
Subject: [PATCH 05/27] When adding a Group if the parent value is null the
Group won't be added to the World, so it's up to you to add it when ready. If
parent is undefined it's added to World.
---
src/core/Group.js | 20 +++++++++-----------
1 file changed, 9 insertions(+), 11 deletions(-)
diff --git a/src/core/Group.js b/src/core/Group.js
index e4b0530c..87ae200c 100644
--- a/src/core/Group.js
+++ b/src/core/Group.js
@@ -10,18 +10,20 @@
* @classdesc A Group is a container for display objects that allows for fast pooling and object recycling. Groups can be nested within other Groups and have their own local transforms.
* @constructor
* @param {Phaser.Game} game - A reference to the currently running game.
-* @param {Phaser.Group|Phaser.Sprite} parent - The parent Group, DisplayObject or DisplayObjectContainer that this Group will be added to. If undefined or null it will use game.world.
+* @param {Phaser.Group|Phaser.Sprite|null} parent - The parent Group, DisplayObject or DisplayObjectContainer that this Group will be added to. If undefined it will use game.world. If null it won't be added to anything.
* @param {string} [name=group] - A name for this Group. Not used internally but useful for debugging.
* @param {boolean} [addToStage=false] - If set to true this Group will be added directly to the Game.Stage instead of Game.World.
*/
Phaser.Group = function (game, parent, name, addToStage) {
+ if (typeof addToStage === 'undefined') { addToStage = false; }
+
/**
* @property {Phaser.Game} game - A reference to the currently running Game.
*/
this.game = game;
- if (typeof parent === 'undefined' || parent === null)
+ if (typeof parent === 'undefined')
{
parent = game.world;
}
@@ -33,20 +35,16 @@ Phaser.Group = function (game, parent, name, addToStage) {
PIXI.DisplayObjectContainer.call(this);
- if (typeof addToStage === 'undefined' || addToStage === false)
+ if (addToStage)
+ {
+ this.game.stage.addChild(this);
+ }
+ else
{
if (parent)
{
parent.addChild(this);
}
- else
- {
- this.game.stage.addChild(this);
- }
- }
- else
- {
- this.game.stage.addChild(this);
}
/**
From 066a625d17bbe8147e36a277e59df94ecc4092a3 Mon Sep 17 00:00:00 2001
From: photonstorm
Date: Fri, 21 Feb 2014 12:35:30 +0000
Subject: [PATCH 06/27] When adding a Group if the parent value is `null` the
Group won't be added to the World, so you can add it when ready. If parent is
`undefined` it's added to World by default.
---
README.md | 1 +
1 file changed, 1 insertion(+)
diff --git a/README.md b/README.md
index fc5d607b..aeed9a2a 100644
--- a/README.md
+++ b/README.md
@@ -91,6 +91,7 @@ Significant API changes:
* After defining tiles that collide on a Tilemap, you need to call Tilemap.generateCollisionData(layer) to populate the physics world with the data required.
* Phaser.QuadTree has been removed from core and moved to a plugin. It's no longer required, nor works with the physics system.
* Phaser.Animation.frame now returns the frame of the current animation, rather than the global frame from the sprite sheet / atlas.
+* When adding a Group if the parent value is `null` the Group won't be added to the World, so you can add it when ready. If parent is `undefined` it's added to World by default.
New features:
From dd8a393bc971d7ac7129b83dc8e9fd4873fd6f9a Mon Sep 17 00:00:00 2001
From: photonstorm
Date: Fri, 21 Feb 2014 12:40:49 +0000
Subject: [PATCH 07/27] Updated version of p2
---
build/p2.js | 92 ++++++++++++++++++----------
src/gameobjects/GameObjectFactory.js | 2 +-
2 files changed, 61 insertions(+), 33 deletions(-)
diff --git a/build/p2.js b/build/p2.js
index 8835ae42..e3d50ce4 100644
--- a/build/p2.js
+++ b/build/p2.js
@@ -1614,12 +1614,22 @@ Broadphase.aabbCheck = function(bodyA, bodyB){
* @return {Boolean}
*/
Broadphase.canCollide = function(bodyA, bodyB){
+
// Cannot collide static bodies
- if(bodyA.motionState & Body.STATIC && bodyB.motionState & Body.STATIC)
+ if(bodyA.motionState == Body.STATIC && bodyB.motionState == Body.STATIC)
return false;
- // Cannot collide sleeping bodies
- if(bodyA.sleepState & Body.SLEEPING && bodyB.sleepState & Body.SLEEPING)
+ // Cannot collide static vs kinematic bodies
+ if( (bodyA.motionState == Body.KINEMATIC && bodyB.motionState == Body.STATIC) ||
+ (bodyA.motionState == Body.STATIC && bodyB.motionState == Body.KINEMATIC))
+ return false;
+
+ // Cannot collide kinematic vs kinematic
+ if(bodyA.motionState == Body.KINEMATIC && bodyB.motionState == Body.KINEMATIC)
+ return false;
+
+ // Cannot collide both sleeping bodies
+ if(bodyA.sleepState == Body.SLEEPING && bodyB.sleepState == Body.SLEEPING)
return false;
return true;
@@ -2027,9 +2037,9 @@ Narrowphase.prototype.createContactEquation = function(bodyA,bodyB,shapeA,shapeB
c.firstImpact = !this.collidedLastStep(bodyA,bodyB);
c.enabled = true;
- if(bodyA.allowSleep && (bodyA.motionState & Body.DYNAMIC) && !(bodyB.motionState & Body.STATIC || bodyB.sleepState === Body.SLEEPY))
+ if(bodyA.allowSleep && (bodyA.motionState == Body.DYNAMIC) && !(bodyB.motionState == Body.STATIC || bodyB.sleepState === Body.SLEEPY))
bodyA.wakeUp();
- if(bodyB.allowSleep && (bodyB.motionState & Body.DYNAMIC) && !(bodyA.motionState & Body.STATIC || bodyA.sleepState === Body.SLEEPY))
+ if(bodyB.allowSleep && (bodyB.motionState == Body.DYNAMIC) && !(bodyA.motionState == Body.STATIC || bodyA.sleepState === Body.SLEEPY))
bodyB.wakeUp();
return c;
@@ -4111,9 +4121,11 @@ SAPBroadphase.prototype.getCollisionPairs = function(world){
break;
// add pair to preliminary list
- var key = bi.id < bj.id ? bi.id+' '+bj.id : bj.id+' '+bi.id;
- preliminaryList[key] = true;
- preliminaryList.keys.push(key);
+ if(Broadphase.canCollide(bi,bj)){
+ var key = bi.id < bj.id ? bi.id+' '+bj.id : bj.id+' '+bi.id;
+ preliminaryList[key] = true;
+ preliminaryList.keys.push(key);
+ }
}
}
@@ -4128,9 +4140,11 @@ SAPBroadphase.prototype.getCollisionPairs = function(world){
break;
// If in preliminary list, add to final result
- var key = bi.id < bj.id ? bi.id+' '+bj.id : bj.id+' '+bi.id;
- if(preliminaryList[key] && Broadphase.boundingRadiusCheck(bi,bj))
- result.push(bi,bj);
+ if(Broadphase.canCollide(bi,bj)){
+ var key = bi.id < bj.id ? bi.id+' '+bj.id : bj.id+' '+bi.id;
+ if(preliminaryList[key] && Broadphase.boundingRadiusCheck(bi,bj))
+ result.push(bi,bj);
+ }
}
}
@@ -6793,6 +6807,12 @@ function Body(options){
*/
this.sleepTimeLimit = 1;
+ /**
+ * Gravity scaling factor. If you want the body to ignore gravity, set this to zero. If you want to reverse gravity, set it to -1.
+ * @property {Number} gravityScale
+ */
+ this.gravityScale = 1;
+
this.timeLastSleepy = 0;
this.concavePath = null;
@@ -7040,6 +7060,7 @@ Body.prototype.fromPolygon = function(path,options){
var p = new decomp.Polygon();
p.vertices = path;
+
// Make it counter-clockwise
p.makeCCW();
@@ -7174,7 +7195,7 @@ Body.prototype.addConstraintVelocity = function(){
* @param {number} dt Current time step
*/
Body.prototype.applyDamping = function(dt){
- if(this.motionState & Body.DYNAMIC){ // Only for dynamic bodies
+ if(this.motionState == Body.DYNAMIC){ // Only for dynamic bodies
// Since Math.pow generates garbage we check if we can reuse the scaling coefficient from last step
if(dt != this.lastDampingTimeStep){
@@ -8619,7 +8640,7 @@ function getUnvisitedNode(nodes){
var Nnodes = nodes.length;
for(var i=0; i!==Nnodes; i++){
var node = nodes[i];
- if(!node.visited && !(node.body.motionState & STATIC)){ // correct?
+ if(!node.visited && !(node.body.motionState == STATIC)){ // correct?
return node;
}
}
@@ -9401,7 +9422,7 @@ World.prototype.internalStep = function(dt){
for(var i=0; i!==Nbodies; i++){
var b = bodies[i],
fi = b.force;
- vec2.scale(mg,g,b.mass); // F=m*g
+ vec2.scale(mg,g,b.mass*b.gravityScale); // F=m*g
add(fi,fi,mg);
}
}
@@ -9417,7 +9438,8 @@ World.prototype.internalStep = function(dt){
if(this.applyDamping){
for(var i=0; i!==Nbodies; i++){
var b = bodies[i];
- b.applyDamping(dt);
+ if(b.motionState == Body.DYNAMIC)
+ b.applyDamping(dt);
}
}
@@ -9466,13 +9488,14 @@ World.prototype.internalStep = function(dt){
// Emit shape end overlap events
var last = this.overlappingShapesLastState;
- for(var i=0; i0){
+ if(body.sleepState !== Body.SLEEPING && body.motionState!=Body.STATIC){
World.integrateBody(body,dt);
}
}
diff --git a/src/gameobjects/GameObjectFactory.js b/src/gameobjects/GameObjectFactory.js
index 3dae41e8..be6ac2e4 100644
--- a/src/gameobjects/GameObjectFactory.js
+++ b/src/gameobjects/GameObjectFactory.js
@@ -95,7 +95,7 @@ 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 {any} parent - The parent Group or DisplayObjectContainer that will hold this group, if any.
+ * @param {any} [parent] - The parent Group or DisplayObjectContainer that will hold this group, if any. If set to null the Group won't be added to the display list. If undefined it will be added to World by default.
* @param {string} [name='group'] - A name for this Group. Not used internally but useful for debugging.
* @param {boolean} [addToStage=false] - If set to true this Group will be added directly to the Game.Stage instead of Game.World.
* @return {Phaser.Group} The newly created group.
From a61d0302563fe4c6b64274e6765ae5cd62cd5085 Mon Sep 17 00:00:00 2001
From: photonstorm
Date: Fri, 21 Feb 2014 13:25:08 +0000
Subject: [PATCH 08/27] Display Objects now clean-up their children properly on
destroy.
---
src/gameobjects/BitmapText.js | 23 +++++++++--------------
src/gameobjects/Image.js | 7 +++++++
src/gameobjects/Sprite.js | 8 ++++++++
src/gameobjects/Text.js | 16 ++++++++++------
src/gameobjects/TileSprite.js | 9 +++++++++
5 files changed, 43 insertions(+), 20 deletions(-)
diff --git a/src/gameobjects/BitmapText.js b/src/gameobjects/BitmapText.js
index 12dcc238..c2b86bde 100644
--- a/src/gameobjects/BitmapText.js
+++ b/src/gameobjects/BitmapText.js
@@ -204,30 +204,25 @@ Phaser.BitmapText.prototype.postUpdate = function () {
*/
Phaser.BitmapText.prototype.destroy = function() {
- if (this.filters)
- {
- this.filters = null;
- }
-
if (this.parent)
{
this.parent.remove(this);
}
+ var i = this.children.length;
+
+ while (i--)
+ {
+ this.removeChild(this.children[i]);
+ }
+
this.exists = false;
this.visible = false;
+ this.filters = null;
+ this.mask = null;
this.game = null;
- if (this.children.length > 0)
- {
- do
- {
- this.removeChild(this.children[0]);
- }
- while (this.children.length > 0);
- }
-
}
/**
diff --git a/src/gameobjects/Image.js b/src/gameobjects/Image.js
index 2e6d7ee4..a76285b6 100644
--- a/src/gameobjects/Image.js
+++ b/src/gameobjects/Image.js
@@ -384,6 +384,13 @@ Phaser.Image.prototype.destroy = function() {
this.input.destroy();
}
+ var i = this.children.length;
+
+ while (i--)
+ {
+ this.removeChild(this.children[i]);
+ }
+
this.alive = false;
this.exists = false;
this.visible = false;
diff --git a/src/gameobjects/Sprite.js b/src/gameobjects/Sprite.js
index 9e260810..04769f33 100644
--- a/src/gameobjects/Sprite.js
+++ b/src/gameobjects/Sprite.js
@@ -14,6 +14,7 @@
* events (via Sprite.events), animation (via Sprite.animations), camera culling and more. Please see the Examples for use cases.
*
* @constructor
+* @extends PIXI.Sprite
* @param {Phaser.Game} game - A reference to the currently running game.
* @param {number} x - The x coordinate (in world space) to position the Sprite at.
* @param {number} y - The y coordinate (in world space) to position the Sprite at.
@@ -516,6 +517,13 @@ Phaser.Sprite.prototype.destroy = function() {
this.events.destroy();
}
+ var i = this.children.length;
+
+ while (i--)
+ {
+ this.removeChild(this.children[i]);
+ }
+
this.alive = false;
this.exists = false;
this.visible = false;
diff --git a/src/gameobjects/Text.js b/src/gameobjects/Text.js
index 5aa0b423..2bca231f 100644
--- a/src/gameobjects/Text.js
+++ b/src/gameobjects/Text.js
@@ -10,6 +10,7 @@
* Here is a compatibility table showing the available default fonts across different mobile browsers: http://www.jordanm.co.uk/tinytype
*
* @class Phaser.Text
+* @extends PIXI.Text
* @constructor
* @param {Phaser.Game} game - Current game instance.
* @param {number} x - X position of the new text object.
@@ -170,7 +171,6 @@ Phaser.Text.prototype.update = function() {
*/
Phaser.Text.prototype.postUpdate = function () {
- // Fixed to Camera?
if (this._cache[7] === 1)
{
this.position.x = this.game.camera.view.x + this.cameraOffset.x;
@@ -184,11 +184,6 @@ Phaser.Text.prototype.postUpdate = function () {
*/
Phaser.Text.prototype.destroy = function () {
- if (this.filters)
- {
- this.filters = null;
- }
-
if (this.parent)
{
this.parent.remove(this);
@@ -206,9 +201,18 @@ Phaser.Text.prototype.destroy = function () {
this.context = null;
}
+ var i = this.children.length;
+
+ while (i--)
+ {
+ this.removeChild(this.children[i]);
+ }
+
this.exists = false;
this.visible = false;
+ this.filters = null;
+ this.mask = null;
this.game = null;
}
diff --git a/src/gameobjects/TileSprite.js b/src/gameobjects/TileSprite.js
index e147145f..e44d0962 100644
--- a/src/gameobjects/TileSprite.js
+++ b/src/gameobjects/TileSprite.js
@@ -288,9 +288,18 @@ Phaser.TileSprite.prototype.destroy = function() {
this.events.destroy();
+ var i = this.children.length;
+
+ while (i--)
+ {
+ this.removeChild(this.children[i]);
+ }
+
this.exists = false;
this.visible = false;
+ this.filters = null;
+ this.mask = null;
this.game = null;
}
From eb38ae35f8c331fda513bc32c75926530d4907a3 Mon Sep 17 00:00:00 2001
From: photonstorm
Date: Fri, 21 Feb 2014 13:44:39 +0000
Subject: [PATCH 09/27] renderXY added back into RenderTexture.
---
src/gameobjects/RenderTexture.js | 42 ++++++++++++++++++++++++++++++++
1 file changed, 42 insertions(+)
diff --git a/src/gameobjects/RenderTexture.js b/src/gameobjects/RenderTexture.js
index 1fb002d9..f4db8708 100644
--- a/src/gameobjects/RenderTexture.js
+++ b/src/gameobjects/RenderTexture.js
@@ -30,9 +30,51 @@ Phaser.RenderTexture = function (game, width, height, key) {
*/
this.type = Phaser.RENDERTEXTURE;
+ /**
+ * @property {Phaser.Point} _temp - Internal var.
+ * @private
+ */
+ this._temp = new Phaser.Point();
+
PIXI.RenderTexture.call(this, width, height);
};
Phaser.RenderTexture.prototype = Object.create(PIXI.RenderTexture.prototype);
Phaser.RenderTexture.prototype.constructor = Phaser.RenderTexture;
+
+/**
+* This function will draw the display object to the texture.
+*
+* @method Phaser.RenderTexture.prototype.renderXY
+* @param {Phaser.Sprite|Phaser.Image|Phaser.Text|Phaser.BitmapText|Phaser.Group} displayObject The display object to render to this texture.
+* @param {number} x - The x position to render the object at.
+* @param {number} y - The y position to render the object at.
+* @param {boolean} clear - If true the texture will be cleared before the display object is drawn.
+*/
+Phaser.RenderTexture.prototype.renderXY = function (displayObject, x, y, clear) {
+
+ this._temp.set(x, y);
+
+ this.render(displayObject, this._temp, clear);
+
+}
+
+// Documentation stubs
+
+/**
+* This function will draw the display object to the texture.
+*
+* @method Phaser.RenderTexture.prototype.render
+* @param {Phaser.Sprite|Phaser.Image|Phaser.Text|Phaser.BitmapText|Phaser.Group} displayObject The display object to render to this texture.
+* @param {Phaser.Point} position - A Point object containing the position to render the display object at.
+* @param {boolean} clear - If true the texture will be cleared before the display object is drawn.
+*/
+
+/**
+* Resize this RenderTexture to the given width and height.
+*
+* @method Phaser.RenderTexture.prototype.resize
+* @param {number} width - The new width of the RenderTexture.
+* @param {number} height - The new height of the RenderTexture.
+*/
From 07af06fc4eb2e6b4c2019ad5b64a3a3ceec6c1b1 Mon Sep 17 00:00:00 2001
From: photonstorm
Date: Fri, 21 Feb 2014 14:50:18 +0000
Subject: [PATCH 10/27] Fixing up documentation, missing functions, examples
and alpha masks.
---
Gruntfile.js | 1 +
build/config.php | 1 +
examples/_site/view_full.html | 68 ++---
examples/_site/view_lite.html | 68 ++---
examples/wip/alpha-mask.js | 53 ++++
examples/wip/graphics-mask.js | 40 +++
src/Phaser.js | 23 +-
src/core/Game.js | 21 +-
src/core/StateManager.js | 1 +
src/gameobjects/BitmapData.js | 42 +++-
src/gameobjects/GameObjectCreator.js | 360 +++++++++++++++++++++++++++
src/gameobjects/GameObjectFactory.js | 2 +-
12 files changed, 565 insertions(+), 115 deletions(-)
create mode 100644 examples/wip/alpha-mask.js
create mode 100644 examples/wip/graphics-mask.js
create mode 100644 src/gameobjects/GameObjectCreator.js
diff --git a/Gruntfile.js b/Gruntfile.js
index 17b86ec4..64646566 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -86,6 +86,7 @@ module.exports = function (grunt) {
'src/gameobjects/Events.js',
'src/gameobjects/GameObjectFactory.js',
+ 'src/gameobjects/GameObjectCreator.js',
'src/gameobjects/BitmapData.js',
'src/gameobjects/Sprite.js',
'src/gameobjects/Image.js',
diff --git a/build/config.php b/build/config.php
index de9615d2..52ee0cc0 100644
--- a/build/config.php
+++ b/build/config.php
@@ -131,6 +131,7 @@
+
diff --git a/examples/_site/view_full.html b/examples/_site/view_full.html
index 33314ad8..47985140 100644
--- a/examples/_site/view_full.html
+++ b/examples/_site/view_full.html
@@ -12,32 +12,29 @@
it's because it makes debugging *significantly* easier for us. Feel free to replace all the below
with just a call to ../dist/phaser.js instead if you prefer.
-->
+
-
-
-
-
-
-
+
+
+
+
+
+
+
-
-
-
-
-
@@ -57,36 +54,10 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -115,29 +86,27 @@
+
+
+
+
-
-
-
-
-
-
-
+
@@ -165,9 +134,14 @@
-
-
-
+
+
+
+
+
+
+
+
diff --git a/examples/_site/view_lite.html b/examples/_site/view_lite.html
index b7c6d0ae..0455a4e3 100644
--- a/examples/_site/view_lite.html
+++ b/examples/_site/view_lite.html
@@ -12,32 +12,29 @@
it's because it makes debugging *significantly* easier for us. Feel free to replace all the below
with just a call to ../build/phaser.js instead if you prefer.
-->
+
-
-
-
-
-
-
+
+
+
+
+
+
+
-
-
-
-
-
@@ -57,36 +54,10 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -115,29 +86,27 @@
+
+
+
+
-
-
-
-
-
-
-
+
@@ -165,9 +134,14 @@
-
-
-
+
+
+
+
+
+
+
+
diff --git a/examples/wip/alpha-mask.js b/examples/wip/alpha-mask.js
new file mode 100644
index 00000000..137aa40b
--- /dev/null
+++ b/examples/wip/alpha-mask.js
@@ -0,0 +1,53 @@
+
+var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create, update: update, render: render });
+// var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render });
+
+function preload() {
+
+ game.load.image('bg', 'assets/pics/color_wheel_swirl.png');
+ game.load.image('pic', 'assets/pics/questar.png');
+ game.load.image('mask1', 'assets/pics/mask-test.png');
+ game.load.image('mask2', 'assets/pics/mask-test2.png');
+
+}
+
+var pic;
+var mask;
+
+function create() {
+
+ game.add.image(-200, 0, 'bg');
+
+ pic = game.add.sprite(0, 0, 'mask1');
+ // pic = game.add.sprite(0, 0, 'pic');
+
+ // mask.addChild(pic);
+
+ // pic.blendMode = Phaser.blendModes.NORMAL;
+ // pic.blendMode = Phaser.blendModes.ADD;
+ // mask.blendMode = Phaser.blendModes.MULTIPLY;
+ // pic.blendMode = Phaser.blendModes.SCREEN;
+ // mask.blendMode = Phaser.blendModes.OVERLAY;
+ // pic.blendMode = Phaser.blendModes.DARKEN;
+ // pic.blendMode = Phaser.blendModes.LIGHTEN;
+ // pic.blendMode = Phaser.blendModes.COLOR_DODGE;
+ // pic.blendMode = Phaser.blendModes.COLOR_BURN;
+ // pic.blendMode = Phaser.blendModes.HARD_LIGHT;
+ // pic.blendMode = Phaser.blendModes.SOFT_LIGHT;
+ // pic.blendMode = Phaser.blendModes.DIFFERENCE;
+ // pic.blendMode = Phaser.blendModes.EXCLUSION;
+ // pic.blendMode = Phaser.blendModes.HUE;
+ // pic.blendMode = PIXI.blendModes.SATURATION;
+ pic.blendMode = Phaser.blendModes.COLOR;
+ // pic.blendMode = Phaser.blendModes.LUMINOSITY;
+
+}
+
+function update() {
+
+
+}
+
+function render() {
+
+}
diff --git a/examples/wip/graphics-mask.js b/examples/wip/graphics-mask.js
new file mode 100644
index 00000000..85ebff6e
--- /dev/null
+++ b/examples/wip/graphics-mask.js
@@ -0,0 +1,40 @@
+
+var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create, update: update, render: render });
+// var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render });
+
+function preload() {
+
+ game.load.image('atari', 'assets/sprites/atari130xe.png');
+
+}
+
+var atari1;
+var graphics;
+
+function create() {
+
+ atari1 = game.add.sprite(50, 50, 'atari');
+
+ graphics = game.add.graphics(0, 0);
+
+ graphics.beginFill(0xFF3300);
+ graphics.moveTo(0,50);
+ graphics.lineTo(250, 50);
+ graphics.lineTo(100, 100);
+ graphics.lineTo(250, 220);
+ graphics.lineTo(50, 220);
+ graphics.lineTo(0, 50);
+ graphics.endFill();
+
+ atari1.mask = graphics;
+
+}
+
+function update() {
+
+
+}
+
+function render() {
+
+}
diff --git a/src/Phaser.js b/src/Phaser.js
index 43eeaf5c..ae7571a0 100644
--- a/src/Phaser.js
+++ b/src/Phaser.js
@@ -49,7 +49,28 @@ var Phaser = Phaser || {
KINEMATIC: 4,
CANVAS_PX_ROUND: false,
- CANVAS_CLEAR_RECT: true
+ CANVAS_CLEAR_RECT: true,
+
+ // the various blend modes supported by pixi / phaser
+ blendModes: {
+ NORMAL:0,
+ ADD:1,
+ MULTIPLY:2,
+ SCREEN:3,
+ OVERLAY:4,
+ DARKEN:5,
+ LIGHTEN:6,
+ COLOR_DODGE:7,
+ COLOR_BURN:8,
+ HARD_LIGHT:9,
+ SOFT_LIGHT:10,
+ DIFFERENCE:11,
+ EXCLUSION:12,
+ HUE:13,
+ SATURATION:14,
+ COLOR:15,
+ LUMINOSITY:16
+ }
};
diff --git a/src/core/Game.js b/src/core/Game.js
index 2b1cf940..06ced0d7 100644
--- a/src/core/Game.js
+++ b/src/core/Game.js
@@ -118,10 +118,15 @@ Phaser.Game = function (width, height, renderer, parent, state, transparent, ant
this.raf = null;
/**
- * @property {Phaser.GameObjectFactory} add - Reference to the GameObject Factory.
+ * @property {Phaser.GameObjectFactory} add - Reference to the Phaser.GameObjectFactory.
*/
this.add = null;
+ /**
+ * @property {Phaser.GameObjectCreator} make - Reference to the GameObject Creator.
+ */
+ this.make = null;
+
/**
* @property {Phaser.Cache} cache - Reference to the assets cache.
* @default
@@ -440,6 +445,7 @@ Phaser.Game.prototype = {
this.world = new Phaser.World(this);
this.add = new Phaser.GameObjectFactory(this);
+ this.make = new Phaser.GameObjectCreator(this);
this.cache = new Phaser.Cache(this);
this.load = new Phaser.Loader(this);
this.time = new Phaser.Time(this);
@@ -534,14 +540,6 @@ 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)
@@ -553,7 +551,6 @@ Phaser.Game.prototype = {
this.renderer = new PIXI.CanvasRenderer(this.width, this.height, this.canvas, this.transparent);
Phaser.Canvas.setSmoothingEnabled(this.renderer.context, this.antialias);
- // this.canvas = this.renderer.view;
this.context = this.renderer.context;
}
else
@@ -566,13 +563,9 @@ Phaser.Game.prototype = {
// They requested WebGL, and their browser supports it
this.renderType = Phaser.WEBGL;
this.renderer = new PIXI.WebGLRenderer(this.width, this.height, this.canvas, this.transparent, this.antialias);
- // this.canvas = this.renderer.view;
this.context = null;
}
- // Phaser.Canvas.addToDOM(this.renderer.view, this.parent, true);
- // Phaser.Canvas.setTouchAction(this.renderer.view);
-
Phaser.Canvas.addToDOM(this.canvas, this.parent, true);
Phaser.Canvas.setTouchAction(this.canvas);
diff --git a/src/core/StateManager.js b/src/core/StateManager.js
index a7ebbe06..77378f61 100644
--- a/src/core/StateManager.js
+++ b/src/core/StateManager.js
@@ -329,6 +329,7 @@ Phaser.StateManager.prototype = {
this.states[key].game = this.game;
this.states[key].add = this.game.add;
+ this.states[key].make = this.game.make;
this.states[key].camera = this.game.camera;
this.states[key].cache = this.game.cache;
this.states[key].input = this.game.input;
diff --git a/src/gameobjects/BitmapData.js b/src/gameobjects/BitmapData.js
index 4c5a5287..2e8f503c 100644
--- a/src/gameobjects/BitmapData.js
+++ b/src/gameobjects/BitmapData.js
@@ -108,7 +108,7 @@ Phaser.BitmapData = function (game, key, width, height) {
Phaser.BitmapData.prototype = {
/**
- * Updates the given objects so that they use this BitmapData as their texture.
+ * Updates the given objects so that they use this BitmapData as their texture. This will replace any texture they will currently have set.
*
* @method Phaser.BitmapData#add
* @param {Phaser.Sprite|Phaser.Sprite[]|Phaser.Image|Phaser.Image[]} object - Either a single Sprite/Image or an Array of Sprites/Images.
@@ -217,6 +217,7 @@ Phaser.BitmapData.prototype = {
/**
* Sets the color of the given pixel to the specified red, green and blue values.
+ *
* @method Phaser.BitmapData#setPixel
* @param {number} x - The X coordinate of the pixel to be set.
* @param {number} y - The Y coordinate of the pixel to be set.
@@ -231,7 +232,8 @@ Phaser.BitmapData.prototype = {
},
/**
- * Get a color of a specific pixel.
+ * Get the color of a specific pixel.
+ *
* @param {number} x - The X coordinate of the pixel to get.
* @param {number} y - The Y coordinate of the pixel to get.
* @return {number} A native color value integer (format: 0xRRGGBB)
@@ -246,7 +248,8 @@ Phaser.BitmapData.prototype = {
},
/**
- * Get a color of a specific pixel (including alpha value).
+ * Get the color of a specific pixel including its alpha value.
+ *
* @param {number} x - The X coordinate of the pixel to get.
* @param {number} y - The Y coordinate of the pixel to get.
* @return {number} A native color value integer (format: 0xAARRGGBB)
@@ -261,8 +264,9 @@ Phaser.BitmapData.prototype = {
},
/**
- * Get pixels in array in a specific Rectangle.
- * @param rect {Rectangle} The specific Rectangle.
+ * Gets all the pixels from the region specified by the given Rectangle object.
+ *
+ * @param {Phaser.Rectangle} rect - The Rectangle region to get.
* @return {array} CanvasPixelArray.
*/
getPixels: function (rect) {
@@ -271,15 +275,43 @@ Phaser.BitmapData.prototype = {
},
+ /**
+ * Copies the pixels from the source image to this BitmapData based on the given area and destination.
+ *
+ * @param {HTMLImage} source - The Image to copy from. If you want to use an image in Phasers Cache, use game.cache.getImage(key).
+ * @param {Phaser.Rectangle} area - The Rectangle region to copy from the source image.
+ * @param {number} destX - The destination x coordinate to copy the image to.
+ * @param {number} destY - The destination y coordinate to copy the image to.
+ */
copyPixels: function (source, area, destX, destY) {
this.context.drawImage(source, area.x, area.y, area.width, area.height, destX, destY, area.width, area.height);
},
+ /**
+ * Alpha mask.
+ *
+ * @param {HTMLImage} source - The Image to copy from. If you want to use an image in Phasers Cache, use game.cache.getImage(key).
+ * @param {Phaser.Rectangle} area - The Rectangle region to copy from the source image.
+ * @param {number} destX - The destination x coordinate to copy the image to.
+ * @param {number} destY - The destination y coordinate to copy the image to.
+ */
+ alphaMask: function (source) {
+
+ var temp = this.context.globalCompositeOperation;
+
+ this.context.globalCompositeOperation = 'source-atop';
+ // this.context.drawImage(source, area.x, area.y, area.width, area.height, destX, destY, area.width, area.height);
+
+ this.context.globalCompositeOperation = temp;
+
+ },
+
/**
* If the game is running in WebGL this will push the texture up to the GPU if it's dirty.
* This is called automatically if the BitmapData is being used by a Sprite, otherwise you need to remember to call it in your render function.
+ *
* @method Phaser.BitmapData#render
*/
render: function () {
diff --git a/src/gameobjects/GameObjectCreator.js b/src/gameobjects/GameObjectCreator.js
new file mode 100644
index 00000000..da0d4805
--- /dev/null
+++ b/src/gameobjects/GameObjectCreator.js
@@ -0,0 +1,360 @@
+/**
+* @author Richard Davey
+* @copyright 2014 Photon Storm Ltd.
+* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+*/
+
+/**
+* The Game Object Creator is a quick way to create all of the different sorts of core objects that Phaser uses, but not add them to the game world.
+* Use the GameObjectFactory to create and add the objects into the world.
+*
+* @class Phaser.GameObjectCreator
+* @constructor
+* @param {Phaser.Game} game - A reference to the currently running game.
+*/
+Phaser.GameObjectCreator = function (game) {
+
+ /**
+ * @property {Phaser.Game} game - A reference to the currently running Game.
+ */
+ this.game = game;
+
+ /**
+ * @property {Phaser.World} world - A reference to the game world.
+ */
+ this.world = this.game.world;
+
+};
+
+Phaser.GameObjectCreator.prototype = {
+
+ /**
+ * Create a new `Image` object. An Image is a light-weight object you can use to display anything that doesn't need physics or animation.
+ * It can still rotate, scale, crop and receive input events. This makes it perfect for logos, backgrounds, simple buttons and other non-Sprite graphics.
+ *
+ * @method Phaser.GameObjectCreator#image
+ * @param {number} x - X position of the image.
+ * @param {number} y - Y position of the image.
+ * @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.
+ * @returns {Phaser.Sprite} the newly created sprite object.
+ */
+ image: function (x, y, key, frame) {
+
+ return new Phaser.Image(this.game, x, y, key, frame);
+
+ },
+
+ /**
+ * Create a new Sprite with specific position and sprite sheet key.
+ *
+ * @method Phaser.GameObjectCreator#sprite
+ * @param {number} x - X position of the new sprite.
+ * @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.
+ * @returns {Phaser.Sprite} the newly created sprite object.
+ */
+ sprite: function (x, y, key, frame) {
+
+ return new Phaser.Sprite(this.game, x, y, key, frame);
+
+ },
+
+ /**
+ * Create a tween object for a specific object. The object can be any JavaScript object or Phaser object such as Sprite.
+ *
+ * @method Phaser.GameObjectCreator#tween
+ * @param {object} obj - Object the tween will be run on.
+ * @return {Phaser.Tween} Description.
+ */
+ tween: function (obj) {
+
+ return this.game.tweens.create(obj);
+
+ },
+
+ /**
+ * A Group is a container for display objects that allows for fast pooling, recycling and collision checks.
+ *
+ * @method Phaser.GameObjectCreator#group
+ * @param {any} [parent] - The parent Group or DisplayObjectContainer that will hold this group, if any. If set to null the Group won't be added to the display list. If undefined it will be added to World by default.
+ * @param {string} [name='group'] - A name for this Group. Not used internally but useful for debugging.
+ * @param {boolean} [addToStage=false] - If set to true this Group will be added directly to the Game.Stage instead of Game.World.
+ * @return {Phaser.Group} The newly created group.
+ */
+ group: function (parent, name, addToStage) {
+
+ if (typeof name === 'undefined') { name = 'group'; }
+ if (typeof addToStage === 'undefined') { addToStage = false; }
+
+ return new Phaser.Group(this.game, parent, name, addToStage);
+
+ },
+
+ /**
+ * A Group is a container for display objects that allows for fast pooling, recycling and collision checks.
+ *
+ * @method Phaser.GameObjectCreator#spriteBatch
+ * @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.
+ * @param {boolean} [addToStage=false] - If set to true this Group will be added directly to the Game.Stage instead of Game.World.
+ * @return {Phaser.Group} The newly created group.
+ */
+ spriteBatch: function (parent, name, addToStage) {
+
+ if (typeof name === 'undefined') { name = 'group'; }
+ if (typeof addToStage === 'undefined') { addToStage = false; }
+
+ return new Phaser.SpriteBatch(this.game, parent, name, addToStage);
+
+ },
+
+ /**
+ * Creates a new Sound object.
+ *
+ * @method Phaser.GameObjectCreator#audio
+ * @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.
+ */
+ audio: function (key, volume, loop, connect) {
+
+ return this.game.sound.add(key, volume, loop, connect);
+
+ },
+
+ /**
+ * Creates a new Sound object.
+ *
+ * @method Phaser.GameObjectCreator#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.GameObjectCreator#tileSprite
+ * @param {number} x - The x coordinate (in world space) to position the TileSprite at.
+ * @param {number} y - The y coordinate (in world space) to position the TileSprite at.
+ * @param {number} width - The width of the TileSprite.
+ * @param {number} height - The height of the TileSprite.
+ * @param {string|Phaser.RenderTexture|Phaser.BitmapData|PIXI.Texture} key - This is the image or texture used by the TileSprite 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 TileSprite 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.
+ * @return {Phaser.TileSprite} The newly created tileSprite object.
+ */
+ tileSprite: function (x, y, width, height, key, frame) {
+
+ return new Phaser.TileSprite(this.game, x, y, width, height, key, frame);
+
+ },
+
+ /**
+ * Creates a new Text object.
+ *
+ * @method Phaser.GameObjectCreator#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.
+ * @return {Phaser.Text} The newly created text object.
+ */
+ text: function (x, y, text, style, group) {
+
+ return new Phaser.Text(this.game, x, y, text, style);
+
+ },
+
+ /**
+ * Creates a new Button object.
+ *
+ * @method Phaser.GameObjectCreator#button
+ * @param {number} [x] X position of the new button object.
+ * @param {number} [y] Y position of the new button object.
+ * @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.
+ * @return {Phaser.Button} The newly created button object.
+ */
+ button: function (x, y, key, callback, callbackContext, overFrame, outFrame, downFrame, upFrame, group) {
+
+ return new Phaser.Button(this.game, x, y, key, callback, callbackContext, overFrame, outFrame, downFrame, upFrame);
+
+ },
+
+ /**
+ * Creates a new Graphics object.
+ *
+ * @method Phaser.GameObjectCreator#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, group) {
+
+ return new Phaser.Graphics(this.game, x, y);
+
+ },
+
+ /**
+ * Emitter is a lightweight particle emitter. It can be used for one-time explosions or for
+ * continuous effects like rain and fire. All it really does is launch Particle objects out
+ * at set intervals, and fixes their positions and velocities accorindgly.
+ *
+ * @method Phaser.GameObjectCreator#emitter
+ * @param {number} [x=0] - The x coordinate within the Emitter that the particles are emitted from.
+ * @param {number} [y=0] - The y coordinate within the Emitter that the particles are emitted from.
+ * @param {number} [maxParticles=50] - The total number of particles in this emitter.
+ * @return {Phaser.Emitter} The newly created emitter object.
+ */
+ emitter: function (x, y, maxParticles) {
+
+ return new Phaser.Particles.Arcade.Emitter(this.game, x, y, maxParticles);
+
+ },
+
+ /**
+ * Create a new BitmapFont object to be used as a texture for an Image or Sprite and optionally add it to the Cache.
+ * The texture can be asssigned or one or multiple images/sprites, but note that the text the BitmapFont uses will be shared across them all,
+ * i.e. if you need each Image to have different text in it, then you need to create multiple BitmapFont objects.
+ *
+ * @method Phaser.GameObjectCreator#bitmapFont
+ * @param {string} font - The key of the image in the Game.Cache that the BitmapFont will use.
+ * @param {number} characterWidth - The width of each character in the font set.
+ * @param {number} characterHeight - The height of each character in the font set.
+ * @param {string} chars - The characters used in the font set, in display order. You can use the TEXT_SET consts for common font set arrangements.
+ * @param {number} charsPerRow - The number of characters per row in the font set.
+ * @param {number} [xSpacing=0] - If the characters in the font set have horizontal spacing between them set the required amount here.
+ * @param {number} [ySpacing=0] - If the characters in the font set have vertical spacing between them set the required amount here.
+ * @param {number} [xOffset=0] - If the font set doesn't start at the top left of the given image, specify the X coordinate offset here.
+ * @param {number} [yOffset=0] - If the font set doesn't start at the top left of the given image, specify the Y coordinate offset here.
+ * @return {Phaser.BitmapFont} The newly created BitmapFont texture which can be applied to an Image or Sprite.
+ */
+ bitmapFont: function (font, characterWidth, characterHeight, chars, charsPerRow, xSpacing, ySpacing, xOffset, yOffset) {
+
+ return new Phaser.BitmapFont(this.game, font, characterWidth, characterHeight, chars, charsPerRow, xSpacing, ySpacing, xOffset, yOffset);
+
+ },
+
+ /**
+ * Create a new BitmapText object.
+ *
+ * @method Phaser.GameObjectCreator#bitmapText
+ * @param {number} x - X position of the new bitmapText object.
+ * @param {number} y - Y position of the new bitmapText object.
+ * @param {string} font - The key of the BitmapText font as stored in Game.Cache.
+ * @param {string} [text] - The actual text that will be rendered. Can be set later via BitmapText.text.
+ * @param {number} [size] - The size the font will be rendered in, in pixels.
+ * @return {Phaser.BitmapText} The newly created bitmapText object.
+ */
+ bitmapText: function (x, y, font, text, size, group) {
+
+ return new Phaser.BitmapText(this.game, x, y, font, text, size);
+
+ },
+
+ /**
+ * Creates a new Tilemap object.
+ *
+ * @method Phaser.GameObjectCreator#tilemap
+ * @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, tilesets) {
+
+ return new Phaser.Tilemap(this.game, key, tilesets);
+
+ },
+
+ /**
+ * A dynamic initially blank canvas to which images can be drawn.
+ *
+ * @method Phaser.GameObjectCreator#renderTexture
+ * @param {number} [width=100] - the width of the RenderTexture.
+ * @param {number} [height=100] - the height of the RenderTexture.
+ * @param {string} [key=''] - Asset key for the RenderTexture when stored in the Cache (see addToCache parameter).
+ * @param {boolean} [addToCache=false] - Should this RenderTexture be added to the Game.Cache? If so you can retrieve it with Cache.getTexture(key)
+ * @return {Phaser.RenderTexture} The newly created RenderTexture object.
+ */
+ renderTexture: function (width, height, key, addToCache) {
+
+ if (typeof key === 'undefined' || key === '') { key = this.game.rnd.uuid(); }
+ if (typeof addToCache === 'undefined') { addToCache = false; }
+
+ var texture = new Phaser.RenderTexture(this.game, width, height, key);
+
+ if (addToCache)
+ {
+ this.game.cache.addRenderTexture(key, texture);
+ }
+
+ return texture;
+
+ },
+
+ /**
+ * A BitmapData object which can be manipulated and drawn to like a traditional Canvas object and used to texture Sprites.
+ *
+ * @method Phaser.GameObjectCreator#bitmapData
+ * @param {number} [width=100] - The width of the BitmapData in pixels.
+ * @param {number} [height=100] - The height of the BitmapData in pixels.
+ * @param {string} [key=''] - Asset key for the BitmapData when stored in the Cache (see addToCache parameter).
+ * @param {boolean} [addToCache=false] - Should this BitmapData be added to the Game.Cache? If so you can retrieve it with Cache.getBitmapData(key)
+ * @return {Phaser.BitmapData} The newly created BitmapData object.
+ */
+ bitmapData: function (width, height, addToCache) {
+
+ if (typeof addToCache === 'undefined') { addToCache = false; }
+ if (typeof key === 'undefined' || key === '') { key = this.game.rnd.uuid(); }
+
+ var texture = new Phaser.BitmapData(this.game, key, width, height);
+
+ if (addToCache)
+ {
+ this.game.cache.addBitmapData(key, texture);
+ }
+
+ return texture;
+
+ },
+
+ /**
+ * A WebGL shader/filter that can be applied to Sprites.
+ *
+ * @method Phaser.GameObjectCreator#filter
+ * @param {string} filter - The name of the filter you wish to create, for example HueRotate or SineWave.
+ * @param {any} - Whatever parameters are needed to be passed to the filter init function.
+ * @return {Phaser.Filter} The newly created Phaser.Filter object.
+ */
+ filter: function (filter) {
+
+ var args = Array.prototype.splice.call(arguments, 1);
+
+ var filter = new Phaser.Filter[filter](this.game);
+
+ filter.init.apply(filter, args);
+
+ return filter;
+
+ }
+
+};
+
+Phaser.GameObjectCreator.prototype.constructor = Phaser.GameObjectCreator;
diff --git a/src/gameobjects/GameObjectFactory.js b/src/gameobjects/GameObjectFactory.js
index be6ac2e4..4320eba6 100644
--- a/src/gameobjects/GameObjectFactory.js
+++ b/src/gameobjects/GameObjectFactory.js
@@ -83,7 +83,7 @@ Phaser.GameObjectFactory.prototype = {
*
* @method Phaser.GameObjectFactory#tween
* @param {object} obj - Object the tween will be run on.
- * @return {Phaser.Tween} Description.
+ * @return {Phaser.Tween} The newly created Phaser.Tween object.
*/
tween: function (obj) {
From d7ababa39872e2e6b934037398fc44c63b84e50a Mon Sep 17 00:00:00 2001
From: photonstorm
Date: Fri, 21 Feb 2014 15:09:04 +0000
Subject: [PATCH 11/27] BitmapData.alphaMask will draw the given image onto a
BitmapData using an image as an alpha mask.
---
README.md | 1 +
examples/wip/alpha-mask.js | 31 ++++-------------
examples/wip/blendmodes.js | 62 +++++++++++++++++++++++++++++++++
src/gameobjects/BitmapData.js | 64 ++++++++++++++++++++++++++++++-----
4 files changed, 124 insertions(+), 34 deletions(-)
create mode 100644 examples/wip/blendmodes.js
diff --git a/README.md b/README.md
index aeed9a2a..b73192ff 100644
--- a/README.md
+++ b/README.md
@@ -135,6 +135,7 @@ Updates:
* World.reset now calls Camera.reset which sends the camera back to 0,0 and un-follows any object it may have been tracking.
* Added hostname: '*' to the grunt-connect in Gruntfile.js (fixes #426)
* Device, Canvas and GamePad classes all updated for better CocoonJS support (thanks Videlais)
+* BitmapData.alphaMask will draw the given image onto a BitmapData using an image as an alpha mask.
Bug Fixes:
diff --git a/examples/wip/alpha-mask.js b/examples/wip/alpha-mask.js
index 137aa40b..72d6824f 100644
--- a/examples/wip/alpha-mask.js
+++ b/examples/wip/alpha-mask.js
@@ -1,10 +1,9 @@
-var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create, update: update, render: render });
-// var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render });
+// var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create, update: update, render: render });
+var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render });
function preload() {
- game.load.image('bg', 'assets/pics/color_wheel_swirl.png');
game.load.image('pic', 'assets/pics/questar.png');
game.load.image('mask1', 'assets/pics/mask-test.png');
game.load.image('mask2', 'assets/pics/mask-test2.png');
@@ -12,34 +11,16 @@ function preload() {
}
var pic;
-var mask;
function create() {
- game.add.image(-200, 0, 'bg');
+ var bmd = game.make.bitmapData(320, 256);
- pic = game.add.sprite(0, 0, 'mask1');
- // pic = game.add.sprite(0, 0, 'pic');
+ bmd.alphaMask('pic', 'mask2');
- // mask.addChild(pic);
+ pic = game.add.sprite(0, 0, bmd);
- // pic.blendMode = Phaser.blendModes.NORMAL;
- // pic.blendMode = Phaser.blendModes.ADD;
- // mask.blendMode = Phaser.blendModes.MULTIPLY;
- // pic.blendMode = Phaser.blendModes.SCREEN;
- // mask.blendMode = Phaser.blendModes.OVERLAY;
- // pic.blendMode = Phaser.blendModes.DARKEN;
- // pic.blendMode = Phaser.blendModes.LIGHTEN;
- // pic.blendMode = Phaser.blendModes.COLOR_DODGE;
- // pic.blendMode = Phaser.blendModes.COLOR_BURN;
- // pic.blendMode = Phaser.blendModes.HARD_LIGHT;
- // pic.blendMode = Phaser.blendModes.SOFT_LIGHT;
- // pic.blendMode = Phaser.blendModes.DIFFERENCE;
- // pic.blendMode = Phaser.blendModes.EXCLUSION;
- // pic.blendMode = Phaser.blendModes.HUE;
- // pic.blendMode = PIXI.blendModes.SATURATION;
- pic.blendMode = Phaser.blendModes.COLOR;
- // pic.blendMode = Phaser.blendModes.LUMINOSITY;
+ pic.scale.set(2);
}
diff --git a/examples/wip/blendmodes.js b/examples/wip/blendmodes.js
new file mode 100644
index 00000000..b8fc2a71
--- /dev/null
+++ b/examples/wip/blendmodes.js
@@ -0,0 +1,62 @@
+
+var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create, update: update, render: render });
+// var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render });
+
+function preload() {
+
+ game.load.image('bg', 'assets/pics/color_wheel_swirl.png');
+ game.load.image('pic', 'assets/pics/questar.png');
+ game.load.image('mask1', 'assets/pics/mask-test.png');
+ game.load.image('mask2', 'assets/pics/mask-test2.png');
+
+}
+
+var pic;
+var mask;
+
+function create() {
+
+ var bmd = game.make.bitmapData(320, 200);
+
+ // bmd.draw('pic');
+
+ bmd.alphaMask('pic', 'mask2');
+
+ pic = game.add.sprite(0, 0, bmd);
+
+ // game.add.image(-200, 0, 'bg');
+
+ // mask = game.add.sprite(0, 0, 'mask1');
+
+ // pic = game.add.sprite(0, 0, 'pic');
+
+ // mask.addChild(pic);
+
+ // pic.blendMode = Phaser.blendModes.NORMAL;
+ // pic.blendMode = Phaser.blendModes.ADD;
+ // pic.blendMode = Phaser.blendModes.MULTIPLY;
+ // pic.blendMode = Phaser.blendModes.SCREEN;
+ // mask.blendMode = Phaser.blendModes.OVERLAY;
+ // pic.blendMode = Phaser.blendModes.DARKEN;
+ // pic.blendMode = Phaser.blendModes.LIGHTEN;
+ // pic.blendMode = Phaser.blendModes.COLOR_DODGE;
+ // pic.blendMode = Phaser.blendModes.COLOR_BURN;
+ // pic.blendMode = Phaser.blendModes.HARD_LIGHT;
+ // pic.blendMode = Phaser.blendModes.SOFT_LIGHT;
+ // pic.blendMode = Phaser.blendModes.DIFFERENCE;
+ // pic.blendMode = Phaser.blendModes.EXCLUSION;
+ // pic.blendMode = Phaser.blendModes.HUE;
+ // pic.blendMode = PIXI.blendModes.SATURATION;
+ // pic.blendMode = Phaser.blendModes.COLOR;
+ // pic.blendMode = Phaser.blendModes.LUMINOSITY;
+
+}
+
+function update() {
+
+
+}
+
+function render() {
+
+}
diff --git a/src/gameobjects/BitmapData.js b/src/gameobjects/BitmapData.js
index 2e8f503c..7a3d313f 100644
--- a/src/gameobjects/BitmapData.js
+++ b/src/gameobjects/BitmapData.js
@@ -278,31 +278,77 @@ Phaser.BitmapData.prototype = {
/**
* Copies the pixels from the source image to this BitmapData based on the given area and destination.
*
- * @param {HTMLImage} source - The Image to copy from. If you want to use an image in Phasers Cache, use game.cache.getImage(key).
+ * @param {HTMLImage|string} source - The Image to draw. If you give a key it will try and find the Image in the Game.Cache.
* @param {Phaser.Rectangle} area - The Rectangle region to copy from the source image.
* @param {number} destX - The destination x coordinate to copy the image to.
* @param {number} destY - The destination y coordinate to copy the image to.
*/
copyPixels: function (source, area, destX, destY) {
- this.context.drawImage(source, area.x, area.y, area.width, area.height, destX, destY, area.width, area.height);
+ if (typeof source === 'string')
+ {
+ source = this.game.cache.getImage(source);
+ }
+
+ if (source)
+ {
+ this.context.drawImage(source, area.x, area.y, area.width, area.height, destX, destY, area.width, area.height);
+ }
},
/**
- * Alpha mask.
+ * Draws the given image to this BitmapData at the coordinates specified. If you need to only draw a part of the image use BitmapData.copyPixels instead.
*
- * @param {HTMLImage} source - The Image to copy from. If you want to use an image in Phasers Cache, use game.cache.getImage(key).
- * @param {Phaser.Rectangle} area - The Rectangle region to copy from the source image.
- * @param {number} destX - The destination x coordinate to copy the image to.
- * @param {number} destY - The destination y coordinate to copy the image to.
+ * @param {HTMLImage|string} source - The Image to draw. If you give a key it will try and find the Image in the Game.Cache.
+ * @param {number} destX - The destination x coordinate to draw the image to.
+ * @param {number} destY - The destination y coordinate to draw the image to.
*/
- alphaMask: function (source) {
+ draw: function (source, destX, destY) {
+
+ if (typeof source === 'string')
+ {
+ source = this.game.cache.getImage(source);
+ }
+
+ if (source)
+ {
+ this.context.drawImage(source, 0, 0, source.width, source.height, destX, destY, source.width, source.height);
+ }
+
+ },
+
+ /**
+ * Draws the given image onto this BitmapData using an image as an alpha mask.
+ *
+ * @param {HTMLImage|string} source - The Image to draw. If you give a key it will try and find the Image in the Game.Cache.
+ * @param {HTMLImage|string} mask - The Image to use as the alpha mask. If you give a key it will try and find the Image in the Game.Cache.
+ */
+ alphaMask: function (source, mask) {
var temp = this.context.globalCompositeOperation;
+ if (typeof mask === 'string')
+ {
+ mask = this.game.cache.getImage(mask);
+ }
+
+ if (mask)
+ {
+ this.context.drawImage(mask, 0, 0);
+ }
+
this.context.globalCompositeOperation = 'source-atop';
- // this.context.drawImage(source, area.x, area.y, area.width, area.height, destX, destY, area.width, area.height);
+
+ if (typeof source === 'string')
+ {
+ source = this.game.cache.getImage(source);
+ }
+
+ if (source)
+ {
+ this.context.drawImage(source, 0, 0);
+ }
this.context.globalCompositeOperation = temp;
From 7ee0c20bb39070c238c20f35e03b7f6f32751528 Mon Sep 17 00:00:00 2001
From: photonstorm
Date: Fri, 21 Feb 2014 15:34:15 +0000
Subject: [PATCH 12/27] Added Debug.renderSpriteBounds() back and wrapped
Body.velocity and force in px2p calls.
---
README.md | 1 +
src/physics/Body.js | 8 ++++----
src/physics/InversePointProxy.js | 8 +++++---
src/physics/PointProxy.js | 8 +++++---
src/utils/Debug.js | 15 +++++++++++++++
5 files changed, 30 insertions(+), 10 deletions(-)
diff --git a/README.md b/README.md
index b73192ff..97f876ef 100644
--- a/README.md
+++ b/README.md
@@ -136,6 +136,7 @@ Updates:
* Added hostname: '*' to the grunt-connect in Gruntfile.js (fixes #426)
* Device, Canvas and GamePad classes all updated for better CocoonJS support (thanks Videlais)
* BitmapData.alphaMask will draw the given image onto a BitmapData using an image as an alpha mask.
+* The new GameObjectCreator (which you access via game.make or State.make) lets you easily create an object but NOT add it to the display list.
Bug Fixes:
diff --git a/src/physics/Body.js b/src/physics/Body.js
index 218e90e0..8c351911 100644
--- a/src/physics/Body.js
+++ b/src/physics/Body.js
@@ -49,14 +49,14 @@ Phaser.Physics.Body = function (game, sprite, x, y, mass) {
this.data.parent = this;
/**
- * @property {Phaser.PointProxy} velocity - The velocity of the body. Set velocity.x to a negative value to move to the left, position to the right. velocity.y negative values move up, positive move down.
+ * @property {Phaser.InversePointProxy} velocity - The velocity of the body. Set velocity.x to a negative value to move to the left, position to the right. velocity.y negative values move up, positive move down.
*/
- this.velocity = new Phaser.Physics.PointProxy(this.data.velocity);
+ this.velocity = new Phaser.Physics.InversePointProxy(this.game, this.data.velocity);
/**
- * @property {Phaser.PointProxy} force - The force applied to the body.
+ * @property {Phaser.InversePointProxy} force - The force applied to the body.
*/
- this.force = new Phaser.Physics.PointProxy(this.data.force);
+ this.force = new Phaser.Physics.InversePointProxy(this.game, this.data.force);
/**
* @property {Phaser.Point} gravity - A locally applied gravity force to the Body. Applied directly before the world step. NOTE: Not currently implemented.
diff --git a/src/physics/InversePointProxy.js b/src/physics/InversePointProxy.js
index db936c9b..c00d9af7 100644
--- a/src/physics/InversePointProxy.js
+++ b/src/physics/InversePointProxy.js
@@ -10,10 +10,12 @@
* @class Phaser.Physics.InversePointProxy
* @classdesc InversePointProxy
* @constructor
+* @param {Phaser.Game} game - A reference to the Phaser.Game instance.
* @param {any} destination - The object to bind to.
*/
-Phaser.Physics.InversePointProxy = function (destination) {
+Phaser.Physics.InversePointProxy = function (game, destination) {
+ this.game = game;
this.destination = destination;
};
@@ -34,7 +36,7 @@ Object.defineProperty(Phaser.Physics.InversePointProxy.prototype, "x", {
set: function (value) {
- this.destination[0] = -value;
+ this.destination[0] = this.game.math.px2p(-value);
}
@@ -54,7 +56,7 @@ Object.defineProperty(Phaser.Physics.InversePointProxy.prototype, "y", {
set: function (value) {
- this.destination[1] = -value;
+ this.destination[1] = this.game.math.px2p(-value);
}
diff --git a/src/physics/PointProxy.js b/src/physics/PointProxy.js
index 57b43083..409ef782 100644
--- a/src/physics/PointProxy.js
+++ b/src/physics/PointProxy.js
@@ -10,10 +10,12 @@
* @class Phaser.Physics.PointProxy
* @classdesc PointProxy
* @constructor
+* @param {Phaser.Game} game - A reference to the Phaser.Game instance.
* @param {any} destination - The object to bind to.
*/
-Phaser.Physics.PointProxy = function (destination) {
+Phaser.Physics.PointProxy = function (game, destination) {
+ this.game = game;
this.destination = destination;
};
@@ -34,7 +36,7 @@ Object.defineProperty(Phaser.Physics.PointProxy.prototype, "x", {
set: function (value) {
- this.destination[0] = value;
+ this.destination[0] = this.game.math.px2p(value);
}
@@ -54,7 +56,7 @@ Object.defineProperty(Phaser.Physics.PointProxy.prototype, "y", {
set: function (value) {
- this.destination[1] = value;
+ this.destination[1] = this.game.math.px2p(value);
}
diff --git a/src/utils/Debug.js b/src/utils/Debug.js
index 2dedd032..a7a64b35 100644
--- a/src/utils/Debug.js
+++ b/src/utils/Debug.js
@@ -350,6 +350,21 @@ Phaser.Utils.Debug.prototype = {
},
+ /**
+ * Renders the Sprites bounds. Note: This is really expensive as it has to calculate the bounds every time you call it!
+ * @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} [filled=true] - Render the rectangle as a fillRect (default, true) or a strokeRect (false)
+ */
+ renderSpriteBounds: function (sprite, color, filled) {
+
+ var bounds = sprite.getBounds();
+
+ this.renderRectangle(bounds, color, filled);
+
+ },
+
/**
* Render debug infos (including name, bounds info, position and some other properties) about the Sprite.
* @method Phaser.Utils.Debug#renderSpriteInfo
From e9e5bf9436f1bd2c6fa50b671fb522e45b3773f6 Mon Sep 17 00:00:00 2001
From: photonstorm
Date: Fri, 21 Feb 2014 15:37:26 +0000
Subject: [PATCH 13/27] Updated docs - they now actually list the new body
methods :)
---
docs/Animation.js.html | 40 +-
docs/AnimationManager.js.html | 38 +-
docs/AnimationParser.js.html | 38 +-
docs/ArcadePhysics.js.html | 38 +-
docs/BitmapData.js.html | 128 +-
docs/BitmapFont.js.html | 38 +-
docs/BitmapText.js.html | 67 +-
docs/Body.js.html | 2391 ++--
docs/Button.js.html | 44 +-
docs/Cache.js.html | 38 +-
docs/Camera.js.html | 38 +-
docs/Canvas.js.html | 38 +-
docs/Circle.js.html | 38 +-
docs/CollisionGroup.js.html | 574 +
docs/Color.js.html | 38 +-
docs/ContactMaterial.js.html | 617 +
docs/Debug.js.html | 228 +-
docs/Device.js.html | 38 +-
docs/Easing.js.html | 38 +-
docs/Ellipse.js.html | 38 +-
docs/Emitter.js.html | 38 +-
docs/Events.js.html | 38 +-
docs/Filter.js.html | 38 +-
docs/Frame.js.html | 38 +-
docs/FrameData.js.html | 38 +-
docs/Game.js.html | 69 +-
docs/GameObjectCreator.js.html | 913 ++
docs/GameObjectFactory.js.html | 42 +-
docs/Gamepad.js.html | 38 +-
docs/GamepadButton.js.html | 38 +-
docs/Graphics.js.html | 42 +-
docs/Group.js.html | 66 +-
docs/Image.js.html | 52 +-
docs/Input.js.html | 38 +-
docs/InputHandler.js.html | 46 +-
docs/InversePointProxy.js.html | 616 +
docs/Key.js.html | 38 +-
docs/Keyboard.js.html | 38 +-
docs/Line.js.html | 40 +-
docs/LinkedList.js.html | 38 +-
docs/Loader.js.html | 38 +-
docs/LoaderParser.js.html | 38 +-
docs/MSPointer.js.html | 38 +-
docs/Material.js.html | 580 +
docs/Math.js.html | 73 +-
docs/Mouse.js.html | 38 +-
docs/Net.js.html | 38 +-
docs/Particles.js.html | 38 +-
docs/Phaser.Animation.html | 38 +-
docs/Phaser.AnimationManager.html | 38 +-
docs/Phaser.AnimationParser.html | 38 +-
docs/Phaser.BitmapData.html | 562 +-
docs/Phaser.BitmapFont.html | 423 +-
docs/Phaser.BitmapText.html | 62 +-
docs/Phaser.Button.html | 74 +-
docs/Phaser.Cache.html | 38 +-
docs/Phaser.Camera.html | 38 +-
docs/Phaser.Canvas.html | 38 +-
docs/Phaser.Circle.html | 38 +-
docs/Phaser.Color.html | 38 +-
docs/Phaser.Device.html | 38 +-
docs/Phaser.Easing.Back.html | 38 +-
docs/Phaser.Easing.Bounce.html | 38 +-
docs/Phaser.Easing.Circular.html | 38 +-
docs/Phaser.Easing.Cubic.html | 38 +-
docs/Phaser.Easing.Elastic.html | 38 +-
docs/Phaser.Easing.Exponential.html | 38 +-
docs/Phaser.Easing.Linear.html | 38 +-
docs/Phaser.Easing.Quadratic.html | 38 +-
docs/Phaser.Easing.Quartic.html | 38 +-
docs/Phaser.Easing.Quintic.html | 38 +-
docs/Phaser.Easing.Sinusoidal.html | 38 +-
docs/Phaser.Easing.html | 38 +-
docs/Phaser.Ellipse.html | 38 +-
docs/Phaser.Events.html | 38 +-
docs/Phaser.Filter.html | 38 +-
docs/Phaser.Frame.html | 38 +-
docs/Phaser.FrameData.html | 38 +-
docs/Phaser.Game.html | 212 +-
docs/Phaser.GameObjectCreator.html | 5577 +++++++++
docs/Phaser.GameObjectFactory.html | 46 +-
docs/Phaser.Gamepad.html | 180 +-
docs/Phaser.GamepadButton.html | 38 +-
docs/Phaser.Graphics.html | 177 +-
docs/Phaser.Group.html | 451 +-
docs/Phaser.Image.html | 64 +-
docs/Phaser.Input.html | 38 +-
docs/Phaser.InputHandler.html | 320 +-
docs/Phaser.Key.html | 38 +-
docs/Phaser.Keyboard.html | 38 +-
docs/Phaser.Line.html | 584 +-
docs/Phaser.LinkedList.html | 38 +-
docs/Phaser.Loader.html | 38 +-
docs/Phaser.LoaderParser.html | 38 +-
docs/Phaser.MSPointer.html | 38 +-
docs/Phaser.Math.html | 748 +-
docs/Phaser.Mouse.html | 38 +-
docs/Phaser.Net.html | 38 +-
docs/Phaser.Particles.Arcade.Emitter.html | 430 +-
docs/Phaser.Particles.html | 38 +-
docs/Phaser.Physics.Arcade.html | 38 +-
docs/Phaser.Physics.Body.html | 11896 +++++++++++++++++++
docs/Phaser.Physics.CollisionGroup.html | 765 ++
docs/Phaser.Physics.ContactMaterial.html | 782 ++
docs/Phaser.Physics.InversePointProxy.html | 939 ++
docs/Phaser.Physics.Material.html | 768 ++
docs/Phaser.Physics.PointProxy.html | 939 ++
docs/Phaser.Physics.Spring.html | 1165 ++
docs/Phaser.Physics.World.html | 7502 ++++++++++++
docs/Phaser.Physics.html | 1508 ++-
docs/Phaser.Plugin.html | 38 +-
docs/Phaser.PluginManager.html | 38 +-
docs/Phaser.Point.html | 38 +-
docs/Phaser.Pointer.html | 38 +-
docs/Phaser.Polygon.html | 38 +-
docs/Phaser.RandomDataGenerator.html | 38 +-
docs/Phaser.Rectangle.html | 38 +-
docs/Phaser.RenderTexture.html | 558 +-
docs/Phaser.RequestAnimationFrame.html | 215 +-
docs/Phaser.Signal.html | 38 +-
docs/Phaser.SinglePad.html | 854 +-
docs/Phaser.Sound.html | 38 +-
docs/Phaser.SoundManager.html | 38 +-
docs/Phaser.Sprite.html | 269 +-
docs/Phaser.SpriteBatch.html | 444 +-
docs/Phaser.Stage.html | 38 +-
docs/Phaser.StageScaleMode.html | 38 +-
docs/Phaser.State.html | 38 +-
docs/Phaser.StateManager.html | 54 +-
docs/Phaser.Text.html | 114 +-
docs/Phaser.Tile.html | 38 +-
docs/Phaser.TileSprite.html | 48 +-
docs/Phaser.Tilemap.html | 38 +-
docs/Phaser.TilemapLayer.html | 38 +-
docs/Phaser.TilemapParser.html | 40 +-
docs/Phaser.Tileset.html | 38 +-
docs/Phaser.Time.html | 38 +-
docs/Phaser.Timer.html | 38 +-
docs/Phaser.TimerEvent.html | 38 +-
docs/Phaser.Touch.html | 38 +-
docs/Phaser.Tween.html | 38 +-
docs/Phaser.TweenManager.html | 176 +-
docs/Phaser.Utils.Debug.html | 1181 +-
docs/Phaser.Utils.html | 38 +-
docs/Phaser.World.html | 470 +-
docs/Phaser.html | 44 +-
docs/Phaser.js.html | 61 +-
docs/Plugin.js.html | 38 +-
docs/PluginManager.js.html | 38 +-
docs/Point.js.html | 38 +-
docs/PointProxy.js.html | 616 +
docs/Pointer.js.html | 38 +-
docs/Polygon.js.html | 38 +-
docs/RandomDataGenerator.js.html | 38 +-
docs/Rectangle.js.html | 38 +-
docs/RenderTexture.js.html | 80 +-
docs/RequestAnimationFrame.js.html | 50 +-
docs/Signal.js.html | 38 +-
docs/SignalBinding.html | 38 +-
docs/SignalBinding.js.html | 38 +-
docs/SinglePad.js.html | 54 +-
docs/Sound.js.html | 38 +-
docs/SoundManager.js.html | 38 +-
docs/Spring.js.html | 619 +
docs/Sprite.js.html | 54 +-
docs/SpriteBatch.js.html | 38 +-
docs/Stage.js.html | 38 +-
docs/StageScaleMode.js.html | 38 +-
docs/State.js.html | 38 +-
docs/StateManager.js.html | 39 +-
docs/Text.js.html | 59 +-
docs/Tile.js.html | 38 +-
docs/TileSprite.js.html | 47 +-
docs/Tilemap.js.html | 38 +-
docs/TilemapLayer.js.html | 38 +-
docs/TilemapParser.js.html | 40 +-
docs/Tileset.js.html | 38 +-
docs/Time.js.html | 38 +-
docs/Timer.js.html | 38 +-
docs/TimerEvent.js.html | 38 +-
docs/Touch.js.html | 38 +-
docs/Tween.js.html | 38 +-
docs/TweenManager.js.html | 40 +-
docs/Utils.js.html | 38 +-
docs/World.js.html | 1221 +-
docs/World.js_.html | 766 ++
docs/build/conf.json | 2 +-
docs/classes.list.html | 68 +-
docs/global.html | 38 +-
docs/index.html | 42 +-
docs/namespaces.list.html | 68 +-
examples/wip/tilemap3.js | 41 +
192 files changed, 51286 insertions(+), 4396 deletions(-)
create mode 100644 docs/CollisionGroup.js.html
create mode 100644 docs/ContactMaterial.js.html
create mode 100644 docs/GameObjectCreator.js.html
create mode 100644 docs/InversePointProxy.js.html
create mode 100644 docs/Material.js.html
create mode 100644 docs/Phaser.GameObjectCreator.html
create mode 100644 docs/Phaser.Physics.Body.html
create mode 100644 docs/Phaser.Physics.CollisionGroup.html
create mode 100644 docs/Phaser.Physics.ContactMaterial.html
create mode 100644 docs/Phaser.Physics.InversePointProxy.html
create mode 100644 docs/Phaser.Physics.Material.html
create mode 100644 docs/Phaser.Physics.PointProxy.html
create mode 100644 docs/Phaser.Physics.Spring.html
create mode 100644 docs/Phaser.Physics.World.html
create mode 100644 docs/PointProxy.js.html
create mode 100644 docs/Spring.js.html
create mode 100644 docs/World.js_.html
create mode 100644 examples/wip/tilemap3.js
diff --git a/docs/Animation.js.html b/docs/Animation.js.html
index 6339bf6e..87ceb7ce 100644
--- a/docs/Animation.js.html
+++ b/docs/Animation.js.html
@@ -166,6 +166,10 @@
Game
+
@@ -923,7 +959,7 @@ Object.defineProperty(Phaser.AnimationManager.prototype, 'frameName', {
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:20 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:21 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/AnimationParser.js.html b/docs/AnimationParser.js.html
index 4901a322..a39ea9fa 100644
--- a/docs/AnimationParser.js.html
+++ b/docs/AnimationParser.js.html
@@ -166,6 +166,10 @@
Game
+
@@ -789,7 +825,7 @@ Phaser.AnimationParser = {
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:20 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:21 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/ArcadePhysics.js.html b/docs/ArcadePhysics.js.html
index 913fc646..4c797faf 100644
--- a/docs/ArcadePhysics.js.html
+++ b/docs/ArcadePhysics.js.html
@@ -166,6 +166,10 @@
Game
+
@@ -1891,7 +1927,7 @@ Phaser.Physics.Arcade.prototype.constructor = Phaser.Physics.Arcade;
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:20 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:22 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/BitmapData.js.html b/docs/BitmapData.js.html
index e44b9b71..ca4ed830 100644
--- a/docs/BitmapData.js.html
+++ b/docs/BitmapData.js.html
@@ -166,6 +166,10 @@
Game
+
@@ -563,7 +599,7 @@ Phaser.BitmapData = function (game, key, width, height) {
Phaser.BitmapData.prototype = {
/**
- * Updates the given objects so that they use this BitmapData as their texture.
+ * Updates the given objects so that they use this BitmapData as their texture. This will replace any texture they will currently have set.
*
* @method Phaser.BitmapData#add
* @param {Phaser.Sprite|Phaser.Sprite[]|Phaser.Image|Phaser.Image[]} object - Either a single Sprite/Image or an Array of Sprites/Images.
@@ -672,6 +708,7 @@ Phaser.BitmapData.prototype = {
/**
* Sets the color of the given pixel to the specified red, green and blue values.
+ *
* @method Phaser.BitmapData#setPixel
* @param {number} x - The X coordinate of the pixel to be set.
* @param {number} y - The Y coordinate of the pixel to be set.
@@ -686,7 +723,8 @@ Phaser.BitmapData.prototype = {
},
/**
- * Get a color of a specific pixel.
+ * Get the color of a specific pixel.
+ *
* @param {number} x - The X coordinate of the pixel to get.
* @param {number} y - The Y coordinate of the pixel to get.
* @return {number} A native color value integer (format: 0xRRGGBB)
@@ -701,7 +739,8 @@ Phaser.BitmapData.prototype = {
},
/**
- * Get a color of a specific pixel (including alpha value).
+ * Get the color of a specific pixel including its alpha value.
+ *
* @param {number} x - The X coordinate of the pixel to get.
* @param {number} y - The Y coordinate of the pixel to get.
* @return {number} A native color value integer (format: 0xAARRGGBB)
@@ -716,8 +755,9 @@ Phaser.BitmapData.prototype = {
},
/**
- * Get pixels in array in a specific Rectangle.
- * @param rect {Rectangle} The specific Rectangle.
+ * Gets all the pixels from the region specified by the given Rectangle object.
+ *
+ * @param {Phaser.Rectangle} rect - The Rectangle region to get.
* @return {array} CanvasPixelArray.
*/
getPixels: function (rect) {
@@ -726,15 +766,89 @@ Phaser.BitmapData.prototype = {
},
+ /**
+ * Copies the pixels from the source image to this BitmapData based on the given area and destination.
+ *
+ * @param {HTMLImage|string} source - The Image to draw. If you give a key it will try and find the Image in the Game.Cache.
+ * @param {Phaser.Rectangle} area - The Rectangle region to copy from the source image.
+ * @param {number} destX - The destination x coordinate to copy the image to.
+ * @param {number} destY - The destination y coordinate to copy the image to.
+ */
copyPixels: function (source, area, destX, destY) {
- this.context.drawImage(source, area.x, area.y, area.width, area.height, destX, destY, area.width, area.height);
+ if (typeof source === 'string')
+ {
+ source = this.game.cache.getImage(source);
+ }
+
+ if (source)
+ {
+ this.context.drawImage(source, area.x, area.y, area.width, area.height, destX, destY, area.width, area.height);
+ }
+
+ },
+
+ /**
+ * Draws the given image to this BitmapData at the coordinates specified. If you need to only draw a part of the image use BitmapData.copyPixels instead.
+ *
+ * @param {HTMLImage|string} source - The Image to draw. If you give a key it will try and find the Image in the Game.Cache.
+ * @param {number} destX - The destination x coordinate to draw the image to.
+ * @param {number} destY - The destination y coordinate to draw the image to.
+ */
+ draw: function (source, destX, destY) {
+
+ if (typeof source === 'string')
+ {
+ source = this.game.cache.getImage(source);
+ }
+
+ if (source)
+ {
+ this.context.drawImage(source, 0, 0, source.width, source.height, destX, destY, source.width, source.height);
+ }
+
+ },
+
+ /**
+ * Draws the given image onto this BitmapData using an image as an alpha mask.
+ *
+ * @param {HTMLImage|string} source - The Image to draw. If you give a key it will try and find the Image in the Game.Cache.
+ * @param {HTMLImage|string} mask - The Image to use as the alpha mask. If you give a key it will try and find the Image in the Game.Cache.
+ */
+ alphaMask: function (source, mask) {
+
+ var temp = this.context.globalCompositeOperation;
+
+ if (typeof mask === 'string')
+ {
+ mask = this.game.cache.getImage(mask);
+ }
+
+ if (mask)
+ {
+ this.context.drawImage(mask, 0, 0);
+ }
+
+ this.context.globalCompositeOperation = 'source-atop';
+
+ if (typeof source === 'string')
+ {
+ source = this.game.cache.getImage(source);
+ }
+
+ if (source)
+ {
+ this.context.drawImage(source, 0, 0);
+ }
+
+ this.context.globalCompositeOperation = temp;
},
/**
* If the game is running in WebGL this will push the texture up to the GPU if it's dirty.
* This is called automatically if the BitmapData is being used by a Sprite, otherwise you need to remember to call it in your render function.
+ *
* @method Phaser.BitmapData#render
*/
render: function () {
@@ -776,7 +890,7 @@ Phaser.BitmapData.prototype.constructor = Phaser.BitmapData;
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:20 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:21 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/BitmapFont.js.html b/docs/BitmapFont.js.html
index 2e875619..72b4be78 100644
--- a/docs/BitmapFont.js.html
+++ b/docs/BitmapFont.js.html
@@ -166,6 +166,10 @@
Game
+
@@ -1046,7 +1082,7 @@ Object.defineProperty(Phaser.BitmapFont.prototype, "text", {
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:20 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:21 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/BitmapText.js.html b/docs/BitmapText.js.html
index fed0d413..d6b83f32 100644
--- a/docs/BitmapText.js.html
+++ b/docs/BitmapText.js.html
@@ -166,6 +166,10 @@
Game
+
/**
+* @author Richard Davey <rich@photonstorm.com>
+* @copyright 2014 Photon Storm Ltd.
+* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+*/
+
+/**
+* Defines a physics material
+*
+* @class Phaser.Physics.ContactMaterial
+* @classdesc Physics ContactMaterial Constructor
+* @constructor
+* @param {Phaser.Physics.Material} materialA
+* @param {Phaser.Physics.Material} materialB
+* @param {object} [options]
+*/
+Phaser.Physics.ContactMaterial = function (materialA, materialB, options) {
+
+ /**
+ * @property {number} id - The contact material identifier.
+ */
+
+ /**
+ * @property {Phaser.Physics.Material} materialA - First material participating in the contact material.
+ */
+
+ /**
+ * @property {Phaser.Physics.Material} materialB - First second participating in the contact material.
+ */
+
+ /**
+ * @property {number} [friction=0.3] - Friction to use in the contact of these two materials.
+ */
+
+ /**
+ * @property {number} [restitution=0.0] - Restitution to use in the contact of these two materials.
+ */
+
+ /**
+ * @property {number} [stiffness=1e7] - Stiffness of the resulting ContactEquation that this ContactMaterial generate.
+ */
+
+ /**
+ * @property {number} [relaxation=3] - Relaxation of the resulting ContactEquation that this ContactMaterial generate.
+ */
+
+ /**
+ * @property {number} [frictionStiffness=1e7] - Stiffness of the resulting FrictionEquation that this ContactMaterial generate.
+ */
+
+ /**
+ * @property {number} [frictionRelaxation=3] - Relaxation of the resulting FrictionEquation that this ContactMaterial generate.
+ */
+
+ /**
+ * @property {number} [surfaceVelocity=0] - Will add surface velocity to this material. If bodyA rests on top if bodyB, and the surface velocity is positive, bodyA will slide to the right.
+ */
+
+ p2.ContactMaterial.call(this, materialA, materialB, options);
+
+}
+
+Phaser.Physics.ContactMaterial.prototype = Object.create(p2.ContactMaterial.prototype);
+Phaser.Physics.ContactMaterial.prototype.constructor = Phaser.Physics.ContactMaterial;
+
@@ -532,7 +568,7 @@ Phaser.Utils.Debug.prototype = {
*/
start: function (x, y, color, columnWidth) {
- if (this.context == null)
+ if (this.context === null)
{
return;
}
@@ -577,7 +613,7 @@ Phaser.Utils.Debug.prototype = {
*/
line: function (text, x, y) {
- if (this.context == null)
+ if (this.context === null)
{
return;
}
@@ -604,7 +640,7 @@ Phaser.Utils.Debug.prototype = {
*/
splitline: function (text) {
- if (this.context == null)
+ if (this.context === null)
{
return;
}
@@ -629,46 +665,6 @@ Phaser.Utils.Debug.prototype = {
},
- /**
- * Visually renders a QuadTree to the display.
- * @method Phaser.Utils.Debug#renderQuadTree
- * @param {Phaser.QuadTree} quadtree - The quadtree to render.
- * @param {string} color - The color of the lines in the quadtree.
- */
- renderQuadTree: function (quadtree, color) {
-
- color = color || 'rgba(255,0,0,0.3)';
-
- this.start();
-
- var bounds = quadtree.bounds;
-
- if (quadtree.nodes.length === 0)
- {
- this.context.strokeStyle = color;
- this.context.strokeRect(bounds.x, bounds.y, bounds.width, bounds.height);
- this.renderText(quadtree.ID + ' / ' + quadtree.objects.length, bounds.x + 4, bounds.y + 16, 'rgb(0,200,0)', '12px Courier');
-
- this.context.strokeStyle = 'rgb(0,255,0)';
-
- // children
- for (var i = 0; i < quadtree.objects.length; i++)
- {
- this.context.strokeRect(quadtree.objects[i].x, quadtree.objects[i].y, quadtree.objects[i].width, quadtree.objects[i].height);
- }
- }
- else
- {
- for (var i = 0; i < quadtree.nodes.length; i++)
- {
- this.renderQuadTree(quadtree.nodes[i]);
- }
- }
-
- this.stop();
-
- },
-
/**
* Render Sound information, including decoded state, duration, volume and more.
* @method Phaser.Utils.Debug#renderSoundInfo
@@ -679,7 +675,7 @@ Phaser.Utils.Debug.prototype = {
*/
renderSoundInfo: function (sound, x, y, color) {
- if (this.context == null)
+ if (this.context === null)
{
return;
}
@@ -716,7 +712,7 @@ Phaser.Utils.Debug.prototype = {
*/
renderCameraInfo: function (camera, x, y, color) {
- if (this.context == null)
+ if (this.context === null)
{
return;
}
@@ -743,7 +739,7 @@ Phaser.Utils.Debug.prototype = {
*/
renderPointer: function (pointer, hideIfUp, downColor, upColor, color) {
- if (this.context == null || pointer == null)
+ if (this.context === null || pointer == null)
{
return;
}
@@ -802,6 +798,11 @@ Phaser.Utils.Debug.prototype = {
*/
renderSpriteInputInfo: function (sprite, x, y, color) {
+ if (this.context === null)
+ {
+ return;
+ }
+
color = color || 'rgb(255,255,255)';
this.start(x, y, color);
@@ -823,7 +824,7 @@ Phaser.Utils.Debug.prototype = {
*/
renderInputInfo: function (x, y, color) {
- if (this.context == null)
+ if (this.context === null)
{
return;
}
@@ -840,6 +841,21 @@ Phaser.Utils.Debug.prototype = {
},
+ /**
+ * Renders the Sprites bounds. Note: This is really expensive as it has to calculate the bounds every time you call it!
+ * @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} [filled=true] - Render the rectangle as a fillRect (default, true) or a strokeRect (false)
+ */
+ renderSpriteBounds: function (sprite, color, filled) {
+
+ var bounds = sprite.getBounds();
+
+ this.renderRectangle(bounds, color, filled);
+
+ },
+
/**
* Render debug infos (including name, bounds info, position and some other properties) about the Sprite.
* @method Phaser.Utils.Debug#renderSpriteInfo
@@ -850,7 +866,7 @@ Phaser.Utils.Debug.prototype = {
*/
renderSpriteInfo: function (sprite, x, y, color) {
- if (this.context == null)
+ if (this.context === null)
{
return;
}
@@ -897,7 +913,7 @@ Phaser.Utils.Debug.prototype = {
*/
renderSpriteCoords: function (sprite, x, y, color) {
- if (this.context == null)
+ if (this.context === null)
{
return;
}
@@ -927,7 +943,7 @@ Phaser.Utils.Debug.prototype = {
*/
renderLine: function (line, color) {
- if (this.context == null)
+ if (this.context === null)
{
return;
}
@@ -955,7 +971,7 @@ Phaser.Utils.Debug.prototype = {
*/
renderLineInfo: function (line, x, y, color) {
- if (this.context == null)
+ if (this.context === null)
{
return;
}
@@ -980,7 +996,7 @@ Phaser.Utils.Debug.prototype = {
*/
renderPointInfo: function (point, x, y, color) {
- if (this.context == null)
+ if (this.context === null)
{
return;
}
@@ -1002,7 +1018,7 @@ Phaser.Utils.Debug.prototype = {
*/
renderPixel: function (x, y, color) {
- if (this.context == null)
+ if (this.context === null)
{
return;
}
@@ -1024,7 +1040,7 @@ Phaser.Utils.Debug.prototype = {
*/
renderPoint: function (point, color) {
- if (this.context == null)
+ if (this.context === null)
{
return;
}
@@ -1047,7 +1063,7 @@ Phaser.Utils.Debug.prototype = {
*/
renderRectangle: function (rect, color, filled) {
- if (this.context == null)
+ if (this.context === null)
{
return;
}
@@ -1081,7 +1097,7 @@ Phaser.Utils.Debug.prototype = {
*/
renderCircle: function (circle, color) {
- if (this.context == null)
+ if (this.context === null)
{
return;
}
@@ -1109,7 +1125,7 @@ Phaser.Utils.Debug.prototype = {
*/
renderText: function (text, x, y, color, font) {
- if (this.context == null)
+ if (this.context === null)
{
return;
}
@@ -1135,6 +1151,11 @@ Phaser.Utils.Debug.prototype = {
*/
renderBodyInfo: function (sprite, x, y, color) {
+ if (this.context === null)
+ {
+ return;
+ }
+
color = color || 'rgb(255,255,255)';
this.start(x, y, color, 210);
@@ -1153,12 +1174,12 @@ Phaser.Utils.Debug.prototype = {
/**
* @method Phaser.Utils.Debug#renderPhysicsBody
- * @param {Phaser.Body} body - The Phaser.Body instance to render all shapes from.
+ * @param {Phaser.Physics.Body} body - The Phaser.Physics.Body instance to render all shapes from.
* @param {string} [color='rgb(255,255,255)'] - The color the polygon is stroked in.
*/
- renderPhysicsBody: function (body, color, context) {
+ renderPhysicsBody: function (body, color) {
- if (this.context === null && context === null)
+ if (this.context === null)
{
return;
}
@@ -1172,8 +1193,8 @@ Phaser.Utils.Debug.prototype = {
var shapeAngles = body.data.shapeAngles;
var i = shapes.length;
- var x = this.game.math.p2px(body.data.position[0]) - this.game.camera.view.x;
- var y = this.game.math.p2px(body.data.position[1]) - this.game.camera.view.y;
+ var x = this.game.math.p2pxi(body.data.position[0]) - this.game.camera.view.x;
+ var y = this.game.math.p2pxi(body.data.position[1]) - this.game.camera.view.y;
var angle = body.data.angle;
while (i--)
@@ -1186,11 +1207,14 @@ Phaser.Utils.Debug.prototype = {
{
this.renderShapeLine(x, y, angle, shapes[i], shapeOffsets[i], shapeAngles[i]);
}
- // else if (shapes[i] instanceof p2.Convex)
- else
+ else if (shapes[i] instanceof p2.Convex)
{
this.renderShapeConvex(x, y, angle, shapes[i], shapeOffsets[i], shapeAngles[i]);
}
+ else if (shapes[i] instanceof p2.Circle)
+ {
+ this.renderShapeCircle(x, y, angle, shapes[i], shapeOffsets[i], shapeAngles[i]);
+ }
}
this.stop();
@@ -1198,11 +1222,15 @@ Phaser.Utils.Debug.prototype = {
},
/**
- * @method Phaser.Utils.Debug#renderShape
+ * Renders a p2.Rectangle shape. Do not call this directly - instead use Debug.renderPhysicsBody.
+ *
+ * @method Phaser.Utils.Debug#renderShapeRectangle
+ * @param {number} x - The x coordinate of the Shape to translate to.
+ * @param {number} y - The y coordinate of the Shape to translate to.
+ * @param {number} bodyAngle - The angle of the Body to rotate to.
* @param {p2.Shape} shape - The shape to render.
- * @param {number} x - The x coordinate of the Body to translate to.
- * @param {number} y - The y coordinate of the Body to translate to.
- * @param {number} angle - The angle of the Body to rotate to.
+ * @param {array} offset - The shape offset vector.
+ * @param {number} angle - The shape angle.
*/
renderShapeRectangle: function (x, y, bodyAngle, shape, offset, angle) {
@@ -1212,14 +1240,14 @@ Phaser.Utils.Debug.prototype = {
this.context.beginPath();
this.context.save();
- this.context.translate(x + this.game.math.p2px(offset[0]), y + this.game.math.p2px(offset[1]));
+ this.context.translate(x + this.game.math.p2pxi(offset[0]), y + this.game.math.p2pxi(offset[1]));
this.context.rotate(bodyAngle + angle);
- this.context.moveTo(this.game.math.p2px(points[0][0]), this.game.math.p2px(points[0][1]));
+ this.context.moveTo(this.game.math.p2pxi(points[0][0]), this.game.math.p2pxi(points[0][1]));
for (var i = 1; i < points.length; i++)
{
- this.context.lineTo(this.game.math.p2px(points[i][0]), this.game.math.p2px(points[i][1]));
+ this.context.lineTo(this.game.math.p2pxi(points[i][0]), this.game.math.p2pxi(points[i][1]));
}
this.context.closePath();
@@ -1229,12 +1257,15 @@ Phaser.Utils.Debug.prototype = {
},
/**
- * @method Phaser.Utils.Debug#renderShape
- * @param {number} x - The x coordinate of the Body to translate to.
- * @param {number} y - The y coordinate of the Body to translate to.
+ * Renders a p2.Line shape. Do not call this directly - instead use Debug.renderPhysicsBody.
+ *
+ * @method Phaser.Utils.Debug#renderShapeLine
+ * @param {number} x - The x coordinate of the Shape to translate to.
+ * @param {number} y - The y coordinate of the Shape to translate to.
+ * @param {number} bodyAngle - The angle of the Body to rotate to.
* @param {p2.Shape} shape - The shape to render.
- * @param {number} offset -
- * @param {number} angle -
+ * @param {array} offset - The shape offset vector.
+ * @param {number} angle - The shape angle.
*/
renderShapeLine: function (x, y, bodyAngle, shape, offset, angle) {
@@ -1252,11 +1283,15 @@ Phaser.Utils.Debug.prototype = {
},
/**
- * @method Phaser.Utils.Debug#renderShape
+ * Renders a convex shape. Do not call this directly - instead use Debug.renderPhysicsBody.
+ *
+ * @method Phaser.Utils.Debug#renderShapeConvex
+ * @param {number} x - The x coordinate of the Shape to translate to.
+ * @param {number} y - The y coordinate of the Shape to translate to.
+ * @param {number} bodyAngle - The angle of the Body to rotate to.
* @param {p2.Shape} shape - The shape to render.
- * @param {number} x - The x coordinate of the Body to translate to.
- * @param {number} y - The y coordinate of the Body to translate to.
- * @param {number} angle - The angle of the Body to rotate to.
+ * @param {array} offset - The shape offset vector.
+ * @param {number} angle - The shape angle.
*/
renderShapeConvex: function (x, y, bodyAngle, shape, offset, angle) {
@@ -1264,16 +1299,41 @@ Phaser.Utils.Debug.prototype = {
this.context.beginPath();
this.context.save();
- this.context.translate(x + this.game.math.p2px(offset[0]), y + this.game.math.p2px(offset[1]));
+ this.context.translate(x + this.game.math.p2pxi(offset[0]), y + this.game.math.p2pxi(offset[1]));
this.context.rotate(bodyAngle + angle);
- this.context.moveTo(this.game.math.p2px(points[0][0]), this.game.math.p2px(points[0][1]));
+ this.context.moveTo(this.game.math.p2pxi(points[0][0]), this.game.math.p2pxi(points[0][1]));
for (var i = 1; i < points.length; i++)
{
- this.context.lineTo(this.game.math.p2px(points[i][0]), this.game.math.p2px(points[i][1]));
+ this.context.lineTo(this.game.math.p2pxi(points[i][0]), this.game.math.p2pxi(points[i][1]));
}
+ // this.context.arc(0, 0, this.game.math.p2px(shape.radius) , 0, Math.PI * 2);
+
+ this.context.closePath();
+ this.context.stroke();
+ this.context.restore();
+
+ },
+
+ /**
+ * Renders a p2.Circle shape. Do not call this directly - instead use Debug.renderPhysicsBody.
+ *
+ * @method Phaser.Utils.Debug#renderShapeCircle
+ * @param {number} x - The x coordinate of the Shape to translate to.
+ * @param {number} y - The y coordinate of the Shape to translate to.
+ * @param {number} bodyAngle - The angle of the Body to rotate to.
+ * @param {p2.Shape} shape - The shape to render.
+ * @param {array} offset - The shape offset vector.
+ * @param {number} angle - The shape angle.
+ */
+ renderShapeCircle: function (x, y, bodyAngle, shape, offset, angle) {
+
+ this.context.beginPath();
+ this.context.save();
+ this.context.translate(x + this.game.math.p2pxi(offset[0]), y + this.game.math.p2pxi(offset[1]));
+ this.context.arc(0, 0, this.game.math.p2px(shape.radius) , 0, Math.PI * 2);
this.context.closePath();
this.context.stroke();
this.context.restore();
@@ -1304,7 +1364,7 @@ Phaser.Utils.Debug.prototype.constructor = Phaser.Utils.Debug;
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:20 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:22 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Device.js.html b/docs/Device.js.html
index b8ced9de..0c9d8eec 100644
--- a/docs/Device.js.html
+++ b/docs/Device.js.html
@@ -166,6 +166,10 @@
Game
+
@@ -1154,7 +1190,7 @@ Phaser.Device.prototype.constructor = Phaser.Device;
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:20 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:21 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Easing.js.html b/docs/Easing.js.html
index 773b7129..97fddaba 100644
--- a/docs/Easing.js.html
+++ b/docs/Easing.js.html
@@ -166,6 +166,10 @@
Game
+
@@ -1037,7 +1073,7 @@ Phaser.Easing = {
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:20 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:21 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Ellipse.js.html b/docs/Ellipse.js.html
index 9dd72350..a00cc84c 100644
--- a/docs/Ellipse.js.html
+++ b/docs/Ellipse.js.html
@@ -166,6 +166,10 @@
Game
+
@@ -770,7 +806,7 @@ PIXI.Ellipse = Phaser.Ellipse;
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:20 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:21 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Emitter.js.html b/docs/Emitter.js.html
index d2affe54..b439b724 100644
--- a/docs/Emitter.js.html
+++ b/docs/Emitter.js.html
@@ -166,6 +166,10 @@
Game
+
@@ -1108,7 +1144,7 @@ Object.defineProperty(Phaser.Particles.Arcade.Emitter.prototype, "bottom", {
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:20 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:22 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Events.js.html b/docs/Events.js.html
index b3d079aa..17dcf631 100644
--- a/docs/Events.js.html
+++ b/docs/Events.js.html
@@ -166,6 +166,10 @@
Game
+
@@ -553,7 +589,7 @@ Phaser.Events.prototype.constructor = Phaser.Events;
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:20 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:21 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Filter.js.html b/docs/Filter.js.html
index 490a836b..7aabecfd 100644
--- a/docs/Filter.js.html
+++ b/docs/Filter.js.html
@@ -166,6 +166,10 @@
Game
+
@@ -639,7 +675,7 @@ Object.defineProperty(Phaser.Filter.prototype, 'height', {
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:20 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:21 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Frame.js.html b/docs/Frame.js.html
index 5aea4a10..89fd7663 100644
--- a/docs/Frame.js.html
+++ b/docs/Frame.js.html
@@ -166,6 +166,10 @@
Game
+
@@ -658,7 +694,7 @@ Phaser.Frame.prototype.constructor = Phaser.Frame;
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:20 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:21 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/FrameData.js.html b/docs/FrameData.js.html
index 66555f89..1d3f82e2 100644
--- a/docs/FrameData.js.html
+++ b/docs/FrameData.js.html
@@ -166,6 +166,10 @@
Game
+
@@ -713,7 +749,7 @@ Object.defineProperty(Phaser.FrameData.prototype, "total", {
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:20 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:21 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Game.js.html b/docs/Game.js.html
index fd295084..ab063cb3 100644
--- a/docs/Game.js.html
+++ b/docs/Game.js.html
@@ -166,6 +166,10 @@
Game
+
/**
+* @author Richard Davey <rich@photonstorm.com>
+* @copyright 2014 Photon Storm Ltd.
+* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+*/
+
+/**
+* The Game Object Creator is a quick way to create all of the different sorts of core objects that Phaser uses, but not add them to the game world.
+* Use the GameObjectFactory to create and add the objects into the world.
+*
+* @class Phaser.GameObjectCreator
+* @constructor
+* @param {Phaser.Game} game - A reference to the currently running game.
+*/
+Phaser.GameObjectCreator = function (game) {
+
+ /**
+ * @property {Phaser.Game} game - A reference to the currently running Game.
+ */
+ this.game = game;
+
+ /**
+ * @property {Phaser.World} world - A reference to the game world.
+ */
+ this.world = this.game.world;
+
+};
+
+Phaser.GameObjectCreator.prototype = {
+
+ /**
+ * Create a new `Image` object. An Image is a light-weight object you can use to display anything that doesn't need physics or animation.
+ * It can still rotate, scale, crop and receive input events. This makes it perfect for logos, backgrounds, simple buttons and other non-Sprite graphics.
+ *
+ * @method Phaser.GameObjectCreator#image
+ * @param {number} x - X position of the image.
+ * @param {number} y - Y position of the image.
+ * @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.
+ * @returns {Phaser.Sprite} the newly created sprite object.
+ */
+ image: function (x, y, key, frame) {
+
+ return new Phaser.Image(this.game, x, y, key, frame);
+
+ },
+
+ /**
+ * Create a new Sprite with specific position and sprite sheet key.
+ *
+ * @method Phaser.GameObjectCreator#sprite
+ * @param {number} x - X position of the new sprite.
+ * @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.
+ * @returns {Phaser.Sprite} the newly created sprite object.
+ */
+ sprite: function (x, y, key, frame) {
+
+ return new Phaser.Sprite(this.game, x, y, key, frame);
+
+ },
+
+ /**
+ * Create a tween object for a specific object. The object can be any JavaScript object or Phaser object such as Sprite.
+ *
+ * @method Phaser.GameObjectCreator#tween
+ * @param {object} obj - Object the tween will be run on.
+ * @return {Phaser.Tween} Description.
+ */
+ tween: function (obj) {
+
+ return this.game.tweens.create(obj);
+
+ },
+
+ /**
+ * A Group is a container for display objects that allows for fast pooling, recycling and collision checks.
+ *
+ * @method Phaser.GameObjectCreator#group
+ * @param {any} [parent] - The parent Group or DisplayObjectContainer that will hold this group, if any. If set to null the Group won't be added to the display list. If undefined it will be added to World by default.
+ * @param {string} [name='group'] - A name for this Group. Not used internally but useful for debugging.
+ * @param {boolean} [addToStage=false] - If set to true this Group will be added directly to the Game.Stage instead of Game.World.
+ * @return {Phaser.Group} The newly created group.
+ */
+ group: function (parent, name, addToStage) {
+
+ if (typeof name === 'undefined') { name = 'group'; }
+ if (typeof addToStage === 'undefined') { addToStage = false; }
+
+ return new Phaser.Group(this.game, parent, name, addToStage);
+
+ },
+
+ /**
+ * A Group is a container for display objects that allows for fast pooling, recycling and collision checks.
+ *
+ * @method Phaser.GameObjectCreator#spriteBatch
+ * @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.
+ * @param {boolean} [addToStage=false] - If set to true this Group will be added directly to the Game.Stage instead of Game.World.
+ * @return {Phaser.Group} The newly created group.
+ */
+ spriteBatch: function (parent, name, addToStage) {
+
+ if (typeof name === 'undefined') { name = 'group'; }
+ if (typeof addToStage === 'undefined') { addToStage = false; }
+
+ return new Phaser.SpriteBatch(this.game, parent, name, addToStage);
+
+ },
+
+ /**
+ * Creates a new Sound object.
+ *
+ * @method Phaser.GameObjectCreator#audio
+ * @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.
+ */
+ audio: function (key, volume, loop, connect) {
+
+ return this.game.sound.add(key, volume, loop, connect);
+
+ },
+
+ /**
+ * Creates a new Sound object.
+ *
+ * @method Phaser.GameObjectCreator#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.GameObjectCreator#tileSprite
+ * @param {number} x - The x coordinate (in world space) to position the TileSprite at.
+ * @param {number} y - The y coordinate (in world space) to position the TileSprite at.
+ * @param {number} width - The width of the TileSprite.
+ * @param {number} height - The height of the TileSprite.
+ * @param {string|Phaser.RenderTexture|Phaser.BitmapData|PIXI.Texture} key - This is the image or texture used by the TileSprite 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 TileSprite 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.
+ * @return {Phaser.TileSprite} The newly created tileSprite object.
+ */
+ tileSprite: function (x, y, width, height, key, frame) {
+
+ return new Phaser.TileSprite(this.game, x, y, width, height, key, frame);
+
+ },
+
+ /**
+ * Creates a new Text object.
+ *
+ * @method Phaser.GameObjectCreator#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.
+ * @return {Phaser.Text} The newly created text object.
+ */
+ text: function (x, y, text, style, group) {
+
+ return new Phaser.Text(this.game, x, y, text, style);
+
+ },
+
+ /**
+ * Creates a new Button object.
+ *
+ * @method Phaser.GameObjectCreator#button
+ * @param {number} [x] X position of the new button object.
+ * @param {number} [y] Y position of the new button object.
+ * @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.
+ * @return {Phaser.Button} The newly created button object.
+ */
+ button: function (x, y, key, callback, callbackContext, overFrame, outFrame, downFrame, upFrame, group) {
+
+ return new Phaser.Button(this.game, x, y, key, callback, callbackContext, overFrame, outFrame, downFrame, upFrame);
+
+ },
+
+ /**
+ * Creates a new Graphics object.
+ *
+ * @method Phaser.GameObjectCreator#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, group) {
+
+ return new Phaser.Graphics(this.game, x, y);
+
+ },
+
+ /**
+ * Emitter is a lightweight particle emitter. It can be used for one-time explosions or for
+ * continuous effects like rain and fire. All it really does is launch Particle objects out
+ * at set intervals, and fixes their positions and velocities accorindgly.
+ *
+ * @method Phaser.GameObjectCreator#emitter
+ * @param {number} [x=0] - The x coordinate within the Emitter that the particles are emitted from.
+ * @param {number} [y=0] - The y coordinate within the Emitter that the particles are emitted from.
+ * @param {number} [maxParticles=50] - The total number of particles in this emitter.
+ * @return {Phaser.Emitter} The newly created emitter object.
+ */
+ emitter: function (x, y, maxParticles) {
+
+ return new Phaser.Particles.Arcade.Emitter(this.game, x, y, maxParticles);
+
+ },
+
+ /**
+ * Create a new BitmapFont object to be used as a texture for an Image or Sprite and optionally add it to the Cache.
+ * The texture can be asssigned or one or multiple images/sprites, but note that the text the BitmapFont uses will be shared across them all,
+ * i.e. if you need each Image to have different text in it, then you need to create multiple BitmapFont objects.
+ *
+ * @method Phaser.GameObjectCreator#bitmapFont
+ * @param {string} font - The key of the image in the Game.Cache that the BitmapFont will use.
+ * @param {number} characterWidth - The width of each character in the font set.
+ * @param {number} characterHeight - The height of each character in the font set.
+ * @param {string} chars - The characters used in the font set, in display order. You can use the TEXT_SET consts for common font set arrangements.
+ * @param {number} charsPerRow - The number of characters per row in the font set.
+ * @param {number} [xSpacing=0] - If the characters in the font set have horizontal spacing between them set the required amount here.
+ * @param {number} [ySpacing=0] - If the characters in the font set have vertical spacing between them set the required amount here.
+ * @param {number} [xOffset=0] - If the font set doesn't start at the top left of the given image, specify the X coordinate offset here.
+ * @param {number} [yOffset=0] - If the font set doesn't start at the top left of the given image, specify the Y coordinate offset here.
+ * @return {Phaser.BitmapFont} The newly created BitmapFont texture which can be applied to an Image or Sprite.
+ */
+ bitmapFont: function (font, characterWidth, characterHeight, chars, charsPerRow, xSpacing, ySpacing, xOffset, yOffset) {
+
+ return new Phaser.BitmapFont(this.game, font, characterWidth, characterHeight, chars, charsPerRow, xSpacing, ySpacing, xOffset, yOffset);
+
+ },
+
+ /**
+ * Create a new BitmapText object.
+ *
+ * @method Phaser.GameObjectCreator#bitmapText
+ * @param {number} x - X position of the new bitmapText object.
+ * @param {number} y - Y position of the new bitmapText object.
+ * @param {string} font - The key of the BitmapText font as stored in Game.Cache.
+ * @param {string} [text] - The actual text that will be rendered. Can be set later via BitmapText.text.
+ * @param {number} [size] - The size the font will be rendered in, in pixels.
+ * @return {Phaser.BitmapText} The newly created bitmapText object.
+ */
+ bitmapText: function (x, y, font, text, size, group) {
+
+ return new Phaser.BitmapText(this.game, x, y, font, text, size);
+
+ },
+
+ /**
+ * Creates a new Tilemap object.
+ *
+ * @method Phaser.GameObjectCreator#tilemap
+ * @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, tilesets) {
+
+ return new Phaser.Tilemap(this.game, key, tilesets);
+
+ },
+
+ /**
+ * A dynamic initially blank canvas to which images can be drawn.
+ *
+ * @method Phaser.GameObjectCreator#renderTexture
+ * @param {number} [width=100] - the width of the RenderTexture.
+ * @param {number} [height=100] - the height of the RenderTexture.
+ * @param {string} [key=''] - Asset key for the RenderTexture when stored in the Cache (see addToCache parameter).
+ * @param {boolean} [addToCache=false] - Should this RenderTexture be added to the Game.Cache? If so you can retrieve it with Cache.getTexture(key)
+ * @return {Phaser.RenderTexture} The newly created RenderTexture object.
+ */
+ renderTexture: function (width, height, key, addToCache) {
+
+ if (typeof key === 'undefined' || key === '') { key = this.game.rnd.uuid(); }
+ if (typeof addToCache === 'undefined') { addToCache = false; }
+
+ var texture = new Phaser.RenderTexture(this.game, width, height, key);
+
+ if (addToCache)
+ {
+ this.game.cache.addRenderTexture(key, texture);
+ }
+
+ return texture;
+
+ },
+
+ /**
+ * A BitmapData object which can be manipulated and drawn to like a traditional Canvas object and used to texture Sprites.
+ *
+ * @method Phaser.GameObjectCreator#bitmapData
+ * @param {number} [width=100] - The width of the BitmapData in pixels.
+ * @param {number} [height=100] - The height of the BitmapData in pixels.
+ * @param {string} [key=''] - Asset key for the BitmapData when stored in the Cache (see addToCache parameter).
+ * @param {boolean} [addToCache=false] - Should this BitmapData be added to the Game.Cache? If so you can retrieve it with Cache.getBitmapData(key)
+ * @return {Phaser.BitmapData} The newly created BitmapData object.
+ */
+ bitmapData: function (width, height, addToCache) {
+
+ if (typeof addToCache === 'undefined') { addToCache = false; }
+ if (typeof key === 'undefined' || key === '') { key = this.game.rnd.uuid(); }
+
+ var texture = new Phaser.BitmapData(this.game, key, width, height);
+
+ if (addToCache)
+ {
+ this.game.cache.addBitmapData(key, texture);
+ }
+
+ return texture;
+
+ },
+
+ /**
+ * A WebGL shader/filter that can be applied to Sprites.
+ *
+ * @method Phaser.GameObjectCreator#filter
+ * @param {string} filter - The name of the filter you wish to create, for example HueRotate or SineWave.
+ * @param {any} - Whatever parameters are needed to be passed to the filter init function.
+ * @return {Phaser.Filter} The newly created Phaser.Filter object.
+ */
+ filter: function (filter) {
+
+ var args = Array.prototype.splice.call(arguments, 1);
+
+ var filter = new Phaser.Filter[filter](this.game);
+
+ filter.init.apply(filter, args);
+
+ return filter;
+
+ }
+
+};
+
+Phaser.GameObjectCreator.prototype.constructor = Phaser.GameObjectCreator;
+
@@ -538,7 +574,7 @@ Phaser.GameObjectFactory.prototype = {
*
* @method Phaser.GameObjectFactory#tween
* @param {object} obj - Object the tween will be run on.
- * @return {Phaser.Tween} Description.
+ * @return {Phaser.Tween} The newly created Phaser.Tween object.
*/
tween: function (obj) {
@@ -550,7 +586,7 @@ 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 {any} parent - The parent Group or DisplayObjectContainer that will hold this group, if any.
+ * @param {any} [parent] - The parent Group or DisplayObjectContainer that will hold this group, if any. If set to null the Group won't be added to the display list. If undefined it will be added to World by default.
* @param {string} [name='group'] - A name for this Group. Not used internally but useful for debugging.
* @param {boolean} [addToStage=false] - If set to true this Group will be added directly to the Game.Stage instead of Game.World.
* @return {Phaser.Group} The newly created group.
@@ -865,7 +901,7 @@ Phaser.GameObjectFactory.prototype.constructor = Phaser.GameObjectFactory;
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:20 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:21 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Gamepad.js.html b/docs/Gamepad.js.html
index 0372625b..f91ec741 100644
--- a/docs/Gamepad.js.html
+++ b/docs/Gamepad.js.html
@@ -166,6 +166,10 @@
Game
+
@@ -1052,7 +1088,7 @@ Phaser.Gamepad.XBOX360_STICK_RIGHT_Y = 3;
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:20 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:21 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/GamepadButton.js.html b/docs/GamepadButton.js.html
index 0f18f110..95ab2241 100644
--- a/docs/GamepadButton.js.html
+++ b/docs/GamepadButton.js.html
@@ -166,6 +166,10 @@
Game
+
@@ -649,7 +685,7 @@ Phaser.GamepadButton.prototype.constructor = Phaser.GamepadButton;
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:20 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:21 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Graphics.js.html b/docs/Graphics.js.html
index 45f6bcad..5b335934 100644
--- a/docs/Graphics.js.html
+++ b/docs/Graphics.js.html
@@ -166,6 +166,10 @@
Game
+
@@ -465,18 +501,20 @@
* @classdesc A Group is a container for display objects that allows for fast pooling and object recycling. Groups can be nested within other Groups and have their own local transforms.
* @constructor
* @param {Phaser.Game} game - A reference to the currently running game.
-* @param {Phaser.Group|Phaser.Sprite} parent - The parent Group, DisplayObject or DisplayObjectContainer that this Group will be added to. If undefined or null it will use game.world.
+* @param {Phaser.Group|Phaser.Sprite|null} parent - The parent Group, DisplayObject or DisplayObjectContainer that this Group will be added to. If undefined it will use game.world. If null it won't be added to anything.
* @param {string} [name=group] - A name for this Group. Not used internally but useful for debugging.
* @param {boolean} [addToStage=false] - If set to true this Group will be added directly to the Game.Stage instead of Game.World.
*/
Phaser.Group = function (game, parent, name, addToStage) {
+ if (typeof addToStage === 'undefined') { addToStage = false; }
+
/**
* @property {Phaser.Game} game - A reference to the currently running Game.
*/
this.game = game;
- if (typeof parent === 'undefined' || parent === null)
+ if (typeof parent === 'undefined')
{
parent = game.world;
}
@@ -488,20 +526,16 @@ Phaser.Group = function (game, parent, name, addToStage) {
PIXI.DisplayObjectContainer.call(this);
- if (typeof addToStage === 'undefined' || addToStage === false)
+ if (addToStage)
+ {
+ this.game.stage.addChild(this);
+ }
+ else
{
if (parent)
{
parent.addChild(this);
}
- else
- {
- this.game.stage.addChild(this);
- }
- }
- else
- {
- this.game.stage.addChild(this);
}
/**
@@ -1272,11 +1306,11 @@ Phaser.Group.prototype.forEach = function (callback, callbackContext, checkExist
}
/**
-* 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.
+* Allows you to call your own function on each member of this Group where child.exists=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)
+* For example: Group.forEachExists(causeDamage, this, 500)
*
-* @method Phaser.Group#forEachAlive
+* @method Phaser.Group#forEachExists
* @param {function} callback - The function that will be called. 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').
*/
@@ -1602,7 +1636,7 @@ Phaser.Group.prototype.destroy = function (destroyChildren) {
{
do
{
- if (this.children[0].group)
+ if (this.children[0].parent)
{
this.children[0].destroy();
}
@@ -1757,7 +1791,7 @@ Object.defineProperty(Phaser.Group.prototype, "fixedToCamera", {
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:20 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:21 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Image.js.html b/docs/Image.js.html
index 2155d293..9a66294a 100644
--- a/docs/Image.js.html
+++ b/docs/Image.js.html
@@ -166,6 +166,10 @@
Game
+
@@ -1350,7 +1386,7 @@ Object.defineProperty(Phaser.Input.prototype, "worldY", {
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:20 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:21 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/InputHandler.js.html b/docs/InputHandler.js.html
index 1255fb6d..89a7aab2 100644
--- a/docs/InputHandler.js.html
+++ b/docs/InputHandler.js.html
@@ -166,6 +166,10 @@
Game
+
@@ -647,7 +683,7 @@ Phaser.Key.prototype.constructor = Phaser.Key;
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:20 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:21 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Keyboard.js.html b/docs/Keyboard.js.html
index e9cee97f..672751ff 100644
--- a/docs/Keyboard.js.html
+++ b/docs/Keyboard.js.html
@@ -166,6 +166,10 @@
Game
+
@@ -971,7 +1007,7 @@ Phaser.Keyboard.NUM_LOCK = 144;
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:20 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:21 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Line.js.html b/docs/Line.js.html
index 9bac1d75..38f812aa 100644
--- a/docs/Line.js.html
+++ b/docs/Line.js.html
@@ -166,6 +166,10 @@
Game
+
@@ -641,7 +677,7 @@ Object.defineProperty(Phaser.Line.prototype, "perpSlope", {
* 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
+* @method Phaser.Line.intersectsPoints
* @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.
@@ -738,7 +774,7 @@ Phaser.Line.intersects = function (a, b, asSegment, result) {
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:20 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:21 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/LinkedList.js.html b/docs/LinkedList.js.html
index 534518f1..09967842 100644
--- a/docs/LinkedList.js.html
+++ b/docs/LinkedList.js.html
@@ -166,6 +166,10 @@
Game
+
@@ -630,7 +666,7 @@ Phaser.LinkedList.prototype.constructor = Phaser.LinkedList;
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:20 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:21 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Loader.js.html b/docs/Loader.js.html
index e586a57a..68302b3c 100644
--- a/docs/Loader.js.html
+++ b/docs/Loader.js.html
@@ -166,6 +166,10 @@
Game
+
@@ -1849,7 +1885,7 @@ Phaser.Loader.prototype.constructor = Phaser.Loader;
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:20 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:21 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/LoaderParser.js.html b/docs/LoaderParser.js.html
index cee4d3c9..e8f7a48d 100644
--- a/docs/LoaderParser.js.html
+++ b/docs/LoaderParser.js.html
@@ -166,6 +166,10 @@
Game
+
@@ -558,7 +594,7 @@ Phaser.LoaderParser = {
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:20 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:22 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/MSPointer.js.html b/docs/MSPointer.js.html
index 9c52fbe1..a081c04d 100644
--- a/docs/MSPointer.js.html
+++ b/docs/MSPointer.js.html
@@ -166,6 +166,10 @@
Game
+
@@ -487,7 +523,7 @@ Phaser.Math = {
/**
* a is fuzzyLessThan b if it is less than b + ε.
- * @method Phaser.Math#fuzzyEqual
+ * @method Phaser.Math#fuzzyLessThan
* @param {number} a
* @param {number} b
* @param {number} epsilon
@@ -1265,7 +1301,6 @@ Phaser.Math = {
* @param {number} angle - The angle value to check. Must be between -180 and +180.
* @param {number} min - The minimum angle that is allowed (must be -180 or greater).
* @param {number} max - The maximum angle that is allowed (must be 180 or less).
- *
* @return {number} The new angle value, returns the same as the input angle if it was within bounds
*/
angleLimit: function (angle, min, max) {
@@ -1754,7 +1789,9 @@ Phaser.Math = {
* @return {number} The scaled value.
*/
p2px: function (v) {
- return v *= -20;
+
+ return v *= 20;
+
},
/**
@@ -1765,7 +1802,35 @@ Phaser.Math = {
* @return {number} The scaled value.
*/
px2p: function (v) {
+
+ return v * 0.05;
+
+ },
+
+ /**
+ * Convert p2 physics value (meters) to pixel scale and inverses it.
+ *
+ * @method Phaser.Math#p2pxi
+ * @param {number} v - The value to convert.
+ * @return {number} The scaled value.
+ */
+ p2pxi: function (v) {
+
+ return v *= -20;
+
+ },
+
+ /**
+ * Convert pixel value to p2 physics scale (meters) and inverses it.
+ *
+ * @method Phaser.Math#px2pi
+ * @param {number} v - The value to convert.
+ * @return {number} The scaled value.
+ */
+ px2pi: function (v) {
+
return v * -0.05;
+
},
/**
@@ -1826,7 +1891,7 @@ Phaser.Math = {
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:20 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:22 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Mouse.js.html b/docs/Mouse.js.html
index 700740cf..f153fc58 100644
--- a/docs/Mouse.js.html
+++ b/docs/Mouse.js.html
@@ -166,6 +166,10 @@
Game
+
@@ -805,7 +841,7 @@ Phaser.Mouse.prototype.constructor = Phaser.Mouse;
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:20 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:22 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Net.js.html b/docs/Net.js.html
index 47ade9b0..f0e00fcb 100644
--- a/docs/Net.js.html
+++ b/docs/Net.js.html
@@ -166,6 +166,10 @@
Game
+
@@ -640,7 +676,7 @@ Phaser.Net.prototype.constructor = Phaser.Net;
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:20 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:22 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Particles.js.html b/docs/Particles.js.html
index 52f52544..51ef760a 100644
--- a/docs/Particles.js.html
+++ b/docs/Particles.js.html
@@ -166,6 +166,10 @@
Game
+
@@ -555,7 +591,7 @@ Phaser.Particles.prototype.constructor = Phaser.Particles;
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:20 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:22 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Phaser.Animation.html b/docs/Phaser.Animation.html
index 3a2e1610..f17dbc50 100644
--- a/docs/Phaser.Animation.html
+++ b/docs/Phaser.Animation.html
@@ -166,6 +166,10 @@
Game
+
@@ -2950,7 +2986,7 @@ You could use this function to generate those by doing: Phaser.Animation.generat
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:21 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:22 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Phaser.AnimationManager.html b/docs/Phaser.AnimationManager.html
index 8db1ad63..4159d793 100644
--- a/docs/Phaser.AnimationManager.html
+++ b/docs/Phaser.AnimationManager.html
@@ -166,6 +166,10 @@
Game
+
@@ -2997,7 +3033,7 @@ The currentAnim property of the AnimationManager is automatically set to the ani
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:21 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:23 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Phaser.AnimationParser.html b/docs/Phaser.AnimationParser.html
index e9774482..889c8af8 100644
--- a/docs/Phaser.AnimationParser.html
+++ b/docs/Phaser.AnimationParser.html
@@ -166,6 +166,10 @@
Game
+
@@ -1518,7 +1554,7 @@
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:21 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:23 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Phaser.BitmapData.html b/docs/Phaser.BitmapData.html
index 2c2eab7a..fda23b64 100644
--- a/docs/Phaser.BitmapData.html
+++ b/docs/Phaser.BitmapData.html
@@ -166,6 +166,10 @@
Game
+
@@ -3401,7 +3941,7 @@ This is called automatically if the BitmapData is being used by a Sprite, otherw
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:22 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:23 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Phaser.BitmapFont.html b/docs/Phaser.BitmapFont.html
index d0b991b5..33300a0c 100644
--- a/docs/Phaser.BitmapFont.html
+++ b/docs/Phaser.BitmapFont.html
@@ -166,6 +166,10 @@
Game
+
@@ -4721,7 +5142,7 @@ If text is wider than the width specified it will be cropped off.
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:22 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:23 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Phaser.BitmapText.html b/docs/Phaser.BitmapText.html
index ea225928..3201ebe8 100644
--- a/docs/Phaser.BitmapText.html
+++ b/docs/Phaser.BitmapText.html
@@ -166,6 +166,10 @@
Game
+
@@ -2868,7 +2908,7 @@ activated for this object and it will then start to process click/touch events a
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:22 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:23 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Phaser.Button.html b/docs/Phaser.Button.html
index d9d164b3..1ed147da 100644
--- a/docs/Phaser.Button.html
+++ b/docs/Phaser.Button.html
@@ -166,6 +166,10 @@
Game
+
@@ -7802,7 +7838,7 @@ Call this function with no parameters at all to reset all sounds on this Button.
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:22 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:23 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Phaser.Cache.html b/docs/Phaser.Cache.html
index 7415058b..5eb87d31 100644
--- a/docs/Phaser.Cache.html
+++ b/docs/Phaser.Cache.html
@@ -166,6 +166,10 @@
Game
+
@@ -8959,7 +8995,7 @@
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:22 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:24 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Phaser.Camera.html b/docs/Phaser.Camera.html
index 1df74628..f5f06e61 100644
--- a/docs/Phaser.Camera.html
+++ b/docs/Phaser.Camera.html
@@ -166,6 +166,10 @@
Game
+
@@ -3536,7 +3572,7 @@ without having to use game.camera.x and game.camera.y.
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:23 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:24 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Phaser.Canvas.html b/docs/Phaser.Canvas.html
index 2474082f..fa9f77b6 100644
--- a/docs/Phaser.Canvas.html
+++ b/docs/Phaser.Canvas.html
@@ -166,6 +166,10 @@
Game
+
@@ -2662,7 +2698,7 @@ patchy on earlier browsers, especially on mobile.
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:23 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:24 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Phaser.Circle.html b/docs/Phaser.Circle.html
index dac06c5e..606e11d1 100644
--- a/docs/Phaser.Circle.html
+++ b/docs/Phaser.Circle.html
@@ -166,6 +166,10 @@
Game
+
@@ -4340,7 +4376,7 @@ This method checks the radius distances between the two Circle objects to see if
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:23 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:24 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Phaser.Color.html b/docs/Phaser.Color.html
index 99ed3114..a4f0e04c 100644
--- a/docs/Phaser.Color.html
+++ b/docs/Phaser.Color.html
@@ -166,6 +166,10 @@
Game
+
@@ -3649,7 +3685,7 @@ Set the max value to restrict the maximum color used per channel.
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:23 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:24 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Phaser.Device.html b/docs/Phaser.Device.html
index e96cb6c7..40bf8638 100644
--- a/docs/Phaser.Device.html
+++ b/docs/Phaser.Device.html
@@ -166,6 +166,10 @@
Game
+
@@ -6075,7 +6111,7 @@
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:23 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:24 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Phaser.Easing.Back.html b/docs/Phaser.Easing.Back.html
index 3fc4763d..62c31444 100644
--- a/docs/Phaser.Easing.Back.html
+++ b/docs/Phaser.Easing.Back.html
@@ -166,6 +166,10 @@
Game
+
@@ -1001,7 +1037,7 @@
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:24 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:25 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Phaser.Easing.Bounce.html b/docs/Phaser.Easing.Bounce.html
index 3e9aa7d4..6e5d55bb 100644
--- a/docs/Phaser.Easing.Bounce.html
+++ b/docs/Phaser.Easing.Bounce.html
@@ -166,6 +166,10 @@
Game
+
@@ -1001,7 +1037,7 @@
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:24 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:25 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Phaser.Easing.Circular.html b/docs/Phaser.Easing.Circular.html
index bf518360..00ed68f4 100644
--- a/docs/Phaser.Easing.Circular.html
+++ b/docs/Phaser.Easing.Circular.html
@@ -166,6 +166,10 @@
Game
+
@@ -1001,7 +1037,7 @@
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:24 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:25 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Phaser.Easing.Cubic.html b/docs/Phaser.Easing.Cubic.html
index 0bc7ee12..de949020 100644
--- a/docs/Phaser.Easing.Cubic.html
+++ b/docs/Phaser.Easing.Cubic.html
@@ -166,6 +166,10 @@
Game
+
@@ -1001,7 +1037,7 @@
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:24 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:25 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Phaser.Easing.Elastic.html b/docs/Phaser.Easing.Elastic.html
index deddec26..dd576741 100644
--- a/docs/Phaser.Easing.Elastic.html
+++ b/docs/Phaser.Easing.Elastic.html
@@ -166,6 +166,10 @@
Game
+
@@ -1001,7 +1037,7 @@
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:24 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:25 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Phaser.Easing.Exponential.html b/docs/Phaser.Easing.Exponential.html
index 344b7457..45c14e65 100644
--- a/docs/Phaser.Easing.Exponential.html
+++ b/docs/Phaser.Easing.Exponential.html
@@ -166,6 +166,10 @@
Game
+
@@ -1001,7 +1037,7 @@
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:24 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:25 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Phaser.Easing.Linear.html b/docs/Phaser.Easing.Linear.html
index 98654d25..4e57b3d0 100644
--- a/docs/Phaser.Easing.Linear.html
+++ b/docs/Phaser.Easing.Linear.html
@@ -166,6 +166,10 @@
Game
+
@@ -719,7 +755,7 @@
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:24 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:25 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Phaser.Easing.Quadratic.html b/docs/Phaser.Easing.Quadratic.html
index c7a8e9b1..f78d7388 100644
--- a/docs/Phaser.Easing.Quadratic.html
+++ b/docs/Phaser.Easing.Quadratic.html
@@ -166,6 +166,10 @@
Game
+
@@ -1001,7 +1037,7 @@
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:24 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:26 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Phaser.Easing.Quartic.html b/docs/Phaser.Easing.Quartic.html
index c7f99b0f..4a34dab2 100644
--- a/docs/Phaser.Easing.Quartic.html
+++ b/docs/Phaser.Easing.Quartic.html
@@ -166,6 +166,10 @@
Game
+
@@ -1001,7 +1037,7 @@
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:24 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:26 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Phaser.Easing.Quintic.html b/docs/Phaser.Easing.Quintic.html
index 2bc4db6d..a81af0e9 100644
--- a/docs/Phaser.Easing.Quintic.html
+++ b/docs/Phaser.Easing.Quintic.html
@@ -166,6 +166,10 @@
Game
+
@@ -1001,7 +1037,7 @@
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:25 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:26 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Phaser.Easing.Sinusoidal.html b/docs/Phaser.Easing.Sinusoidal.html
index 95027f03..ff000306 100644
--- a/docs/Phaser.Easing.Sinusoidal.html
+++ b/docs/Phaser.Easing.Sinusoidal.html
@@ -166,6 +166,10 @@
Game
+
@@ -1001,7 +1037,7 @@
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:25 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:26 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Phaser.Easing.html b/docs/Phaser.Easing.html
index 42de6dfd..cf176139 100644
--- a/docs/Phaser.Easing.html
+++ b/docs/Phaser.Easing.html
@@ -166,6 +166,10 @@
Game
+
@@ -611,7 +647,7 @@
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:23 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:25 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Phaser.Ellipse.html b/docs/Phaser.Ellipse.html
index 470766b0..cda99152 100644
--- a/docs/Phaser.Ellipse.html
+++ b/docs/Phaser.Ellipse.html
@@ -166,6 +166,10 @@
Game
+
@@ -2756,7 +2792,7 @@ If set to true it will reset all of the Ellipse objects properties to 0. An Elli
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:25 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:26 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Phaser.Events.html b/docs/Phaser.Events.html
index d4da03b5..404b7863 100644
--- a/docs/Phaser.Events.html
+++ b/docs/Phaser.Events.html
@@ -166,6 +166,10 @@
Game
+
@@ -625,7 +661,7 @@
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:25 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:26 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Phaser.Filter.html b/docs/Phaser.Filter.html
index 3460d9bb..f975ddf0 100644
--- a/docs/Phaser.Filter.html
+++ b/docs/Phaser.Filter.html
@@ -166,6 +166,10 @@
Game
+
@@ -1910,7 +1946,7 @@
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:25 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:26 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Phaser.Frame.html b/docs/Phaser.Frame.html
index 2bd23887..24f17f94 100644
--- a/docs/Phaser.Frame.html
+++ b/docs/Phaser.Frame.html
@@ -166,6 +166,10 @@
Game
+
@@ -3139,7 +3175,7 @@
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:25 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:26 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Phaser.FrameData.html b/docs/Phaser.FrameData.html
index 4bea63a3..7291c13f 100644
--- a/docs/Phaser.FrameData.html
+++ b/docs/Phaser.FrameData.html
@@ -166,6 +166,10 @@
Game
+
@@ -1933,7 +1969,7 @@ The frames are returned in the output array, or if none is provided in a new Arr
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:25 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:27 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Phaser.Game.html b/docs/Phaser.Game.html
index 949b6d3b..7dacceb9 100644
--- a/docs/Phaser.Game.html
+++ b/docs/Phaser.Game.html
@@ -166,6 +166,10 @@
Game
+
@@ -5660,7 +5798,7 @@ This is extremely useful to hard to track down errors! Use the internal stepCoun
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:25 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:27 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Phaser.GameObjectCreator.html b/docs/Phaser.GameObjectCreator.html
new file mode 100644
index 00000000..445486d7
--- /dev/null
+++ b/docs/Phaser.GameObjectCreator.html
@@ -0,0 +1,5577 @@
+
+
+
+
+
+ Phaser Class: GameObjectCreator
+
+
+
+
+
+
+
+
+
+
+
The Game Object Creator is a quick way to create all of the different sorts of core objects that Phaser uses, but not add them to the game world.
+Use the GameObjectFactory to create and add the objects into the world.
Create a new BitmapFont object to be used as a texture for an Image or Sprite and optionally add it to the Cache.
+The texture can be asssigned or one or multiple images/sprites, but note that the text the BitmapFont uses will be shared across them all,
+i.e. if you need each Image to have different text in it, then you need to create multiple BitmapFont objects.
+
+
+
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+
+
Name
+
+
+
Type
+
+
+
Argument
+
+
+
+
Default
+
+
+
Description
+
+
+
+
+
+
+
+
+
font
+
+
+
+
+
+string
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
The key of the image in the Game.Cache that the BitmapFont will use.
+
+
+
+
+
+
+
characterWidth
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
The width of each character in the font set.
+
+
+
+
+
+
+
characterHeight
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
The height of each character in the font set.
+
+
+
+
+
+
+
chars
+
+
+
+
+
+string
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
The characters used in the font set, in display order. You can use the TEXT_SET consts for common font set arrangements.
+
+
+
+
+
+
+
charsPerRow
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
The number of characters per row in the font set.
+
+
+
+
+
+
+
xSpacing
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ 0
+
+
+
+
+
If the characters in the font set have horizontal spacing between them set the required amount here.
+
+
+
+
+
+
+
ySpacing
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ 0
+
+
+
+
+
If the characters in the font set have vertical spacing between them set the required amount here.
+
+
+
+
+
+
+
xOffset
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ 0
+
+
+
+
+
If the font set doesn't start at the top left of the given image, specify the X coordinate offset here.
+
+
+
+
+
+
+
yOffset
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ 0
+
+
+
+
+
If the font set doesn't start at the top left of the given image, specify the Y coordinate offset here.
The image key as defined in the Game.Cache to use as the texture for this button.
+
+
+
+
+
+
+
callback
+
+
+
+
+
+function
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
The function to call when this button is pressed
+
+
+
+
+
+
+
callbackContext
+
+
+
+
+
+object
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
The context in which the callback will be called (usually 'this')
+
+
+
+
+
+
+
overFrame
+
+
+
+
+
+string
+|
+
+number
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
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.
+
+
+
+
+
+
+
outFrame
+
+
+
+
+
+string
+|
+
+number
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
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.
+
+
+
+
+
+
+
downFrame
+
+
+
+
+
+string
+|
+
+number
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
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.
Emitter is a lightweight particle emitter. It can be used for one-time explosions or for
+continuous effects like rain and fire. All it really does is launch Particle objects out
+at set intervals, and fixes their positions and velocities accorindgly.
+
+
+
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+
+
Name
+
+
+
Type
+
+
+
Argument
+
+
+
+
Default
+
+
+
Description
+
+
+
+
+
+
+
+
+
x
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ 0
+
+
+
+
+
The x coordinate within the Emitter that the particles are emitted from.
+
+
+
+
+
+
+
y
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ 0
+
+
+
+
+
The y coordinate within the Emitter that the particles are emitted from.
A Group is a container for display objects that allows for fast pooling, recycling and collision checks.
+
+
+
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+
+
Name
+
+
+
Type
+
+
+
Argument
+
+
+
+
Default
+
+
+
Description
+
+
+
+
+
+
+
+
+
parent
+
+
+
+
+
+any
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
The parent Group or DisplayObjectContainer that will hold this group, if any. If set to null the Group won't be added to the display list. If undefined it will be added to World by default.
+
+
+
+
+
+
+
name
+
+
+
+
+
+string
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ 'group'
+
+
+
+
+
A name for this Group. Not used internally but useful for debugging.
+
+
+
+
+
+
+
addToStage
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ false
+
+
+
+
+
If set to true this Group will be added directly to the Game.Stage instead of Game.World.
Create a new Image object. An Image is a light-weight object you can use to display anything that doesn't need physics or animation.
+It can still rotate, scale, crop and receive input events. This makes it perfect for logos, backgrounds, simple buttons and other non-Sprite graphics.
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.
+
+
+
+
+
+
+
frame
+
+
+
+
+
+string
+|
+
+number
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
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.
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.
+
+
+
+
+
+
+
frame
+
+
+
+
+
+string
+|
+
+number
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
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.
This is the image or texture used by the TileSprite during rendering. It can be a string which is a reference to the Cache entry, or an instance of a RenderTexture or PIXI.Texture.
+
+
+
+
+
+
+
frame
+
+
+
+
+
+string
+|
+
+number
+
+
+
+
+
+
+
+
+
+
If this TileSprite 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.
@@ -3417,6 +3453,8 @@ at set intervals, and fixes their positions and velocities accorindgly.
+ <optional>
+
@@ -3430,7 +3468,7 @@ at set intervals, and fixes their positions and velocities accorindgly.
-
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 set to null the Group won't be added to the display list. If undefined it will be added to World by default.
@@ -5865,7 +5903,7 @@ It can still rotate, scale, crop and receive input events. This makes it perfect
-
Description.
+
The newly created Phaser.Tween object.
@@ -5914,7 +5952,7 @@ It can still rotate, scale, crop and receive input events. This makes it perfect
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:26 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:27 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Phaser.Gamepad.html b/docs/Phaser.Gamepad.html
index e15a3919..7659cb05 100644
--- a/docs/Phaser.Gamepad.html
+++ b/docs/Phaser.Gamepad.html
@@ -166,6 +166,10 @@
Game
+
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
@@ -3400,7 +3294,7 @@ This MUST be called manually before Phaser will start polling the Gamepad API.
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:26 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:27 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Phaser.GamepadButton.html b/docs/Phaser.GamepadButton.html
index 6590db26..10cd7f77 100644
--- a/docs/Phaser.GamepadButton.html
+++ b/docs/Phaser.GamepadButton.html
@@ -166,6 +166,10 @@
Game
+
@@ -2578,7 +2614,7 @@ If the button is up it holds the duration of the previous down session.
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:26 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:27 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Phaser.Graphics.html b/docs/Phaser.Graphics.html
index 15060ab3..90dcf7dd 100644
--- a/docs/Phaser.Graphics.html
+++ b/docs/Phaser.Graphics.html
@@ -166,6 +166,10 @@
Game
+
@@ -1717,7 +1892,7 @@ So if this Graphics was in a Group that has x: 200, then this will be added to t
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:26 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:27 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Phaser.Group.html b/docs/Phaser.Group.html
index 395a4cb6..739cda62 100644
--- a/docs/Phaser.Group.html
+++ b/docs/Phaser.Group.html
@@ -166,6 +166,10 @@
Game
+
The parent Group, DisplayObject or DisplayObjectContainer that this Group will be added to. If undefined or null it will use game.world.
+
The parent Group, DisplayObject or DisplayObjectContainer that this Group will be added to. If undefined it will use game.world. If null it won't be added to anything.
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').
Allows you to call your own function on each member of this Group where child.exists=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.forEachExists(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').
@@ -9177,7 +9216,7 @@ You cannot swap a child with itself, or swap un-parented children, doing so will
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:26 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:27 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Phaser.Image.html b/docs/Phaser.Image.html
index b6514b7f..8d104257 100644
--- a/docs/Phaser.Image.html
+++ b/docs/Phaser.Image.html
@@ -166,6 +166,10 @@
Game
+
@@ -3933,7 +3969,7 @@ It will dispatch the onRevived event, you can listen to Image.events.onRevived f
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:27 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:28 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Phaser.Input.html b/docs/Phaser.Input.html
index 060c0ee4..5d60b167 100644
--- a/docs/Phaser.Input.html
+++ b/docs/Phaser.Input.html
@@ -166,6 +166,10 @@
Game
+
@@ -7689,7 +7725,7 @@ to only use if you've limited input to a single pointer (i.e. mouse or touch)
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:27 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:28 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Phaser.InputHandler.html b/docs/Phaser.InputHandler.html
index 16e44726..46d72ae1 100644
--- a/docs/Phaser.InputHandler.html
+++ b/docs/Phaser.InputHandler.html
@@ -166,6 +166,10 @@
Game
+
@@ -7994,7 +8038,7 @@ This value is only set when the pointer is over this Sprite.
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:27 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:28 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Phaser.Key.html b/docs/Phaser.Key.html
index 167faf5c..d2bcf38c 100644
--- a/docs/Phaser.Key.html
+++ b/docs/Phaser.Key.html
@@ -166,6 +166,10 @@
Game
+
@@ -2568,7 +2604,7 @@ If the key is up it holds the duration of the previous down session.
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:27 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:28 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Phaser.Keyboard.html b/docs/Phaser.Keyboard.html
index 963d58da..01f67f65 100644
--- a/docs/Phaser.Keyboard.html
+++ b/docs/Phaser.Keyboard.html
@@ -166,6 +166,10 @@
Game
+
@@ -2995,7 +3031,7 @@ This is called automatically by Phaser.Input and should not normally be invoked
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:27 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:28 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Phaser.Line.html b/docs/Phaser.Line.html
index 915d4ad3..daeec541 100644
--- a/docs/Phaser.Line.html
+++ b/docs/Phaser.Line.html
@@ -166,6 +166,10 @@
Game
+
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
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
@@ -3091,7 +3127,7 @@ Returns the intersection segment of AB and EF as a Point, or null if there is no
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:27 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:28 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Phaser.LinkedList.html b/docs/Phaser.LinkedList.html
index b86f5ccf..96159673 100644
--- a/docs/Phaser.LinkedList.html
+++ b/docs/Phaser.LinkedList.html
@@ -166,6 +166,10 @@
Game
+
@@ -1487,7 +1523,7 @@ The function must exist on the member.
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:28 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:29 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Phaser.Loader.html b/docs/Phaser.Loader.html
index c6be26c2..28c248c0 100644
--- a/docs/Phaser.Loader.html
+++ b/docs/Phaser.Loader.html
@@ -166,6 +166,10 @@
Game
+
@@ -7607,7 +7643,7 @@ This allows you to easily make loading bars for games.
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:28 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:29 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Phaser.LoaderParser.html b/docs/Phaser.LoaderParser.html
index f0033004..97e159ce 100644
--- a/docs/Phaser.LoaderParser.html
+++ b/docs/Phaser.LoaderParser.html
@@ -166,6 +166,10 @@
Game
+
@@ -742,7 +778,7 @@
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:28 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:29 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Phaser.MSPointer.html b/docs/Phaser.MSPointer.html
index a4fee1c1..e01070ed 100644
--- a/docs/Phaser.MSPointer.html
+++ b/docs/Phaser.MSPointer.html
@@ -166,6 +166,10 @@
Game
+
@@ -1437,7 +1473,7 @@ It will work only in Internet Explorer 10 and Windows Store or Windows Phone 8 a
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:28 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:29 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Phaser.Math.html b/docs/Phaser.Math.html
index 03998940..42e9587f 100644
--- a/docs/Phaser.Math.html
+++ b/docs/Phaser.Math.html
@@ -166,6 +166,10 @@
Game
+
@@ -11657,7 +11975,7 @@ Should be called whenever the angle is updated on the Sprite to stop it from goi
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:28 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:29 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Phaser.Mouse.html b/docs/Phaser.Mouse.html
index 53115ab0..315fe8fb 100644
--- a/docs/Phaser.Mouse.html
+++ b/docs/Phaser.Mouse.html
@@ -166,6 +166,10 @@
Game
+
@@ -2754,7 +2790,7 @@ If the browser successfully enters a locked state the event Phaser.Mouse.pointer
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:28 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:29 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Phaser.Net.html b/docs/Phaser.Net.html
index f953f984..9aa65a27 100644
--- a/docs/Phaser.Net.html
+++ b/docs/Phaser.Net.html
@@ -166,6 +166,10 @@
Game
+
@@ -1381,7 +1417,7 @@ Optionally you can redirect to the new url, or just return it as a string.
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:29 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:29 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Phaser.Particles.Arcade.Emitter.html b/docs/Phaser.Particles.Arcade.Emitter.html
index ffc5ec99..6b69c8de 100644
--- a/docs/Phaser.Particles.Arcade.Emitter.html
+++ b/docs/Phaser.Particles.Arcade.Emitter.html
@@ -166,6 +166,10 @@
Game
+
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').
Allows you to call your own function on each member of this Group where child.exists=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.forEachExists(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').
@@ -13315,7 +13351,7 @@ You cannot swap a child with itself, or swap un-parented children, doing so will
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:29 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:30 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Phaser.Particles.html b/docs/Phaser.Particles.html
index 24e94212..4514734a 100644
--- a/docs/Phaser.Particles.html
+++ b/docs/Phaser.Particles.html
@@ -166,6 +166,10 @@
Game
+
@@ -1270,7 +1306,7 @@
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:29 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:30 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Phaser.Physics.Arcade.html b/docs/Phaser.Physics.Arcade.html
index 34b8dec4..423fc955 100644
--- a/docs/Phaser.Physics.Arcade.html
+++ b/docs/Phaser.Physics.Arcade.html
@@ -166,6 +166,10 @@
Game
+
@@ -8094,7 +8130,7 @@ One way to use this is: velocityFromRotation(rotation, 200, sprite.velocity) whi
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:29 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:30 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Phaser.Physics.Body.html b/docs/Phaser.Physics.Body.html
new file mode 100644
index 00000000..8632030f
--- /dev/null
+++ b/docs/Phaser.Physics.Body.html
@@ -0,0 +1,11896 @@
+
+
+
+
+
+ Phaser Class: Body
+
+
+
+
+
+
+
+
+
+
+
The Physics Body is typically 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.
+By default a single Rectangle shape is added to the Body that matches the dimensions of the parent Sprite. See addShape, removeShape, clearShapes to add extra shapes around the Body.
The angle of the Body 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 Body.angle = 450 is the same as Body.angle = 90.
+If you wish to work in radians instead of degrees use the property Body.rotation instead. Working in radians is faster as it doesn't have to convert values.
A Body can be set to collide against the World bounds automatically if this is set to true. Otherwise it will leave the World.
+Note that this only applies if your World has bounds! The response to the collision should be managed via CollisionMaterials.
The type of motion this body has. Should be one of: Body.STATIC (the body does not move), Body.DYNAMIC (body can move and respond to collisions) and Body.KINEMATIC (only moves according to its .velocity).
The angle of the Body in radians.
+If you wish to work in degrees instead of radians use the Body.angle property instead. Working in radians is faster as it doesn't have to convert values.
The velocity of the body. Set velocity.x to a negative value to move to the left, position to the right. velocity.y negative values move up, positive move down.
Adds a Line shape to this Body.
+The line shape is along the x direction, and stretches from [-length/2, 0] to [length/2,0].
+You can control the offset from the center of the body and the rotation.
+
+
+
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+
+
Name
+
+
+
Type
+
+
+
Argument
+
+
+
+
Default
+
+
+
Description
+
+
+
+
+
+
+
+
+
length
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
The length of this line (in pixels)
+
+
+
+
+
+
+
offsetX
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ 0
+
+
+
+
+
Local horizontal offset of the shape relative to the body center of mass.
+
+
+
+
+
+
+
offsetY
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ 0
+
+
+
+
+
Local vertical offset of the shape relative to the body center of mass.
+
+
+
+
+
+
+
rotation
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ 0
+
+
+
+
+
Local rotation of the shape relative to the body center of mass, specified in radians.
Reads a polygon shape path, and assembles convex shapes from that and puts them at proper offset points. The shape must be simple and without holes.
+This function expects the x.y values to be given in pixels. If you want to provide them at p2 world scales then call Body.data.fromPolygon directly.
+
+
+
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+
+
Name
+
+
+
Type
+
+
+
+
+
+
Description
+
+
+
+
+
+
+
+
+
options
+
+
+
+
+
+object
+
+
+
+
+
+
+
+
+
+
An object containing the build options:
+
Properties
+
+
+
+
+
+
+
Name
+
+
+
Type
+
+
+
Argument
+
+
+
+
Default
+
+
+
Description
+
+
+
+
+
+
+
+
+
optimalDecomp
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ false
+
+
+
+
+
Set to true if you need optimal decomposition. Warning: very slow for polygons with more than 10 vertices.
+
+
+
+
+
+
+
skipSimpleCheck
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ false
+
+
+
+
+
Set to true if you already know that the path is not intersecting itself.
+
+
+
+
+
+
+
removeCollinearPoints
+
+
+
+
+
+boolean
+|
+
+number
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ false
+
+
+
+
+
Set to a number (angle threshold value) to remove collinear points, or false to keep all points.
An array of 2d vectors that form the convex or concave polygon.
+ Either [[0,0], [0,1],...] or a flat array of numbers that will be interpreted as [x,y, x,y, ...],
+ or the arguments passed can be flat x,y values e.g. setPolygon(options, x,y, x,y, x,y, ...) where x and y are numbers.
Add a shape to the body. You can pass a local transform when adding a shape, so that the shape gets an offset and an angle relative to the body center of mass.
+Will automatically update the mass properties and bounding radius.
+
+
+
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+
+
Name
+
+
+
Type
+
+
+
Argument
+
+
+
+
Default
+
+
+
Description
+
+
+
+
+
+
+
+
+
shape
+
+
+
+
+
+*
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
The shape to add to the body.
+
+
+
+
+
+
+
offsetX
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ 0
+
+
+
+
+
Local horizontal offset of the shape relative to the body center of mass.
+
+
+
+
+
+
+
offsetY
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ 0
+
+
+
+
+
Local vertical offset of the shape relative to the body center of mass.
+
+
+
+
+
+
+
rotation
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ 0
+
+
+
+
+
Local rotation of the shape relative to the body center of mass, specified in radians.
Apply force to a world point. This could for example be a point on the RigidBody surface. Applying force this way will add to Body.force and Body.angularForce.
Sets a callback to be fired any time this Body impacts with the given Body. The impact test is performed against body.id values.
+The callback will be sent 4 parameters: This body, the body that impacted, the Shape in this body and the shape in the impacting body.
Sets a callback to be fired any time this Body impacts with the given Group. The impact test is performed against shape.collisionGroup values.
+The callback will be sent 4 parameters: This body, the body that impacted, the Shape in this body and the shape in the impacting body.
+This callback will only fire if this Body has been assigned a collision group.
Reads the physics data from a physics data file stored in the Game.Cache.
+It will add the shape data to this Body, as well as set the density (mass), friction and bounce (restitution) values.
+
+
+
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+
+
Name
+
+
+
Type
+
+
+
+
+
+
Description
+
+
+
+
+
+
+
+
+
key
+
+
+
+
+
+string
+
+
+
+
+
+
+
+
+
+
The key of the Physics Data file as stored in Game.Cache.
+
+
+
+
+
+
+
object
+
+
+
+
+
+string
+
+
+
+
+
+
+
+
+
+
The key of the object within the Physics data file that you wish to load the shape data from.
+
+
+
+
+
+
+
options
+
+
+
+
+
+object
+
+
+
+
+
+
+
+
+
+
An object containing the build options:
+
Properties
+
+
+
+
+
+
+
Name
+
+
+
Type
+
+
+
Argument
+
+
+
+
Default
+
+
+
Description
+
+
+
+
+
+
+
+
+
optimalDecomp
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ false
+
+
+
+
+
Set to true if you need optimal decomposition. Warning: very slow for polygons with more than 10 vertices.
+
+
+
+
+
+
+
skipSimpleCheck
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ false
+
+
+
+
+
Set to true if you already know that the path is not intersecting itself.
+
+
+
+
+
+
+
removeCollinearPoints
+
+
+
+
+
+boolean
+|
+
+number
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ false
+
+
+
+
+
Set to a number (angle threshold value) to remove collinear points, or false to keep all points.
Moves the Body backwards based on its current angle and the given speed.
+The speed is represented in pixels per second. So a value of 100 would move 100 pixels in 1 second (1000ms).
If this Body is dynamic then this will move it down by setting its y velocity to the given speed.
+The speed is represented in pixels per second. So a value of 100 would move 100 pixels in 1 second (1000ms).
+
+
+
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+
+
Name
+
+
+
Type
+
+
+
+
+
+
Description
+
+
+
+
+
+
+
+
+
speed
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+
The speed at which it should move down, in pixels per second.
Moves the Body forwards based on its current angle and the given speed.
+The speed is represented in pixels per second. So a value of 100 would move 100 pixels in 1 second (1000ms).
If this Body is dynamic then this will move it to the left by setting its x velocity to the given speed.
+The speed is represented in pixels per second. So a value of 100 would move 100 pixels in 1 second (1000ms).
+
+
+
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+
+
Name
+
+
+
Type
+
+
+
+
+
+
Description
+
+
+
+
+
+
+
+
+
speed
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+
The speed at which it should move to the left, in pixels per second.
If this Body is dynamic then this will move it to the right by setting its x velocity to the given speed.
+The speed is represented in pixels per second. So a value of 100 would move 100 pixels in 1 second (1000ms).
+
+
+
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+
+
Name
+
+
+
Type
+
+
+
+
+
+
Description
+
+
+
+
+
+
+
+
+
speed
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+
The speed at which it should move to the right, in pixels per second.
If this Body is dynamic then this will move it up by setting its y velocity to the given speed.
+The speed is represented in pixels per second. So a value of 100 would move 100 pixels in 1 second (1000ms).
+
+
+
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+
+
Name
+
+
+
Type
+
+
+
+
+
+
Description
+
+
+
+
+
+
+
+
+
speed
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+
The speed at which it should move up, in pixels per second.
Applies a force to the Body that causes it to 'thrust' backwards (in reverse), based on its current angle and the given speed.
+The speed is represented in pixels per second. So a value of 100 would move 100 pixels in 1 second (1000ms).
Adds the given Material to all Shapes that belong to this Body.
+If you only wish to apply it to a specific Shape in this Body then provide that as the 2nd parameter.
Clears any previously set shapes. The creates a new Rectangle shape at the given size and offset, and adds it to this Body.
+If you wish to create a Rectangle to match the size of a Sprite or Image see Body.setRectangleFromSprite.
+
+
+
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+
+
Name
+
+
+
Type
+
+
+
Argument
+
+
+
+
Default
+
+
+
Description
+
+
+
+
+
+
+
+
+
width
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ 16
+
+
+
+
+
The width of the rectangle in pixels.
+
+
+
+
+
+
+
height
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ 16
+
+
+
+
+
The height of the rectangle in pixels.
+
+
+
+
+
+
+
offsetX
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ 0
+
+
+
+
+
Local horizontal offset of the shape relative to the body center of mass.
+
+
+
+
+
+
+
offsetY
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ 0
+
+
+
+
+
Local vertical offset of the shape relative to the body center of mass.
+
+
+
+
+
+
+
rotation
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ 0
+
+
+
+
+
Local rotation of the shape relative to the body center of mass, specified in radians.
Clears any previously set shapes.
+Then creates a Rectangle shape sized to match the dimensions and orientation of the Sprite given.
+If no Sprite is given it defaults to using the parent of this Body.
Applies a force to the Body that causes it to 'thrust' forwards, based on its current angle and the given speed.
+The speed is represented in pixels per second. So a value of 100 would move 100 pixels in 1 second (1000ms).
A InversePointProxy is an internal class that allows for direct getter/setter style property access to Arrays and TypedArrays but inverses the values on set.
An array of 2d vectors that form the convex or concave polygon.
+ Either [[0,0], [0,1],...] or a flat array of numbers that will be interpreted as [x,y, x,y, ...],
+ or the arguments passed can be flat x,y values e.g. setPolygon(options, x,y, x,y, x,y, ...) where x and y are numbers.
An array of 2d vectors that form the convex or concave polygon.
+ Either [[0,0], [0,1],...] or a flat array of numbers that will be interpreted as [x,y, x,y, ...],
+ or the arguments passed can be flat x,y values e.g. setPolygon(options, x,y, x,y, x,y, ...) where x and y are numbers.
Creates a Material. Materials are applied to Shapes owned by a Body and can be set with Body.setMaterial().
+Materials are a way to control what happens when Shapes collide. Combine unique Materials together to create Contact Materials.
+Contact Materials have properties such as friction and restitution that allow for fine-grained collision control between different Materials.
+
+
+
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+
+
Name
+
+
+
Type
+
+
+
Argument
+
+
+
+
+
Description
+
+
+
+
+
+
+
+
+
name
+
+
+
+
+
+string
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
Optional name of the Material. Each Material has a unique ID but string names are handy for debugging.
setBounds(x, y, width, height, left, right, top, bottom, setCollisionGroup)
+
+
+
+
+
+
+
+
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.
+
+
+
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+
+
Name
+
+
+
Type
+
+
+
Argument
+
+
+
+
Default
+
+
+
Description
+
+
+
+
+
+
+
+
+
x
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
The x coordinate of the top-left corner of the bounds.
+
+
+
+
+
+
+
y
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
The y coordinate of the top-left corner of the bounds.
+
+
+
+
+
+
+
width
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
The width of the bounds.
+
+
+
+
+
+
+
height
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
The height of the bounds.
+
+
+
+
+
+
+
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.
+
+
+
+
+
+
+
setCollisionGroup
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+ <optional>
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
If true the Bounds will be set to use its own Collision Group.
@@ -577,7 +2083,7 @@
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:29 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:30 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Phaser.Plugin.html b/docs/Phaser.Plugin.html
index eb7dbfeb..93e78c8a 100644
--- a/docs/Phaser.Plugin.html
+++ b/docs/Phaser.Plugin.html
@@ -166,6 +166,10 @@
Game
+
@@ -1944,7 +1980,7 @@ It is only called if active is set to true.
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:29 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:31 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Phaser.PluginManager.html b/docs/Phaser.PluginManager.html
index 4fc191e1..9bcb5f32 100644
--- a/docs/Phaser.PluginManager.html
+++ b/docs/Phaser.PluginManager.html
@@ -166,6 +166,10 @@
Game
+
@@ -1609,7 +1645,7 @@ It only calls plugins who have active=true.
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:29 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:31 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Phaser.Point.html b/docs/Phaser.Point.html
index 62257788..8a39d141 100644
--- a/docs/Phaser.Point.html
+++ b/docs/Phaser.Point.html
@@ -166,6 +166,10 @@
Game
+
@@ -5469,7 +5505,7 @@
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:30 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:31 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Phaser.Pointer.html b/docs/Phaser.Pointer.html
index 18255a3b..2bf4fc01 100644
--- a/docs/Phaser.Pointer.html
+++ b/docs/Phaser.Pointer.html
@@ -166,6 +166,10 @@
Game
+
@@ -4447,7 +4483,7 @@ If you wish to check if the Pointer was released just once then see the Sprite.e
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:30 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:31 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Phaser.Polygon.html b/docs/Phaser.Polygon.html
index 59526d5c..bfba0ab3 100644
--- a/docs/Phaser.Polygon.html
+++ b/docs/Phaser.Polygon.html
@@ -166,6 +166,10 @@
Game
+
@@ -1102,7 +1138,7 @@ arguments passed can be flat x,y values e.g. new Phaser.Polygon(x,y, x,y,
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:30 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:32 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Phaser.RandomDataGenerator.html b/docs/Phaser.RandomDataGenerator.html
index 14e8f03f..1abc018c 100644
--- a/docs/Phaser.RandomDataGenerator.html
+++ b/docs/Phaser.RandomDataGenerator.html
@@ -166,6 +166,10 @@
Game
+
@@ -2075,7 +2111,7 @@ Random number generator from
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:30 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:32 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Phaser.Rectangle.html b/docs/Phaser.Rectangle.html
index 14a4822e..ec1300ea 100644
--- a/docs/Phaser.Rectangle.html
+++ b/docs/Phaser.Rectangle.html
@@ -166,6 +166,10 @@
Game
+
@@ -7672,7 +7708,7 @@ This method checks the x, y, width, and height properties of the Rectangles.
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:30 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:32 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Phaser.RenderTexture.html b/docs/Phaser.RenderTexture.html
index 7b369a48..95788e6d 100644
--- a/docs/Phaser.RenderTexture.html
+++ b/docs/Phaser.RenderTexture.html
@@ -166,6 +166,10 @@
Game
+
+
@@ -1064,7 +1620,7 @@
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:30 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:32 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Phaser.RequestAnimationFrame.html b/docs/Phaser.RequestAnimationFrame.html
index 69f81237..f4611c86 100644
--- a/docs/Phaser.RequestAnimationFrame.html
+++ b/docs/Phaser.RequestAnimationFrame.html
@@ -166,6 +166,10 @@
Game
+
@@ -1341,7 +1534,7 @@
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:30 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:32 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Phaser.Signal.html b/docs/Phaser.Signal.html
index 1c6e73c3..18afda0b 100644
--- a/docs/Phaser.Signal.html
+++ b/docs/Phaser.Signal.html
@@ -166,6 +166,10 @@
Game
+
@@ -2326,7 +2362,7 @@ IMPORTANT: should be called only during signal dispatch, calling it before/after
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:30 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:32 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Phaser.SinglePad.html b/docs/Phaser.SinglePad.html
index e9b43d7b..251dff3a 100644
--- a/docs/Phaser.SinglePad.html
+++ b/docs/Phaser.SinglePad.html
@@ -166,6 +166,10 @@
Game
+
@@ -2103,6 +2139,289 @@ The Key object can then be polled, have events attached to it, etc.
+
+
+
+
+
+
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
@@ -2714,202 +2892,6 @@ analog trigger buttons on the XBOX 360 controller
-
-
-
-
-
-
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.
True if the button is just released otherwise false.
-
-
-
-
-
-
- Type
-
-
-
-boolean
-
-
-
-
-
-
-
-
-
@@ -3106,6 +3088,202 @@ analog trigger buttons on the XBOX 360 controller
+
+
+
+
+
+
justReleased(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.
True if the button is just released otherwise false.
+
+
+
+
+
+
+ Type
+
+
+
+boolean
+
+
+
+
+
+
+
+
+
@@ -3813,7 +3991,7 @@ analog trigger buttons on the XBOX 360 controller
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:31 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:32 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Phaser.Sound.html b/docs/Phaser.Sound.html
index 5851b38f..e5f9ed40 100644
--- a/docs/Phaser.Sound.html
+++ b/docs/Phaser.Sound.html
@@ -166,6 +166,10 @@
Game
+
@@ -5837,7 +5873,7 @@ This allows you to bundle multiple sounds together into a single audio file and
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:31 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:32 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Phaser.SoundManager.html b/docs/Phaser.SoundManager.html
index 0a3233fe..55cac110 100644
--- a/docs/Phaser.SoundManager.html
+++ b/docs/Phaser.SoundManager.html
@@ -166,6 +166,10 @@
Game
+
@@ -2895,7 +2931,7 @@ Note: On Firefox 25+ on Linux if you have media.gstreamer disabled in about:conf
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:31 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:33 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Phaser.Sprite.html b/docs/Phaser.Sprite.html
index cf18d6cc..8475e04b 100644
--- a/docs/Phaser.Sprite.html
+++ b/docs/Phaser.Sprite.html
@@ -166,6 +166,10 @@
Game
+
@@ -1073,7 +1115,7 @@ Be advised this is quite an expensive operation, as it has to calculate the boun
-Phaser.Physics.Body
+Phaser.Physics.Body
|
null
@@ -1115,7 +1157,7 @@ Be advised this is quite an expensive operation, as it has to calculate the boun
@@ -5445,7 +5348,7 @@ It will dispatch the onRevived event, you can listen to Sprite.events.onRevived
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:31 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:33 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Phaser.SpriteBatch.html b/docs/Phaser.SpriteBatch.html
index 41be5c71..35553d3d 100644
--- a/docs/Phaser.SpriteBatch.html
+++ b/docs/Phaser.SpriteBatch.html
@@ -166,6 +166,10 @@
Game
+
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').
Allows you to call your own function on each member of this Group where child.exists=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.forEachExists(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').
@@ -9163,7 +9199,7 @@ You cannot swap a child with itself, or swap un-parented children, doing so will
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:31 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:33 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Phaser.Stage.html b/docs/Phaser.Stage.html
index b325f73c..3e0a12ad 100644
--- a/docs/Phaser.Stage.html
+++ b/docs/Phaser.Stage.html
@@ -166,6 +166,10 @@
Game
+
@@ -1939,7 +1975,7 @@ Most objects have preUpdate methods and it's where initial movement and position
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:31 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:33 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Phaser.StageScaleMode.html b/docs/Phaser.StageScaleMode.html
index 889cdf36..ef73be97 100644
--- a/docs/Phaser.StageScaleMode.html
+++ b/docs/Phaser.StageScaleMode.html
@@ -166,6 +166,10 @@
Game
+
@@ -5228,7 +5264,7 @@ Please note that this needs to be supported by the web browser and isn't the sam
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:31 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:33 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Phaser.State.html b/docs/Phaser.State.html
index 54a31fad..2344d187 100644
--- a/docs/Phaser.State.html
+++ b/docs/Phaser.State.html
@@ -166,6 +166,10 @@
Game
+
@@ -2606,7 +2642,7 @@ If you need to use the loader, you may need to use them here.
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:32 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:33 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Phaser.StateManager.html b/docs/Phaser.StateManager.html
index 3c0bf092..4cf5f866 100644
--- a/docs/Phaser.StateManager.html
+++ b/docs/Phaser.StateManager.html
@@ -166,6 +166,10 @@
Game
+
@@ -3310,7 +3346,7 @@ State must exist and have at least one callback function registered..
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:32 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:34 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Phaser.Text.html b/docs/Phaser.Text.html
index 6d75216e..584e5b3b 100644
--- a/docs/Phaser.Text.html
+++ b/docs/Phaser.Text.html
@@ -166,6 +166,10 @@
Game
+
Create a new Text object. This uses a local hidden Canvas object and renders the type into it. It then makes a texture from this for renderning to the view.
+Because of this you can only display fonts that are currently loaded and available to the browser. It won't load the fonts for you.
+Here is a compatibility table showing the available default fonts across different mobile browsers: http://www.jordanm.co.uk/tinytype
@@ -4360,7 +4404,7 @@ activated for this object and it will then start to process click/touch events a
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:32 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:34 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Phaser.Tile.html b/docs/Phaser.Tile.html
index e92d0bf6..4d1a6ec1 100644
--- a/docs/Phaser.Tile.html
+++ b/docs/Phaser.Tile.html
@@ -166,6 +166,10 @@
Game
+
@@ -4003,7 +4039,7 @@ The callback must true true for collision processing to take place.
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:32 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:34 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Phaser.TileSprite.html b/docs/Phaser.TileSprite.html
index d822bdc1..a692a5d9 100644
--- a/docs/Phaser.TileSprite.html
+++ b/docs/Phaser.TileSprite.html
@@ -166,6 +166,10 @@
Game
+
@@ -2876,7 +2912,7 @@ If the requested animation is already playing this request will be ignored. If y
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:33 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:34 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Phaser.Tilemap.html b/docs/Phaser.Tilemap.html
index 3e920abb..53b74e55 100644
--- a/docs/Phaser.Tilemap.html
+++ b/docs/Phaser.Tilemap.html
@@ -166,6 +166,10 @@
Game
+
@@ -10959,7 +10995,7 @@ If you want to set a callback for a tile at a specific location on the map then
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:32 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:34 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Phaser.TilemapLayer.html b/docs/Phaser.TilemapLayer.html
index 3c724fe2..3ee341c3 100644
--- a/docs/Phaser.TilemapLayer.html
+++ b/docs/Phaser.TilemapLayer.html
@@ -166,6 +166,10 @@
Game
+
@@ -4638,7 +4674,7 @@ half as quickly as the 'normal' camera-locked layers do)
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:32 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:34 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Phaser.TilemapParser.html b/docs/Phaser.TilemapParser.html
index 8c810879..f6f5793d 100644
--- a/docs/Phaser.TilemapParser.html
+++ b/docs/Phaser.TilemapParser.html
@@ -166,6 +166,10 @@
Game
+
Parse tileset data from the cache and creates a Tileset object.
+
Parse tilemap data from the cache and creates a Tilemap object.
@@ -1573,7 +1609,7 @@
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:32 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:34 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Phaser.Tileset.html b/docs/Phaser.Tileset.html
index c2c0f642..557a06a2 100644
--- a/docs/Phaser.Tileset.html
+++ b/docs/Phaser.Tileset.html
@@ -166,6 +166,10 @@
Game
+
@@ -2640,7 +2676,7 @@ You should not normally instantiate this class directly.
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:33 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:34 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Phaser.Time.html b/docs/Phaser.Time.html
index 0c5e9aa4..543419d3 100644
--- a/docs/Phaser.Time.html
+++ b/docs/Phaser.Time.html
@@ -166,6 +166,10 @@
Game
+
@@ -3120,7 +3156,7 @@
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:33 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:35 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Phaser.Timer.html b/docs/Phaser.Timer.html
index d703b0b3..72e43077 100644
--- a/docs/Phaser.Timer.html
+++ b/docs/Phaser.Timer.html
@@ -166,6 +166,10 @@
Game
+
@@ -3784,7 +3820,7 @@ If the Timer is already running the delay will be calculated based on the timers
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:33 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:35 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Phaser.TimerEvent.html b/docs/Phaser.TimerEvent.html
index 54261eb9..68696d96 100644
--- a/docs/Phaser.TimerEvent.html
+++ b/docs/Phaser.TimerEvent.html
@@ -166,6 +166,10 @@
Game
+
@@ -1709,7 +1745,7 @@ It can call a specific callback, passing in optional parameters.
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:33 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:35 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Phaser.Touch.html b/docs/Phaser.Touch.html
index b79e8f9a..5f77cf04 100644
--- a/docs/Phaser.Touch.html
+++ b/docs/Phaser.Touch.html
@@ -166,6 +166,10 @@
Game
+
@@ -2679,7 +2715,7 @@ Doesn't appear to be supported by most browsers on a canvas element yet.
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:33 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:35 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Phaser.Tween.html b/docs/Phaser.Tween.html
index 9fa9f675..1c051b46 100644
--- a/docs/Phaser.Tween.html
+++ b/docs/Phaser.Tween.html
@@ -166,6 +166,10 @@
Game
+
@@ -3168,7 +3204,7 @@ Used in combination with repeat you can create endless loops.
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:33 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:35 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Phaser.TweenManager.html b/docs/Phaser.TweenManager.html
index 9d2525ea..0a9df269 100644
--- a/docs/Phaser.TweenManager.html
+++ b/docs/Phaser.TweenManager.html
@@ -166,6 +166,10 @@
Game
+
@@ -1672,7 +1708,7 @@ Please see https://github.com/sole/tw
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:33 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:35 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Phaser.Utils.Debug.html b/docs/Phaser.Utils.Debug.html
index 1983e6d4..ecec4f96 100644
--- a/docs/Phaser.Utils.Debug.html
+++ b/docs/Phaser.Utils.Debug.html
@@ -166,6 +166,10 @@
Game
+
@@ -6675,7 +7140,7 @@ your game set to use Phaser.AUTO then swap it for Phaser.CANVAS to ensure WebGL
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:34 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:35 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Phaser.Utils.html b/docs/Phaser.Utils.html
index 5dedb87a..7e61abb8 100644
--- a/docs/Phaser.Utils.html
+++ b/docs/Phaser.Utils.html
@@ -166,6 +166,10 @@
Game
+
@@ -1297,7 +1333,7 @@ dir = 1 (left), 2 (right), 3 (both)
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:34 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:35 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Phaser.World.html b/docs/Phaser.World.html
index 85665af2..00366e5b 100644
--- a/docs/Phaser.World.html
+++ b/docs/Phaser.World.html
@@ -166,6 +166,10 @@
Game
+
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').
Allows you to call your own function on each member of this Group where child.exists=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.forEachExists(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').
@@ -10146,7 +10182,7 @@ You cannot swap a child with itself, or swap un-parented children, doing so will
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:34 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:36 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Phaser.html b/docs/Phaser.html
index a2c09d20..2dbbe412 100644
--- a/docs/Phaser.html
+++ b/docs/Phaser.html
@@ -166,6 +166,10 @@
Game
+
@@ -768,7 +810,7 @@
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:21 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:22 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Phaser.js.html b/docs/Phaser.js.html
index 0ea5449c..4490ca6b 100644
--- a/docs/Phaser.js.html
+++ b/docs/Phaser.js.html
@@ -166,6 +166,10 @@
Game
+
@@ -597,7 +633,7 @@ Phaser.Plugin.prototype.constructor = Phaser.Plugin;
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:20 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:22 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/PluginManager.js.html b/docs/PluginManager.js.html
index 3b6e00c6..f0d45c44 100644
--- a/docs/PluginManager.js.html
+++ b/docs/PluginManager.js.html
@@ -166,6 +166,10 @@
Game
+
@@ -773,7 +809,7 @@ Phaser.PluginManager.prototype.constructor = Phaser.PluginManager;
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:20 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:22 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Point.js.html b/docs/Point.js.html
index 8ac30aac..3eb655a9 100644
--- a/docs/Point.js.html
+++ b/docs/Point.js.html
@@ -166,6 +166,10 @@
Game
+
@@ -1120,7 +1156,7 @@ Object.defineProperty(Phaser.Pointer.prototype, "worldY", {
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:20 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:22 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Polygon.js.html b/docs/Polygon.js.html
index 0213c160..40673184 100644
--- a/docs/Polygon.js.html
+++ b/docs/Polygon.js.html
@@ -166,6 +166,10 @@
Game
+
@@ -584,7 +620,7 @@ PIXI.Polygon = Phaser.Polygon;
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:20 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:22 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/RandomDataGenerator.js.html b/docs/RandomDataGenerator.js.html
index 0fc57185..29fac511 100644
--- a/docs/RandomDataGenerator.js.html
+++ b/docs/RandomDataGenerator.js.html
@@ -166,6 +166,10 @@
Game
+
@@ -723,7 +759,7 @@ Phaser.RandomDataGenerator.prototype.constructor = Phaser.RandomDataGenerator;
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:20 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:22 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Rectangle.js.html b/docs/Rectangle.js.html
index 229b9ebd..24ee51e5 100644
--- a/docs/Rectangle.js.html
+++ b/docs/Rectangle.js.html
@@ -166,6 +166,10 @@
Game
+
@@ -1250,7 +1286,7 @@ PIXI.EmptyRectangle = new Phaser.Rectangle(0, 0, 0, 0);
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:20 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:22 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/RenderTexture.js.html b/docs/RenderTexture.js.html
index 00bad73a..6f508850 100644
--- a/docs/RenderTexture.js.html
+++ b/docs/RenderTexture.js.html
@@ -166,6 +166,10 @@
Game
+
@@ -485,12 +521,54 @@ Phaser.RenderTexture = function (game, width, height, key) {
*/
this.type = Phaser.RENDERTEXTURE;
+ /**
+ * @property {Phaser.Point} _temp - Internal var.
+ * @private
+ */
+ this._temp = new Phaser.Point();
+
PIXI.RenderTexture.call(this, width, height);
};
Phaser.RenderTexture.prototype = Object.create(PIXI.RenderTexture.prototype);
Phaser.RenderTexture.prototype.constructor = Phaser.RenderTexture;
+
+/**
+* This function will draw the display object to the texture.
+*
+* @method Phaser.RenderTexture.prototype.renderXY
+* @param {Phaser.Sprite|Phaser.Image|Phaser.Text|Phaser.BitmapText|Phaser.Group} displayObject The display object to render to this texture.
+* @param {number} x - The x position to render the object at.
+* @param {number} y - The y position to render the object at.
+* @param {boolean} clear - If true the texture will be cleared before the display object is drawn.
+*/
+Phaser.RenderTexture.prototype.renderXY = function (displayObject, x, y, clear) {
+
+ this._temp.set(x, y);
+
+ this.render(displayObject, this._temp, clear);
+
+}
+
+// Documentation stubs
+
+/**
+* This function will draw the display object to the texture.
+*
+* @method Phaser.RenderTexture.prototype.render
+* @param {Phaser.Sprite|Phaser.Image|Phaser.Text|Phaser.BitmapText|Phaser.Group} displayObject The display object to render to this texture.
+* @param {Phaser.Point} position - A Point object containing the position to render the display object at.
+* @param {boolean} clear - If true the texture will be cleared before the display object is drawn.
+*/
+
+/**
+* Resize this RenderTexture to the given width and height.
+*
+* @method Phaser.RenderTexture.prototype.resize
+* @param {number} width - The new width of the RenderTexture.
+* @param {number} height - The new height of the RenderTexture.
+*/
@@ -512,7 +590,7 @@ Phaser.RenderTexture.prototype.constructor = Phaser.RenderTexture;
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:20 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:21 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/RequestAnimationFrame.js.html b/docs/RequestAnimationFrame.js.html
index 7110e8b2..58b8152f 100644
--- a/docs/RequestAnimationFrame.js.html
+++ b/docs/RequestAnimationFrame.js.html
@@ -166,6 +166,10 @@
Game
+
@@ -778,7 +814,7 @@ Phaser.Signal.prototype.constructor = Phaser.Signal;
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:20 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:22 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/SignalBinding.html b/docs/SignalBinding.html
index eb256b6d..59511c17 100644
--- a/docs/SignalBinding.html
+++ b/docs/SignalBinding.html
@@ -166,6 +166,10 @@
Game
+
@@ -771,7 +807,7 @@ Inspired by Joa Ebert AS3 SignalBinding and Robert Penner's Slot classes.
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:34 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:36 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/SignalBinding.js.html b/docs/SignalBinding.js.html
index 215745fd..3172b2b5 100644
--- a/docs/SignalBinding.js.html
+++ b/docs/SignalBinding.js.html
@@ -166,6 +166,10 @@
Game
+
@@ -638,7 +674,7 @@ Phaser.SignalBinding.prototype.constructor = Phaser.SignalBinding;
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:20 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:22 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/SinglePad.js.html b/docs/SinglePad.js.html
index cb36f2d9..93e93c62 100644
--- a/docs/SinglePad.js.html
+++ b/docs/SinglePad.js.html
@@ -166,6 +166,10 @@
Game
+
@@ -572,7 +608,7 @@ 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
+ * @method Phaser.SinglePad#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
@@ -662,8 +698,8 @@ Phaser.SinglePad.prototype = {
/**
* Gamepad connect function, should be called by Phaser.Gamepad
- * @param {Object} rawPad - The raw gamepad object
* @method Phaser.SinglePad#connect
+ * @param {Object} rawPad - The raw gamepad object
*/
connect: function (rawPad) {
@@ -715,8 +751,8 @@ Phaser.SinglePad.prototype = {
/**
* Handles changes in axis
- * @param {Object} axisState - State of the relevant axis
* @method Phaser.SinglePad#processAxisChange
+ * @param {Object} axisState - State of the relevant axis
*/
processAxisChange: function (axisState) {
@@ -746,9 +782,9 @@ Phaser.SinglePad.prototype = {
/**
* Handles button down press
+ * @method Phaser.SinglePad#processButtonDown
* @param {number} buttonCode - Which buttonCode of this button
* @param {Object} value - Button value
- * @method Phaser.SinglePad#processButtonDown
*/
processButtonDown: function (buttonCode, value) {
@@ -804,9 +840,9 @@ Phaser.SinglePad.prototype = {
/**
* Handles button release
+ * @method Phaser.SinglePad#processButtonUp
* @param {number} buttonCode - Which buttonCode of this button
* @param {Object} value - Button value
- * @method Phaser.SinglePad#processButtonUp
*/
processButtonUp: function (buttonCode, value) {
@@ -852,9 +888,9 @@ Phaser.SinglePad.prototype = {
/**
* Handles buttons with floating values (like analog buttons that acts almost like an axis but still registers like a button)
+ * @method Phaser.SinglePad#processButtonFloat
* @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) {
@@ -893,7 +929,7 @@ Phaser.SinglePad.prototype = {
/**
* Returns value of requested axis
- * @method Phaser.SinglePad#isDown
+ * @method Phaser.SinglePad#axis
* @param {number} axisCode - The index of the axis to check
* @return {number} Axis value if available otherwise false
*/
@@ -927,7 +963,7 @@ Phaser.SinglePad.prototype = {
/**
* 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
+ * @method Phaser.SinglePad#justReleased
* @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.
@@ -1043,7 +1079,7 @@ Object.defineProperty(Phaser.SinglePad.prototype, "index", {
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:20 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:22 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Sound.js.html b/docs/Sound.js.html
index 7f0680f3..7d959b39 100644
--- a/docs/Sound.js.html
+++ b/docs/Sound.js.html
@@ -166,6 +166,10 @@
Game
+
@@ -1299,7 +1335,7 @@ Object.defineProperty(Phaser.Sound.prototype, "volume", {
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:20 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:22 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/SoundManager.js.html b/docs/SoundManager.js.html
index f936684e..ac447ac6 100644
--- a/docs/SoundManager.js.html
+++ b/docs/SoundManager.js.html
@@ -166,6 +166,10 @@
Game
+
@@ -469,6 +505,7 @@
* events (via Sprite.events), animation (via Sprite.animations), camera culling and more. Please see the Examples for use cases.
*
* @constructor
+* @extends PIXI.Sprite
* @param {Phaser.Game} game - A reference to the currently running game.
* @param {number} x - The x coordinate (in world space) to position the Sprite at.
* @param {number} y - The y coordinate (in world space) to position the Sprite at.
@@ -946,11 +983,6 @@ Phaser.Sprite.prototype.kill = function() {
*/
Phaser.Sprite.prototype.destroy = function() {
- if (this.filters)
- {
- this.filters = null;
- }
-
if (this.parent)
{
this.parent.remove(this);
@@ -976,10 +1008,19 @@ Phaser.Sprite.prototype.destroy = function() {
this.events.destroy();
}
+ var i = this.children.length;
+
+ while (i--)
+ {
+ this.removeChild(this.children[i]);
+ }
+
this.alive = false;
this.exists = false;
this.visible = false;
+ this.filters = null;
+ this.mask = null;
this.game = null;
};
@@ -1371,7 +1412,6 @@ Object.defineProperty(Phaser.Sprite.prototype, "exists", {
});
-
/**
* An Sprite that is fixed to the camera uses its x/y coordinates as offsets from the top left of the camera. These are stored in Sprite.cameraOffset.
* Note that the cameraOffset values are in addition to any parent in the display list.
@@ -1423,7 +1463,7 @@ Object.defineProperty(Phaser.Sprite.prototype, "fixedToCamera", {
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:20 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:22 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/SpriteBatch.js.html b/docs/SpriteBatch.js.html
index d79a738e..acaeb69c 100644
--- a/docs/SpriteBatch.js.html
+++ b/docs/SpriteBatch.js.html
@@ -166,6 +166,10 @@
Game
+
@@ -509,7 +545,7 @@ Phaser.SpriteBatch.prototype.constructor = Phaser.SpriteBatch;
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:20 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:22 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Stage.js.html b/docs/Stage.js.html
index 7cf3fa67..26ff3886 100644
--- a/docs/Stage.js.html
+++ b/docs/Stage.js.html
@@ -166,6 +166,10 @@
Game
+
@@ -799,7 +835,7 @@ Object.defineProperty(Phaser.Stage.prototype, "backgroundColor", {
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:20 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:22 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/StageScaleMode.js.html b/docs/StageScaleMode.js.html
index ebbd3ecd..c7c64c2b 100644
--- a/docs/StageScaleMode.js.html
+++ b/docs/StageScaleMode.js.html
@@ -166,6 +166,10 @@
Game
+
@@ -1257,7 +1293,7 @@ Object.defineProperty(Phaser.StageScaleMode.prototype, "isLandscape", {
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:20 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:22 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/State.js.html b/docs/State.js.html
index 0c89f806..32e17c26 100644
--- a/docs/State.js.html
+++ b/docs/State.js.html
@@ -166,6 +166,10 @@
Game
+
@@ -645,7 +681,7 @@ Phaser.State.prototype.constructor = Phaser.State;
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:20 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:22 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/StateManager.js.html b/docs/StateManager.js.html
index 49641e12..bc2763df 100644
--- a/docs/StateManager.js.html
+++ b/docs/StateManager.js.html
@@ -166,6 +166,10 @@
Game
+
@@ -460,8 +496,12 @@
*/
/**
-* Create a new `Text` object.
+* Create a new `Text` object. This uses a local hidden Canvas object and renders the type into it. It then makes a texture from this for renderning to the view.
+* Because of this you can only display fonts that are currently loaded and available to the browser. It won't load the fonts for you.
+* Here is a compatibility table showing the available default fonts across different mobile browsers: http://www.jordanm.co.uk/tinytype
+*
* @class Phaser.Text
+* @extends PIXI.Text
* @constructor
* @param {Phaser.Game} game - Current game instance.
* @param {number} x - X position of the new text object.
@@ -622,7 +662,6 @@ Phaser.Text.prototype.update = function() {
*/
Phaser.Text.prototype.postUpdate = function () {
- // Fixed to Camera?
if (this._cache[7] === 1)
{
this.position.x = this.game.camera.view.x + this.cameraOffset.x;
@@ -636,11 +675,6 @@ Phaser.Text.prototype.postUpdate = function () {
*/
Phaser.Text.prototype.destroy = function () {
- if (this.filters)
- {
- this.filters = null;
- }
-
if (this.parent)
{
this.parent.remove(this);
@@ -658,9 +692,18 @@ Phaser.Text.prototype.destroy = function () {
this.context = null;
}
+ var i = this.children.length;
+
+ while (i--)
+ {
+ this.removeChild(this.children[i]);
+ }
+
this.exists = false;
this.visible = false;
+ this.filters = null;
+ this.mask = null;
this.game = null;
}
@@ -1285,7 +1328,7 @@ Object.defineProperty(Phaser.Text.prototype, "fixedToCamera", {
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:20 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:22 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Tile.js.html b/docs/Tile.js.html
index 6b470c06..15856305 100644
--- a/docs/Tile.js.html
+++ b/docs/Tile.js.html
@@ -166,6 +166,10 @@
Game
+
@@ -767,7 +803,7 @@ Object.defineProperty(Phaser.Tile.prototype, "bottom", {
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:20 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:22 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/TileSprite.js.html b/docs/TileSprite.js.html
index e772067b..1fb1e9cb 100644
--- a/docs/TileSprite.js.html
+++ b/docs/TileSprite.js.html
@@ -166,6 +166,10 @@
Game
+
@@ -1889,7 +1925,7 @@ Phaser.Tilemap.prototype.constructor = Phaser.Tilemap;
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:20 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:22 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/TilemapLayer.js.html b/docs/TilemapLayer.js.html
index 6daa61f4..c057bf76 100644
--- a/docs/TilemapLayer.js.html
+++ b/docs/TilemapLayer.js.html
@@ -166,6 +166,10 @@
Game
+
@@ -1354,7 +1390,7 @@ Object.defineProperty(Phaser.TilemapLayer.prototype, "collisionHeight", {
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:20 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:22 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/TilemapParser.js.html b/docs/TilemapParser.js.html
index b06d0881..7ca86c26 100644
--- a/docs/TilemapParser.js.html
+++ b/docs/TilemapParser.js.html
@@ -166,6 +166,10 @@
Game
+
@@ -521,7 +557,7 @@ Phaser.TilemapParser = {
},
/**
- * Parse tileset data from the cache and creates a Tileset object.
+ * Parse tilemap data from the cache and creates a Tilemap object.
* @method Phaser.TilemapParser.parse
* @param {Phaser.Game} game - Game reference to the currently running game.
* @param {string} key - The key of the tilemap in the Cache.
@@ -933,7 +969,7 @@ Phaser.TilemapParser = {
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:20 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:22 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Tileset.js.html b/docs/Tileset.js.html
index fc27a8f2..52ca0715 100644
--- a/docs/Tileset.js.html
+++ b/docs/Tileset.js.html
@@ -166,6 +166,10 @@
Game
+
@@ -630,7 +666,7 @@ Phaser.Tileset.prototype.constructor = Phaser.Tileset;
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:20 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:22 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Time.js.html b/docs/Time.js.html
index 7e4e0747..cfb57c5b 100644
--- a/docs/Time.js.html
+++ b/docs/Time.js.html
@@ -166,6 +166,10 @@
Game
+
@@ -821,7 +857,7 @@ Phaser.Time.prototype.constructor = Phaser.Time;
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:20 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:22 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Timer.js.html b/docs/Timer.js.html
index 378175f6..cabba614 100644
--- a/docs/Timer.js.html
+++ b/docs/Timer.js.html
@@ -166,6 +166,10 @@
Game
+
@@ -983,7 +1019,7 @@ Phaser.Timer.prototype.constructor = Phaser.Timer;
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:20 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:22 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/TimerEvent.js.html b/docs/TimerEvent.js.html
index 684a55ff..b5b57d71 100644
--- a/docs/TimerEvent.js.html
+++ b/docs/TimerEvent.js.html
@@ -166,6 +166,10 @@
Game
+
@@ -547,7 +583,7 @@ Phaser.TimerEvent.prototype.constructor = Phaser.TimerEvent;
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:20 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:22 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Touch.js.html b/docs/Touch.js.html
index cdef914b..8223f21a 100644
--- a/docs/Touch.js.html
+++ b/docs/Touch.js.html
@@ -166,6 +166,10 @@
Game
+
@@ -845,7 +881,7 @@ Phaser.Touch.prototype.constructor = Phaser.Touch;
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:20 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:22 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/Tween.js.html b/docs/Tween.js.html
index a21786a1..bbe88916 100644
--- a/docs/Tween.js.html
+++ b/docs/Tween.js.html
@@ -166,6 +166,10 @@
Game
+
@@ -1053,7 +1089,7 @@ Phaser.Tween.prototype.constructor = Phaser.Tween;
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:20 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:22 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/TweenManager.js.html b/docs/TweenManager.js.html
index d2479aa3..c08f1aa9 100644
--- a/docs/TweenManager.js.html
+++ b/docs/TweenManager.js.html
@@ -166,6 +166,10 @@
Game
+
/**
+* @author Richard Davey <rich@photonstorm.com>
+* @copyright 2014 Photon Storm Ltd.
+* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+*/
+
+/**
+* "This world is but a canvas to our imagination." - Henry David Thoreau
+*
+* A game has only one world. The world is an abstract place in which all game objects live. It is not bound
+* by stage limits and can be any size. You look into the world via cameras. All game objects live within
+* 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.
+*/
+Phaser.World = function (game) {
+
+ Phaser.Group.call(this, game, null, '__world', false);
+
+ /**
+ * 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.
+ * However 0,0 is actually the center of the world, and if you rotate or scale the world all of that will happen from 0,0.
+ * So if you want to make a game in which the world itself will rotate you should adjust the bounds so that 0,0 is the center point, i.e. set them to -1000,-1000,2000,2000 for a 2000x2000 sized world centered around 0,0.
+ * @property {Phaser.Rectangle} bounds - Bound of this world that objects can not escape from.
+ */
+ this.bounds = new Phaser.Rectangle(0, 0, game.width, game.height);
+
+ /**
+ * @property {Phaser.Camera} camera - Camera instance.
+ */
+ this.camera = null;
+
+ /**
+ * @property {number} currentRenderOrderID - Reset each frame, keeps a count of the total number of objects updated.
+ */
+ this.currentRenderOrderID = 0;
+
+}
+
+Phaser.World.prototype = Object.create(Phaser.Group.prototype);
+Phaser.World.prototype.constructor = Phaser.World;
+
+/**
+* Initialises the game world.
+*
+* @method Phaser.World#boot
+* @protected
+*/
+Phaser.World.prototype.boot = function () {
+
+ this.camera = new Phaser.Camera(this.game, 0, 0, 0, this.game.width, this.game.height);
+
+ this.camera.displayObject = this;
+
+ this.game.camera = this.camera;
+
+ this.game.stage.addChild(this);
+
+}
+
+/**
+* Updates the size of this world. Note that this doesn't modify the world x/y coordinates, just the width and height.
+*
+* @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. 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();
+
+}
+
+/**
+* Destroyer of worlds.
+* @method Phaser.World#destroy
+*/
+Phaser.World.prototype.destroy = function () {
+
+ this.camera.reset();
+
+ this.game.input.reset(true);
+
+ this.removeAll();
+
+}
+
+/**
+* @name Phaser.World#width
+* @property {number} width - Gets or sets the current width of the game world.
+*/
+Object.defineProperty(Phaser.World.prototype, "width", {
+
+ get: function () {
+ return this.bounds.width;
+ },
+
+ set: function (value) {
+ this.bounds.width = value;
+ }
+
+});
+
+/**
+* @name Phaser.World#height
+* @property {number} height - Gets or sets the current height of the game world.
+*/
+Object.defineProperty(Phaser.World.prototype, "height", {
+
+ get: function () {
+ return this.bounds.height;
+ },
+
+ set: function (value) {
+ this.bounds.height = value;
+ }
+
+});
+
+/**
+* @name Phaser.World#centerX
+* @property {number} centerX - Gets the X position corresponding to the center point of the world.
+* @readonly
+*/
+Object.defineProperty(Phaser.World.prototype, "centerX", {
+
+ get: function () {
+ return this.bounds.halfWidth;
+ }
+
+});
+
+/**
+* @name Phaser.World#centerY
+* @property {number} centerY - Gets the Y position corresponding to the center point of the world.
+* @readonly
+*/
+Object.defineProperty(Phaser.World.prototype, "centerY", {
+
+ get: function () {
+ return this.bounds.halfHeight;
+ }
+
+});
+
+/**
+* @name Phaser.World#randomX
+* @property {number} randomX - Gets a random integer which is lesser than or equal to the current width of the game world.
+* @readonly
+*/
+Object.defineProperty(Phaser.World.prototype, "randomX", {
+
+ get: function () {
+
+ if (this.bounds.x < 0)
+ {
+ return this.game.rnd.integerInRange(this.bounds.x, (this.bounds.width - Math.abs(this.bounds.x)));
+ }
+ else
+ {
+ return this.game.rnd.integerInRange(this.bounds.x, this.bounds.width);
+ }
+
+ }
+
+});
+
+/**
+* @name Phaser.World#randomY
+* @property {number} randomY - Gets a random integer which is lesser than or equal to the current height of the game world.
+* @readonly
+*/
+Object.defineProperty(Phaser.World.prototype, "randomY", {
+
+ get: function () {
+
+ if (this.bounds.y < 0)
+ {
+ return this.game.rnd.integerInRange(this.bounds.y, (this.bounds.height - Math.abs(this.bounds.y)));
+ }
+ else
+ {
+ return this.game.rnd.integerInRange(this.bounds.y, this.bounds.height);
+ }
+
+ }
+
+});
+
+
@@ -815,7 +881,7 @@
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:21 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:22 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/global.html b/docs/global.html
index feb3b182..b5185e31 100644
--- a/docs/global.html
+++ b/docs/global.html
@@ -166,6 +166,10 @@
Game
+
@@ -1221,7 +1257,7 @@ this function is taken from Starling Framework as its pretty neat ;)
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:21 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:22 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/index.html b/docs/index.html
index 4b75349d..2c595f8a 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -166,6 +166,10 @@
Game
+
Cache.getImageKeys and similar has been removed, please use Cache.getKeys(Phaser.Cache.IMAGE) instead, this now supports all 10 Cache data types.
After defining tiles that collide on a Tilemap, you need to call Tilemap.generateCollisionData(layer) to populate the physics world with the data required.
Phaser.QuadTree has been removed from core and moved to a plugin. It's no longer required, nor works with the physics system.
+
Phaser.Animation.frame now returns the frame of the current animation, rather than the global frame from the sprite sheet / atlas.
+
When adding a Group if the parent value is null the Group won't be added to the World, so you can add it when ready. If parent is undefined it's added to World by default.
New features:
@@ -580,6 +618,8 @@
World.reset now calls Camera.reset which sends the camera back to 0,0 and un-follows any object it may have been tracking.
Added hostname: '*' to the grunt-connect in Gruntfile.js (fixes #426)
Device, Canvas and GamePad classes all updated for better CocoonJS support (thanks Videlais)
+
BitmapData.alphaMask will draw the given image onto a BitmapData using an image as an alpha mask.
+
The new GameObjectCreator (which you access via game.make or State.make) lets you easily create an object but NOT add it to the display list.
Bug Fixes:
@@ -733,7 +773,7 @@ Sprites also have full Input support: click them, touch them, drag them around,
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:21 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:22 GMT-0000 (GMT) using the DocStrap template.
diff --git a/docs/namespaces.list.html b/docs/namespaces.list.html
index d34ce06d..747eeb6f 100644
--- a/docs/namespaces.list.html
+++ b/docs/namespaces.list.html
@@ -166,6 +166,10 @@
Game
+
@@ -815,7 +881,7 @@
Documentation generated by JSDoc 3.3.0-dev
- on Wed Feb 19 2014 05:26:21 GMT-0000 (GMT) using the DocStrap template.
+ on Fri Feb 21 2014 15:36:22 GMT-0000 (GMT) using the DocStrap template.
diff --git a/examples/wip/tilemap3.js b/examples/wip/tilemap3.js
new file mode 100644
index 00000000..eb3e62e2
--- /dev/null
+++ b/examples/wip/tilemap3.js
@@ -0,0 +1,41 @@
+
+var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render });
+// var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create, update: update, render: render });
+
+function preload() {
+
+ game.load.tilemap('map', 'assets/tilemaps/maps/test.json', null, Phaser.Tilemap.TILED_JSON);
+ game.load.image('tileset', 'assets/tilemaps/tiles/test.png');
+
+}
+
+var map;
+var layer;
+
+function create() {
+
+ game.stage.backgroundColor = '#787878';
+
+ map = game.add.tilemap('map');
+
+ map.addTilesetImage('tileset');
+
+ layer = map.createLayer('calque1');
+
+ console.log(layer);
+
+ // layer.resizeWorld();
+
+ // map.setCollisionBetween(1, 12);
+
+ // layer.debug = true;
+
+ // dump = map.generateCollisionData(layer);
+
+}
+
+function update() {
+}
+
+function render() {
+}
From 3ead8aee7b3a48c53522b381abfab311268e4968 Mon Sep 17 00:00:00 2001
From: photonstorm
Date: Fri, 21 Feb 2014 15:47:00 +0000
Subject: [PATCH 14/27] Updated Mouse to use event.button not event.which, so
the const references are correct (fix #464)
---
src/input/Mouse.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/input/Mouse.js b/src/input/Mouse.js
index 0a429375..033236f0 100644
--- a/src/input/Mouse.js
+++ b/src/input/Mouse.js
@@ -165,7 +165,7 @@ Phaser.Mouse.prototype = {
event.preventDefault();
}
- this.button = event.which;
+ this.button = event.button;
if (this.mouseDownCallback)
{
From 5c4dd26d2573363fa93769c207e3bc52acf01901 Mon Sep 17 00:00:00 2001
From: photonstorm
Date: Fri, 21 Feb 2014 15:50:02 +0000
Subject: [PATCH 15/27] Fixed for renderSpriteInfo.
---
README.md | 1 +
src/utils/Debug.js | 19 -------------------
2 files changed, 1 insertion(+), 19 deletions(-)
diff --git a/README.md b/README.md
index 97f876ef..e5663203 100644
--- a/README.md
+++ b/README.md
@@ -153,6 +153,7 @@ Bug Fixes:
* Fixed bug in Math.angleBetween where it was using the coordinates in the wrong order.
* Previously using a Pixel Perfect check didn't work if the Sprite was rotated or had a non-zero anchor point, now works under all conditions + atlas frames.
* If pixelPerfect Input Sprites overlapped each other the pixel check wasn't taken into consieration in the Pointer move method.
+* Updated Input.Mouse to use event.button not event.which, so the const reference from input.mouse.button is correct (thanks grimor)
TO DO:
diff --git a/src/utils/Debug.js b/src/utils/Debug.js
index a7a64b35..a42a3bcd 100644
--- a/src/utils/Debug.js
+++ b/src/utils/Debug.js
@@ -388,26 +388,7 @@ Phaser.Utils.Debug.prototype = {
this.line('x: ' + sprite.x.toFixed(1) + ' y: ' + sprite.y.toFixed(1));
this.line('angle: ' + sprite.angle.toFixed(1) + ' rotation: ' + sprite.rotation.toFixed(1));
this.line('visible: ' + sprite.visible + ' in camera: ' + sprite.inCamera);
- this.line('body x: ' + sprite.body.x.toFixed(1) + ' y: ' + sprite.body.y.toFixed(1));
- // 0 = scaleX
- // 1 = skewY
- // 2 = translateX
- // 3 = skewX
- // 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('sdx: ' + sprite.deltaX);
- this.line('sdy: ' + sprite.deltaY);
-
- // this.line('inCamera: ' + this.game.renderer.spriteRenderer.inCamera(this.game.camera, sprite));
this.stop();
},
From 3ac8fba9e89f39894a3f07b41de491bad0b62b3d Mon Sep 17 00:00:00 2001
From: photonstorm
Date: Fri, 21 Feb 2014 16:35:37 +0000
Subject: [PATCH 16/27] Body.x/y didn't use pxpi. Also fixed out of bounds
example.
---
examples/sprites/out of bounds.js | 6 ++++++
src/physics/Body.js | 8 ++++----
2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/examples/sprites/out of bounds.js b/examples/sprites/out of bounds.js
index 94ffc31f..23b7a51c 100644
--- a/examples/sprites/out of bounds.js
+++ b/examples/sprites/out of bounds.js
@@ -13,6 +13,10 @@ var aliens;
function create() {
+ // We only want world bounds on the left and right
+ game.physics.setBoundsToWorld(true, true, false, false);
+ game.physics.friction = 0;
+
player = game.add.sprite(400, 500, 'ship');
player.anchor.setTo(0.5, 0.5);
@@ -24,7 +28,9 @@ function create() {
{
var alien = aliens.create(200 + x * 48, y * 50, 'alien');
alien.name = 'alien' + x.toString() + y.toString();
+ alien.checkWorldBounds = true;
alien.events.onOutOfBounds.add(alienOut, this);
+ alien.physicsEnabled = true;
alien.body.velocity.y = 50 + Math.random() * 200;
}
}
diff --git a/src/physics/Body.js b/src/physics/Body.js
index 8c351911..a800f720 100644
--- a/src/physics/Body.js
+++ b/src/physics/Body.js
@@ -1467,13 +1467,13 @@ Object.defineProperty(Phaser.Physics.Body.prototype, "x", {
get: function () {
- return this.p2px(this.data.position[0]);
+ return this.p2pxi(this.data.position[0]);
},
set: function (value) {
- this.data.position[0] = this.px2p(value);
+ this.data.position[0] = this.px2pi(value);
}
@@ -1487,13 +1487,13 @@ Object.defineProperty(Phaser.Physics.Body.prototype, "y", {
get: function () {
- return this.p2px(this.data.position[1]);
+ return this.p2pxi(this.data.position[1]);
},
set: function (value) {
- this.data.position[1] = this.px2p(value);
+ this.data.position[1] = this.px2pi(value);
}
From 5a00a0ad97d86623ef147d3b54b70294b1082ca0 Mon Sep 17 00:00:00 2001
From: photonstorm
Date: Fri, 21 Feb 2014 16:57:45 +0000
Subject: [PATCH 17/27] TilemapParser will now throw a warning if the tileset
image isn't the right size for the tile dimensions (fixes #377)
---
README.md | 3 ++
labs/code/010 fixed to camera.js | 70 ++++++++++++++++++++++++++++++++
src/gameobjects/BitmapData.js | 2 +-
src/tilemap/TilemapParser.js | 9 +++-
4 files changed, 82 insertions(+), 2 deletions(-)
create mode 100644 labs/code/010 fixed to camera.js
diff --git a/README.md b/README.md
index e5663203..89afd9b3 100644
--- a/README.md
+++ b/README.md
@@ -137,6 +137,7 @@ Updates:
* Device, Canvas and GamePad classes all updated for better CocoonJS support (thanks Videlais)
* BitmapData.alphaMask will draw the given image onto a BitmapData using an image as an alpha mask.
* The new GameObjectCreator (which you access via game.make or State.make) lets you easily create an object but NOT add it to the display list.
+* TilemapParser will now throw a warning if the tileset image isn't the right size for the tile dimensions.
Bug Fixes:
@@ -154,6 +155,8 @@ Bug Fixes:
* Previously using a Pixel Perfect check didn't work if the Sprite was rotated or had a non-zero anchor point, now works under all conditions + atlas frames.
* If pixelPerfect Input Sprites overlapped each other the pixel check wasn't taken into consieration in the Pointer move method.
* Updated Input.Mouse to use event.button not event.which, so the const reference from input.mouse.button is correct (thanks grimor)
+* Text that was fixedToCamera would 'jitter' if the world scrolled. Now works as expected across all fixed objects.
+
TO DO:
diff --git a/labs/code/010 fixed to camera.js b/labs/code/010 fixed to camera.js
new file mode 100644
index 00000000..d900f3ef
--- /dev/null
+++ b/labs/code/010 fixed to camera.js
@@ -0,0 +1,70 @@
+
+var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create, update: update });
+
+function preload() {
+
+ game.load.image('backdrop', 'assets/pics/remember-me.jpg');
+ game.load.image('mushroom', 'assets/sprites/mushroom2.png');
+ game.load.image('coke', 'assets/sprites/cokecan.png');
+ game.load.bitmapFont('desyrel', 'assets/fonts/desyrel.png', 'assets/fonts/desyrel.xml', null, 0, -32);
+
+}
+
+var cursors;
+var mushroom;
+
+function create() {
+
+ game.world.setBounds(0, 0, 1920, 1200);
+ game.add.image(0, 0, 'backdrop');
+
+ mushroom = game.add.sprite(400, 400, 'mushroom');
+
+ // Test Fixing an Image to the Camera
+ var fixie = game.add.image(100, 100, 'coke');
+ fixie.fixedToCamera = true;
+
+ // And tween it
+ game.add.tween(fixie.cameraOffset).to({ y: 500 }, 2000, Phaser.Easing.Bounce.Out, true, 0, 1000, true);
+
+ // Test Fixing a Sprite to the Camera
+ var fixie2 = game.add.sprite(600, 100, 'coke');
+ fixie2.fixedToCamera = true;
+ fixie2.inputEnabled = true;
+ fixie2.input.enableDrag();
+
+ // Test Fixing a Text to the Camera
+ var text = game.add.text(300, 32, 'arrows to move\ndrag the can ->');
+ text.fixedToCamera = true;
+
+ // Test fixing a BitmapText to the Camera
+ var text2 = game.add.bitmapText(270, 520, 'desyrel', 'Fixed to Camera!', 32);
+ text2.fixedToCamera = true;
+
+ game.camera.follow(mushroom);
+
+ cursors = game.input.keyboard.createCursorKeys();
+
+}
+
+function update() {
+
+ if (cursors.left.isDown)
+ {
+ mushroom.x -= 8;
+ }
+ else if (cursors.right.isDown)
+ {
+ mushroom.x += 8;
+ }
+
+ if (cursors.up.isDown)
+ {
+ mushroom.y -= 8;
+ }
+ else if (cursors.down.isDown)
+ {
+ mushroom.y += 8;
+ }
+
+}
diff --git a/src/gameobjects/BitmapData.js b/src/gameobjects/BitmapData.js
index 7a3d313f..9fdcc462 100644
--- a/src/gameobjects/BitmapData.js
+++ b/src/gameobjects/BitmapData.js
@@ -365,7 +365,7 @@ Phaser.BitmapData.prototype = {
if (this._dirty)
{
// Only needed if running in WebGL, otherwise this array will never get cleared down
- if (this.game.renderType == Phaser.WEBGL)
+ if (this.game.renderType === Phaser.WEBGL)
{
PIXI.texturesToUpdate.push(this.baseTexture);
}
diff --git a/src/tilemap/TilemapParser.js b/src/tilemap/TilemapParser.js
index f3691eb0..973e3917 100644
--- a/src/tilemap/TilemapParser.js
+++ b/src/tilemap/TilemapParser.js
@@ -400,7 +400,14 @@ Phaser.TilemapParser = {
newSet.columns = (set.imagewidth - set.margin) / (set.tilewidth + set.spacing);
newSet.total = newSet.rows * newSet.columns;
- tilesets.push(newSet);
+ if (newSet.rows % 1 !== 0 || newSet.columns % 1 !== 0)
+ {
+ console.warn('TileSet image dimensions do not match expected dimensions. Tileset width/height must be evenly divisible by Tilemap tile width/height.');
+ }
+ else
+ {
+ tilesets.push(newSet);
+ }
}
map.tilesets = tilesets;
From fb5920feec9483d28387d0dbffb977aea690586b Mon Sep 17 00:00:00 2001
From: photonstorm
Date: Fri, 21 Feb 2014 17:29:51 +0000
Subject: [PATCH 18/27] We now force IE11 into Canvas mode to avoid a Pixi bug
with pre-multiplied alpha. Will remove once that is fixed, sorry, but it's
better than no game at all, right? :( Loader.setPreloadSprite() will now set
sprite.visible = true once the crop has been applied. Should help avoid
issues (#430) on super-slow connections.
---
README.md | 2 ++
src/core/Game.js | 7 +++++++
src/loader/Loader.js | 8 ++++----
3 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/README.md b/README.md
index 89afd9b3..94cfd463 100644
--- a/README.md
+++ b/README.md
@@ -138,6 +138,8 @@ Updates:
* BitmapData.alphaMask will draw the given image onto a BitmapData using an image as an alpha mask.
* The new GameObjectCreator (which you access via game.make or State.make) lets you easily create an object but NOT add it to the display list.
* TilemapParser will now throw a warning if the tileset image isn't the right size for the tile dimensions.
+* We now force IE11 into Canvas mode to avoid a Pixi bug with pre-multiplied alpha. Will remove once that is fixed, sorry, but it's better than no game at all, right? :(
+* Loader.setPreloadSprite() will now set sprite.visible = true once the crop has been applied. Should help avoid issues (#430) on super-slow connections.
Bug Fixes:
diff --git a/src/core/Game.js b/src/core/Game.js
index 06ced0d7..0c64a6e8 100644
--- a/src/core/Game.js
+++ b/src/core/Game.js
@@ -540,6 +540,13 @@ Phaser.Game.prototype = {
*/
setUpRenderer: function () {
+ if (this.device.trident)
+ {
+ // Pixi WebGL renderer on IE11 doesn't work correctly at the moment, the pre-multiplied alpha gets all washed out.
+ // So we're forcing canvas for now until this is fixed, sorry. It's got to be better than no game appearing at all, right?
+ 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)
diff --git a/src/loader/Loader.js b/src/loader/Loader.js
index f6ee485f..320a7a79 100644
--- a/src/loader/Loader.js
+++ b/src/loader/Loader.js
@@ -144,10 +144,10 @@ Phaser.Loader.prototype = {
/**
* You can set a Sprite to be a "preload" sprite by passing it to this method.
* A "preload" sprite will have its width or height crop adjusted based on the percentage of the loader in real-time.
- * This allows you to easily make loading bars for games.
+ * This allows you to easily make loading bars for games. Note that Sprite.visible = true will be set when calling this.
*
* @method Phaser.Loader#setPreloadSprite
- * @param {Phaser.Sprite} sprite - The sprite that will be cropped during the load.
+ * @param {Phaser.Sprite|Phaser.Image} sprite - The sprite that will be cropped during the load.
* @param {number} [direction=0] - A value of zero means the sprite width will be cropped, a value of 1 means its height will be cropped.
*/
setPreloadSprite: function (sprite, direction) {
@@ -169,6 +169,8 @@ Phaser.Loader.prototype = {
sprite.crop(this.preloadSprite.crop);
+ sprite.visible = true;
+
},
/**
@@ -1305,8 +1307,6 @@ Phaser.Loader.prototype = {
{
this.preloadSprite.crop.height = Math.floor((this.preloadSprite.height / 100) * this.progress);
}
-
- // this.preloadSprite.sprite.crop = this.preloadSprite.crop;
}
this.onFileComplete.dispatch(this.progress, this._fileList[previousIndex].key, success, this.totalLoadedFiles(), this._fileList.length);
From 7342ce603a271abfe5ded4078f93cb39fc99b0f9 Mon Sep 17 00:00:00 2001
From: alvinsight
Date: Fri, 21 Feb 2014 15:53:07 +0000
Subject: [PATCH 19/27] Velocity is back on track :)
---
examples/basics/03 - move an image.js | 4 +++-
examples/camera/basic follow.js | 10 ++++++----
examples/camera/camera cull.js | 3 +--
examples/display/fullscreen.js | 2 +-
4 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/examples/basics/03 - move an image.js b/examples/basics/03 - move an image.js
index 0cdd9320..a98631a6 100644
--- a/examples/basics/03 - move an image.js
+++ b/examples/basics/03 - move an image.js
@@ -19,6 +19,8 @@ function create() {
// and assign it to a variable
var image = game.add.sprite(0, 0, 'einstein');
- image.body.velocity.x=50;
+ image.physicsEnabled = true;
+
+ image.body.moveRight(150);
}
diff --git a/examples/camera/basic follow.js b/examples/camera/basic follow.js
index bcb21bc7..5a949b48 100644
--- a/examples/camera/basic follow.js
+++ b/examples/camera/basic follow.js
@@ -31,6 +31,8 @@ function create() {
player = game.add.sprite(150, 320, 'player');
+ player.physicsEnabled = true;
+
cursors = game.input.keyboard.createCursorKeys();
game.camera.follow(player);
@@ -39,15 +41,15 @@ function create() {
function update() {
- player.body.velocity.setTo(0, 0);
+ player.body.setZeroVelocity();
if (cursors.up.isDown)
{
- player.body.velocity.y = -200;
+ player.body.moveUp(200)
}
else if (cursors.down.isDown)
{
- player.body.velocity.y = 200;
+ player.body.moveDown(200);
}
if (cursors.left.isDown)
@@ -56,7 +58,7 @@ function update() {
}
else if (cursors.right.isDown)
{
- player.body.velocity.x = 200;
+ player.body.moveRight(200);
}
}
diff --git a/examples/camera/camera cull.js b/examples/camera/camera cull.js
index 6060ada2..6d4b9c5d 100644
--- a/examples/camera/camera cull.js
+++ b/examples/camera/camera cull.js
@@ -42,7 +42,6 @@ function update() {
function render() {
- game.debug.renderSpriteCorners(s, true, true);
- game.debug.renderSpriteInfo(s, 20, 32);
+ game.debug.renderSpriteBounds(s);
}
diff --git a/examples/display/fullscreen.js b/examples/display/fullscreen.js
index d02dd75c..2ff001d7 100644
--- a/examples/display/fullscreen.js
+++ b/examples/display/fullscreen.js
@@ -26,7 +26,7 @@ function create() {
function gofull() {
- game.stage.scale.startFullScreen();
+ game.scale.startFullScreen();
}
From 2eab5d48153a193e4c7391ffaa33acef47090901 Mon Sep 17 00:00:00 2001
From: alvinsight
Date: Fri, 21 Feb 2014 16:37:57 +0000
Subject: [PATCH 20/27] Debug functions and more examples
---
examples/input/keyboard justpressed.js | 3 +++
1 file changed, 3 insertions(+)
diff --git a/examples/input/keyboard justpressed.js b/examples/input/keyboard justpressed.js
index 8eb6321e..a4c24e32 100644
--- a/examples/input/keyboard justpressed.js
+++ b/examples/input/keyboard justpressed.js
@@ -19,10 +19,13 @@ function create() {
bullets = game.add.group();
bullets.createMultiple(10, 'bullet');
+ bullets.setAll('physicsEnabled',true);
bullets.callAll('events.onOutOfBounds.add', 'events.onOutOfBounds', resetBullet, this);
sprite = game.add.sprite(400, 550, 'phaser');
+ sprite.physicsEnabled = true;
+
// Stop the following keys from propagating up to the browser
game.input.keyboard.addKeyCapture([ Phaser.Keyboard.LEFT, Phaser.Keyboard.RIGHT, Phaser.Keyboard.SPACEBAR ]);
From 2669f81391563f7bc17903f65ca309b7ea400e2f Mon Sep 17 00:00:00 2001
From: alvinsight
Date: Fri, 21 Feb 2014 16:38:19 +0000
Subject: [PATCH 21/27] Debug functions ? Seems last commit didn't work
---
examples/camera/camera cull.js | 1 +
examples/groups/depth sort.js | 2 ++
2 files changed, 3 insertions(+)
diff --git a/examples/camera/camera cull.js b/examples/camera/camera cull.js
index 6d4b9c5d..cb15113a 100644
--- a/examples/camera/camera cull.js
+++ b/examples/camera/camera cull.js
@@ -43,5 +43,6 @@ function update() {
function render() {
game.debug.renderSpriteBounds(s);
+ game.debug.renderSpriteInfo(s, 20, 32);
}
diff --git a/examples/groups/depth sort.js b/examples/groups/depth sort.js
index 05b74511..2684b533 100644
--- a/examples/groups/depth sort.js
+++ b/examples/groups/depth sort.js
@@ -35,6 +35,8 @@ function create() {
// The player
sprite = group.create(300, 200, 'phaser');
+ sprite.physicsEnabled = true;
+
// Some trees
for (var i = 0; i < 50; i++)
{
From b03c6231e1531d7ce4cf662c50a66a9f9f6f1351 Mon Sep 17 00:00:00 2001
From: alvinsight
Date: Fri, 21 Feb 2014 17:58:52 +0000
Subject: [PATCH 22/27] And some more examples updated :)
---
examples/groups/bring a group to top.js | 4 ++--
examples/groups/call all.js | 4 ++--
examples/groups/remove.js | 2 +-
examples/groups/replace.js | 4 ++--
examples/input/drop limitation.js | 2 +-
examples/input/game scale.js | 12 ++++++++----
examples/input/motion lock - horizontal.js | 2 +-
examples/input/motion lock - vertical.js | 2 +-
8 files changed, 18 insertions(+), 14 deletions(-)
diff --git a/examples/groups/bring a group to top.js b/examples/groups/bring a group to top.js
index 687c07f2..bff5bdf4 100644
--- a/examples/groups/bring a group to top.js
+++ b/examples/groups/bring a group to top.js
@@ -34,7 +34,7 @@ function create() {
var tempSprite = game.add.sprite(game.world.randomX, game.world.randomY, 'atari1');
tempSprite.name = 'atari' + i;
- tempSprite.input.start(i, true);
+ tempSprite.inputEnabled = true;
tempSprite.input.enableDrag(false, true);
group1.add(tempSprite);
@@ -44,7 +44,7 @@ function create() {
var tempSprite=game.add.sprite(game.world.randomX, game.world.randomY, 'sonic');
tempSprite.name = 'sonic' + i;
- tempSprite.input.start(10 + i, true);
+ tempSprite.inputEnabled = true;
tempSprite.input.enableDrag(false, true);
group2.add(tempSprite);
diff --git a/examples/groups/call all.js b/examples/groups/call all.js
index 250d6fa0..8123997f 100644
--- a/examples/groups/call all.js
+++ b/examples/groups/call all.js
@@ -19,12 +19,12 @@ function create() {
item = game.add.sprite(290, 98 * (i + 1), 'item', i);
// Enable input.
- item.input.start(0, true);
+ item.inputEnabled = true;
item.events.onInputUp.add(kill);
// An item besides the left one.
item = game.add.sprite(388, 98 * (i + 1), 'item', i + 3);
- item.input.start(0, true);
+ item.inputEnabled = true;
item.events.onInputUp.add(kill);
}
diff --git a/examples/groups/remove.js b/examples/groups/remove.js
index 85ed08dd..4b88e350 100644
--- a/examples/groups/remove.js
+++ b/examples/groups/remove.js
@@ -23,7 +23,7 @@ function create() {
// Directly create sprites from the group.
item = items.create(90, 90 * i, 'item', i);
// Enable input detection, then it's possible be dragged.
- item.input.start(0,true);
+ item.inputEnabled = true;
// Make this item draggable.
item.input.enableDrag();
// Then we make it snap to 90x90 grids.
diff --git a/examples/groups/replace.js b/examples/groups/replace.js
index 8fac9595..23de93ce 100644
--- a/examples/groups/replace.js
+++ b/examples/groups/replace.js
@@ -25,12 +25,12 @@ function create() {
// Directly create sprites from the left group.
item = left.create(290, 98 * (i + 1), 'item', i);
// Enable input.
- item.input.start(0, false, true);
+ item.inputEnabled = true;
item.events.onInputUp.add(select);
// Add another to the right group.
item = right.create(388, 98 * (i + 1), 'item', i + 3);
// Enable input.
- item.input.start(0,true);
+ item.inputEnabled = true;
item.events.onInputUp.add(select);
}
}
diff --git a/examples/input/drop limitation.js b/examples/input/drop limitation.js
index 76a0c615..0fbc3533 100644
--- a/examples/input/drop limitation.js
+++ b/examples/input/drop limitation.js
@@ -18,7 +18,7 @@ function create() {
item = game.add.sprite(90, 90 * i, 'item', i);
// Enable input detection, then it's possible be dragged.
- item.input.start(0,true);
+ item.inputEnabled = true;
// Make this item draggable.
item.input.enableDrag();
diff --git a/examples/input/game scale.js b/examples/input/game scale.js
index 0e6542e5..b750015a 100644
--- a/examples/input/game scale.js
+++ b/examples/input/game scale.js
@@ -14,6 +14,8 @@ function preload() {
}
+var cursors;
+
function create() {
//We increase the size of our game world
@@ -25,26 +27,28 @@ function create() {
game.add.sprite(game.world.randomX, game.world.randomY, 'melon');
}
+ cursors = game.input.keyboard.createCursorKeys();
+
}
function update() {
//This allows us to move the game camera using the keyboard
- if (game.input.keyboard.isDown(Phaser.Keyboard.LEFT))
+ if (cursors.left.isDown)
{
game.camera.x -= 4;
}
- else if (game.input.keyboard.isDown(Phaser.Keyboard.RIGHT))
+ else if (cursors.right.isDown)
{
game.camera.x += 4;
}
- if (game.input.keyboard.isDown(Phaser.Keyboard.UP))
+ if (cursors.up.isDown)
{
game.camera.y -= 4;
}
- else if (game.input.keyboard.isDown(Phaser.Keyboard.DOWN))
+ else if (cursors.down.isDown)
{
game.camera.y += 4;
}
diff --git a/examples/input/motion lock - horizontal.js b/examples/input/motion lock - horizontal.js
index 1e2a82f2..fff81273 100644
--- a/examples/input/motion lock - horizontal.js
+++ b/examples/input/motion lock - horizontal.js
@@ -18,7 +18,7 @@ function create() {
// Enable Input detection. Sprites have this disabled by default,
// so you have to start it if you want to interact with them.
- sprite.input.start(0,true);
+ sprite.inputEnabled = true;
// This allows you to drag the sprite. The parameter controls if you drag from the position you touched it (false)
// or if it will snap to the center (true)
diff --git a/examples/input/motion lock - vertical.js b/examples/input/motion lock - vertical.js
index 045bbc64..ea5692c3 100644
--- a/examples/input/motion lock - vertical.js
+++ b/examples/input/motion lock - vertical.js
@@ -18,7 +18,7 @@ function create() {
// Enable Input detection. Sprites have this disabled by default,
// so you have to start it if you want to interact with them.
- sprite.input.start(0,true);
+ sprite.inputEnabled = true;
// This allows you to drag the sprite. The parameter controls if you drag from the position you touched it (false)
// or if it will snap to the center (true)
From 1448562abddc9661c6453cc6948ccd7f4ec2a664 Mon Sep 17 00:00:00 2001
From: photonstorm
Date: Fri, 21 Feb 2014 18:48:06 +0000
Subject: [PATCH 23/27] Loader can now load JSON files specifically
(game.load.json) and they are parsed and stored in the Game.Cache. Retrieve
with game.cache.getJSON(key) (#329) Also fixed UTF encoding on the animation
file.
---
README.md | 1 +
.../assets/sprites/seacreatures_json.json | Bin 79826 -> 39915 bytes
src/loader/Cache.js | 65 ++++++++++++++++++
src/loader/Loader.js | 39 +++++++++++
tutorials/01 Getting Started/part4.html | 2 +-
5 files changed, 106 insertions(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 94cfd463..897c7f26 100644
--- a/README.md
+++ b/README.md
@@ -122,6 +122,7 @@ New features:
* fixedToCamera now works across all display objects. When enabled it will fix at its current x/y coordinate, but can be changed via cameraOffset.
* fixedToCamrea now works for Groups as well :) You can fix a Group to the camera and it will influence its children.
* Tilemap.createCollisionObjects will parse Tiled data for objectgroups and convert polyline instances into physics objects you can collide with in the world.
+* Loader can now load JSON files specifically (game.load.json) and they are parsed and stored in the Game.Cache. Retrieve with game.cache.getJSON(key).
Updates:
diff --git a/examples/assets/sprites/seacreatures_json.json b/examples/assets/sprites/seacreatures_json.json
index 305d2a432c104c22c389bae7391063b99228dffd..6a5e96d3e133e4a7a48152faa76ea5296d2bd8f2 100644
GIT binary patch
literal 39915
zcmdsA+iv5?5q*xoVxVVZ!S3eOZ<_@+K^`-YK@e~}^jLvxc_}%YS!2E|5Ba40LaNwZ
z6h$6gJZ@rDo&m-liEjC@y6V)m`M>}C_hoU{)(_2Qar5DCS644re^}ftSIr~6M6WD9
zt)82|G^^FuyXEFSp+AdjzJh;(-hNs9dvTMN>Gk64;-)B)>&35&o1Ff8&tJarrR{oK
zZ=26_@m;;zH2l)GT|PW?FKyfB?v>3`yWBP(*U#;3^KtoGzcejK3x{QMzii$uyV<{%
zKem7W>f6=zDIDf7j?&ReyrAA7^q)pUXh#|16LQK>W&c2*d#(
zB?*G$Z*o`Y0g_IEq?zByx`1R;Ae9Lc$BgK&mMamjq?k1jGPdcTD8kBw`S;TT%ABQlsn!Fnd~wvTFhY
zm_5rx*^7M_<&w>>0nDCTQFcv00JCQ%D0}Yqb>xzrMgy4LWkE+0N8iMCXG@?mGEFktg1neeb=TV9CYXPx)
z@tdsDqROXD^Ual(0XZtL~>0)0Iior@K16Rj4uJ>6v`$0Cl=6pl}hG86A(b_
zoZahEL8F}3MGFM5x^W^9O+Wyxn@Su;O+Wyx+f1ylA|MXYdMehJm3~0$m+UdR!?d2~
z`?29g!$7p2h|LA(pw?+fRS#}P)B@XR-S3tHa150p03M;beFU6Abr^sjs15`00o7pu?w>M^
zMt+|UD3n-LRG`tek6>*^89&3aj5Z8_q1ElBcfir+C`Xq*^EC3xj<#6z9aiV`Q;in>
zUUv`GV0N2H3y62X(gv{fP7tB?G7|dH-SnE~ywSSfy_o<{Yr}vlE;|fL6arOS^nn1e
z^bUj$jj->4tL;1BYE)cNwU;c;@nxA$k)!t$kUn#aRpDV#5`q+Btg
zvII9Ba4q$W`G8k#u>EzXBH6u<1k!;xG3ii-4OUu@#Bldlx528@8|+o?6jup(VdHBB
zQ!rf}Fn&hWjg($p_`;
zjkNPwW>#&0fQR6MCu(e_5D@SYtc-eE9#+*RA>bwSt;x0wtg6Vyp?rQJZF06G>!3|S
zz)$GhQ1;`lge;Wv
zt8fm4QKUbpT#(5Oz%EkNW8hHjpdaxwsc4WM3POd1LPAwnjs4OXv9}LP0=Y#`#aZAa
zRKX+|jb4uh$%Ir!v}~!*(YC-z$YkolDhyUF@Dltcr?j}fxB(4w^s%=S7E%-lp`i}P
z`uCiJnlD}!m(Bq5MY$aC^TI|)_vjW!8^WJ1Ad#V%CsGr)RM+78ql
zf(9ils4fsvQ*m&>Nhk_mg`x_I1m480u>#e3D?$$V2wplB*M&Oas43Su;2%hBn6f+~
z9Es{8M5#VtoXaD1z&$9qW?
zl~pD?BNy_jZi?~B(-wr`6{rPaeY;&hJ#R3Gvh2ymhdi7fB_QP)ZAYhyr*un5(q0^4
z+3HXq#qRy%5J28T8wB9PhzXV+1CB#U2vvlrbEp%$o6L3B=}y|ce_RN_X;Fp%cqx6!
zL#m(!QCB1(5T8cZ1mKrwg8-Zn$A{OlugG?Z3@f{ik%Zt4U0ibn+z(|4fX^YlsE&Il
zSq5~^SOyX1<@fqecIM`7<_NeM${?U725k@kGi!qYm{}VHK+W190B+U>0dTW62!NZl
zK~PW5Xp~Twdtm@KEAvue>wuixs3TTDQ-rz#Hh5fP$Xn_Nno&o9vdjhQ0nh>AsjYu~
z#0fB&ipn_3;b6x%X%%OT-n=T0x4-T*_p*B*^
z79oWcj->XPPGf!kIV-wpktvYD1t*b!m_aEL5IRsUcq9|KbrEFZ#XW;aKmef=2nZvB
zJTjT&;_etqY{bx!&;UMzKtL>^5(fw(GBwFZ)AaD@
zCAwEkvtrUCupvwW%Ax(bkN{rq9mTW^y_IY-+4@E}I(n~;9aAKL)^!2_w60Ox(X(Gv
z;&>;lj!qpb+1PR{A`hoC8vHCclB5#}VD>^9!FwJNnM5e+&F1@}?4eF1D2b@WZf%B07
z!2r%l70$ZX1OvDxQfZQBZfTIl!F)s4@<_3Q1`xn434_y@kK&i-<$+F3shP=>u_ZZb
z(%437yz3XN+S$lqcp+*HcBH5V52m`09HyP43H7k2m>TUHNpT%bdJZJO_R8K$t8h%K$izh(1)T%QksxY{6(3qMi$JFjd^L=NqR%l#JJVrU2qu<9_v{?5$8RYNRSBr;cTQ6=tywJ%u_0to5
zxA^h%`cw1a=T*JA|M1gCPbB|p+RbwP$Zs3_LqdPk(x;4;5A~OZU#CW)+qS8<&uz2$
z$3Hjg#~+>^zbv>5=x*IU)LXvhuYdaEkJJe4ZQ*A58~@--XTuYICKYA+Y?69?+uYWx
NZe6pW)YZ4E{{zf13aaf(B>Ym~F
za5z2e!4?Q#NRgu+p03-eOaJe`U&3X06+VTV@GjhjdwKRCzf8NUDSGm%iT;ol6@%Xq5-#lF-{to>#e(%5bzwJ6~!?nEc
zQa+ELZRGJ{|NNKz^Y!CT-#k70&(l>ug%9CDR`nn&_<8^H=dy+ySXI)c>T!+=8
z&2U7Z&w&AUW7G&^BC?_o*@=eIHAF;KV#oVr#9GSp*^xPFtu=+nLL_9H*pZb;joR{V
zt>uWopB>`)Zb(EnnPqoGN@=Yvg~-*DuiI!Xmyt4dWJe*g+((ku`*j&9BO|a6OniuF
z(8lWvu_7)bC1hkFJ`{t^Mh4qmIzjyTgeR7SX%eJL_w8437k;Dg}-
z#+bcEHr}pz9^CIjbPr?M;rm)UvXSSj1P_&<$h^6P43!WrVqb}Vvbzl$>_ukRT|&m-
z;urEwGZF$To<<{XMao3%@Shk&)>(#KJ+0J==(DJ`-1i-(wUC!(5J@!_beQw-cJGao
zJw)D|K?62C*I4kgte55TF@_BRzs?}C6*)>}WWD!%9gb9V^3rC3~MkWRv*4$nL_9
zI3nXC!bR)5y{C)sKjx|&5qujZ>_p*k1SzN5X5Nne%j9;sqb3}$B
z!bR(dA#;Y&Wu%PG;-d8{vEjMz>xh&<1iFavw7@XtzAref!=9FNjKj3na!|AmEAQ3U
z<9k`iYcTSG?hwnsBNFM)8@hZPl8=|t<#Ho^Jjg5QgF)cBrJ-`p9W1D*p>hSgZ}srpwuJrctsX-A?P%b~uj$I^A^CN7qCTV2{#bMds}P!9EZ|2!sF^1
zd{@*G4~?r`FLhPS9UIHRTjJ~ZFcZgC*Ek&)uHMpd
z$!Fm=zHQfjWN~>dRmivUct1#5Hlnp`2MhLyYBgP5oUy91g6@hjDv`@+u)g&&QquML
zS+Oowfz!BGEgF+q2?)?YUoY&Qxnna7?Rj~?$Ib)O=Zzje
zpKi13o*zD3SWW~3Ow|ABR}JKY^Qn#RwvI7A1==hzrgN8V3D5M0mM>Y
zAMdC^e&W8FtA^W9+}T#}vGxad4XLsc6wmo+B*=QI=hJZMOsDzD5Sy9L=i@g#TJ*0S
zAxure-o?%wFaFt4GK2}0sTBf3sTb!6l|TsAgUJxsI1jrdo)GEsqgpf7>|@CfzG(&>
zye~xvwE^lCI6`F+;y8q5#)$$iOc`}Ap)?1F>oYP0Pdk?(3F_fPr$s(a89A%v@Cu$cK20rrg4NHu#<;8M
z=d;=KEVd#;dT$XSFmmbLMsKe{Xq;+;QyICqu6Z&(h-w&5A`D_Ph(=XsdO=(CPE2E!z3IIx<4@mLIk=AV0AO9zyD8x3k@K
z#PfjzyWo%crf
zR+?{c87d<~Tx9}!UsEpuv5>yvUP2zFkI5%2#e-(-5Hwm|rQNOp_A2f1IXN&n3___N
zhx3Y3`GF^qX6)+V5_HeZGoK1ijKKz6kL`s*{Xsk9t#NC^#?_HgwNjtj%x>!*C;8OS
zoeEEk!NHpP>z7nkTUZa&+jg;3eH=E*X
zYi8`sp=+>w^@s2>JcJM7WB45Ik3s^KRPD&dW_e;pK@q{bYp65OUDEc-($&INHmhZj
z==%IAC~zE&qmZ5gGd2obRY&dx=W`5VK2#+Eb=J+^I$sB=)uq->bbW`%_`Y4AKSdHa
zro}O^Cl-#40mr4ZyFBt
a|FM#;5h$1dcCp6w2BJju}COZhZ|z3zoNvtYcj^
z!FqHx+XRmNa12V?1div(=c0m_w^2eGx21mf`Fx|uDc5fkb`%fjD3r7b;O-bU)=?;n
z0v9to3T08?VrEC7EDBuI>?o8)fs30Rg|aAcakHaP76mSDb`;8@;E{70V@{vj0TaYT
z3(j7YV=vfw1kRkw4Y^zvmT(XV}=Y2tC7AP9L%J0~~{r7;rJO
z*Ibmf30%zVD2#`~N2$iU3BSmhQODHct&*Z
zuFtbp8TEIcqzdn?)I<(BApAv0kmf)g6RM
zeLzE9rGk?MR#*6SZ<3@{vvepNE8Sc?rh@9o#nVD`nTY429z{6&_r!
z!tt024=!)vcua){Tl=@md|sRqm`}Y{|FSNd9{XRF_1Ar++(NenIHpUb`wFM}SbQa*
zV=|TBi);~-Z*4P*n89ajm9b}Z7e+Z*8%E-M)ykGZu~qxsd%OlI;i7d%WI7q)qII|J
z)7Wo>r8Do|?h2PsggIVoowCT=g^`G@}C|AXwlH{07
zXV%IJ
zTQlQJ9l8c@F;X-*Kg!X#3*B*FH=;w);QS~@V;VF#Kg!XV1`W=Sax|tvgY%^vjcL%}
z@=lJ%G-z-YqK?KiXmGhEM`Ic^xGa;SF$EfIU8tim4H_PcUxt_$OWB<1nGwYGOf8Sg
z#x%0wv3O0g;jws4Xm~7sUNjzLPRXb6N^%_cV!w{57Rjv#rZZ^8n`Sv;eq600o;9;3
zYOGG^TQ6h7yFSlz=?{Xy`|x@{H|E!)aIh6rIOjU;uSw6X(Q4f>a5!~JiRQz!vL$w<
z#q3zVX6&nG%?uXExu)4Fy~b&Ha6T?7q-~`L&S$W4(Ow(sr-_kNeRbm!Fx@g^AsBj>+AAlG6MAX_K+m`ciC0m)_$1U8}dy7ijBuy70Ji83|ux
zX2~#e1{!}ZoMOgO(c*IU4(Urv@HNsh@dOonBm7)-|T
zeSeGgoy$jATeAMD4~(jImyuyIGAtv7YH2+a@{m92m|TdzJq!~rFO}Ppyt||AbHPh?
zIT?Zpo1MxrVQh)p_hE9vPc2E~cVN=5yRIeTcR3j*CtUoVbB!LqAF`vT^IQwr?M(I%
z_QU#J49``c?!vhx_48aqrk6MuTvA53_&t}A#>YCeHk{sDn=OGxn1hUP@q5nCW6Fl@
zXiRc9Kj#8mZh5&s&w70?^j4>6*_a9qh!C+@|;Av8j-c
zpM!L;XQ=77AL|HkVosl@vZ*jqpM&LKPgBb+MjCwc6iG%%^|gciAeVJ6XYvRE61!i(7f+rCbUB
zKI~7qx|OT`E&N^n#+AR7wV{%%`OUBP)1Yvrho|5B=kSN{y{ug)0$aZjE9~wUe<5pC
gPedalSWK+A@x||DWjFiE1pUS?_jjXJS2%Cw|NZF-LjV8(
diff --git a/src/loader/Cache.js b/src/loader/Cache.js
index 3945e693..37ca004a 100644
--- a/src/loader/Cache.js
+++ b/src/loader/Cache.js
@@ -49,6 +49,12 @@ Phaser.Cache = function (game) {
*/
this._text = {};
+ /**
+ * @property {object} _text - Text key-value container.
+ * @private
+ */
+ this._json = {};
+
/**
* @property {object} _physics - Physics data key-value container.
* @private
@@ -149,6 +155,12 @@ Phaser.Cache.BITMAPDATA = 9;
*/
Phaser.Cache.BITMAPFONT = 10;
+/**
+* @constant
+* @type {number}
+*/
+Phaser.Cache.JSON = 11;
+
Phaser.Cache.prototype = {
/**
@@ -382,6 +394,20 @@ Phaser.Cache.prototype = {
},
+ /**
+ * Add a new json object into the cache.
+ *
+ * @method Phaser.Cache#addJSON
+ * @param {string} key - Asset key for the text data.
+ * @param {string} url - URL of this text data file.
+ * @param {object} data - Extra text data.
+ */
+ addJSON: function (key, url, data) {
+
+ this._json[key] = { url: url, data: data };
+
+ },
+
/**
* Add a new image.
*
@@ -880,6 +906,26 @@ Phaser.Cache.prototype = {
},
+ /**
+ * Get a JSON object by key from the cache.
+ *
+ * @method Phaser.Cache#getJSON
+ * @param {string} key - Asset key of the json object to retrieve from the Cache.
+ * @return {object} The JSON object.
+ */
+ getJSON: function (key) {
+
+ if (this._json[key])
+ {
+ return this._json[key].data;
+ }
+ else
+ {
+ console.warn('Phaser.Cache.getJSON: Invalid key: "' + key + '"');
+ }
+
+ },
+
/**
* Get binary data by key.
*
@@ -952,6 +998,10 @@ Phaser.Cache.prototype = {
case Phaser.Cache.BITMAPFONT:
array = this._bitmapFont;
break;
+
+ case Phaser.Cache.JSON:
+ array = this._json;
+ break;
}
if (!array)
@@ -1013,6 +1063,16 @@ Phaser.Cache.prototype = {
delete this._text[key];
},
+ /**
+ * Removes a json object from the cache.
+ *
+ * @method Phaser.Cache#removeJSON
+ * @param {string} key - Key of the asset you want to remove.
+ */
+ removeJSON: function (key) {
+ delete this._json[key];
+ },
+
/**
* Removes a physics data file from the cache.
*
@@ -1090,6 +1150,11 @@ Phaser.Cache.prototype = {
delete this._text[item['key']];
}
+ for (var item in this._json)
+ {
+ delete this._json[item['key']];
+ }
+
for (var item in this._textures)
{
delete this._textures[item['key']];
diff --git a/src/loader/Loader.js b/src/loader/Loader.js
index 320a7a79..b4b7cd20 100644
--- a/src/loader/Loader.js
+++ b/src/loader/Loader.js
@@ -361,6 +361,32 @@ Phaser.Loader.prototype = {
},
+ /**
+ * Add a json file to the Loader.
+ *
+ * @method Phaser.Loader#json
+ * @param {string} key - Unique asset key of the json file.
+ * @param {string} url - URL of the json file.
+ * @param {boolean} [overwrite=false] - If an unloaded file with a matching key already exists in the queue, this entry will overwrite it.
+ * @return {Phaser.Loader} This Loader instance.
+ */
+ json: function (key, url, overwrite) {
+
+ if (typeof overwrite === "undefined") { overwrite = false; }
+
+ if (overwrite)
+ {
+ this.replaceInFileList('json', key, url);
+ }
+ else
+ {
+ this.addToFileList('json', key, url);
+ }
+
+ return this;
+
+ },
+
/**
* Add a JavaScript file to the Loader. Once loaded the JavaScript file will be automatically turned into a script tag (and executed), so be careful what you load!
*
@@ -885,6 +911,15 @@ Phaser.Loader.prototype = {
break;
+ case 'json':
+ this._xhr.open("GET", this.baseURL + file.url, true);
+ this._xhr.responseType = "text";
+ this._xhr.onload = function () {
+ return _this.jsonLoadComplete(_this._fileIndex);
+ };
+ this._xhr.send();
+ break;
+
case 'tilemap':
this._xhr.open("GET", this.baseURL + file.url, true);
this._xhr.responseType = "text";
@@ -1176,6 +1211,10 @@ Phaser.Loader.prototype = {
{
this.game.cache.addTilemap(file.key, file.url, data, file.format);
}
+ else if (file.type === 'json')
+ {
+ this.game.cache.addJSON(file.key, file.url, data);
+ }
else
{
this.game.cache.addTextureAtlas(file.key, file.url, file.data, data, file.format);
diff --git a/tutorials/01 Getting Started/part4.html b/tutorials/01 Getting Started/part4.html
index d533f735..4077a440 100644
--- a/tutorials/01 Getting Started/part4.html
+++ b/tutorials/01 Getting Started/part4.html
@@ -29,7 +29,7 @@
WebStorm
-
JetBrains WebStorm is an extremely advanced fully development environment. It goes well beyond simple code editing and offers all of the high-level features you'd expect from a proper IDE include code-insight, npm built-in, code style/syntax reports, source control and a wealth of other features designed more for web developers than game developers. It's based on IntelliJ IDEA, which is both a good and bad thing. For a start the actual code editing experience is nothing like as smooth and freeform as with Sublime, but the power features can often make up for that. Having errors with your code spotted for you, before you've even tested your game can be really useful. And code-completion is great too, although obviously somewhat limited by the myriad ways JavaScript can be written.
+
JetBrains WebStorm is an extremely advanced fully development environment. It goes well beyond simple code editing and offers all of the high-level features you'd expect from a proper IDE include code-insight, npm built-in, code style/syntax reports, source control and a wealth of other features designed more for web developers than game developers. It's based on IntelliJ IDEA, a heavily Java based editor, which is both a good and bad thing. For a start the actual code editing experience is nothing like as smooth and freeform as with Sublime and OS integration is weak, but the power features can often make up for that. Having errors with your code spotted for you, before you've even tested your game can be really useful. And code-completion is great too, although obviously somewhat limited by the myriad ways JavaScript can be written.
The full version starts from $49 and is available for Windows and OS X. There are often deals to be found on the JetBrains site too.
From 57796a60beb10a81b2fe991de01f4e7056aa4e30 Mon Sep 17 00:00:00 2001
From: photonstorm
Date: Fri, 21 Feb 2014 19:21:00 +0000
Subject: [PATCH 24/27] TileSprites can now receive full Input events,
dragging, etc and be positioned in-world and fixed to cameras (fixes #321)
---
README.md | 1 +
examples/wip/tilesprite input.js | 67 ++++++++++++++++++++++++++++++++
src/gameobjects/TileSprite.js | 41 +++++++++++++++++++
src/input/Input.js | 16 ++++++++
4 files changed, 125 insertions(+)
create mode 100644 examples/wip/tilesprite input.js
diff --git a/README.md b/README.md
index 897c7f26..9d3db635 100644
--- a/README.md
+++ b/README.md
@@ -123,6 +123,7 @@ New features:
* fixedToCamrea now works for Groups as well :) You can fix a Group to the camera and it will influence its children.
* Tilemap.createCollisionObjects will parse Tiled data for objectgroups and convert polyline instances into physics objects you can collide with in the world.
* Loader can now load JSON files specifically (game.load.json) and they are parsed and stored in the Game.Cache. Retrieve with game.cache.getJSON(key).
+* TileSprites can now receive full Input events, dragging, etc and be positioned in-world and fixed to cameras.
Updates:
diff --git a/examples/wip/tilesprite input.js b/examples/wip/tilesprite input.js
new file mode 100644
index 00000000..94876e90
--- /dev/null
+++ b/examples/wip/tilesprite input.js
@@ -0,0 +1,67 @@
+
+var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create, update: update, render: render });
+
+function preload() {
+
+ game.load.image('backdrop', 'assets/pics/remember-me.jpg');
+ game.load.image('mushroom', 'assets/sprites/mushroom2.png');
+ game.load.image('starfield', 'assets/misc/starfield.jpg');
+
+}
+
+var sprite;
+var cursors;
+var mushroom;
+
+function create() {
+
+ game.world.setBounds(0, 0, 1920, 1200);
+ game.add.image(0, 0, 'backdrop');
+
+ sprite = game.add.tileSprite(100, 100, 200, 200, 'starfield');
+ sprite.inputEnabled = true;
+ sprite.events.onInputDown.add(scroll, this);
+ sprite.input.enableDrag();
+
+ mushroom = game.add.sprite(400, 400, 'mushroom');
+ mushroom.inputEnabled = true;
+ mushroom.input.enableDrag();
+
+ game.camera.follow(mushroom);
+
+ cursors = game.input.keyboard.createCursorKeys();
+
+}
+
+function scroll()
+{
+ sprite.autoScroll(0, 100);
+}
+
+function update() {
+
+ if (cursors.left.isDown)
+ {
+ mushroom.x -= 8;
+ }
+ else if (cursors.right.isDown)
+ {
+ mushroom.x += 8;
+ }
+
+ if (cursors.up.isDown)
+ {
+ mushroom.y -= 8;
+ }
+ else if (cursors.down.isDown)
+ {
+ mushroom.y += 8;
+ }
+
+}
+
+function render() {
+
+ // game.debug.renderText(sprite.frame, 32, 32);
+
+}
diff --git a/src/gameobjects/TileSprite.js b/src/gameobjects/TileSprite.js
index e44d0962..f13ac4ad 100644
--- a/src/gameobjects/TileSprite.js
+++ b/src/gameobjects/TileSprite.js
@@ -83,6 +83,11 @@ Phaser.TileSprite = function (game, x, y, width, height, key, frame) {
this.position.set(x, y);
+ /**
+ * @property {Phaser.InputHandler|null} input - The Input Handler for this object. Needs to be enabled with image.inputEnabled = true before you can use it.
+ */
+ this.input = null;
+
/**
* @property {Phaser.Point} world - The world coordinates of this Sprite. This differs from the x/y coordinates which are relative to the Sprites container.
*/
@@ -418,3 +423,39 @@ Object.defineProperty(Phaser.TileSprite.prototype, "fixedToCamera", {
}
});
+
+/**
+* By default a TileSprite won't process any input events at all. By setting inputEnabled to true the Phaser.InputHandler is
+* activated for this object 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 object to receive input events.
+*/
+Object.defineProperty(Phaser.TileSprite.prototype, "inputEnabled", {
+
+ get: function () {
+
+ return (this.input && this.input.enabled);
+
+ },
+
+ set: function (value) {
+
+ if (value)
+ {
+ if (this.input === null)
+ {
+ this.input = new Phaser.InputHandler(this);
+ this.input.start();
+ }
+ }
+ else
+ {
+ if (this.input && this.input.enabled)
+ {
+ this.input.stop();
+ }
+ }
+ }
+
+});
diff --git a/src/input/Input.js b/src/input/Input.js
index c9b7dbc1..844c8011 100644
--- a/src/input/Input.js
+++ b/src/input/Input.js
@@ -730,6 +730,22 @@ Phaser.Input.prototype = {
return false;
}
+ else if (displayObject instanceof Phaser.TileSprite)
+ {
+ var width = displayObject.width;
+ var height = displayObject.height;
+ var x1 = -width * displayObject.anchor.x;
+
+ if (this._localPoint.x > x1 && this._localPoint.x < x1 + width)
+ {
+ var y1 = -height * displayObject.anchor.y;
+
+ if (this._localPoint.y > y1 && this._localPoint.y < y1 + height)
+ {
+ return true;
+ }
+ }
+ }
else if (displayObject instanceof PIXI.Sprite)
{
var width = displayObject.texture.frame.width;
From ea4873e2861cf627120463cf52084daaf87b19bc Mon Sep 17 00:00:00 2001
From: photonstorm
Date: Fri, 21 Feb 2014 23:55:11 +0000
Subject: [PATCH 25/27] SoundManager.play() does not do anything with
destroyOnComplete (fix #333)
---
src/sound/SoundManager.js | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/src/sound/SoundManager.js b/src/sound/SoundManager.js
index 31988184..2b7cd833 100644
--- a/src/sound/SoundManager.js
+++ b/src/sound/SoundManager.js
@@ -352,12 +352,9 @@ Phaser.SoundManager.prototype = {
* @param {string} key - Asset key for the sound.
* @param {number} [volume=1] - Default value for the volume.
* @param {boolean} [loop=false] - Whether or not the sound will loop.
- * @param {boolean} [destroyOnComplete=false] - If true the Sound will destroy itself once it has finished playing, or is stopped.
* @return {Phaser.Sound} The new sound instance.
*/
- play: function (key, volume, loop, destroyOnComplete) {
-
- if (typeof destroyOnComplete == 'undefined') { destroyOnComplete = false; }
+ play: function (key, volume, loop) {
var sound = this.add(key, volume, loop);
From be4d42a1c2dc82f6f8a01dc7680a9bdd0d993557 Mon Sep 17 00:00:00 2001
From: photonstorm
Date: Sat, 22 Feb 2014 00:01:19 +0000
Subject: [PATCH 26/27] The StateManager now looks for a function called
'resumed' which is called when a game un-pauses (fixes #358)
---
README.md | 1 +
src/core/StateManager.js | 14 +++++++++++---
2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/README.md b/README.md
index 9d3db635..d0bc9c1f 100644
--- a/README.md
+++ b/README.md
@@ -124,6 +124,7 @@ New features:
* Tilemap.createCollisionObjects will parse Tiled data for objectgroups and convert polyline instances into physics objects you can collide with in the world.
* Loader can now load JSON files specifically (game.load.json) and they are parsed and stored in the Game.Cache. Retrieve with game.cache.getJSON(key).
* TileSprites can now receive full Input events, dragging, etc and be positioned in-world and fixed to cameras.
+* The StateManager now looks for a function called 'resumed' which is called when a game un-pauses.
Updates:
diff --git a/src/core/StateManager.js b/src/core/StateManager.js
index 77378f61..1a29948f 100644
--- a/src/core/StateManager.js
+++ b/src/core/StateManager.js
@@ -93,6 +93,11 @@ Phaser.StateManager = function (game, pendingState) {
*/
this.onPausedCallback = null;
+ /**
+ * @property {function} onResumedCallback - This will be called when the state is resumed from a paused state.
+ */
+ this.onResumedCallback = null;
+
/**
* @property {function} onShutDownCallback - This will be called when the state is shut down (i.e. swapped to another state).
*/
@@ -195,6 +200,7 @@ Phaser.StateManager.prototype = {
this.onUpdateCallback = null;
this.onRenderCallback = null;
this.onPausedCallback = null;
+ this.onResumedCallback = null;
this.onDestroyCallback = null;
}
@@ -370,6 +376,7 @@ Phaser.StateManager.prototype = {
this.onPreRenderCallback = this.states[key]['preRender'] || null;
this.onRenderCallback = this.states[key]['render'] || null;
this.onPausedCallback = this.states[key]['paused'] || null;
+ this.onResumedCallback = this.states[key]['resumed'] || null;
// Used when the state is no longer the current active state
this.onShutDownCallback = this.states[key]['shutdown'] || this.dummy;
@@ -418,7 +425,7 @@ Phaser.StateManager.prototype = {
if (this._created && this.onPausedCallback)
{
- this.onPausedCallback.call(this.callbackContext, this.game, true);
+ this.onPausedCallback.call(this.callbackContext, this.game);
}
},
@@ -429,9 +436,9 @@ Phaser.StateManager.prototype = {
*/
resume: function () {
- if (this._created && this.onre)
+ if (this._created && this.onResumedCallback)
{
- this.onPausedCallback.call(this.callbackContext, this.game, false);
+ this.onResumedCallback.call(this.callbackContext, this.game);
}
},
@@ -518,6 +525,7 @@ Phaser.StateManager.prototype = {
this.onUpdateCallback = null;
this.onRenderCallback = null;
this.onPausedCallback = null;
+ this.onResumedCallback = null;
this.onDestroyCallback = null;
this.game = null;
From e266ecfe00769546edea5b12cba77393038b8c70 Mon Sep 17 00:00:00 2001
From: photonstorm
Date: Sat, 22 Feb 2014 00:17:41 +0000
Subject: [PATCH 27/27] Starting timer tests.
---
examples/wip/timer1.js | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
create mode 100644 examples/wip/timer1.js
diff --git a/examples/wip/timer1.js b/examples/wip/timer1.js
new file mode 100644
index 00000000..a3e2aedd
--- /dev/null
+++ b/examples/wip/timer1.js
@@ -0,0 +1,30 @@
+
+var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create, update: update, render: render });
+
+function preload() {
+
+ game.load.image('pic', 'assets/pics/backscroll.png');
+
+}
+
+var text;
+var b;
+var grd;
+
+function create() {
+
+ game.stage.setBackgroundColor(0x2d2d2d);
+
+ text = game.add.text(0, 0, "time");
+
+}
+
+function update() {
+
+
+}
+
+function render() {
+
+
+}