diff --git a/Gruntfile.js b/Gruntfile.js
index 17b86ec47..64646566b 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/README.md b/README.md
index 4e5daaae3..d0bc9c1f1 100644
--- a/README.md
+++ b/README.md
@@ -90,6 +90,8 @@ 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.
+* 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:
@@ -120,6 +122,9 @@ 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).
+* 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:
@@ -133,6 +138,11 @@ 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.
+* 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:
@@ -149,6 +159,9 @@ 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)
+* Text that was fixedToCamera would 'jitter' if the world scrolled. Now works as expected across all fixed objects.
+
TO DO:
diff --git a/build/config.php b/build/config.php
index de9615d2e..52ee0cc03 100644
--- a/build/config.php
+++ b/build/config.php
@@ -131,6 +131,7 @@
+
diff --git a/build/p2.js b/build/p2.js
index 8835ae426..e3d50ce4e 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/docs/Animation.js.html b/docs/Animation.js.html
index 6339bf6e7..87ceb7ce5 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 4901a322e..a39ea9fa4 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 913fc6468..4c797fafd 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 e44b9b710..ca4ed830c 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 2e8756191..72b4be78f 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 fed0d413d..d6b83f32e 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 b8ced9deb..0c9d8eecc 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 773b7129b..97fddabaa 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 9dd723502..a00cc84c3 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 d2affe54d..b439b7248 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 b3d079aa3..17dcf6317 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 490a836ba..7aabecfda 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 5aea4a10a..89fd7663a 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 66555f89a..1d3f82e24 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 fd295084f..ab063cb31 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 0372625be..f91ec7410 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 0f18f110f..95ab22415 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 45f6bcadb..5b335934d 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 2155d293a..9a66294a0 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 1255fb6d4..89a7aab2f 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 e9cee97f6..672751ff5 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 9bac1d752..38f812aaa 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 534518f1f..09967842c 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 e586a57ac..68302b3c9 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 cee4d3c9d..e8f7a48d1 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 9c52fbe1a..a081c04d2 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 700740cf3..f153fc58e 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 47ade9b0f..f0e00fcba 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 52f52544b..51ef760a3 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 3a2e16102..f17dbc500 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 8db1ad635..4159d7935 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 e9774482e..889c8af86 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 2c2eab7a8..fda23b649 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 d0b991b58..33300a0c2 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 ea2259288..3201ebe83 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 d9d164b31..1ed147da7 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 7415058b7..5eb87d316 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 1df746286..f5f06e610 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 2474082f1..fa9f77b6f 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 dac06c5e9..606e11d1b 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 99ed31148..a4f0e04ce 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 e96cb6c77..40bf86385 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 3fc4763d6..62c314447 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 3e9aa7d43..6e5d55bbe 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 bf5183609..00ed68f4c 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 0bc7ee123..de949020e 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 deddec262..dd5767415 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 344b74578..45c14e655 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 98654d258..4e57b3d03 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 c7a8e9b17..f78d7388d 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 c7f99b0f0..4a34dab2a 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 2bc4db6d4..a81af0e9a 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 95027f03c..ff0003061 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 42de6dfd4..cf176139d 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 470766b0d..cda99152f 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 d4da03b53..404b7863b 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 3460d9bb3..f975ddf0d 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 2bd23887f..24f17f94b 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 4bea63a3c..7291c13fc 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 949b6d3b5..7dacceb96 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 000000000..445486d76
--- /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 e15a3919e..7659cb055 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 6590db267..10cd7f77b 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 15060ab39..90dcf7dd9 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 395a4cb69..739cda624 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 b6514b7f3..8d104257f 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 060c0ee4c..5d60b167d 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 16e447262..46d72ae15 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 167faf5c6..d2bcf38c4 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 963d58da3..01f67f65b 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 915d4ad3c..daeec541a 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 b86f5ccf9..961596736 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 c6be26c28..28c248c0b 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 f0033004d..97e159ce4 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 a4fee1c18..e01070ed2 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 039989403..42e9587ff 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 53115ab04..315fe8fb8 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 f953f984a..9aa65a274 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 ffc5ec994..6b69c8de7 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 24e942129..4514734af 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 34b8dec42..423fc9553 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 000000000..8632030f5
--- /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 eb7dbfeb6..93e78c8af 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 4fc191e13..9bcb5f320 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 622577880..8a39d1411 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 18255a3b8..2bf4fc017 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 59526d5c2..bfba0ab31 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 14e8f03f4..1abc018c8 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 14a4822ea..ec1300ea2 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 7b369a480..95788e6da 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 69f81237b..f4611c867 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 1c6e73c3a..18afda0bf 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 e9b43d7b7..251dff3a1 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 5851b38fc..e5f9ed408 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 0a3233fe8..55cac1106 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 cf18d6cc3..8475e04b5 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 41be5c716..35553d3dc 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 b325f73ca..3e0a12ade 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 889cdf36a..ef73be97b 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 54a31fad1..2344d187c 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 3c0bf0920..4cf5f8665 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 6d75216e4..584e5b3b1 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 e92d0bf63..4d1a6ec1f 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 d822bdc16..a692a5d91 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 3e920abbd..53b74e558 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 3c724fe2b..3ee341c37 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 8c8108792..f6f5793d2 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 c2c0f642e..557a06a2a 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 0c5e9aa4a..543419d36 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 d703b0b37..72e430770 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 54261eb9c..68696d965 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 b79e8f9a7..5f77cf040 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 9fa9f675a..1c051b466 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 9d2525ea6..0a9df2696 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 1983e6d4a..ecec4f96b 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 5dedb87a8..7e61abb89 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 85665af26..00366e5b4 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 a2c09d20f..2dbbe4126 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 0ea5449c9..4490ca6b1 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 3b6e00c67..f0d45c444 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 8ac30aac8..3eb655a94 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 0213c160e..406731841 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 0fc571851..29fac511f 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 229b9ebdc..24ee51e56 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 00bad73a2..6f5088508 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 7110e8b25..58b8152fd 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 eb256b6d6..59511c176 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 215745fd6..3172b2b53 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 cb36f2d9a..93e93c624 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 7f0680f37..7d959b397 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 f936684e1..ac447ac66 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 d79a738e7..acaeb69c3 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 7cf3fa67b..26ff38860 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 ebbd3ecd5..c7c64c2ba 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 0c89f806a..32e17c26c 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 49641e126..bc2763df8 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 6b470c069..15856305e 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 e772067b5..1fb1e9cb2 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 6daa61f4a..c057bf763 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 b06d0881b..7ca86c268 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 fc27a8f25..52ca0715c 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 7e4e07472..cfb57c5ba 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 378175f60..cabba6147 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 684a55ff5..b5b57d718 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 cdef914bb..8223f21ae 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 a21786a12..bbe889169 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 d2479aa37..c08f1aa9b 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 feb3b1821..b5185e319 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 4b75349d4..2c595f8af 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 d34ce06db..747eeb6f5 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/_site/view_full.html b/examples/_site/view_full.html
index 33314ad85..479851401 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 b7c6d0ae1..0455a4e31 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/assets/sprites/seacreatures_json.json b/examples/assets/sprites/seacreatures_json.json
index 305d2a432..6a5e96d3e 100644
Binary files a/examples/assets/sprites/seacreatures_json.json and b/examples/assets/sprites/seacreatures_json.json differ
diff --git a/examples/basics/03 - move an image.js b/examples/basics/03 - move an image.js
index 0cdd93205..a98631a64 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 bcb21bc7b..5a949b481 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 6060ada2a..cb15113ad 100644
--- a/examples/camera/camera cull.js
+++ b/examples/camera/camera cull.js
@@ -42,7 +42,7 @@ function update() {
function render() {
- game.debug.renderSpriteCorners(s, true, true);
+ game.debug.renderSpriteBounds(s);
game.debug.renderSpriteInfo(s, 20, 32);
}
diff --git a/examples/display/fullscreen.js b/examples/display/fullscreen.js
index d02dd75ce..2ff001d7e 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();
}
diff --git a/examples/groups/bring a group to top.js b/examples/groups/bring a group to top.js
index 687c07f21..bff5bdf41 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 250d6fa09..8123997f7 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/depth sort.js b/examples/groups/depth sort.js
index 05b745113..2684b533f 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++)
{
diff --git a/examples/groups/remove.js b/examples/groups/remove.js
index 85ed08dd9..4b88e3503 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 8fac95956..23de93ce3 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 76a0c6153..0fbc35333 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 0e6542e51..b750015ad 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/keyboard justpressed.js b/examples/input/keyboard justpressed.js
index 8eb6321e5..a4c24e32c 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 ]);
diff --git a/examples/input/motion lock - horizontal.js b/examples/input/motion lock - horizontal.js
index 1e2a82f2a..fff812735 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 045bbc64a..ea5692c36 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)
diff --git a/examples/sprites/out of bounds.js b/examples/sprites/out of bounds.js
index 94ffc31f6..23b7a51c7 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/examples/wip/alpha-mask.js b/examples/wip/alpha-mask.js
new file mode 100644
index 000000000..72d6824fd
--- /dev/null
+++ b/examples/wip/alpha-mask.js
@@ -0,0 +1,34 @@
+
+// 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('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;
+
+function create() {
+
+ var bmd = game.make.bitmapData(320, 256);
+
+ bmd.alphaMask('pic', 'mask2');
+
+ pic = game.add.sprite(0, 0, bmd);
+
+ pic.scale.set(2);
+
+}
+
+function update() {
+
+
+}
+
+function render() {
+
+}
diff --git a/examples/wip/blendmodes.js b/examples/wip/blendmodes.js
new file mode 100644
index 000000000..b8fc2a710
--- /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/examples/wip/graphics-mask.js b/examples/wip/graphics-mask.js
new file mode 100644
index 000000000..85ebff6e0
--- /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/examples/wip/tilemap3.js b/examples/wip/tilemap3.js
new file mode 100644
index 000000000..eb3e62e2f
--- /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() {
+}
diff --git a/examples/wip/tilesprite input.js b/examples/wip/tilesprite input.js
new file mode 100644
index 000000000..94876e905
--- /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/examples/wip/timer1.js b/examples/wip/timer1.js
new file mode 100644
index 000000000..a3e2aedd8
--- /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() {
+
+
+}
diff --git a/labs/code/010 fixed to camera.js b/labs/code/010 fixed to camera.js
new file mode 100644
index 000000000..d900f3ef0
--- /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/Phaser.js b/src/Phaser.js
index 43eeaf5cd..ae7571a06 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/animation/Animation.js b/src/animation/Animation.js
index a61934214..03f0d555e 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)
{
diff --git a/src/core/Game.js b/src/core/Game.js
index 2b1cf940b..0c64a6e8d 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,13 +540,12 @@ 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
+ // 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))
{
@@ -553,7 +558,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 +570,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/Group.js b/src/core/Group.js
index f5a0a3fae..87ae200c7 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);
}
/**
@@ -1147,7 +1145,7 @@ Phaser.Group.prototype.destroy = function (destroyChildren) {
{
do
{
- if (this.children[0].group)
+ if (this.children[0].parent)
{
this.children[0].destroy();
}
diff --git a/src/core/StateManager.js b/src/core/StateManager.js
index a7ebbe060..1a29948fd 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;
}
@@ -329,6 +335,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;
@@ -369,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;
@@ -417,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);
}
},
@@ -428,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);
}
},
@@ -517,6 +525,7 @@ Phaser.StateManager.prototype = {
this.onUpdateCallback = null;
this.onRenderCallback = null;
this.onPausedCallback = null;
+ this.onResumedCallback = null;
this.onDestroyCallback = null;
this.game = null;
diff --git a/src/gameobjects/BitmapData.js b/src/gameobjects/BitmapData.js
index 4c5a5287e..9fdcc4625 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,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 () {
@@ -287,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/gameobjects/BitmapText.js b/src/gameobjects/BitmapText.js
index 12dcc2388..c2b86bde9 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/GameObjectCreator.js b/src/gameobjects/GameObjectCreator.js
new file mode 100644
index 000000000..da0d48053
--- /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 3dae41e8d..4320eba65 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) {
@@ -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.
diff --git a/src/gameobjects/Image.js b/src/gameobjects/Image.js
index 656790812..a76285b6b 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);
@@ -389,10 +384,19 @@ 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;
+ this.filters = null;
+ this.mask = null;
this.game = null;
}
diff --git a/src/gameobjects/RenderTexture.js b/src/gameobjects/RenderTexture.js
index 1fb002d9d..f4db87081 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.
+*/
diff --git a/src/gameobjects/Sprite.js b/src/gameobjects/Sprite.js
index 232c94efd..04769f331 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.
@@ -491,11 +492,6 @@ Phaser.Sprite.prototype.kill = function() {
*/
Phaser.Sprite.prototype.destroy = function() {
- if (this.filters)
- {
- this.filters = null;
- }
-
if (this.parent)
{
this.parent.remove(this);
@@ -521,10 +517,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;
};
diff --git a/src/gameobjects/Text.js b/src/gameobjects/Text.js
index 5aa0b4238..2bca231fc 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 e147145fc..f13ac4adb 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.
*/
@@ -288,9 +293,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;
}
@@ -409,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 c9b7dbc11..844c80111 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;
diff --git a/src/input/InputHandler.js b/src/input/InputHandler.js
index a42ca770e..210f34c25 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/input/Mouse.js b/src/input/Mouse.js
index 0a429375e..033236f0f 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)
{
diff --git a/src/loader/Cache.js b/src/loader/Cache.js
index 3945e6937..37ca004a6 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 f6ee485fe..b4b7cd20a 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;
+
},
/**
@@ -359,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!
*
@@ -883,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";
@@ -1174,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);
@@ -1305,8 +1346,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);
diff --git a/src/physics/Body.js b/src/physics/Body.js
index 218e90e08..a800f720e 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.
@@ -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);
}
diff --git a/src/physics/InversePointProxy.js b/src/physics/InversePointProxy.js
index db936c9bc..c00d9af76 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 57b43083f..409ef7829 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/sound/SoundManager.js b/src/sound/SoundManager.js
index 31988184a..2b7cd833a 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);
diff --git a/src/tilemap/TilemapParser.js b/src/tilemap/TilemapParser.js
index e325cf8ce..973e3917c 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.
@@ -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;
diff --git a/src/utils/Debug.js b/src/utils/Debug.js
index 2dedd032d..a42a3bcdb 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
@@ -373,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();
},
diff --git a/tutorials/01 Getting Started/part4.html b/tutorials/01 Getting Started/part4.html
index d533f735c..4077a440e 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.