diff --git a/README.md b/README.md index 3755ca57..24d9d041 100644 --- a/README.md +++ b/README.md @@ -100,6 +100,7 @@ Bug Fixes: * Added TimerEvent.pendingDelete and checks in Timer.update, so that removing an event in a callback no longer throws an exception (thanks georgiee) * Fixed TypeScript defs on lines 1741-1748 (thanks wombatbuddy) * Previously if you used Sprite.crop() it would crop all Sprites using the same base image. It now takes a local copy of the texture data and crops just that. +* Tilemap had the wrong @method signatures so most were missing from the docs. You can view the Change Log for all previous versions at https://github.com/photonstorm/phaser/changelog.md diff --git a/docs/Animation.js.html b/docs/Animation.js.html index b367005b..a908f303 100644 --- a/docs/Animation.js.html +++ b/docs/Animation.js.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -909,7 +943,7 @@ Phaser.Animation.generateFrameNames = function (prefix, start, stop, suffix, zer Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/AnimationManager.js.html b/docs/AnimationManager.js.html index 7361a183..a8154b53 100644 --- a/docs/AnimationManager.js.html +++ b/docs/AnimationManager.js.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -683,7 +717,7 @@ Phaser.AnimationManager.prototype = { * * @method Phaser.AnimationManager#getAnimation * @param {string} name - The name of the animation to be returned, e.g. "fire". - * @return {Phaser.Animation|boolean} The Animation instance, if found, otherwise false. + * @return {Phaser.Animation} The Animation instance, if found, otherwise null. */ getAnimation: function (name) { @@ -695,7 +729,7 @@ Phaser.AnimationManager.prototype = { } } - return false; + return null; }, @@ -865,7 +899,7 @@ Object.defineProperty(Phaser.AnimationManager.prototype, 'frameName', { Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/AnimationParser.js.html b/docs/AnimationParser.js.html index 63062ca5..a840213d 100644 --- a/docs/AnimationParser.js.html +++ b/docs/AnimationParser.js.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -570,10 +604,14 @@ Phaser.AnimationParser = { frames[i].spriteSourceSize.h ); - // We had to hack Pixi to get this to work :( PIXI.TextureCache[uuid].trimmed = true; - PIXI.TextureCache[uuid].trim.x = frames[i].spriteSourceSize.x; - PIXI.TextureCache[uuid].trim.y = frames[i].spriteSourceSize.y; + + PIXI.TextureCache[uuid].trim = { + x: frames[i].spriteSourceSize.x, + y: frames[i].spriteSourceSize.y, + realWidth: frames[i].sourceSize.w, + realHeight: frames[i].sourceSize.h + } } } @@ -642,10 +680,14 @@ Phaser.AnimationParser = { frames[key].spriteSourceSize.h ); - // We had to hack Pixi to get this to work :( PIXI.TextureCache[uuid].trimmed = true; - PIXI.TextureCache[uuid].trim.x = frames[key].spriteSourceSize.x; - PIXI.TextureCache[uuid].trim.y = frames[key].spriteSourceSize.y; + + PIXI.TextureCache[uuid].trim = { + x: frames[i].spriteSourceSize.x, + y: frames[i].spriteSourceSize.y, + realWidth: frames[i].sourceSize.w, + realHeight: frames[i].sourceSize.h + } } @@ -730,10 +772,14 @@ Phaser.AnimationParser = { PIXI.TextureCache[uuid].realSize = { x: frameX, y: frameY, w: frameWidth, h: frameHeight }; - // We had to hack Pixi to get this to work :( PIXI.TextureCache[uuid].trimmed = true; - PIXI.TextureCache[uuid].trim.x = frameX; - PIXI.TextureCache[uuid].trim.y = frameY; + + PIXI.TextureCache[uuid].trim = { + x: frameX, + y: frameY, + realWidth: width, + realHeight: height + } } } @@ -763,7 +809,7 @@ Phaser.AnimationParser = { Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/ArcadePhysics.js.html b/docs/ArcadePhysics.js.html index f1d2775b..6d71589f 100644 --- a/docs/ArcadePhysics.js.html +++ b/docs/ArcadePhysics.js.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -1053,15 +1087,15 @@ Phaser.Physics.Arcade.prototype = { return; } - var len = group._container.children.length; + var len = group.children.length; for (var i = 0; i < len; i++) { for (var j = i + 1; j <= len; j++) { - if (group._container.children[i] && group._container.children[j] && group._container.children[i].exists && group._container.children[j].exists) + if (group.children[i] && group.children[j] && group.children[i].exists && group.children[j].exists) { - this.collideSpriteVsSprite(group._container.children[i], group._container.children[j], collideCallback, processCallback, callbackContext, overlapOnly); + this.collideSpriteVsSprite(group.children[i], group.children[j], collideCallback, processCallback, callbackContext, overlapOnly); } } } @@ -1081,19 +1115,12 @@ Phaser.Physics.Arcade.prototype = { return; } - if (group1._container.first._iNext) + for (var i = 0, len = group1.children.length; i < len; i++) { - var currentNode = group1._container.first._iNext; - - do + if (group1.children[i].exists) { - if (currentNode.exists) - { - this.collideSpriteVsGroup(currentNode, group2, collideCallback, processCallback, callbackContext, overlapOnly); - } - currentNode = currentNode._iNext; + this.collideSpriteVsGroup(group1.children[i], group2, collideCallback, processCallback, callbackContext, overlapOnly); } - while (currentNode != group1._container.last._iNext); } }, @@ -1163,19 +1190,12 @@ Phaser.Physics.Arcade.prototype = { return; } - if (group._container.first._iNext) + for (var i = 0, len = group.children.length; i < len; i++) { - var currentNode = group._container.first._iNext; - - do + if (group.children[i].exists) { - if (currentNode.exists) - { - this.collideSpriteVsTilemapLayer(currentNode, tilemapLayer, collideCallback, processCallback, callbackContext); - } - currentNode = currentNode._iNext; + this.collideSpriteVsTilemapLayer(group.children[i], tilemapLayer, collideCallback, processCallback, callbackContext); } - while (currentNode != group._container.last._iNext); } }, @@ -1473,6 +1493,8 @@ Phaser.Physics.Arcade.prototype = { body.blocked.down = true; } + body.reboundCheck(body.overlapX, body.overlapY, true); + return true; }, @@ -1865,7 +1887,7 @@ Phaser.Physics.Arcade.prototype.constructor = Phaser.Physics.Arcade; Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/BitmapData.js.html b/docs/BitmapData.js.html index f1e849a9..ec9200d0 100644 --- a/docs/BitmapData.js.html +++ b/docs/BitmapData.js.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -434,13 +468,14 @@ * * @constructor * @param {Phaser.Game} game - A reference to the currently running game. -* @param {number} [width=256] - The width of the BitmapData in pixels. -* @param {number} [height=256] - The height of the BitmapData in pixels. +* @param {string} key - Internal Phaser reference key for the render texture. +* @param {number} [width=100] - The width of the BitmapData in pixels. +* @param {number} [height=100] - The height of the BitmapData in pixels. */ -Phaser.BitmapData = function (game, width, height) { +Phaser.BitmapData = function (game, key, width, height) { - if (typeof width === 'undefined') { width = 256; } - if (typeof height === 'undefined') { height = 256; } + if (typeof width === 'undefined') { width = 100; } + if (typeof height === 'undefined') { height = 100; } /** * @property {Phaser.Game} game - A reference to the currently running game. @@ -448,9 +483,9 @@ Phaser.BitmapData = function (game, width, height) { this.game = game; /** - * @property {string} name - The name of the BitmapData. + * @property {string} key - The key of the BitmapData in the Cache, if stored there. */ - this.name = ''; + this.key = key; /** * @property {number} width - The width of the BitmapData in pixels. @@ -1556,7 +1591,7 @@ Phaser.BitmapData.prototype.de = Phaser.BitmapData.prototype.ellipse; Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/BitmapText.js.html b/docs/BitmapText.js.html index 3f69ce4e..ceb2e4b4 100644 --- a/docs/BitmapText.js.html +++ b/docs/BitmapText.js.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -669,7 +703,7 @@ Object.defineProperty(Phaser.BitmapText.prototype, 'y', { Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Body.js.html b/docs/Body.js.html index 0168e9ab..0d4fb667 100644 --- a/docs/Body.js.html +++ b/docs/Body.js.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -798,6 +832,8 @@ Phaser.Physics.Arcade.Body.prototype = { this.x = (this.sprite.world.x - (this.sprite.anchor.x * this.sprite.width)) + this.offset.x; this.y = (this.sprite.world.y - (this.sprite.anchor.y * this.sprite.height)) + this.offset.y; + console.log('body pre', this.preX, this.preY, 'now', this.x, this.y); + // This covers any motion that happens during this frame, not since the last frame this.preX = this.x; this.preY = this.y; @@ -1306,7 +1342,7 @@ Phaser.Physics.Arcade.Body.prototype = { if (this.inContact(body)) { - return false; + // return false; } this._distances[0] = body.right - this.x; // Distance of B to face on left side of A @@ -1336,11 +1372,11 @@ Phaser.Physics.Arcade.Body.prototype = { if (response.overlapN.x) { // Which is smaller? Left or Right? - if (this._distances[0] < this._distances[1] && (body.checkCollision.right || this.checkCollision.left)) + if (this._distances[0] < this._distances[1]) { hasSeparated = this.hitLeft(body, response); } - else if (this._distances[1] < this._distances[0] && (body.checkCollision.left || this.checkCollision.right)) + else if (this._distances[1] < this._distances[0]) { hasSeparated = this.hitRight(body, response); } @@ -1348,11 +1384,11 @@ Phaser.Physics.Arcade.Body.prototype = { else if (response.overlapN.y) { // Which is smaller? Top or Bottom? - if (this._distances[2] < this._distances[3] && (body.checkCollision.down || this.checkCollision.up)) + if (this._distances[2] < this._distances[3]) { hasSeparated = this.hitTop(body, response); } - else if (this._distances[3] < this._distances[2] && (body.checkCollision.up || this.checkCollision.down)) + else if (this._distances[3] < this._distances[2]) { hasSeparated = this.hitBottom(body, response); } @@ -1390,6 +1426,11 @@ Phaser.Physics.Arcade.Body.prototype = { */ hitLeft: function (body, response) { + if (!this.checkCollision.left || !body.checkCollision.right) + { + return false; + } + if (this.collideCallback && !this.collideCallback.call(this.collideCallbackContext, Phaser.LEFT, this, body, response)) { return; @@ -1432,6 +1473,11 @@ Phaser.Physics.Arcade.Body.prototype = { */ hitRight: function (body, response) { + if (!this.checkCollision.right || !body.checkCollision.left) + { + return false; + } + if (this.collideCallback && !this.collideCallback.call(this.collideCallbackContext, Phaser.RIGHT, this, body)) { return; @@ -1474,6 +1520,11 @@ Phaser.Physics.Arcade.Body.prototype = { */ hitTop: function (body, response) { + if (!this.checkCollision.up || !body.checkCollision.down) + { + return false; + } + if (this.collideCallback && !this.collideCallback.call(this.collideCallbackContext, Phaser.UP, this, body)) { return false; @@ -1518,6 +1569,11 @@ Phaser.Physics.Arcade.Body.prototype = { */ hitBottom: function (body, response) { + if (!this.checkCollision.down || !body.checkCollision.up) + { + return false; + } + if (this.collideCallback && !this.collideCallback.call(this.collideCallbackContext, Phaser.DOWN, this, body)) { return false; @@ -1605,10 +1661,10 @@ Phaser.Physics.Arcade.Body.prototype = { if (this.moves) { - this.reboundCheck(true, true, true); - this.game.physics.checkBounds(this); + this.reboundCheck(true, true, true); + this._dx = this.deltaX(); this._dy = this.deltaY(); @@ -1645,7 +1701,6 @@ Phaser.Physics.Arcade.Body.prototype = { { this.updateScale(); } - } }, @@ -1954,7 +2009,7 @@ Object.defineProperty(Phaser.Physics.Arcade.Body.prototype, "y", { Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Button.js.html b/docs/Button.js.html index 50feb1cd..2b3f7cab 100644 --- a/docs/Button.js.html +++ b/docs/Button.js.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -434,6 +468,7 @@ * You can set a unique texture frame and Sound for any of these states. * * @constructor +* @extends Phaser.Image * * @param {Phaser.Game} game Current game instance. * @param {number} [x=0] - X position of the Button. @@ -454,7 +489,7 @@ Phaser.Button = function (game, x, y, key, callback, callbackContext, overFrame, callback = callback || null; callbackContext = callbackContext || this; - Phaser.Sprite.call(this, game, x, y, key, outFrame); + Phaser.Image.call(this, game, x, y, key, outFrame); /** * @property {number} type - The Phaser Object Type. @@ -597,6 +632,10 @@ Phaser.Button = function (game, x, y, key, callback, callbackContext, overFrame, */ this.forceOut = false; + this.inputEnabled = true; + + this.input.start(0, true); + this.setFrames(overFrame, outFrame, downFrame, upFrame); if (callback !== null) @@ -604,8 +643,6 @@ Phaser.Button = function (game, x, y, key, callback, callbackContext, overFrame, this.onInputUp.add(callback, callbackContext); } - this.input.start(0, true); - // Redirect the input events to here so we can handle animation updates, etc this.events.onInputOver.add(this.onInputOverHandler, this); this.events.onInputOut.add(this.onInputOutHandler, this); @@ -614,8 +651,7 @@ Phaser.Button = function (game, x, y, key, callback, callbackContext, overFrame, }; -Phaser.Button.prototype = Object.create(Phaser.Sprite.prototype); -Phaser.Button.prototype = Phaser.Utils.extend(true, Phaser.Button.prototype, Phaser.Sprite.prototype, PIXI.Sprite.prototype); +Phaser.Button.prototype = Object.create(Phaser.Image.prototype); Phaser.Button.prototype.constructor = Phaser.Button; /** @@ -1071,7 +1107,7 @@ Phaser.Button.prototype.setState = function (newState) { Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Cache.js.html b/docs/Cache.js.html index bc00d8b4..e7c4fb23 100644 --- a/docs/Cache.js.html +++ b/docs/Cache.js.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -1285,7 +1319,7 @@ Phaser.Cache.prototype.constructor = Phaser.Cache; Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Camera.js.html b/docs/Camera.js.html index c91ddc80..d6988af3 100644 --- a/docs/Camera.js.html +++ b/docs/Camera.js.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -853,7 +887,7 @@ Object.defineProperty(Phaser.Camera.prototype, "height", { Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Canvas.js.html b/docs/Canvas.js.html index a5a6e341..76fbb8ea 100644 --- a/docs/Canvas.js.html +++ b/docs/Canvas.js.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -722,7 +756,7 @@ Phaser.Canvas = { Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Circle.js.html b/docs/Circle.js.html index b66a23cb..1c24a00e 100644 --- a/docs/Circle.js.html +++ b/docs/Circle.js.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -549,9 +583,16 @@ Phaser.Circle.prototype = { */ clone: function(out) { - if (typeof out === "undefined") { out = new Phaser.Circle(); } + if (typeof out === "undefined") + { + out = new Phaser.Circle(this.x, this.y, this.diameter); + } + else + { + out.setTo(this.x, this.y, this.diameter); + } - return out.setTo(this.x, this.y, this.diameter); + return out; }, @@ -795,16 +836,17 @@ Object.defineProperty(Phaser.Circle.prototype, "empty", { Phaser.Circle.contains = function (a, x, y) { // Check if x/y are within the bounds first - if (x >= a.left && x <= a.right && y >= a.top && y <= a.bottom) { - + if (a.radius > 0 && x >= a.left && x <= a.right && y >= a.top && y <= a.bottom) + { var dx = (a.x - x) * (a.x - x); var dy = (a.y - y) * (a.y - y); return (dx + dy) <= (a.radius * a.radius); - } - - return false; + else + { + return false; + } }; @@ -892,6 +934,9 @@ Phaser.Circle.intersectsRectangle = function (c, r) { return xCornerDistSq + yCornerDistSq <= maxCornerDistSq; }; + +// Because PIXI uses its own Circle, we'll replace it with ours to avoid duplicating code or confusion. +PIXI.Circle = Phaser.Circle; @@ -913,7 +958,7 @@ Phaser.Circle.intersectsRectangle = function (c, r) { Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Color.js.html b/docs/Color.js.html index ed3362bd..e8c24098 100644 --- a/docs/Color.js.html +++ b/docs/Color.js.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -787,7 +821,7 @@ Phaser.Color = { Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/DOMSprite.js.html b/docs/DOMSprite.js.html index 9bd6f200..ddbe9e15 100644 --- a/docs/DOMSprite.js.html +++ b/docs/DOMSprite.js.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -524,7 +558,7 @@ Phaser.DOMSprite = function (game, element, x, y, style) { Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Debug.js.html b/docs/Debug.js.html index 3db78003..bddeb2ae 100644 --- a/docs/Debug.js.html +++ b/docs/Debug.js.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -1162,19 +1196,32 @@ Phaser.Utils.Debug.prototype = { * @method Phaser.Utils.Debug#renderRectangle * @param {Phaser.Rectangle} rect - The Rectangle to render. * @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) */ - renderRectangle: function (rect, color) { + renderRectangle: function (rect, color, filled) { if (this.context == null) { return; } + if (typeof filled === 'undefined') { filled = true; } + color = color || 'rgba(0,255,0,0.3)'; this.start(); - this.context.fillStyle = color; - this.context.fillRect(rect.x, rect.y, rect.width, rect.height); + + if (filled) + { + this.context.fillStyle = color; + this.context.fillRect(rect.x, rect.y, rect.width, rect.height); + } + else + { + this.context.strokeStyle = color; + this.context.strokeRect(rect.x, rect.y, rect.width, rect.height); + } + this.stop(); }, @@ -1357,7 +1404,7 @@ Phaser.Utils.Debug.prototype.constructor = Phaser.Utils.Debug; Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Device.js.html b/docs/Device.js.html index b5182378..f7d283ec 100644 --- a/docs/Device.js.html +++ b/docs/Device.js.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -1115,7 +1149,7 @@ Phaser.Device.prototype.constructor = Phaser.Device; Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Easing.js.html b/docs/Easing.js.html index 4c9ee5bf..16d187ee 100644 --- a/docs/Easing.js.html +++ b/docs/Easing.js.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -999,7 +1033,7 @@ Phaser.Easing = { Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Emitter.js.html b/docs/Emitter.js.html index f12e2643..ee21431b 100644 --- a/docs/Emitter.js.html +++ b/docs/Emitter.js.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -936,7 +970,6 @@ Phaser.Particles.Arcade.Emitter.prototype.at = function (object) { * The emitters alpha value. * @name Phaser.Particles.Arcade.Emitter#alpha * @property {number} alpha - Gets or sets the alpha value of the Emitter. -*/ Object.defineProperty(Phaser.Particles.Arcade.Emitter.prototype, "alpha", { get: function () { @@ -948,12 +981,12 @@ Object.defineProperty(Phaser.Particles.Arcade.Emitter.prototype, "alpha", { } }); +*/ /** * The emitter visible state. * @name Phaser.Particles.Arcade.Emitter#visible * @property {boolean} visible - Gets or sets the Emitter visible state. -*/ Object.defineProperty(Phaser.Particles.Arcade.Emitter.prototype, "visible", { get: function () { @@ -965,6 +998,7 @@ Object.defineProperty(Phaser.Particles.Arcade.Emitter.prototype, "visible", { } }); +*/ /** * @name Phaser.Particles.Arcade.Emitter#x @@ -1070,7 +1104,7 @@ Object.defineProperty(Phaser.Particles.Arcade.Emitter.prototype, "bottom", { Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Events.js.html b/docs/Events.js.html index 0e77e3f9..b4e01086 100644 --- a/docs/Events.js.html +++ b/docs/Events.js.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -518,7 +552,7 @@ Phaser.Events.prototype.constructor = Phaser.Events; Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Filter.js.html b/docs/Filter.js.html index b187003d..1fd36302 100644 --- a/docs/Filter.js.html +++ b/docs/Filter.js.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -595,7 +629,7 @@ Object.defineProperty(Phaser.Filter.prototype, 'height', { Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Frame.js.html b/docs/Frame.js.html index 56b5e93c..f72b2198 100644 --- a/docs/Frame.js.html +++ b/docs/Frame.js.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -572,6 +606,28 @@ Phaser.Frame.prototype = { this.spriteSourceSizeH = destHeight; } + }, + + /** + * Returns a Rectangle set to the dimensions of this Frame. + * + * @method Phaser.Frame#getRect + * @param {Phaser.Rectangle} [out] - A rectangle to copy the frame dimensions to. + * @return {Phaser.Rectangle} A rectangle. + */ + getRect: function (out) { + + if (typeof out === 'undefined') + { + out = new Phaser.Rectangle(this.x, this.y, this.width, this.height); + } + else + { + out.setTo(this.x, this.y, this.width, this.height); + } + + return out; + } }; @@ -598,7 +654,7 @@ Phaser.Frame.prototype.constructor = Phaser.Frame; Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/FrameData.js.html b/docs/FrameData.js.html index a25b6514..2ab0c7e5 100644 --- a/docs/FrameData.js.html +++ b/docs/FrameData.js.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -477,12 +511,12 @@ Phaser.FrameData.prototype = { */ getFrame: function (index) { - if (this._frames.length > index) + if (index > this._frames.length) { - return this._frames[index]; + index = 0; } - return null; + return this._frames[index]; }, @@ -675,7 +709,7 @@ Object.defineProperty(Phaser.FrameData.prototype, "total", { Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Game.js.html b/docs/Game.js.html index b075f156..93add7bd 100644 --- a/docs/Game.js.html +++ b/docs/Game.js.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -885,7 +919,6 @@ Phaser.Game.prototype = { this.raf = new Phaser.RequestAnimationFrame(this); this.raf.start(); - } }, @@ -1180,7 +1213,7 @@ Object.defineProperty(Phaser.Game.prototype, "paused", { Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/GameObjectFactory.js.html b/docs/GameObjectFactory.js.html index 8665cdb7..e401b29f 100644 --- a/docs/GameObjectFactory.js.html +++ b/docs/GameObjectFactory.js.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -456,6 +490,26 @@ Phaser.GameObjectFactory.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.GameObjectFactory#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. + * @param {Phaser.Group} [group] - Optional Group to add the object to. If not specified it will be added to the World group. + * @returns {Phaser.Sprite} the newly created sprite object. + */ + image: function (x, y, key, frame, group) { + + if (typeof group === 'undefined') { group = this.world; } + + return group.add(new Phaser.Image(this.game, x, y, key, frame)); + + }, + /** * Create a new Sprite with specific position and sprite sheet key. * @@ -475,24 +529,6 @@ Phaser.GameObjectFactory.prototype = { }, - /** - * DEPRECATED - will be removed in Phaser 1.2 - * Create a new Sprite with specific position and sprite sheet key that will automatically be added as a child of the given parent. - * - * @method Phaser.GameObjectFactory#child - * @param {Phaser.Group} group - The Group to add this child to. - * @param {number} x - X position of the new sprite. - * @param {number} y - Y position of the new sprite. - * @param {string|RenderTexture} [key] - The image key as defined in the Game.Cache to use as the texture for this sprite OR a RenderTexture. - * @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. - */ - child: function (group, x, y, key, frame) { - - return group.create(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. * @@ -686,32 +722,51 @@ Phaser.GameObjectFactory.prototype = { * A dynamic initially blank canvas to which images can be drawn. * * @method Phaser.GameObjectFactory#renderTexture - * @param {string} key - Asset key for the render texture. - * @param {number} width - the width of the render texture. - * @param {number} height - the height of the render texture. - * @return {Phaser.RenderTexture} The newly created renderTexture object. + * @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 (key, width, height) { + renderTexture: function (width, height, key, addToCache) { - var texture = new Phaser.RenderTexture(this.game, key, width, height); + if (typeof addToCache === 'undefined') { addToCache = false; } + if (typeof key === 'undefined' || key === '') { key = this.game.rnd.uuid(); } - this.game.cache.addRenderTexture(key, texture); + var texture = new Phaser.RenderTexture(this.game, width, height, key); + + if (addToCache) + { + this.game.cache.addRenderTexture(key, texture); + } return texture; }, /** - * Experimental: A BitmapData object which can be manipulated and drawn to like a traditional Canvas object and used to texture Sprites. + * A BitmapData object which can be manipulated and drawn to like a traditional Canvas object and used to texture Sprites. * * @method Phaser.GameObjectFactory#bitmapData - * @param {number} [width=256] - The width of the BitmapData in pixels. - * @param {number} [height=256] - The height of the BitmapData in pixels. + * @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) { + bitmapData: function (width, height, addToCache) { - return new Phaser.BitmapData(this.game, width, height); + 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; }, @@ -759,7 +814,7 @@ Phaser.GameObjectFactory.prototype.constructor = Phaser.GameObjectFactory; Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Gamepad.js.html b/docs/Gamepad.js.html index 54da0f92..245e1a69 100644 --- a/docs/Gamepad.js.html +++ b/docs/Gamepad.js.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -1014,7 +1048,7 @@ Phaser.Gamepad.XBOX360_STICK_RIGHT_Y = 3; Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/GamepadButton.js.html b/docs/GamepadButton.js.html index e4982105..55529636 100644 --- a/docs/GamepadButton.js.html +++ b/docs/GamepadButton.js.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -611,7 +645,7 @@ Phaser.GamepadButton.prototype.constructor = Phaser.GamepadButton; Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Graphics.js.html b/docs/Graphics.js.html index 4c11d8b7..02ec9f9b 100644 --- a/docs/Graphics.js.html +++ b/docs/Graphics.js.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -459,9 +493,9 @@ Phaser.Graphics.prototype.destroy = function() { this.clear(); - if (this.group) + if (this.parent) { - this.group.remove(this); + this.parent.remove(this); } this.game = null; @@ -470,6 +504,8 @@ Phaser.Graphics.prototype.destroy = function() { /* * Draws a {Phaser.Polygon} or a {PIXI.Polygon} filled +* +* @method Phaser.Sprite.prototype.drawPolygon */ Phaser.Graphics.prototype.drawPolygon = function (poly) { @@ -484,41 +520,14 @@ Phaser.Graphics.prototype.drawPolygon = function (poly) { } -Object.defineProperty(Phaser.Graphics.prototype, 'angle', { - - get: function() { - return Phaser.Math.wrapAngle(Phaser.Math.radToDeg(this.rotation)); - }, - - set: function(value) { - this.rotation = Phaser.Math.degToRad(Phaser.Math.wrapAngle(value)); - } - -}); - -Object.defineProperty(Phaser.Graphics.prototype, 'x', { - - get: function() { - return this.position.x; - }, - - set: function(value) { - this.position.x = value; - } - -}); - -Object.defineProperty(Phaser.Graphics.prototype, 'y', { - - get: function() { - return this.position.y; - }, - - set: function(value) { - this.position.y = value; - } - -}); +/** +* Indicates the rotation of the Button in degrees, from its original orientation. Values from 0 to 180 represent clockwise rotation; values from 0 to -180 represent counterclockwise rotation. +* Values outside this range are added to or subtracted from 360 to obtain a value within the range. For example, the statement player.angle = 450 is the same as player.angle = 90. +* If you wish to work in radians instead of degrees use the rotation property instead. Working in radians is also a little faster as it doesn't have to convert the angle. +* +* @name Phaser.Button#angle +* @property {number} angle - The angle of this Button in degrees. +*/ @@ -540,7 +549,7 @@ Object.defineProperty(Phaser.Graphics.prototype, 'y', { Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Group.js.html b/docs/Group.js.html index 55d13f2c..48a7a8ed 100644 --- a/docs/Group.js.html +++ b/docs/Group.js.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -427,9 +461,9 @@ * @classdesc A Group is a container for display objects that allows for fast pooling, recycling and collision checks. * @constructor * @param {Phaser.Game} game - A reference to the currently running game. -* @param {*} parent - The parent Group or DisplayObjectContainer that will hold this group, if any. If undefined it will use game.world. +* @param {*} parent - The parent Group, DisplayObject or DisplayObjectContainer that this Group will be added to. If undefined or null it will use game.world. * @param {string} [name=group] - A name for this Group. Not used internally but useful for debugging. -* @param {boolean} [useStage=false] - Should the DisplayObjectContainer this Group creates be added to the World (default, false) or direct to the Stage (true). +* @param {boolean} [useStage=false] - Should this Group be added to the World (default, false) or direct to the Stage (true). */ Phaser.Group = function (game, parent, name, useStage) { @@ -438,7 +472,7 @@ Phaser.Group = function (game, parent, name, useStage) { */ this.game = game; - if (typeof parent === 'undefined') + if (typeof parent === 'undefined' || parent === null) { parent = game.world; } @@ -448,38 +482,23 @@ Phaser.Group = function (game, parent, name, useStage) { */ this.name = name || 'group'; + PIXI.DisplayObjectContainer.call(this); + if (typeof useStage === 'undefined') { - useStage = false; - } - - if (useStage) - { - this._container = this.game.stage._stage; - } - else - { - this._container = new PIXI.DisplayObjectContainer(); - this._container.name = this.name; - if (parent) { - if (parent instanceof Phaser.Group) - { - parent._container.addChild(this._container); - } - else - { - parent.addChild(this._container); - parent.updateTransform(); - } + parent.addChild(this); } else { - this.game.stage._stage.addChild(this._container); - this.game.stage._stage.updateTransform(); + this.game.stage._stage.addChild(this); } } + else + { + this.game.stage._stage.addChild(this); + } /** * @property {number} type - Internal Phaser Type value. @@ -494,28 +513,24 @@ Phaser.Group = function (game, parent, name, useStage) { this.alive = true; /** - * @property {boolean} exists - If exists is true the the Group is updated, otherwise it is skipped. + * @property {boolean} exists - If exists is true the Group is updated, otherwise it is skipped. * @default */ this.exists = true; /** - * @property {Phaser.Group} group - The parent Group of this Group, if a child of another. + * @property {Phaser.Group|Phaser.Sprite} parent - The parent of this Group. */ - this.group = null; - - // Replaces the PIXI.Point with a slightly more flexible one. - this._container.scale = new Phaser.Point(1, 1); + // this.group = null; /** - * @property {Phaser.Point} scale - The scane of the Group container. + * @property {Phaser.Point} scale - The scale of the Group container. */ - this.scale = this._container.scale; + this.scale = new Phaser.Point(1, 1); /** * @property {Phaser.Point} pivot - The pivot point of the Group container. */ - this.pivot = this._container.pivot; /** * The cursor is a simple way to iterate through the objects in a Group using the Group.next and Group.previous functions. @@ -524,8 +539,13 @@ Phaser.Group = function (game, parent, name, useStage) { */ this.cursor = null; + this._cursorIndex = 0; + }; +Phaser.Group.prototype = Object.create(PIXI.DisplayObjectContainer.prototype); +Phaser.Group.prototype.constructor = Phaser.Group; + /** * @constant * @type {number} @@ -556,1324 +576,970 @@ Phaser.Group.SORT_ASCENDING = -1; */ Phaser.Group.SORT_DESCENDING = 1; -Phaser.Group.prototype = { +// PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index) - /** - * Adds an existing object to this Group. The object can be an instance of Phaser.Sprite, Phaser.Button or any other display object. - * The child is automatically added to the top of the Group, so renders on-top of everything else within the Group. If you need to control - * that then see the addAt method. - * - * @see Phaser.Group#create - * @see Phaser.Group#addAt - * @method Phaser.Group#add - * @param {*} child - An instance of Phaser.Sprite, Phaser.Button or any other display object.. - * @return {*} The child that was added to the Group. - */ - add: function (child) { +/** +* Adds an existing object to this Group. The object can be an instance of Phaser.Sprite, Phaser.Button or any other display object. +* The child is automatically added to the top of the Group, so renders on-top of everything else within the Group. If you need to control +* that then see the addAt method. +* +* @see Phaser.Group#create +* @see Phaser.Group#addAt +* @method Phaser.Group#add +* @param {*} child - An instance of Phaser.Sprite, Phaser.Button or any other display object.. +* @return {*} The child that was added to the Group. +*/ +Phaser.Group.prototype.add = function (child) { - if (child.group !== this) - { - if (child.type && child.type === Phaser.GROUP) - { - child.group = this; - - this._container.addChild(child._container); - - child._container.updateTransform(); - } - else - { - child.group = this; - - this._container.addChild(child); - - child.updateTransform(); - - if (child.events) - { - child.events.onAddedToGroup.dispatch(child, this); - } - } - - if (this.cursor === null) - { - this.cursor = child; - } - } - - return child; - - }, - - /** - * Adds an existing object to this Group. The object can be an instance of Phaser.Sprite, Phaser.Button or any other display object. - * The child is added to the Group at the location specified by the index value, this allows you to control child ordering. - * - * @method Phaser.Group#addAt - * @param {*} child - An instance of Phaser.Sprite, Phaser.Button or any other display object.. - * @param {number} index - The index within the Group to insert the child to. - * @return {*} The child that was added to the Group. - */ - addAt: function (child, index) { - - if (child.group !== this) - { - if (child.type && child.type === Phaser.GROUP) - { - child.group = this; - - this._container.addChildAt(child._container, index); - - child._container.updateTransform(); - } - else - { - child.group = this; - - this._container.addChildAt(child, index); - - child.updateTransform(); - - if (child.events) - { - child.events.onAddedToGroup.dispatch(child, this); - } - } - - if (this.cursor === null) - { - this.cursor = child; - } - } - - return child; - - }, - - /** - * Returns the child found at the given index within this Group. - * - * @method Phaser.Group#getAt - * @param {number} index - The index to return the child from. - * @return {*} The child that was found at the given index. - */ - getAt: function (index) { - - return this._container.getChildAt(index); - - }, - - /** - * Automatically creates a new Phaser.Sprite object and adds it to the top of this Group. - * Useful if you don't need to create the Sprite instances before-hand. - * - * @method Phaser.Group#create - * @param {number} x - The x coordinate to display the newly created Sprite at. The value is in relation to the Group.x point. - * @param {number} y - The y coordinate to display the newly created Sprite at. The value is in relation to the Group.y point. - * @param {string} key - The Game.cache key of the image that this Sprite will use. - * @param {number|string} [frame] - If the Sprite image contains multiple frames you can specify which one to use here. - * @param {boolean} [exists=true] - The default exists state of the Sprite. - * @return {Phaser.Sprite} The child that was created. - */ - create: function (x, y, key, frame, exists) { - - if (typeof exists === 'undefined') { exists = true; } - - var child = new Phaser.Sprite(this.game, x, y, key, frame); - - child.group = this; - child.exists = exists; - child.visible = exists; - child.alive = exists; - - this._container.addChild(child); - - child.updateTransform(); + if (child.parent !== this) + { + this.addChild(child); if (child.events) { child.events.onAddedToGroup.dispatch(child, this); } - - if (this.cursor === null) - { - this.cursor = child; - } - - return child; - - }, - - /** - * Automatically creates multiple Phaser.Sprite objects and adds them to the top of this Group. - * Useful if you need to quickly generate a pool of identical sprites, such as bullets. By default the sprites will be set to not exist - * and will be positioned at 0, 0 (relative to the Group.x/y) - * - * @method Phaser.Group#createMultiple - * @param {number} quantity - The number of Sprites to create. - * @param {string} key - The Game.cache key of the image that this Sprite will use. - * @param {number|string} [frame] - If the Sprite image contains multiple frames you can specify which one to use here. - * @param {boolean} [exists=false] - The default exists state of the Sprite. - */ - createMultiple: function (quantity, key, frame, exists) { - - if (typeof exists === 'undefined') { exists = false; } - - for (var i = 0; i < quantity; i++) - { - var child = new Phaser.Sprite(this.game, 0, 0, key, frame); - - child.group = this; - child.exists = exists; - child.visible = exists; - child.alive = exists; - - this._container.addChild(child); - - child.updateTransform(); - - if (child.events) - { - child.events.onAddedToGroup.dispatch(child, this); - } - - if (this.cursor === null) - { - this.cursor = child; - } - - } - - }, - - /** - * Advances the Group cursor to the next object in the Group. If it's at the end of the Group it wraps around to the first object. - * - * @method Phaser.Group#next - */ - next: function () { - - if (this.cursor) - { - // Wrap the cursor? - if (this.cursor == this._container.last) - { - this.cursor = this._container._iNext; - } - else - { - this.cursor = this.cursor._iNext; - } - } - - }, - - /** - * Moves the Group cursor to the previous object in the Group. If it's at the start of the Group it wraps around to the last object. - * - * @method Phaser.Group#previous - */ - previous: function () { - - if (this.cursor) - { - // Wrap the cursor? - if (this.cursor == this._container._iNext) - { - this.cursor = this._container.last; - } - else - { - this.cursor = this.cursor._iPrev; - } - } - - }, - - /** - * Internal test. - * - * @method Phaser.Group#childTest - */ - childTest: function (prefix, child) { - - var s = prefix + ' next: '; - - if (child._iNext) - { - s = s + child._iNext.name; - } - else - { - s = s + '-null-'; - } - - s = s + ' ' + prefix + ' prev: '; - - if (child._iPrev) - { - s = s + child._iPrev.name; - } - else - { - s = s + '-null-'; - } - - console.log(s); - - }, - - /** - * Internal test. - * - * @method Phaser.Group#swapIndex - */ - swapIndex: function (index1, index2) { - - var child1 = this.getAt(index1); - var child2 = this.getAt(index2); - - this.swap(child1, child2); - - }, - - /** - * Swaps the position of two children in this Group. Both children must be in this Group. - * You cannot swap a child with itself, or swap un-parented children, doing so will return false. - * - * @method Phaser.Group#swap - * @param {*} child1 - The first child to swap. - * @param {*} child2 - The second child to swap. - * @return {boolean} True if the swap was successful, otherwise false. - */ - swap: function (child1, child2) { - - if (child1 === child2 || !child1.parent || !child2.parent || child1.group !== this || child2.group !== this) - { - return false; - } - - // Cache the values - var child1Prev = child1._iPrev; - var child1Next = child1._iNext; - var child2Prev = child2._iPrev; - var child2Next = child2._iNext; - - var endNode = this._container.last._iNext; - var currentNode = this.game.stage._stage; - - do - { - if (currentNode !== child1 && currentNode !== child2) - { - if (currentNode.first === child1) - { - currentNode.first = child2; - } - else if (currentNode.first === child2) - { - currentNode.first = child1; - } - - if (currentNode.last === child1) - { - currentNode.last = child2; - } - else if (currentNode.last === child2) - { - currentNode.last = child1; - } - } - - currentNode = currentNode._iNext; - } - while (currentNode != endNode) - - if (child1._iNext == child2) - { - // This is a downward (A to B) neighbour swap - child1._iNext = child2Next; - child1._iPrev = child2; - child2._iNext = child1; - child2._iPrev = child1Prev; - - if (child1Prev) { child1Prev._iNext = child2; } - if (child2Next) { child2Next._iPrev = child1; } - - if (child1.__renderGroup) - { - child1.__renderGroup.updateTexture(child1); - } - - if (child2.__renderGroup) - { - child2.__renderGroup.updateTexture(child2); - } - - return true; - } - else if (child2._iNext == child1) - { - // This is an upward (B to A) neighbour swap - child1._iNext = child2; - child1._iPrev = child2Prev; - child2._iNext = child1Next; - child2._iPrev = child1; - - if (child2Prev) { child2Prev._iNext = child1; } - if (child1Next) { child1Next._iPrev = child2; } - - if (child1.__renderGroup) - { - child1.__renderGroup.updateTexture(child1); - } - - if (child2.__renderGroup) - { - child2.__renderGroup.updateTexture(child2); - } - - return true; - } - else - { - // Children are far apart - child1._iNext = child2Next; - child1._iPrev = child2Prev; - child2._iNext = child1Next; - child2._iPrev = child1Prev; - - if (child1Prev) { child1Prev._iNext = child2; } - if (child1Next) { child1Next._iPrev = child2; } - if (child2Prev) { child2Prev._iNext = child1; } - if (child2Next) { child2Next._iPrev = child1; } - - if (child1.__renderGroup) - { - child1.__renderGroup.updateTexture(child1); - } - - if (child2.__renderGroup) - { - child2.__renderGroup.updateTexture(child2); - } - - return true; - } - - return false; - - }, - - /** - * Brings the given child to the top of this Group so it renders above all other children. - * - * @method Phaser.Group#bringToTop - * @param {*} child - The child to bring to the top of this Group. - * @return {*} The child that was moved. - */ - bringToTop: function (child) { - - if (child.group === this) - { - this.remove(child); - this.add(child); - } - - return child; - - }, - - /** - * Get the index position of the given child in this Group. - * - * @method Phaser.Group#getIndex - * @param {*} child - The child to get the index for. - * @return {number} The index of the child or -1 if it's not a member of this Group. - */ - getIndex: function (child) { - - return this._container.children.indexOf(child); - - }, - - /** - * Replaces a child of this Group with the given newChild. The newChild cannot be a member of this Group. - * - * @method Phaser.Group#replace - * @param {*} oldChild - The child in this Group that will be replaced. - * @param {*} newChild - The child to be inserted into this group. - */ - replace: function (oldChild, newChild) { - - if (!this._container.first._iNext) - { - return; - } - - var index = this.getIndex(oldChild); - - if (index != -1) - { - if (newChild.parent !== undefined) - { - newChild.events.onRemovedFromGroup.dispatch(newChild, this); - newChild.parent.removeChild(newChild); - } - - this._container.removeChild(oldChild); - this._container.addChildAt(newChild, index); - - newChild.events.onAddedToGroup.dispatch(newChild, this); - newChild.updateTransform(); - - if (this.cursor == oldChild) - { - this.cursor = this._container._iNext; - } - } - - }, - - /** - * Sets the given property to the given value on the child. The operation controls the assignment of the value. - * - * @method Phaser.Group#setProperty - * @param {*} child - The child to set the property value on. - * @param {array} key - An array of strings that make up the property that will be set. - * @param {*} value - The value that will be set. - * @param {number} [operation=0] - Controls how the value is assigned. A value of 0 replaces the value with the new one. A value of 1 adds it, 2 subtracts it, 3 multiplies it and 4 divides it. - */ - setProperty: function (child, key, value, operation) { - - operation = operation || 0; - - // As ugly as this approach looks, and although it's limited to a depth of only 4, it's extremely fast. - // Much faster than a for loop or object iteration. There are no checks, so if the key isn't valid then it'll fail - // but as you are likely to call this from inner loops that have to perform well, I'll take that trade off. - - // 0 = Equals - // 1 = Add - // 2 = Subtract - // 3 = Multiply - // 4 = Divide - - var len = key.length; - - if (len == 1) - { - if (operation === 0) { child[key[0]] = value; } - else if (operation == 1) { child[key[0]] += value; } - else if (operation == 2) { child[key[0]] -= value; } - else if (operation == 3) { child[key[0]] *= value; } - else if (operation == 4) { child[key[0]] /= value; } - } - else if (len == 2) - { - if (operation === 0) { child[key[0]][key[1]] = value; } - else if (operation == 1) { child[key[0]][key[1]] += value; } - else if (operation == 2) { child[key[0]][key[1]] -= value; } - else if (operation == 3) { child[key[0]][key[1]] *= value; } - else if (operation == 4) { child[key[0]][key[1]] /= value; } - } - else if (len == 3) - { - if (operation === 0) { child[key[0]][key[1]][key[2]] = value; } - else if (operation == 1) { child[key[0]][key[1]][key[2]] += value; } - else if (operation == 2) { child[key[0]][key[1]][key[2]] -= value; } - else if (operation == 3) { child[key[0]][key[1]][key[2]] *= value; } - else if (operation == 4) { child[key[0]][key[1]][key[2]] /= value; } - } - else if (len == 4) - { - if (operation === 0) { child[key[0]][key[1]][key[2]][key[3]] = value; } - else if (operation == 1) { child[key[0]][key[1]][key[2]][key[3]] += value; } - else if (operation == 2) { child[key[0]][key[1]][key[2]][key[3]] -= value; } - else if (operation == 3) { child[key[0]][key[1]][key[2]][key[3]] *= value; } - else if (operation == 4) { child[key[0]][key[1]][key[2]][key[3]] /= value; } - } - - // TODO - Deep property scane - - }, - - /** - * This function allows you to quickly set a property on a single child of this Group to a new value. - * The operation parameter controls how the new value is assigned to the property, from simple replacement to addition and multiplication. - * - * @method Phaser.Group#set - * @param {Phaser.Sprite} child - The child to set the property on. - * @param {string} key - The property, as a string, to be set. For example: 'body.velocity.x' - * @param {*} value - The value that will be set. - * @param {boolean} [checkAlive=false] - If set then the child will only be updated if alive=true. - * @param {boolean} [checkVisible=false] - If set then the child will only be updated if visible=true. - * @param {number} [operation=0] - Controls how the value is assigned. A value of 0 replaces the value with the new one. A value of 1 adds it, 2 subtracts it, 3 multiplies it and 4 divides it. - */ - set: function (child, key, value, checkAlive, checkVisible, operation) { - - key = key.split('.'); - - if (typeof checkAlive === 'undefined') { checkAlive = false; } - if (typeof checkVisible === 'undefined') { checkVisible = false; } - - if ((checkAlive === false || (checkAlive && child.alive)) && (checkVisible === false || (checkVisible && child.visible))) - { - this.setProperty(child, key, value, operation); - } - - }, - - /** - * This function allows you to quickly set the same property across all children of this Group to a new value. - * The operation parameter controls how the new value is assigned to the property, from simple replacement to addition and multiplication. - * - * @method Phaser.Group#setAll - * @param {string} key - The property, as a string, to be set. For example: 'body.velocity.x' - * @param {*} value - The value that will be set. - * @param {boolean} [checkAlive=false] - If set then only children with alive=true will be updated. - * @param {boolean} [checkVisible=false] - If set then only children with visible=true will be updated. - * @param {number} [operation=0] - Controls how the value is assigned. A value of 0 replaces the value with the new one. A value of 1 adds it, 2 subtracts it, 3 multiplies it and 4 divides it. - */ - setAll: function (key, value, checkAlive, checkVisible, operation) { - - key = key.split('.'); - - if (typeof checkAlive === 'undefined') { checkAlive = false; } - if (typeof checkVisible === 'undefined') { checkVisible = false; } - - operation = operation || 0; - - if (this._container.children.length > 0 && this._container.first._iNext) - { - var currentNode = this._container.first._iNext; - - do - { - if ((checkAlive === false || (checkAlive && currentNode.alive)) && (checkVisible === false || (checkVisible && currentNode.visible))) - { - this.setProperty(currentNode, key, value, operation); - } - - currentNode = currentNode._iNext; - } - while (currentNode != this._container.last._iNext) - } - - }, - - /** - * Adds the amount to the given property on all children in this Group. - * Group.addAll('x', 10) will add 10 to the child.x value. - * - * @method Phaser.Group#addAll - * @param {string} property - The property to increment, for example 'body.velocity.x' or 'angle'. - * @param {number} amount - The amount to increment the property by. If child.x = 10 then addAll('x', 40) would make child.x = 50. - * @param {boolean} checkAlive - If true the property will only be changed if the child is alive. - * @param {boolean} checkVisible - If true the property will only be changed if the child is visible. - */ - addAll: function (property, amount, checkAlive, checkVisible) { - - this.setAll(property, amount, checkAlive, checkVisible, 1); - - }, - - /** - * Subtracts the amount from the given property on all children in this Group. - * Group.subAll('x', 10) will minus 10 from the child.x value. - * - * @method Phaser.Group#subAll - * @param {string} property - The property to decrement, for example 'body.velocity.x' or 'angle'. - * @param {number} amount - The amount to subtract from the property. If child.x = 50 then subAll('x', 40) would make child.x = 10. - * @param {boolean} checkAlive - If true the property will only be changed if the child is alive. - * @param {boolean} checkVisible - If true the property will only be changed if the child is visible. - */ - subAll: function (property, amount, checkAlive, checkVisible) { - - this.setAll(property, amount, checkAlive, checkVisible, 2); - - }, - - /** - * Multiplies the given property by the amount on all children in this Group. - * Group.multiplyAll('x', 2) will x2 the child.x value. - * - * @method Phaser.Group#multiplyAll - * @param {string} property - The property to multiply, for example 'body.velocity.x' or 'angle'. - * @param {number} amount - The amount to multiply the property by. If child.x = 10 then multiplyAll('x', 2) would make child.x = 20. - * @param {boolean} checkAlive - If true the property will only be changed if the child is alive. - * @param {boolean} checkVisible - If true the property will only be changed if the child is visible. - */ - multiplyAll: function (property, amount, checkAlive, checkVisible) { - - this.setAll(property, amount, checkAlive, checkVisible, 3); - - }, - - /** - * Divides the given property by the amount on all children in this Group. - * Group.divideAll('x', 2) will half the child.x value. - * - * @method Phaser.Group#divideAll - * @param {string} property - The property to divide, for example 'body.velocity.x' or 'angle'. - * @param {number} amount - The amount to divide the property by. If child.x = 100 then divideAll('x', 2) would make child.x = 50. - * @param {boolean} checkAlive - If true the property will only be changed if the child is alive. - * @param {boolean} checkVisible - If true the property will only be changed if the child is visible. - */ - divideAll: function (property, amount, checkAlive, checkVisible) { - - this.setAll(property, amount, checkAlive, checkVisible, 4); - - }, - - /** - * Calls a function on all of the children that have exists=true in this Group. - * After the existsValue parameter you can add as many parameters as you like, which will all be passed to the child callback. - * - * @method Phaser.Group#callAllExists - * @param {function} callback - The function that exists on the children that will be called. - * @param {boolean} existsValue - Only children with exists=existsValue will be called. - * @param {...*} parameter - Additional parameters that will be passed to the callback. - */ - callAllExists: function (callback, existsValue) { - - var args = Array.prototype.splice.call(arguments, 2); - - if (this._container.children.length > 0 && this._container.first._iNext) - { - var currentNode = this._container.first._iNext; - - do - { - if (currentNode.exists == existsValue && currentNode[callback]) - { - currentNode[callback].apply(currentNode, args); - } - - currentNode = currentNode._iNext; - } - while (currentNode != this._container.last._iNext) - - } - - }, - - /** - * Returns a reference to a function that exists on a child of the Group based on the given callback array. - * - * @method Phaser.Group#callbackFromArray - * @param {object} child - The object to inspect. - * @param {array} callback - The array of function names. - * @param {number} length - The size of the array (pre-calculated in callAll). - * @protected - */ - callbackFromArray: function (child, callback, length) { - - // Kinda looks like a Christmas tree - - if (length == 1) - { - if (child[callback[0]]) - { - return child[callback[0]]; - } - } - else if (length == 2) - { - if (child[callback[0]][callback[1]]) - { - return child[callback[0]][callback[1]]; - } - } - else if (length == 3) - { - if (child[callback[0]][callback[1]][callback[2]]) - { - return child[callback[0]][callback[1]][callback[2]]; - } - } - else if (length == 4) - { - if (child[callback[0]][callback[1]][callback[2]][callback[3]]) - { - return child[callback[0]][callback[1]][callback[2]][callback[3]]; - } - } - else - { - if (child[callback]) - { - return child[callback]; - } - } - - return false; - - }, - - /** - * Calls a function on all of the children regardless if they are dead or alive (see callAllExists if you need control over that) - * After the method parameter and context you can add as many extra parameters as you like, which will all be passed to the child. - * - * @method Phaser.Group#callAll - * @param {string} method - A string containing the name of the function that will be called. The function must exist on the child. - * @param {string} [context=null] - A string containing the context under which the method will be executed. Set to null to default to the child. - * @param {...*} parameter - Additional parameters that will be passed to the method. - */ - callAll: function (method, context) { - - if (typeof method === 'undefined') - { - return; - } - - // Extract the method into an array - method = method.split('.'); - - var methodLength = method.length; - - if (typeof context === 'undefined') - { - context = null; - } - else - { - // Extract the context into an array - if (typeof context === 'string') - { - context = context.split('.'); - var contextLength = context.length; - } - } - - var args = Array.prototype.splice.call(arguments, 2); - var callback = null; - var callbackContext = null; - - if (this._container.children.length > 0 && this._container.first._iNext) - { - var child = this._container.first._iNext; - - do - { - callback = this.callbackFromArray(child, method, methodLength); - - if (context && callback) - { - callbackContext = this.callbackFromArray(child, context, contextLength); - - if (callback) - { - callback.apply(callbackContext, args); - } - } - else if (callback) - { - callback.apply(child, args); - } - - child = child._iNext; - } - while (child != this._container.last._iNext) - - } - - }, - - /** - * Allows you to call your own function on each member of this Group. You must pass the callback and context in which it will run. - * After the checkExists parameter you can add as many parameters as you like, which will all be passed to the callback along with the child. - * For example: Group.forEach(awardBonusGold, this, true, 100, 500) - * Note: Currently this will skip any children which are Groups themselves. - * - * @method Phaser.Group#forEach - * @param {function} callback - The function that will be called. Each child of the Group will be passed to it as its first parameter. - * @param {Object} callbackContext - The context in which the function should be called (usually 'this'). - * @param {boolean} checkExists - If set only children with exists=true will be passed to the callback, otherwise all children will be passed. - */ - forEach: function (callback, callbackContext, checkExists) { - - if (typeof checkExists === 'undefined') - { - checkExists = false; - } - - var args = Array.prototype.splice.call(arguments, 3); - args.unshift(null); - - if (this._container.children.length > 0 && this._container.first._iNext) - { - var currentNode = this._container.first._iNext; - - do - { - if (checkExists === false || (checkExists && currentNode.exists)) - { - args[0] = currentNode; - callback.apply(callbackContext, args); - } - - currentNode = currentNode._iNext; - } - while (currentNode != this._container.last._iNext); - - } - - }, - - /** - * 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) - * - * @method Phaser.Group#forEachAlive - * @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'). - */ - forEachExists: function (callback, callbackContext) { - - var args = Array.prototype.splice.call(arguments, 2); - args.unshift(null); - - this.iterate('exists', true, Phaser.Group.RETURN_TOTAL, callback, callbackContext, args); - - }, - - /** - * 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) - * - * @method Phaser.Group#forEachAlive - * @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'). - */ - forEachAlive: function (callback, callbackContext) { - - var args = Array.prototype.splice.call(arguments, 2); - args.unshift(null); - - this.iterate('alive', true, Phaser.Group.RETURN_TOTAL, callback, callbackContext, args); - - }, - - /** - * Allows you to call your own function on each dead member of this Group (where alive=false). You must pass the callback and context in which it will run. - * You can add as many parameters as you like, which will all be passed to the callback along with the child. - * For example: Group.forEachDead(bringToLife, this) - * - * @method Phaser.Group#forEachDead - * @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'). - */ - forEachDead: function (callback, callbackContext) { - - var args = Array.prototype.splice.call(arguments, 2); - args.unshift(null); - - this.iterate('alive', false, Phaser.Group.RETURN_TOTAL, callback, callbackContext, args); - - }, - - /** - * Call this function to sort the group according to a particular value and order. - * For example to depth sort Sprites for Zelda-style game you might call `group.sort('y', Phaser.Group.SORT_ASCENDING)` at the bottom of your `State.update()`. - * - * @method Phaser.Group#sort - * @param {string} [index='y'] - The `string` name of the property you want to sort on. - * @param {number} [order=Phaser.Group.SORT_ASCENDING] - The `Group` constant that defines the sort order. Possible values are Phaser.Group.SORT_ASCENDING and Phaser.Group.SORT_DESCENDING. - */ - sort: function (index, order) { - - if (typeof index === 'undefined') { index = 'y'; } - if (typeof order === 'undefined') { order = Phaser.Group.SORT_ASCENDING; } - - var swapped; - var temp; - - do { - - swapped = false; - - for (var i = 0, len = this._container.children.length - 1; i < len; i++) - { - if (order == Phaser.Group.SORT_ASCENDING) - { - if (this._container.children[i][index] > this._container.children[i + 1][index]) - { - this.swap(this.getAt(i), this.getAt(i + 1)); - temp = this._container.children[i]; - this._container.children[i] = this._container.children[i + 1]; - this._container.children[i + 1] = temp; - swapped = true; - } - } - else - { - if (this._container.children[i][index] < this._container.children[i + 1][index]) - { - this.swap(this.getAt(i), this.getAt(i + 1)); - temp = this._container.children[i]; - this._container.children[i] = this._container.children[i + 1]; - this._container.children[i + 1] = temp; - swapped = true; - } - } - } - } while (swapped); - - }, - - /** - * Iterates over the children of the Group. When a child has a property matching key that equals the given value, it is considered as a match. - * Matched children can be sent to the optional callback, or simply returned or counted. - * You can add as many callback parameters as you like, which will all be passed to the callback along with the child, after the callbackContext parameter. - * - * @method Phaser.Group#iterate - * @param {string} key - The child property to check, i.e. 'exists', 'alive', 'health' - * @param {any} value - If child.key === this value it will be considered a match. Note that a strict comparison is used. - * @param {number} returnType - How to return the data from this method. Either Phaser.Group.RETURN_NONE, Phaser.Group.RETURN_TOTAL or Phaser.Group.RETURN_CHILD. - * @param {function} [callback=null] - Optional function that will be called on each matching child. Each child of the Group will be passed to it as its first parameter. - * @param {Object} [callbackContext] - The context in which the function should be called (usually 'this'). - * @return {any} Returns either a numeric total (if RETURN_TOTAL was specified) or the child object. - */ - iterate: function (key, value, returnType, callback, callbackContext, args) { - - if (returnType === Phaser.Group.RETURN_TOTAL && this._container.children.length === 0) - { - return 0; - } - - if (typeof callback === 'undefined') - { - callback = false; - } - - var total = 0; - - if (this._container.children.length > 0 && this._container.first._iNext) - { - var currentNode = this._container.first._iNext; - - do - { - if (currentNode[key] === value) - { - total++; - - if (callback) - { - args[0] = currentNode; - callback.apply(callbackContext, args); - } - - if (returnType === Phaser.Group.RETURN_CHILD) - { - return currentNode; - } - } - - currentNode = currentNode._iNext; - } - while (currentNode != this._container.last._iNext); - } - - if (returnType === Phaser.Group.RETURN_TOTAL) - { - return total; - } - else if (returnType === Phaser.Group.RETURN_CHILD) - { - return null; - } - - }, - - /** - * Call this function to retrieve the first object with exists == (the given state) in the Group. - * - * @method Phaser.Group#getFirstExists - * @param {boolean} state - True or false. - * @return {Any} The first child, or null if none found. - */ - getFirstExists: function (state) { - - if (typeof state !== 'boolean') - { - state = true; - } - - return this.iterate('exists', state, Phaser.Group.RETURN_CHILD); - - }, - - /** - * Call this function to retrieve the first object with alive === true in the group. - * This is handy for checking if everything has been wiped out, or choosing a squad leader, etc. - * - * @method Phaser.Group#getFirstAlive - * @return {Any} The first alive child, or null if none found. - */ - getFirstAlive: function () { - - return this.iterate('alive', true, Phaser.Group.RETURN_CHILD); - - }, - - /** - * Call this function to retrieve the first object with alive === false in the group. - * This is handy for checking if everything has been wiped out, or choosing a squad leader, etc. - * - * @method Phaser.Group#getFirstDead - * @return {Any} The first dead child, or null if none found. - */ - getFirstDead: function () { - - return this.iterate('alive', false, Phaser.Group.RETURN_CHILD); - - }, - - /** - * Call this function to find out how many members of the group are alive. - * - * @method Phaser.Group#countLiving - * @return {number} The number of children flagged as alive. - */ - countLiving: function () { - - return this.iterate('alive', true, Phaser.Group.RETURN_TOTAL); - - }, - - /** - * Call this function to find out how many members of the group are dead. - * - * @method Phaser.Group#countDead - * @return {number} The number of children flagged as dead. - */ - countDead: function () { - - return this.iterate('alive', false, Phaser.Group.RETURN_TOTAL); - - }, - - /** - * Returns a member at random from the group. - * - * @method Phaser.Group#getRandom - * @param {number} startIndex - Optional offset off the front of the array. Default value is 0, or the beginning of the array. - * @param {number} length - Optional restriction on the number of values you want to randomly select from. - * @return {Any} A random child of this Group. - */ - getRandom: function (startIndex, length) { - - if (this._container.children.length === 0) - { - return null; - } - - startIndex = startIndex || 0; - length = length || this._container.children.length; - - return this.game.math.getRandom(this._container.children, startIndex, length); - - }, - - /** - * Removes the given child from this Group and sets its group property to null. - * - * @method Phaser.Group#remove - * @param {Any} child - The child to remove. - * @return {boolean} true if the child was removed from this Group, otherwise false. - */ - remove: function (child) { - - if (child.group !== this) - { - return false; - } + } + + if (this.cursor === null) + { + this.cursor = child; + } + + return child; + +} + +/** +* Adds an existing object to this Group. The object can be an instance of Phaser.Sprite, Phaser.Button or any other display object. +* The child is added to the Group at the location specified by the index value, this allows you to control child ordering. +* +* @method Phaser.Group#addAt +* @param {*} child - An instance of Phaser.Sprite, Phaser.Button or any other display object.. +* @param {number} index - The index within the Group to insert the child to. +* @return {*} The child that was added to the Group. +*/ +Phaser.Group.prototype.addAt = function (child, index) { + + if (child.parent !== this) + { + this.addChildAt(child, index); if (child.events) { - child.events.onRemovedFromGroup.dispatch(child, this); + child.events.onAddedToGroup.dispatch(child, this); } + } - // Check it's actually in the container - if (child.parent === this._container) + if (this.cursor === null) + { + this.cursor = child; + } + + return child; + +} + +/** +* Returns the child found at the given index within this Group. +* +* @method Phaser.Group#getAt +* @param {number} index - The index to return the child from. +* @return {*} The child that was found at the given index. +*/ +Phaser.Group.prototype.getAt = function (index) { + + return this.getChildAt(index); + +} + +/** +* Automatically creates a new Phaser.Sprite object and adds it to the top of this Group. +* Useful if you don't need to create the Sprite instances before-hand. +* +* @method Phaser.Group#create +* @param {number} x - The x coordinate to display the newly created Sprite at. The value is in relation to the Group.x point. +* @param {number} y - The y coordinate to display the newly created Sprite at. The value is in relation to the Group.y point. +* @param {string} key - The Game.cache key of the image that this Sprite will use. +* @param {number|string} [frame] - If the Sprite image contains multiple frames you can specify which one to use here. +* @param {boolean} [exists=true] - The default exists state of the Sprite. +* @return {Phaser.Sprite} The child that was created. +*/ +Phaser.Group.prototype.create = function (x, y, key, frame, exists) { + + if (typeof exists === 'undefined') { exists = true; } + + var child = new Phaser.Sprite(this.game, x, y, key, frame); + + child.exists = exists; + child.visible = exists; + child.alive = exists; + + this.addChild(child); + + if (child.events) + { + child.events.onAddedToGroup.dispatch(child, this); + } + + if (this.cursor === null) + { + this.cursor = child; + } + + return child; + +} + +/** +* Automatically creates multiple Phaser.Sprite objects and adds them to the top of this Group. +* Useful if you need to quickly generate a pool of identical sprites, such as bullets. By default the sprites will be set to not exist +* and will be positioned at 0, 0 (relative to the Group.x/y) +* +* @method Phaser.Group#createMultiple +* @param {number} quantity - The number of Sprites to create. +* @param {string} key - The Game.cache key of the image that this Sprite will use. +* @param {number|string} [frame] - If the Sprite image contains multiple frames you can specify which one to use here. +* @param {boolean} [exists=false] - The default exists state of the Sprite. +*/ +Phaser.Group.prototype.createMultiple = function (quantity, key, frame, exists) { + + if (typeof exists === 'undefined') { exists = false; } + + for (var i = 0; i < quantity; i++) + { + this.create(0, 0, key, frame, exists); + } + +} + +/** +* Advances the Group cursor to the next object in the Group. If it's at the end of the Group it wraps around to the first object. +* +* @method Phaser.Group#next +*/ +Phaser.Group.prototype.next = function () { + + if (this.cursor) + { + // Wrap the cursor? + if (this._cursorIndex === this.children.length) { - this._container.removeChild(child); - } - - if (this.cursor == child) - { - if (this._container._iNext) - { - this.cursor = this._container._iNext; - } - else - { - this.cursor = null; - } - } - - child.group = null; - - return true; - - }, - - /** - * Removes all children from this Group, setting all group properties to null. - * The Group container remains on the display list. - * - * @method Phaser.Group#removeAll - */ - removeAll: function () { - - if (this._container.children.length === 0) - { - return; - } - - do - { - if (this._container.children[0].events) - { - this._container.children[0].events.onRemovedFromGroup.dispatch(this._container.children[0], this); - } - this._container.removeChild(this._container.children[0]); - } - while (this._container.children.length > 0); - - this.cursor = null; - - }, - - /** - * Removes all children from this Group whos index falls beteen the given startIndex and endIndex values. - * - * @method Phaser.Group#removeBetween - * @param {number} startIndex - The index to start removing children from. - * @param {number} endIndex - The index to stop removing children from. Must be higher than startIndex and less than the length of the Group. - */ - removeBetween: function (startIndex, endIndex) { - - if (this._container.children.length === 0) - { - return; - } - - if (startIndex > endIndex || startIndex < 0 || endIndex > this._container.children.length) - { - return false; - } - - for (var i = startIndex; i < endIndex; i++) - { - var child = this._container.children[i]; - child.events.onRemovedFromGroup.dispatch(child, this); - this._container.removeChild(child); - - if (this.cursor == child) - { - if (this._container._iNext) - { - this.cursor = this._container._iNext; - } - else - { - this.cursor = null; - } - } - } - - }, - - /** - * Destroys this Group. Removes all children, then removes the container from the display list and nulls references. - * - * @method Phaser.Group#destroy - * @param {boolean} [destroyChildren=false] - Should every child of this Group have its destroy method called? - */ - destroy: function (destroyChildren) { - - if (typeof destroyChildren === 'undefined') { destroyChildren = false; } - - if (destroyChildren) - { - if (this._container.children.length > 0) - { - do - { - if (this._container.children[0].group) - { - this._container.children[0].destroy(); - } - } - while (this._container.children.length > 0); - } + this._cursorIndex = 0; } else { - this.removeAll(); + this._cursorIndex++; } - - this._container.parent.removeChild(this._container); - - this._container = null; - - this.game = null; - - this.exists = false; - - this.cursor = null; - - }, - - validate: function () { - - var testObject = this.game.stage._stage.last._iNext; - var displayObject = this.game.stage._stage; - var nextObject = null; - var prevObject = null; - var count = 0; - - do - { - if (count > 0) - { - // check next - if (displayObject !== nextObject) - { - console.log('check next fail'); - return false; - } - - // check previous - if (displayObject._iPrev !== prevObject) - { - console.log('check previous fail'); - return false; - } - } - - // Set the next object - nextObject = displayObject._iNext; - prevObject = displayObject; - - displayObject = displayObject._iNext; - - count++; - - } - while(displayObject != testObject) - - return true; + this.cursor = this.children[this._cursorIndex]; } -}; +} -Phaser.Group.prototype.constructor = Phaser.Group; +/** +* Moves the Group cursor to the previous object in the Group. If it's at the start of the Group it wraps around to the last object. +* +* @method Phaser.Group#previous +*/ +Phaser.Group.prototype.previous = function () { + + if (this.cursor) + { + // Wrap the cursor? + if (this._cursorIndex === 0) + { + this._cursorIndex = this.children.length - 1; + } + else + { + this._cursorIndex--; + } + + this.cursor = this.children[this._cursorIndex]; + } + +} + +/** +* Swaps the position of two children in this Group. Both children must be in this Group. +* You cannot swap a child with itself, or swap un-parented children, doing so will return false. +* +* @method Phaser.Group#swap +* @param {*} child1 - The first child to swap. +* @param {*} child2 - The second child to swap. +*/ +Phaser.Group.prototype.swap = function (child1, child2) { + + return this.swapChildren(child1, child2); + +} + +/** +* Brings the given child to the top of this Group so it renders above all other children. +* +* @method Phaser.Group#bringToTop +* @param {*} child - The child to bring to the top of this Group. +* @return {*} The child that was moved. +*/ +Phaser.Group.prototype.bringToTop = function (child) { + + if (child.parent === this) + { + this.remove(child); + this.add(child); + } + + return child; + +} + +/** +* Get the index position of the given child in this Group. +* +* @method Phaser.Group#getIndex +* @param {*} child - The child to get the index for. +* @return {number} The index of the child or -1 if it's not a member of this Group. +*/ +Phaser.Group.prototype.getIndex = function (child) { + + return this.children.indexOf(child); + +} + +/** +* Replaces a child of this Group with the given newChild. The newChild cannot be a member of this Group. +* +* @method Phaser.Group#replace +* @param {*} oldChild - The child in this Group that will be replaced. +* @param {*} newChild - The child to be inserted into this group. +*/ +Phaser.Group.prototype.replace = function (oldChild, newChild) { + + var index = this.getIndex(oldChild); + + if (index !== -1) + { + if (newChild.parent !== undefined) + { + newChild.events.onRemovedFromGroup.dispatch(newChild, this); + newChild.parent.removeChild(newChild); + } + + this.removeChild(oldChild); + this.addChildAt(newChild, index); + + newChild.events.onAddedToGroup.dispatch(newChild, this); + + if (this.cursor === oldChild) + { + this.cursor = newChild; + } + } + +} + +/** +* Sets the given property to the given value on the child. The operation controls the assignment of the value. +* +* @method Phaser.Group#setProperty +* @param {*} child - The child to set the property value on. +* @param {array} key - An array of strings that make up the property that will be set. +* @param {*} value - The value that will be set. +* @param {number} [operation=0] - Controls how the value is assigned. A value of 0 replaces the value with the new one. A value of 1 adds it, 2 subtracts it, 3 multiplies it and 4 divides it. +*/ +Phaser.Group.prototype.setProperty = function (child, key, value, operation) { + + operation = operation || 0; + + // As ugly as this approach looks, and although it's limited to a depth of only 4, it's extremely fast. + // Much faster than a for loop or object iteration. There are no checks, so if the key isn't valid then it'll fail + // but as you are likely to call this from inner loops that have to perform well, I'll take that trade off. + + // 0 = Equals + // 1 = Add + // 2 = Subtract + // 3 = Multiply + // 4 = Divide + + var len = key.length; + + if (len == 1) + { + if (operation === 0) { child[key[0]] = value; } + else if (operation == 1) { child[key[0]] += value; } + else if (operation == 2) { child[key[0]] -= value; } + else if (operation == 3) { child[key[0]] *= value; } + else if (operation == 4) { child[key[0]] /= value; } + } + else if (len == 2) + { + if (operation === 0) { child[key[0]][key[1]] = value; } + else if (operation == 1) { child[key[0]][key[1]] += value; } + else if (operation == 2) { child[key[0]][key[1]] -= value; } + else if (operation == 3) { child[key[0]][key[1]] *= value; } + else if (operation == 4) { child[key[0]][key[1]] /= value; } + } + else if (len == 3) + { + if (operation === 0) { child[key[0]][key[1]][key[2]] = value; } + else if (operation == 1) { child[key[0]][key[1]][key[2]] += value; } + else if (operation == 2) { child[key[0]][key[1]][key[2]] -= value; } + else if (operation == 3) { child[key[0]][key[1]][key[2]] *= value; } + else if (operation == 4) { child[key[0]][key[1]][key[2]] /= value; } + } + else if (len == 4) + { + if (operation === 0) { child[key[0]][key[1]][key[2]][key[3]] = value; } + else if (operation == 1) { child[key[0]][key[1]][key[2]][key[3]] += value; } + else if (operation == 2) { child[key[0]][key[1]][key[2]][key[3]] -= value; } + else if (operation == 3) { child[key[0]][key[1]][key[2]][key[3]] *= value; } + else if (operation == 4) { child[key[0]][key[1]][key[2]][key[3]] /= value; } + } + +} + +/** +* This function allows you to quickly set a property on a single child of this Group to a new value. +* The operation parameter controls how the new value is assigned to the property, from simple replacement to addition and multiplication. +* +* @method Phaser.Group#set +* @param {Phaser.Sprite} child - The child to set the property on. +* @param {string} key - The property, as a string, to be set. For example: 'body.velocity.x' +* @param {*} value - The value that will be set. +* @param {boolean} [checkAlive=false] - If set then the child will only be updated if alive=true. +* @param {boolean} [checkVisible=false] - If set then the child will only be updated if visible=true. +* @param {number} [operation=0] - Controls how the value is assigned. A value of 0 replaces the value with the new one. A value of 1 adds it, 2 subtracts it, 3 multiplies it and 4 divides it. +*/ +Phaser.Group.prototype.set = function (child, key, value, checkAlive, checkVisible, operation) { + + key = key.split('.'); + + if (typeof checkAlive === 'undefined') { checkAlive = false; } + if (typeof checkVisible === 'undefined') { checkVisible = false; } + + if ((checkAlive === false || (checkAlive && child.alive)) && (checkVisible === false || (checkVisible && child.visible))) + { + this.setProperty(child, key, value, operation); + } + +} + +/** +* This function allows you to quickly set the same property across all children of this Group to a new value. +* The operation parameter controls how the new value is assigned to the property, from simple replacement to addition and multiplication. +* +* @method Phaser.Group#setAll +* @param {string} key - The property, as a string, to be set. For example: 'body.velocity.x' +* @param {*} value - The value that will be set. +* @param {boolean} [checkAlive=false] - If set then only children with alive=true will be updated. +* @param {boolean} [checkVisible=false] - If set then only children with visible=true will be updated. +* @param {number} [operation=0] - Controls how the value is assigned. A value of 0 replaces the value with the new one. A value of 1 adds it, 2 subtracts it, 3 multiplies it and 4 divides it. +*/ +Phaser.Group.prototype.setAll = function (key, value, checkAlive, checkVisible, operation) { + + key = key.split('.'); + + if (typeof checkAlive === 'undefined') { checkAlive = false; } + if (typeof checkVisible === 'undefined') { checkVisible = false; } + + operation = operation || 0; + + for (var i = 0, len = this.children.length; i < len; i++) + { + if ((!checkAlive || (checkAlive && this.children[i].alive)) && (!checkVisible || (checkVisible && this.children[i].visible))) + { + this.setProperty(this.children[i], key, value, operation); + } + } + +} + +/** +* Adds the amount to the given property on all children in this Group. +* Group.addAll('x', 10) will add 10 to the child.x value. +* +* @method Phaser.Group#addAll +* @param {string} property - The property to increment, for example 'body.velocity.x' or 'angle'. +* @param {number} amount - The amount to increment the property by. If child.x = 10 then addAll('x', 40) would make child.x = 50. +* @param {boolean} checkAlive - If true the property will only be changed if the child is alive. +* @param {boolean} checkVisible - If true the property will only be changed if the child is visible. +*/ +Phaser.Group.prototype.addAll = function (property, amount, checkAlive, checkVisible) { + + this.setAll(property, amount, checkAlive, checkVisible, 1); + +} + +/** +* Subtracts the amount from the given property on all children in this Group. +* Group.subAll('x', 10) will minus 10 from the child.x value. +* +* @method Phaser.Group#subAll +* @param {string} property - The property to decrement, for example 'body.velocity.x' or 'angle'. +* @param {number} amount - The amount to subtract from the property. If child.x = 50 then subAll('x', 40) would make child.x = 10. +* @param {boolean} checkAlive - If true the property will only be changed if the child is alive. +* @param {boolean} checkVisible - If true the property will only be changed if the child is visible. +*/ +Phaser.Group.prototype.subAll = function (property, amount, checkAlive, checkVisible) { + + this.setAll(property, amount, checkAlive, checkVisible, 2); + +} + +/** +* Multiplies the given property by the amount on all children in this Group. +* Group.multiplyAll('x', 2) will x2 the child.x value. +* +* @method Phaser.Group#multiplyAll +* @param {string} property - The property to multiply, for example 'body.velocity.x' or 'angle'. +* @param {number} amount - The amount to multiply the property by. If child.x = 10 then multiplyAll('x', 2) would make child.x = 20. +* @param {boolean} checkAlive - If true the property will only be changed if the child is alive. +* @param {boolean} checkVisible - If true the property will only be changed if the child is visible. +*/ +Phaser.Group.prototype.multiplyAll = function (property, amount, checkAlive, checkVisible) { + + this.setAll(property, amount, checkAlive, checkVisible, 3); + +} + +/** +* Divides the given property by the amount on all children in this Group. +* Group.divideAll('x', 2) will half the child.x value. +* +* @method Phaser.Group#divideAll +* @param {string} property - The property to divide, for example 'body.velocity.x' or 'angle'. +* @param {number} amount - The amount to divide the property by. If child.x = 100 then divideAll('x', 2) would make child.x = 50. +* @param {boolean} checkAlive - If true the property will only be changed if the child is alive. +* @param {boolean} checkVisible - If true the property will only be changed if the child is visible. +*/ +Phaser.Group.prototype.divideAll = function (property, amount, checkAlive, checkVisible) { + + this.setAll(property, amount, checkAlive, checkVisible, 4); + +} + +/** +* Calls a function on all of the children that have exists=true in this Group. +* After the existsValue parameter you can add as many parameters as you like, which will all be passed to the child callback. +* +* @method Phaser.Group#callAllExists +* @param {function} callback - The function that exists on the children that will be called. +* @param {boolean} existsValue - Only children with exists=existsValue will be called. +* @param {...*} parameter - Additional parameters that will be passed to the callback. +*/ +Phaser.Group.prototype.callAllExists = function (callback, existsValue) { + + var args = Array.prototype.splice.call(arguments, 2); + + for (var i = 0, len = this.children.length; i < len; i++) + { + if (this.children[i].exists === existsValue && this.children[i][callback]) + { + this.children[i][callback].apply(this.children[i], args); + } + } + +} + +/** +* Returns a reference to a function that exists on a child of the Group based on the given callback array. +* +* @method Phaser.Group#callbackFromArray +* @param {object} child - The object to inspect. +* @param {array} callback - The array of function names. +* @param {number} length - The size of the array (pre-calculated in callAll). +* @protected +*/ +Phaser.Group.prototype.callbackFromArray = function (child, callback, length) { + + // Kinda looks like a Christmas tree + + if (length == 1) + { + if (child[callback[0]]) + { + return child[callback[0]]; + } + } + else if (length == 2) + { + if (child[callback[0]][callback[1]]) + { + return child[callback[0]][callback[1]]; + } + } + else if (length == 3) + { + if (child[callback[0]][callback[1]][callback[2]]) + { + return child[callback[0]][callback[1]][callback[2]]; + } + } + else if (length == 4) + { + if (child[callback[0]][callback[1]][callback[2]][callback[3]]) + { + return child[callback[0]][callback[1]][callback[2]][callback[3]]; + } + } + else + { + if (child[callback]) + { + return child[callback]; + } + } + + return false; + +} + +/** +* Calls a function on all of the children regardless if they are dead or alive (see callAllExists if you need control over that) +* After the method parameter and context you can add as many extra parameters as you like, which will all be passed to the child. +* +* @method Phaser.Group#callAll +* @param {string} method - A string containing the name of the function that will be called. The function must exist on the child. +* @param {string} [context=null] - A string containing the context under which the method will be executed. Set to null to default to the child. +* @param {...*} parameter - Additional parameters that will be passed to the method. +*/ +Phaser.Group.prototype.callAll = function (method, context) { + + if (typeof method === 'undefined') + { + return; + } + + // Extract the method into an array + method = method.split('.'); + + var methodLength = method.length; + + if (typeof context === 'undefined') + { + context = null; + } + else + { + // Extract the context into an array + if (typeof context === 'string') + { + context = context.split('.'); + var contextLength = context.length; + } + } + + var args = Array.prototype.splice.call(arguments, 2); + var callback = null; + var callbackContext = null; + + for (var i = 0, len = this.children.length; i < len; i++) + { + callback = this.callbackFromArray(this.children[i], method, methodLength); + + if (context && callback) + { + callbackContext = this.callbackFromArray(this.children[i], context, contextLength); + + if (callback) + { + callback.apply(callbackContext, args); + } + } + else if (callback) + { + callback.apply(this.children[i], args); + } + } + +} + +/** +* Allows you to call your own function on each member of this Group. You must pass the callback and context in which it will run. +* After the checkExists parameter you can add as many parameters as you like, which will all be passed to the callback along with the child. +* For example: Group.forEach(awardBonusGold, this, true, 100, 500) +* Note: Currently this will skip any children which are Groups themselves. +* +* @method Phaser.Group#forEach +* @param {function} callback - The function that will be called. Each child of the Group will be passed to it as its first parameter. +* @param {Object} callbackContext - The context in which the function should be called (usually 'this'). +* @param {boolean} checkExists - If set only children with exists=true will be passed to the callback, otherwise all children will be passed. +*/ +Phaser.Group.prototype.forEach = function (callback, callbackContext, checkExists) { + + if (typeof checkExists === 'undefined') + { + checkExists = false; + } + + var args = Array.prototype.splice.call(arguments, 3); + args.unshift(null); + + for (var i = 0, len = this.children.length; i < len; i++) + { + if (!checkExists || (checkExists && this.children[i].exists)) + { + args[0] = this.children[i]; + callback.apply(callbackContext, args); + } + } + +} + +/** +* 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) +* +* @method Phaser.Group#forEachAlive +* @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'). +*/ +Phaser.Group.prototype.forEachExists = function (callback, callbackContext) { + + var args = Array.prototype.splice.call(arguments, 2); + args.unshift(null); + + this.iterate('exists', true, Phaser.Group.RETURN_TOTAL, callback, callbackContext, args); + +} + +/** +* 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) +* +* @method Phaser.Group#forEachAlive +* @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'). +*/ +Phaser.Group.prototype.forEachAlive = function (callback, callbackContext) { + + var args = Array.prototype.splice.call(arguments, 2); + args.unshift(null); + + this.iterate('alive', true, Phaser.Group.RETURN_TOTAL, callback, callbackContext, args); + +} + +/** +* Allows you to call your own function on each dead member of this Group (where alive=false). You must pass the callback and context in which it will run. +* You can add as many parameters as you like, which will all be passed to the callback along with the child. +* For example: Group.forEachDead(bringToLife, this) +* +* @method Phaser.Group#forEachDead +* @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'). +*/ +Phaser.Group.prototype.forEachDead = function (callback, callbackContext) { + + var args = Array.prototype.splice.call(arguments, 2); + args.unshift(null); + + this.iterate('alive', false, Phaser.Group.RETURN_TOTAL, callback, callbackContext, args); + +} + +/** +* Call this function to sort the group according to a particular value and order. +* For example to depth sort Sprites for Zelda-style game you might call `group.sort('y', Phaser.Group.SORT_ASCENDING)` at the bottom of your `State.update()`. +* +* @method Phaser.Group#sort +* @param {string} [index='y'] - The `string` name of the property you want to sort on. +* @param {number} [order=Phaser.Group.SORT_ASCENDING] - The `Group` constant that defines the sort order. Possible values are Phaser.Group.SORT_ASCENDING and Phaser.Group.SORT_DESCENDING. +*/ +Phaser.Group.prototype.sort = function (index, order) { + + if (typeof index === 'undefined') { index = 'y'; } + if (typeof order === 'undefined') { order = Phaser.Group.SORT_ASCENDING; } + + +} + +Phaser.Group.prototype.sortHandler = function (a, b) { + +} + +/** +* Iterates over the children of the Group. When a child has a property matching key that equals the given value, it is considered as a match. +* Matched children can be sent to the optional callback, or simply returned or counted. +* You can add as many callback parameters as you like, which will all be passed to the callback along with the child, after the callbackContext parameter. +* +* @method Phaser.Group#iterate +* @param {string} key - The child property to check, i.e. 'exists', 'alive', 'health' +* @param {any} value - If child.key === this value it will be considered a match. Note that a strict comparison is used. +* @param {number} returnType - How to return the data from this method. Either Phaser.Group.RETURN_NONE, Phaser.Group.RETURN_TOTAL or Phaser.Group.RETURN_CHILD. +* @param {function} [callback=null] - Optional function that will be called on each matching child. Each child of the Group will be passed to it as its first parameter. +* @param {Object} [callbackContext] - The context in which the function should be called (usually 'this'). +* @return {any} Returns either a numeric total (if RETURN_TOTAL was specified) or the child object. +*/ +Phaser.Group.prototype.iterate = function (key, value, returnType, callback, callbackContext, args) { + + if (returnType === Phaser.Group.RETURN_TOTAL && this.children.length === 0) + { + return 0; + } + + if (typeof callback === 'undefined') + { + callback = false; + } + + var total = 0; + + for (var i = 0, len = this.children.length; i < len; i++) + { + if (this.children[i][key] === value) + { + total++; + + if (callback) + { + args[0] = this.children[i]; + callback.apply(callbackContext, args); + } + + if (returnType === Phaser.Group.RETURN_CHILD) + { + return this.children[i]; + } + } + } + + if (returnType === Phaser.Group.RETURN_TOTAL) + { + return total; + } + else if (returnType === Phaser.Group.RETURN_CHILD) + { + return null; + } + +} + +/** +* Call this function to retrieve the first object with exists == (the given state) in the Group. +* +* @method Phaser.Group#getFirstExists +* @param {boolean} state - True or false. +* @return {Any} The first child, or null if none found. +*/ +Phaser.Group.prototype.getFirstExists = function (state) { + + if (typeof state !== 'boolean') + { + state = true; + } + + return this.iterate('exists', state, Phaser.Group.RETURN_CHILD); + +} + +/** +* Call this function to retrieve the first object with alive === true in the group. +* This is handy for checking if everything has been wiped out, or choosing a squad leader, etc. +* +* @method Phaser.Group#getFirstAlive +* @return {Any} The first alive child, or null if none found. +*/ +Phaser.Group.prototype.getFirstAlive = function () { + + return this.iterate('alive', true, Phaser.Group.RETURN_CHILD); + +} + +/** +* Call this function to retrieve the first object with alive === false in the group. +* This is handy for checking if everything has been wiped out, or choosing a squad leader, etc. +* +* @method Phaser.Group#getFirstDead +* @return {Any} The first dead child, or null if none found. +*/ +Phaser.Group.prototype.getFirstDead = function () { + + return this.iterate('alive', false, Phaser.Group.RETURN_CHILD); + +} + +/** +* Call this function to find out how many members of the group are alive. +* +* @method Phaser.Group#countLiving +* @return {number} The number of children flagged as alive. +*/ +Phaser.Group.prototype.countLiving = function () { + + return this.iterate('alive', true, Phaser.Group.RETURN_TOTAL); + +} + +/** +* Call this function to find out how many members of the group are dead. +* +* @method Phaser.Group#countDead +* @return {number} The number of children flagged as dead. +*/ +Phaser.Group.prototype.countDead = function () { + + return this.iterate('alive', false, Phaser.Group.RETURN_TOTAL); + +} + +/** +* Returns a member at random from the group. +* +* @method Phaser.Group#getRandom +* @param {number} startIndex - Optional offset off the front of the array. Default value is 0, or the beginning of the array. +* @param {number} length - Optional restriction on the number of values you want to randomly select from. +* @return {Any} A random child of this Group. +*/ +Phaser.Group.prototype.getRandom = function (startIndex, length) { + + if (this.children.length === 0) + { + return null; + } + + startIndex = startIndex || 0; + length = length || this.children.length; + + return this.game.math.getRandom(this.children, startIndex, length); + +} + +/** +* Removes the given child from this Group and sets its group property to null. +* +* @method Phaser.Group#remove +* @param {Any} child - The child to remove. +* @return {boolean} true if the child was removed from this Group, otherwise false. +*/ +Phaser.Group.prototype.remove = function (child) { + + if (this.children.length === 0) + { + return; + } + + if (child.events) + { + child.events.onRemovedFromGroup.dispatch(child, this); + } + + this.removeChild(child); + + if (this.cursor === child) + { + this.next(); + } + + return true; + +} + +/** +* Removes all children from this Group, setting all group properties to null. +* The Group container remains on the display list. +* +* @method Phaser.Group#removeAll +*/ +Phaser.Group.prototype.removeAll = function () { + + if (this.children.length === 0) + { + return; + } + + do + { + if (this.children[0].events) + { + this.children[0].events.onRemovedFromGroup.dispatch(this.children[0], this); + } + + this.removeChild(this.children[0]); + } + while (this.children.length > 0); + + this.cursor = null; + +} + +/** +* Removes all children from this Group whos index falls beteen the given startIndex and endIndex values. +* +* @method Phaser.Group#removeBetween +* @param {number} startIndex - The index to start removing children from. +* @param {number} endIndex - The index to stop removing children from. Must be higher than startIndex and less than the length of the Group. +*/ +Phaser.Group.prototype.removeBetween = function (startIndex, endIndex) { + + if (this.children.length === 0) + { + return; + } + + if (startIndex > endIndex || startIndex < 0 || endIndex > this.children.length) + { + return false; + } + + for (var i = startIndex; i < endIndex; i++) + { + if (this.children[i].events) + { + this.children[i].events.onRemovedFromGroup.dispatch(this.children[i], this); + } + + this.removeChild(this.children[i]); + + if (this.cursor === child) + { + this.cursor = null; + } + } + +} + +/** +* Destroys this Group. Removes all children, then removes the container from the display list and nulls references. +* +* @method Phaser.Group#destroy +* @param {boolean} [destroyChildren=false] - Should every child of this Group have its destroy method called? +*/ +Phaser.Group.prototype.destroy = function (destroyChildren) { + + if (typeof destroyChildren === 'undefined') { destroyChildren = false; } + + if (destroyChildren) + { + if (this.children.length > 0) + { + do + { + if (this.children[0].group) + { + this.children[0].destroy(); + } + } + while (this.children.length > 0); + } + } + else + { + this.removeAll(); + } + + this.parent.removeChild(this); + + this.game = null; + + this.exists = false; + + this.cursor = null; + +} /** * @name Phaser.Group#total @@ -1884,14 +1550,7 @@ Object.defineProperty(Phaser.Group.prototype, "total", { get: function () { - if (this._container) - { - return this.iterate('exists', true, Phaser.Group.RETURN_TOTAL); - } - else - { - return 0; - } + return this.iterate('exists', true, Phaser.Group.RETURN_TOTAL); } @@ -1906,55 +1565,12 @@ Object.defineProperty(Phaser.Group.prototype, "length", { get: function () { - if (this._container) - { - return this._container.children.length; - } - else - { - return 0; - } + return this.children.length; } }); -/** -* The x coordinate of the Group container. You can adjust the Group container itself by modifying its coordinates. -* This will have no impact on the x/y coordinates of its children, but it will update their worldTransform and on-screen position. -* @name Phaser.Group#x -* @property {number} x - The x coordinate of the Group container. -*/ -Object.defineProperty(Phaser.Group.prototype, "x", { - - get: function () { - return this._container.position.x; - }, - - set: function (value) { - this._container.position.x = value; - } - -}); - -/** -* The y coordinate of the Group container. You can adjust the Group container itself by modifying its coordinates. -* This will have no impact on the x/y coordinates of its children, but it will update their worldTransform and on-screen position. -* @name Phaser.Group#y -* @property {number} y - The y coordinate of the Group container. -*/ -Object.defineProperty(Phaser.Group.prototype, "y", { - - get: function () { - return this._container.position.y; - }, - - set: function (value) { - this._container.position.y = value; - } - -}); - /** * The angle of rotation of the Group container. This will adjust the Group container itself by modifying its rotation. * This will have no impact on the rotation value of its children, but it will update their worldTransform and on-screen position. @@ -1964,64 +1580,47 @@ Object.defineProperty(Phaser.Group.prototype, "y", { Object.defineProperty(Phaser.Group.prototype, "angle", { get: function() { - return Phaser.Math.radToDeg(this._container.rotation); + return Phaser.Math.radToDeg(this.rotation); }, set: function(value) { - this._container.rotation = Phaser.Math.degToRad(value); + this.rotation = Phaser.Math.degToRad(value); } }); +// Documentation stubs + +/** +* The x coordinate of the Group container. You can adjust the Group container itself by modifying its coordinates. +* This will have no impact on the x/y coordinates of its children, but it will update their worldTransform and on-screen position. +* @name Phaser.Group#x +* @property {number} x - The x coordinate of the Group container. +*/ + +/** +* The y coordinate of the Group container. You can adjust the Group container itself by modifying its coordinates. +* This will have no impact on the x/y coordinates of its children, but it will update their worldTransform and on-screen position. +* @name Phaser.Group#y +* @property {number} y - The y coordinate of the Group container. +*/ + /** * The angle of rotation of the Group container. This will adjust the Group container itself by modifying its rotation. * This will have no impact on the rotation value of its children, but it will update their worldTransform and on-screen position. * @name Phaser.Group#rotation * @property {number} rotation - The angle of rotation given in radians. */ -Object.defineProperty(Phaser.Group.prototype, "rotation", { - - get: function () { - return this._container.rotation; - }, - - set: function (value) { - this._container.rotation = value; - } - -}); /** * @name Phaser.Group#visible * @property {boolean} visible - The visible state of the Group. Non-visible Groups and all of their children are not rendered. */ -Object.defineProperty(Phaser.Group.prototype, "visible", { - - get: function () { - return this._container.visible; - }, - - set: function (value) { - this._container.visible = value; - } - -}); /** * @name Phaser.Group#alpha * @property {number} alpha - The alpha value of the Group container. */ -Object.defineProperty(Phaser.Group.prototype, "alpha", { - - get: function () { - return this._container.alpha; - }, - - set: function (value) { - this._container.alpha = value; - } - -}); @@ -2043,7 +1642,7 @@ Object.defineProperty(Phaser.Group.prototype, "alpha", { Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Image.js.html b/docs/Image.js.html new file mode 100644 index 00000000..30345ec0 --- /dev/null +++ b/docs/Image.js.html @@ -0,0 +1,1144 @@ + + + + + + Phaser Source: gameobjects/Image.js + + + + + + + + + + +
    + + +
    + + +
    + +
    + + + +

    Source: gameobjects/Image.js

    + +
    +
    +
    /**
    +* @author       Richard Davey <rich@photonstorm.com>
    +* @copyright    2014 Photon Storm Ltd.
    +* @license      {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
    +*/
    +
    +/**
    +* @class Phaser.Image
    +*
    +* @classdesc 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.
    +*
    +* @constructor
    +* @param {Phaser.Game} game - A reference to the currently running game.
    +* @param {number} x - The x coordinate of the Imaget. The coordinate is relative to any parent container this Image may be in.
    +* @param {number} y - The y coordinate of the Image. The coordinate is relative to any parent container this Image may be in.
    +* @param {string|Phaser.RenderTexture|Phaser.BitmapData|PIXI.Texture} key - The texture used by the Image during rendering. It can be a string which is a reference to the Cache entry, or an instance of a RenderTexture, BitmapData or PIXI.Texture.
    +* @param {string|number} frame - If this Image is using part of a sprite sheet or texture atlas you can specify the exact frame to use by giving a string or numeric index.
    +*/
    +Phaser.Image = function (game, x, y, key, frame) {
    +
    +    x = x || 0;
    +    y = y || 0;
    +    key = key || null;
    +    frame = frame || null;
    +    
    +    /**
    +    * @property {Phaser.Game} game - A reference to the currently running Game.
    +    */
    +    this.game = game;
    + 
    +    /**
    +    * @property {boolean} exists - If exists = false then the Sprite isn't updated by the core game loop or physics subsystem at all.
    +    * @default
    +    */
    +    this.exists = true;
    +
    +    /**
    +    * @property {string} name - The user defined name given to this Sprite.
    +    * @default
    +    */
    +    this.name = '';
    +
    +    /**
    +    * @property {number} type - The const type of this object.
    +    * @readonly
    +    */
    +    this.type = Phaser.IMAGE;
    +
    +    /**
    +    * @property {Phaser.Events} events - The Events you can subscribe to that are dispatched when certain things happen on this Sprite or its components.
    +    */
    +    this.events = new Phaser.Events(this);
    +
    +    /**
    +    *  @property {string|Phaser.RenderTexture|Phaser.BitmapData|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, BitmapData or PIXI.Texture.
    +    */
    +    this.key = key;
    +
    +    this._frame = 0;
    +    this._frameName = '';
    +
    +    PIXI.Sprite.call(this, PIXI.TextureCache['__default']);
    +
    +    this.loadTexture(key, frame);
    +
    +    this.position.set(x, y);
    +
    +    /**
    +    * @property {Phaser.Point} world - The world coordinates of this Sprite. This differs from the x/y coordinates which are relative to the Sprites container.
    +    */
    +    this.world = new Phaser.Point(x, y);
    +
    +    /**
    +    * Should this Sprite be automatically culled if out of range of the camera?
    +    * A culled sprite has its renderable property set to 'false'.
    +    * Be advised this is quite an expensive operation, as it has to calculate the bounds of the object every frame, so only enable it if you really need it.
    +    *
    +    * @property {boolean} autoCull - A flag indicating if the Sprite should be automatically camera culled or not.
    +    * @default
    +    */
    +    this.autoCull = false;
    +
    +    /**
    +    * A Sprite that is fixed to the camera uses its x/y coordinates as offsets from the top left of the camera.
    +    * Note that if this Image is a child of a display object that has changed its position then the offset will be calculated from that.
    +    * @property {boolean} fixedToCamera - Fixes this Sprite to the Camera.
    +    * @default
    +    */
    +    this.fixedToCamera = false;
    +
    +    /**
    +    * @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 {array} _cache - A small cache for previous step values. 0 = x, 1 = y, 2 = rotation, 3 = renderID
    +    * @private
    +    */
    +    this._cache = [0, 0, 0, 0];
    +
    +};
    +
    +Phaser.Image.prototype = Object.create(PIXI.Sprite.prototype);
    +Phaser.Image.prototype.constructor = Phaser.Image;
    +
    +/**
    +* Automatically called by World.preUpdate.
    +*
    +* @method Phaser.Image#preUpdate
    +* @memberof Phaser.Image
    +*/
    +Phaser.Image.prototype.preUpdate = function() {
    +
    +    this._cache[0] = this.world.x;
    +    this._cache[1] = this.world.y;
    +    this._cache[2] = this.rotation;
    +
    +    if (!this.exists || !this.parent.exists)
    +    {
    +        this.renderOrderID = -1;
    +        return false;
    +    }
    +
    +    if (this.autoCull)
    +    {
    +        //  Won't get rendered but will still get its transform updated
    +        this.renderable = this.game.world.camera.screenView.intersects(this.getBounds());
    +    }
    +
    +    this.world.setTo(this.game.camera.x + this.worldTransform[2], this.game.camera.y + this.worldTransform[5]);
    +
    +    if (this.visible)
    +    {
    +        this._cache[3] = this.game.world.currentRenderOrderID++;
    +    }
    +
    +    return true;
    +
    +};
    +
    +/**
    +* Internal function called by the World postUpdate cycle.
    +*
    +* @method Phaser.Image#postUpdate
    +* @memberof Phaser.Image
    +*/
    +Phaser.Image.prototype.postUpdate = function() {
    +
    +    if (this.key instanceof Phaser.BitmapData && this.key._dirty)
    +    {
    +        this.key.render();
    +    }
    +
    +    if (this.fixedToCamera)
    +    {
    +        this.position.x = this.game.camera.view.x + this.x;
    +        this.position.y = this.game.camera.view.y + this.y;
    +    }
    +
    +};
    +
    +/**
    +* Changes the Texture the Sprite is using entirely. The old texture is removed and the new one is referenced or fetched from the Cache.
    +* This causes a WebGL texture update, so use sparingly or in low-intensity portions of your game.
    +*
    +* @method Phaser.Image#loadTexture
    +* @memberof Phaser.Image
    +* @param {string|Phaser.RenderTexture|Phaser.BitmapData|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, BitmapData or PIXI.Texture.
    +* @param {string|number} frame - If this Sprite is using part of a sprite sheet or texture atlas you can specify the exact frame to use by giving a string or numeric index.
    +*/
    +Phaser.Image.prototype.loadTexture = function (key, frame) {
    +
    +    frame = frame || 0;
    +
    +    if (key instanceof Phaser.RenderTexture)
    +    {
    +        this.key = key.key;
    +        this.setTexture(key);
    +    }
    +    else if (key instanceof Phaser.BitmapData)
    +    {
    +        this.key = key.key;
    +        this.setTexture(key.texture);
    +    }
    +    else if (key instanceof PIXI.Texture)
    +    {
    +        this.key = key;
    +        this.setTexture(key);
    +    }
    +    else
    +    {
    +        if (key === null || typeof key === 'undefined')
    +        {
    +            this.key = '__default';
    +            this.setTexture(PIXI.TextureCache[this.key]);
    +        }
    +        else if (typeof key === 'string' && !this.game.cache.checkImageKey(key))
    +        {
    +            this.key = '__missing';
    +            this.setTexture(PIXI.TextureCache[this.key]);
    +        }
    +
    +        if (this.game.cache.isSpriteSheet(key))
    +        {
    +            this.key = key;
    +
    +            var frameData = this.game.cache.getFrameData(key);
    +
    +            if (typeof frame === 'string')
    +            {
    +                this._frame = 0;
    +                this._frameName = frame;
    +                this.setTexture(PIXI.TextureCache[frameData.getFrameByName(frame).uuid]);
    +            }
    +            else
    +            {
    +                this._frame = frame;
    +                this._frameName = '';
    +                this.setTexture(PIXI.TextureCache[frameData.getFrame(frame).uuid]);
    +            }
    +        }
    +        else
    +        {
    +            this.key = key;
    +            this.setTexture(PIXI.TextureCache[key]);
    +        }
    +    }
    +
    +};
    +
    +/**
    +* Crop allows you to crop the texture used to display this Image.
    +* Cropping takes place from the top-left of the Image and can be modified in real-time by providing an updated rectangle object.
    +*
    +* @method Phaser.Image#crop
    +* @memberof Phaser.Image
    +* @param {Phaser.Rectangle} rect - The Rectangle to crop the Image to. Pass null or no parameters to clear a previously set crop rectangle.
    +*/
    +Phaser.Image.prototype.crop = function(rect) {
    +
    +    if (typeof rect === 'undefined' || rect === null)
    +    {
    +        //  Clear any crop that may be set
    +        if (this.texture.hasOwnProperty('sourceWidth'))
    +        {
    +            this.texture.setFrame(new Phaser.Rectangle(0, 0, this.texture.sourceWidth, this.texture.sourceHeight));
    +        }
    +    }
    +    else
    +    {
    +        //  Do we need to clone the PIXI.Texture object?
    +        if (this.texture instanceof PIXI.Texture)
    +        {
    +            //  Yup, let's rock it ...
    +            var local = {};
    +
    +            Phaser.Utils.extend(true, local, this.texture);
    +
    +            local.sourceWidth = local.width;
    +            local.sourceHeight = local.height;
    +            local.frame = rect;
    +            local.width = rect.width;
    +            local.height = rect.height;
    +
    +            this.texture = local;
    +
    +            this.texture.updateFrame = true;
    +            PIXI.Texture.frameUpdates.push(this.texture);
    +        }
    +        else
    +        {
    +            this.texture.setFrame(rect);
    +        }
    +    }
    +
    +};
    +
    +/**
    +* Brings a 'dead' Sprite back to life, optionally giving it the health value specified.
    +* A resurrected Sprite has its alive, exists and visible properties all set to true.
    +* It will dispatch the onRevived event, you can listen to Sprite.events.onRevived for the signal.
    +* 
    +* @method Phaser.Image#revive
    +* @memberof Phaser.Image
    +* @return {Phaser.Image} This instance.
    +*/
    +Phaser.Image.prototype.revive = function() {
    +
    +    this.alive = true;
    +    this.exists = true;
    +    this.visible = true;
    +
    +    if (this.events)
    +    {
    +        this.events.onRevived.dispatch(this);
    +    }
    +
    +    return this;
    +
    +};
    +
    +/**
    +* Kills a Sprite. A killed Sprite has its alive, exists and visible properties all set to false.
    +* It will dispatch the onKilled event, you can listen to Sprite.events.onKilled for the signal.
    +* Note that killing a Sprite is a way for you to quickly recycle it in a Sprite pool, it doesn't free it up from memory.
    +* If you don't need this Sprite any more you should call Sprite.destroy instead.
    +* 
    +* @method Phaser.Image#kill
    +* @memberof Phaser.Image
    +* @return {Phaser.Image} This instance.
    +*/
    +Phaser.Image.prototype.kill = function() {
    +
    +    this.alive = false;
    +    this.exists = false;
    +    this.visible = false;
    +
    +    if (this.events)
    +    {
    +        this.events.onKilled.dispatch(this);
    +    }
    +
    +    return this;
    +
    +};
    +
    +/**
    +* Destroys the Sprite. This removes it from its parent group, destroys the input, event and animation handlers if present
    +* and nulls its reference to game, freeing it up for garbage collection.
    +* 
    +* @method Phaser.Image#destroy
    +* @memberof Phaser.Image
    +*/
    +Phaser.Image.prototype.destroy = function() {
    +
    +    if (this.filters)
    +    {
    +        this.filters = null;
    +    }
    +
    +    if (this.parent)
    +    {
    +        this.parent.remove(this);
    +    }
    +
    +    if (this.events)
    +    {
    +        this.events.destroy();
    +    }
    +
    +    if (this.input)
    +    {
    +        this.input.destroy();
    +    }
    +
    +    this.alive = false;
    +    this.exists = false;
    +    this.visible = false;
    +
    +    this.game = null;
    +
    +};
    +
    +/**
    +* Resets the Sprite. This places the Sprite at the given x/y world coordinates and then sets alive, exists, visible and renderable all to true.
    +* 
    +* @method Phaser.Image#reset
    +* @memberof Phaser.Image
    +* @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.
    +* @return {Phaser.Image} This instance.
    +*/
    +Phaser.Image.prototype.reset = function(x, y) {
    +
    +    this.world.setTo(x, y);
    +    this.position.x = x;
    +    this.position.y = y;
    +    this.alive = true;
    +    this.exists = true;
    +    this.visible = true;
    +    this.renderable = true;
    +
    +    return this;
    +    
    +};
    +
    +/**
    +* Brings the Sprite to the top of the display list it is a child of. Sprites that are members of a Phaser.Group are only
    +* bought to the top of that Group, not the entire display list.
    +* 
    +* @method Phaser.Image#bringToTop
    +* @memberof Phaser.Image
    +* @return {Phaser.Image} This instance.
    +*/
    +Phaser.Image.prototype.bringToTop = function(child) {
    +
    +    if (typeof child === 'undefined')
    +    {
    +        if (this.parent)
    +        {
    +            this.parent.bringToTop(this);
    +        }
    +    }
    +    else
    +    {
    +
    +    }
    +
    +    return this;
    +
    +};
    +
    +/**
    +* Indicates the rotation of the Sprite, in degrees, from its original orientation. Values from 0 to 180 represent clockwise rotation; values from 0 to -180 represent counterclockwise rotation.
    +* Values outside this range are added to or subtracted from 360 to obtain a value within the range. For example, the statement player.angle = 450 is the same as player.angle = 90.
    +* If you wish to work in radians instead of degrees use the property Sprite.rotation instead. Working in radians is also a little faster as it doesn't have to convert the angle.
    +* 
    +* @name Phaser.Image#angle
    +* @property {number} angle - The angle of this Image in degrees.
    +*/
    +Object.defineProperty(Phaser.Image.prototype, "angle", {
    +
    +    get: function() {
    +
    +        return Phaser.Math.wrapAngle(Phaser.Math.radToDeg(this.rotation));
    +
    +    },
    +
    +    set: function(value) {
    +
    +        this.rotation = Phaser.Math.degToRad(Phaser.Math.wrapAngle(value));
    +
    +    }
    +
    +});
    +
    +/**
    +* Returns the delta x value. The difference between world.x now and in the previous step.
    +*
    +* @name Phaser.Image#deltaX
    +* @property {number} deltaX - The delta value. Positive if the motion was to the right, negative if to the left.
    +* @readonly
    +*/
    +Object.defineProperty(Phaser.Image.prototype, "deltaX", {
    +
    +    get: function() {
    +
    +        return this.world.x - this._cache[0];
    +
    +    }
    +
    +});
    +
    +/**
    +* Returns the delta y value. The difference between world.y now and in the previous step.
    +*
    +* @name Phaser.Image#deltaY
    +* @property {number} deltaY - The delta value. Positive if the motion was downwards, negative if upwards.
    +* @readonly
    +*/
    +Object.defineProperty(Phaser.Image.prototype, "deltaY", {
    +
    +    get: function() {
    +    
    +        return this.world.y - this._cache[1];
    +
    +    }
    +
    +});
    +
    +/**
    +* Returns the delta z value. The difference between rotation now and in the previous step.
    +*
    +* @name Phaser.Image#deltaZ
    +* @property {number} deltaZ - The delta value.
    +* @readonly
    +*/
    +Object.defineProperty(Phaser.Image.prototype, "deltaZ", {
    +
    +    get: function() {
    +    
    +        return this.rotation - this._cache[2];
    +
    +    }
    +
    +});
    +
    +/**
    +* Checks if the Image bounds are within the game world, otherwise false if fully outside of it.
    +*
    +* @name Phaser.Image#inWorld
    +* @property {boolean} inWorld - True if the Image bounds is within the game world, even if only partially. Otherwise false if fully outside of it.
    +* @readonly
    +*/
    +Object.defineProperty(Phaser.Image.prototype, "inWorld", {
    +
    +    get: function() {
    +
    +        return this.game.world.bounds.intersects(this.getBounds());
    +
    +    }
    +
    +});
    +
    +/**
    +* Checks if the Image bounds are within the game camera, otherwise false if fully outside of it.
    +*
    +* @name Phaser.Image#inCamera
    +* @property {boolean} inCamera - True if the Image bounds is within the game camera, even if only partially. Otherwise false if fully outside of it.
    +* @readonly
    +*/
    +Object.defineProperty(Phaser.Image.prototype, "inCamera", {
    +
    +    get: function() {
    +    
    +        return this.game.world.camera.screenView.intersects(this.getBounds());
    +
    +    }
    +
    +});
    +
    +/**
    +* @name Phaser.Image#frame
    +* @property {number} frame - Gets or sets the current frame index and updates the Texture for display.
    +*/
    +Object.defineProperty(Phaser.Image.prototype, "frame", {
    +
    +    get: function() {
    +    
    +        return this._frame;
    +
    +    },
    +
    +    set: function(value) {
    +
    +        if (value !== this.frame && this.game.cache.isSpriteSheet(this.key))
    +        {
    +            var frameData = this.game.cache.getFrameData(this.key);
    +
    +            if (frameData && value < frameData.total && frameData.getFrame(value))
    +            {
    +                this.setTexture(PIXI.TextureCache[frameData.getFrame(value).uuid]);
    +                this._frame = value;
    +            }
    +        }
    +
    +    }
    +
    +});
    +
    +/**
    +* @name Phaser.Image#frameName
    +* @property {string} frameName - Gets or sets the current frame by name and updates the Texture for display.
    +*/
    +Object.defineProperty(Phaser.Image.prototype, "frameName", {
    +
    +    get: function() {
    +    
    +        return this._frameName;
    +
    +    },
    +
    +    set: function(value) {
    +
    +        if (value !== this.frameName && this.game.cache.isSpriteSheet(this.key))
    +        {
    +            var frameData = this.game.cache.getFrameData(this.key);
    +
    +            if (frameData && frameData.getFrameByName(value))
    +            {
    +                this.setTexture(PIXI.TextureCache[frameData.getFrameByName(value).uuid]);
    +                this._frameName = value;
    +            }
    +        }
    +
    +    }
    +
    +});
    +
    +/**
    +* @name Phaser.Image#renderOrderID
    +* @property {number} renderOrderID - The render order ID, reset every frame.
    +* @readonly
    +*/
    +Object.defineProperty(Phaser.Image.prototype, "renderOrderID", {
    +
    +    get: function() {
    +
    +        return this._cache[3];
    +
    +    }
    +
    +});
    +
    +/**
    +* By default an Image 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.Image#inputEnabled
    +* @property {boolean} inputEnabled - Set to true to allow this object to receive input events.
    +*/
    +Object.defineProperty(Phaser.Image.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();
    +            }
    +        }
    +    }
    +
    +});
    +
    +
    +
    + + + + + +
    + +
    +
    + + + + Phaser Copyright © 2012-2014 Photon Storm Ltd. + +
    + + + Documentation generated by JSDoc 3.3.0-dev + on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. + +
    +
    + + +
    +
    + +
    + + + + + + + + + + + + + + + + + + + + diff --git a/docs/Input.js.html b/docs/Input.js.html index 962827b9..1efb8a8c 100644 --- a/docs/Input.js.html +++ b/docs/Input.js.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -457,6 +491,257 @@ Phaser.Input = function (game) { * @property {object} moveCallbackContext - The context in which the moveCallback will be sent. Defaults to Phaser.Input but can be set to any valid JS object. */ this.moveCallbackContext = this; + + /** + * @property {number} pollRate - How often should the input pointers be checked for updates? A value of 0 means every single frame (60fps); a value of 1 means every other frame (30fps) and so on. + * @default + */ + this.pollRate = 0; + + /** + * @property {number} _pollCounter - Internal var holding the current poll counter. + * @private + */ + this._pollCounter = 0; + + /** + * @property {Phaser.Point} _oldPosition - A point object representing the previous position of the Pointer. + * @private + */ + this._oldPosition = null; + + /** + * @property {number} _x - x coordinate of the most recent Pointer event + * @private + */ + this._x = 0; + + /** + * @property {number} _y - Y coordinate of the most recent Pointer event + * @private + */ + this._y = 0; + + /** + * You can disable all Input by setting Input.disabled = true. While set all new input related events will be ignored. + * If you need to disable just one type of input; for example mouse; use Input.mouse.disabled = true instead + * @property {boolean} disabled + * @default + */ + this.disabled = false; + + /** + * @property {number} multiInputOverride - Controls the expected behaviour when using a mouse and touch together on a multi-input device. + * @default + */ + this.multiInputOverride = Phaser.Input.MOUSE_TOUCH_COMBINE; + + /** + * @property {Phaser.Point} position - A point object representing the current position of the Pointer. + * @default + */ + this.position = null; + + /** + * @property {Phaser.Point} speed - A point object representing the speed of the Pointer. Only really useful in single Pointer games; otherwise see the Pointer objects directly. + */ + this.speed = null; + + /** + * A Circle object centered on the x/y screen coordinates of the Input. + * Default size of 44px (Apples recommended "finger tip" size) but can be changed to anything. + * @property {Phaser.Circle} circle + */ + this.circle = null; + + /** + * @property {Phaser.Point} scale - The scale by which all input coordinates are multiplied; calculated by the StageScaleMode. In an un-scaled game the values will be x = 1 and y = 1. + */ + this.scale = null; + + /** + * @property {number} maxPointers - The maximum number of Pointers allowed to be active at any one time. For lots of games it's useful to set this to 1. + * @default + */ + this.maxPointers = 10; + + /** + * @property {number} currentPointers - The current number of active Pointers. + * @default + */ + this.currentPointers = 0; + + /** + * @property {number} tapRate - The number of milliseconds that the Pointer has to be pressed down and then released to be considered a tap or click. + * @default + */ + this.tapRate = 200; + + /** + * @property {number} doubleTapRate - The number of milliseconds between taps of the same Pointer for it to be considered a double tap / click. + * @default + */ + this.doubleTapRate = 300; + + /** + * @property {number} holdRate - The number of milliseconds that the Pointer has to be pressed down for it to fire a onHold event. + * @default + */ + this.holdRate = 2000; + + /** + * @property {number} justPressedRate - The number of milliseconds below which the Pointer is considered justPressed. + * @default + */ + this.justPressedRate = 200; + + /** + * @property {number} justReleasedRate - The number of milliseconds below which the Pointer is considered justReleased . + * @default + */ + this.justReleasedRate = 200; + + /** + * Sets if the Pointer objects should record a history of x/y coordinates they have passed through. + * The history is cleared each time the Pointer is pressed down. + * The history is updated at the rate specified in Input.pollRate + * @property {boolean} recordPointerHistory + * @default + */ + this.recordPointerHistory = false; + + /** + * @property {number} recordRate - The rate in milliseconds at which the Pointer objects should update their tracking history. + * @default + */ + this.recordRate = 100; + + /** + * The total number of entries that can be recorded into the Pointer objects tracking history. + * If the Pointer is tracking one event every 100ms; then a trackLimit of 100 would store the last 10 seconds worth of history. + * @property {number} recordLimit + * @default + */ + this.recordLimit = 100; + + /** + * @property {Phaser.Pointer} pointer1 - A Pointer object. + */ + this.pointer1 = null; + + /** + * @property {Phaser.Pointer} pointer2 - A Pointer object. + */ + this.pointer2 = null; + + /** + * @property {Phaser.Pointer} pointer3 - A Pointer object. + */ + this.pointer3 = null; + + /** + * @property {Phaser.Pointer} pointer4 - A Pointer object. + */ + this.pointer4 = null; + + /** + * @property {Phaser.Pointer} pointer5 - A Pointer object. + */ + this.pointer5 = null; + + /** + * @property {Phaser.Pointer} pointer6 - A Pointer object. + */ + this.pointer6 = null; + + /** + * @property {Phaser.Pointer} pointer7 - A Pointer object. + */ + this.pointer7 = null; + + /** + * @property {Phaser.Pointer} pointer8 - A Pointer object. + */ + this.pointer8 = null; + + /** + * @property {Phaser.Pointer} pointer9 - A Pointer object. + */ + this.pointer9 = null; + + /** + * @property {Phaser.Pointer} pointer10 - A Pointer object. + */ + this.pointer10 = null; + + /** + * The most recently active Pointer object. + * When you've limited max pointers to 1 this will accurately be either the first finger touched or mouse. + * @property {Phaser.Pointer} activePointer + */ + this.activePointer = null; + + /** + * @property {Pointer} mousePointer - The mouse has its own unique Phaser.Pointer object which you can use if making a desktop specific game. + */ + this.mousePointer = null; + + /** + * @property {Phaser.Mouse} mouse - The Mouse Input manager. + */ + this.mouse = null; + + /** + * @property {Phaser.Keyboard} keyboard - The Keyboard Input manager. + */ + this.keyboard = null; + + /** + * @property {Phaser.Touch} touch - the Touch Input manager. + */ + this.touch = null; + + /** + * @property {Phaser.MSPointer} mspointer - The MSPointer Input manager. + */ + this.mspointer = null; + + /** + * @property {Phaser.Gamepad} gamepad - The Gamepad Input manager. + */ + this.gamepad = null; + + /** + * @property {Phaser.Signal} onDown - A Signal that is dispatched each time a pointer is pressed down. + */ + this.onDown = null; + + /** + * @property {Phaser.Signal} onUp - A Signal that is dispatched each time a pointer is released. + */ + this.onUp = null; + + /** + * @property {Phaser.Signal} onTap - A Signal that is dispatched each time a pointer is tapped. + */ + this.onTap = null; + + /** + * @property {Phaser.Signal} onHold - A Signal that is dispatched each time a pointer is held down. + */ + this.onHold = null; + + /** + * A linked list of interactive objects; the InputHandler components (belonging to Sprites) register themselves with this. + * @property {Phaser.LinkedList} interactiveItems + */ + this.interactiveItems = new Phaser.LinkedList(); + + /** + * @property {Phaser.Point} _localPoint - Internal cache var. + * @private + */ + this._localPoint = new Phaser.Point(); }; @@ -480,300 +765,6 @@ Phaser.Input.MOUSE_TOUCH_COMBINE = 2; Phaser.Input.prototype = { - /** - * How often should the input pointers be checked for updates? - * A value of 0 means every single frame (60fps), a value of 1 means every other frame (30fps) and so on. - * @property {number} pollRate - * @default - */ - pollRate: 0, - - /** - * @property {number} _pollCounter - Internal var holding the current poll counter. - * @private - * @default - */ - _pollCounter: 0, - - /** - * @property {Phaser.Point} _oldPosition - A point object representing the previous position of the Pointer. - * @private - * @default - */ - _oldPosition: null, - - /** - * @property {number} _x - x coordinate of the most recent Pointer event - * @private - * @default - */ - _x: 0, - - /** - * @property {number} _y - Y coordinate of the most recent Pointer event - * @private - * @default - */ - _y: 0, - - /** - * You can disable all Input by setting Input.disabled: true. While set all new input related events will be ignored. - * If you need to disable just one type of input, for example mouse, use Input.mouse.disabled: true instead - * @property {boolean} disabled - * @default - */ - disabled: false, - - /** - * Controls the expected behaviour when using a mouse and touch together on a multi-input device. - * @property {Description} multiInputOverride - */ - multiInputOverride: Phaser.Input.MOUSE_TOUCH_COMBINE, - - /** - * @property {Phaser.Point} position - A point object representing the current position of the Pointer. - * @default - */ - position: null, - - /** - * A point object representing the speed of the Pointer. Only really useful in single Pointer games, otherwise see the Pointer objects directly. - * @property {Phaser.Point} speed - */ - speed: null, - - /** - * A Circle object centered on the x/y screen coordinates of the Input. - * Default size of 44px (Apples recommended "finger tip" size) but can be changed to anything. - * @property {Phaser.Circle} circle - */ - circle: null, - - /** - * The scale by which all input coordinates are multiplied, calculated by the StageScaleMode. - * In an un-scaled game the values will be x: 1 and y: 1. - * @property {Phaser.Point} scale - */ - scale: null, - - /** - * The maximum number of Pointers allowed to be active at any one time. - * For lots of games it's useful to set this to 1. - * @property {number} maxPointers - * @default - */ - maxPointers: 10, - - /** - * The current number of active Pointers. - * @property {number} currentPointers - * @default - */ - currentPointers: 0, - - /** - * The number of milliseconds that the Pointer has to be pressed down and then released to be considered a tap or clicke - * @property {number} tapRate - * @default - */ - tapRate: 200, - - /** - * The number of milliseconds between taps of the same Pointer for it to be considered a double tap / click - * @property {number} doubleTapRate - * @default - */ - doubleTapRate: 300, - - /** - * The number of milliseconds that the Pointer has to be pressed down for it to fire a onHold event - * @property {number} holdRate - * @default - */ - holdRate: 2000, - - /** - * The number of milliseconds below which the Pointer is considered justPressed - * @property {number} justPressedRate - * @default - */ - justPressedRate: 200, - - /** - * The number of milliseconds below which the Pointer is considered justReleased - * @property {number} justReleasedRate - * @default - */ - justReleasedRate: 200, - - /** - * Sets if the Pointer objects should record a history of x/y coordinates they have passed through. - * The history is cleared each time the Pointer is pressed down. - * The history is updated at the rate specified in Input.pollRate - * @property {boolean} recordPointerHistory - * @default - */ - recordPointerHistory: false, - - /** - * The rate in milliseconds at which the Pointer objects should update their tracking history - * @property {number} recordRate - * @default - */ - recordRate: 100, - - /** - * The total number of entries that can be recorded into the Pointer objects tracking history. - * If the Pointer is tracking one event every 100ms, then a trackLimit of 100 would store the last 10 seconds worth of history. - * @property {number} recordLimit - * @default - */ - recordLimit: 100, - - /** - * A Pointer object - * @property {Phaser.Pointer} pointer1 - */ - pointer1: null, - - /** - * A Pointer object - * @property {Phaser.Pointer} pointer2 - */ - pointer2: null, - - /** - * A Pointer object - * @property {Phaser.Pointer} pointer3 - */ - pointer3: null, - - /** - * A Pointer object - * @property {Phaser.Pointer} pointer4 - */ - pointer4: null, - - /** - * A Pointer object - * @property {Phaser.Pointer} pointer5 - */ - pointer5: null, - - /** - * A Pointer object - * @property {Phaser.Pointer} pointer6 - */ - pointer6: null, - - /** - * A Pointer object - * @property {Phaser.Pointer} pointer7 - */ - pointer7: null, - - /** - * A Pointer object - * @property {Phaser.Pointer} pointer8 - */ - pointer8: null, - - /** - * A Pointer object - * @property {Phaser.Pointer} pointer9 - */ - pointer9: null, - - /** - * A Pointer object. - * @property {Phaser.Pointer} pointer10 - */ - pointer10: null, - - /** - * The most recently active Pointer object. - * When you've limited max pointers to 1 this will accurately be either the first finger touched or mouse. - * @property {Phaser.Pointer} activePointer - * @default - */ - activePointer: null, - - /** - * The mouse has its own unique Phaser.Pointer object which you can use if making a desktop specific game. - * @property {Pointer} mousePointer - * @default - */ - mousePointer: null, - - /** - * The Mouse Input manager. - * @property {Phaser.Mouse} mouse - The Mouse Input manager. - * @default - */ - mouse: null, - - /** - * The Keyboard Input manager. - * @property {Phaser.Keyboard} keyboard - The Keyboard Input manager. - * @default - */ - keyboard: null, - - /** - * The Touch Input manager. - * @property {Phaser.Touch} touch - the Touch Input manager. - * @default - */ - touch: null, - - /** - * The MSPointer Input manager. - * @property {Phaser.MSPointer} mspointer - The MSPointer Input manager. - * @default - */ - mspointer: null, - - /** - * The Gamepad Input manager. - * @property {Phaser.Gamepad} gamepad - The Gamepad Input manager. - * @default - */ - gamepad: null, - - /** - * A Signal that is dispatched each time a pointer is pressed down. - * @property {Phaser.Signal} onDown - * @default - */ - onDown: null, - - /** - * A Signal that is dispatched each time a pointer is released. - * @property {Phaser.Signal} onUp - * @default - */ - onUp: null, - - /** - * A Signal that is dispatched each time a pointer is tapped. - * @property {Phaser.Signal} onTap - * @default - */ - onTap: null, - - /** - * A Signal that is dispatched each time a pointer is held down. - * @property {Phaser.Signal} onHold - * @default - */ - onHold: null, - - /** - * A linked list of interactive objects, the InputHandler components (belonging to Sprites) register themselves with this. - * @property {Phaser.LinkedList} interactiveItems - */ - interactiveItems: new Phaser.LinkedList(), - /** * Starts the Input Manager running. * @method Phaser.Input#boot @@ -947,7 +938,7 @@ Phaser.Input.prototype = { if (this.game.canvas.style.cursor !== 'none') { - this.game.canvas.style.cursor = 'default'; + this.game.canvas.style.cursor = 'inherit'; } if (hard === true) @@ -1141,6 +1132,81 @@ Phaser.Input.prototype = { return null; + }, + + /** + * This will return the local coordinates of the specified displayObject based on the given Pointer. + * @method Phaser.Input#getLocalPosition + * @param {Phaser.Sprite|Phaser.Image} displayObject - The DisplayObject to get the local coordinates for. + * @param {Phaser.Pointer} pointer - The Pointer to use in the check against the displayObject. + * @return {Phaser.Point} A point containing the coordinates of the Pointer position relative to the DisplayObject. + */ + getLocalPosition: function (displayObject, pointer, output) { + + if (typeof output === 'undefined') { output = new Phaser.Point(); } + + var wt = displayObject.worldTransform; + var id = 1 / (wt.a * wt.d + wt.b * -wt.c); + + return output.setTo( + wt.d * id * pointer.x + -wt.b * id * pointer.y + (wt.ty * wt.b - wt.tx * wt.d) * id, + wt.a * id * pointer.y + -wt.c * id * pointer.x + (-wt.ty * wt.a + wt.tx * wt.c) * id + ); + + }, + + /** + * Tests if the current mouse coordinates hit a sprite + * + * @method hitTest + * @param displayObject {DisplayObject} The displayObject to test for a hit + */ + hitTest: function (displayObject, pointer, localPoint) { + + if (!displayObject.worldVisible) + { + return false; + } + + this.getLocalPosition(displayObject, pointer, this._localPoint); + + localPoint.copyFrom(this._localPoint); + + if (displayObject.hitArea && displayObject.hitArea.contains) + { + if (displayObject.hitArea.contains(this._localPoint.x, this._localPoint.y)) + { + return true; + } + + return false; + } + else if (displayObject instanceof PIXI.Sprite) + { + var width = displayObject.texture.frame.width; + var height = displayObject.texture.frame.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; + } + } + } + + for (var i = 0, len = displayObject.children.length; i < len; i++) + { + if (this.hitTest(displayObject.children[i], pointer, localPoint)) + { + return true; + } + } + + return false; } }; @@ -1280,7 +1346,7 @@ Object.defineProperty(Phaser.Input.prototype, "worldY", { Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/InputHandler.js.html b/docs/InputHandler.js.html index 592d86d6..9e85cf47 100644 --- a/docs/InputHandler.js.html +++ b/docs/InputHandler.js.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -632,7 +666,7 @@ Phaser.InputHandler.prototype = { this.enabled = true; // Create the signals the Input component will emit - if (this.sprite.events && this.sprite.events.onInputOver == null) + if (this.sprite.events && this.sprite.events.onInputOver === null) { this.sprite.events.onInputOver = new Phaser.Signal(); this.sprite.events.onInputOut = new Phaser.Signal(); @@ -909,14 +943,13 @@ Phaser.InputHandler.prototype = { */ checkPointerOver: function (pointer) { - if (this.enabled === false || this.sprite.visible === false || (this.sprite.group && this.sprite.group.visible === false)) + if (this.enabled === false || this.sprite.visible === false || this.sprite.parent.visible === false) { return false; } - this.sprite.getLocalUnmodifiedPosition(this._tempPoint, pointer.x, pointer.y); - - if (this._tempPoint.x >= 0 && this._tempPoint.x <= this.sprite.currentFrame.width && this._tempPoint.y >= 0 && this._tempPoint.y <= this.sprite.currentFrame.height) + // Need to pass it a temp point, in case we need it again for the pixel check + if (this.game.input.hitTest(this.sprite, pointer, this._tempPoint)) { if (this.pixelPerfect) { @@ -928,6 +961,8 @@ Phaser.InputHandler.prototype = { } } + return false; + }, /** @@ -1614,7 +1649,7 @@ Phaser.InputHandler.prototype.constructor = Phaser.InputHandler; Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Key.js.html b/docs/Key.js.html index 49ba93aa..df9a0c26 100644 --- a/docs/Key.js.html +++ b/docs/Key.js.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -609,7 +643,7 @@ Phaser.Key.prototype.constructor = Phaser.Key; Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Keyboard.js.html b/docs/Keyboard.js.html index 4b428a4c..ab68e49c 100644 --- a/docs/Keyboard.js.html +++ b/docs/Keyboard.js.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -933,7 +967,7 @@ Phaser.Keyboard.NUM_LOCK = 144; Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Line.js.html b/docs/Line.js.html index aa41210f..5ffbda4c 100644 --- a/docs/Line.js.html +++ b/docs/Line.js.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -700,7 +734,7 @@ Phaser.Line.intersects = function (a, b, asSegment, result) { Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/LinkedList.js.html b/docs/LinkedList.js.html index dce1bbe0..aecaa08d 100644 --- a/docs/LinkedList.js.html +++ b/docs/LinkedList.js.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -592,7 +626,7 @@ Phaser.LinkedList.prototype.constructor = Phaser.LinkedList; Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Loader.js.html b/docs/Loader.js.html index 6dde3054..b2803dfe 100644 --- a/docs/Loader.js.html +++ b/docs/Loader.js.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -1749,7 +1783,7 @@ Phaser.Loader.prototype.constructor = Phaser.Loader; Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/LoaderParser.js.html b/docs/LoaderParser.js.html index bd280b4c..428cbb5f 100644 --- a/docs/LoaderParser.js.html +++ b/docs/LoaderParser.js.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -518,7 +552,7 @@ Phaser.LoaderParser = { Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/MSPointer.js.html b/docs/MSPointer.js.html index 014729ff..44fa56e6 100644 --- a/docs/MSPointer.js.html +++ b/docs/MSPointer.js.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -606,7 +640,7 @@ Phaser.MSPointer.prototype.constructor = Phaser.MSPointer; Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Math.js.html b/docs/Math.js.html index 166ea58e..4dd11bc1 100644 --- a/docs/Math.js.html +++ b/docs/Math.js.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -1755,7 +1789,7 @@ Phaser.Math = { Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Mouse.js.html b/docs/Mouse.js.html index c1518e11..ab41d38f 100644 --- a/docs/Mouse.js.html +++ b/docs/Mouse.js.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -767,7 +801,7 @@ Phaser.Mouse.prototype.constructor = Phaser.Mouse; Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Net.js.html b/docs/Net.js.html index b9b79823..827ec5b7 100644 --- a/docs/Net.js.html +++ b/docs/Net.js.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -602,7 +636,7 @@ Phaser.Net.prototype.constructor = Phaser.Net; Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Particles.js.html b/docs/Particles.js.html index 89d16184..ccee8cbf 100644 --- a/docs/Particles.js.html +++ b/docs/Particles.js.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -517,7 +551,7 @@ Phaser.Particles.prototype.constructor = Phaser.Particles; Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Animation.html b/docs/Phaser.Animation.html index 3ea9c67e..85dddc8e 100644 --- a/docs/Phaser.Animation.html +++ b/docs/Phaser.Animation.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -2912,7 +2946,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 05 2014 06:28:25 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:41 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.AnimationManager.html b/docs/Phaser.AnimationManager.html index 4609bb4a..6abdf7aa 100644 --- a/docs/Phaser.AnimationManager.html +++ b/docs/Phaser.AnimationManager.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -1985,7 +2019,7 @@ Animations added in this way are played back with the play function.

    -

    getAnimation(name) → {Phaser.Animation|boolean}

    +

    getAnimation(name) → {Phaser.Animation}

    @@ -2100,7 +2134,7 @@ Animations added in this way are played back with the play function.

    -

    The Animation instance, if found, otherwise false.

    +

    The Animation instance, if found, otherwise null.

    @@ -2112,9 +2146,6 @@ Animations added in this way are played back with the play function.

    Phaser.Animation -| - -boolean
    @@ -2962,7 +2993,7 @@ The currentAnim property of the AnimationManager is automatically set to the ani Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:25 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:41 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.AnimationParser.html b/docs/Phaser.AnimationParser.html index ca5b0c11..fbea0e16 100644 --- a/docs/Phaser.AnimationParser.html +++ b/docs/Phaser.AnimationParser.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -840,7 +874,7 @@
    Source:
    @@ -1406,7 +1440,7 @@
    Source:
    @@ -1480,7 +1514,7 @@ Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:25 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:41 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.BitmapData.html b/docs/Phaser.BitmapData.html index b1f396be..b4f4166d 100644 --- a/docs/Phaser.BitmapData.html +++ b/docs/Phaser.BitmapData.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -435,7 +469,7 @@ for multiple Sprites. So if you need to dynamically create a Sprite texture then
    -

    new BitmapData(game, width, height)

    +

    new BitmapData(game, key, width, height)

    @@ -514,6 +548,41 @@ for multiple Sprites. So if you need to dynamically create a Sprite texture then + + + key + + + + + +string + + + + + + + + + + + + + + + + + + + + + +

    Internal Phaser reference key for the render texture.

    + + + + width @@ -543,7 +612,7 @@ for multiple Sprites. So if you need to dynamically create a Sprite texture then - 256 + 100 @@ -582,7 +651,7 @@ for multiple Sprites. So if you need to dynamically create a Sprite texture then - 256 + 100 @@ -619,7 +688,7 @@ for multiple Sprites. So if you need to dynamically create a Sprite texture then
    Source:
    @@ -747,7 +816,7 @@ for multiple Sprites. So if you need to dynamically create a Sprite texture then
    Source:
    @@ -849,7 +918,7 @@ for multiple Sprites. So if you need to dynamically create a Sprite texture then
    Source:
    @@ -951,7 +1020,7 @@ for multiple Sprites. So if you need to dynamically create a Sprite texture then
    Source:
    @@ -1053,7 +1122,7 @@ for multiple Sprites. So if you need to dynamically create a Sprite texture then
    Source:
    @@ -1155,7 +1224,7 @@ for multiple Sprites. So if you need to dynamically create a Sprite texture then
    Source:
    @@ -1257,7 +1326,7 @@ for multiple Sprites. So if you need to dynamically create a Sprite texture then
    Source:
    @@ -1275,7 +1344,7 @@ for multiple Sprites. So if you need to dynamically create a Sprite texture then
    -

    name

    +

    key

    @@ -1314,7 +1383,7 @@ for multiple Sprites. So if you need to dynamically create a Sprite texture then - name + key @@ -1330,7 +1399,7 @@ for multiple Sprites. So if you need to dynamically create a Sprite texture then -

    The name of the BitmapData.

    +

    The key of the BitmapData in the Cache, if stored there.

    @@ -1359,7 +1428,7 @@ for multiple Sprites. So if you need to dynamically create a Sprite texture then
    Source:
    @@ -1461,7 +1530,7 @@ for multiple Sprites. So if you need to dynamically create a Sprite texture then
    Source:
    @@ -1563,7 +1632,7 @@ for multiple Sprites. So if you need to dynamically create a Sprite texture then
    Source:
    @@ -1665,7 +1734,7 @@ for multiple Sprites. So if you need to dynamically create a Sprite texture then
    Source:
    @@ -1767,7 +1836,7 @@ for multiple Sprites. So if you need to dynamically create a Sprite texture then
    Source:
    @@ -1869,7 +1938,7 @@ for multiple Sprites. So if you need to dynamically create a Sprite texture then
    Source:
    @@ -1934,7 +2003,7 @@ for multiple Sprites. So if you need to dynamically create a Sprite texture then
    Source:
    @@ -2052,7 +2121,7 @@ for multiple Sprites. So if you need to dynamically create a Sprite texture then
    Source:
    @@ -2170,7 +2239,7 @@ for multiple Sprites. So if you need to dynamically create a Sprite texture then
    Source:
    @@ -2484,7 +2553,7 @@ going in the given direction by anticlockwise (defaulting to clockwise).

    Source:
    @@ -2717,7 +2786,7 @@ going in the given direction by anticlockwise (defaulting to clockwise).

    Source:
    @@ -2809,7 +2878,7 @@ going in the given direction by anticlockwise (defaulting to clockwise).

    Source:
    @@ -2927,7 +2996,7 @@ going in the given direction by anticlockwise (defaulting to clockwise).

    Source:
    @@ -3185,7 +3254,7 @@ example, the following code defines a black to white vertical gradient ranging f
    Source:
    @@ -3444,7 +3513,7 @@ square to display it:

    Source:
    @@ -3536,7 +3605,7 @@ square to display it:

    Source:
    @@ -3842,7 +3911,7 @@ blue radial gradient centered at (100, 100), with a radius of 50, and draws a re
    Source:
    @@ -3983,7 +4052,7 @@ blue radial gradient centered at (100, 100), with a radius of 50, and draws a re
    Source:
    @@ -4239,7 +4308,7 @@ blue radial gradient centered at (100, 100), with a radius of 50, and draws a re
    Source:
    @@ -4331,7 +4400,7 @@ blue radial gradient centered at (100, 100), with a radius of 50, and draws a re
    Source:
    @@ -4400,7 +4469,7 @@ blue radial gradient centered at (100, 100), with a radius of 50, and draws a re
    Source:
    @@ -4469,7 +4538,7 @@ blue radial gradient centered at (100, 100), with a radius of 50, and draws a re
    Source:
    @@ -4538,7 +4607,7 @@ blue radial gradient centered at (100, 100), with a radius of 50, and draws a re
    Source:
    @@ -4702,7 +4771,7 @@ blue radial gradient centered at (100, 100), with a radius of 50, and draws a re
    Source:
    @@ -4794,7 +4863,7 @@ blue radial gradient centered at (100, 100), with a radius of 50, and draws a re
    Source:
    @@ -4981,7 +5050,7 @@ blue radial gradient centered at (100, 100), with a radius of 50, and draws a re
    Source:
    @@ -5073,7 +5142,7 @@ blue radial gradient centered at (100, 100), with a radius of 50, and draws a re
    Source:
    @@ -5165,7 +5234,7 @@ blue radial gradient centered at (100, 100), with a radius of 50, and draws a re
    Source:
    @@ -5257,7 +5326,7 @@ blue radial gradient centered at (100, 100), with a radius of 50, and draws a re
    Source:
    @@ -5445,7 +5514,7 @@ Once the gradient is created colors can be inserted using the addColorStop metho
    Source:
    @@ -5701,7 +5770,7 @@ Once the gradient is created colors can be inserted using the addColorStop metho
    Source:
    @@ -5793,7 +5862,7 @@ Once the gradient is created colors can be inserted using the addColorStop metho
    Source:
    @@ -5862,7 +5931,7 @@ Once the gradient is created colors can be inserted using the addColorStop metho
    Source:
    @@ -5931,7 +6000,7 @@ Once the gradient is created colors can be inserted using the addColorStop metho
    Source:
    @@ -6000,7 +6069,7 @@ Once the gradient is created colors can be inserted using the addColorStop metho
    Source:
    @@ -6069,7 +6138,7 @@ Once the gradient is created colors can be inserted using the addColorStop metho
    Source:
    @@ -6256,7 +6325,7 @@ Once the gradient is created colors can be inserted using the addColorStop metho
    Source:
    @@ -6348,7 +6417,7 @@ Once the gradient is created colors can be inserted using the addColorStop metho
    Source:
    @@ -6417,7 +6486,7 @@ Once the gradient is created colors can be inserted using the addColorStop metho
    Source:
    @@ -6486,7 +6555,7 @@ Once the gradient is created colors can be inserted using the addColorStop metho
    Source:
    @@ -6696,7 +6765,7 @@ Once the gradient is created colors can be inserted using the addColorStop metho
    Source:
    @@ -6837,7 +6906,7 @@ Once the gradient is created colors can be inserted using the addColorStop metho
    Source:
    @@ -6978,7 +7047,7 @@ Once the gradient is created colors can be inserted using the addColorStop metho
    Source:
    @@ -7142,7 +7211,7 @@ Once the gradient is created colors can be inserted using the addColorStop metho
    Source:
    @@ -7306,7 +7375,7 @@ Once the gradient is created colors can be inserted using the addColorStop metho
    Source:
    @@ -7447,7 +7516,7 @@ Once the gradient is created colors can be inserted using the addColorStop metho
    Source:
    @@ -7588,7 +7657,7 @@ Once the gradient is created colors can be inserted using the addColorStop metho
    Source:
    @@ -7730,7 +7799,7 @@ source-over (default), destination-atop, destination-in, destination-out, destin
    Source:
    @@ -7822,7 +7891,7 @@ source-over (default), destination-atop, destination-in, destination-out, destin
    Source:
    @@ -7940,7 +8009,7 @@ source-over (default), destination-atop, destination-in, destination-out, destin
    Source:
    @@ -8081,7 +8150,7 @@ source-over (default), destination-atop, destination-in, destination-out, destin
    Source:
    @@ -8222,7 +8291,7 @@ source-over (default), destination-atop, destination-in, destination-out, destin
    Source:
    @@ -8386,7 +8455,7 @@ source-over (default), destination-atop, destination-in, destination-out, destin
    Source:
    @@ -8527,7 +8596,7 @@ source-over (default), destination-atop, destination-in, destination-out, destin
    Source:
    @@ -8619,7 +8688,7 @@ source-over (default), destination-atop, destination-in, destination-out, destin
    Source:
    @@ -8737,7 +8806,7 @@ source-over (default), destination-atop, destination-in, destination-out, destin
    Source:
    @@ -8901,7 +8970,7 @@ source-over (default), destination-atop, destination-in, destination-out, destin
    Source:
    @@ -8993,7 +9062,7 @@ source-over (default), destination-atop, destination-in, destination-out, destin
    Source:
    @@ -9062,7 +9131,7 @@ source-over (default), destination-atop, destination-in, destination-out, destin
    Source:
    @@ -9131,7 +9200,7 @@ source-over (default), destination-atop, destination-in, destination-out, destin
    Source:
    @@ -9318,7 +9387,7 @@ source-over (default), destination-atop, destination-in, destination-out, destin
    Source:
    @@ -9410,7 +9479,7 @@ source-over (default), destination-atop, destination-in, destination-out, destin
    Source:
    @@ -9479,7 +9548,7 @@ source-over (default), destination-atop, destination-in, destination-out, destin
    Source:
    @@ -9666,7 +9735,7 @@ source-over (default), destination-atop, destination-in, destination-out, destin
    Source:
    @@ -9759,7 +9828,7 @@ This is called automatically if the BitmapData is being used by a Sprite, otherw
    Source:
    @@ -9828,7 +9897,7 @@ This is called automatically if the BitmapData is being used by a Sprite, otherw
    Source:
    @@ -9920,7 +9989,7 @@ This is called automatically if the BitmapData is being used by a Sprite, otherw
    Source:
    @@ -10038,7 +10107,7 @@ This is called automatically if the BitmapData is being used by a Sprite, otherw
    Source:
    @@ -10130,7 +10199,7 @@ This is called automatically if the BitmapData is being used by a Sprite, otherw
    Source:
    @@ -10199,7 +10268,7 @@ This is called automatically if the BitmapData is being used by a Sprite, otherw
    Source:
    @@ -10268,7 +10337,7 @@ This is called automatically if the BitmapData is being used by a Sprite, otherw
    Source:
    @@ -10337,7 +10406,7 @@ This is called automatically if the BitmapData is being used by a Sprite, otherw
    Source:
    @@ -10501,7 +10570,7 @@ This is called automatically if the BitmapData is being used by a Sprite, otherw
    Source:
    @@ -10589,7 +10658,7 @@ This is called automatically if the BitmapData is being used by a Sprite, otherw
    Source:
    @@ -10822,7 +10891,7 @@ This is called automatically if the BitmapData is being used by a Sprite, otherw
    Source:
    @@ -11055,7 +11124,7 @@ This is called automatically if the BitmapData is being used by a Sprite, otherw
    Source:
    @@ -11353,7 +11422,7 @@ the stroke style and color in a single line of code like so:

    Source:
    @@ -11445,7 +11514,7 @@ the stroke style and color in a single line of code like so:

    Source:
    @@ -11514,7 +11583,7 @@ the stroke style and color in a single line of code like so:

    Source:
    @@ -11724,7 +11793,7 @@ the stroke style and color in a single line of code like so:

    Source:
    @@ -11865,7 +11934,7 @@ the stroke style and color in a single line of code like so:

    Source:
    @@ -11939,7 +12008,7 @@ the stroke style and color in a single line of code like so:

    Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:25 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:41 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.BitmapText.html b/docs/Phaser.BitmapText.html index 46ef4655..039748e8 100644 --- a/docs/Phaser.BitmapText.html +++ b/docs/Phaser.BitmapText.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -1907,7 +1941,7 @@ If you wish to work in radians instead of degrees use the property Sprite.rotati Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:25 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:42 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Button.html b/docs/Phaser.Button.html index ac34735f..2dfbb336 100644 --- a/docs/Phaser.Button.html +++ b/docs/Phaser.Button.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -890,7 +924,7 @@
    Source:
    @@ -919,6 +953,12 @@ +

    Extends

    + + + @@ -933,6 +973,895 @@
    +
    +

    angle

    + + +
    +
    + +
    +

    Indicates the rotation of the Button in degrees, from its original orientation. Values from 0 to 180 represent clockwise rotation; values from 0 to -180 represent counterclockwise rotation. +Values outside this range are added to or subtracted from 360 to obtain a value within the range. For example, the statement player.angle = 450 is the same as player.angle = 90. +If you wish to work in radians instead of degrees use the rotation property instead. Working in radians is also a little faster as it doesn't have to convert the angle.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    angle + + +number + + + +

    The angle of this Button in degrees.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    autoCull

    + + +
    +
    + +
    +

    Should this Sprite be automatically culled if out of range of the camera? +A culled sprite has its renderable property set to 'false'. +Be advised this is quite an expensive operation, as it has to calculate the bounds of the object every frame, so only enable it if you really need it.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    autoCull + + +boolean + + + +

    A flag indicating if the Sprite should be automatically camera culled or not.

    +
    + + + + + + + + +
    Inherited From:
    +
    + + + + + + + + + + + +
    Default Value:
    +
    • false
    + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    <readonly> deltaX

    + + +
    +
    + +
    +

    Returns the delta x value. The difference between world.x now and in the previous step.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    deltaX + + +number + + + +

    The delta value. Positive if the motion was to the right, negative if to the left.

    +
    + + + + + + + + +
    Inherited From:
    +
    + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    <readonly> deltaY

    + + +
    +
    + +
    +

    Returns the delta y value. The difference between world.y now and in the previous step.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    deltaY + + +number + + + +

    The delta value. Positive if the motion was downwards, negative if upwards.

    +
    + + + + + + + + +
    Inherited From:
    +
    + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    <readonly> deltaZ

    + + +
    +
    + +
    +

    Returns the delta z value. The difference between rotation now and in the previous step.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    deltaZ + + +number + + + +

    The delta value.

    +
    + + + + + + + + +
    Inherited From:
    +
    + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    events

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    events + + +Phaser.Events + + + +

    The Events you can subscribe to that are dispatched when certain things happen on this Sprite or its components.

    +
    + + + + + + + + +
    Inherited From:
    +
    + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    exists

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    exists + + +boolean + + + +

    If exists = false then the Sprite isn't updated by the core game loop or physics subsystem at all.

    +
    + + + + + + + + +
    Inherited From:
    +
    + + + + + + + + + + + +
    Default Value:
    +
    • true
    + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    fixedToCamera

    + + +
    +
    + +
    +

    A Sprite that is fixed to the camera uses its x/y coordinates as offsets from the top left of the camera. +Note that if this Image is a child of a display object that has changed its position then the offset will be calculated from that.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    fixedToCamera + + +boolean + + + +

    Fixes this Sprite to the Camera.

    +
    + + + + + + + + +
    Inherited From:
    +
    + + + + + + + + + + + +
    Default Value:
    +
    • false
    + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + +

    forceOut

    @@ -1025,7 +1954,221 @@
    Source:
    + + + + + + + +
    + + + + + + + +
    +

    frame

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    frame + + +number + + + +

    Gets or sets the current frame index and updates the Texture for display.

    +
    + + + + + + + + +
    Inherited From:
    +
    + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    frameName

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    frameName + + +string + + + +

    Gets or sets the current frame by name and updates the Texture for display.

    +
    + + + + + + + + +
    Inherited From:
    +
    + + + + + + + + + + + + + +
    Source:
    +
    @@ -1127,7 +2270,781 @@
    Source:
    + + + + + + + +
    + + + +
    + + + +
    +

    game

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    game + + +Phaser.Game + + + +

    A reference to the currently running Game.

    +
    + + + + + + + + +
    Inherited From:
    +
    + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    <readonly> inCamera

    + + +
    +
    + +
    +

    Checks if the Image bounds are within the game camera, otherwise false if fully outside of it.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    inCamera + + +boolean + + + +

    True if the Image bounds is within the game camera, even if only partially. Otherwise false if fully outside of it.

    +
    + + + + + + + + +
    Inherited From:
    +
    + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    input

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    input + + +Phaser.InputHandler +| + +null + + + +

    The Input Handler for this object. Needs to be enabled with image.inputEnabled = true before you can use it.

    +
    + + + + + + + + +
    Inherited From:
    +
    + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    inputEnabled

    + + +
    +
    + +
    +

    By default an Image 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.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    inputEnabled + + +boolean + + + +

    Set to true to allow this object to receive input events.

    +
    + + + + + + + + +
    Inherited From:
    +
    + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    <readonly> inWorld

    + + +
    +
    + +
    +

    Checks if the Image bounds are within the game world, otherwise false if fully outside of it.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    inWorld + + +boolean + + + +

    True if the Image bounds is within the game world, even if only partially. Otherwise false if fully outside of it.

    +
    + + + + + + + + +
    Inherited From:
    +
    + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    key

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    key + + +string +| + +Phaser.RenderTexture +| + +Phaser.BitmapData +| + +PIXI.Texture + + + +

    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, BitmapData or PIXI.Texture.

    +
    + + + + + + + + +
    Inherited From:
    +
    + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    name

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    name + + +string + + + +

    The user defined name given to this Sprite.

    +
    + + + + + + + + +
    Inherited From:
    +
    + + + + + + + + + + + + + +
    Source:
    +
    @@ -1232,7 +3149,7 @@
    Source:
    @@ -1334,7 +3251,7 @@
    Source:
    @@ -1436,7 +3353,7 @@
    Source:
    @@ -1538,7 +3455,7 @@
    Source:
    @@ -1640,7 +3557,7 @@
    Source:
    @@ -1742,7 +3659,7 @@
    Source:
    @@ -1847,7 +3764,7 @@
    Source:
    @@ -1949,7 +3866,7 @@
    Source:
    @@ -2054,7 +3971,7 @@
    Source:
    @@ -2156,7 +4073,7 @@
    Source:
    @@ -2261,7 +4178,7 @@
    Source:
    @@ -2363,7 +4280,114 @@
    Source:
    + + + + + + + +
    + + + +
    + + + +
    +

    <readonly> renderOrderID

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    renderOrderID + + +number + + + +

    The render order ID, reset every frame.

    +
    + + + + + + + + +
    Inherited From:
    +
    + + + + + + + + + + + + + +
    Source:
    +
    @@ -2465,7 +4489,114 @@
    Source:
    + + + + + + + +
    + + + +
    + + + +
    +

    world

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    world + + +Phaser.Point + + + +

    The world coordinates of this Sprite. This differs from the x/y coordinates which are relative to the Sprites container.

    +
    + + + + + + + + +
    Inherited From:
    +
    + + + + + + + + + + + + + +
    Source:
    +
    @@ -2488,6 +4619,104 @@
    +
    +

    bringToTop() → {Phaser.Image}

    + + +
    +
    + + +
    +

    Brings the Sprite to the top of the display list it is a child of. Sprites that are members of a Phaser.Group are only +bought to the top of that Group, not the entire display list.

    +
    + + + + + + + + + +
    + + + + + + + +
    Inherited From:
    +
    + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    This instance.

    +
    + + + +
    +
    + Type +
    +
    + +Phaser.Image + + +
    +
    + + + + + +
    + + +

    clearFrames()

    @@ -2530,7 +4759,465 @@
    Source:
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    crop(rect)

    + + +
    +
    + + +
    +

    Crop allows you to crop the texture used to display this Image. +Cropping takes place from the top-left of the Image and can be modified in real-time by providing an updated rectangle object.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    rect + + +Phaser.Rectangle + + + +

    The Rectangle to crop the Image to. Pass null or no parameters to clear a previously set crop rectangle.

    + + + + +
    + + + + + + + +
    Inherited From:
    +
    + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    destroy()

    + + +
    +
    + + +
    +

    Destroys the Sprite. This removes it from its parent group, destroys the input, event and animation handlers if present +and nulls its reference to game, freeing it up for garbage collection.

    +
    + + + + + + + + + +
    + + + + + + + +
    Inherited From:
    +
    + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    kill() → {Phaser.Image}

    + + +
    +
    + + +
    +

    Kills a Sprite. A killed Sprite has its alive, exists and visible properties all set to false. +It will dispatch the onKilled event, you can listen to Sprite.events.onKilled for the signal. +Note that killing a Sprite is a way for you to quickly recycle it in a Sprite pool, it doesn't free it up from memory. +If you don't need this Sprite any more you should call Sprite.destroy instead.

    +
    + + + + + + + + + +
    + + + + + + + +
    Inherited From:
    +
    + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    This instance.

    +
    + + + +
    +
    + Type +
    +
    + +Phaser.Image + + +
    +
    + + + + + +
    + + + +
    +

    loadTexture(key, frame)

    + + +
    +
    + + +
    +

    Changes the Texture the Sprite is using entirely. The old texture is removed and the new one is referenced or fetched from the Cache. +This causes a WebGL texture update, so use sparingly or in low-intensity portions of your game.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    key + + +string +| + +Phaser.RenderTexture +| + +Phaser.BitmapData +| + +PIXI.Texture + + + +

    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, BitmapData or PIXI.Texture.

    frame + + +string +| + +number + + + +

    If this Sprite is using part of a sprite sheet or texture atlas you can specify the exact frame to use by giving a string or numeric index.

    + + + + +
    + + + + + + + +
    Inherited From:
    +
    + + + + + + + + + + + + + +
    Source:
    +
    @@ -2671,7 +5358,7 @@
    Source:
    @@ -2812,7 +5499,7 @@
    Source:
    @@ -2953,7 +5640,7 @@
    Source:
    @@ -3094,7 +5781,7 @@
    Source:
    @@ -3117,6 +5804,422 @@ +
    + + + +
    +

    postUpdate()

    + + +
    +
    + + +
    +

    Internal function called by the World postUpdate cycle.

    +
    + + + + + + + + + +
    + + + + + + + +
    Inherited From:
    +
    + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    preUpdate()

    + + +
    +
    + + +
    +

    Automatically called by World.preUpdate.

    +
    + + + + + + + + + +
    + + + + + + + +
    Inherited From:
    +
    + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    reset(x, y) → {Phaser.Image}

    + + +
    +
    + + +
    +

    Resets the Sprite. This places the Sprite at the given x/y world coordinates and then sets alive, exists, visible and renderable all to true.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    x + + +number + + + +

    The x coordinate (in world space) to position the Sprite at.

    y + + +number + + + +

    The y coordinate (in world space) to position the Sprite at.

    + + + + +
    + + + + + + + +
    Inherited From:
    +
    + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    This instance.

    +
    + + + +
    +
    + Type +
    +
    + +Phaser.Image + + +
    +
    + + + + + +
    + + + +
    +

    revive() → {Phaser.Image}

    + + +
    +
    + + +
    +

    Brings a 'dead' Sprite back to life, optionally giving it the health value specified. +A resurrected Sprite has its alive, exists and visible properties all set to true. +It will dispatch the onRevived event, you can listen to Sprite.events.onRevived for the signal.

    +
    + + + + + + + + + +
    + + + + + + + +
    Inherited From:
    +
    + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    This instance.

    +
    + + + +
    +
    + Type +
    +
    + +Phaser.Image + + +
    +
    + + + + +
    @@ -3255,7 +6358,7 @@
    Source:
    @@ -3496,7 +6599,7 @@
    Source:
    @@ -3657,7 +6760,7 @@
    Source:
    @@ -3818,7 +6921,7 @@
    Source:
    @@ -4181,7 +7284,7 @@ Call this function with no parameters at all to reset all sounds on this Button.
    Source:
    @@ -4299,7 +7402,7 @@ Call this function with no parameters at all to reset all sounds on this Button.
    Source:
    @@ -4460,7 +7563,7 @@ Call this function with no parameters at all to reset all sounds on this Button.
    Source:
    @@ -4511,7 +7614,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 05 2014 06:28:26 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:42 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Cache.html b/docs/Phaser.Cache.html index ac9a8804..83bec0aa 100644 --- a/docs/Phaser.Cache.html +++ b/docs/Phaser.Cache.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -7052,7 +7086,7 @@ Normally you don't call this directly but instead use getImageKeys, getSoundKeys Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:26 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:42 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Camera.html b/docs/Phaser.Camera.html index 9c78271a..c06156fd 100644 --- a/docs/Phaser.Camera.html +++ b/docs/Phaser.Camera.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -3429,7 +3463,7 @@ without having to use game.camera.x and game.camera.y.

    Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:26 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:42 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Canvas.html b/docs/Phaser.Canvas.html index 06f8a7ad..8f38c7e4 100644 --- a/docs/Phaser.Canvas.html +++ b/docs/Phaser.Canvas.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -2624,7 +2658,7 @@ patchy on earlier browsers, especially on mobile.

    Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:26 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:42 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Circle.html b/docs/Phaser.Circle.html index 9f4ff06b..d3acc07b 100644 --- a/docs/Phaser.Circle.html +++ b/docs/Phaser.Circle.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -775,7 +809,7 @@
    Source:
    @@ -881,7 +915,7 @@
    Source:
    @@ -987,7 +1021,7 @@
    Source:
    @@ -1094,7 +1128,7 @@ If set to true it will reset all of the Circle objects properties to 0. A Circle
    Source:
    @@ -1148,7 +1182,7 @@ If set to true it will reset all of the Circle objects properties to 0. A Circle
    Source:
    @@ -1254,7 +1288,7 @@ If set to true it will reset all of the Circle objects properties to 0. A Circle
    Source:
    @@ -1360,7 +1394,7 @@ If set to true it will reset all of the Circle objects properties to 0. A Circle
    Source:
    @@ -1466,7 +1500,7 @@ If set to true it will reset all of the Circle objects properties to 0. A Circle
    Source:
    @@ -1889,7 +1923,7 @@ If set to true it will reset all of the Circle objects properties to 0. A Circle
    Source:
    @@ -2076,7 +2110,7 @@ If set to true it will reset all of the Circle objects properties to 0. A Circle
    Source:
    @@ -2240,7 +2274,7 @@ If set to true it will reset all of the Circle objects properties to 0. A Circle
    Source:
    @@ -2405,7 +2439,7 @@ This method checks the radius distances between the two Circle objects to see if
    Source:
    @@ -2569,7 +2603,7 @@ This method checks the radius distances between the two Circle objects to see if
    Source:
    @@ -2872,7 +2906,7 @@ This method checks the radius distances between the two Circle objects to see if
    Source:
    @@ -3177,7 +3211,7 @@ This method checks the radius distances between the two Circle objects to see if
    Source:
    @@ -3808,7 +3842,7 @@ This method checks the radius distances between the two Circle objects to see if
    Source:
    @@ -3949,7 +3983,7 @@ This method checks the radius distances between the two Circle objects to see if
    Source:
    @@ -4228,7 +4262,7 @@ This method checks the radius distances between the two Circle objects to see if
    Source:
    @@ -4302,7 +4336,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 05 2014 06:28:26 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:42 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Color.html b/docs/Phaser.Color.html index 8db79737..c71e9133 100644 --- a/docs/Phaser.Color.html +++ b/docs/Phaser.Color.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -3611,7 +3645,7 @@ Set the max value to restrict the maximum color used per channel.

    Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:26 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:43 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.DOMSprite.html b/docs/Phaser.DOMSprite.html index c7f3269d..a9785517 100644 --- a/docs/Phaser.DOMSprite.html +++ b/docs/Phaser.DOMSprite.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -1429,7 +1463,7 @@ Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:27 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:43 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Device.html b/docs/Phaser.Device.html index 7d231d36..0203c6f8 100644 --- a/docs/Phaser.Device.html +++ b/docs/Phaser.Device.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -6037,7 +6071,7 @@ Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:27 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:43 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Easing.Back.html b/docs/Phaser.Easing.Back.html index 5cd5ceb8..acf5665a 100644 --- a/docs/Phaser.Easing.Back.html +++ b/docs/Phaser.Easing.Back.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -963,7 +997,7 @@ Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:27 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:43 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Easing.Bounce.html b/docs/Phaser.Easing.Bounce.html index 559da0c6..3e0a7762 100644 --- a/docs/Phaser.Easing.Bounce.html +++ b/docs/Phaser.Easing.Bounce.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -963,7 +997,7 @@ Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:27 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:43 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Easing.Circular.html b/docs/Phaser.Easing.Circular.html index 423e8058..1da13cea 100644 --- a/docs/Phaser.Easing.Circular.html +++ b/docs/Phaser.Easing.Circular.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -963,7 +997,7 @@ Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:27 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:43 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Easing.Cubic.html b/docs/Phaser.Easing.Cubic.html index 56b6e2f3..dadf57d3 100644 --- a/docs/Phaser.Easing.Cubic.html +++ b/docs/Phaser.Easing.Cubic.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -963,7 +997,7 @@ Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:27 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:44 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Easing.Elastic.html b/docs/Phaser.Easing.Elastic.html index 445528fa..dcb4f112 100644 --- a/docs/Phaser.Easing.Elastic.html +++ b/docs/Phaser.Easing.Elastic.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -963,7 +997,7 @@ Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:27 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:44 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Easing.Exponential.html b/docs/Phaser.Easing.Exponential.html index 2bec6a2d..848cfaf4 100644 --- a/docs/Phaser.Easing.Exponential.html +++ b/docs/Phaser.Easing.Exponential.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -963,7 +997,7 @@ Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:28 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:44 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Easing.Linear.html b/docs/Phaser.Easing.Linear.html index efd870b1..e0dd7635 100644 --- a/docs/Phaser.Easing.Linear.html +++ b/docs/Phaser.Easing.Linear.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -681,7 +715,7 @@ Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:28 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:44 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Easing.Quadratic.html b/docs/Phaser.Easing.Quadratic.html index 97dd1fb8..f622e7b6 100644 --- a/docs/Phaser.Easing.Quadratic.html +++ b/docs/Phaser.Easing.Quadratic.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -963,7 +997,7 @@ Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:28 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:44 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Easing.Quartic.html b/docs/Phaser.Easing.Quartic.html index d605c617..73952cb8 100644 --- a/docs/Phaser.Easing.Quartic.html +++ b/docs/Phaser.Easing.Quartic.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -963,7 +997,7 @@ Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:28 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:44 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Easing.Quintic.html b/docs/Phaser.Easing.Quintic.html index cae49a2f..740435a7 100644 --- a/docs/Phaser.Easing.Quintic.html +++ b/docs/Phaser.Easing.Quintic.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -963,7 +997,7 @@ Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:28 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:44 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Easing.Sinusoidal.html b/docs/Phaser.Easing.Sinusoidal.html index 876ace73..f84059e8 100644 --- a/docs/Phaser.Easing.Sinusoidal.html +++ b/docs/Phaser.Easing.Sinusoidal.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -963,7 +997,7 @@ Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:28 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:44 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Easing.html b/docs/Phaser.Easing.html index 76cf08c7..1181d42f 100644 --- a/docs/Phaser.Easing.html +++ b/docs/Phaser.Easing.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -573,7 +607,7 @@ Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:27 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:43 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Events.html b/docs/Phaser.Events.html index a3c813c2..070500c3 100644 --- a/docs/Phaser.Events.html +++ b/docs/Phaser.Events.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -587,7 +621,7 @@ Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:28 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:45 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Filter.html b/docs/Phaser.Filter.html index 20026212..b9c05442 100644 --- a/docs/Phaser.Filter.html +++ b/docs/Phaser.Filter.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -1872,7 +1906,7 @@ Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:28 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:45 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Frame.html b/docs/Phaser.Frame.html index a7dd759c..dee7f5d7 100644 --- a/docs/Phaser.Frame.html +++ b/docs/Phaser.Frame.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -2668,6 +2702,159 @@
    +
    +

    getRect(out) → {Phaser.Rectangle}

    + + +
    +
    + + +
    +

    Returns a Rectangle set to the dimensions of this Frame.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeArgumentDescription
    out + + +Phaser.Rectangle + + + + + + <optional>
    + + + + + +

    A rectangle to copy the frame dimensions to.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    A rectangle.

    +
    + + + +
    +
    + Type +
    +
    + +Phaser.Rectangle + + +
    +
    + + + + + +
    + + +

    setTrim(trimmed, actualWidth, actualHeight, destX, destY, destWidth, destHeight)

    @@ -2948,7 +3135,7 @@ Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:28 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:45 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.FrameData.html b/docs/Phaser.FrameData.html index e8a64653..03eab0de 100644 --- a/docs/Phaser.FrameData.html +++ b/docs/Phaser.FrameData.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -1895,7 +1929,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 05 2014 06:28:28 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:45 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Game.html b/docs/Phaser.Game.html index 5290e6ce..5aa5199b 100644 --- a/docs/Phaser.Game.html +++ b/docs/Phaser.Game.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -2902,7 +2936,7 @@ When a game is paused the onPause event is dispatched. When it is resumed the on
    Source:
    @@ -4707,7 +4741,7 @@ When a game is paused the onPause event is dispatched. When it is resumed the on
    Source:
    @@ -4776,7 +4810,7 @@ When a game is paused the onPause event is dispatched. When it is resumed the on
    Source:
    @@ -4846,7 +4880,7 @@ Calling step will advance the game loop by one frame. This is extremely useful t
    Source:
    @@ -4915,7 +4949,7 @@ Calling step will advance the game loop by one frame. This is extremely useful t
    Source:
    @@ -5122,7 +5156,7 @@ Calling step will advance the game loop by one frame. This is extremely useful t
    Source:
    @@ -5191,7 +5225,7 @@ Calling step will advance the game loop by one frame. This is extremely useful t
    Source:
    @@ -5261,7 +5295,7 @@ This is extremely useful to hard to track down errors! Use the internal stepCoun
    Source:
    @@ -5379,7 +5413,7 @@ This is extremely useful to hard to track down errors! Use the internal stepCoun
    Source:
    @@ -5430,7 +5464,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 05 2014 06:28:29 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:45 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.GameObjectFactory.html b/docs/Phaser.GameObjectFactory.html index 336b5ec6..7870a0e4 100644 --- a/docs/Phaser.GameObjectFactory.html +++ b/docs/Phaser.GameObjectFactory.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -999,7 +1033,7 @@
    Source:
    @@ -1050,7 +1084,7 @@
    -

    bitmapData(width, height) → {Phaser.BitmapData}

    +

    bitmapData(width, height, key, addToCache) → {Phaser.BitmapData}

    @@ -1058,7 +1092,7 @@
    -

    Experimental: A BitmapData object which can be manipulated and drawn to like a traditional Canvas object and used to texture Sprites.

    +

    A BitmapData object which can be manipulated and drawn to like a traditional Canvas object and used to texture Sprites.

    @@ -1123,7 +1157,7 @@ - 256 + 100 @@ -1162,7 +1196,7 @@ - 256 + 100 @@ -1171,6 +1205,84 @@ + + + + key + + + + + +string + + + + + + + + + <optional>
    + + + + + + + + + + + + '' + + + + +

    Asset key for the BitmapData when stored in the Cache (see addToCache parameter).

    + + + + + + + addToCache + + + + + +boolean + + + + + + + + + <optional>
    + + + + + + + + + + + + false + + + + +

    Should this BitmapData be added to the Game.Cache? If so you can retrieve it with Cache.getBitmapData(key)

    + + + @@ -1199,7 +1311,7 @@
    Source:
    @@ -1478,7 +1590,7 @@
    Source:
    @@ -1940,7 +2052,7 @@
    Source:
    @@ -1986,292 +2098,6 @@ - - - - -
    -

    child(group, x, y, key, frame) → {Phaser.Sprite}

    - - -
    -
    - - -
    -

    DEPRECATED - will be removed in Phaser 1.2 -Create a new Sprite with specific position and sprite sheet key that will automatically be added as a child of the given parent.

    -
    - - - - - - - -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeArgumentDescription
    group - - -Phaser.Group - - - - - - - - - -

    The Group to add this child to.

    x - - -number - - - - - - - - - -

    X position of the new sprite.

    y - - -number - - - - - - - - - -

    Y position of the new sprite.

    key - - -string -| - -RenderTexture - - - - - - <optional>
    - - - - - -

    The image key as defined in the Game.Cache to use as the texture for this sprite OR a RenderTexture.

    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.

    - - - - -
    - - - - - - - - - - - - - - - - - - - -
    Source:
    -
    - - - - - - - -
    - - - - - - - - - - - -
    Returns:
    - - -
    -

    the newly created sprite object.

    -
    - - - -
    -
    - Type -
    -
    - -Phaser.Sprite - - -
    -
    - - - - -
    @@ -2467,7 +2293,7 @@ at set intervals, and fixes their positions and velocities accorindgly.

    Source:
    @@ -2772,7 +2598,7 @@ at set intervals, and fixes their positions and velocities accorindgly.

    Source:
    @@ -2987,7 +2813,7 @@ at set intervals, and fixes their positions and velocities accorindgly.

    Source:
    @@ -3183,7 +3009,7 @@ at set intervals, and fixes their positions and velocities accorindgly.

    Source:
    @@ -3234,7 +3060,7 @@ at set intervals, and fixes their positions and velocities accorindgly.

    -

    renderTexture(key, width, height) → {Phaser.RenderTexture}

    +

    image(x, y, key, frame, group) → {Phaser.Sprite}

    @@ -3242,7 +3068,8 @@ at set intervals, and fixes their positions and velocities accorindgly.

    -

    A dynamic initially blank canvas to which images can be drawn.

    +

    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.

    @@ -3264,6 +3091,8 @@ at set intervals, and fixes their positions and velocities accorindgly.

    Type + Argument + @@ -3274,6 +3103,68 @@ at set intervals, and fixes their positions and velocities accorindgly.

    + + + x + + + + + +number + + + + + + + + + + + + + + + + + +

    X position of the image.

    + + + + + + + y + + + + + +number + + + + + + + + + + + + + + + + + +

    Y position of the image.

    + + + + key @@ -3283,28 +3174,45 @@ at set intervals, and fixes their positions and velocities accorindgly.

    string +| + +Phaser.RenderTexture +| + +PIXI.Texture + + + + + + + + -

    Asset key for the render texture.

    +

    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.

    - width + frame +string +| + number @@ -3312,33 +3220,53 @@ at set intervals, and fixes their positions and velocities accorindgly.

    + + + <optional>
    + + + + + + + -

    the width of the render texture.

    +

    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.

    - height + group -number +Phaser.Group + + + <optional>
    + + + + + + + -

    the height of the render texture.

    +

    Optional Group to add the object to. If not specified it will be added to the World group.

    @@ -3370,7 +3298,7 @@ at set intervals, and fixes their positions and velocities accorindgly.

    Source:
    @@ -3395,7 +3323,285 @@ at set intervals, and fixes their positions and velocities accorindgly.

    -

    The newly created renderTexture object.

    +

    the newly created sprite object.

    +
    + + + +
    +
    + Type +
    +
    + +Phaser.Sprite + + +
    +
    + + + + + + + + + +
    +

    renderTexture(width, height, key, addToCache) → {Phaser.RenderTexture}

    + + +
    +
    + + +
    +

    A dynamic initially blank canvas to which images can be drawn.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeArgumentDefaultDescription
    width + + +number + + + + + + <optional>
    + + + + + +
    + + 100 + +

    the width of the RenderTexture.

    height + + +number + + + + + + <optional>
    + + + + + +
    + + 100 + +

    the height of the RenderTexture.

    key + + +string + + + + + + <optional>
    + + + + + +
    + + '' + +

    Asset key for the RenderTexture when stored in the Cache (see addToCache parameter).

    addToCache + + +boolean + + + + + + <optional>
    + + + + + +
    + + false + +

    Should this RenderTexture be added to the Game.Cache? If so you can retrieve it with Cache.getTexture(key)

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    The newly created RenderTexture object.

    @@ -3644,7 +3850,7 @@ at set intervals, and fixes their positions and velocities accorindgly.

    Source:
    @@ -3932,7 +4138,7 @@ at set intervals, and fixes their positions and velocities accorindgly.

    Source:
    @@ -4209,7 +4415,7 @@ at set intervals, and fixes their positions and velocities accorindgly.

    Source:
    @@ -4376,7 +4582,7 @@ at set intervals, and fixes their positions and velocities accorindgly.

    Source:
    @@ -4690,7 +4896,7 @@ at set intervals, and fixes their positions and velocities accorindgly.

    Source:
    @@ -4831,7 +5037,7 @@ at set intervals, and fixes their positions and velocities accorindgly.

    Source:
    @@ -4905,7 +5111,7 @@ at set intervals, and fixes their positions and velocities accorindgly.

    Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:29 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:45 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Gamepad.html b/docs/Phaser.Gamepad.html index aeae4f64..71212853 100644 --- a/docs/Phaser.Gamepad.html +++ b/docs/Phaser.Gamepad.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -3362,7 +3396,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 05 2014 06:28:29 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:45 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.GamepadButton.html b/docs/Phaser.GamepadButton.html index 8a741cdf..57a0aa0d 100644 --- a/docs/Phaser.GamepadButton.html +++ b/docs/Phaser.GamepadButton.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -2540,7 +2574,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 05 2014 06:28:29 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:46 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Graphics.html b/docs/Phaser.Graphics.html index 75ae9f33..70d2d789 100644 --- a/docs/Phaser.Graphics.html +++ b/docs/Phaser.Graphics.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -739,7 +773,7 @@ Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:29 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:46 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Group.html b/docs/Phaser.Group.html index 79bcc812..c8a44cf1 100644 --- a/docs/Phaser.Group.html +++ b/docs/Phaser.Group.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -541,7 +575,7 @@ -

    The parent Group or DisplayObjectContainer that will hold this group, if any. If undefined it will use game.world.

    +

    The parent Group, DisplayObject or DisplayObjectContainer that this Group will be added to. If undefined or null it will use game.world.

    @@ -619,7 +653,7 @@ -

    Should the DisplayObjectContainer this Group creates be added to the World (default, false) or direct to the Stage (true).

    +

    Should this Group be added to the World (default, false) or direct to the Stage (true).

    @@ -737,7 +771,7 @@
    Source:
    @@ -797,7 +831,7 @@
    Source:
    @@ -857,7 +891,7 @@
    Source:
    @@ -917,7 +951,7 @@
    Source:
    @@ -977,7 +1011,7 @@
    Source:
    @@ -1082,7 +1116,7 @@
    Source:
    @@ -1184,7 +1218,7 @@
    Source:
    @@ -1291,7 +1325,7 @@ This will have no impact on the rotation value of its children, but it will upda
    Source:
    @@ -1398,7 +1432,7 @@ The cursor is set to the first child added to the Group and doesn't change unles
    Source:
    @@ -1471,7 +1505,7 @@ The cursor is set to the first child added to the Group and doesn't change unles -

    If exists is true the the Group is updated, otherwise it is skipped.

    +

    If exists is true the Group is updated, otherwise it is skipped.

    @@ -1503,7 +1537,7 @@ The cursor is set to the first child added to the Group and doesn't change unles
    Source:
    @@ -1614,108 +1648,6 @@ The cursor is set to the first child added to the Group and doesn't change unles -
    - - - - - - - -
    -

    group

    - - -
    -
    - - - - - -
    - - -
    Properties:
    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    group - - -Phaser.Group - - - -

    The parent Group of this Group, if a child of another.

    -
    - - - - - - - - - - - - - - - - - - - - -
    Source:
    -
    - - - - - - -
    @@ -1809,7 +1741,7 @@ The cursor is set to the first child added to the Group and doesn't change unles
    Source:
    @@ -1920,108 +1852,6 @@ The cursor is set to the first child added to the Group and doesn't change unles - - - - - - - - -
    -

    pivot

    - - -
    -
    - - - - - -
    - - -
    Properties:
    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    pivot - - -Phaser.Point - - - -

    The pivot point of the Group container.

    -
    - - - - - - - - - - - - - - - - - - - - -
    Source:
    -
    - - - - - - -
    @@ -2120,7 +1950,7 @@ This will have no impact on the rotation value of its children, but it will upda
    Source:
    @@ -2193,7 +2023,7 @@ This will have no impact on the rotation value of its children, but it will upda -

    The scane of the Group container.

    +

    The scale of the Group container.

    @@ -2222,7 +2052,7 @@ This will have no impact on the rotation value of its children, but it will upda
    Source:
    @@ -2324,7 +2154,7 @@ This will have no impact on the rotation value of its children, but it will upda
    Source:
    @@ -2426,7 +2256,7 @@ This will have no impact on the rotation value of its children, but it will upda
    Source:
    @@ -2528,7 +2358,7 @@ This will have no impact on the rotation value of its children, but it will upda
    Source:
    @@ -2635,7 +2465,7 @@ This will have no impact on the x/y coordinates of its children, but it will upd
    Source:
    @@ -2742,7 +2572,7 @@ This will have no impact on the x/y coordinates of its children, but it will upd
    Source:
    @@ -2858,7 +2688,7 @@ that then see the addAt method.

    Source:
    @@ -3078,7 +2908,7 @@ Group.addAll('x', 10) will add 10 to the child.x value.

    Source:
    @@ -3220,7 +3050,7 @@ The child is added to the Group at the location specified by the index value, th
    Source:
    @@ -3361,7 +3191,7 @@ The child is added to the Group at the location specified by the index value, th
    Source:
    @@ -3595,7 +3425,7 @@ After the method parameter and context you can add as many extra parameters as y
    Source:
    @@ -3788,7 +3618,7 @@ After the existsValue parameter you can add as many parameters as you like, whic
    Source:
    @@ -3952,76 +3782,7 @@ After the existsValue parameter you can add as many parameters as you like, whic
    Source:
    - - - - - - - - - - - - - - - - - - - - - - - - - -
    -

    childTest()

    - - -
    -
    - - -
    -

    Internal test.

    -
    - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - -
    Source:
    -
    @@ -4090,7 +3851,7 @@ After the existsValue parameter you can add as many parameters as you like, whic
    Source:
    @@ -4182,7 +3943,7 @@ After the existsValue parameter you can add as many parameters as you like, whic
    Source:
    @@ -4489,7 +4250,7 @@ Useful if you don't need to create the Sprite instances before-hand.

    Source:
    @@ -4762,7 +4523,7 @@ and will be positioned at 0, 0 (relative to the Group.x/y)

    Source:
    @@ -4900,7 +4661,7 @@ and will be positioned at 0, 0 (relative to the Group.x/y)

    Source:
    @@ -5088,7 +4849,7 @@ Group.divideAll('x', 2) will half the child.x value.

    Source:
    @@ -5255,7 +5016,7 @@ Note: Currently this will skip any children which are Groups themselves.

    Source:
    @@ -5398,7 +5159,7 @@ For example: Group.forEachAlive(causeDamage, this, 500)

    Source:
    @@ -5541,7 +5302,7 @@ For example: Group.forEachAlive(causeDamage, this, 500)

    Source:
    @@ -5684,7 +5445,7 @@ For example: Group.forEachDead(bringToLife, this)

    Source:
    @@ -5802,7 +5563,7 @@ For example: Group.forEachDead(bringToLife, this)

    Source:
    @@ -5895,7 +5656,7 @@ This is handy for checking if everything has been wiped out, or choosing a squad
    Source:
    @@ -5988,7 +5749,7 @@ This is handy for checking if everything has been wiped out, or choosing a squad
    Source:
    @@ -6129,7 +5890,7 @@ This is handy for checking if everything has been wiped out, or choosing a squad
    Source:
    @@ -6270,7 +6031,7 @@ This is handy for checking if everything has been wiped out, or choosing a squad
    Source:
    @@ -6434,7 +6195,7 @@ This is handy for checking if everything has been wiped out, or choosing a squad
    Source:
    @@ -6739,7 +6500,7 @@ You can add as many callback parameters as you like, which will all be passed to
    Source:
    @@ -6950,7 +6711,7 @@ Group.multiplyAll('x', 2) will x2 the child.x value.

    Source:
    @@ -7019,7 +6780,7 @@ Group.multiplyAll('x', 2) will x2 the child.x value.

    Source:
    @@ -7088,7 +6849,7 @@ Group.multiplyAll('x', 2) will x2 the child.x value.

    Source:
    @@ -7206,7 +6967,7 @@ Group.multiplyAll('x', 2) will x2 the child.x value.

    Source:
    @@ -7299,7 +7060,7 @@ The Group container remains on the display list.

    Source:
    @@ -7440,7 +7201,7 @@ The Group container remains on the display list.

    Source:
    @@ -7581,7 +7342,7 @@ The Group container remains on the display list.

    Source:
    @@ -7903,7 +7664,7 @@ The operation parameter controls how the new value is assigned to the property,
    Source:
    @@ -8190,7 +7951,7 @@ The operation parameter controls how the new value is assigned to the property,
    Source:
    @@ -8433,7 +8194,7 @@ The operation parameter controls how the new value is assigned to the property,
    Source:
    @@ -8611,7 +8372,7 @@ For example to depth sort Sprites for Zelda-style game you might call grou
    Source:
    @@ -8799,7 +8560,7 @@ Group.subAll('x', 10) will minus 10 from the child.x value.

    Source:
    @@ -8827,7 +8588,7 @@ Group.subAll('x', 10) will minus 10 from the child.x value.

    -

    swap(child1, child2) → {boolean}

    +

    swap(child1, child2)

    @@ -8941,99 +8702,7 @@ You cannot swap a child with itself, or swap un-parented children, doing so will
    Source:
    - - - - - - - -
    - - - - - - - - - - - -
    Returns:
    - - -
    -

    True if the swap was successful, otherwise false.

    -
    - - - -
    -
    - Type -
    -
    - -boolean - - -
    -
    - - - - - -
    - - - -
    -

    swapIndex()

    - - -
    -
    - - -
    -

    Internal test.

    -
    - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - -
    Source:
    -
    @@ -9084,7 +8753,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 05 2014 06:28:29 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:46 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Image.html b/docs/Phaser.Image.html new file mode 100644 index 00000000..37ef0e85 --- /dev/null +++ b/docs/Phaser.Image.html @@ -0,0 +1,3807 @@ + + + + + + Phaser Class: Image + + + + + + + + + + +
    + + +
    + + +
    + +
    + + + +

    Class: Image

    +
    + +
    +

    + Phaser. + + Image +

    + +

    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.

    + +
    + +
    +
    + + + + +
    +

    new Image(game, x, y, key, frame)

    + + +
    +
    + + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    game + + +Phaser.Game + + + +

    A reference to the currently running game.

    x + + +number + + + +

    The x coordinate of the Imaget. The coordinate is relative to any parent container this Image may be in.

    y + + +number + + + +

    The y coordinate of the Image. The coordinate is relative to any parent container this Image may be in.

    key + + +string +| + +Phaser.RenderTexture +| + +Phaser.BitmapData +| + +PIXI.Texture + + + +

    The texture used by the Image during rendering. It can be a string which is a reference to the Cache entry, or an instance of a RenderTexture, BitmapData or PIXI.Texture.

    frame + + +string +| + +number + + + +

    If this Image 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.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + +
    + + + + + + + + + + + + +

    Members

    + +
    + +
    +

    angle

    + + +
    +
    + +
    +

    Indicates the rotation of the Sprite, in degrees, from its original orientation. Values from 0 to 180 represent clockwise rotation; values from 0 to -180 represent counterclockwise rotation. +Values outside this range are added to or subtracted from 360 to obtain a value within the range. For example, the statement player.angle = 450 is the same as player.angle = 90. +If you wish to work in radians instead of degrees use the property Sprite.rotation instead. Working in radians is also a little faster as it doesn't have to convert the angle.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    angle + + +number + + + +

    The angle of this Image in degrees.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    autoCull

    + + +
    +
    + +
    +

    Should this Sprite be automatically culled if out of range of the camera? +A culled sprite has its renderable property set to 'false'. +Be advised this is quite an expensive operation, as it has to calculate the bounds of the object every frame, so only enable it if you really need it.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    autoCull + + +boolean + + + +

    A flag indicating if the Sprite should be automatically camera culled or not.

    +
    + + + + + + + + + + + + + + + + + + +
    Default Value:
    +
    • false
    + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    <readonly> deltaX

    + + +
    +
    + +
    +

    Returns the delta x value. The difference between world.x now and in the previous step.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    deltaX + + +number + + + +

    The delta value. Positive if the motion was to the right, negative if to the left.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    <readonly> deltaY

    + + +
    +
    + +
    +

    Returns the delta y value. The difference between world.y now and in the previous step.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    deltaY + + +number + + + +

    The delta value. Positive if the motion was downwards, negative if upwards.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    <readonly> deltaZ

    + + +
    +
    + +
    +

    Returns the delta z value. The difference between rotation now and in the previous step.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    deltaZ + + +number + + + +

    The delta value.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    events

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    events + + +Phaser.Events + + + +

    The Events you can subscribe to that are dispatched when certain things happen on this Sprite or its components.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    exists

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    exists + + +boolean + + + +

    If exists = false then the Sprite isn't updated by the core game loop or physics subsystem at all.

    +
    + + + + + + + + + + + + + + + + + + +
    Default Value:
    +
    • true
    + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    fixedToCamera

    + + +
    +
    + +
    +

    A Sprite that is fixed to the camera uses its x/y coordinates as offsets from the top left of the camera. +Note that if this Image is a child of a display object that has changed its position then the offset will be calculated from that.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    fixedToCamera + + +boolean + + + +

    Fixes this Sprite to the Camera.

    +
    + + + + + + + + + + + + + + + + + + +
    Default Value:
    +
    • false
    + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    frame

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    frame + + +number + + + +

    Gets or sets the current frame index and updates the Texture for display.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    frameName

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    frameName + + +string + + + +

    Gets or sets the current frame by name and updates the Texture for display.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    game

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    game + + +Phaser.Game + + + +

    A reference to the currently running Game.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    <readonly> inCamera

    + + +
    +
    + +
    +

    Checks if the Image bounds are within the game camera, otherwise false if fully outside of it.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    inCamera + + +boolean + + + +

    True if the Image bounds is within the game camera, even if only partially. Otherwise false if fully outside of it.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    input

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    input + + +Phaser.InputHandler +| + +null + + + +

    The Input Handler for this object. Needs to be enabled with image.inputEnabled = true before you can use it.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    inputEnabled

    + + +
    +
    + +
    +

    By default an Image 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.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    inputEnabled + + +boolean + + + +

    Set to true to allow this object to receive input events.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    <readonly> inWorld

    + + +
    +
    + +
    +

    Checks if the Image bounds are within the game world, otherwise false if fully outside of it.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    inWorld + + +boolean + + + +

    True if the Image bounds is within the game world, even if only partially. Otherwise false if fully outside of it.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    key

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    key + + +string +| + +Phaser.RenderTexture +| + +Phaser.BitmapData +| + +PIXI.Texture + + + +

    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, BitmapData or PIXI.Texture.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    name

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    name + + +string + + + +

    The user defined name given to this Sprite.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    <readonly> renderOrderID

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    renderOrderID + + +number + + + +

    The render order ID, reset every frame.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    <readonly> type

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    type + + +number + + + +

    The const type of this object.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    world

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    world + + +Phaser.Point + + + +

    The world coordinates of this Sprite. This differs from the x/y coordinates which are relative to the Sprites container.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + +
    + + + +

    Methods

    + +
    + +
    +

    bringToTop() → {Phaser.Image}

    + + +
    +
    + + +
    +

    Brings the Sprite to the top of the display list it is a child of. Sprites that are members of a Phaser.Group are only +bought to the top of that Group, not the entire display list.

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    This instance.

    +
    + + + +
    +
    + Type +
    +
    + +Phaser.Image + + +
    +
    + + + + + +
    + + + +
    +

    crop(rect)

    + + +
    +
    + + +
    +

    Crop allows you to crop the texture used to display this Image. +Cropping takes place from the top-left of the Image and can be modified in real-time by providing an updated rectangle object.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    rect + + +Phaser.Rectangle + + + +

    The Rectangle to crop the Image to. Pass null or no parameters to clear a previously set crop rectangle.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    destroy()

    + + +
    +
    + + +
    +

    Destroys the Sprite. This removes it from its parent group, destroys the input, event and animation handlers if present +and nulls its reference to game, freeing it up for garbage collection.

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    kill() → {Phaser.Image}

    + + +
    +
    + + +
    +

    Kills a Sprite. A killed Sprite has its alive, exists and visible properties all set to false. +It will dispatch the onKilled event, you can listen to Sprite.events.onKilled for the signal. +Note that killing a Sprite is a way for you to quickly recycle it in a Sprite pool, it doesn't free it up from memory. +If you don't need this Sprite any more you should call Sprite.destroy instead.

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    This instance.

    +
    + + + +
    +
    + Type +
    +
    + +Phaser.Image + + +
    +
    + + + + + +
    + + + +
    +

    loadTexture(key, frame)

    + + +
    +
    + + +
    +

    Changes the Texture the Sprite is using entirely. The old texture is removed and the new one is referenced or fetched from the Cache. +This causes a WebGL texture update, so use sparingly or in low-intensity portions of your game.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    key + + +string +| + +Phaser.RenderTexture +| + +Phaser.BitmapData +| + +PIXI.Texture + + + +

    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, BitmapData or PIXI.Texture.

    frame + + +string +| + +number + + + +

    If this Sprite is using part of a sprite sheet or texture atlas you can specify the exact frame to use by giving a string or numeric index.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    postUpdate()

    + + +
    +
    + + +
    +

    Internal function called by the World postUpdate cycle.

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    preUpdate()

    + + +
    +
    + + +
    +

    Automatically called by World.preUpdate.

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    reset(x, y) → {Phaser.Image}

    + + +
    +
    + + +
    +

    Resets the Sprite. This places the Sprite at the given x/y world coordinates and then sets alive, exists, visible and renderable all to true.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    x + + +number + + + +

    The x coordinate (in world space) to position the Sprite at.

    y + + +number + + + +

    The y coordinate (in world space) to position the Sprite at.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    This instance.

    +
    + + + +
    +
    + Type +
    +
    + +Phaser.Image + + +
    +
    + + + + + +
    + + + +
    +

    revive() → {Phaser.Image}

    + + +
    +
    + + +
    +

    Brings a 'dead' Sprite back to life, optionally giving it the health value specified. +A resurrected Sprite has its alive, exists and visible properties all set to true. +It will dispatch the onRevived event, you can listen to Sprite.events.onRevived for the signal.

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    This instance.

    +
    + + + +
    +
    + Type +
    +
    + +Phaser.Image + + +
    +
    + + + + + +
    + +
    + + + + + +
    + +
    + + + + +
    + +
    +
    + + + + Phaser Copyright © 2012-2014 Photon Storm Ltd. + +
    + + + Documentation generated by JSDoc 3.3.0-dev + on Sat Feb 08 2014 07:19:46 GMT-0000 (GMT) using the DocStrap template. + +
    +
    + + +
    +
    +
    + +
    +
    + +
    + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/Phaser.Input.html b/docs/Phaser.Input.html index 66d143c8..92a1a934 100644 --- a/docs/Phaser.Input.html +++ b/docs/Phaser.Input.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -609,7 +643,7 @@ The Input manager is updated automatically by the core game loop.

    Source:
    @@ -669,7 +703,7 @@ The Input manager is updated automatically by the core game loop.

    Source:
    @@ -729,7 +763,7 @@ The Input manager is updated automatically by the core game loop.

    Source:
    @@ -832,14 +866,11 @@ When you've limited max pointers to 1 this will accurately be either the first f -
    Default Value:
    -
    • null
    -
    Source:
    @@ -946,7 +977,7 @@ Default size of 44px (Apples recommended "finger tip" size) but can be
    Source:
    @@ -970,10 +1001,6 @@ Default size of 44px (Apples recommended "finger tip" size) but can be
    -
    -

    The current number of active Pointers.

    -
    - @@ -1023,7 +1050,7 @@ Default size of 44px (Apples recommended "finger tip" size) but can be - +

    The current number of active Pointers.

    @@ -1055,7 +1082,7 @@ Default size of 44px (Apples recommended "finger tip" size) but can be
    Source:
    @@ -1080,8 +1107,8 @@ Default size of 44px (Apples recommended "finger tip" size) but can be
    -

    You can disable all Input by setting Input.disabled: true. While set all new input related events will be ignored. -If you need to disable just one type of input, for example mouse, use Input.mouse.disabled: true instead

    +

    You can disable all Input by setting Input.disabled = true. While set all new input related events will be ignored. +If you need to disable just one type of input; for example mouse; use Input.mouse.disabled = true instead

    @@ -1165,7 +1192,7 @@ If you need to disable just one type of input, for example mouse, use Input.mous
    Source:
    @@ -1189,10 +1216,6 @@ If you need to disable just one type of input, for example mouse, use Input.mous
    -
    -

    The number of milliseconds between taps of the same Pointer for it to be considered a double tap / click

    -
    - @@ -1242,7 +1265,7 @@ If you need to disable just one type of input, for example mouse, use Input.mous - +

    The number of milliseconds between taps of the same Pointer for it to be considered a double tap / click.

    @@ -1274,7 +1297,7 @@ If you need to disable just one type of input, for example mouse, use Input.mous
    Source:
    @@ -1400,10 +1423,6 @@ If you need to disable just one type of input, for example mouse, use Input.mous
    -
    -

    The Gamepad Input manager.

    -
    - @@ -1478,14 +1497,11 @@ If you need to disable just one type of input, for example mouse, use Input.mous -
    Default Value:
    -
    • null
    -
    Source:
    @@ -1719,10 +1735,6 @@ If you need to disable just one type of input, for example mouse, use Input.mous
    -
    -

    The number of milliseconds that the Pointer has to be pressed down for it to fire a onHold event

    -
    - @@ -1772,7 +1784,7 @@ If you need to disable just one type of input, for example mouse, use Input.mous - +

    The number of milliseconds that the Pointer has to be pressed down for it to fire a onHold event.

    @@ -1804,7 +1816,7 @@ If you need to disable just one type of input, for example mouse, use Input.mous
    Source:
    @@ -1829,7 +1841,7 @@ If you need to disable just one type of input, for example mouse, use Input.mous
    -

    A linked list of interactive objects, the InputHandler components (belonging to Sprites) register themselves with this.

    +

    A linked list of interactive objects; the InputHandler components (belonging to Sprites) register themselves with this.

    @@ -1910,7 +1922,7 @@ If you need to disable just one type of input, for example mouse, use Input.mous
    Source:
    @@ -1934,10 +1946,6 @@ If you need to disable just one type of input, for example mouse, use Input.mous
    -
    -

    The number of milliseconds below which the Pointer is considered justPressed

    -
    - @@ -1987,7 +1995,7 @@ If you need to disable just one type of input, for example mouse, use Input.mous - +

    The number of milliseconds below which the Pointer is considered justPressed.

    @@ -2019,7 +2027,7 @@ If you need to disable just one type of input, for example mouse, use Input.mous
    Source:
    @@ -2043,10 +2051,6 @@ If you need to disable just one type of input, for example mouse, use Input.mous
    -
    -

    The number of milliseconds below which the Pointer is considered justReleased

    -
    - @@ -2096,7 +2100,7 @@ If you need to disable just one type of input, for example mouse, use Input.mous - +

    The number of milliseconds below which the Pointer is considered justReleased .

    @@ -2128,7 +2132,7 @@ If you need to disable just one type of input, for example mouse, use Input.mous
    Source:
    @@ -2152,10 +2156,6 @@ If you need to disable just one type of input, for example mouse, use Input.mous
    -
    -

    The Keyboard Input manager.

    -
    - @@ -2230,14 +2230,11 @@ If you need to disable just one type of input, for example mouse, use Input.mous -
    Default Value:
    -
    • null
    -
    Source:
    @@ -2261,11 +2258,6 @@ If you need to disable just one type of input, for example mouse, use Input.mous
    -
    -

    The maximum number of Pointers allowed to be active at any one time. -For lots of games it's useful to set this to 1.

    -
    - @@ -2315,7 +2307,7 @@ For lots of games it's useful to set this to 1.

    - +

    The maximum number of Pointers allowed to be active at any one time. For lots of games it's useful to set this to 1.

    @@ -2347,7 +2339,7 @@ For lots of games it's useful to set this to 1.

    Source:
    @@ -2371,10 +2363,6 @@ For lots of games it's useful to set this to 1.

    -
    -

    The Mouse Input manager.

    -
    - @@ -2449,14 +2437,11 @@ For lots of games it's useful to set this to 1.

    -
    Default Value:
    -
    • null
    -
    Source:
    @@ -2480,10 +2465,6 @@ For lots of games it's useful to set this to 1.

    -
    -

    The mouse has its own unique Phaser.Pointer object which you can use if making a desktop specific game.

    -
    - @@ -2533,7 +2514,7 @@ For lots of games it's useful to set this to 1.

    - +

    The mouse has its own unique Phaser.Pointer object which you can use if making a desktop specific game.

    @@ -2558,14 +2539,11 @@ For lots of games it's useful to set this to 1.

    -
    Default Value:
    -
    • null
    -
    Source:
    @@ -2793,10 +2771,6 @@ For lots of games it's useful to set this to 1.

    -
    -

    The MSPointer Input manager.

    -
    - @@ -2871,14 +2845,11 @@ For lots of games it's useful to set this to 1.

    -
    Default Value:
    -
    • null
    -
    Source:
    @@ -2902,10 +2873,6 @@ For lots of games it's useful to set this to 1.

    -
    -

    Controls the expected behaviour when using a mouse and touch together on a multi-input device.

    -
    - @@ -2945,7 +2912,7 @@ For lots of games it's useful to set this to 1.

    -Description +number @@ -2955,7 +2922,7 @@ For lots of games it's useful to set this to 1.

    - +

    Controls the expected behaviour when using a mouse and touch together on a multi-input device.

    @@ -2984,7 +2951,7 @@ For lots of games it's useful to set this to 1.

    Source:
    @@ -3008,10 +2975,6 @@ For lots of games it's useful to set this to 1.

    -
    -

    A Signal that is dispatched each time a pointer is pressed down.

    -
    - @@ -3061,7 +3024,7 @@ For lots of games it's useful to set this to 1.

    - +

    A Signal that is dispatched each time a pointer is pressed down.

    @@ -3086,14 +3049,11 @@ For lots of games it's useful to set this to 1.

    -
    Default Value:
    -
    • null
    -
    Source:
    @@ -3117,10 +3077,6 @@ For lots of games it's useful to set this to 1.

    -
    -

    A Signal that is dispatched each time a pointer is held down.

    -
    - @@ -3170,7 +3126,7 @@ For lots of games it's useful to set this to 1.

    - +

    A Signal that is dispatched each time a pointer is held down.

    @@ -3195,14 +3151,11 @@ For lots of games it's useful to set this to 1.

    -
    Default Value:
    -
    • null
    -
    Source:
    @@ -3226,10 +3179,6 @@ For lots of games it's useful to set this to 1.

    -
    -

    A Signal that is dispatched each time a pointer is tapped.

    -
    - @@ -3279,7 +3228,7 @@ For lots of games it's useful to set this to 1.

    - +

    A Signal that is dispatched each time a pointer is tapped.

    @@ -3304,14 +3253,11 @@ For lots of games it's useful to set this to 1.

    -
    Default Value:
    -
    • null
    -
    Source:
    @@ -3335,10 +3281,6 @@ For lots of games it's useful to set this to 1.

    -
    -

    A Signal that is dispatched each time a pointer is released.

    -
    - @@ -3388,7 +3330,7 @@ For lots of games it's useful to set this to 1.

    - +

    A Signal that is dispatched each time a pointer is released.

    @@ -3413,14 +3355,11 @@ For lots of games it's useful to set this to 1.

    -
    Default Value:
    -
    • null
    -
    Source:
    @@ -3444,10 +3383,6 @@ For lots of games it's useful to set this to 1.

    -
    -

    A Pointer object

    -
    - @@ -3497,7 +3432,7 @@ For lots of games it's useful to set this to 1.

    - +

    A Pointer object.

    @@ -3526,7 +3461,7 @@ For lots of games it's useful to set this to 1.

    Source:
    @@ -3550,10 +3485,6 @@ For lots of games it's useful to set this to 1.

    -
    -

    A Pointer object

    -
    - @@ -3603,7 +3534,7 @@ For lots of games it's useful to set this to 1.

    - +

    A Pointer object.

    @@ -3632,7 +3563,7 @@ For lots of games it's useful to set this to 1.

    Source:
    @@ -3656,10 +3587,6 @@ For lots of games it's useful to set this to 1.

    -
    -

    A Pointer object

    -
    - @@ -3709,7 +3636,7 @@ For lots of games it's useful to set this to 1.

    - +

    A Pointer object.

    @@ -3738,7 +3665,7 @@ For lots of games it's useful to set this to 1.

    Source:
    @@ -3762,10 +3689,6 @@ For lots of games it's useful to set this to 1.

    -
    -

    A Pointer object

    -
    - @@ -3815,7 +3738,7 @@ For lots of games it's useful to set this to 1.

    - +

    A Pointer object.

    @@ -3844,7 +3767,7 @@ For lots of games it's useful to set this to 1.

    Source:
    @@ -3868,10 +3791,6 @@ For lots of games it's useful to set this to 1.

    -
    -

    A Pointer object

    -
    - @@ -3921,7 +3840,7 @@ For lots of games it's useful to set this to 1.

    - +

    A Pointer object.

    @@ -3950,7 +3869,7 @@ For lots of games it's useful to set this to 1.

    Source:
    @@ -3974,10 +3893,6 @@ For lots of games it's useful to set this to 1.

    -
    -

    A Pointer object

    -
    - @@ -4027,7 +3942,7 @@ For lots of games it's useful to set this to 1.

    - +

    A Pointer object.

    @@ -4056,7 +3971,7 @@ For lots of games it's useful to set this to 1.

    Source:
    @@ -4080,10 +3995,6 @@ For lots of games it's useful to set this to 1.

    -
    -

    A Pointer object

    -
    - @@ -4133,7 +4044,7 @@ For lots of games it's useful to set this to 1.

    - +

    A Pointer object.

    @@ -4162,7 +4073,7 @@ For lots of games it's useful to set this to 1.

    Source:
    @@ -4186,10 +4097,6 @@ For lots of games it's useful to set this to 1.

    -
    -

    A Pointer object

    -
    - @@ -4239,7 +4146,7 @@ For lots of games it's useful to set this to 1.

    - +

    A Pointer object.

    @@ -4268,7 +4175,7 @@ For lots of games it's useful to set this to 1.

    Source:
    @@ -4292,10 +4199,6 @@ For lots of games it's useful to set this to 1.

    -
    -

    A Pointer object

    -
    - @@ -4345,7 +4248,7 @@ For lots of games it's useful to set this to 1.

    - +

    A Pointer object.

    @@ -4374,7 +4277,7 @@ For lots of games it's useful to set this to 1.

    Source:
    @@ -4398,10 +4301,6 @@ For lots of games it's useful to set this to 1.

    -
    -

    A Pointer object.

    -
    - @@ -4451,7 +4350,7 @@ For lots of games it's useful to set this to 1.

    - +

    A Pointer object.

    @@ -4480,7 +4379,7 @@ For lots of games it's useful to set this to 1.

    Source:
    @@ -4582,7 +4481,7 @@ For lots of games it's useful to set this to 1.

    Source:
    @@ -4606,11 +4505,6 @@ For lots of games it's useful to set this to 1.

    -
    -

    How often should the input pointers be checked for updates? -A value of 0 means every single frame (60fps), a value of 1 means every other frame (30fps) and so on.

    -
    - @@ -4660,7 +4554,7 @@ A value of 0 means every single frame (60fps), a value of 1 means every other fr - +

    How often should the input pointers be checked for updates? A value of 0 means every single frame (60fps); a value of 1 means every other frame (30fps) and so on.

    @@ -4692,7 +4586,7 @@ A value of 0 means every single frame (60fps), a value of 1 means every other fr
    Source:
    @@ -4797,7 +4691,7 @@ A value of 0 means every single frame (60fps), a value of 1 means every other fr
    Source:
    @@ -4823,7 +4717,7 @@ A value of 0 means every single frame (60fps), a value of 1 means every other fr

    The total number of entries that can be recorded into the Pointer objects tracking history. -If the Pointer is tracking one event every 100ms, then a trackLimit of 100 would store the last 10 seconds worth of history.

    +If the Pointer is tracking one event every 100ms; then a trackLimit of 100 would store the last 10 seconds worth of history.

    @@ -4907,7 +4801,7 @@ If the Pointer is tracking one event every 100ms, then a trackLimit of 100 would
    Source:
    @@ -5018,7 +4912,7 @@ The history is updated at the rate specified in Input.pollRate

    Source:
    @@ -5042,10 +4936,6 @@ The history is updated at the rate specified in Input.pollRate

    -
    -

    The rate in milliseconds at which the Pointer objects should update their tracking history

    -
    - @@ -5095,7 +4985,7 @@ The history is updated at the rate specified in Input.pollRate

    - +

    The rate in milliseconds at which the Pointer objects should update their tracking history.

    @@ -5127,7 +5017,7 @@ The history is updated at the rate specified in Input.pollRate

    Source:
    @@ -5151,11 +5041,6 @@ The history is updated at the rate specified in Input.pollRate

    -
    -

    The scale by which all input coordinates are multiplied, calculated by the StageScaleMode. -In an un-scaled game the values will be x: 1 and y: 1.

    -
    - @@ -5205,7 +5090,7 @@ In an un-scaled game the values will be x: 1 and y: 1.

    - +

    The scale by which all input coordinates are multiplied; calculated by the StageScaleMode. In an un-scaled game the values will be x = 1 and y = 1.

    @@ -5234,7 +5119,7 @@ In an un-scaled game the values will be x: 1 and y: 1.

    Source:
    @@ -5258,10 +5143,6 @@ In an un-scaled game the values will be x: 1 and y: 1.

    -
    -

    A point object representing the speed of the Pointer. Only really useful in single Pointer games, otherwise see the Pointer objects directly.

    -
    - @@ -5311,7 +5192,7 @@ In an un-scaled game the values will be x: 1 and y: 1.

    - +

    A point object representing the speed of the Pointer. Only really useful in single Pointer games; otherwise see the Pointer objects directly.

    @@ -5340,7 +5221,7 @@ In an un-scaled game the values will be x: 1 and y: 1.

    Source:
    @@ -5364,10 +5245,6 @@ In an un-scaled game the values will be x: 1 and y: 1.

    -
    -

    The number of milliseconds that the Pointer has to be pressed down and then released to be considered a tap or clicke

    -
    - @@ -5417,7 +5294,7 @@ In an un-scaled game the values will be x: 1 and y: 1.

    - +

    The number of milliseconds that the Pointer has to be pressed down and then released to be considered a tap or click.

    @@ -5449,7 +5326,7 @@ In an un-scaled game the values will be x: 1 and y: 1.

    Source:
    @@ -5555,7 +5432,7 @@ In an un-scaled game the values will be x: 1 and y: 1.

    Source:
    @@ -5661,7 +5538,7 @@ In an un-scaled game the values will be x: 1 and y: 1.

    Source:
    @@ -5685,10 +5562,6 @@ In an un-scaled game the values will be x: 1 and y: 1.

    -
    -

    The Touch Input manager.

    -
    - @@ -5763,14 +5636,11 @@ In an un-scaled game the values will be x: 1 and y: 1.

    -
    Default Value:
    -
    • null
    -
    Source:
    @@ -5876,7 +5746,7 @@ In an un-scaled game the values will be x: 1 and y: 1.

    Source:
    @@ -5982,7 +5852,7 @@ In an un-scaled game the values will be x: 1 and y: 1.

    Source:
    @@ -6088,7 +5958,7 @@ In an un-scaled game the values will be x: 1 and y: 1.

    Source:
    @@ -6194,7 +6064,7 @@ In an un-scaled game the values will be x: 1 and y: 1.

    Source:
    @@ -6260,7 +6130,7 @@ If you need more then use this to create a new one, up to a maximum of 10.

    Source:
    @@ -6352,7 +6222,7 @@ If you need more then use this to create a new one, up to a maximum of 10.

    Source:
    @@ -6421,7 +6291,7 @@ If you need more then use this to create a new one, up to a maximum of 10.

    Source:
    @@ -6444,6 +6314,173 @@ If you need more then use this to create a new one, up to a maximum of 10.

    +
    + + + +
    +

    getLocalPosition(displayObject, pointer) → {Phaser.Point}

    + + +
    +
    + + +
    +

    This will return the local coordinates of the specified displayObject based on the given Pointer.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    displayObject + + +Phaser.Sprite +| + +Phaser.Image + + + +

    The DisplayObject to get the local coordinates for.

    pointer + + +Phaser.Pointer + + + +

    The Pointer to use in the check against the displayObject.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    A point containing the coordinates of the Pointer position relative to the DisplayObject.

    +
    + + + +
    +
    + Type +
    +
    + +Phaser.Point + + +
    +
    + + + + +
    @@ -6539,7 +6576,7 @@ If you need more then use this to create a new one, up to a maximum of 10.

    Source:
    @@ -6680,7 +6717,7 @@ If you need more then use this to create a new one, up to a maximum of 10.

    Source:
    @@ -6821,7 +6858,7 @@ If you need more then use this to create a new one, up to a maximum of 10.

    Source:
    @@ -6962,7 +6999,7 @@ If you need more then use this to create a new one, up to a maximum of 10.

    Source:
    @@ -7105,7 +7142,7 @@ to only use if you've limited input to a single pointer (i.e. mouse or touch)

    Source:
    @@ -7223,7 +7260,7 @@ to only use if you've limited input to a single pointer (i.e. mouse or touch)

    Source:
    @@ -7364,7 +7401,7 @@ to only use if you've limited input to a single pointer (i.e. mouse or touch)

    Source:
    @@ -7456,7 +7493,7 @@ to only use if you've limited input to a single pointer (i.e. mouse or touch)

    Source:
    @@ -7574,7 +7611,7 @@ to only use if you've limited input to a single pointer (i.e. mouse or touch)

    Source:
    @@ -7648,7 +7685,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 05 2014 06:28:30 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:46 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.InputHandler.html b/docs/Phaser.InputHandler.html index d9e43038..279238bb 100644 --- a/docs/Phaser.InputHandler.html +++ b/docs/Phaser.InputHandler.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -2922,7 +2956,7 @@ For example if you had a stack of 6 sprites with the same priority IDs and one c
    Source:
    @@ -2991,7 +3025,7 @@ For example if you had a stack of 6 sprites with the same priority IDs and one c
    Source:
    @@ -3133,7 +3167,7 @@ It compares the alpha value of the pixel and if >= InputHandler.pixelPerfectA
    Source:
    @@ -3431,7 +3465,7 @@ It compares the alpha value of the pixel and if >= InputHandler.pixelPerfectA
    Source:
    @@ -3500,7 +3534,7 @@ It compares the alpha value of the pixel and if >= InputHandler.pixelPerfectA
    Source:
    @@ -3618,7 +3652,7 @@ It compares the alpha value of the pixel and if >= InputHandler.pixelPerfectA
    Source:
    @@ -3974,7 +4008,7 @@ It compares the alpha value of the pixel and if >= InputHandler.pixelPerfectA
    Source:
    @@ -4300,7 +4334,7 @@ For example 16x16 as the snapX and snapY would make the sprite snap to every 16
    Source:
    @@ -4441,7 +4475,7 @@ For example 16x16 as the snapX and snapY would make the sprite snap to every 16
    Source:
    @@ -4601,7 +4635,7 @@ For example 16x16 as the snapX and snapY would make the sprite snap to every 16
    Source:
    @@ -4761,7 +4795,7 @@ For example 16x16 as the snapX and snapY would make the sprite snap to every 16
    Source:
    @@ -4921,7 +4955,7 @@ For example 16x16 as the snapX and snapY would make the sprite snap to every 16
    Source:
    @@ -5058,7 +5092,7 @@ For example 16x16 as the snapX and snapY would make the sprite snap to every 16
    Source:
    @@ -6876,7 +6910,7 @@ This value is only set when the pointer is over this Sprite.

    Source:
    @@ -7158,7 +7192,7 @@ This value is only set when the pointer is over this Sprite.

    Source:
    @@ -7345,7 +7379,7 @@ This value is only set when the pointer is over this Sprite.

    Source:
    @@ -7463,7 +7497,7 @@ This value is only set when the pointer is over this Sprite.

    Source:
    @@ -7581,7 +7615,7 @@ This value is only set when the pointer is over this Sprite.

    Source:
    @@ -7651,7 +7685,7 @@ This value is only set when the pointer is over this Sprite.

    Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:30 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:46 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Key.html b/docs/Phaser.Key.html index 1f8e66e1..e7c81147 100644 --- a/docs/Phaser.Key.html +++ b/docs/Phaser.Key.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -2530,7 +2564,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 05 2014 06:28:30 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:47 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Keyboard.html b/docs/Phaser.Keyboard.html index 3e720486..38a54649 100644 --- a/docs/Phaser.Keyboard.html +++ b/docs/Phaser.Keyboard.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -2957,7 +2991,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 05 2014 06:28:30 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:47 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Line.html b/docs/Phaser.Line.html index 5f974cbf..78ac8afe 100644 --- a/docs/Phaser.Line.html +++ b/docs/Phaser.Line.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -3053,7 +3087,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 05 2014 06:28:30 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:47 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.LinkedList.html b/docs/Phaser.LinkedList.html index 8f1018e0..e55a3b05 100644 --- a/docs/Phaser.LinkedList.html +++ b/docs/Phaser.LinkedList.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -1449,7 +1483,7 @@ The function must exist on the member.

    Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:30 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:47 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Loader.html b/docs/Phaser.Loader.html index eca96ed4..958fb0d5 100644 --- a/docs/Phaser.Loader.html +++ b/docs/Phaser.Loader.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -7133,7 +7167,7 @@ This allows you to easily make loading bars for games.

    Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:30 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:47 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.LoaderParser.html b/docs/Phaser.LoaderParser.html index e5052246..0a8b82cc 100644 --- a/docs/Phaser.LoaderParser.html +++ b/docs/Phaser.LoaderParser.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -681,7 +715,7 @@ Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:31 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:47 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.MSPointer.html b/docs/Phaser.MSPointer.html index 1726c1aa..4ac95b71 100644 --- a/docs/Phaser.MSPointer.html +++ b/docs/Phaser.MSPointer.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -1399,7 +1433,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 05 2014 06:28:31 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:48 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Math.html b/docs/Phaser.Math.html index 41f67fbc..0ca5ab5e 100644 --- a/docs/Phaser.Math.html +++ b/docs/Phaser.Math.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -11177,7 +11211,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 05 2014 06:28:31 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:47 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Mouse.html b/docs/Phaser.Mouse.html index 03806212..a37f803a 100644 --- a/docs/Phaser.Mouse.html +++ b/docs/Phaser.Mouse.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -2716,7 +2750,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 05 2014 06:28:31 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:48 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Net.html b/docs/Phaser.Net.html index 5c69959d..b0d74dbb 100644 --- a/docs/Phaser.Net.html +++ b/docs/Phaser.Net.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -1343,7 +1377,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 05 2014 06:28:31 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:48 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Particles.Arcade.Emitter.html b/docs/Phaser.Particles.Arcade.Emitter.html index bc65c282..b09f7512 100644 --- a/docs/Phaser.Particles.Arcade.Emitter.html +++ b/docs/Phaser.Particles.Arcade.Emitter.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -797,7 +831,7 @@ at set intervals, and fixes their positions and velocities accorindgly.

    Source:
    @@ -874,7 +908,16 @@ at set intervals, and fixes their positions and velocities accorindgly.

    Gets or sets the alpha value of the Emitter.

    +

    Gets or sets the alpha value of the Emitter. +Object.defineProperty(Phaser.Particles.Arcade.Emitter.prototype, "alpha", {

    +
    get: function () {
    +    return this._container.alpha;
    +},
    +
    +set: function (value) {
    +    this._container.alpha = value;
    +}
    +

    });

    @@ -1015,7 +1058,7 @@ This will have no impact on the rotation value of its children, but it will upda
    Source:
    @@ -1436,7 +1479,7 @@ The cursor is set to the first child added to the Group and doesn't change unles
    Source:
    @@ -2083,113 +2126,6 @@ Emitter.emitX and Emitter.emitY control the emission location relative to the x/ - - - - - - - - -
    -

    group

    - - -
    -
    - - - - - -
    - - -
    Properties:
    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    group - - -Phaser.Group - - - -

    The parent Group of this Group, if a child of another.

    -
    - - - - - - - - -
    Inherited From:
    -
    - - - - - - - - - - - - - -
    Source:
    -
    - - - - - - -
    @@ -2495,7 +2431,7 @@ Emitter.emitX and Emitter.emitY control the emission location relative to the x/
    Source:
    @@ -3749,113 +3685,6 @@ Emitter.emitX and Emitter.emitY control the emission location relative to the x/ - - - - - - - - -
    -

    pivot

    - - -
    -
    - - - - - -
    - - -
    Properties:
    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    pivot - - -Phaser.Point - - - -

    The pivot point of the Group container.

    -
    - - - - - - - - -
    Inherited From:
    -
    - - - - - - - - - - - - - -
    Source:
    -
    - - - - - - -
    @@ -4061,7 +3890,7 @@ This will have no impact on the rotation value of its children, but it will upda
    Source:
    @@ -4134,7 +3963,7 @@ This will have no impact on the rotation value of its children, but it will upda -

    The scane of the Group container.

    +

    The scale of the Group container.

    @@ -4168,7 +3997,7 @@ This will have no impact on the rotation value of its children, but it will upda
    Source:
    @@ -4377,7 +4206,7 @@ This will have no impact on the rotation value of its children, but it will upda
    Source:
    @@ -4556,7 +4385,16 @@ This will have no impact on the rotation value of its children, but it will upda -

    Gets or sets the Emitter visible state.

    +

    Gets or sets the Emitter visible state. +Object.defineProperty(Phaser.Particles.Arcade.Emitter.prototype, "visible", {

    +
    get: function () {
    +    return this._container.visible;
    +},
    +
    +set: function (value) {
    +    this._container.visible = value;
    +}
    +

    });

    @@ -4585,7 +4423,7 @@ This will have no impact on the rotation value of its children, but it will upda
    Source:
    @@ -4792,7 +4630,7 @@ This will have no impact on the rotation value of its children, but it will upda
    Source:
    @@ -5225,7 +5063,7 @@ that then see the addAt method.

    Source:
    @@ -5450,7 +5288,7 @@ Group.addAll('x', 10) will add 10 to the child.x value.

    Source:
    @@ -5597,7 +5435,7 @@ The child is added to the Group at the location specified by the index value, th
    Source:
    @@ -5864,7 +5702,7 @@ The child is added to the Group at the location specified by the index value, th
    Source:
    @@ -6103,7 +5941,7 @@ After the method parameter and context you can add as many extra parameters as y
    Source:
    @@ -6301,7 +6139,7 @@ After the existsValue parameter you can add as many parameters as you like, whic
    Source:
    @@ -6470,81 +6308,7 @@ After the existsValue parameter you can add as many parameters as you like, whic
    Source:
    - - - - - - - - - - - - - - - - - - - - - - - - - -
    -

    childTest()

    - - -
    -
    - - -
    -

    Internal test.

    -
    - - - - - - - - - -
    - - - - - - - -
    Inherited From:
    -
    - - - - - - - - - - - - - -
    Source:
    -
    @@ -6618,7 +6382,7 @@ After the existsValue parameter you can add as many parameters as you like, whic
    Source:
    @@ -6715,7 +6479,7 @@ After the existsValue parameter you can add as many parameters as you like, whic
    Source:
    @@ -7027,7 +6791,7 @@ Useful if you don't need to create the Sprite instances before-hand.

    Source:
    @@ -7305,7 +7069,7 @@ and will be positioned at 0, 0 (relative to the Group.x/y)

    Source:
    @@ -7448,7 +7212,7 @@ and will be positioned at 0, 0 (relative to the Group.x/y)

    Source:
    @@ -7641,7 +7405,7 @@ Group.divideAll('x', 2) will half the child.x value.

    Source:
    @@ -7882,7 +7646,7 @@ Note: Currently this will skip any children which are Groups themselves.

    Source:
    @@ -8030,7 +7794,7 @@ For example: Group.forEachAlive(causeDamage, this, 500)

    Source:
    @@ -8178,7 +7942,7 @@ For example: Group.forEachAlive(causeDamage, this, 500)

    Source:
    @@ -8326,7 +8090,7 @@ For example: Group.forEachDead(bringToLife, this)

    Source:
    @@ -8449,7 +8213,7 @@ For example: Group.forEachDead(bringToLife, this)

    Source:
    @@ -8547,7 +8311,7 @@ This is handy for checking if everything has been wiped out, or choosing a squad
    Source:
    @@ -8645,7 +8409,7 @@ This is handy for checking if everything has been wiped out, or choosing a squad
    Source:
    @@ -8791,7 +8555,7 @@ This is handy for checking if everything has been wiped out, or choosing a squad
    Source:
    @@ -8937,7 +8701,7 @@ This is handy for checking if everything has been wiped out, or choosing a squad
    Source:
    @@ -9106,7 +8870,7 @@ This is handy for checking if everything has been wiped out, or choosing a squad
    Source:
    @@ -9416,7 +9180,7 @@ You can add as many callback parameters as you like, which will all be passed to
    Source:
    @@ -10012,7 +9776,7 @@ Group.multiplyAll('x', 2) will x2 the child.x value.

    Source:
    @@ -10086,7 +9850,7 @@ Group.multiplyAll('x', 2) will x2 the child.x value.

    Source:
    @@ -10160,7 +9924,7 @@ Group.multiplyAll('x', 2) will x2 the child.x value.

    Source:
    @@ -10283,7 +10047,7 @@ Group.multiplyAll('x', 2) will x2 the child.x value.

    Source:
    @@ -10381,7 +10145,7 @@ The Group container remains on the display list.

    Source:
    @@ -10527,7 +10291,7 @@ The Group container remains on the display list.

    Source:
    @@ -10673,7 +10437,7 @@ The Group container remains on the display list.

    Source:
    @@ -11069,7 +10833,7 @@ The operation parameter controls how the new value is assigned to the property,
    Source:
    @@ -11361,7 +11125,7 @@ The operation parameter controls how the new value is assigned to the property,
    Source:
    @@ -11609,7 +11373,7 @@ The operation parameter controls how the new value is assigned to the property,
    Source:
    @@ -12464,7 +12228,7 @@ For example to depth sort Sprites for Zelda-style game you might call grou
    Source:
    @@ -12912,7 +12676,7 @@ Group.subAll('x', 10) will minus 10 from the child.x value.

    Source:
    @@ -12940,7 +12704,7 @@ Group.subAll('x', 10) will minus 10 from the child.x value.

    -

    swap(child1, child2) → {boolean}

    +

    swap(child1, child2)

    @@ -13059,104 +12823,7 @@ You cannot swap a child with itself, or swap un-parented children, doing so will
    Source:
    - - - - - - - -
    - - - - - - - - - - - -
    Returns:
    - - -
    -

    True if the swap was successful, otherwise false.

    -
    - - - -
    -
    - Type -
    -
    - -boolean - - -
    -
    - - - - - -
    - - - -
    -

    swapIndex()

    - - -
    -
    - - -
    -

    Internal test.

    -
    - - - - - - - - - -
    - - - - - - - -
    Inherited From:
    -
    - - - - - - - - - - - - - -
    Source:
    -
    @@ -13276,7 +12943,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 05 2014 06:28:31 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:48 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Particles.html b/docs/Phaser.Particles.html index 293c88e1..5c788d0f 100644 --- a/docs/Phaser.Particles.html +++ b/docs/Phaser.Particles.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -1232,7 +1266,7 @@ Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:31 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:48 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Physics.Arcade.Body.html b/docs/Phaser.Physics.Arcade.Body.html index fb9cd106..9472bab6 100644 --- a/docs/Phaser.Physics.Arcade.Body.html +++ b/docs/Phaser.Physics.Arcade.Body.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -5522,7 +5556,7 @@ touching.up = true means the collision happened to the top of this Body for exam
    Source:
    @@ -5624,7 +5658,7 @@ touching.up = true means the collision happened to the top of this Body for exam
    Source:
    @@ -5738,7 +5772,7 @@ touching.up = true means the collision happened to the top of this Body for exam
    Source:
    @@ -5856,7 +5890,7 @@ touching.up = true means the collision happened to the top of this Body for exam
    Source:
    @@ -5948,7 +5982,7 @@ touching.up = true means the collision happened to the top of this Body for exam
    Source:
    @@ -6017,7 +6051,7 @@ touching.up = true means the collision happened to the top of this Body for exam
    Source:
    @@ -6086,7 +6120,7 @@ touching.up = true means the collision happened to the top of this Body for exam
    Source:
    @@ -6178,7 +6212,7 @@ touching.up = true means the collision happened to the top of this Body for exam
    Source:
    @@ -6270,7 +6304,7 @@ touching.up = true means the collision happened to the top of this Body for exam
    Source:
    @@ -6362,7 +6396,7 @@ touching.up = true means the collision happened to the top of this Body for exam
    Source:
    @@ -6480,7 +6514,7 @@ touching.up = true means the collision happened to the top of this Body for exam
    Source:
    @@ -6549,7 +6583,7 @@ touching.up = true means the collision happened to the top of this Body for exam
    Source:
    @@ -6641,7 +6675,7 @@ touching.up = true means the collision happened to the top of this Body for exam
    Source:
    @@ -6805,7 +6839,7 @@ touching.up = true means the collision happened to the top of this Body for exam
    Source:
    @@ -6950,7 +6984,7 @@ If it returns false this will be skipped and must be handled manually.

    Source:
    @@ -7095,7 +7129,7 @@ If it returns false this will be skipped and must be handled manually.

    Source:
    @@ -7240,7 +7274,7 @@ If it returns false this will be skipped and must be handled manually.

    Source:
    @@ -7385,7 +7419,7 @@ If it returns false this will be skipped and must be handled manually.

    Source:
    @@ -7503,7 +7537,7 @@ If it returns false this will be skipped and must be handled manually.

    Source:
    @@ -7595,7 +7629,7 @@ If it returns false this will be skipped and must be handled manually.

    Source:
    @@ -7664,7 +7698,7 @@ If it returns false this will be skipped and must be handled manually.

    Source:
    @@ -7756,7 +7790,7 @@ If it returns false this will be skipped and must be handled manually.

    Source:
    @@ -7920,7 +7954,7 @@ If it returns false this will be skipped and must be handled manually.

    Source:
    @@ -8012,7 +8046,7 @@ If it returns false this will be skipped and must be handled manually.

    Source:
    @@ -8199,7 +8233,7 @@ If it returns false this will be skipped and must be handled manually.

    Source:
    @@ -8363,7 +8397,7 @@ If it returns false this will be skipped and must be handled manually.

    Source:
    @@ -8481,7 +8515,7 @@ If it returns false this will be skipped and must be handled manually.

    Source:
    @@ -8643,7 +8677,7 @@ Also resets the forces to defaults: gravity, bounce, minVelocity,maxVelocity, an
    Source:
    @@ -8785,7 +8819,7 @@ It assumes they have already been overlap checked and the resulting overlap is s
    Source:
    @@ -9021,7 +9055,7 @@ The Circle will be centered on the center of the Sprite by default, but can be a
    Source:
    @@ -9153,7 +9187,7 @@ Use Body.translate and/or Body.offset to re-position the polygon from the Sprite
    Source:
    @@ -9383,7 +9417,7 @@ If you don't specify any parameters it will be sized to match the parent Sprites
    Source:
    @@ -9524,7 +9558,7 @@ If you don't specify any parameters it will be sized to match the parent Sprites
    Source:
    @@ -9642,7 +9676,7 @@ If you don't specify any parameters it will be sized to match the parent Sprites
    Source:
    @@ -9783,7 +9817,7 @@ If you don't specify any parameters it will be sized to match the parent Sprites
    Source:
    @@ -9925,7 +9959,7 @@ See also the Body.offset property.

    Source:
    @@ -9994,7 +10028,7 @@ See also the Body.offset property.

    Source:
    @@ -10114,7 +10148,7 @@ See also the Body.offset property.

    Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:32 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:48 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Physics.Arcade.html b/docs/Phaser.Physics.Arcade.html index b048804c..2d301976 100644 --- a/docs/Phaser.Physics.Arcade.html +++ b/docs/Phaser.Physics.Arcade.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -2040,7 +2074,7 @@ Note: The display object doesn't stop moving once it reaches the destination coo
    Source:
    @@ -2354,7 +2388,7 @@ Note: The display object doesn't stop moving once it reaches the destination coo
    Source:
    @@ -2701,7 +2735,7 @@ Note: The display object doesn't stop moving once it reaches the destination coo
    Source:
    @@ -2938,7 +2972,7 @@ One way to use this is: accelerationFromRotation(rotation, 200, sprite.accelerat
    Source:
    @@ -3104,7 +3138,7 @@ One way to use this is: accelerationFromRotation(rotation, 200, sprite.accelerat
    Source:
    @@ -3288,7 +3322,7 @@ One way to use this is: accelerationFromRotation(rotation, 200, sprite.accelerat
    Source:
    @@ -3475,7 +3509,7 @@ One way to use this is: accelerationFromRotation(rotation, 200, sprite.accelerat
    Source:
    @@ -4113,7 +4147,7 @@ The collideCallback is an optional function that is only called if two sprites c
    Source:
    @@ -4299,7 +4333,7 @@ If you need to calculate from the center of a display object instead use the met
    Source:
    @@ -4488,7 +4522,7 @@ If you need to calculate from the center of a display object instead use the met
    Source:
    @@ -4653,7 +4687,7 @@ Objects must expose properties: width, height, left, right, top, bottom.

    Source:
    @@ -4928,7 +4962,7 @@ Note: Doesn't take into account acceleration, maxVelocity or drag (if you've set
    Source:
    @@ -5204,7 +5238,7 @@ Note: The display object doesn't stop moving once it reaches the destination coo
    Source:
    @@ -5514,7 +5548,7 @@ Note: Doesn't take into account acceleration, maxVelocity or drag (if you've set
    Source:
    @@ -5980,7 +6014,7 @@ The second parameter can be an array of objects, of differing types.

    Source:
    @@ -6248,7 +6282,7 @@ The second parameter can be an array of objects, of differing types.

    Source:
    @@ -6412,7 +6446,7 @@ The second parameter can be an array of objects, of differing types.

    Source:
    @@ -6576,7 +6610,7 @@ The second parameter can be an array of objects, of differing types.

    Source:
    @@ -7393,7 +7427,7 @@ Objects must expose properties: width, height, left, right, top, bottom.

    Source:
    @@ -7748,7 +7782,7 @@ One way to use this is: velocityFromAngle(angle, 200, sprite.velocity) which wil
    Source:
    @@ -7987,7 +8021,7 @@ One way to use this is: velocityFromRotation(rotation, 200, sprite.velocity) whi
    Source:
    @@ -8063,7 +8097,7 @@ One way to use this is: velocityFromRotation(rotation, 200, sprite.velocity) whi Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:32 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:48 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Physics.html b/docs/Phaser.Physics.html index 9379c4c4..59c96ebd 100644 --- a/docs/Phaser.Physics.html +++ b/docs/Phaser.Physics.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -539,7 +573,7 @@ Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:32 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:48 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Plugin.html b/docs/Phaser.Plugin.html index 4816bc54..7d4db35b 100644 --- a/docs/Phaser.Plugin.html +++ b/docs/Phaser.Plugin.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -1906,7 +1940,7 @@ It is only called if active is set to true.

    Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:32 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:49 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.PluginManager.html b/docs/Phaser.PluginManager.html index 8e608895..4dfc6426 100644 --- a/docs/Phaser.PluginManager.html +++ b/docs/Phaser.PluginManager.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -1571,7 +1605,7 @@ It only calls plugins who have active=true.

    Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:32 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:49 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Point.html b/docs/Phaser.Point.html index 3290f887..4846788a 100644 --- a/docs/Phaser.Point.html +++ b/docs/Phaser.Point.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -963,7 +997,7 @@
    Source:
    @@ -1178,7 +1212,7 @@
    Source:
    @@ -1393,7 +1427,7 @@
    Source:
    @@ -1557,7 +1591,7 @@
    Source:
    @@ -1772,7 +1806,7 @@
    Source:
    @@ -2028,7 +2062,7 @@
    Source:
    @@ -2243,7 +2277,7 @@
    Source:
    @@ -2407,7 +2441,7 @@
    Source:
    @@ -2571,7 +2605,7 @@
    Source:
    @@ -2735,7 +2769,7 @@
    Source:
    @@ -2899,7 +2933,7 @@
    Source:
    @@ -3052,7 +3086,7 @@
    Source:
    @@ -3334,7 +3368,7 @@
    Source:
    @@ -3518,7 +3552,7 @@
    Source:
    @@ -3682,7 +3716,7 @@
    Source:
    @@ -3823,7 +3857,7 @@
    Source:
    @@ -3915,7 +3949,7 @@
    Source:
    @@ -4056,7 +4090,7 @@
    Source:
    @@ -4240,7 +4274,7 @@
    Source:
    @@ -4404,7 +4438,7 @@
    Source:
    @@ -4496,7 +4530,7 @@
    Source:
    @@ -4773,7 +4807,7 @@
    Source:
    @@ -4819,6 +4853,170 @@ +
    + + + +
    +

    set(x, y) → {Point}

    + + +
    +
    + + +
    +

    Sets the x and y values of this Point object to the given coordinates.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    x + + +number + + + +

    The horizontal position of this point.

    y + + +number + + + +

    The vertical position of this point.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    This Point object. Useful for chaining method calls.

    +
    + + + +
    +
    + Type +
    +
    + +Point + + +
    +
    + + + + +
    @@ -5101,7 +5299,7 @@
    Source:
    @@ -5193,7 +5391,7 @@
    Source:
    @@ -5267,7 +5465,7 @@ Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:32 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:49 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Pointer.html b/docs/Phaser.Pointer.html index 260e519c..70b8cd52 100644 --- a/docs/Phaser.Pointer.html +++ b/docs/Phaser.Pointer.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -4354,7 +4388,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 05 2014 06:28:32 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:49 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Polygon.html b/docs/Phaser.Polygon.html index 026558c8..7797450a 100644 --- a/docs/Phaser.Polygon.html +++ b/docs/Phaser.Polygon.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -699,7 +733,7 @@ arguments passed can be flat x,y values e.g. new PIXI.Polygon(x,y, x,y, x, Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:33 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:49 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.QuadTree.html b/docs/Phaser.QuadTree.html index 83f23cd6..c848fba7 100644 --- a/docs/Phaser.QuadTree.html +++ b/docs/Phaser.QuadTree.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -1620,7 +1654,7 @@ Split the node into 4 subnodes

    Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:33 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:49 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.RandomDataGenerator.html b/docs/Phaser.RandomDataGenerator.html index 6e2c5b66..eb68cbd9 100644 --- a/docs/Phaser.RandomDataGenerator.html +++ b/docs/Phaser.RandomDataGenerator.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -2037,7 +2071,7 @@ Random number generator from Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:33 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:49 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Rectangle.html b/docs/Phaser.Rectangle.html index 0472e0e8..ced47c37 100644 --- a/docs/Phaser.Rectangle.html +++ b/docs/Phaser.Rectangle.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -432,7 +466,7 @@
    -

    new Rectangle(x, y, width, height) → {Rectangle}

    +

    new Rectangle(x, y, width, height) → {Phaser.Rectangle}

    @@ -627,7 +661,7 @@
    -Rectangle +Phaser.Rectangle
    @@ -746,7 +780,7 @@
    Source:
    @@ -764,7 +798,7 @@
    -

    bottom

    +

    bottomRight

    @@ -852,7 +886,7 @@
    Source:
    @@ -958,7 +992,7 @@
    Source:
    @@ -1064,7 +1098,7 @@
    Source:
    @@ -1171,7 +1205,7 @@ If set to true then all of the Rectangle properties are set to 0.

    Source:
    @@ -1273,7 +1307,7 @@ If set to true then all of the Rectangle properties are set to 0.

    Source:
    @@ -1375,7 +1409,7 @@ If set to true then all of the Rectangle properties are set to 0.

    Source:
    @@ -1583,7 +1617,7 @@ If set to true then all of the Rectangle properties are set to 0.

    Source:
    @@ -1689,7 +1723,7 @@ If set to true then all of the Rectangle properties are set to 0.

    Source:
    @@ -1795,7 +1829,7 @@ If set to true then all of the Rectangle properties are set to 0.

    Source:
    @@ -1902,7 +1936,7 @@ However it does affect the height property, whereas changing the y value does no
    Source:
    @@ -2008,7 +2042,7 @@ However it does affect the height property, whereas changing the y value does no
    Source:
    @@ -2114,7 +2148,7 @@ However it does affect the height property, whereas changing the y value does no
    Source:
    @@ -2577,7 +2611,7 @@ However it does affect the height property, whereas changing the y value does no
    Source:
    @@ -2760,7 +2794,7 @@ However it does affect the height property, whereas changing the y value does no
    Source:
    @@ -2924,7 +2958,263 @@ However it does affect the height property, whereas changing the y value does no
    Source:
    + + + + + + + + + + + + + + + + + + + +
    Returns:
    + + +
    +

    A value of true if the Rectangle object contains the specified point; otherwise false.

    +
    + + + +
    +
    + Type +
    +
    + +boolean + + +
    +
    + + + + + + + + + +
    +

    <static> containsRaw(rx, ry, rw, rh, x, y) → {boolean}

    + + +
    +
    + + +
    +

    Determines whether the specified coordinates are contained within the region defined by the given raw values.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    rx + + +number + + + +

    The x coordinate of the top left of the area.

    ry + + +number + + + +

    The y coordinate of the top left of the area.

    rw + + +number + + + +

    The width of the area.

    rh + + +number + + + +

    The height of the area.

    x + + +number + + + +

    The x coordinate of the point to test.

    y + + +number + + + +

    The y coordinate of the point to test.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    @@ -3089,7 +3379,7 @@ A Rectangle object is said to contain another if the second Rectangle object fal
    Source:
    @@ -3254,7 +3544,7 @@ This method compares the x, y, width and height properties of each Rectangle.

    Source:
    @@ -3441,7 +3731,7 @@ This method compares the x, y, width and height properties of each Rectangle.

    Source:
    @@ -3605,7 +3895,7 @@ This method compares the x, y, width and height properties of each Rectangle.

    Source:
    @@ -3656,7 +3946,7 @@ This method compares the x, y, width and height properties of each Rectangle.

    -

    <static> intersection(a, b, out) → {Phaser.Rectangle}

    +

    <static> intersection(a, b, output) → {Phaser.Rectangle}

    @@ -3762,7 +4052,7 @@ This method compares the x, y, width and height properties of each Rectangle.

    - out + output @@ -3820,7 +4110,7 @@ This method compares the x, y, width and height properties of each Rectangle.

    Source:
    @@ -3985,7 +4275,7 @@ This method checks the x, y, width, and height properties of the Rectangles.

    Source:
    @@ -4218,7 +4508,7 @@ This method checks the x, y, width, and height properties of the Rectangles.

    Source:
    @@ -4402,7 +4692,7 @@ This method checks the x, y, width, and height properties of the Rectangles.

    Source:
    @@ -4453,7 +4743,7 @@ This method checks the x, y, width, and height properties of the Rectangles.

    -

    <static> union(a, b, out) → {Phaser.Rectangle}

    +

    <static> union(a, b, output) → {Phaser.Rectangle}

    @@ -4559,7 +4849,7 @@ This method checks the x, y, width, and height properties of the Rectangles.

    - out + output @@ -4617,7 +4907,7 @@ This method checks the x, y, width, and height properties of the Rectangles.

    Source:
    @@ -4770,7 +5060,7 @@ This method checks the x, y, width, and height properties of the Rectangles.

    Source:
    @@ -4930,7 +5220,7 @@ This method checks the x, y, width, and height properties of the Rectangles.

    Source:
    @@ -5072,7 +5362,7 @@ A Rectangle object is said to contain another if the second Rectangle object fal
    Source:
    @@ -5123,7 +5413,7 @@ A Rectangle object is said to contain another if the second Rectangle object fal
    -

    copyFrom(source) → {Rectangle}

    +

    copyFrom(source) → {Phaser.Rectangle}

    @@ -5213,7 +5503,7 @@ A Rectangle object is said to contain another if the second Rectangle object fal
    Source:
    @@ -5249,7 +5539,7 @@ A Rectangle object is said to contain another if the second Rectangle object fal
    -Rectangle +Phaser.Rectangle
    @@ -5354,7 +5644,7 @@ A Rectangle object is said to contain another if the second Rectangle object fal
    Source:
    @@ -5496,7 +5786,7 @@ This method compares the x, y, width and height properties of each Rectangle.

    Source:
    @@ -5588,7 +5878,7 @@ This method compares the x, y, width and height properties of each Rectangle.

    Source:
    @@ -5657,7 +5947,7 @@ This method compares the x, y, width and height properties of each Rectangle.

    Source:
    @@ -5798,7 +6088,7 @@ This method compares the x, y, width and height properties of each Rectangle.

    Source:
    @@ -5962,7 +6252,7 @@ This method compares the x, y, width and height properties of each Rectangle.

    Source:
    @@ -6127,7 +6417,7 @@ This method checks the x, y, width, and height properties of the Rectangles.

    Source:
    @@ -6360,7 +6650,7 @@ This method checks the x, y, width, and height properties of the Rectangles.

    Source:
    @@ -6411,7 +6701,7 @@ This method checks the x, y, width, and height properties of the Rectangles.

    -

    offset(dx, dy) → {Rectangle}

    +

    offset(dx, dy) → {Phaser.Rectangle}

    @@ -6560,7 +6850,7 @@ This method checks the x, y, width, and height properties of the Rectangles.

    -Rectangle +Phaser.Rectangle
    @@ -6575,7 +6865,7 @@ This method checks the x, y, width, and height properties of the Rectangles.

    -

    offsetPoint(point) → {Rectangle}

    +

    offsetPoint(point) → {Phaser.Rectangle}

    @@ -6623,7 +6913,7 @@ This method checks the x, y, width, and height properties of the Rectangles.

    -Point +Phaser.Point @@ -6701,7 +6991,7 @@ This method checks the x, y, width, and height properties of the Rectangles.

    -Rectangle +Phaser.Rectangle
    @@ -6716,7 +7006,7 @@ This method checks the x, y, width, and height properties of the Rectangles.

    -

    setTo(x, y, width, height) → {Rectangle}

    +

    setTo(x, y, width, height) → {Phaser.Rectangle}

    @@ -6875,7 +7165,7 @@ This method checks the x, y, width, and height properties of the Rectangles.

    Source:
    @@ -6911,7 +7201,7 @@ This method checks the x, y, width, and height properties of the Rectangles.

    -Rectangle +Phaser.Rectangle
    @@ -7028,7 +7318,7 @@ This method checks the x, y, width, and height properties of the Rectangles.

    Source:
    @@ -7120,7 +7410,7 @@ This method checks the x, y, width, and height properties of the Rectangles.

    Source:
    @@ -7304,7 +7594,7 @@ This method checks the x, y, width, and height properties of the Rectangles.

    Source:
    @@ -7378,7 +7668,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 05 2014 06:28:33 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:50 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.RenderTexture.html b/docs/Phaser.RenderTexture.html index d3854fb4..631e8769 100644 --- a/docs/Phaser.RenderTexture.html +++ b/docs/Phaser.RenderTexture.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -591,7 +625,7 @@
    Source:
    @@ -719,7 +753,109 @@
    Source:
    + + + + + + + +
    + + + +
    + + + +
    +

    game

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    game + + +Phaser.Game + + + +

    A reference to the currently running game.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    @@ -923,7 +1059,7 @@
    Source:
    @@ -1025,7 +1161,109 @@
    Source:
    + + + + + + + +
    + + + +
    + + + +
    +

    key

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    key + + +string + + + +

    The key of the RenderTexture in the Cache, if stored there.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    @@ -1127,7 +1365,7 @@
    Source:
    @@ -1229,7 +1467,109 @@
    Source:
    + + + + + + + +
    + + + +
    + + + +
    +

    type

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    type + + +number + + + +

    Base Phaser object type.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    @@ -1331,7 +1671,7 @@
    Source:
    @@ -1577,7 +1917,7 @@ draw all children as well.

    Source:
    @@ -1860,7 +2200,7 @@ If the display object is a Group or has children it will draw all children as we
    Source:
    @@ -1929,7 +2269,1930 @@ If the display object is a Group or has children it will draw all children as we
    Source:
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +

    Class: RenderTexture

    +
    + +
    +

    + Phaser. + + RenderTexture +

    + +

    Phaser.RenderTexture

    + +
    + +
    +
    + + + + +
    +

    new RenderTexture(game, key, width, height)

    + + +
    +
    + + +
    +

    A RenderTexture is a special texture that allows any displayObject to be rendered to it.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeArgumentDefaultDescription
    game + + +Phaser.Game + + + + + + + + + + + +

    Current game instance.

    key + + +string + + + + + + + + + + + +

    Internal Phaser reference key for the render texture.

    width + + +number + + + + + + <optional>
    + + + + + +
    + + 100 + +

    The width of the render texture.

    height + + +number + + + + + + <optional>
    + + + + + +
    + + 100 + +

    The height of the render texture.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + +
    + + + + + + + + + + + + +

    Members

    + +
    + +
    +

    frame

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    frame + + +PIXI.Rectangle + + + +

    The frame for this texture.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    game

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    game + + +Phaser.Game + + + +

    A reference to the currently running game.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    game

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    game + + +Phaser.Game + + + +

    A reference to the currently running game.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    height

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    height + + +number + + + +

    the height.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    indetityMatrix

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    indetityMatrix + + +PIXI.mat3 + + + +

    Matrix object.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    key

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    key + + +string + + + +

    The key of the RenderTexture in the Cache, if stored there.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    name

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    name + + +string + + + +

    the name of the object.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    type

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    type + + +number + + + +

    Base Phaser object type.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    type

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    type + + +number + + + +

    Base Phaser object type.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    width

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    width + + +number + + + +

    the width.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + +
    + + + +

    Methods

    + +
    + +
    +

    render(displayObject, position, clear, renderHidden)

    + + +
    +
    + + +
    +

    This function will draw the display object to the texture. If the display object is a Group or has children it will +draw all children as well.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeArgumentDefaultDescription
    displayObject + + +DisplayObject + + + + + + + + + + + +

    The display object to render this texture on.

    position + + +Phaser.Point + + + + + + <optional>
    + + + + + +
    + +

    Where to draw the display object.

    clear + + +boolean + + + + + + <optional>
    + + + + + +
    + + false + +

    If true the texture will be cleared before the displayObject is drawn.

    renderHidden + + +boolean + + + + + + <optional>
    + + + + + +
    + + false + +

    If true displayObjects that have their visible property set to false will still be rendered.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    renderXY(displayObject, x, y, clear, renderHidden)

    + + +
    +
    + + +
    +

    This function will draw the display object to the texture at the given x/y coordinates. +If the display object is a Group or has children it will draw all children as well.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeArgumentDefaultDescription
    displayObject + + +DisplayObject + + + + + + + + + + + +

    The display object to render this texture on.

    x + + +number + + + + + + + + + + + +

    The x coordinate to draw the display object at.

    y + + +number + + + + + + + + + + + +

    The y coordinate to draw the display object at.

    clear + + +boolean + + + + + + <optional>
    + + + + + +
    + + false + +

    If true the texture will be cleared before the displayObject is drawn.

    renderHidden + + +boolean + + + + + + <optional>
    + + + + + +
    + + false + +

    If true displayObjects that have their visible property set to false will still be rendered.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    resize()

    + + +
    +
    + + +
    +

    Resizes the RenderTexture.

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    @@ -1980,7 +4243,7 @@ If the display object is a Group or has children it will draw all children as we Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:33 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:50 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.RequestAnimationFrame.html b/docs/Phaser.RequestAnimationFrame.html index 724525ad..91a68ab3 100644 --- a/docs/Phaser.RequestAnimationFrame.html +++ b/docs/Phaser.RequestAnimationFrame.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -1303,7 +1337,7 @@ Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:33 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:50 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Signal.html b/docs/Phaser.Signal.html index 176d68b9..28377b51 100644 --- a/docs/Phaser.Signal.html +++ b/docs/Phaser.Signal.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -2288,7 +2322,7 @@ IMPORTANT: should be called only during signal dispatch, calling it before/after Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:33 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:50 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.SinglePad.html b/docs/Phaser.SinglePad.html index 5452d373..f1abb223 100644 --- a/docs/Phaser.SinglePad.html +++ b/docs/Phaser.SinglePad.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -3775,7 +3809,7 @@ analog trigger buttons on the XBOX 360 controller

    Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:33 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:50 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Sound.html b/docs/Phaser.Sound.html index c8bf2e3f..f44b1490 100644 --- a/docs/Phaser.Sound.html +++ b/docs/Phaser.Sound.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -5799,7 +5833,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 05 2014 06:28:34 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:50 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.SoundManager.html b/docs/Phaser.SoundManager.html index 4c50e2f2..1c61d2bf 100644 --- a/docs/Phaser.SoundManager.html +++ b/docs/Phaser.SoundManager.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -2857,7 +2891,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 05 2014 06:28:34 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:50 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Sprite.html b/docs/Phaser.Sprite.html index 8338ac67..740daa40 100644 --- a/docs/Phaser.Sprite.html +++ b/docs/Phaser.Sprite.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -623,6 +657,11404 @@ events (via Sprite.events), animation (via Sprite.animations), camera culling an +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +

    Members

    + +
    + +
    +

    alive

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    alive + + +boolean + + + +

    This is a handy little var your game can use to determine if a sprite is alive or not, it doesn't effect rendering.

    +
    + + + + + + + + + + + + + + + + + + +
    Default Value:
    +
    • true
    + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    angle

    + + +
    +
    + +
    +

    Indicates the rotation of the Sprite, in degrees, from its original orientation. Values from 0 to 180 represent clockwise rotation; values from 0 to -180 represent counterclockwise rotation. +Values outside this range are added to or subtracted from 360 to obtain a value within the range. For example, the statement player.angle = 450 is the same as player.angle = 90. +If you wish to work in radians instead of degrees use the property Sprite.rotation instead.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    angle + + +number + + + +

    Gets or sets the Sprites angle of rotation in degrees.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    angle

    + + +
    +
    + +
    +

    Indicates the rotation of the Sprite, in degrees, from its original orientation. Values from 0 to 180 represent clockwise rotation; values from 0 to -180 represent counterclockwise rotation. +Values outside this range are added to or subtracted from 360 to obtain a value within the range. For example, the statement player.angle = 450 is the same as player.angle = 90. +If you wish to work in radians instead of degrees use the property Sprite.rotation instead. Working in radians is also a little faster as it doesn't have to convert the angle.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    angle + + +number + + + +

    The angle of this Image in degrees.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    animations

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    animations + + +Phaser.AnimationManager + + + +

    This manages animations of the sprite. You can modify animations through it (see Phaser.AnimationManager)

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    animations

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    animations + + +Phaser.AnimationManager + + + +

    This manages animations of the sprite. You can modify animations through it (see Phaser.AnimationManager)

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    autoCull

    + + +
    +
    + +
    +

    Should this Sprite be automatically culled if out of range of the camera? +A culled sprite has its renderable property set to 'false'.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    autoCull + + +boolean + + + +

    A flag indicating if the Sprite should be automatically camera culled or not.

    +
    + + + + + + + + + + + + + + + + + + +
    Default Value:
    +
    • false
    + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    autoCull

    + + +
    +
    + +
    +

    Should this Sprite be automatically culled if out of range of the camera? +A culled sprite has its renderable property set to 'false'. +Be advised this is quite an expensive operation, as it has to calculate the bounds of the object every frame, so only enable it if you really need it.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    autoCull + + +boolean + + + +

    A flag indicating if the Sprite should be automatically camera culled or not.

    +
    + + + + + + + + + + + + + + + + + + +
    Default Value:
    +
    • false
    + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    body

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    body + + +Phaser.Physics.Arcade.Body + + + +

    By default Sprites have a Phaser.Physics Body attached to them. You can operate physics actions via this property, or null it to skip all physics updates.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    body

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    body + + +Phaser.Physics.Arcade.Body + + + +

    By default Sprites have a Phaser.Physics Body attached to them. You can operate physics actions via this property, or null it to skip all physics updates.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    bottomLeft

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    bottomLeft + + +Phaser.Point + + + +

    A Point containing the bottom left coordinate of the Sprite. Takes rotation and scale into account.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    bottomRight

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    bottomRight + + +Phaser.Point + + + +

    A Point containing the bottom right coordinate of the Sprite. Takes rotation and scale into account.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    bounds

    + + +
    +
    + +
    +

    This Rectangle object fully encompasses the Sprite and is updated in real-time. +The bounds is the full bounding area after rotation and scale have been taken into account. It should not be modified directly. +It's used for Camera culling and physics body alignment.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    bounds + + +Phaser.Rectangle + + + +
    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    cameraOffset

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    cameraOffset + + +Phaser.Point + + + +

    If this Sprite is fixed to the camera then use this Point to specify how far away from the Camera x/y it's rendered.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    center

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    center + + +Phaser.Point + + + +

    A Point containing the center coordinate of the Sprite. Takes rotation and scale into account.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    crop

    + + +
    +
    + +
    +

    You can crop the Sprites texture by modifying the crop properties. For example crop.width = 50 would set the Sprite to only render 50px wide. +The crop is only applied if you have set Sprite.cropEnabled to true.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    crop + + +Phaser.Rectangle + + + +

    The crop Rectangle applied to the Sprite texture before rendering.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    cropEnabled

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    cropEnabled + + +boolean + + + +

    If true the Sprite.crop property is used to crop the texture before render. Set to false to disable.

    +
    + + + + + + + + + + + + + + + + + + +
    Default Value:
    +
    • false
    + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    currentFrame

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    currentFrame + + +Phaser.Frame + + + +

    A reference to the currently displayed frame.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    debug

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    debug + + +boolean + + + +

    Handy flag to use with Game.enableStep

    +
    + + + + + + + + + + + + + + + + + + +
    Default Value:
    +
    • false
    + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    debug

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    debug + + +boolean + + + +

    Handy flag to use with Game.enableStep

    +
    + + + + + + + + + + + + + + + + + + +
    Default Value:
    +
    • false
    + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    <readonly> deltaX

    + + +
    +
    + +
    +

    Returns the delta x value. The difference between world.x now and in the previous step.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    deltaX + + +number + + + +

    The delta value. Positive if the motion was to the right, negative if to the left.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    <readonly> deltaY

    + + +
    +
    + +
    +

    Returns the delta y value. The difference between world.y now and in the previous step.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    deltaY + + +number + + + +

    The delta value. Positive if the motion was downwards, negative if upwards.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    <readonly> deltaZ

    + + +
    +
    + +
    +

    Returns the delta z value. The difference between rotation now and in the previous step.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    deltaZ + + +number + + + +

    The delta value.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    events

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    events + + +Phaser.Events + + + +

    The Events you can subscribe to that are dispatched when certain things happen on this Sprite or its components.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    events

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    events + + +Phaser.Events + + + +

    The Events you can subscribe to that are dispatched when certain things happen on this Sprite or its components.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    exists

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    exists + + +boolean + + + +

    If exists = false then the Sprite isn't updated by the core game loop or physics subsystem at all.

    +
    + + + + + + + + + + + + + + + + + + +
    Default Value:
    +
    • true
    + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    exists

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    exists + + +boolean + + + +

    If exists = false then the Sprite isn't updated by the core game loop or physics subsystem at all.

    +
    + + + + + + + + + + + + + + + + + + +
    Default Value:
    +
    • true
    + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    fixedToCamera

    + + +
    +
    + +
    +

    A Sprite that is fixed to the camera ignores the position of any ancestors in the display list and uses its x/y coordinates as offsets from the top left of the camera.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    fixedToCamera + + +boolean + + + +

    Fixes this Sprite to the Camera.

    +
    + + + + + + + + + + + + + + + + + + +
    Default Value:
    +
    • false
    + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    fixedToCamera

    + + +
    +
    + +
    +

    A Sprite that is fixed to the camera uses its x/y coordinates as offsets from the top left of the camera. +Note that if this Image is a child of a display object that has changed its position then the offset will be calculated from that.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    fixedToCamera + + +boolean + + + +

    Fixes this Sprite to the Camera.

    +
    + + + + + + + + + + + + + + + + + + +
    Default Value:
    +
    • false
    + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    frame

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    frame + + +number + + + +

    Gets or sets the current frame index and updates the Texture Cache for display.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    frame

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    frame + + +number + + + +

    Gets or sets the current frame index and updates the Texture Cache for display.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    frameName

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    frameName + + +string + + + +

    Gets or sets the current frame name and updates the Texture Cache for display.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    frameName

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    frameName + + +string + + + +

    Gets or sets the current frame name and updates the Texture Cache for display.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    game

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    game + + +Phaser.Game + + + +

    A reference to the currently running Game.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    game

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    game + + +Phaser.Game + + + +

    A reference to the currently running Game.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    health

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    health + + +number + + + +

    Health value. Used in combination with damage() to allow for quick killing of Sprites.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    health

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    health + + +number + + + +

    Health value. Used in combination with damage() to allow for quick killing of Sprites.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    height

    + + +
    +
    + +
    +

    The height of the sprite in pixels, setting this will actually modify the scale to acheive the value desired. +If you wish to crop the Sprite instead see the Sprite.crop value.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    height + + +number + + + +

    The height of the Sprite in pixels.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    <readonly> inCamera

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    inCamera + + +boolean + + + +

    Is this sprite visible to the camera or not?

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    <readonly> inCamera

    + + +
    +
    + +
    +

    Checks if the Image bounds are within the game camera, otherwise false if fully outside of it.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    inCamera + + +boolean + + + +

    True if the Image bounds is within the game camera, even if only partially. Otherwise false if fully outside of it.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    input

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    input + + +Phaser.InputHandler + + + +

    The Input Handler Component.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    input

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    input + + +Phaser.InputHandler +| + +null + + + +

    The Input Handler for this object. Needs to be enabled with image.inputEnabled = true before you can use it.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    inputEnabled

    + + +
    +
    + +
    +

    By default a Sprite won't process any input events at all. By setting inputEnabled to true the Phaser.InputHandler is +activated for this Sprite instance and it will then start to process click/touch events and more.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    inputEnabled + + +boolean + + + +

    Set to true to allow this Sprite to receive input events, otherwise false.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    inputEnabled

    + + +
    +
    + +
    +

    By default an Image 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.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    inputEnabled + + +boolean + + + +

    Set to true to allow this object to receive input events.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    inWorld

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    inWorld + + +boolean + + + +

    This value is set to true if the Sprite is positioned within the World, otherwise false.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    <readonly> inWorld

    + + +
    +
    + +
    +

    Checks if the Image bounds are within the game world, otherwise false if fully outside of it.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    inWorld + + +boolean + + + +

    True if the Image bounds is within the game world, even if only partially. Otherwise false if fully outside of it.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    inWorldThreshold

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    inWorldThreshold + + +number + + + +

    A threshold value applied to the inWorld check. If you don't want a Sprite to be considered "out of the world" until at least 100px away for example then set it to 100.

    +
    + + + + + + + + + + + + + + + + + + +
    Default Value:
    +
    • 0
    + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    key

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    key + + +string +| + +Phaser.RenderTexture +| + +Phaser.BitmapData +| + +PIXI.Texture + + + +

    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, BitmapData or PIXI.Texture.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    key

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    key + + +string +| + +Phaser.RenderTexture +| + +Phaser.BitmapData +| + +PIXI.Texture + + + +

    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, BitmapData or PIXI.Texture.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    lifespan

    + + +
    +
    + +
    +

    If you would like the Sprite to have a lifespan once 'born' you can set this to a positive value. Handy for particles, bullets, etc. +The lifespan is decremented by game.time.elapsed each update, once it reaches zero the kill() function is called.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    lifespan + + +number + + + +

    The lifespan of the Sprite (in ms) before it will be killed.

    +
    + + + + + + + + + + + + + + + + + + +
    Default Value:
    +
    • 0
    + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    lifespan

    + + +
    +
    + +
    +

    If you would like the Sprite to have a lifespan once 'born' you can set this to a positive value. Handy for particles, bullets, etc. +The lifespan is decremented by game.time.elapsed each update, once it reaches zero the kill() function is called.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    lifespan + + +number + + + +

    The lifespan of the Sprite (in ms) before it will be killed.

    +
    + + + + + + + + + + + + + + + + + + +
    Default Value:
    +
    • 0
    + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    name

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    name + + +string + + + +

    The user defined name given to this Sprite.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    name

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    name + + +string + + + +

    The user defined name given to this Sprite.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    offset

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    offset + + +Phaser.Point + + + +

    Corner point defaults. Should not typically be modified.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    outOfBoundsKill

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    outOfBoundsKill + + +boolean + + + +

    If true the Sprite is killed as soon as Sprite.inWorld is false.

    +
    + + + + + + + + + + + + + + + + + + +
    Default Value:
    +
    • false
    + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    outOfBoundsKill

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    outOfBoundsKill + + +boolean + + + +

    If true the Sprite is killed as soon as Sprite.inWorld is false.

    +
    + + + + + + + + + + + + + + + + + + +
    Default Value:
    +
    • false
    + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    renderOrderID

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    renderOrderID + + +number + + + +

    Used by the Renderer and Input Manager to control picking order.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    <readonly> renderOrderID

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    renderOrderID + + +number + + + +

    The render order ID, reset every frame.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    textureRegion

    + + +
    +
    + +
    +

    The rectangular area from the texture that will be rendered.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    textureRegion + + +Phaser.Rectangle + + + +
    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    topLeft

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    topLeft + + +Phaser.Point + + + +

    A Point containing the top left coordinate of the Sprite. Takes rotation and scale into account.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    topRight

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    topRight + + +Phaser.Point + + + +

    A Point containing the top right coordinate of the Sprite. Takes rotation and scale into account.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    <readonly> type

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    type + + +number + + + +

    The const type of this object.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    <readonly> type

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    type + + +number + + + +

    The const type of this object.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    width

    + + +
    +
    + +
    +

    The width of the sprite in pixels, setting this will actually modify the scale to acheive the value desired. +If you wish to crop the Sprite instead see the Sprite.crop value.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    width + + +number + + + +

    The width of the Sprite in pixels.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    world

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    world + + +Phaser.Point + + + +

    The world coordinates of this Sprite. This differs from the x/y coordinates which are relative to the Sprites container.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    world

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    world + + +Phaser.Point + + + +

    The world coordinates of this Sprite. This differs from the x/y coordinates which are relative to the Sprites container.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    <readonly> worldCenterX

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    worldCenterX + + +number + + + +

    The center of the Sprite in world coordinates.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    <readonly> worldCenterY

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    worldCenterY + + +number + + + +

    The center of the Sprite in world coordinates.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    x

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    x + + +number + + + +

    The x coordinate in world space of this Sprite.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    y

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    y + + +number + + + +

    The y coordinate in world space of this Sprite.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + +
    + + + +

    Methods

    + +
    + +
    +

    bringToTop()

    + + +
    +
    + + +
    +

    Brings the Sprite to the top of the display list it is a child of. Sprites that are members of a Phaser.Group are only +bought to the top of that Group, not the entire display list.

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    (Phaser.Sprite) This instance.

    +
    + + + + + + + +
    + + + +
    +

    bringToTop()

    + + +
    +
    + + +
    +

    Brings the Sprite to the top of the display list it is a child of. Sprites that are members of a Phaser.Group are only +bought to the top of that Group, not the entire display list.

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    (Phaser.Sprite) This instance.

    +
    + + + + + + + +
    + + + +
    +

    centerOn(x, y)

    + + +
    +
    + + +
    +

    Moves the sprite so its center is located on the given x and y coordinates. +Doesn't change the anchor point of the sprite.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    x + + +number + + + +

    The x coordinate (in world space) to position the Sprite at.

    y + + +number + + + +

    The y coordinate (in world space) to position the Sprite at.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    (Phaser.Sprite) This instance.

    +
    + + + + + + + +
    + + + +
    +

    crop(rect)

    + + +
    +
    + + +
    +

    Crop allows you to crop the texture used to display this Image. +Cropping takes place from the top-left of the Image and can be modified in real-time by providing an updated rectangle object.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    rect + + +Phaser.Rectangle + + + +

    The Rectangle to crop the Image to. Pass null or no parameters to clear a previously set crop rectangle.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    damage(amount)

    + + +
    +
    + + +
    +

    Damages the Sprite, this removes the given amount from the Sprites health property. +If health is then taken below zero Sprite.kill is called.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    amount + + +number + + + +

    The amount to subtract from the Sprite.health value.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    (Phaser.Sprite) This instance.

    +
    + + + + + + + +
    + + + +
    +

    damage(amount)

    + + +
    +
    + + +
    +

    Damages the Sprite, this removes the given amount from the Sprites health property. +If health is then taken below zero Sprite.kill is called.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    amount + + +number + + + +

    The amount to subtract from the Sprite.health value.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    (Phaser.Sprite) This instance.

    +
    + + + + + + + +
    + + + +
    +

    deltaX() → {number}

    + + +
    +
    + + +
    +

    Returns the delta x value. The difference between Sprite.x now and in the previous step.

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    The delta value. Positive if the motion was to the right, negative if to the left.

    +
    + + + +
    +
    + Type +
    +
    + +number + + +
    +
    + + + + + +
    + + + +
    +

    deltaY() → {number}

    + + +
    +
    + + +
    +

    Returns the delta x value. The difference between Sprite.y now and in the previous step.

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    The delta value. Positive if the motion was downwards, negative if upwards.

    +
    + + + +
    +
    + Type +
    +
    + +number + + +
    +
    + + + + + +
    + + + +
    +

    destroy()

    + + +
    +
    + + +
    +

    Destroy this Graphics instance.

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    destroy()

    + + +
    +
    + + +
    +

    Destroys the Sprite. This removes it from its parent group, destroys the input, event and animation handlers if present +and nulls its reference to game, freeing it up for garbage collection.

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    destroy()

    + + +
    +
    + + +
    +

    Destroys the Sprite. This removes it from its parent group, destroys the input, event and animation handlers if present +and nulls its reference to game, freeing it up for garbage collection.

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    drawPolygon()

    + + +
    +
    + + +
    +

    /* +Draws a {Phaser.Polygon} or a {PIXI.Polygon} filled

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    getLocalPosition(p, x, y) → {Phaser.Point}

    + + +
    +
    + + +
    +

    Gets the local position of a coordinate relative to the Sprite, factoring in rotation and scale. +Mostly only used internally.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    p + + +Phaser.Point + + + +

    The Point object to store the results in.

    x + + +number + + + +

    x coordinate within the Sprite to translate.

    y + + +number + + + +

    y coordinate within the Sprite to translate.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    The translated point.

    +
    + + + +
    +
    + Type +
    +
    + +Phaser.Point + + +
    +
    + + + + + +
    + + + +
    +

    getLocalUnmodifiedPosition(p, gx, gy) → {Phaser.Point}

    + + +
    +
    + + +
    +

    Gets the local unmodified position of a coordinate relative to the Sprite, factoring in rotation and scale. +Mostly only used internally by the Input Manager, but also useful for custom hit detection.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    p + + +Phaser.Point + + + +

    The Point object to store the results in.

    gx + + +number + + + +

    x coordinate within the Sprite to translate.

    gy + + +number + + + +

    y coordinate within the Sprite to translate.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    The translated point.

    +
    + + + +
    +
    + Type +
    +
    + +Phaser.Point + + +
    +
    + + + + + +
    + + + +
    +

    kill()

    + + +
    +
    + + +
    +

    Kills a Sprite. A killed Sprite has its alive, exists and visible properties all set to false. +It will dispatch the onKilled event, you can listen to Sprite.events.onKilled for the signal. +Note that killing a Sprite is a way for you to quickly recycle it in a Sprite pool, it doesn't free it up from memory. +If you don't need this Sprite any more you should call Sprite.destroy instead.

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    (Phaser.Sprite) This instance.

    +
    + + + + + + + +
    + + + +
    +

    kill()

    + + +
    +
    + + +
    +

    Kills a Sprite. A killed Sprite has its alive, exists and visible properties all set to false. +It will dispatch the onKilled event, you can listen to Sprite.events.onKilled for the signal. +Note that killing a Sprite is a way for you to quickly recycle it in a Sprite pool, it doesn't free it up from memory. +If you don't need this Sprite any more you should call Sprite.destroy instead.

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    (Phaser.Sprite) This instance.

    +
    + + + + + + + +
    + + + +
    +

    loadTexture(key, frame)

    + + +
    +
    + + +
    +

    Changes the Texture the Sprite is using entirely. The old texture is removed and the new one is referenced or fetched from the Cache. +This causes a WebGL texture update, so use sparingly or in low-intensity portions of your game.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    key + + +string +| + +Phaser.RenderTexture +| + +Phaser.BitmapData +| + +PIXI.Texture + + + +

    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, BitmapData or PIXI.Texture.

    frame + + +string +| + +number + + + +

    If this Sprite is using part of a sprite sheet or texture atlas you can specify the exact frame to use by giving a string or numeric index.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    loadTexture(key, frame)

    + + +
    +
    + + +
    +

    Changes the Texture the Sprite is using entirely. The old texture is removed and the new one is referenced or fetched from the Cache. +This causes a WebGL texture update, so use sparingly or in low-intensity portions of your game.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    key + + +string +| + +Phaser.RenderTexture +| + +Phaser.BitmapData +| + +PIXI.Texture + + + +

    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, BitmapData or PIXI.Texture.

    frame + + +string +| + +number + + + +

    If this Sprite is using part of a sprite sheet or texture atlas you can specify the exact frame to use by giving a string or numeric index.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    play(name, frameRate, loop, killOnComplete) → {Phaser.Animation}

    + + +
    +
    + + +
    +

    Play an animation based on the given key. The animation should previously have been added via sprite.animations.add() +If the requested animation is already playing this request will be ignored. If you need to reset an already running animation do so directly on the Animation object itself.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeArgumentDefaultDescription
    name + + +string + + + + + + + + + + + +

    The name of the animation to be played, e.g. "fire", "walk", "jump".

    frameRate + + +number + + + + + + <optional>
    + + + + + +
    + + null + +

    The framerate to play the animation at. The speed is given in frames per second. If not provided the previously set frameRate of the Animation is used.

    loop + + +boolean + + + + + + <optional>
    + + + + + +
    + + false + +

    Should the animation be looped after playback. If not provided the previously set loop value of the Animation is used.

    killOnComplete + + +boolean + + + + + + <optional>
    + + + + + +
    + + false + +

    If set to true when the animation completes (only happens if loop=false) the parent Sprite will be killed.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    A reference to playing Animation instance.

    +
    + + + +
    +
    + Type +
    +
    + +Phaser.Animation + + +
    +
    + + + + + +
    + + + +
    +

    play(name, frameRate, loop, killOnComplete) → {Phaser.Animation}

    + + +
    +
    + + +
    +

    Play an animation based on the given key. The animation should previously have been added via sprite.animations.add() +If the requested animation is already playing this request will be ignored. If you need to reset an already running animation do so directly on the Animation object itself.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeArgumentDefaultDescription
    name + + +string + + + + + + + + + + + +

    The name of the animation to be played, e.g. "fire", "walk", "jump".

    frameRate + + +number + + + + + + <optional>
    + + + + + +
    + + null + +

    The framerate to play the animation at. The speed is given in frames per second. If not provided the previously set frameRate of the Animation is used.

    loop + + +boolean + + + + + + <optional>
    + + + + + +
    + + false + +

    Should the animation be looped after playback. If not provided the previously set loop value of the Animation is used.

    killOnComplete + + +boolean + + + + + + <optional>
    + + + + + +
    + + false + +

    If set to true when the animation completes (only happens if loop=false) the parent Sprite will be killed.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    A reference to playing Animation instance.

    +
    + + + +
    +
    + Type +
    +
    + +Phaser.Animation + + +
    +
    + + + + + +
    + + + +
    +

    postUpdate()

    + + +
    +
    + + +
    +

    Internal function called by the World postUpdate cycle.

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    postUpdate()

    + + +
    +
    + + +
    +

    Internal function called by the World postUpdate cycle.

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    preUpdate()

    + + +
    +
    + + +
    +

    Automatically called by World.preUpdate. Handles cache updates, lifespan checks, animation updates and physics updates.

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    preUpdate()

    + + +
    +
    + + +
    +

    Automatically called by World.preUpdate.

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    reset(x, y, health)

    + + +
    +
    + + +
    +

    Resets the Sprite. This places the Sprite at the given x/y world coordinates and then +sets alive, exists, visible and renderable all to true. Also resets the outOfBounds state and health values. +If the Sprite has a physics body that too is reset.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeArgumentDefaultDescription
    x + + +number + + + + + + + + + + + +

    The x coordinate (in world space) to position the Sprite at.

    y + + +number + + + + + + + + + + + +

    The y coordinate (in world space) to position the Sprite at.

    health + + +number + + + + + + <optional>
    + + + + + +
    + + 1 + +

    The health to give the Sprite.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    (Phaser.Sprite) This instance.

    +
    + + + + + + + +
    + + + +
    +

    reset(x, y, health)

    + + +
    +
    + + +
    +

    Resets the Sprite. This places the Sprite at the given x/y world coordinates and then +sets alive, exists, visible and renderable all to true. Also resets the outOfBounds state and health values. +If the Sprite has a physics body that too is reset.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeArgumentDefaultDescription
    x + + +number + + + + + + + + + + + +

    The x coordinate (in world space) to position the Sprite at.

    y + + +number + + + + + + + + + + + +

    The y coordinate (in world space) to position the Sprite at.

    health + + +number + + + + + + <optional>
    + + + + + +
    + + 1 + +

    The health to give the Sprite.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    (Phaser.Sprite) This instance.

    +
    + + + + + + + +
    + + + +
    +

    resetCrop()

    + + +
    +
    + + +
    +

    Resets the Sprite.crop value back to the frame dimensions.

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    revive(health)

    + + +
    +
    + + +
    +

    Brings a 'dead' Sprite back to life, optionally giving it the health value specified. +A resurrected Sprite has its alive, exists and visible properties all set to true. +It will dispatch the onRevived event, you can listen to Sprite.events.onRevived for the signal.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeArgumentDefaultDescription
    health + + +number + + + + + + <optional>
    + + + + + +
    + + 1 + +

    The health to give the Sprite.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    (Phaser.Sprite) This instance.

    +
    + + + + + + + +
    + + + +
    +

    revive(health)

    + + +
    +
    + + +
    +

    Brings a 'dead' Sprite back to life, optionally giving it the health value specified. +A resurrected Sprite has its alive, exists and visible properties all set to true. +It will dispatch the onRevived event, you can listen to Sprite.events.onRevived for the signal.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeArgumentDefaultDescription
    health + + +number + + + + + + <optional>
    + + + + + +
    + + 1 + +

    The health to give the Sprite.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    (Phaser.Sprite) This instance.

    +
    + + + + + + + +
    + + + +
    +

    updateAnimation()

    + + +
    +
    + + +
    +

    Internal function called by preUpdate.

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    updateBounds()

    + + +
    +
    + + +
    +

    Internal function called by preUpdate.

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    updateCache()

    + + +
    +
    + + +
    +

    Internal function called by preUpdate.

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    updateCrop()

    + + +
    +
    + + +
    +

    Internal function called by preUpdate.

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + +
    + + + + + +
    + +
    + + + + + +

    Class: Sprite

    +
    + +
    +

    + Phaser. + + Sprite +

    + +

    Create a new Sprite object. Sprites are the lifeblood of your game, used for nearly everything visual.

    +

    At its most basic a Sprite consists of a set of coordinates and a texture that is rendered to the canvas. +They also contain additional properties allowing for physics motion (via Sprite.body), input handling (via Sprite.input), +events (via Sprite.events), animation (via Sprite.animations), camera culling and more. Please see the Examples for use cases.

    + +
    + +
    +
    + + + + +
    +

    new Sprite(game, x, y, key, frame)

    + + +
    +
    + + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    game + + +Phaser.Game + + + +

    A reference to the currently running game.

    x + + +number + + + +

    The x coordinate (in world space) to position the Sprite at.

    y + + +number + + + +

    The y coordinate (in world space) to position the Sprite at.

    key + + +string +| + +Phaser.RenderTexture +| + +Phaser.BitmapData +| + +PIXI.Texture + + + +

    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 + + + +

    If this Sprite is using part of a sprite sheet or texture atlas you can specify the exact frame to use by giving a string or numeric index.

    + + + + +
    + + + + + + + + + + + + + + + + + + +
    Source:
    - - - -
    - - - -
    -

    anchor

    - - -
    -
    - -
    -

    The anchor sets the origin point of the texture. -The default is 0,0 this means the textures origin is the top left -Setting than anchor to 0.5,0.5 means the textures origin is centered -Setting the anchor to 1,1 would mean the textures origin points will be the bottom right

    -
    - - - - - -
    - - -
    Properties:
    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    anchor - - -Phaser.Point - - - -

    The anchor around which rotation and scaling takes place.

    -
    - - - - - - - - - - - - - - - - - - - - -
    Source:
    -
    @@ -973,7 +12296,115 @@ If you wish to work in radians instead of degrees use the property Sprite.rotati
    Source:
    + + + + + + + +
    + + + +
    + + + +
    +

    angle

    + + +
    +
    + +
    +

    Indicates the rotation of the Sprite, in degrees, from its original orientation. Values from 0 to 180 represent clockwise rotation; values from 0 to -180 represent counterclockwise rotation. +Values outside this range are added to or subtracted from 360 to obtain a value within the range. For example, the statement player.angle = 450 is the same as player.angle = 90. +If you wish to work in radians instead of degrees use the property Sprite.rotation instead. Working in radians is also a little faster as it doesn't have to convert the angle.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    angle + + +number + + + +

    The angle of this Image in degrees.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    @@ -1075,7 +12506,109 @@ If you wish to work in radians instead of degrees use the property Sprite.rotati
    Source:
    + + + + + + + +
    + + + +
    + + + +
    +

    animations

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    animations + + +Phaser.AnimationManager + + + +

    This manages animations of the sprite. You can modify animations through it (see Phaser.AnimationManager)

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    @@ -1185,7 +12718,118 @@ A culled sprite has its renderable property set to 'false'.

    Source:
    + + + + + + + +
    + + + +
    + + + +
    +

    autoCull

    + + +
    +
    + +
    +

    Should this Sprite be automatically culled if out of range of the camera? +A culled sprite has its renderable property set to 'false'. +Be advised this is quite an expensive operation, as it has to calculate the bounds of the object every frame, so only enable it if you really need it.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    autoCull + + +boolean + + + +

    A flag indicating if the Sprite should be automatically camera culled or not.

    +
    + + + + + + + + + + + + + + + + + + +
    Default Value:
    +
    • false
    + + + +
    Source:
    +
    @@ -1287,7 +12931,109 @@ A culled sprite has its renderable property set to 'false'.

    Source:
    + + + + + + + +
    + + + +
    + + + +
    +

    body

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    body + + +Phaser.Physics.Arcade.Body + + + +

    By default Sprites have a Phaser.Physics Body attached to them. You can operate physics actions via this property, or null it to skip all physics updates.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    @@ -1389,7 +13135,7 @@ A culled sprite has its renderable property set to 'false'.

    Source:
    @@ -1491,7 +13237,7 @@ A culled sprite has its renderable property set to 'false'.

    Source:
    @@ -1599,7 +13345,7 @@ It's used for Camera culling and physics body alignment.

    Source:
    @@ -1701,7 +13447,7 @@ It's used for Camera culling and physics body alignment.

    Source:
    @@ -1803,7 +13549,7 @@ It's used for Camera culling and physics body alignment.

    Source:
    @@ -1910,7 +13656,7 @@ The crop is only applied if you have set Sprite.cropEnabled to true.

    Source:
    @@ -2015,7 +13761,7 @@ The crop is only applied if you have set Sprite.cropEnabled to true.

    Source:
    @@ -2117,7 +13863,7 @@ The crop is only applied if you have set Sprite.cropEnabled to true.

    Source:
    @@ -2222,7 +13968,112 @@ The crop is only applied if you have set Sprite.cropEnabled to true.

    Source:
    + + + + + + + +
    + + + +
    + + + +
    +

    debug

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    debug + + +boolean + + + +

    Handy flag to use with Game.enableStep

    +
    + + + + + + + + + + + + + + + + + + +
    Default Value:
    +
    • false
    + + + +
    Source:
    +
    @@ -2247,7 +14098,7 @@ The crop is only applied if you have set Sprite.cropEnabled to true.

    -

    Returns the delta x value. The difference between Sprite.x now and in the previous step.

    +

    Returns the delta x value. The difference between world.x now and in the previous step.

    @@ -2328,7 +14179,7 @@ The crop is only applied if you have set Sprite.cropEnabled to true.

    Source:
    @@ -2353,7 +14204,7 @@ The crop is only applied if you have set Sprite.cropEnabled to true.

    -

    Returns the delta x value. The difference between Sprite.y now and in the previous step.

    +

    Returns the delta y value. The difference between world.y now and in the previous step.

    @@ -2434,7 +14285,113 @@ The crop is only applied if you have set Sprite.cropEnabled to true.

    Source:
    + + + + + + + +
    + + + +
    + + + +
    +

    <readonly> deltaZ

    + + +
    +
    + +
    +

    Returns the delta z value. The difference between rotation now and in the previous step.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    deltaZ + + +number + + + +

    The delta value.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    @@ -2536,7 +14493,214 @@ The crop is only applied if you have set Sprite.cropEnabled to true.

    Source:
    + + + + + + + +
    + + + +
    + + + +
    +

    events

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    events + + +Phaser.Events + + + +

    The Events you can subscribe to that are dispatched when certain things happen on this Sprite or its components.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    exists

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    exists + + +boolean + + + +

    If exists = false then the Sprite isn't updated by the core game loop or physics subsystem at all.

    +
    + + + + + + + + + + + + + + + + + + +
    Default Value:
    +
    • true
    + + + +
    Source:
    +
    @@ -2750,7 +14914,117 @@ The crop is only applied if you have set Sprite.cropEnabled to true.

    Source:
    + + + + + + + +
    + + + +
    + + + +
    +

    fixedToCamera

    + + +
    +
    + +
    +

    A Sprite that is fixed to the camera uses its x/y coordinates as offsets from the top left of the camera. +Note that if this Image is a child of a display object that has changed its position then the offset will be calculated from that.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    fixedToCamera + + +boolean + + + +

    Fixes this Sprite to the Camera.

    +
    + + + + + + + + + + + + + + + + + + +
    Default Value:
    +
    • false
    + + + +
    Source:
    +
    @@ -2852,7 +15126,109 @@ The crop is only applied if you have set Sprite.cropEnabled to true.

    Source:
    + + + + + + + +
    + + + +
    + + + +
    +

    frame

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    frame + + +number + + + +

    Gets or sets the current frame index and updates the Texture Cache for display.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    @@ -2954,7 +15330,211 @@ The crop is only applied if you have set Sprite.cropEnabled to true.

    Source:
    + + + + + + + +
    + + + +
    + + + +
    +

    frameName

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    frameName + + +string + + + +

    Gets or sets the current frame name and updates the Texture Cache for display.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    game

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    game + + +Phaser.Game + + + +

    A reference to the currently running Game.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    @@ -3074,7 +15654,7 @@ The crop is only applied if you have set Sprite.cropEnabled to true.

    -

    group

    +

    health

    @@ -3113,13 +15693,13 @@ The crop is only applied if you have set Sprite.cropEnabled to true.

    - group + health -Phaser.Group +number @@ -3129,7 +15709,7 @@ The crop is only applied if you have set Sprite.cropEnabled to true.

    -

    The parent Group of this Sprite. This is usually set after Sprite instantiation by the parent.

    +

    Health value. Used in combination with damage() to allow for quick killing of Sprites.

    @@ -3158,7 +15738,7 @@ The crop is only applied if you have set Sprite.cropEnabled to true.

    Source:
    @@ -3260,7 +15840,7 @@ The crop is only applied if you have set Sprite.cropEnabled to true.

    Source:
    @@ -3367,7 +15947,7 @@ If you wish to crop the Sprite instead see the Sprite.crop value.

    Source:
    @@ -3469,7 +16049,113 @@ If you wish to crop the Sprite instead see the Sprite.crop value.

    Source:
    + + + + + + + +
    + + + +
    + + + +
    +

    <readonly> inCamera

    + + +
    +
    + +
    +

    Checks if the Image bounds are within the game camera, otherwise false if fully outside of it.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    inCamera + + +boolean + + + +

    True if the Image bounds is within the game camera, even if only partially. Otherwise false if fully outside of it.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    @@ -3571,7 +16257,112 @@ If you wish to crop the Sprite instead see the Sprite.crop value.

    Source:
    + + + + + + + +
    + + + +
    + + + +
    +

    input

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    input + + +Phaser.InputHandler +| + +null + + + +

    The Input Handler for this object. Needs to be enabled with image.inputEnabled = true before you can use it.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    @@ -3678,7 +16469,114 @@ activated for this Sprite instance and it will then start to process click/touch
    Source:
    + + + + + + + +
    + + + +
    + + + +
    +

    inputEnabled

    + + +
    +
    + +
    +

    By default an Image 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.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    inputEnabled + + +boolean + + + +

    Set to true to allow this object to receive input events.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    @@ -3780,7 +16678,113 @@ activated for this Sprite instance and it will then start to process click/touch
    Source:
    + + + + + + + +
    + + + +
    + + + +
    +

    <readonly> inWorld

    + + +
    +
    + +
    +

    Checks if the Image bounds are within the game world, otherwise false if fully outside of it.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    inWorld + + +boolean + + + +

    True if the Image bounds is within the game world, even if only partially. Otherwise false if fully outside of it.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    @@ -3885,7 +16889,7 @@ activated for this Sprite instance and it will then start to process click/touch
    Source:
    @@ -3996,7 +17000,118 @@ activated for this Sprite instance and it will then start to process click/touch
    Source:
    + + + + + + + +
    + + + +
    + + + +
    +

    key

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    key + + +string +| + +Phaser.RenderTexture +| + +Phaser.BitmapData +| + +PIXI.Texture + + + +

    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, BitmapData or PIXI.Texture.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    @@ -4106,7 +17221,117 @@ The lifespan is decremented by game.time.elapsed each update, once it reaches ze
    Source:
    + + + + + + + +
    + + + +
    + + + +
    +

    lifespan

    + + +
    +
    + +
    +

    If you would like the Sprite to have a lifespan once 'born' you can set this to a positive value. Handy for particles, bullets, etc. +The lifespan is decremented by game.time.elapsed each update, once it reaches zero the kill() function is called.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    lifespan + + +number + + + +

    The lifespan of the Sprite (in ms) before it will be killed.

    +
    + + + + + + + + + + + + + + + + + + +
    Default Value:
    +
    • 0
    + + + +
    Source:
    +
    @@ -4208,7 +17433,109 @@ The lifespan is decremented by game.time.elapsed each update, once it reaches ze
    Source:
    + + + + + + + +
    + + + +
    + + + +
    +

    name

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    name + + +string + + + +

    The user defined name given to this Sprite.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    @@ -4310,7 +17637,7 @@ The lifespan is decremented by game.time.elapsed each update, once it reaches ze
    Source:
    @@ -4415,7 +17742,112 @@ The lifespan is decremented by game.time.elapsed each update, once it reaches ze
    Source:
    + + + + + + + +
    + + + +
    + + + +
    +

    outOfBoundsKill

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    outOfBoundsKill + + +boolean + + + +

    If true the Sprite is killed as soon as Sprite.inWorld is false.

    +
    + + + + + + + + + + + + + + + + + + +
    Default Value:
    +
    • false
    + + + +
    Source:
    +
    @@ -4517,7 +17949,7 @@ The lifespan is decremented by game.time.elapsed each update, once it reaches ze
    Source:
    @@ -4535,7 +17967,7 @@ The lifespan is decremented by game.time.elapsed each update, once it reaches ze
    -

    scale

    +

    <readonly> renderOrderID

    @@ -4574,13 +18006,13 @@ The lifespan is decremented by game.time.elapsed each update, once it reaches ze - scale + renderOrderID -Phaser.Point +number @@ -4590,7 +18022,7 @@ The lifespan is decremented by game.time.elapsed each update, once it reaches ze -

    The scale of the Sprite when rendered. By default it's set to 1 (no scale). You can modify it via scale.x or scale.y or scale.setTo(x, y). A value of 1 means no change to the scale, 0.5 means "half the size", 2 means "twice the size", etc.

    +

    The render order ID, reset every frame.

    @@ -4619,7 +18051,7 @@ The lifespan is decremented by game.time.elapsed each update, once it reaches ze
    Source:
    @@ -4725,7 +18157,7 @@ The lifespan is decremented by game.time.elapsed each update, once it reaches ze
    Source:
    @@ -4827,7 +18259,7 @@ The lifespan is decremented by game.time.elapsed each update, once it reaches ze
    Source:
    @@ -4929,7 +18361,7 @@ The lifespan is decremented by game.time.elapsed each update, once it reaches ze
    Source:
    @@ -5031,7 +18463,109 @@ The lifespan is decremented by game.time.elapsed each update, once it reaches ze
    Source:
    + + + + + + + +
    + + + +
    + + + +
    +

    <readonly> type

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    type + + +number + + + +

    The const type of this object.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    @@ -5138,7 +18672,7 @@ If you wish to crop the Sprite instead see the Sprite.crop value.

    Source:
    @@ -5240,7 +18774,109 @@ If you wish to crop the Sprite instead see the Sprite.crop value.

    Source:
    + + + + + + + +
    + + + +
    + + + +
    +

    world

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    world + + +Phaser.Point + + + +

    The world coordinates of this Sprite. This differs from the x/y coordinates which are relative to the Sprites container.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    @@ -5342,7 +18978,7 @@ If you wish to crop the Sprite instead see the Sprite.crop value.

    Source:
    @@ -5444,7 +19080,7 @@ If you wish to crop the Sprite instead see the Sprite.crop value.

    Source:
    @@ -5546,7 +19182,7 @@ If you wish to crop the Sprite instead see the Sprite.crop value.

    Source:
    @@ -5648,7 +19284,7 @@ If you wish to crop the Sprite instead see the Sprite.crop value.

    Source:
    @@ -5714,7 +19350,88 @@ bought to the top of that Group, not the entire display list.

    Source:
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    (Phaser.Sprite) This instance.

    +
    + + + + + + + +
    + + + +
    +

    bringToTop()

    + + +
    +
    + + +
    +

    Brings the Sprite to the top of the display list it is a child of. Sprites that are members of a Phaser.Group are only +bought to the top of that Group, not the entire display list.

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    @@ -5867,7 +19584,256 @@ Doesn't change the anchor point of the sprite.

    Source:
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    (Phaser.Sprite) This instance.

    +
    + + + + + + + +
    + + + +
    +

    crop(rect)

    + + +
    +
    + + +
    +

    Crop allows you to crop the texture used to display this Image. +Cropping takes place from the top-left of the Image and can be modified in real-time by providing an updated rectangle object.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    rect + + +Phaser.Rectangle + + + +

    The Rectangle to crop the Image to. Pass null or no parameters to clear a previously set crop rectangle.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    damage(amount)

    + + +
    +
    + + +
    +

    Damages the Sprite, this removes the given amount from the Sprites health property. +If health is then taken below zero Sprite.kill is called.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    amount + + +number + + + +

    The amount to subtract from the Sprite.health value.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    @@ -5997,7 +19963,7 @@ If health is then taken below zero Sprite.kill is called.

    Source:
    @@ -6031,6 +19997,190 @@ If health is then taken below zero Sprite.kill is called.

    +
    + + + +
    +

    deltaX() → {number}

    + + +
    +
    + + +
    +

    Returns the delta x value. The difference between Sprite.x now and in the previous step.

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    The delta value. Positive if the motion was to the right, negative if to the left.

    +
    + + + +
    +
    + Type +
    +
    + +number + + +
    +
    + + + + + +
    + + + +
    +

    deltaY() → {number}

    + + +
    +
    + + +
    +

    Returns the delta x value. The difference between Sprite.y now and in the previous step.

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    The delta value. Positive if the motion was downwards, negative if upwards.

    +
    + + + +
    +
    + Type +
    +
    + +number + + +
    +
    + + + + +
    @@ -6147,7 +20297,147 @@ and nulls its reference to game, freeing it up for garbage collection.

    Source:
    + + + + + + + + + + + + + + + + + + + + + + + + + +
    +

    destroy()

    + + +
    +
    + + +
    +

    Destroys the Sprite. This removes it from its parent group, destroys the input, event and animation handlers if present +and nulls its reference to game, freeing it up for garbage collection.

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    drawPolygon()

    + + +
    +
    + + +
    +

    /* +Draws a {Phaser.Polygon} or a {PIXI.Polygon} filled

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    @@ -6312,7 +20602,7 @@ Mostly only used internally.

    Source:
    @@ -6500,7 +20790,7 @@ Mostly only used internally by the Input Manager, but also useful for custom hit
    Source:
    @@ -6595,7 +20885,90 @@ If you don't need this Sprite any more you should call Sprite.destroy instead.Source:
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    (Phaser.Sprite) This instance.

    +
    + + + + + + + +
    + + + +
    +

    kill()

    + + +
    +
    + + +
    +

    Kills a Sprite. A killed Sprite has its alive, exists and visible properties all set to false. +It will dispatch the onKilled event, you can listen to Sprite.events.onKilled for the signal. +Note that killing a Sprite is a way for you to quickly recycle it in a Sprite pool, it doesn't free it up from memory. +If you don't need this Sprite any more you should call Sprite.destroy instead.

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    @@ -6760,7 +21133,161 @@ This causes a WebGL texture update, so use sparingly or in low-intensity portion
    Source:
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    loadTexture(key, frame)

    + + +
    +
    + + +
    +

    Changes the Texture the Sprite is using entirely. The old texture is removed and the new one is referenced or fetched from the Cache. +This causes a WebGL texture update, so use sparingly or in low-intensity portions of your game.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    key + + +string +| + +Phaser.RenderTexture +| + +Phaser.BitmapData +| + +PIXI.Texture + + + +

    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, BitmapData or PIXI.Texture.

    frame + + +string +| + +number + + + +

    If this Sprite is using part of a sprite sheet or texture atlas you can specify the exact frame to use by giving a string or numeric index.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    @@ -7012,7 +21539,282 @@ If the requested animation is already playing this request will be ignored. If y
    Source:
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    A reference to playing Animation instance.

    +
    + + + +
    +
    + Type +
    +
    + +Phaser.Animation + + +
    +
    + + + + + +
    + + + +
    +

    play(name, frameRate, loop, killOnComplete) → {Phaser.Animation}

    + + +
    +
    + + +
    +

    Play an animation based on the given key. The animation should previously have been added via sprite.animations.add() +If the requested animation is already playing this request will be ignored. If you need to reset an already running animation do so directly on the Animation object itself.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeArgumentDefaultDescription
    name + + +string + + + + + + + + + + + +

    The name of the animation to be played, e.g. "fire", "walk", "jump".

    frameRate + + +number + + + + + + <optional>
    + + + + + +
    + + null + +

    The framerate to play the animation at. The speed is given in frames per second. If not provided the previously set frameRate of the Animation is used.

    loop + + +boolean + + + + + + <optional>
    + + + + + +
    + + false + +

    Should the animation be looped after playback. If not provided the previously set loop value of the Animation is used.

    killOnComplete + + +boolean + + + + + + <optional>
    + + + + + +
    + + false + +

    If set to true when the animation completes (only happens if loop=false) the parent Sprite will be killed.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    @@ -7104,7 +21906,76 @@ If the requested animation is already playing this request will be ignored. If y
    Source:
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    postUpdate()

    + + +
    +
    + + +
    +

    Internal function called by the World postUpdate cycle.

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    @@ -7173,7 +22044,76 @@ If the requested animation is already playing this request will be ignored. If y
    Source:
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    preUpdate()

    + + +
    +
    + + +
    +

    Automatically called by World.preUpdate.

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    @@ -7383,7 +22323,228 @@ If the Sprite has a physics body that too is reset.

    Source:
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    (Phaser.Sprite) This instance.

    +
    + + + + + + + +
    + + + +
    +

    reset(x, y, health)

    + + +
    +
    + + +
    +

    Resets the Sprite. This places the Sprite at the given x/y world coordinates and then +sets alive, exists, visible and renderable all to true. Also resets the outOfBounds state and health values. +If the Sprite has a physics body that too is reset.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeArgumentDefaultDescription
    x + + +number + + + + + + + + + + + +

    The x coordinate (in world space) to position the Sprite at.

    y + + +number + + + + + + + + + + + +

    The y coordinate (in world space) to position the Sprite at.

    health + + +number + + + + + + <optional>
    + + + + + +
    + + 1 + +

    The health to give the Sprite.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    @@ -7463,7 +22624,7 @@ If the Sprite has a physics body that too is reset.

    Source:
    @@ -7603,7 +22764,158 @@ It will dispatch the onRevived event, you can listen to Sprite.events.onRevived
    Source:
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    (Phaser.Sprite) This instance.

    +
    + + + + + + + +
    + + + +
    +

    revive(health)

    + + +
    +
    + + +
    +

    Brings a 'dead' Sprite back to life, optionally giving it the health value specified. +A resurrected Sprite has its alive, exists and visible properties all set to true. +It will dispatch the onRevived event, you can listen to Sprite.events.onRevived for the signal.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeArgumentDefaultDescription
    health + + +number + + + + + + <optional>
    + + + + + +
    + + 1 + +

    The health to give the Sprite.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    @@ -7683,7 +22995,7 @@ It will dispatch the onRevived event, you can listen to Sprite.events.onRevived
    Source:
    @@ -7752,7 +23064,7 @@ It will dispatch the onRevived event, you can listen to Sprite.events.onRevived
    Source:
    @@ -7821,7 +23133,7 @@ It will dispatch the onRevived event, you can listen to Sprite.events.onRevived
    Source:
    @@ -7890,7 +23202,7 @@ It will dispatch the onRevived event, you can listen to Sprite.events.onRevived
    Source:
    @@ -7941,7 +23253,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 05 2014 06:28:34 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:50 GMT-0000 (GMT) using the DocStrap template.
    diff --git a/docs/Phaser.Stage.html b/docs/Phaser.Stage.html index bace5b63..c3a06801 100644 --- a/docs/Phaser.Stage.html +++ b/docs/Phaser.Stage.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -1930,7 +1964,7 @@ focus handling, game resizing, scaling and the pause, boot and orientation scree Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:34 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:51 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.StageScaleMode.html b/docs/Phaser.StageScaleMode.html index 72ea2c10..539c7496 100644 --- a/docs/Phaser.StageScaleMode.html +++ b/docs/Phaser.StageScaleMode.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -4904,7 +4938,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 05 2014 06:28:34 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:51 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.State.html b/docs/Phaser.State.html index d0a995ce..a7006252 100644 --- a/docs/Phaser.State.html +++ b/docs/Phaser.State.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -2568,7 +2602,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 05 2014 06:28:34 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:51 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.StateManager.html b/docs/Phaser.StateManager.html index bd5daaaf..6c14776a 100644 --- a/docs/Phaser.StateManager.html +++ b/docs/Phaser.StateManager.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -3254,7 +3288,7 @@ State must exist and have at least one callback function registered..

    Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:34 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:51 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Text.html b/docs/Phaser.Text.html index ea84a034..6b00f9c5 100644 --- a/docs/Phaser.Text.html +++ b/docs/Phaser.Text.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -2560,7 +2594,7 @@ If you wish to work in radians instead of degrees use the property Sprite.rotati Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:35 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:51 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Tile.html b/docs/Phaser.Tile.html index c6710c82..1ae5a9a1 100644 --- a/docs/Phaser.Tile.html +++ b/docs/Phaser.Tile.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -3965,7 +3999,7 @@ The callback must true true for collision processing to take place.

    Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:35 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:51 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.TileSprite.html b/docs/Phaser.TileSprite.html index 04e6138a..29baf294 100644 --- a/docs/Phaser.TileSprite.html +++ b/docs/Phaser.TileSprite.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -785,121 +819,7 @@
    Source:
    - - - - - - - - - - - - - - - -
    -

    anchor

    - - -
    -
    - -
    -

    The anchor sets the origin point of the texture. -The default is 0,0 this means the textures origin is the top left -Setting than anchor to 0.5,0.5 means the textures origin is centered -Setting the anchor to 1,1 would mean the textures origin points will be the bottom right

    -
    - - - - - -
    - - -
    Properties:
    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    anchor - - -Phaser.Point - - - -

    The anchor around which rotation and scaling takes place.

    -
    - - - - - - - - -
    Inherited From:
    -
    - - - - - - - - - - - - - -
    Source:
    -
    @@ -1114,7 +1034,114 @@ If you wish to work in radians instead of degrees use the property Sprite.rotati
    Source:
    + + + + + + + +
    + + + +
    + + + +
    +

    animations

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    animations + + +Phaser.AnimationManager + + + +

    This manages animations of the sprite. You can modify animations through it (see Phaser.AnimationManager)

    +
    + + + + + + + + +
    Inherited From:
    +
    + + + + + + + + + + + + + +
    Source:
    +
    @@ -1229,7 +1256,123 @@ A culled sprite has its renderable property set to 'false'.

    Source:
    + + + + + + + +
    + + + +
    + + + +
    +

    autoCull

    + + +
    +
    + +
    +

    Should this Sprite be automatically culled if out of range of the camera? +A culled sprite has its renderable property set to 'false'. +Be advised this is quite an expensive operation, as it has to calculate the bounds of the object every frame, so only enable it if you really need it.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    autoCull + + +boolean + + + +

    A flag indicating if the Sprite should be automatically camera culled or not.

    +
    + + + + + + + + +
    Inherited From:
    +
    + + + + + + + + + + + +
    Default Value:
    +
    • false
    + + + +
    Source:
    +
    @@ -1336,7 +1479,114 @@ A culled sprite has its renderable property set to 'false'.

    Source:
    + + + + + + + +
    + + + +
    + + + +
    +

    body

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    body + + +Phaser.Physics.Arcade.Body + + + +

    By default Sprites have a Phaser.Physics Body attached to them. You can operate physics actions via this property, or null it to skip all physics updates.

    +
    + + + + + + + + +
    Inherited From:
    +
    + + + + + + + + + + + + + +
    Source:
    +
    @@ -1443,7 +1693,7 @@ A culled sprite has its renderable property set to 'false'.

    Source:
    @@ -1550,7 +1800,7 @@ A culled sprite has its renderable property set to 'false'.

    Source:
    @@ -1663,7 +1913,7 @@ It's used for Camera culling and physics body alignment.

    Source:
    @@ -1770,7 +2020,7 @@ It's used for Camera culling and physics body alignment.

    Source:
    @@ -1877,7 +2127,7 @@ It's used for Camera culling and physics body alignment.

    Source:
    @@ -1989,7 +2239,7 @@ The crop is only applied if you have set Sprite.cropEnabled to true.

    Source:
    @@ -2099,7 +2349,7 @@ The crop is only applied if you have set Sprite.cropEnabled to true.

    Source:
    @@ -2206,7 +2456,7 @@ The crop is only applied if you have set Sprite.cropEnabled to true.

    Source:
    @@ -2316,7 +2566,117 @@ The crop is only applied if you have set Sprite.cropEnabled to true.

    Source:
    + + + + + + + +
    + + + +
    + + + +
    +

    debug

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    debug + + +boolean + + + +

    Handy flag to use with Game.enableStep

    +
    + + + + + + + + +
    Inherited From:
    +
    + + + + + + + + + + + +
    Default Value:
    +
    • false
    + + + +
    Source:
    +
    @@ -2341,7 +2701,7 @@ The crop is only applied if you have set Sprite.cropEnabled to true.

    -

    Returns the delta x value. The difference between Sprite.x now and in the previous step.

    +

    Returns the delta x value. The difference between world.x now and in the previous step.

    @@ -2427,7 +2787,7 @@ The crop is only applied if you have set Sprite.cropEnabled to true.

    Source:
    @@ -2452,7 +2812,7 @@ The crop is only applied if you have set Sprite.cropEnabled to true.

    -

    Returns the delta x value. The difference between Sprite.y now and in the previous step.

    +

    Returns the delta y value. The difference between world.y now and in the previous step.

    @@ -2538,7 +2898,118 @@ The crop is only applied if you have set Sprite.cropEnabled to true.

    Source:
    + + + + + + + +
    + + + +
    + + + +
    +

    <readonly> deltaZ

    + + +
    +
    + +
    +

    Returns the delta z value. The difference between rotation now and in the previous step.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    deltaZ + + +number + + + +

    The delta value.

    +
    + + + + + + + + +
    Inherited From:
    +
    + + + + + + + + + + + + + +
    Source:
    +
    @@ -2645,7 +3116,224 @@ The crop is only applied if you have set Sprite.cropEnabled to true.

    Source:
    + + + + + + + +
    + + + +
    + + + +
    +

    events

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    events + + +Phaser.Events + + + +

    The Events you can subscribe to that are dispatched when certain things happen on this Sprite or its components.

    +
    + + + + + + + + +
    Inherited From:
    +
    + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    exists

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    exists + + +boolean + + + +

    If exists = false then the Sprite isn't updated by the core game loop or physics subsystem at all.

    +
    + + + + + + + + +
    Inherited From:
    +
    + + + + + + + + + + + +
    Default Value:
    +
    • true
    + + + +
    Source:
    +
    @@ -2869,7 +3557,122 @@ The crop is only applied if you have set Sprite.cropEnabled to true.

    Source:
    + + + + + + + +
    + + + +
    + + + +
    +

    fixedToCamera

    + + +
    +
    + +
    +

    A Sprite that is fixed to the camera uses its x/y coordinates as offsets from the top left of the camera. +Note that if this Image is a child of a display object that has changed its position then the offset will be calculated from that.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    fixedToCamera + + +boolean + + + +

    Fixes this Sprite to the Camera.

    +
    + + + + + + + + +
    Inherited From:
    +
    + + + + + + + + + + + +
    Default Value:
    +
    • false
    + + + +
    Source:
    +
    @@ -3180,7 +3983,7 @@ The crop is only applied if you have set Sprite.cropEnabled to true.

    Source:
    @@ -3198,7 +4001,7 @@ The crop is only applied if you have set Sprite.cropEnabled to true.

    -

    group

    +

    game

    @@ -3237,13 +4040,13 @@ The crop is only applied if you have set Sprite.cropEnabled to true.

    - group + game -Phaser.Group +Phaser.Game @@ -3253,7 +4056,7 @@ The crop is only applied if you have set Sprite.cropEnabled to true.

    -

    The parent Group of this Sprite. This is usually set after Sprite instantiation by the parent.

    +

    A reference to the currently running Game.

    @@ -3270,7 +4073,7 @@ The crop is only applied if you have set Sprite.cropEnabled to true.

    Inherited From:
    @@ -3287,7 +4090,7 @@ The crop is only applied if you have set Sprite.cropEnabled to true.

    Source:
    @@ -3394,7 +4197,114 @@ The crop is only applied if you have set Sprite.cropEnabled to true.

    Source:
    + + + + + + + +
    + + + +
    + + + +
    +

    health

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    health + + +number + + + +

    Health value. Used in combination with damage() to allow for quick killing of Sprites.

    +
    + + + + + + + + +
    Inherited From:
    +
    + + + + + + + + + + + + + +
    Source:
    +
    @@ -3506,7 +4416,7 @@ If you wish to crop the Sprite instead see the Sprite.crop value.

    Source:
    @@ -3715,7 +4625,117 @@ If you wish to crop the Sprite instead see the Sprite.crop value.

    Source:
    + + + + + + + +
    + + + +
    + + + +
    +

    input

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    input + + +Phaser.InputHandler +| + +null + + + +

    The Input Handler for this object. Needs to be enabled with image.inputEnabled = true before you can use it.

    +
    + + + + + + + + +
    Inherited From:
    +
    + + + + + + + + + + + + + +
    Source:
    +
    @@ -3929,7 +4949,118 @@ activated for this Sprite instance and it will then start to process click/touch
    Source:
    + + + + + + + +
    + + + +
    + + + +
    +

    <readonly> inWorld

    + + +
    +
    + +
    +

    Checks if the Image bounds are within the game world, otherwise false if fully outside of it.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    inWorld + + +boolean + + + +

    True if the Image bounds is within the game world, even if only partially. Otherwise false if fully outside of it.

    +
    + + + + + + + + +
    Inherited From:
    +
    + + + + + + + + + + + + + +
    Source:
    +
    @@ -4039,7 +5170,7 @@ activated for this Sprite instance and it will then start to process click/touch
    Source:
    @@ -4155,7 +5286,123 @@ activated for this Sprite instance and it will then start to process click/touch
    Source:
    + + + + + + + +
    + + + +
    + + + +
    +

    key

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    key + + +string +| + +Phaser.RenderTexture +| + +Phaser.BitmapData +| + +PIXI.Texture + + + +

    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, BitmapData or PIXI.Texture.

    +
    + + + + + + + + +
    Inherited From:
    +
    + + + + + + + + + + + + + +
    Source:
    +
    @@ -4270,7 +5517,122 @@ The lifespan is decremented by game.time.elapsed each update, once it reaches ze
    Source:
    + + + + + + + +
    + + + +
    + + + +
    +

    lifespan

    + + +
    +
    + +
    +

    If you would like the Sprite to have a lifespan once 'born' you can set this to a positive value. Handy for particles, bullets, etc. +The lifespan is decremented by game.time.elapsed each update, once it reaches zero the kill() function is called.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    lifespan + + +number + + + +

    The lifespan of the Sprite (in ms) before it will be killed.

    +
    + + + + + + + + +
    Inherited From:
    +
    + + + + + + + + + + + +
    Default Value:
    +
    • 0
    + + + +
    Source:
    +
    @@ -4377,7 +5739,114 @@ The lifespan is decremented by game.time.elapsed each update, once it reaches ze
    Source:
    + + + + + + + +
    + + + +
    + + + +
    +

    name

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    name + + +string + + + +

    The user defined name given to this Sprite.

    +
    + + + + + + + + +
    Inherited From:
    +
    + + + + + + + + + + + + + +
    Source:
    +
    @@ -4484,7 +5953,7 @@ The lifespan is decremented by game.time.elapsed each update, once it reaches ze
    Source:
    @@ -4594,7 +6063,117 @@ The lifespan is decremented by game.time.elapsed each update, once it reaches ze
    Source:
    + + + + + + + +
    + + + +
    + + + +
    +

    outOfBoundsKill

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    outOfBoundsKill + + +boolean + + + +

    If true the Sprite is killed as soon as Sprite.inWorld is false.

    +
    + + + + + + + + +
    Inherited From:
    +
    + + + + + + + + + + + +
    Default Value:
    +
    • false
    + + + +
    Source:
    +
    @@ -4701,7 +6280,7 @@ The lifespan is decremented by game.time.elapsed each update, once it reaches ze
    Source:
    @@ -4719,7 +6298,7 @@ The lifespan is decremented by game.time.elapsed each update, once it reaches ze
    -

    scale

    +

    <readonly> renderOrderID

    @@ -4758,13 +6337,13 @@ The lifespan is decremented by game.time.elapsed each update, once it reaches ze - scale + renderOrderID -Phaser.Point +number @@ -4774,7 +6353,7 @@ The lifespan is decremented by game.time.elapsed each update, once it reaches ze -

    The scale of the Sprite when rendered. By default it's set to 1 (no scale). You can modify it via scale.x or scale.y or scale.setTo(x, y). A value of 1 means no change to the scale, 0.5 means "half the size", 2 means "twice the size", etc.

    +

    The render order ID, reset every frame.

    @@ -4791,7 +6370,7 @@ The lifespan is decremented by game.time.elapsed each update, once it reaches ze
    Inherited From:
    @@ -4808,7 +6387,7 @@ The lifespan is decremented by game.time.elapsed each update, once it reaches ze
    Source:
    @@ -5021,7 +6600,7 @@ The lifespan is decremented by game.time.elapsed each update, once it reaches ze
    Source:
    @@ -5332,7 +6911,7 @@ The lifespan is decremented by game.time.elapsed each update, once it reaches ze
    Source:
    @@ -5439,7 +7018,7 @@ The lifespan is decremented by game.time.elapsed each update, once it reaches ze
    Source:
    @@ -5653,7 +7232,7 @@ If you wish to crop the Sprite instead see the Sprite.crop value.

    Source:
    @@ -5760,7 +7339,114 @@ If you wish to crop the Sprite instead see the Sprite.crop value.

    Source:
    + + + + + + + +
    + + + +
    + + + +
    +

    world

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    world + + +Phaser.Point + + + +

    The world coordinates of this Sprite. This differs from the x/y coordinates which are relative to the Sprites container.

    +
    + + + + + + + + +
    Inherited From:
    +
    + + + + + + + + + + + + + +
    Source:
    +
    @@ -5867,7 +7553,7 @@ If you wish to crop the Sprite instead see the Sprite.crop value.

    Source:
    @@ -5974,7 +7660,7 @@ If you wish to crop the Sprite instead see the Sprite.crop value.

    Source:
    @@ -6081,7 +7767,7 @@ If you wish to crop the Sprite instead see the Sprite.crop value.

    Source:
    @@ -6188,7 +7874,7 @@ If you wish to crop the Sprite instead see the Sprite.crop value.

    Source:
    @@ -6259,7 +7945,93 @@ bought to the top of that Group, not the entire display list.

    Source:
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    (Phaser.Sprite) This instance.

    +
    + + + + + + + +
    + + + +
    +

    bringToTop()

    + + +
    +
    + + +
    +

    Brings the Sprite to the top of the display list it is a child of. Sprites that are members of a Phaser.Group are only +bought to the top of that Group, not the entire display list.

    +
    + + + + + + + + + +
    + + + + + + + +
    Inherited From:
    +
    + + + + + + + + + + + + + +
    Source:
    +
    @@ -6417,7 +8189,266 @@ Doesn't change the anchor point of the sprite.

    Source:
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    (Phaser.Sprite) This instance.

    +
    + + + + + + + +
    + + + +
    +

    crop(rect)

    + + +
    +
    + + +
    +

    Crop allows you to crop the texture used to display this Image. +Cropping takes place from the top-left of the Image and can be modified in real-time by providing an updated rectangle object.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    rect + + +Phaser.Rectangle + + + +

    The Rectangle to crop the Image to. Pass null or no parameters to clear a previously set crop rectangle.

    + + + + +
    + + + + + + + +
    Inherited From:
    +
    + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    damage(amount)

    + + +
    +
    + + +
    +

    Damages the Sprite, this removes the given amount from the Sprites health property. +If health is then taken below zero Sprite.kill is called.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    amount + + +number + + + +

    The amount to subtract from the Sprite.health value.

    + + + + +
    + + + + + + + +
    Inherited From:
    +
    + + + + + + + + + + + + + +
    Source:
    +
    @@ -6552,7 +8583,7 @@ If health is then taken below zero Sprite.kill is called.

    Source:
    @@ -6586,6 +8617,200 @@ If health is then taken below zero Sprite.kill is called.

    +
    + + + +
    +

    deltaX() → {number}

    + + +
    +
    + + +
    +

    Returns the delta x value. The difference between Sprite.x now and in the previous step.

    +
    + + + + + + + + + +
    + + + + + + + +
    Inherited From:
    +
    + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    The delta value. Positive if the motion was to the right, negative if to the left.

    +
    + + + +
    +
    + Type +
    +
    + +number + + +
    +
    + + + + + +
    + + + +
    +

    deltaY() → {number}

    + + +
    +
    + + +
    +

    Returns the delta x value. The difference between Sprite.y now and in the previous step.

    +
    + + + + + + + + + +
    + + + + + + + +
    Inherited From:
    +
    + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    The delta value. Positive if the motion was downwards, negative if upwards.

    +
    + + + +
    +
    + Type +
    +
    + +number + + +
    +
    + + + + +
    @@ -6712,7 +8937,157 @@ and nulls its reference to game, freeing it up for garbage collection.

    Source:
    + + + + + + + + + + + + + + + + + + + + + + + + + +
    +

    destroy()

    + + +
    +
    + + +
    +

    Destroys the Sprite. This removes it from its parent group, destroys the input, event and animation handlers if present +and nulls its reference to game, freeing it up for garbage collection.

    +
    + + + + + + + + + +
    + + + + + + + +
    Inherited From:
    +
    + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    drawPolygon()

    + + +
    +
    + + +
    +

    /* +Draws a {Phaser.Polygon} or a {PIXI.Polygon} filled

    +
    + + + + + + + + + +
    + + + + + + + +
    Inherited From:
    +
    + + + + + + + + + + + + + +
    Source:
    +
    @@ -6882,7 +9257,7 @@ Mostly only used internally.

    Source:
    @@ -7075,7 +9450,7 @@ Mostly only used internally by the Input Manager, but also useful for custom hit
    Source:
    @@ -7175,7 +9550,95 @@ If you don't need this Sprite any more you should call Sprite.destroy instead.Source:
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    (Phaser.Sprite) This instance.

    +
    + + + + + + + +
    + + + +
    +

    kill()

    + + +
    +
    + + +
    +

    Kills a Sprite. A killed Sprite has its alive, exists and visible properties all set to false. +It will dispatch the onKilled event, you can listen to Sprite.events.onKilled for the signal. +Note that killing a Sprite is a way for you to quickly recycle it in a Sprite pool, it doesn't free it up from memory. +If you don't need this Sprite any more you should call Sprite.destroy instead.

    +
    + + + + + + + + + +
    + + + + + + + +
    Inherited From:
    +
    + + + + + + + + + + + + + +
    Source:
    +
    @@ -7345,7 +9808,166 @@ This causes a WebGL texture update, so use sparingly or in low-intensity portion
    Source:
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    loadTexture(key, frame)

    + + +
    +
    + + +
    +

    Changes the Texture the Sprite is using entirely. The old texture is removed and the new one is referenced or fetched from the Cache. +This causes a WebGL texture update, so use sparingly or in low-intensity portions of your game.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    key + + +string +| + +Phaser.RenderTexture +| + +Phaser.BitmapData +| + +PIXI.Texture + + + +

    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, BitmapData or PIXI.Texture.

    frame + + +string +| + +number + + + +

    If this Sprite is using part of a sprite sheet or texture atlas you can specify the exact frame to use by giving a string or numeric index.

    + + + + +
    + + + + + + + +
    Inherited From:
    +
    + + + + + + + + + + + + + +
    Source:
    +
    @@ -7602,7 +10224,287 @@ If the requested animation is already playing this request will be ignored. If y
    Source:
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    A reference to playing Animation instance.

    +
    + + + +
    +
    + Type +
    +
    + +Phaser.Animation + + +
    +
    + + + + + +
    + + + +
    +

    play(name, frameRate, loop, killOnComplete) → {Phaser.Animation}

    + + +
    +
    + + +
    +

    Play an animation based on the given key. The animation should previously have been added via sprite.animations.add() +If the requested animation is already playing this request will be ignored. If you need to reset an already running animation do so directly on the Animation object itself.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeArgumentDefaultDescription
    name + + +string + + + + + + + + + + + +

    The name of the animation to be played, e.g. "fire", "walk", "jump".

    frameRate + + +number + + + + + + <optional>
    + + + + + +
    + + null + +

    The framerate to play the animation at. The speed is given in frames per second. If not provided the previously set frameRate of the Animation is used.

    loop + + +boolean + + + + + + <optional>
    + + + + + +
    + + false + +

    Should the animation be looped after playback. If not provided the previously set loop value of the Animation is used.

    killOnComplete + + +boolean + + + + + + <optional>
    + + + + + +
    + + false + +

    If set to true when the animation completes (only happens if loop=false) the parent Sprite will be killed.

    + + + + +
    + + + + + + + +
    Inherited From:
    +
    + + + + + + + + + + + + + +
    Source:
    +
    @@ -7699,7 +10601,81 @@ If the requested animation is already playing this request will be ignored. If y
    Source:
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    postUpdate()

    + + +
    +
    + + +
    +

    Internal function called by the World postUpdate cycle.

    +
    + + + + + + + + + +
    + + + + + + + +
    Inherited From:
    +
    + + + + + + + + + + + + + +
    Source:
    +
    @@ -7773,7 +10749,81 @@ If the requested animation is already playing this request will be ignored. If y
    Source:
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    preUpdate()

    + + +
    +
    + + +
    +

    Automatically called by World.preUpdate.

    +
    + + + + + + + + + +
    + + + + + + + +
    Inherited From:
    +
    + + + + + + + + + + + + + +
    Source:
    +
    @@ -7988,7 +11038,233 @@ If the Sprite has a physics body that too is reset.

    Source:
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    (Phaser.Sprite) This instance.

    +
    + + + + + + + +
    + + + +
    +

    reset(x, y, health)

    + + +
    +
    + + +
    +

    Resets the Sprite. This places the Sprite at the given x/y world coordinates and then +sets alive, exists, visible and renderable all to true. Also resets the outOfBounds state and health values. +If the Sprite has a physics body that too is reset.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeArgumentDefaultDescription
    x + + +number + + + + + + + + + + + +

    The x coordinate (in world space) to position the Sprite at.

    y + + +number + + + + + + + + + + + +

    The y coordinate (in world space) to position the Sprite at.

    health + + +number + + + + + + <optional>
    + + + + + +
    + + 1 + +

    The health to give the Sprite.

    + + + + +
    + + + + + + + +
    Inherited From:
    +
    + + + + + + + + + + + + + +
    Source:
    +
    @@ -8073,7 +11349,7 @@ If the Sprite has a physics body that too is reset.

    Source:
    @@ -8218,7 +11494,163 @@ It will dispatch the onRevived event, you can listen to Sprite.events.onRevived
    Source:
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    (Phaser.Sprite) This instance.

    +
    + + + + + + + +
    + + + +
    +

    revive(health)

    + + +
    +
    + + +
    +

    Brings a 'dead' Sprite back to life, optionally giving it the health value specified. +A resurrected Sprite has its alive, exists and visible properties all set to true. +It will dispatch the onRevived event, you can listen to Sprite.events.onRevived for the signal.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeArgumentDefaultDescription
    health + + +number + + + + + + <optional>
    + + + + + +
    + + 1 + +

    The health to give the Sprite.

    + + + + +
    + + + + + + + +
    Inherited From:
    +
    + + + + + + + + + + + + + +
    Source:
    +
    @@ -8303,7 +11735,7 @@ It will dispatch the onRevived event, you can listen to Sprite.events.onRevived
    Source:
    @@ -8377,7 +11809,7 @@ It will dispatch the onRevived event, you can listen to Sprite.events.onRevived
    Source:
    @@ -8451,7 +11883,7 @@ It will dispatch the onRevived event, you can listen to Sprite.events.onRevived
    Source:
    @@ -8525,7 +11957,7 @@ It will dispatch the onRevived event, you can listen to Sprite.events.onRevived
    Source:
    @@ -8576,7 +12008,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 05 2014 06:28:35 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:52 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Tilemap.html b/docs/Phaser.Tilemap.html index feae7e2e..789fd2db 100644 --- a/docs/Phaser.Tilemap.html +++ b/docs/Phaser.Tilemap.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -652,7 +686,7 @@ A map may have multiple layers. You can perform operations on the map data such
    Source:
    @@ -712,7 +746,7 @@ A map may have multiple layers. You can perform operations on the map data such
    Source:
    @@ -814,7 +848,7 @@ A map may have multiple layers. You can perform operations on the map data such
    Source:
    @@ -916,7 +950,7 @@ A map may have multiple layers. You can perform operations on the map data such
    Source:
    @@ -1027,6 +1061,210 @@ A map may have multiple layers. You can perform operations on the map data such +
    + + + +
    + + + +
    +

    height

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    height + + +number + + + +

    The height of the map (in tiles).

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    heightInPixels

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    heightInPixels + + +number + + + +

    The height of the map in pixels based on height * tileHeight.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + +
    @@ -1120,7 +1358,7 @@ A map may have multiple layers. You can perform operations on the map data such
    Source:
    @@ -1324,7 +1562,7 @@ A map may have multiple layers. You can perform operations on the map data such
    Source:
    @@ -1426,7 +1664,313 @@ A map may have multiple layers. You can perform operations on the map data such
    Source:
    + + + + + + + + + + + + + + + +
    +

    orientation

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    orientation + + +string + + + +

    The orientation of the map data (as specified in Tiled), usually 'orthogonal'.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    properties

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    properties + + +object + + + +

    Map specific properties as specified in Tiled.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    tileHeight

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    tileHeight + + +number + + + +

    The base height of the tiles in the map (in pixels).

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    @@ -1528,7 +2072,7 @@ A map may have multiple layers. You can perform operations on the map data such
    Source:
    @@ -1630,7 +2174,415 @@ A map may have multiple layers. You can perform operations on the map data such
    Source:
    + + + + + + + +
    + + + +
    + + + +
    +

    tileWidth

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    tileWidth + + +number + + + +

    The base width of the tiles in the map (in pixels).

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    version

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    version + + +number + + + +

    The version of the map data (as specified in Tiled, usually 1).

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    width

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    width + + +number + + + +

    The width of the map (in tiles).

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    widthInPixels

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    widthInPixels + + +number + + + +

    The width of the map in pixels based on width * tileWidth.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    @@ -1788,7 +2740,125 @@ Note that the tileset name can be found in the JSON file exported from Tiled, or
    Source:
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    <protected> calculateFaces(layer)

    + + +
    +
    + + +
    +

    Internal function.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    layer + + +number + + + +

    The index of the TilemapLayer to operate on.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    @@ -2048,7 +3118,7 @@ Note that the tileset name can be found in the JSON file exported from Tiled, or
    Source:
    @@ -2235,7 +3305,7 @@ Note that the tileset name can be found in the JSON file exported from Tiled, or
    Source:
    @@ -2258,6 +3328,623 @@ Note that the tileset name can be found in the JSON file exported from Tiled, or +
    + + + +
    +

    createFromObjects(name, gid, key, frame, exists, autoCull, group)

    + + +
    +
    + + +
    +

    Creates a Sprite for every object matching the given gid in the map data. You can optionally specify the group that the Sprite will be created in. If none is +given it will be created in the World. All properties from the map data objectgroup are copied across to the Sprite, so you can use this as an easy way to +configure Sprite properties from within the map editor. For example giving an object a property if alpha: 0.5 in the map editor will duplicate that when the +Sprite is created. You could also give it a value like: body.velocity.x: 100 to set it moving automatically.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeArgumentDefaultDescription
    name + + +string + + + + + + + + + + + +

    The name of the Object Group to create Sprites from.

    gid + + +number + + + + + + + + + + + +

    The layer array index value, or if a string is given the layer name, within the map data that this TilemapLayer represents.

    key + + +string + + + + + + + + + + + +

    The Game.cache key of the image that this Sprite will use.

    frame + + +number +| + +string + + + + + + <optional>
    + + + + + +
    + +

    If the Sprite image contains multiple frames you can specify which one to use here.

    exists + + +boolean + + + + + + <optional>
    + + + + + +
    + + true + +

    The default exists state of the Sprite.

    autoCull + + +boolean + + + + + + <optional>
    + + + + + +
    + + true + +

    The default autoCull state of the Sprite. Sprites that are autoCulled are culled from the camera if out of its range.

    group + + +Phaser.Group + + + + + + <optional>
    + + + + + +
    + +

    Optional Group to add the Sprite to. If not specified it will be added to the World group.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    createLayer(layer, width, height, group) → {Phaser.TilemapLayer}

    + + +
    +
    + + +
    +

    Creates a new TilemapLayer object. By default TilemapLayers are fixed to the camera. +The layer parameter is important. If you've created your map in Tiled then you can get this by looking in Tiled and looking at the Layer name. +Or you can open the JSON file it exports and look at the layers[].name value. Either way it must match.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeArgumentDescription
    layer + + +number +| + +string + + + + + + + + + +

    The layer array index value, or if a string is given the layer name, within the map data that this TilemapLayer represents.

    width + + +number + + + + + + <optional>
    + + + + + +

    The rendered width of the layer, should never be wider than Game.width. If not given it will be set to Game.width.

    height + + +number + + + + + + <optional>
    + + + + + +

    The rendered height of the layer, should never be wider than Game.height. If not given it will be set to Game.height.

    group + + +Phaser.Group + + + + + + <optional>
    + + + + + +

    Optional Group to add the object to. If not specified it will be added to the World group.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    The TilemapLayer object. This is an extension of Phaser.Sprite and can be moved around the display list accordingly.

    +
    + + + +
    +
    + Type +
    +
    + +Phaser.TilemapLayer + + +
    +
    + + + + +
    @@ -2304,7 +3991,7 @@ Note that the tileset name can be found in the JSON file exported from Tiled, or
    Source:
    @@ -2373,7 +4060,7 @@ Note that the tileset name can be found in the JSON file exported from Tiled, or
    Source:
    @@ -2664,7 +4351,7 @@ Note that the tileset name can be found in the JSON file exported from Tiled, or
    Source:
    @@ -2986,7 +4673,7 @@ Note that the tileset name can be found in the JSON file exported from Tiled, or
    Source:
    @@ -3009,6 +4696,740 @@ Note that the tileset name can be found in the JSON file exported from Tiled, or + + + + +
    +

    getImageIndex(name) → {number}

    + + +
    +
    + + +
    +

    Gets the image index based on its name.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    name + + +string + + + +

    The name of the image to get.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    The index of the image in this tilemap, or null if not found.

    +
    + + + +
    +
    + Type +
    +
    + +number + + +
    +
    + + + + + +
    + + + +
    +

    <protected> getIndex(location, name) → {number}

    + + +
    +
    + + +
    +

    Gets the layer index based on the layers name.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    location + + +array + + + +

    The local array to search.

    name + + +string + + + +

    The name of the array element to get.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    The index of the element in the array, or null if not found.

    +
    + + + +
    +
    + Type +
    +
    + +number + + +
    +
    + + + + + +
    + + + +
    +

    <protected> getLayer(layer) → {number}

    + + +
    +
    + + +
    +

    Gets the TilemapLayer index as used in the setCollision calls.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    layer + + +number +| + +string +| + +Phaser.TilemapLayer + + + +

    The layer to operate on. If not given will default to this.currentLayer.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    The TilemapLayer index.

    +
    + + + +
    +
    + Type +
    +
    + +number + + +
    +
    + + + + + +
    + + + +
    +

    getLayerIndex(name) → {number}

    + + +
    +
    + + +
    +

    Gets the layer index based on its name.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    name + + +string + + + +

    The name of the layer to get.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    The index of the layer in this tilemap, or null if not found.

    +
    + + + +
    +
    + Type +
    +
    + +number + + +
    +
    + + + + + +
    + + + +
    +

    getObjectIndex(name) → {number}

    + + +
    +
    + + +
    +

    Gets the object index based on its name.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    name + + +string + + + +

    The name of the object to get.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    The index of the object in this tilemap, or null if not found.

    +
    + + + +
    +
    + Type +
    +
    + +number + + +
    +
    + + + + +
    @@ -3184,7 +5605,7 @@ Note that the tileset name can be found in the JSON file exported from Tiled, or
    Source:
    @@ -3230,6 +5651,807 @@ Note that the tileset name can be found in the JSON file exported from Tiled, or + + + + +
    +

    getTileAbove(layer, x, y)

    + + +
    +
    + + +
    +

    Gets the tile above the tile coordinates given. +Mostly used as an internal function by calculateFaces.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    layer + + +number + + + +

    The local layer index to get the tile from. Can be determined by Tilemap.getLayer().

    x + + +number + + + +

    The x coordinate to get the tile from. In tiles, not pixels.

    y + + +number + + + +

    The y coordinate to get the tile from. In tiles, not pixels.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    getTileBelow(layer, x, y)

    + + +
    +
    + + +
    +

    Gets the tile below the tile coordinates given. +Mostly used as an internal function by calculateFaces.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    layer + + +number + + + +

    The local layer index to get the tile from. Can be determined by Tilemap.getLayer().

    x + + +number + + + +

    The x coordinate to get the tile from. In tiles, not pixels.

    y + + +number + + + +

    The y coordinate to get the tile from. In tiles, not pixels.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    getTileLeft(layer, x, y)

    + + +
    +
    + + +
    +

    Gets the tile to the left of the tile coordinates given. +Mostly used as an internal function by calculateFaces.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    layer + + +number + + + +

    The local layer index to get the tile from. Can be determined by Tilemap.getLayer().

    x + + +number + + + +

    The x coordinate to get the tile from. In tiles, not pixels.

    y + + +number + + + +

    The y coordinate to get the tile from. In tiles, not pixels.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    getTileRight(layer, x, y)

    + + +
    +
    + + +
    +

    Gets the tile to the right of the tile coordinates given. +Mostly used as an internal function by calculateFaces.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    layer + + +number + + + +

    The local layer index to get the tile from. Can be determined by Tilemap.getLayer().

    x + + +number + + + +

    The x coordinate to get the tile from. In tiles, not pixels.

    y + + +number + + + +

    The y coordinate to get the tile from. In tiles, not pixels.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    getTilesetIndex(name) → {number}

    + + +
    +
    + + +
    +

    Gets the tileset index based on its name.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    name + + +string + + + +

    The name of the tileset to get.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + +
    Returns:
    + + +
    +

    The index of the tileset in this tilemap, or null if not found.

    +
    + + + +
    +
    + Type +
    +
    + +number + + +
    +
    + + + + +
    @@ -3405,7 +6627,7 @@ Note that the tileset name can be found in the JSON file exported from Tiled, or
    Source:
    @@ -3657,7 +6879,7 @@ Note that the tileset name can be found in the JSON file exported from Tiled, or
    Source:
    @@ -3889,7 +7111,7 @@ Note that the tileset name can be found in the JSON file exported from Tiled, or
    Source:
    @@ -4183,7 +7405,7 @@ Note that the tileset name can be found in the JSON file exported from Tiled, or
    Source:
    @@ -4443,7 +7665,7 @@ Note that the tileset name can be found in the JSON file exported from Tiled, or
    Source:
    @@ -4512,7 +7734,7 @@ Note that the tileset name can be found in the JSON file exported from Tiled, or
    Source:
    @@ -4834,7 +8056,947 @@ Note that the tileset name can be found in the JSON file exported from Tiled, or
    Source:
    + + + + + + + + + + + + + + + + + + + + + + + + + +
    +

    setCollision(indexes, collides, layer)

    + + +
    +
    + + +
    +

    Sets collision the given tile or tiles. You can pass in either a single numeric index or an array of indexes: [ 2, 3, 15, 20]. +The collides parameter controls if collision will be enabled (true) or disabled (false).

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeArgumentDefaultDescription
    indexes + + +number +| + +array + + + + + + + + + + + +

    Either a single tile index, or an array of tile IDs to be checked for collision.

    collides + + +boolean + + + + + + <optional>
    + + + + + +
    + + true + +

    If true it will enable collision. If false it will clear collision.

    layer + + +number +| + +string +| + +Phaser.TilemapLayer + + + + + + <optional>
    + + + + + +
    + +

    The layer to operate on. If not given will default to this.currentLayer.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    setCollisionBetween(start, stop, collides, layer)

    + + +
    +
    + + +
    +

    Sets collision on a range of tiles where the tile IDs increment sequentially. +Calling this with a start value of 10 and a stop value of 14 would set collision for tiles 10, 11, 12, 13 and 14. +The collides parameter controls if collision will be enabled (true) or disabled (false).

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeArgumentDefaultDescription
    start + + +number + + + + + + + + + + + +

    The first index of the tile to be set for collision.

    stop + + +number + + + + + + + + + + + +

    The last index of the tile to be set for collision.

    collides + + +boolean + + + + + + <optional>
    + + + + + +
    + + true + +

    If true it will enable collision. If false it will clear collision.

    layer + + +number +| + +string +| + +Phaser.TilemapLayer + + + + + + <optional>
    + + + + + +
    + +

    The layer to operate on. If not given will default to this.currentLayer.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    setCollisionByExclusion(indexes, collides, layer)

    + + +
    +
    + + +
    +

    Sets collision on all tiles in the given layer, except for the IDs of those in the given array. +The collides parameter controls if collision will be enabled (true) or disabled (false).

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeArgumentDefaultDescription
    indexes + + +array + + + + + + + + + + + +

    An array of the tile IDs to not be counted for collision.

    collides + + +boolean + + + + + + <optional>
    + + + + + +
    + + true + +

    If true it will enable collision. If false it will clear collision.

    layer + + +number +| + +string +| + +Phaser.TilemapLayer + + + + + + <optional>
    + + + + + +
    + +

    The layer to operate on. If not given will default to this.currentLayer.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    <protected> setCollisionByIndex(index, collides, layer, recalculate)

    + + +
    +
    + + +
    +

    Sets collision values on a tile in the set. +You shouldn't usually call this method directly, instead use setCollision, setCollisionBetween or setCollisionByExclusion.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeArgumentDefaultDescription
    index + + +number + + + + + + + + + + + +

    The index of the tile on the layer.

    collides + + +boolean + + + + + + <optional>
    + + + + + +
    + + true + +

    If true it will enable collision on the tile. If false it will clear collision values from the tile.

    layer + + +number + + + + + + <optional>
    + + + + + +
    + +

    The layer to operate on. If not given will default to this.currentLayer.

    recalculate + + +boolean + + + + + + <optional>
    + + + + + +
    + + true + +

    Recalculates the tile faces after the update.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    @@ -4958,7 +9120,565 @@ Note that the tileset name can be found in the JSON file exported from Tiled, or
    Source:
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    setTileIndexCallback(indexes, callback, callbackContext, layer)

    + + +
    +
    + + +
    +

    Sets a global collision callback for the given tile index within the layer. This will affect all tiles on this layer that have the same index. +If a callback is already set for the tile index it will be replaced. Set the callback to null to remove it. +If you want to set a callback for a tile at a specific location on the map then see setTileLocationCallback.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeArgumentDescription
    indexes + + +number +| + +array + + + + + + + + + +

    Either a single tile index, or an array of tile indexes to have a collision callback set for.

    callback + + +function + + + + + + + + + +

    The callback that will be invoked when the tile is collided with.

    callbackContext + + +object + + + + + + + + + +

    The context under which the callback is called.

    layer + + +number +| + +string +| + +Phaser.TilemapLayer + + + + + + <optional>
    + + + + + +

    The layer to operate on. If not given will default to this.currentLayer.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    setTileLocationCallback(x, y, width, height, callback, callbackContext, layer)

    + + +
    +
    + + +
    +

    Sets a global collision callback for the given tile index within the layer. This will affect all tiles on this layer that have the same index. +If a callback is already set for the tile index it will be replaced. Set the callback to null to remove it. +If you want to set a callback for a tile at a specific location on the map then see setTileLocationCallback.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeArgumentDescription
    x + + +number + + + + + + + + + +

    X position of the top left of the area to copy (given in tiles, not pixels)

    y + + +number + + + + + + + + + +

    Y position of the top left of the area to copy (given in tiles, not pixels)

    width + + +number + + + + + + + + + +

    The width of the area to copy (given in tiles, not pixels)

    height + + +number + + + + + + + + + +

    The height of the area to copy (given in tiles, not pixels)

    callback + + +function + + + + + + + + + +

    The callback that will be invoked when the tile is collided with.

    callbackContext + + +object + + + + + + + + + +

    The context under which the callback is called.

    layer + + +number +| + +string +| + +Phaser.TilemapLayer + + + + + + <optional>
    + + + + + +

    The layer to operate on. If not given will default to this.currentLayer.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    @@ -5218,7 +9938,7 @@ Note that the tileset name can be found in the JSON file exported from Tiled, or
    Source:
    @@ -5540,7 +10260,7 @@ Note that the tileset name can be found in the JSON file exported from Tiled, or
    Source:
    @@ -5591,7 +10311,7 @@ Note that the tileset name can be found in the JSON file exported from Tiled, or Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:35 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:51 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.TilemapLayer.html b/docs/Phaser.TilemapLayer.html index 6324e83e..fd9324a7 100644 --- a/docs/Phaser.TilemapLayer.html +++ b/docs/Phaser.TilemapLayer.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -4600,7 +4634,7 @@ half as quickly as the 'normal' camera-locked layers do)

    Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:35 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:52 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.TilemapParser.html b/docs/Phaser.TilemapParser.html index 8da89b64..00666bcf 100644 --- a/docs/Phaser.TilemapParser.html +++ b/docs/Phaser.TilemapParser.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -1443,7 +1477,7 @@ Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:35 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:52 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Tileset.html b/docs/Phaser.Tileset.html index 2a1cd745..f33eb683 100644 --- a/docs/Phaser.Tileset.html +++ b/docs/Phaser.Tileset.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -1835,124 +1869,6 @@ You should not normally instantiate this class directly.

    -
    -

    <protected> calculateFaces(layer)

    - - -
    -
    - - -
    -

    Internal function.

    -
    - - - - - - - -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    layer - - -number - - - -

    The index of the TilemapLayer to operate on.

    - - - - -
    - - - - - - - - - - - - - - - - - - - -
    Source:
    -
    - - - - - - - -
    - - - - - - - - - - - - - -
    - - -

    checkTileIndex(index) → {boolean}

    @@ -2094,1355 +2010,6 @@ You should not normally instantiate this class directly.

    -
    - - - -
    -

    createFromObjects(name, gid, key, frame, exists, autoCull, group)

    - - -
    -
    - - -
    -

    Creates a Sprite for every object matching the given gid in the map data. You can optionally specify the group that the Sprite will be created in. If none is -given it will be created in the World. All properties from the map data objectgroup are copied across to the Sprite, so you can use this as an easy way to -configure Sprite properties from within the map editor. For example giving an object a property if alpha: 0.5 in the map editor will duplicate that when the -Sprite is created. You could also give it a value like: body.velocity.x: 100 to set it moving automatically.

    -
    - - - - - - - -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeArgumentDefaultDescription
    name - - -string - - - - - - - - - - - -

    The name of the Object Group to create Sprites from.

    gid - - -number - - - - - - - - - - - -

    The layer array index value, or if a string is given the layer name, within the map data that this TilemapLayer represents.

    key - - -string - - - - - - - - - - - -

    The Game.cache key of the image that this Sprite will use.

    frame - - -number -| - -string - - - - - - <optional>
    - - - - - -
    - -

    If the Sprite image contains multiple frames you can specify which one to use here.

    exists - - -boolean - - - - - - <optional>
    - - - - - -
    - - true - -

    The default exists state of the Sprite.

    autoCull - - -boolean - - - - - - <optional>
    - - - - - -
    - - true - -

    The default autoCull state of the Sprite. Sprites that are autoCulled are culled from the camera if out of its range.

    group - - -Phaser.Group - - - - - - <optional>
    - - - - - -
    - -

    Optional Group to add the Sprite to. If not specified it will be added to the World group.

    - - - - -
    - - - - - - - - - - - - - - - - - - - -
    Source:
    -
    - - - - - - - -
    - - - - - - - - - - - - - -
    - - - -
    -

    createLayer(layer, width, height, group) → {Phaser.TilemapLayer}

    - - -
    -
    - - -
    -

    Creates a new TilemapLayer object. By default TilemapLayers are fixed to the camera.

    -
    - - - - - - - -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeArgumentDescription
    layer - - -number -| - -string - - - - - - - - - -

    The layer array index value, or if a string is given the layer name, within the map data that this TilemapLayer represents.

    width - - -number - - - - - - <optional>
    - - - - - -

    The rendered width of the layer, should never be wider than Game.width. If not given it will be set to Game.width.

    height - - -number - - - - - - <optional>
    - - - - - -

    The rendered height of the layer, should never be wider than Game.height. If not given it will be set to Game.height.

    group - - -Phaser.Group - - - - - - <optional>
    - - - - - -

    Optional Group to add the object to. If not specified it will be added to the World group.

    - - - - -
    - - - - - - - - - - - - - - - - - - - -
    Source:
    -
    - - - - - - - -
    - - - - - - - - - - - -
    Returns:
    - - -
    -

    The TilemapLayer object. This is an extension of Phaser.Sprite and can be moved around the display list accordingly.

    -
    - - - -
    -
    - Type -
    -
    - -Phaser.TilemapLayer - - -
    -
    - - - - - -
    - - - -
    -

    getImageIndex(name) → {number}

    - - -
    -
    - - -
    -

    Gets the image index based on its name.

    -
    - - - - - - - -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    name - - -string - - - -

    The name of the image to get.

    - - - - -
    - - - - - - - - - - - - - - - - - - - -
    Source:
    -
    - - - - - - - -
    - - - - - - - - - - - -
    Returns:
    - - -
    -

    The index of the image in this tilemap, or null if not found.

    -
    - - - -
    -
    - Type -
    -
    - -number - - -
    -
    - - - - - -
    - - - -
    -

    <protected> getIndex(location, name) → {number}

    - - -
    -
    - - -
    -

    Gets the layer index based on the layers name.

    -
    - - - - - - - -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    location - - -array - - - -

    The local array to search.

    name - - -string - - - -

    The name of the array element to get.

    - - - - -
    - - - - - - - - - - - - - - - - - - - -
    Source:
    -
    - - - - - - - -
    - - - - - - - - - - - -
    Returns:
    - - -
    -

    The index of the element in the array, or null if not found.

    -
    - - - -
    -
    - Type -
    -
    - -number - - -
    -
    - - - - - -
    - - - -
    -

    <protected> getLayer(layer) → {number}

    - - -
    -
    - - -
    -

    Gets the TilemapLayer index as used in the setCollision calls.

    -
    - - - - - - - -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    layer - - -number -| - -string -| - -Phaser.TilemapLayer - - - -

    The layer to operate on. If not given will default to this.currentLayer.

    - - - - -
    - - - - - - - - - - - - - - - - - - - -
    Source:
    -
    - - - - - - - -
    - - - - - - - - - - - -
    Returns:
    - - -
    -

    The TilemapLayer index.

    -
    - - - -
    -
    - Type -
    -
    - -number - - -
    -
    - - - - - -
    - - - -
    -

    getLayerIndex(name) → {number}

    - - -
    -
    - - -
    -

    Gets the layer index based on its name.

    -
    - - - - - - - -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    name - - -string - - - -

    The name of the layer to get.

    - - - - -
    - - - - - - - - - - - - - - - - - - - -
    Source:
    -
    - - - - - - - -
    - - - - - - - - - - - -
    Returns:
    - - -
    -

    The index of the layer in this tilemap, or null if not found.

    -
    - - - -
    -
    - Type -
    -
    - -number - - -
    -
    - - - - - -
    - - - -
    -

    getObjectIndex(name) → {number}

    - - -
    -
    - - -
    -

    Gets the object index based on its name.

    -
    - - - - - - - -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    name - - -string - - - -

    The name of the object to get.

    - - - - -
    - - - - - - - - - - - - - - - - - - - -
    Source:
    -
    - - - - - - - -
    - - - - - - - - - - - -
    Returns:
    - - -
    -

    The index of the object in this tilemap, or null if not found.

    -
    - - - -
    -
    - Type -
    -
    - -number - - -
    -
    - - - - -
    @@ -3588,807 +2155,6 @@ Sprite is created. You could also give it a value like: body.velocity.x: 100 to - - - - -
    -

    getTileAbove(layer, x, y)

    - - -
    -
    - - -
    -

    Gets the tile above the tile coordinates given. -Mostly used as an internal function by calculateFaces.

    -
    - - - - - - - -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    layer - - -number - - - -

    The local layer index to get the tile from. Can be determined by Tilemap.getLayer().

    x - - -number - - - -

    The x coordinate to get the tile from. In tiles, not pixels.

    y - - -number - - - -

    The y coordinate to get the tile from. In tiles, not pixels.

    - - - - -
    - - - - - - - - - - - - - - - - - - - -
    Source:
    -
    - - - - - - - -
    - - - - - - - - - - - - - -
    - - - -
    -

    getTileBelow(layer, x, y)

    - - -
    -
    - - -
    -

    Gets the tile below the tile coordinates given. -Mostly used as an internal function by calculateFaces.

    -
    - - - - - - - -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    layer - - -number - - - -

    The local layer index to get the tile from. Can be determined by Tilemap.getLayer().

    x - - -number - - - -

    The x coordinate to get the tile from. In tiles, not pixels.

    y - - -number - - - -

    The y coordinate to get the tile from. In tiles, not pixels.

    - - - - -
    - - - - - - - - - - - - - - - - - - - -
    Source:
    -
    - - - - - - - -
    - - - - - - - - - - - - - -
    - - - -
    -

    getTileLeft(layer, x, y)

    - - -
    -
    - - -
    -

    Gets the tile to the left of the tile coordinates given. -Mostly used as an internal function by calculateFaces.

    -
    - - - - - - - -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    layer - - -number - - - -

    The local layer index to get the tile from. Can be determined by Tilemap.getLayer().

    x - - -number - - - -

    The x coordinate to get the tile from. In tiles, not pixels.

    y - - -number - - - -

    The y coordinate to get the tile from. In tiles, not pixels.

    - - - - -
    - - - - - - - - - - - - - - - - - - - -
    Source:
    -
    - - - - - - - -
    - - - - - - - - - - - - - -
    - - - -
    -

    getTileRight(layer, x, y)

    - - -
    -
    - - -
    -

    Gets the tile to the right of the tile coordinates given. -Mostly used as an internal function by calculateFaces.

    -
    - - - - - - - -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    layer - - -number - - - -

    The local layer index to get the tile from. Can be determined by Tilemap.getLayer().

    x - - -number - - - -

    The x coordinate to get the tile from. In tiles, not pixels.

    y - - -number - - - -

    The y coordinate to get the tile from. In tiles, not pixels.

    - - - - -
    - - - - - - - - - - - - - - - - - - - -
    Source:
    -
    - - - - - - - -
    - - - - - - - - - - - - - -
    - - - -
    -

    getTilesetIndex(name) → {number}

    - - -
    -
    - - -
    -

    Gets the tileset index based on its name.

    -
    - - - - - - - -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    name - - -string - - - -

    The name of the tileset to get.

    - - - - -
    - - - - - - - - - - - - - - - - - - - -
    Source:
    -
    - - - - - - - -
    - - - - - - - - - - - -
    Returns:
    - - -
    -

    The index of the tileset in this tilemap, or null if not found.

    -
    - - - -
    -
    - Type -
    -
    - -number - - -
    -
    - - - - -
    @@ -4679,946 +2445,6 @@ Mostly used as an internal function by calculateFaces.

    - - - - -
    -

    setCollision(indexes, collides, layer)

    - - -
    -
    - - -
    -

    Sets collision the given tile or tiles. You can pass in either a single numeric index or an array of indexes: [ 2, 3, 15, 20]. -The collides parameter controls if collision will be enabled (true) or disabled (false).

    -
    - - - - - - - -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeArgumentDefaultDescription
    indexes - - -number -| - -array - - - - - - - - - - - -

    Either a single tile index, or an array of tile IDs to be checked for collision.

    collides - - -boolean - - - - - - <optional>
    - - - - - -
    - - true - -

    If true it will enable collision. If false it will clear collision.

    layer - - -number -| - -string -| - -Phaser.TilemapLayer - - - - - - <optional>
    - - - - - -
    - -

    The layer to operate on. If not given will default to this.currentLayer.

    - - - - -
    - - - - - - - - - - - - - - - - - - - -
    Source:
    -
    - - - - - - - -
    - - - - - - - - - - - - - -
    - - - -
    -

    setCollisionBetween(start, stop, collides, layer)

    - - -
    -
    - - -
    -

    Sets collision on a range of tiles where the tile IDs increment sequentially. -Calling this with a start value of 10 and a stop value of 14 would set collision for tiles 10, 11, 12, 13 and 14. -The collides parameter controls if collision will be enabled (true) or disabled (false).

    -
    - - - - - - - -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeArgumentDefaultDescription
    start - - -number - - - - - - - - - - - -

    The first index of the tile to be set for collision.

    stop - - -number - - - - - - - - - - - -

    The last index of the tile to be set for collision.

    collides - - -boolean - - - - - - <optional>
    - - - - - -
    - - true - -

    If true it will enable collision. If false it will clear collision.

    layer - - -number -| - -string -| - -Phaser.TilemapLayer - - - - - - <optional>
    - - - - - -
    - -

    The layer to operate on. If not given will default to this.currentLayer.

    - - - - -
    - - - - - - - - - - - - - - - - - - - -
    Source:
    -
    - - - - - - - -
    - - - - - - - - - - - - - -
    - - - -
    -

    setCollisionByExclusion(indexes, collides, layer)

    - - -
    -
    - - -
    -

    Sets collision on all tiles in the given layer, except for the IDs of those in the given array. -The collides parameter controls if collision will be enabled (true) or disabled (false).

    -
    - - - - - - - -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeArgumentDefaultDescription
    indexes - - -array - - - - - - - - - - - -

    An array of the tile IDs to not be counted for collision.

    collides - - -boolean - - - - - - <optional>
    - - - - - -
    - - true - -

    If true it will enable collision. If false it will clear collision.

    layer - - -number -| - -string -| - -Phaser.TilemapLayer - - - - - - <optional>
    - - - - - -
    - -

    The layer to operate on. If not given will default to this.currentLayer.

    - - - - -
    - - - - - - - - - - - - - - - - - - - -
    Source:
    -
    - - - - - - - -
    - - - - - - - - - - - - - -
    - - - -
    -

    <protected> setCollisionByIndex(index, collides, layer, recalculate)

    - - -
    -
    - - -
    -

    Sets collision values on a tile in the set. -You shouldn't usually call this method directly, instead use setCollision, setCollisionBetween or setCollisionByExclusion.

    -
    - - - - - - - -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeArgumentDefaultDescription
    index - - -number - - - - - - - - - - - -

    The index of the tile on the layer.

    collides - - -boolean - - - - - - <optional>
    - - - - - -
    - - true - -

    If true it will enable collision on the tile. If false it will clear collision values from the tile.

    layer - - -number - - - - - - <optional>
    - - - - - -
    - -

    The layer to operate on. If not given will default to this.currentLayer.

    recalculate - - -boolean - - - - - - <optional>
    - - - - - -
    - - true - -

    Recalculates the tile faces after the update.

    - - - - -
    - - - - - - - - - - - - - - - - - - - -
    Source:
    -
    - - - - - - - -
    - - - - - - - - - - - - -
    @@ -5782,564 +2608,6 @@ You shouldn't usually call this method directly, instead use setCollision, setCo - - - - -
    -

    setTileIndexCallback(indexes, callback, callbackContext, layer)

    - - -
    -
    - - -
    -

    Sets a global collision callback for the given tile index within the layer. This will affect all tiles on this layer that have the same index. -If a callback is already set for the tile index it will be replaced. Set the callback to null to remove it. -If you want to set a callback for a tile at a specific location on the map then see setTileLocationCallback.

    -
    - - - - - - - -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeArgumentDescription
    indexes - - -number -| - -array - - - - - - - - - -

    Either a single tile index, or an array of tile indexes to have a collision callback set for.

    callback - - -function - - - - - - - - - -

    The callback that will be invoked when the tile is collided with.

    callbackContext - - -object - - - - - - - - - -

    The context under which the callback is called.

    layer - - -number -| - -string -| - -Phaser.TilemapLayer - - - - - - <optional>
    - - - - - -

    The layer to operate on. If not given will default to this.currentLayer.

    - - - - -
    - - - - - - - - - - - - - - - - - - - -
    Source:
    -
    - - - - - - - -
    - - - - - - - - - - - - - -
    - - - -
    -

    setTileLocationCallback(x, y, width, height, callback, callbackContext, layer)

    - - -
    -
    - - -
    -

    Sets a global collision callback for the given tile index within the layer. This will affect all tiles on this layer that have the same index. -If a callback is already set for the tile index it will be replaced. Set the callback to null to remove it. -If you want to set a callback for a tile at a specific location on the map then see setTileLocationCallback.

    -
    - - - - - - - -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeArgumentDescription
    x - - -number - - - - - - - - - -

    X position of the top left of the area to copy (given in tiles, not pixels)

    y - - -number - - - - - - - - - -

    Y position of the top left of the area to copy (given in tiles, not pixels)

    width - - -number - - - - - - - - - -

    The width of the area to copy (given in tiles, not pixels)

    height - - -number - - - - - - - - - -

    The height of the area to copy (given in tiles, not pixels)

    callback - - -function - - - - - - - - - -

    The callback that will be invoked when the tile is collided with.

    callbackContext - - -object - - - - - - - - - -

    The context under which the callback is called.

    layer - - -number -| - -string -| - -Phaser.TilemapLayer - - - - - - <optional>
    - - - - - -

    The layer to operate on. If not given will default to this.currentLayer.

    - - - - -
    - - - - - - - - - - - - - - - - - - - -
    Source:
    -
    - - - - - - - -
    - - - - - - - - - - - - -
    @@ -6368,7 +2636,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 05 2014 06:28:35 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:52 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Time.html b/docs/Phaser.Time.html index 8daece68..4206af8f 100644 --- a/docs/Phaser.Time.html +++ b/docs/Phaser.Time.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -3082,7 +3116,7 @@ Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:36 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:52 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Timer.html b/docs/Phaser.Timer.html index 0457fc84..62f289d1 100644 --- a/docs/Phaser.Timer.html +++ b/docs/Phaser.Timer.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -1049,7 +1083,7 @@ So if you want to fire an event every quarter of a second you'd need to set the
    Source:
    @@ -1460,7 +1494,7 @@ So if you want to fire an event every quarter of a second you'd need to set the
    Source:
    @@ -1562,7 +1596,7 @@ So if you want to fire an event every quarter of a second you'd need to set the
    Source:
    @@ -1664,7 +1698,7 @@ So if you want to fire an event every quarter of a second you'd need to set the
    Source:
    @@ -2180,7 +2214,7 @@ So if you want to fire an event every quarter of a second you'd need to set the
    Source:
    @@ -2493,7 +2527,7 @@ If the Timer is already running the delay will be calculated based on the timers
    Source:
    @@ -2880,7 +2914,7 @@ If the Timer is already running the delay will be calculated based on the timers
    Source:
    @@ -3347,7 +3381,7 @@ If the Timer is already running the delay will be calculated based on the timers
    Source:
    @@ -3746,7 +3780,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 05 2014 06:28:36 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:52 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.TimerEvent.html b/docs/Phaser.TimerEvent.html index ca35f0e0..6cffa887 100644 --- a/docs/Phaser.TimerEvent.html +++ b/docs/Phaser.TimerEvent.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -1229,6 +1263,108 @@ It can call a specific callback, passing in optional parameters.

    + + + + + + + + +
    +

    <protected> pendingDelete

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    pendingDelete + + +boolean + + + +

    A flag that controls if the TimerEvent is pending deletion.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + +
    @@ -1569,7 +1705,7 @@ It can call a specific callback, passing in optional parameters.

    Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:36 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:52 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Touch.html b/docs/Phaser.Touch.html index 0bcca464..db008289 100644 --- a/docs/Phaser.Touch.html +++ b/docs/Phaser.Touch.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -2641,7 +2675,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 05 2014 06:28:36 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:53 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Tween.html b/docs/Phaser.Tween.html index 1730684c..c4c94645 100644 --- a/docs/Phaser.Tween.html +++ b/docs/Phaser.Tween.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -3130,7 +3164,7 @@ Used in combination with repeat you can create endless loops.

    Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:36 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:53 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.TweenManager.html b/docs/Phaser.TweenManager.html index 93737650..8ef46d6d 100644 --- a/docs/Phaser.TweenManager.html +++ b/docs/Phaser.TweenManager.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -1634,7 +1668,7 @@ Please see https://github.com/sole/tw Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:36 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:53 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Utils.Debug.html b/docs/Phaser.Utils.Debug.html index f4c4033c..72d1b6ee 100644 --- a/docs/Phaser.Utils.Debug.html +++ b/docs/Phaser.Utils.Debug.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -2316,7 +2350,7 @@ your game set to use Phaser.AUTO then swap it for Phaser.CANVAS to ensure WebGL
    Source:
    @@ -3109,7 +3143,7 @@ your game set to use Phaser.AUTO then swap it for Phaser.CANVAS to ensure WebGL
    Source:
    @@ -4164,7 +4198,7 @@ your game set to use Phaser.AUTO then swap it for Phaser.CANVAS to ensure WebGL
    Source:
    @@ -4333,7 +4367,7 @@ your game set to use Phaser.AUTO then swap it for Phaser.CANVAS to ensure WebGL
    -

    renderRectangle(rect, color)

    +

    renderRectangle(rect, color, filled)

    @@ -4367,6 +4401,8 @@ your game set to use Phaser.AUTO then swap it for Phaser.CANVAS to ensure WebGL + Default + Description @@ -4400,6 +4436,10 @@ your game set to use Phaser.AUTO then swap it for Phaser.CANVAS to ensure WebGL + + + +

    The Rectangle to render.

    @@ -4433,11 +4473,54 @@ your game set to use Phaser.AUTO then swap it for Phaser.CANVAS to ensure WebGL + + + +

    Color of the debug info to be rendered (format is css color string).

    + + + + filled + + + + + +boolean + + + + + + + + + <optional>
    + + + + + + + + + + + + true + + + + +

    Render the rectangle as a fillRect (default, true) or a strokeRect (false)

    + + + @@ -6363,7 +6446,7 @@ your game set to use Phaser.AUTO then swap it for Phaser.CANVAS to ensure WebGL
    Source:
    @@ -6856,7 +6939,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 05 2014 06:28:36 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:53 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Utils.html b/docs/Phaser.Utils.html index 840f9c11..13275310 100644 --- a/docs/Phaser.Utils.html +++ b/docs/Phaser.Utils.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -1259,7 +1293,7 @@ dir = 1 (left), 2 (right), 3 (both)

    Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:36 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:53 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.World.html b/docs/Phaser.World.html index 2328e0fa..72de4a0d 100644 --- a/docs/Phaser.World.html +++ b/docs/Phaser.World.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -667,7 +701,7 @@ the world at world-based coordinates. By default a world is created the same siz
    Source:
    @@ -774,7 +808,7 @@ the world at world-based coordinates. By default a world is created the same siz
    Source:
    @@ -886,7 +920,7 @@ This will have no impact on the rotation value of its children, but it will upda
    Source:
    @@ -1199,7 +1233,7 @@ So if you want to make a game in which the world itself will rotate you should a
    Source:
    @@ -1301,7 +1335,7 @@ So if you want to make a game in which the world itself will rotate you should a
    Source:
    @@ -1515,7 +1549,7 @@ The cursor is set to the first child added to the Group and doesn't change unles
    Source:
    @@ -1588,7 +1622,7 @@ The cursor is set to the first child added to the Group and doesn't change unles -

    If exists is true the the Group is updated, otherwise it is skipped.

    +

    If exists is true the Group is updated, otherwise it is skipped.

    @@ -1625,7 +1659,7 @@ The cursor is set to the first child added to the Group and doesn't change unles
    Source:
    @@ -1741,113 +1775,6 @@ The cursor is set to the first child added to the Group and doesn't change unles - - - - - - - - -
    -

    group

    - - -
    -
    - - - - - -
    - - -
    Properties:
    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    group - - -Phaser.Group - - - -

    The parent Group of this Group, if a child of another.

    -
    - - - - - - - - -
    Inherited From:
    -
    - - - - - - - - - - - - - -
    Source:
    -
    - - - - - - -
    @@ -1941,7 +1868,7 @@ The cursor is set to the first child added to the Group and doesn't change unles
    Source:
    @@ -2048,7 +1975,7 @@ The cursor is set to the first child added to the Group and doesn't change unles
    Source:
    @@ -2164,113 +2091,6 @@ The cursor is set to the first child added to the Group and doesn't change unles - - - - - - - - -
    -

    pivot

    - - -
    -
    - - - - - -
    - - -
    Properties:
    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    pivot - - -Phaser.Point - - - -

    The pivot point of the Group container.

    -
    - - - - - - - - -
    Inherited From:
    -
    - - - - - - - - - - - - - -
    Source:
    -
    - - - - - - -
    @@ -2364,7 +2184,7 @@ The cursor is set to the first child added to the Group and doesn't change unles
    Source:
    @@ -2466,7 +2286,7 @@ The cursor is set to the first child added to the Group and doesn't change unles
    Source:
    @@ -2578,7 +2398,7 @@ This will have no impact on the rotation value of its children, but it will upda
    Source:
    @@ -2651,7 +2471,7 @@ This will have no impact on the rotation value of its children, but it will upda -

    The scane of the Group container.

    +

    The scale of the Group container.

    @@ -2685,7 +2505,7 @@ This will have no impact on the rotation value of its children, but it will upda
    Source:
    @@ -2792,7 +2612,7 @@ This will have no impact on the rotation value of its children, but it will upda
    Source:
    @@ -2899,7 +2719,7 @@ This will have no impact on the rotation value of its children, but it will upda
    Source:
    @@ -2972,7 +2792,7 @@ This will have no impact on the rotation value of its children, but it will upda -

    Gets or sets the visible state of the World.

    +

    The visible state of the Group. Non-visible Groups and all of their children are not rendered.

    @@ -2987,6 +2807,11 @@ This will have no impact on the rotation value of its children, but it will upda +
    Inherited From:
    +
    + @@ -3001,7 +2826,7 @@ This will have no impact on the rotation value of its children, but it will upda
    Source:
    @@ -3103,7 +2928,7 @@ This will have no impact on the rotation value of its children, but it will upda
    Source:
    @@ -3215,7 +3040,7 @@ This will have no impact on the x/y coordinates of its children, but it will upd
    Source:
    @@ -3327,7 +3152,7 @@ This will have no impact on the x/y coordinates of its children, but it will upd
    Source:
    @@ -3448,7 +3273,7 @@ that then see the addAt method.

    Source:
    @@ -3673,7 +3498,7 @@ Group.addAll('x', 10) will add 10 to the child.x value.

    Source:
    @@ -3820,7 +3645,7 @@ The child is added to the Group at the location specified by the index value, th
    Source:
    @@ -4035,7 +3860,7 @@ The child is added to the Group at the location specified by the index value, th
    Source:
    @@ -4274,7 +4099,7 @@ After the method parameter and context you can add as many extra parameters as y
    Source:
    @@ -4472,7 +4297,7 @@ After the existsValue parameter you can add as many parameters as you like, whic
    Source:
    @@ -4641,81 +4466,7 @@ After the existsValue parameter you can add as many parameters as you like, whic
    Source:
    - - - - - - - - - - - - - - - - - - - - - - - - - -
    -

    childTest()

    - - -
    -
    - - -
    -

    Internal test.

    -
    - - - - - - - - - -
    - - - - - - - -
    Inherited From:
    -
    - - - - - - - - - - - - - -
    Source:
    -
    @@ -4789,7 +4540,7 @@ After the existsValue parameter you can add as many parameters as you like, whic
    Source:
    @@ -4886,7 +4637,7 @@ After the existsValue parameter you can add as many parameters as you like, whic
    Source:
    @@ -5198,7 +4949,7 @@ Useful if you don't need to create the Sprite instances before-hand.

    Source:
    @@ -5476,7 +5227,7 @@ and will be positioned at 0, 0 (relative to the Group.x/y)

    Source:
    @@ -5545,7 +5296,7 @@ and will be positioned at 0, 0 (relative to the Group.x/y)

    Source:
    @@ -5738,7 +5489,7 @@ Group.divideAll('x', 2) will half the child.x value.

    Source:
    @@ -5910,7 +5661,7 @@ Note: Currently this will skip any children which are Groups themselves.

    Source:
    @@ -6058,7 +5809,7 @@ For example: Group.forEachAlive(causeDamage, this, 500)

    Source:
    @@ -6206,7 +5957,7 @@ For example: Group.forEachAlive(causeDamage, this, 500)

    Source:
    @@ -6354,7 +6105,7 @@ For example: Group.forEachDead(bringToLife, this)

    Source:
    @@ -6477,7 +6228,7 @@ For example: Group.forEachDead(bringToLife, this)

    Source:
    @@ -6575,7 +6326,7 @@ This is handy for checking if everything has been wiped out, or choosing a squad
    Source:
    @@ -6673,7 +6424,7 @@ This is handy for checking if everything has been wiped out, or choosing a squad
    Source:
    @@ -6819,7 +6570,7 @@ This is handy for checking if everything has been wiped out, or choosing a squad
    Source:
    @@ -6965,7 +6716,7 @@ This is handy for checking if everything has been wiped out, or choosing a squad
    Source:
    @@ -7134,7 +6885,7 @@ This is handy for checking if everything has been wiped out, or choosing a squad
    Source:
    @@ -7444,7 +7195,7 @@ You can add as many callback parameters as you like, which will all be passed to
    Source:
    @@ -7660,7 +7411,7 @@ Group.multiplyAll('x', 2) will x2 the child.x value.

    Source:
    @@ -7734,7 +7485,7 @@ Group.multiplyAll('x', 2) will x2 the child.x value.

    Source:
    @@ -7806,7 +7557,77 @@ The only exception to this is if the camera is following an object, in which cas
    Source:
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    preUpdate()

    + + +
    +
    + + +
    +

    This is called automatically after the plugins preUpdate and before the State.update. +Most objects have preUpdate methods and it's where initial movement, drawing and calculations are done.

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    @@ -7880,7 +7701,7 @@ The only exception to this is if the camera is following an object, in which cas
    Source:
    @@ -8003,7 +7824,7 @@ The only exception to this is if the camera is following an object, in which cas
    Source:
    @@ -8101,7 +7922,7 @@ The Group container remains on the display list.

    Source:
    @@ -8247,7 +8068,7 @@ The Group container remains on the display list.

    Source:
    @@ -8393,7 +8214,7 @@ The Group container remains on the display list.

    Source:
    @@ -8720,7 +8541,7 @@ The operation parameter controls how the new value is assigned to the property,
    Source:
    @@ -9012,7 +8833,7 @@ The operation parameter controls how the new value is assigned to the property,
    Source:
    @@ -9199,7 +9020,7 @@ The operation parameter controls how the new value is assigned to the property,
    Source:
    @@ -9447,7 +9268,7 @@ The operation parameter controls how the new value is assigned to the property,
    Source:
    @@ -9630,7 +9451,7 @@ For example to depth sort Sprites for Zelda-style game you might call grou
    Source:
    @@ -9823,7 +9644,7 @@ Group.subAll('x', 10) will minus 10 from the child.x value.

    Source:
    @@ -9851,7 +9672,7 @@ Group.subAll('x', 10) will minus 10 from the child.x value.

    -

    swap(child1, child2) → {boolean}

    +

    swap(child1, child2)

    @@ -9970,174 +9791,7 @@ You cannot swap a child with itself, or swap un-parented children, doing so will
    Source:
    - - - - - - - -
    - - - - - - - - - - - -
    Returns:
    - - -
    -

    True if the swap was successful, otherwise false.

    -
    - - - -
    -
    - Type -
    -
    - -boolean - - -
    -
    - - - - - -
    - - - -
    -

    swapIndex()

    - - -
    -
    - - -
    -

    Internal test.

    -
    - - - - - - - - - -
    - - - - - - - -
    Inherited From:
    -
    - - - - - - - - - - - - - -
    Source:
    -
    - - - - - - - -
    - - - - - - - - - - - - - -
    - - - -
    -

    update()

    - - -
    -
    - - -
    -

    This is called automatically after the plugins preUpdate and before the State.update. -Most objects have preUpdate methods and it's where initial movement, drawing and calculations are done.

    -
    - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - -
    Source:
    -
    @@ -10207,7 +9861,7 @@ Most objects won't have an update method set unless explicitly given one.

    Source:
    @@ -10258,7 +9912,7 @@ Most objects won't have an update method set unless explicitly given one.

    Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:37 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:53 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.html b/docs/Phaser.html index ecf95de5..2c8d0676 100644 --- a/docs/Phaser.html +++ b/docs/Phaser.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -549,6 +583,9 @@
    Group
    +
    Image
    +
    +
    Input
    @@ -618,6 +655,9 @@
    RenderTexture
    +
    RenderTexture
    +
    +
    RequestAnimationFrame
    @@ -636,6 +676,9 @@
    Sprite
    +
    Sprite
    +
    +
    Stage
    @@ -724,7 +767,7 @@ Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:25 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:41 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.js.html b/docs/Phaser.js.html index 0c5ebf0e..51548077 100644 --- a/docs/Phaser.js.html +++ b/docs/Phaser.js.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -427,7 +461,7 @@ var Phaser = Phaser || { VERSION: '<%= version %>', - DEV_VERSION: '1.1.4', + DEV_VERSION: '1.2', GAMES: [], AUTO: 0, @@ -461,7 +495,7 @@ var Phaser = Phaser || { CANVAS_PX_ROUND: false, CANVAS_CLEAR_RECT: true - }; +}; PIXI.InteractionManager = function (dummy) { // We don't need this in Pixi, so we've removed it to save space @@ -488,7 +522,7 @@ PIXI.InteractionManager = function (dummy) { Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Plugin.js.html b/docs/Plugin.js.html index 8302d705..65c12d15 100644 --- a/docs/Plugin.js.html +++ b/docs/Plugin.js.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -559,7 +593,7 @@ Phaser.Plugin.prototype.constructor = Phaser.Plugin; Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/PluginManager.js.html b/docs/PluginManager.js.html index b2bd4a46..d7aab5e4 100644 --- a/docs/PluginManager.js.html +++ b/docs/PluginManager.js.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -735,7 +769,7 @@ Phaser.PluginManager.prototype.constructor = Phaser.PluginManager; Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Point.js.html b/docs/Point.js.html index 34a3fe53..4029a52e 100644 --- a/docs/Point.js.html +++ b/docs/Point.js.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -476,8 +510,25 @@ Phaser.Point.prototype = { */ setTo: function (x, y) { - this.x = x; - this.y = y; + this.x = x || 0; + this.y = y || ( (y !== 0) ? this.x : 0 ); + + return this; + + }, + + /** + * Sets the x and y values of this Point object to the given coordinates. + * @method Phaser.Point#set + * @param {number} x - The horizontal position of this point. + * @param {number} y - The vertical position of this point. + * @return {Point} This Point object. Useful for chaining method calls. + */ + set: function (x, y) { + + this.x = x || 0; + this.y = y || ( (y !== 0) ? this.x : 0 ); + return this; }, @@ -593,9 +644,16 @@ Phaser.Point.prototype = { */ clone: function (output) { - if (typeof output === "undefined") { output = new Phaser.Point(); } + if (typeof output === "undefined") + { + output = new Phaser.Point(this.x, this.y); + } + else + { + output.setTo(this.x, this.y); + } - return output.setTo(this.x, this.y); + return output; }, @@ -847,6 +905,9 @@ Phaser.Point.rotate = function (a, x, y, angle, asDegrees, distance) { return a.setTo(x + distance * Math.cos(angle), y + distance * Math.sin(angle)); }; + +// Because PIXI uses its own Point, we'll replace it with ours to avoid duplicating code or confusion. +PIXI.Point = Phaser.Point;
    @@ -868,7 +929,7 @@ Phaser.Point.rotate = function (a, x, y, angle, asDegrees, distance) { Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Pointer.js.html b/docs/Pointer.js.html index 12357a84..5f633965 100644 --- a/docs/Pointer.js.html +++ b/docs/Pointer.js.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -1080,7 +1114,7 @@ Object.defineProperty(Phaser.Pointer.prototype, "worldY", { Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Polygon.js.html b/docs/Polygon.js.html index 2a9440c0..7b2d953b 100644 --- a/docs/Polygon.js.html +++ b/docs/Polygon.js.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -465,7 +499,7 @@ Phaser.Polygon.prototype.constructor = Phaser.Polygon; Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/QuadTree.js.html b/docs/QuadTree.js.html index 856ca076..de48b23f 100644 --- a/docs/QuadTree.js.html +++ b/docs/QuadTree.js.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -723,7 +757,7 @@ Phaser.QuadTree.prototype.constructor = Phaser.QuadTree; Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/RandomDataGenerator.js.html b/docs/RandomDataGenerator.js.html index 20d38246..436502a1 100644 --- a/docs/RandomDataGenerator.js.html +++ b/docs/RandomDataGenerator.js.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -685,7 +719,7 @@ Phaser.RandomDataGenerator.prototype.constructor = Phaser.RandomDataGenerator; Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Rectangle.js.html b/docs/Rectangle.js.html index 4b5a9635..8287a74d 100644 --- a/docs/Rectangle.js.html +++ b/docs/Rectangle.js.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -430,7 +464,7 @@ * @param {number} y - The y coordinate of the top-left corner of the Rectangle. * @param {number} width - The width of the Rectangle. * @param {number} height - The height of the Rectangle. -* @return {Rectangle} This Rectangle object. +* @return {Phaser.Rectangle} This Rectangle object. */ Phaser.Rectangle = function (x, y, width, height) { @@ -468,7 +502,7 @@ Phaser.Rectangle.prototype = { * @method Phaser.Rectangle#offset * @param {number} dx - Moves the x value of the Rectangle object by this amount. * @param {number} dy - Moves the y value of the Rectangle object by this amount. - * @return {Rectangle} This Rectangle object. + * @return {Phaser.Rectangle} This Rectangle object. */ offset: function (dx, dy) { @@ -482,11 +516,13 @@ Phaser.Rectangle.prototype = { /** * Adjusts the location of the Rectangle object using a Point object as a parameter. This method is similar to the Rectangle.offset() method, except that it takes a Point object as a parameter. * @method Phaser.Rectangle#offsetPoint - * @param {Point} point - A Point object to use to offset this Rectangle object. - * @return {Rectangle} This Rectangle object. + * @param {Phaser.Point} point - A Point object to use to offset this Rectangle object. + * @return {Phaser.Rectangle} This Rectangle object. */ offsetPoint: function (point) { + return this.offset(point.x, point.y); + }, /** @@ -496,7 +532,7 @@ Phaser.Rectangle.prototype = { * @param {number} y - The y coordinate of the top-left corner of the Rectangle. * @param {number} width - The width of the Rectangle in pixels. * @param {number} height - The height of the Rectangle in pixels. - * @return {Rectangle} This Rectangle object + * @return {Phaser.Rectangle} This Rectangle object */ setTo: function (x, y, width, height) { @@ -508,7 +544,7 @@ Phaser.Rectangle.prototype = { return this; }, - + /** * Runs Math.floor() on both the x and y values of this Rectangle. * @method Phaser.Rectangle#floor @@ -537,10 +573,12 @@ Phaser.Rectangle.prototype = { * Copies the x, y, width and height properties from any given object to this Rectangle. * @method Phaser.Rectangle#copyFrom * @param {any} source - The object to copy from. - * @return {Rectangle} This Rectangle object. + * @return {Phaser.Rectangle} This Rectangle object. */ copyFrom: function (source) { + return this.setTo(source.x, source.y, source.width, source.height); + }, /** @@ -568,7 +606,9 @@ Phaser.Rectangle.prototype = { * @return {Phaser.Rectangle} This Rectangle object. */ inflate: function (dx, dy) { + return Phaser.Rectangle.inflate(this, dx, dy); + }, /** @@ -578,7 +618,9 @@ Phaser.Rectangle.prototype = { * @return {Phaser.Point} The size of the Rectangle object. */ size: function (output) { + return Phaser.Rectangle.size(this, output); + }, /** @@ -588,7 +630,9 @@ Phaser.Rectangle.prototype = { * @return {Phaser.Rectangle} */ clone: function (output) { + return Phaser.Rectangle.clone(this, output); + }, /** @@ -599,7 +643,9 @@ Phaser.Rectangle.prototype = { * @return {boolean} A value of true if the Rectangle object contains the specified point; otherwise false. */ contains: function (x, y) { + return Phaser.Rectangle.contains(this, x, y); + }, /** @@ -610,7 +656,9 @@ Phaser.Rectangle.prototype = { * @return {boolean} A value of true if the Rectangle object contains the specified point; otherwise false. */ containsRect: function (b) { + return Phaser.Rectangle.containsRect(this, b); + }, /** @@ -621,7 +669,9 @@ Phaser.Rectangle.prototype = { * @return {boolean} A value of true if the two Rectangles have exactly the same values for the x, y, width and height properties; otherwise false. */ equals: function (b) { + return Phaser.Rectangle.equals(this, b); + }, /** @@ -632,7 +682,9 @@ Phaser.Rectangle.prototype = { * @return {Phaser.Rectangle} A Rectangle object that equals the area of intersection. If the Rectangles do not intersect, this method returns an empty Rectangle object; that is, a Rectangle with its x, y, width, and height properties set to 0. */ intersection: function (b, out) { + return Phaser.Rectangle.intersection(this, b, out); + }, /** @@ -644,7 +696,9 @@ Phaser.Rectangle.prototype = { * @return {boolean} A value of true if the specified object intersects with this Rectangle object; otherwise false. */ intersects: function (b, tolerance) { + return Phaser.Rectangle.intersects(this, b, tolerance); + }, /** @@ -658,7 +712,9 @@ Phaser.Rectangle.prototype = { * @return {boolean} A value of true if the specified object intersects with the Rectangle; otherwise false. */ intersectsRaw: function (left, right, top, bottom, tolerance) { + return Phaser.Rectangle.intersectsRaw(this, left, right, top, bottom, tolerance); + }, /** @@ -669,7 +725,9 @@ Phaser.Rectangle.prototype = { * @return {Phaser.Rectangle} A Rectangle object that is the union of the two Rectangles. */ union: function (b, out) { + return Phaser.Rectangle.union(this, b, out); + }, /** @@ -678,237 +736,238 @@ Phaser.Rectangle.prototype = { * @return {string} A string representation of the instance. */ toString: function () { + return "[{Rectangle (x=" + this.x + " y=" + this.y + " width=" + this.width + " height=" + this.height + " empty=" + this.empty + ")}]"; - } -}; + }, -Phaser.Rectangle.prototype.constructor = Phaser.Rectangle; + /** + * @name Phaser.Rectangle#halfWidth + * @property {number} halfWidth - Half of the width of the Rectangle. + * @readonly + */ + get halfWidth() { -/** -* @name Phaser.Rectangle#halfWidth -* @property {number} halfWidth - Half of the width of the Rectangle. -* @readonly -*/ -Object.defineProperty(Phaser.Rectangle.prototype, "halfWidth", { - - get: function () { return Math.round(this.width / 2); - } -}); + }, -/** -* @name Phaser.Rectangle#halfHeight -* @property {number} halfHeight - Half of the height of the Rectangle. -* @readonly -*/ -Object.defineProperty(Phaser.Rectangle.prototype, "halfHeight", { + /** + * @name Phaser.Rectangle#halfHeight + * @property {number} halfHeight - Half of the height of the Rectangle. + * @readonly + */ + get halfHeight() { - get: function () { return Math.round(this.height / 2); - } -}); + }, + + /** + * The sum of the y and height properties. Changing the bottom property of a Rectangle object has no effect on the x, y and width properties, but does change the height property. + * @name Phaser.Rectangle#bottom + * @property {number} bottom - The sum of the y and height properties. + */ + get bottom() { -/** -* The sum of the y and height properties. Changing the bottom property of a Rectangle object has no effect on the x, y and width properties, but does change the height property. -* @name Phaser.Rectangle#bottom -* @property {number} bottom - The sum of the y and height properties. -*/ -Object.defineProperty(Phaser.Rectangle.prototype, "bottom", { - - get: function () { return this.y + this.height; + }, - set: function (value) { - if (value <= this.y) { + set bottom(value) { + + if (value <= this.y) + { this.height = 0; - } else { + } + else + { this.height = (this.y - value); } - } + }, -}); + /** + * The location of the Rectangles bottom right corner as a Point object. + * @name Phaser.Rectangle#bottomRight + * @property {Phaser.Point} bottomRight - Gets or sets the location of the Rectangles bottom right corner as a Point object. + */ + get bottomRight() { -/** -* The location of the Rectangles bottom right corner as a Point object. -* @name Phaser.Rectangle#bottom -* @property {Phaser.Point} bottomRight - Gets or sets the location of the Rectangles bottom right corner as a Point object. -*/ -Object.defineProperty(Phaser.Rectangle.prototype, "bottomRight", { - - get: function () { return new Phaser.Point(this.right, this.bottom); }, - set: function (value) { + + set bottomRight(value) { + this.right = value.x; this.bottom = value.y; - } -}); - -/** -* The x coordinate of the left of the Rectangle. Changing the left property of a Rectangle object has no effect on the y and height properties. However it does affect the width property, whereas changing the x value does not affect the width property. -* @name Phaser.Rectangle#left -* @property {number} left - The x coordinate of the left of the Rectangle. -*/ -Object.defineProperty(Phaser.Rectangle.prototype, "left", { - - get: function () { - return this.x; }, - set: function (value) { - if (value >= this.right) { + /** + * The x coordinate of the left of the Rectangle. Changing the left property of a Rectangle object has no effect on the y and height properties. However it does affect the width property, whereas changing the x value does not affect the width property. + * @name Phaser.Rectangle#left + * @property {number} left - The x coordinate of the left of the Rectangle. + */ + get left() { + + return this.x; + + }, + + set left(value) { + + if (value >= this.right) + { this.width = 0; - } else { + } + else + { this.width = this.right - value; } + this.x = value; - } - -}); - -/** -* The sum of the x and width properties. Changing the right property of a Rectangle object has no effect on the x, y and height properties, however it does affect the width property. -* @name Phaser.Rectangle#right -* @property {number} right - The sum of the x and width properties. -*/ -Object.defineProperty(Phaser.Rectangle.prototype, "right", { - - get: function () { - return this.x + this.width; }, - set: function (value) { - if (value <= this.x) { + /** + * The sum of the x and width properties. Changing the right property of a Rectangle object has no effect on the x, y and height properties, however it does affect the width property. + * @name Phaser.Rectangle#right + * @property {number} right - The sum of the x and width properties. + */ + get right() { + + return this.x + this.width; + + }, + + set right(value) { + + if (value <= this.x) + { this.width = 0; - } else { + } + else + { this.width = this.x + value; } - } -}); + }, + + /** + * The volume of the Rectangle derived from width * height. + * @name Phaser.Rectangle#volume + * @property {number} volume - The volume of the Rectangle derived from width * height. + * @readonly + */ + get volume() { -/** -* The volume of the Rectangle derived from width * height. -* @name Phaser.Rectangle#volume -* @property {number} volume - The volume of the Rectangle derived from width * height. -* @readonly -*/ -Object.defineProperty(Phaser.Rectangle.prototype, "volume", { - - get: function () { return this.width * this.height; - } -}); + }, + + /** + * The perimeter size of the Rectangle. This is the sum of all 4 sides. + * @name Phaser.Rectangle#perimeter + * @property {number} perimeter - The perimeter size of the Rectangle. This is the sum of all 4 sides. + * @readonly + */ + get perimeter() { -/** -* The perimeter size of the Rectangle. This is the sum of all 4 sides. -* @name Phaser.Rectangle#perimeter -* @property {number} perimeter - The perimeter size of the Rectangle. This is the sum of all 4 sides. -* @readonly -*/ -Object.defineProperty(Phaser.Rectangle.prototype, "perimeter", { - - get: function () { return (this.width * 2) + (this.height * 2); - } -}); + }, + + /** + * The x coordinate of the center of the Rectangle. + * @name Phaser.Rectangle#centerX + * @property {number} centerX - The x coordinate of the center of the Rectangle. + */ + get centerX() { -/** -* The x coordinate of the center of the Rectangle. -* @name Phaser.Rectangle#centerX -* @property {number} centerX - The x coordinate of the center of the Rectangle. -*/ -Object.defineProperty(Phaser.Rectangle.prototype, "centerX", { - - get: function () { return this.x + this.halfWidth; + }, - set: function (value) { + set centerX(value) { + this.x = value - this.halfWidth; - } -}); + }, + + /** + * The y coordinate of the center of the Rectangle. + * @name Phaser.Rectangle#centerY + * @property {number} centerY - The y coordinate of the center of the Rectangle. + */ + get centerY() { -/** -* The y coordinate of the center of the Rectangle. -* @name Phaser.Rectangle#centerY -* @property {number} centerY - The y coordinate of the center of the Rectangle. -*/ -Object.defineProperty(Phaser.Rectangle.prototype, "centerY", { - - get: function () { return this.y + this.halfHeight; + }, - set: function (value) { + set centerY(value) { + this.y = value - this.halfHeight; - } -}); - -/** -* The y coordinate of the top of the Rectangle. Changing the top property of a Rectangle object has no effect on the x and width properties. -* However it does affect the height property, whereas changing the y value does not affect the height property. -* @name Phaser.Rectangle#top -* @property {number} top - The y coordinate of the top of the Rectangle. -*/ -Object.defineProperty(Phaser.Rectangle.prototype, "top", { - - get: function () { - return this.y; }, - set: function (value) { - if (value >= this.bottom) { + /** + * The y coordinate of the top of the Rectangle. Changing the top property of a Rectangle object has no effect on the x and width properties. + * However it does affect the height property, whereas changing the y value does not affect the height property. + * @name Phaser.Rectangle#top + * @property {number} top - The y coordinate of the top of the Rectangle. + */ + get top() { + + return this.y; + + }, + + set top(value) { + + if (value >= this.bottom) + { this.height = 0; this.y = value; - } else { + } + else + { this.height = (this.bottom - value); } - } -}); + }, -/** -* The location of the Rectangles top left corner as a Point object. -* @name Phaser.Rectangle#topLeft -* @property {Phaser.Point} topLeft - The location of the Rectangles top left corner as a Point object. -*/ -Object.defineProperty(Phaser.Rectangle.prototype, "topLeft", { + /** + * The location of the Rectangles top left corner as a Point object. + * @name Phaser.Rectangle#topLeft + * @property {Phaser.Point} topLeft - The location of the Rectangles top left corner as a Point object. + */ + get topLeft() { - get: function () { return new Phaser.Point(this.x, this.y); + }, - set: function (value) { + set topLeft(value) { + this.x = value.x; this.y = value.y; - } -}); - -/** -* Determines whether or not this Rectangle object is empty. A Rectangle object is empty if its width or height is less than or equal to 0. -* If set to true then all of the Rectangle properties are set to 0. -* @name Phaser.Rectangle#empty -* @property {boolean} empty - Gets or sets the Rectangles empty state. -*/ -Object.defineProperty(Phaser.Rectangle.prototype, "empty", { - - get: function () { - return (!this.width || !this.height); }, - set: function (value) { + /** + * Determines whether or not this Rectangle object is empty. A Rectangle object is empty if its width or height is less than or equal to 0. + * If set to true then all of the Rectangle properties are set to 0. + * @name Phaser.Rectangle#empty + * @property {boolean} empty - Gets or sets the Rectangles empty state. + */ + get empty() { + + return (!this.width || !this.height); + + }, + + set empty(value) { if (value === true) { @@ -917,7 +976,9 @@ Object.defineProperty(Phaser.Rectangle.prototype, "empty", { } -}); +}; + +Phaser.Rectangle.prototype.constructor = Phaser.Rectangle; /** * Increases the size of the Rectangle object by the specified amounts. The center point of the Rectangle object stays the same, and its size increases to the left and right by the dx value, and to the top and the bottom by the dy value. @@ -928,11 +989,14 @@ Object.defineProperty(Phaser.Rectangle.prototype, "empty", { * @return {Phaser.Rectangle} This Rectangle object. */ Phaser.Rectangle.inflate = function (a, dx, dy) { + a.x -= dx; a.width += 2 * dx; a.y -= dy; a.height += 2 * dy; + return a; + }; /** @@ -943,7 +1007,9 @@ Phaser.Rectangle.inflate = function (a, dx, dy) { * @return {Phaser.Rectangle} The Rectangle object. */ Phaser.Rectangle.inflatePoint = function (a, point) { + return Phaser.Rectangle.inflate(a, point.x, point.y); + }; /** @@ -954,8 +1020,18 @@ Phaser.Rectangle.inflatePoint = function (a, point) { * @return {Phaser.Point} The size of the Rectangle object */ Phaser.Rectangle.size = function (a, output) { - if (typeof output === "undefined") { output = new Phaser.Point(); } - return output.setTo(a.width, a.height); + + if (typeof output === "undefined") + { + output = new Phaser.Point(a.width, a.height); + } + else + { + output.setTo(a.width, a.height); + } + + return output; + }; /** @@ -966,8 +1042,18 @@ Phaser.Rectangle.size = function (a, output) { * @return {Phaser.Rectangle} */ Phaser.Rectangle.clone = function (a, output) { - if (typeof output === "undefined") { output = new Phaser.Rectangle(); } - return output.setTo(a.x, a.y, a.width, a.height); + + if (typeof output === "undefined") + { + output = new Phaser.Rectangle(a.x, a.y, a.width, a.height); + } + else + { + output.setTo(a.x, a.y, a.width, a.height); + } + + return output; + }; /** @@ -979,11 +1065,31 @@ Phaser.Rectangle.clone = function (a, output) { * @return {boolean} A value of true if the Rectangle object contains the specified point; otherwise false. */ Phaser.Rectangle.contains = function (a, x, y) { + + if (a.width <= 0 || a.height <= 0) + { + return false; + } + return (x >= a.x && x <= a.right && y >= a.y && y <= a.bottom); + }; +/** +* Determines whether the specified coordinates are contained within the region defined by the given raw values. +* @method Phaser.Rectangle.containsRaw +* @param {number} rx - The x coordinate of the top left of the area. +* @param {number} ry - The y coordinate of the top left of the area. +* @param {number} rw - The width of the area. +* @param {number} rh - The height of the area. +* @param {number} x - The x coordinate of the point to test. +* @param {number} y - The y coordinate of the point to test. +* @return {boolean} A value of true if the Rectangle object contains the specified point; otherwise false. +*/ Phaser.Rectangle.containsRaw = function (rx, ry, rw, rh, x, y) { + return (x >= rx && x <= (rx + rw) && y >= ry && y <= (ry + rh)); + }; /** @@ -994,7 +1100,9 @@ Phaser.Rectangle.containsRaw = function (rx, ry, rw, rh, x, y) { * @return {boolean} A value of true if the Rectangle object contains the specified point; otherwise false. */ Phaser.Rectangle.containsPoint = function (a, point) { + return Phaser.Rectangle.contains(a, point.x, point.y); + }; /** @@ -1026,7 +1134,9 @@ Phaser.Rectangle.containsRect = function (a, b) { * @return {boolean} A value of true if the two Rectangles have exactly the same values for the x, y, width and height properties; otherwise false. */ Phaser.Rectangle.equals = function (a, b) { + return (a.x == b.x && a.y == b.y && a.width == b.width && a.height == b.height); + }; /** @@ -1034,22 +1144,25 @@ Phaser.Rectangle.equals = function (a, b) { * @method Phaser.Rectangle.intersection * @param {Phaser.Rectangle} a - The first Rectangle object. * @param {Phaser.Rectangle} b - The second Rectangle object. -* @param {Phaser.Rectangle} [out] - Optional Rectangle object. If given the intersection values will be set into this object, otherwise a brand new Rectangle object will be created and returned. +* @param {Phaser.Rectangle} [output] - Optional Rectangle object. If given the intersection values will be set into this object, otherwise a brand new Rectangle object will be created and returned. * @return {Phaser.Rectangle} A Rectangle object that equals the area of intersection. If the Rectangles do not intersect, this method returns an empty Rectangle object; that is, a Rectangle with its x, y, width, and height properties set to 0. */ -Phaser.Rectangle.intersection = function (a, b, out) { +Phaser.Rectangle.intersection = function (a, b, output) { - out = out || new Phaser.Rectangle(); + if (typeof output === "undefined") + { + output = new Phaser.Rectangle(); + } if (Phaser.Rectangle.intersects(a, b)) { - out.x = Math.max(a.x, b.x); - out.y = Math.max(a.y, b.y); - out.width = Math.min(a.right, b.right) - out.x; - out.height = Math.min(a.bottom, b.bottom) - out.y; + output.x = Math.max(a.x, b.x); + output.y = Math.max(a.y, b.y); + output.width = Math.min(a.right, b.right) - output.x; + output.height = Math.min(a.bottom, b.bottom) - output.y; } - return out; + return output; }; @@ -1095,16 +1208,23 @@ Phaser.Rectangle.intersectsRaw = function (a, left, right, top, bottom, toleranc * @method Phaser.Rectangle.union * @param {Phaser.Rectangle} a - The first Rectangle object. * @param {Phaser.Rectangle} b - The second Rectangle object. -* @param {Phaser.Rectangle} [out] - Optional Rectangle object. If given the new values will be set into this object, otherwise a brand new Rectangle object will be created and returned. +* @param {Phaser.Rectangle} [output] - Optional Rectangle object. If given the new values will be set into this object, otherwise a brand new Rectangle object will be created and returned. * @return {Phaser.Rectangle} A Rectangle object that is the union of the two Rectangles. */ -Phaser.Rectangle.union = function (a, b, out) { +Phaser.Rectangle.union = function (a, b, output) { - if (typeof out === "undefined") { out = new Phaser.Rectangle(); } + if (typeof output === "undefined") + { + output = new Phaser.Rectangle(); + } - return out.setTo(Math.min(a.x, b.x), Math.min(a.y, b.y), Math.max(a.right, b.right) - Math.min(a.left, b.left), Math.max(a.bottom, b.bottom) - Math.min(a.top, b.top)); + return output.setTo(Math.min(a.x, b.x), Math.min(a.y, b.y), Math.max(a.right, b.right) - Math.min(a.left, b.left), Math.max(a.bottom, b.bottom) - Math.min(a.top, b.top)); }; + +// Because PIXI uses its own Rectangle, we'll replace it with ours to avoid duplicating code or confusion. +PIXI.Rectangle = Phaser.Rectangle; +PIXI.EmptyRectangle = new Phaser.Rectangle(0, 0, 0, 0); @@ -1126,7 +1246,7 @@ Phaser.Rectangle.union = function (a, b, out) { Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/RenderTexture.js.html b/docs/RenderTexture.js.html index b85fcadd..192f88da 100644 --- a/docs/RenderTexture.js.html +++ b/docs/RenderTexture.js.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -426,11 +460,11 @@ * @class Phaser.RenderTexture * @constructor * @param {Phaser.Game} game - Current game instance. -* @param {string} key - Asset key for the render texture. -* @param {number} width - the width of the render texture. -* @param {number} height - the height of the render texture. +* @param {string} key - Internal Phaser reference key for the render texture. +* @param {number} [width=100] - The width of the render texture. +* @param {number} [height=100] - The height of the render texture. */ -Phaser.RenderTexture = function (game, key, width, height) { +Phaser.RenderTexture = function (game, width, height, key) { /** * @property {Phaser.Game} game - A reference to the currently running game. @@ -438,315 +472,21 @@ Phaser.RenderTexture = function (game, key, width, height) { this.game = game; /** - * @property {string} name - the name of the object. + * @property {string} key - The key of the RenderTexture in the Cache, if stored there. */ - this.name = key; - - PIXI.EventTarget.call(this); - - /** - * @property {number} width - the width. - */ - this.width = width || 100; - - /** - * @property {number} height - the height. - */ - this.height = height || 100; - - /** - * @property {PIXI.mat3} indetityMatrix - Matrix object. - */ - this.indetityMatrix = PIXI.mat3.create(); - - /** - * @property {PIXI.Rectangle} frame - The frame for this texture. - */ - this.frame = new PIXI.Rectangle(0, 0, this.width, this.height); + this.key = key; /** * @property {number} type - Base Phaser object type. */ this.type = Phaser.RENDERTEXTURE; - this._tempPoint = { x: 0, y: 0 }; - - if (PIXI.gl) - { - this.initWebGL(); - } - else - { - this.initCanvas(); - } + PIXI.RenderTexture.call(this, width, height); }; -Phaser.RenderTexture.prototype = Object.create(PIXI.Texture.prototype); -Phaser.RenderTexture.prototype.constructor = PIXI.RenderTexture; - -/** -* This function will draw the display object to the texture. If the display object is a Group or has children it will -* draw all children as well. -* -* @method Phaser.RenderTexture#render -* @memberof Phaser.RenderTexture -* @param {DisplayObject} displayObject - The display object to render this texture on. -* @param {Phaser.Point} [position] - Where to draw the display object. -* @param {boolean} [clear=false] - If true the texture will be cleared before the displayObject is drawn. -* @param {boolean} [renderHidden=false] - If true displayObjects that have their visible property set to false will still be rendered. -*/ -Phaser.RenderTexture.prototype.render = function(displayObject, position, clear, renderHidden) { - - if (typeof position === 'undefined') { position = false; } - if (typeof clear === 'undefined') { clear = false; } - if (typeof renderHidden === 'undefined') { renderHidden = false; } - - if (displayObject instanceof Phaser.Group) - { - displayObject = displayObject._container; - } - - if (PIXI.gl) - { - this.renderWebGL(displayObject, position, clear, renderHidden); - } - else - { - this.renderCanvas(displayObject, position, clear, renderHidden); - } - -} - -/** -* This function will draw the display object to the texture at the given x/y coordinates. -* If the display object is a Group or has children it will draw all children as well. -* -* @method Phaser.RenderTexture#renderXY -* @memberof Phaser.RenderTexture -* @param {DisplayObject} displayObject - The display object to render this texture on. -* @param {number} x - The x coordinate to draw the display object at. -* @param {number} y - The y coordinate to draw the display object at. -* @param {boolean} [clear=false] - If true the texture will be cleared before the displayObject is drawn. -* @param {boolean} [renderHidden=false] - If true displayObjects that have their visible property set to false will still be rendered. -*/ -Phaser.RenderTexture.prototype.renderXY = function(displayObject, x, y, clear, renderHidden) { - - this._tempPoint.x = x; - this._tempPoint.y = y; - - this.render(displayObject, this._tempPoint, clear, renderHidden); - -} - -/** -* Initializes the webgl data for this texture -* -* @method Phaser.RenderTexture#initWebGL -* @memberof Phaser.RenderTexture -* @private -*/ -Phaser.RenderTexture.prototype.initWebGL = function() { - - var gl = PIXI.gl; - this.glFramebuffer = gl.createFramebuffer(); - - gl.bindFramebuffer(gl.FRAMEBUFFER, this.glFramebuffer ); - - this.glFramebuffer.width = this.width; - this.glFramebuffer.height = this.height; - - this.baseTexture = new PIXI.BaseTexture(); - - this.baseTexture.width = this.width; - this.baseTexture.height = this.height; - - this.baseTexture._glTexture = gl.createTexture(); - gl.bindTexture(gl.TEXTURE_2D, this.baseTexture._glTexture); - - gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, this.width, this.height, 0, gl.RGBA, gl.UNSIGNED_BYTE, null); - - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); - - this.baseTexture.isRender = true; - - gl.bindFramebuffer(gl.FRAMEBUFFER, this.glFramebuffer ); - gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, this.baseTexture._glTexture, 0); - - // create a projection matrix.. - this.projection = new PIXI.Point(this.width/2 , -this.height/2); - - // set the correct render function.. - // this.render = this.renderWebGL; -} - -/** -* Resizes the RenderTexture. -* -* @method Phaser.RenderTexture#resize -* @memberof Phaser.RenderTexture -*/ -Phaser.RenderTexture.prototype.resize = function(width, height) -{ - - this.width = width; - this.height = height; - - if(PIXI.gl) - { - this.projection.x = this.width/2 - this.projection.y = -this.height/2; - - var gl = PIXI.gl; - gl.bindTexture(gl.TEXTURE_2D, this.baseTexture._glTexture); - gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, this.width, this.height, 0, gl.RGBA, gl.UNSIGNED_BYTE, null); - } - else - { - - this.frame.width = this.width - this.frame.height = this.height; - this.renderer.resize(this.width, this.height); - } -} - -/** -* Initializes the canvas data for this texture -* -* @method Phaser.RenderTexture#initCanvas -* @memberof Phaser.RenderTexture -* @private -*/ -Phaser.RenderTexture.prototype.initCanvas = function() -{ - this.renderer = new PIXI.CanvasRenderer(this.width, this.height, null, 0); - - this.baseTexture = new PIXI.BaseTexture(this.renderer.view); - this.frame = new PIXI.Rectangle(0, 0, this.width, this.height); - - // this.render = this.renderCanvas; -} - -/** -* This function will draw the display object to the texture. -* -* @method Phaser.RenderTexture#renderWebGL -* @memberof Phaser.RenderTexture -* @private -* @param {DisplayObject} displayObject - The display object to render this texture on. -* @param {Phaser.Point} [position] - Where to draw the display object. -* @param {boolean} [clear=false] - If true the texture will be cleared before the displayObject is drawn. -* @param {boolean} [renderHidden=false] - If true displayObjects that have their visible property set to false will still be rendered. -*/ -Phaser.RenderTexture.prototype.renderWebGL = function(displayObject, position, clear, renderHidden) -{ - var gl = PIXI.gl; - - // enable the alpha color mask.. - gl.colorMask(true, true, true, true); - - gl.viewport(0, 0, this.width, this.height); - - gl.bindFramebuffer(gl.FRAMEBUFFER, this.glFramebuffer ); - - if (clear) - { - gl.clearColor(0,0,0, 0); - gl.clear(gl.COLOR_BUFFER_BIT); - } - - // THIS WILL MESS WITH HIT TESTING! - var children = displayObject.children; - - //TODO -? create a new one??? dont think so! - var originalWorldTransform = displayObject.worldTransform; - displayObject.worldTransform = PIXI.mat3.create();//sthis.indetityMatrix; - // modify to flip... - displayObject.worldTransform[4] = -1; - displayObject.worldTransform[5] = this.projection.y * -2; - - if (position) - { - displayObject.worldTransform[2] = position.x; - displayObject.worldTransform[5] -= position.y; - } - - PIXI.visibleCount++; - displayObject.vcount = PIXI.visibleCount; - - for (var i = 0, j = children.length; i < j; i++) - { - children[i].updateTransform(); - } - - var renderGroup = displayObject.__renderGroup; - - if (renderGroup) - { - if (displayObject == renderGroup.root) - { - renderGroup.render(this.projection, this.glFramebuffer); - } - else - { - renderGroup.renderSpecific(displayObject, this.projection, this.glFramebuffer); - } - } - else - { - if (!this.renderGroup) - { - this.renderGroup = new PIXI.WebGLRenderGroup(gl); - } - - this.renderGroup.setRenderable(displayObject); - this.renderGroup.render(this.projection, this.glFramebuffer); - } - - displayObject.worldTransform = originalWorldTransform; -} - -/** - * This function will draw the display object to the texture. - * -* @method Phaser.RenderTexture#renderCanvas -* @memberof Phaser.RenderTexture -* @private -* @param {DisplayObject} displayObject - The display object to render this texture on. -* @param {Phaser.Point} [position] - Where to draw the display object. -* @param {boolean} [clear=false] - If true the texture will be cleared before the displayObject is drawn. -* @param {boolean} [renderHidden=false] - If true displayObjects that have their visible property set to false will still be rendered. -*/ -Phaser.RenderTexture.prototype.renderCanvas = function(displayObject, position, clear, renderHidden) -{ - var children = displayObject.children; - - displayObject.worldTransform = PIXI.mat3.create(); - - if (position) - { - displayObject.worldTransform[2] = position.x; - displayObject.worldTransform[5] = position.y; - } - - for (var i = 0, j = children.length; i < j; i++) - { - children[i].updateTransform(); - } - - if (clear) - { - this.renderer.context.clearRect(0, 0, this.width, this.height); - } - - this.renderer.renderDisplayObject(displayObject, renderHidden); - - this.renderer.context.setTransform(1, 0, 0, 1, 0, 0); - -} +Phaser.RenderTexture.prototype = Object.create(PIXI.RenderTexture.prototype); +Phaser.RenderTexture.prototype.constructor = Phaser.RenderTexture; @@ -768,7 +508,7 @@ Phaser.RenderTexture.prototype.renderCanvas = function(displayObject, position, Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/RequestAnimationFrame.js.html b/docs/RequestAnimationFrame.js.html index c47f23db..d6a1375f 100644 --- a/docs/RequestAnimationFrame.js.html +++ b/docs/RequestAnimationFrame.js.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -595,7 +629,7 @@ Phaser.RequestAnimationFrame.prototype.constructor = Phaser.RequestAnimationFram Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/SAT.js.html b/docs/SAT.js.html index daffcd9a..36c69c9c 100644 --- a/docs/SAT.js.html +++ b/docs/SAT.js.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -1297,7 +1331,7 @@ Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Signal.js.html b/docs/Signal.js.html index 02fe379b..d9630889 100644 --- a/docs/Signal.js.html +++ b/docs/Signal.js.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -740,7 +774,7 @@ Phaser.Signal.prototype.constructor = Phaser.Signal; Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/SignalBinding.html b/docs/SignalBinding.html index b3c0f540..cc07418e 100644 --- a/docs/SignalBinding.html +++ b/docs/SignalBinding.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -733,7 +767,7 @@ Inspired by Joa Ebert AS3 SignalBinding and Robert Penner's Slot classes.

    Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:37 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:53 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/SignalBinding.js.html b/docs/SignalBinding.js.html index 8bc0854f..823a47f6 100644 --- a/docs/SignalBinding.js.html +++ b/docs/SignalBinding.js.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -600,7 +634,7 @@ Phaser.SignalBinding.prototype.constructor = Phaser.SignalBinding; Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/SinglePad.js.html b/docs/SinglePad.js.html index af2fdfca..79235ff1 100644 --- a/docs/SinglePad.js.html +++ b/docs/SinglePad.js.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -1005,7 +1039,7 @@ Object.defineProperty(Phaser.SinglePad.prototype, "index", { Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Sound.js.html b/docs/Sound.js.html index 03167d6d..b1e79fca 100644 --- a/docs/Sound.js.html +++ b/docs/Sound.js.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -1261,7 +1295,7 @@ Object.defineProperty(Phaser.Sound.prototype, "volume", { Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/SoundManager.js.html b/docs/SoundManager.js.html index 6fa385c5..e36bc9a3 100644 --- a/docs/SoundManager.js.html +++ b/docs/SoundManager.js.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -918,7 +952,7 @@ Object.defineProperty(Phaser.SoundManager.prototype, "volume", { Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Sprite.js.html b/docs/Sprite.js.html index cce3609a..17059fa6 100644 --- a/docs/Sprite.js.html +++ b/docs/Sprite.js.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -455,17 +489,6 @@ Phaser.Sprite = function (game, x, y, key, frame) { */ this.exists = true; - /** - * @property {boolean} alive - This is a handy little var your game can use to determine if a sprite is alive or not, it doesn't effect rendering. - * @default - */ - this.alive = true; - - /** - * @property {Phaser.Group} group - The parent Group of this Sprite. This is usually set after Sprite instantiation by the parent. - */ - this.group = null; - /** * @property {string} name - The user defined name given to this Sprite. * @default @@ -478,20 +501,6 @@ Phaser.Sprite = function (game, x, y, key, frame) { */ this.type = Phaser.SPRITE; - /** - * @property {number} renderOrderID - Used by the Renderer and Input Manager to control picking order. - * @default - */ - this.renderOrderID = -1; - - /** - * If you would like the Sprite to have a lifespan once 'born' you can set this to a positive value. Handy for particles, bullets, etc. - * The lifespan is decremented by game.time.elapsed each update, once it reaches zero the kill() function is called. - * @property {number} lifespan - The lifespan of the Sprite (in ms) before it will be killed. - * @default - */ - this.lifespan = 0; - /** * @property {Phaser.Events} events - The Events you can subscribe to that are dispatched when certain things happen on this Sprite or its components. */ @@ -502,104 +511,28 @@ Phaser.Sprite = function (game, x, y, key, frame) { */ this.animations = new Phaser.AnimationManager(this); - /** - * @property {Phaser.InputHandler} input - The Input Handler Component. - */ - this.input = new Phaser.InputHandler(this); - /** * @property {string|Phaser.RenderTexture|Phaser.BitmapData|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, BitmapData or PIXI.Texture. */ this.key = key; /** - * @property {Phaser.Frame} currentFrame - A reference to the currently displayed frame. + * @property {number} _frame - Internal cache var. + * @private */ - this.currentFrame = null; - - if (key instanceof Phaser.RenderTexture) - { - PIXI.Sprite.call(this, key); - - this.currentFrame = this.game.cache.getTextureFrame(key.name); - } - else if (key instanceof Phaser.BitmapData) - { - PIXI.Sprite.call(this, key.texture, key.textureFrame); - - this.currentFrame = key.textureFrame; - } - else if (key instanceof PIXI.Texture) - { - PIXI.Sprite.call(this, key); - - this.currentFrame = frame; - } - else - { - if (key === null || typeof key === 'undefined') - { - key = '__default'; - this.key = key; - } - else if (typeof key === 'string' && this.game.cache.checkImageKey(key) === false) - { - key = '__missing'; - this.key = key; - } - - PIXI.Sprite.call(this, PIXI.TextureCache[key]); - - if (this.game.cache.isSpriteSheet(key)) - { - this.animations.loadFrameData(this.game.cache.getFrameData(key)); - - if (frame !== null) - { - if (typeof frame === 'string') - { - this.frameName = frame; - } - else - { - this.frame = frame; - } - } - } - else - { - this.currentFrame = this.game.cache.getFrame(key); - } - } + this._frame = 0; /** - * The rectangular area from the texture that will be rendered. - * @property {Phaser.Rectangle} textureRegion + * @property {string} _frameName - Internal cache var. + * @private */ - this.textureRegion = new Phaser.Rectangle(this.texture.frame.x, this.texture.frame.y, this.texture.frame.width, this.texture.frame.height); + this._frameName = ''; - /** - * The anchor sets the origin point of the texture. - * The default is 0,0 this means the textures origin is the top left - * Setting than anchor to 0.5,0.5 means the textures origin is centered - * Setting the anchor to 1,1 would mean the textures origin points will be the bottom right - * - * @property {Phaser.Point} anchor - The anchor around which rotation and scaling takes place. - */ - this.anchor = new Phaser.Point(); + PIXI.Sprite.call(this, PIXI.TextureCache['__default']); - /** - * @property {number} x - The x coordinate in world space of this Sprite. - */ - this.x = x; - - /** - * @property {number} y - The y coordinate in world space of this Sprite. - */ - this.y = y; + this.loadTexture(key, frame); - this.position.x = x; - this.position.y = y; + this.position.set(x, y); /** * @property {Phaser.Point} world - The world coordinates of this Sprite. This differs from the x/y coordinates which are relative to the Sprites container. @@ -609,6 +542,7 @@ Phaser.Sprite = function (game, x, y, key, frame) { /** * Should this Sprite be automatically culled if out of range of the camera? * A culled sprite has its renderable property set to 'false'. + * Be advised this is quite an expensive operation, as it has to calculate the bounds of the object every frame, so only enable it if you really need it. * * @property {boolean} autoCull - A flag indicating if the Sprite should be automatically camera culled or not. * @default @@ -616,118 +550,18 @@ Phaser.Sprite = function (game, x, y, key, frame) { this.autoCull = false; /** - * @property {Phaser.Point} scale - The scale of the Sprite when rendered. By default it's set to 1 (no scale). You can modify it via scale.x or scale.y or scale.setTo(x, y). A value of 1 means no change to the scale, 0.5 means "half the size", 2 means "twice the size", etc. + * A Sprite that is fixed to the camera uses its x/y coordinates as offsets from the top left of the camera. + * Note that if this Image is a child of a display object that has changed its position then the offset will be calculated from that. + * @property {boolean} fixedToCamera - Fixes this Sprite to the Camera. + * @default */ - this.scale = new Phaser.Point(1, 1); + this.fixedToCamera = false; /** - * @property {object} _cache - A mini cache for storing all of the calculated values. - * @private + * @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._cache = { + this.input = null; - fresh: true, - dirty: false, - - // Transform cache - a00: -1, - a01: -1, - a02: -1, - a10: -1, - a11: -1, - a12: -1, - id: -1, - - // Input specific transform cache - i01: -1, - i10: -1, - idi: -1, - - // Bounds check - left: null, - right: null, - top: null, - bottom: null, - - // delta cache - prevX: x, - prevY: y, - - // The previous calculated position - x: -1, - y: -1, - - // The actual scale values based on the worldTransform - scaleX: 1, - scaleY: 1, - - // The width/height of the image, based on the un-modified frame size multiplied by the final calculated scale size - width: this.currentFrame.sourceSizeW, - height: this.currentFrame.sourceSizeH, - - // The actual width/height of the image if from a trimmed atlas, multiplied by the final calculated scale size - halfWidth: Math.floor(this.currentFrame.sourceSizeW / 2), - halfHeight: Math.floor(this.currentFrame.sourceSizeH / 2), - - // The width/height of the image, based on the un-modified frame size multiplied by the final calculated scale size - calcWidth: -1, - calcHeight: -1, - - // The current frame details - // frameID: this.currentFrame.uuid, frameWidth: this.currentFrame.width, frameHeight: this.currentFrame.height, - frameID: -1, - frameWidth: this.currentFrame.width, - frameHeight: this.currentFrame.height, - - // If this sprite visible to the camera (regardless of being set to visible or not) - cameraVisible: true, - - // Crop cache - cropX: 0, - cropY: 0, - cropWidth: this.currentFrame.sourceSizeW, - cropHeight: this.currentFrame.sourceSizeH - - }; - - /** - * @property {Phaser.Point} offset - Corner point defaults. Should not typically be modified. - */ - this.offset = new Phaser.Point(); - - /** - * @property {Phaser.Point} center - A Point containing the center coordinate of the Sprite. Takes rotation and scale into account. - */ - this.center = new Phaser.Point(x + Math.floor(this._cache.width / 2), y + Math.floor(this._cache.height / 2)); - - /** - * @property {Phaser.Point} topLeft - A Point containing the top left coordinate of the Sprite. Takes rotation and scale into account. - */ - this.topLeft = new Phaser.Point(x, y); - - /** - * @property {Phaser.Point} topRight - A Point containing the top right coordinate of the Sprite. Takes rotation and scale into account. - */ - this.topRight = new Phaser.Point(x + this._cache.width, y); - - /** - * @property {Phaser.Point} bottomRight - A Point containing the bottom right coordinate of the Sprite. Takes rotation and scale into account. - */ - this.bottomRight = new Phaser.Point(x + this._cache.width, y + this._cache.height); - - /** - * @property {Phaser.Point} bottomLeft - A Point containing the bottom left coordinate of the Sprite. Takes rotation and scale into account. - */ - this.bottomLeft = new Phaser.Point(x, y + this._cache.height); - - /** - * This Rectangle object fully encompasses the Sprite and is updated in real-time. - * The bounds is the full bounding area after rotation and scale have been taken into account. It should not be modified directly. - * It's used for Camera culling and physics body alignment. - * @property {Phaser.Rectangle} bounds - */ - this.bounds = new Phaser.Rectangle(x, y, this._cache.width, this._cache.height); - /** * @property {Phaser.Physics.Arcade.Body} body - By default Sprites have a Phaser.Physics Body attached to them. You can operate physics actions via this property, or null it to skip all physics updates. */ @@ -739,15 +573,12 @@ Phaser.Sprite = function (game, x, y, key, frame) { this.health = 1; /** - * @property {boolean} inWorld - This value is set to true if the Sprite is positioned within the World, otherwise false. - */ - this.inWorld = Phaser.Rectangle.intersects(this.bounds, this.game.world.bounds); - - /** - * @property {number} inWorldThreshold - A threshold value applied to the inWorld check. If you don't want a Sprite to be considered "out of the world" until at least 100px away for example then set it to 100. + * If you would like the Sprite to have a lifespan once 'born' you can set this to a positive value. Handy for particles, bullets, etc. + * The lifespan is decremented by game.time.elapsed each update, once it reaches zero the kill() function is called. + * @property {number} lifespan - The lifespan of the Sprite (in ms) before it will be killed. * @default */ - this.inWorldThreshold = 0; + this.lifespan = 0; /** * @property {boolean} outOfBoundsKill - If true the Sprite is killed as soon as Sprite.inWorld is false. @@ -755,72 +586,47 @@ Phaser.Sprite = function (game, x, y, key, frame) { */ this.outOfBoundsKill = false; - /** - * @property {boolean} _outOfBoundsFired - Internal flag. - * @private - * @default - */ - this._outOfBoundsFired = false; - - /** - * A Sprite that is fixed to the camera ignores the position of any ancestors in the display list and uses its x/y coordinates as offsets from the top left of the camera. - * @property {boolean} fixedToCamera - Fixes this Sprite to the Camera. - * @default - */ - this.fixedToCamera = false; - - /** - * @property {Phaser.Point} cameraOffset - If this Sprite is fixed to the camera then use this Point to specify how far away from the Camera x/y it's rendered. - */ - this.cameraOffset = new Phaser.Point(x, y); - - /** - * You can crop the Sprites texture by modifying the crop properties. For example crop.width = 50 would set the Sprite to only render 50px wide. - * The crop is only applied if you have set Sprite.cropEnabled to true. - * @property {Phaser.Rectangle} crop - The crop Rectangle applied to the Sprite texture before rendering. - * @default - */ - this.crop = new Phaser.Rectangle(0, 0, this._cache.width, this._cache.height); - - /** - * @property {boolean} cropEnabled - If true the Sprite.crop property is used to crop the texture before render. Set to false to disable. - * @default - */ - this.cropEnabled = false; - /** * @property {boolean} debug - Handy flag to use with Game.enableStep * @default */ this.debug = false; - this.updateCache(); - this.updateBounds(); + /** + * @property {boolean} _outOfBoundsFired - Internal flag. + * @private + */ + this._outOfBoundsFired = false; /** - * @property {PIXI.Point} pivot - The pivot point of the displayObject that it rotates around. + * @property {array} _cache - A small cache for previous step values. 0 = x, 1 = y, 2 = rotation, 3 = renderID, 4 = fresh? (0 = no, 1 = yes) + * @private */ + this._cache = [0, 0, 0, 0, 1]; }; -// Needed to keep the PIXI.Sprite constructor in the prototype chain (as the core pixi renderer uses an instanceof check sadly) Phaser.Sprite.prototype = Object.create(PIXI.Sprite.prototype); Phaser.Sprite.prototype.constructor = Phaser.Sprite; /** -* Automatically called by World.preUpdate. Handles cache updates, lifespan checks, animation updates and physics updates. +* Automatically called by World.preUpdate. * * @method Phaser.Sprite#preUpdate * @memberof Phaser.Sprite */ Phaser.Sprite.prototype.preUpdate = function() { - if (this._cache.fresh) + if (this._cache[4] === 1) { - this.world.setTo(this.parent.position.x + this.x, this.parent.position.y + this.y); + console.log('sprite cache fresh'); + this.world.setTo(this.parent.position.x + this.position.x, this.parent.position.y + this.position.y); this.worldTransform[2] = this.world.x; this.worldTransform[5] = this.world.y; - this._cache.fresh = false; + // this._cache[0] = this.world.x; + // this._cache[1] = this.world.y; + // this._cache[2] = this.rotation; + this._cache[4] = 0; if (this.body) { @@ -833,11 +639,13 @@ Phaser.Sprite.prototype.preUpdate = function() { return; } - if (!this.exists || (this.group && !this.group.exists)) + this._cache[0] = this.world.x; + this._cache[1] = this.world.y; + this._cache[2] = this.rotation; + + if (!this.exists || !this.parent.exists) { this.renderOrderID = -1; - - // Skip children if not exists return false; } @@ -852,175 +660,30 @@ Phaser.Sprite.prototype.preUpdate = function() { } } - this._cache.dirty = false; - - if (this.visible) + if (this.autoCull) { - this.renderOrderID = this.game.world.currentRenderOrderID++; - } - - this.updateCache(); - - this.updateAnimation(); - - this.updateCrop(); - - // Re-run the camera visibility check - if (this._cache.dirty || this.world.x !== this._cache.prevX || this.world.y !== this._cache.prevY) - { - this.updateBounds(); - } - - if (this.body) - { - this.body.preUpdate(); - } - - return true; - -}; - -/** -* Internal function called by preUpdate. -* -* @method Phaser.Sprite#updateCache -* @memberof Phaser.Sprite -*/ -Phaser.Sprite.prototype.updateCache = function() { - - this._cache.prevX = this.world.x; - this._cache.prevY = this.world.y; - - if (this.fixedToCamera) - { - this.x = this.game.camera.view.x + this.cameraOffset.x; - this.y = this.game.camera.view.y + this.cameraOffset.y; + // Won't get rendered but will still get its transform updated + this.renderable = this.game.world.camera.screenView.intersects(this.getBounds()); } this.world.setTo(this.game.camera.x + this.worldTransform[2], this.game.camera.y + this.worldTransform[5]); - if (this.worldTransform[1] != this._cache.i01 || this.worldTransform[3] != this._cache.i10 || this.worldTransform[0] != this._cache.a00 || this.worldTransform[41] != this._cache.a11) + if (this.visible) { - this._cache.a00 = this.worldTransform[0]; // scaleX a |a c tx| - this._cache.a01 = this.worldTransform[1]; // skewY c |b d ty| - this._cache.a10 = this.worldTransform[3]; // skewX b |0 0 1| - this._cache.a11 = this.worldTransform[4]; // scaleY d - - this._cache.i01 = this.worldTransform[1]; // skewY c (remains non-modified for input checks) - this._cache.i10 = this.worldTransform[3]; // skewX b (remains non-modified for input checks) - - this._cache.scaleX = Math.sqrt((this._cache.a00 * this._cache.a00) + (this._cache.a01 * this._cache.a01)); // round this off a bit? - this._cache.scaleY = Math.sqrt((this._cache.a10 * this._cache.a10) + (this._cache.a11 * this._cache.a11)); // round this off a bit? - - this._cache.a01 *= -1; - this._cache.a10 *= -1; - - this._cache.id = 1 / (this._cache.a00 * this._cache.a11 + this._cache.a01 * -this._cache.a10); - this._cache.idi = 1 / (this._cache.a00 * this._cache.a11 + this._cache.i01 * -this._cache.i10); - - this._cache.dirty = true; + this._cache[3] = this.game.world.currentRenderOrderID++; } - this._cache.a02 = this.worldTransform[2]; // translateX tx - this._cache.a12 = this.worldTransform[5]; // translateY ty + this.animations.update(); -}; - -/** -* Internal function called by preUpdate. -* -* @method Phaser.Sprite#updateAnimation -* @memberof Phaser.Sprite -*/ -Phaser.Sprite.prototype.updateAnimation = function() { - - if (this.animations.update() || (this.currentFrame && this.currentFrame.uuid != this._cache.frameID)) + if (!this.inWorld && Phaser.Rectangle.intersects(this.getBounds(), this.game.world.bounds, this.inWorldThreshold)) { - this._cache.frameID = this.currentFrame.uuid; - - this._cache.frameWidth = this.texture.frame.width; - this._cache.frameHeight = this.texture.frame.height; - - this._cache.width = this.currentFrame.width; - this._cache.height = this.currentFrame.height; - - this._cache.halfWidth = Math.floor(this._cache.width / 2); - this._cache.halfHeight = Math.floor(this._cache.height / 2); - - this._cache.dirty = true; - } - -}; - -/** -* Internal function called by preUpdate. -* -* @method Phaser.Sprite#updateCrop -* @memberof Phaser.Sprite -*/ -Phaser.Sprite.prototype.updateCrop = function() { - - // This only runs if crop is enabled - if (this.cropEnabled && (this.crop.width != this._cache.cropWidth || this.crop.height != this._cache.cropHeight || this.crop.x != this._cache.cropX || this.crop.y != this._cache.cropY)) - { - this.crop.floorAll(); - - this._cache.cropX = this.crop.x; - this._cache.cropY = this.crop.y; - this._cache.cropWidth = this.crop.width; - this._cache.cropHeight = this.crop.height; - - this.texture.frame = this.crop; - this.texture.width = this.crop.width; - this.texture.height = this.crop.height; - - this.texture.updateFrame = true; - - PIXI.Texture.frameUpdates.push(this.texture); - } - -}; - -/** -* Internal function called by preUpdate. -* -* @method Phaser.Sprite#updateBounds -* @memberof Phaser.Sprite -*/ -Phaser.Sprite.prototype.updateBounds = function() { - - this.offset.setTo(this._cache.a02 - (this.anchor.x * this.width), this._cache.a12 - (this.anchor.y * this.height)); - - this.getLocalPosition(this.center, this.offset.x + (this.width / 2), this.offset.y + (this.height / 2)); - this.getLocalPosition(this.topLeft, this.offset.x, this.offset.y); - this.getLocalPosition(this.topRight, this.offset.x + this.width, this.offset.y); - this.getLocalPosition(this.bottomLeft, this.offset.x, this.offset.y + this.height); - this.getLocalPosition(this.bottomRight, this.offset.x + this.width, this.offset.y + this.height); - - this._cache.left = Phaser.Math.min(this.topLeft.x, this.topRight.x, this.bottomLeft.x, this.bottomRight.x); - this._cache.right = Phaser.Math.max(this.topLeft.x, this.topRight.x, this.bottomLeft.x, this.bottomRight.x); - this._cache.top = Phaser.Math.min(this.topLeft.y, this.topRight.y, this.bottomLeft.y, this.bottomRight.y); - this._cache.bottom = Phaser.Math.max(this.topLeft.y, this.topRight.y, this.bottomLeft.y, this.bottomRight.y); - - this.bounds.setTo(this._cache.left, this._cache.top, this._cache.right - this._cache.left, this._cache.bottom - this._cache.top); - - this.updateFrame = true; - - if (this.inWorld === false) - { - // Sprite WAS out of the screen, is it still? - this.inWorld = Phaser.Rectangle.intersects(this.bounds, this.game.world.bounds, this.inWorldThreshold); - - if (this.inWorld) - { - // It's back again, reset the OOB check - this._outOfBoundsFired = false; - } + // It's back again, reset the OOB check + this._outOfBoundsFired = false; } else { // Sprite WAS in the screen, has it now left? - this.inWorld = Phaser.Rectangle.intersects(this.bounds, this.game.world.bounds, this.inWorldThreshold); + this.inWorld = Phaser.Rectangle.intersects(this.getBounds(), this.game.world.bounds, this.inWorldThreshold); if (this.inWorld === false) { @@ -1034,7 +697,7 @@ Phaser.Sprite.prototype.updateBounds = function() { } } - this._cache.cameraVisible = Phaser.Rectangle.intersects(this.game.world.camera.screenView, this.bounds, 0); + this._cache.cameraVisible = Phaser.Rectangle.intersects(this.game.world.camera.screenView, this.getBounds(), 0); if (this.autoCull) { @@ -1042,59 +705,12 @@ Phaser.Sprite.prototype.updateBounds = function() { this.renderable = this._cache.cameraVisible; } -}; + if (this.body) + { + this.body.preUpdate(); + } -/** -* Gets the local position of a coordinate relative to the Sprite, factoring in rotation and scale. -* Mostly only used internally. -* -* @method Phaser.Sprite#getLocalPosition -* @memberof Phaser.Sprite -* @param {Phaser.Point} p - The Point object to store the results in. -* @param {number} x - x coordinate within the Sprite to translate. -* @param {number} y - y coordinate within the Sprite to translate. -* @return {Phaser.Point} The translated point. -*/ -Phaser.Sprite.prototype.getLocalPosition = function(p, x, y) { - - p.x = ((this._cache.a11 * this._cache.id * x + -this._cache.a01 * this._cache.id * y + (this._cache.a12 * this._cache.a01 - this._cache.a02 * this._cache.a11) * this._cache.id) * this.scale.x) + this._cache.a02; - p.y = ((this._cache.a00 * this._cache.id * y + -this._cache.a10 * this._cache.id * x + (-this._cache.a12 * this._cache.a00 + this._cache.a02 * this._cache.a10) * this._cache.id) * this.scale.y) + this._cache.a12; - - return p; - -}; - -/** -* Gets the local unmodified position of a coordinate relative to the Sprite, factoring in rotation and scale. -* Mostly only used internally by the Input Manager, but also useful for custom hit detection. -* -* @method Phaser.Sprite#getLocalUnmodifiedPosition -* @memberof Phaser.Sprite -* @param {Phaser.Point} p - The Point object to store the results in. -* @param {number} gx - x coordinate within the Sprite to translate. -* @param {number} gy - y coordinate within the Sprite to translate. -* @return {Phaser.Point} The translated point. -*/ -Phaser.Sprite.prototype.getLocalUnmodifiedPosition = function(p, gx, gy) { - - p.x = (this._cache.a11 * this._cache.idi * gx + -this._cache.i01 * this._cache.idi * gy + (this._cache.a12 * this._cache.i01 - this._cache.a02 * this._cache.a11) * this._cache.idi) + (this.anchor.x * this._cache.width); - p.y = (this._cache.a00 * this._cache.idi * gy + -this._cache.i10 * this._cache.idi * gx + (-this._cache.a12 * this._cache.a00 + this._cache.a02 * this._cache.i10) * this._cache.idi) + (this.anchor.y * this._cache.height); - - return p; - -}; - -/** -* Resets the Sprite.crop value back to the frame dimensions. -* -* @method Phaser.Sprite#resetCrop -* @memberof Phaser.Sprite -*/ -Phaser.Sprite.prototype.resetCrop = function() { - - this.crop = new Phaser.Rectangle(0, 0, this._cache.width, this._cache.height); - this.texture.setFrame(this.crop); - this.cropEnabled = false; + return true; }; @@ -1120,17 +736,9 @@ Phaser.Sprite.prototype.postUpdate = function() { if (this.fixedToCamera) { - this._cache.x = this.game.camera.view.x + this.cameraOffset.x; - this._cache.y = this.game.camera.view.y + this.cameraOffset.y; + // this.position.x = this.game.camera.view.x + this.x; + // this.position.y = this.game.camera.view.y + this.y; } - else - { - this._cache.x = this.x; - this._cache.y = this.y; - } - - this.position.x = this._cache.x; - this.position.y = this._cache.y; } }; @@ -1146,48 +754,55 @@ Phaser.Sprite.prototype.postUpdate = function() { */ Phaser.Sprite.prototype.loadTexture = function (key, frame) { - this.key = key; + frame = frame || 0; if (key instanceof Phaser.RenderTexture) { - this.currentFrame = this.game.cache.getTextureFrame(key.name); + this.key = key.key; + this.setTexture(key); } else if (key instanceof Phaser.BitmapData) { + this.key = key.key; this.setTexture(key.texture); - this.currentFrame = key.textureFrame; } else if (key instanceof PIXI.Texture) { - this.currentFrame = frame; + this.key = key; + this.setTexture(key); } else { - if (typeof key === 'undefined' || this.game.cache.checkImageKey(key) === false) + if (key === null || typeof key === 'undefined') { - key = '__default'; - this.key = key; + this.key = '__default'; + this.setTexture(PIXI.TextureCache[this.key]); + } + else if (typeof key === 'string' && !this.game.cache.checkImageKey(key)) + { + this.key = '__missing'; + this.setTexture(PIXI.TextureCache[this.key]); } if (this.game.cache.isSpriteSheet(key)) { + this.key = key; + + // var frameData = this.game.cache.getFrameData(key); this.animations.loadFrameData(this.game.cache.getFrameData(key)); - if (typeof frame !== 'undefined') + if (typeof frame === 'string') { - if (typeof frame === 'string') - { - this.frameName = frame; - } - else - { - this.frame = frame; - } + this.frameName = frame; + } + else + { + this.frame = frame; } } else { - this.currentFrame = this.game.cache.getFrame(key); + this.key = key; this.setTexture(PIXI.TextureCache[key]); } } @@ -1195,29 +810,49 @@ Phaser.Sprite.prototype.loadTexture = function (key, frame) { }; /** -* Moves the sprite so its center is located on the given x and y coordinates. -* Doesn't change the anchor point of the sprite. -* -* @method Phaser.Sprite#centerOn +* Crop allows you to crop the texture used to display this Image. +* Cropping takes place from the top-left of the Image and can be modified in real-time by providing an updated rectangle object. +* +* @method Phaser.Sprite#crop * @memberof Phaser.Sprite -* @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. -* @return (Phaser.Sprite) This instance. +* @param {Phaser.Rectangle} rect - The Rectangle to crop the Image to. Pass null or no parameters to clear a previously set crop rectangle. */ -Phaser.Sprite.prototype.centerOn = function(x, y) { +Phaser.Sprite.prototype.crop = function(rect) { - if (this.fixedToCamera) + if (typeof rect === 'undefined' || rect === null) { - this.cameraOffset.x = x + (this.cameraOffset.x - this.center.x); - this.cameraOffset.y = y + (this.cameraOffset.y - this.center.y); + // Clear any crop that may be set + if (this.texture.hasOwnProperty('sourceWidth')) + { + this.texture.setFrame(new Phaser.Rectangle(0, 0, this.texture.sourceWidth, this.texture.sourceHeight)); + } } else { - this.x = x + (this.x - this.center.x); - this.y = y + (this.y - this.center.y); - } + // Do we need to clone the PIXI.Texture object? + if (this.texture instanceof PIXI.Texture) + { + // Yup, let's rock it ... + var local = {}; - return this; + Phaser.Utils.extend(true, local, this.texture); + + local.sourceWidth = local.width; + local.sourceHeight = local.height; + local.frame = rect; + local.width = rect.width; + local.height = rect.height; + + this.texture = local; + + this.texture.updateFrame = true; + PIXI.Texture.frameUpdates.push(this.texture); + } + else + { + this.texture.setFrame(rect); + } + } }; @@ -1288,14 +923,9 @@ Phaser.Sprite.prototype.destroy = function() { this.filters = null; } - if (this.group) + if (this.parent) { - this.group.remove(this); - } - - if (this.input) - { - this.input.destroy(); + this.parent.remove(this); } if (this.events) @@ -1303,6 +933,11 @@ Phaser.Sprite.prototype.destroy = function() { this.events.destroy(); } + if (this.input) + { + this.input.destroy(); + } + if (this.animations) { this.animations.destroy(); @@ -1362,11 +997,9 @@ Phaser.Sprite.prototype.reset = function(x, y, health) { if (typeof health === 'undefined') { health = 1; } - this.x = x; - this.y = y; this.world.setTo(x, y); - this.position.x = this.x; - this.position.y = this.y; + this.position.x = x; + this.position.y = y; this.alive = true; this.exists = true; this.visible = true; @@ -1392,15 +1025,18 @@ Phaser.Sprite.prototype.reset = function(x, y, health) { * @memberof Phaser.Sprite * @return (Phaser.Sprite) This instance. */ -Phaser.Sprite.prototype.bringToTop = function() { +Phaser.Sprite.prototype.bringToTop = function(child) { - if (this.group) + if (typeof child === 'undefined') { - this.group.bringToTop(this); + if (this.parent) + { + this.parent.bringToTop(this); + } } else { - this.game.world.bringToTop(this); + } return this; @@ -1429,48 +1065,110 @@ Phaser.Sprite.prototype.play = function (name, frameRate, loop, killOnComplete) }; /** -* Returns the delta x value. The difference between Sprite.x now and in the previous step. +* Indicates the rotation of the Sprite, in degrees, from its original orientation. Values from 0 to 180 represent clockwise rotation; values from 0 to -180 represent counterclockwise rotation. +* Values outside this range are added to or subtracted from 360 to obtain a value within the range. For example, the statement player.angle = 450 is the same as player.angle = 90. +* If you wish to work in radians instead of degrees use the property Sprite.rotation instead. Working in radians is also a little faster as it doesn't have to convert the angle. +* +* @name Phaser.Sprite#angle +* @property {number} angle - The angle of this Image in degrees. +*/ +Object.defineProperty(Phaser.Sprite.prototype, "angle", { + + get: function() { + + return Phaser.Math.wrapAngle(Phaser.Math.radToDeg(this.rotation)); + + }, + + set: function(value) { + + this.rotation = Phaser.Math.degToRad(Phaser.Math.wrapAngle(value)); + + } + +}); + +/** +* Returns the delta x value. The difference between world.x now and in the previous step. +* * @name Phaser.Sprite#deltaX * @property {number} deltaX - The delta value. Positive if the motion was to the right, negative if to the left. * @readonly */ -Object.defineProperty(Phaser.Sprite.prototype, 'deltaX', { +Object.defineProperty(Phaser.Sprite.prototype, "deltaX", { get: function() { - return this.world.x - this._cache.prevX; + + return this.world.x - this._cache[0]; + } }); /** -* Returns the delta x value. The difference between Sprite.y now and in the previous step. +* Returns the delta y value. The difference between world.y now and in the previous step. +* * @name Phaser.Sprite#deltaY * @property {number} deltaY - The delta value. Positive if the motion was downwards, negative if upwards. * @readonly */ -Object.defineProperty(Phaser.Sprite.prototype, 'deltaY', { +Object.defineProperty(Phaser.Sprite.prototype, "deltaY", { get: function() { - return this.world.y - this._cache.prevY; + + return this.world.y - this._cache[1]; + } }); /** -* Indicates the rotation of the Sprite, in degrees, from its original orientation. Values from 0 to 180 represent clockwise rotation; values from 0 to -180 represent counterclockwise rotation. -* Values outside this range are added to or subtracted from 360 to obtain a value within the range. For example, the statement player.angle = 450 is the same as player.angle = 90. -* If you wish to work in radians instead of degrees use the property Sprite.rotation instead. -* @name Phaser.Sprite#angle -* @property {number} angle - Gets or sets the Sprites angle of rotation in degrees. +* Returns the delta z value. The difference between rotation now and in the previous step. +* +* @name Phaser.Sprite#deltaZ +* @property {number} deltaZ - The delta value. +* @readonly */ -Object.defineProperty(Phaser.Sprite.prototype, 'angle', { +Object.defineProperty(Phaser.Sprite.prototype, "deltaZ", { get: function() { - return Phaser.Math.wrapAngle(Phaser.Math.radToDeg(this.rotation)); - }, + + return this.rotation - this._cache[2]; + + } + +}); + +/** +* Checks if the Image bounds are within the game world, otherwise false if fully outside of it. +* +* @name Phaser.Sprite#inWorld +* @property {boolean} inWorld - True if the Image bounds is within the game world, even if only partially. Otherwise false if fully outside of it. +* @readonly +*/ +Object.defineProperty(Phaser.Sprite.prototype, "inWorld", { + + get: function() { + + return this.game.world.bounds.intersects(this.getBounds()); + + } + +}); + +/** +* Checks if the Image bounds are within the game camera, otherwise false if fully outside of it. +* +* @name Phaser.Sprite#inCamera +* @property {boolean} inCamera - True if the Image bounds is within the game camera, even if only partially. Otherwise false if fully outside of it. +* @readonly +*/ +Object.defineProperty(Phaser.Sprite.prototype, "inCamera", { + + get: function() { + + return this.game.world.camera.screenView.intersects(this.getBounds()); - set: function(value) { - this.rotation = Phaser.Math.degToRad(Phaser.Math.wrapAngle(value)); } }); @@ -1480,7 +1178,7 @@ Object.defineProperty(Phaser.Sprite.prototype, 'angle', { * @property {number} frame - Gets or sets the current frame index and updates the Texture Cache for display. */ Object.defineProperty(Phaser.Sprite.prototype, "frame", { - + get: function () { return this.animations.frame; }, @@ -1496,7 +1194,7 @@ Object.defineProperty(Phaser.Sprite.prototype, "frame", { * @property {string} frameName - Gets or sets the current frame name and updates the Texture Cache for display. */ Object.defineProperty(Phaser.Sprite.prototype, "frameName", { - + get: function () { return this.animations.frameName; }, @@ -1508,102 +1206,32 @@ Object.defineProperty(Phaser.Sprite.prototype, "frameName", { }); /** -* @name Phaser.Sprite#inCamera -* @property {boolean} inCamera - Is this sprite visible to the camera or not? +* @name Phaser.Sprite#renderOrderID +* @property {number} renderOrderID - The render order ID, reset every frame. * @readonly */ -Object.defineProperty(Phaser.Sprite.prototype, "inCamera", { - - get: function () { - return this._cache.cameraVisible; - } - -}); - -/** -* @name Phaser.Sprite#worldCenterX -* @property {number} worldCenterX - The center of the Sprite in world coordinates. -* @readonly -*/ -Object.defineProperty(Phaser.Sprite.prototype, "worldCenterX", { - - get: function () { - return this.game.camera.x + this.center.x; - } - -}); - -/** -* @name Phaser.Sprite#worldCenterY -* @property {number} worldCenterY - The center of the Sprite in world coordinates. -* @readonly -*/ -Object.defineProperty(Phaser.Sprite.prototype, "worldCenterY", { - - get: function () { - return this.game.camera.y + this.center.y; - } - -}); - -/** -* The width of the sprite in pixels, setting this will actually modify the scale to acheive the value desired. -* If you wish to crop the Sprite instead see the Sprite.crop value. -* -* @name Phaser.Sprite#width -* @property {number} width - The width of the Sprite in pixels. -*/ -Object.defineProperty(Phaser.Sprite.prototype, 'width', { +Object.defineProperty(Phaser.Sprite.prototype, "renderOrderID", { get: function() { - return this.scale.x * this.currentFrame.width; - }, - set: function(value) { - - this.scale.x = value / this.currentFrame.width; - this._cache.scaleX = value / this.currentFrame.width; - this._width = value; + return this._cache[3]; } }); /** -* The height of the sprite in pixels, setting this will actually modify the scale to acheive the value desired. -* If you wish to crop the Sprite instead see the Sprite.crop value. -* -* @name Phaser.Sprite#height -* @property {number} height - The height of the Sprite in pixels. -*/ -Object.defineProperty(Phaser.Sprite.prototype, 'height', { - - get: function() { - return this.scale.y * this.currentFrame.height; - }, - - set: function(value) { - - this.scale.y = value / this.currentFrame.height; - this._cache.scaleY = value / this.currentFrame.height; - this._height = value; - - } - -}); - -/** -* By default a Sprite won't process any input events at all. By setting inputEnabled to true the Phaser.InputHandler is -* activated for this Sprite instance and it will then start to process click/touch events and more. +* By default an Image 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.Sprite#inputEnabled -* @property {boolean} inputEnabled - Set to true to allow this Sprite to receive input events, otherwise false. +* @property {boolean} inputEnabled - Set to true to allow this object to receive input events. */ Object.defineProperty(Phaser.Sprite.prototype, "inputEnabled", { get: function () { - return (this.input.enabled); + return (this.input && this.input.enabled); }, @@ -1611,19 +1239,19 @@ Object.defineProperty(Phaser.Sprite.prototype, "inputEnabled", { if (value) { - if (this.input.enabled === false) + if (this.input === null) { + this.input = new Phaser.InputHandler(this); this.input.start(); } } else { - if (this.input.enabled) + if (this.input && this.input.enabled) { this.input.stop(); } } - } }); @@ -1648,7 +1276,7 @@ Object.defineProperty(Phaser.Sprite.prototype, "inputEnabled", { Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Stage.js.html b/docs/Stage.js.html index 61e45c67..9a68cd74 100644 --- a/docs/Stage.js.html +++ b/docs/Stage.js.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -665,21 +699,12 @@ Object.defineProperty(Phaser.Stage.prototype, "backgroundColor", { if (this.game.transparent === false) { - if (this.game.renderType == Phaser.CANVAS) + if (typeof color === 'string') { - // Set it directly, this allows us to use rgb alpha values in Canvas mode. - this.game.canvas.style.backgroundColor = color; - } - else - { - if (typeof color === 'string') - { - color = Phaser.Color.hexToRGB(color); - } - - this._stage.setBackgroundColor(color); + color = Phaser.Color.hexToRGB(color); } + this._stage.setBackgroundColor(color); } } @@ -706,7 +731,7 @@ Object.defineProperty(Phaser.Stage.prototype, "backgroundColor", { Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/StageScaleMode.js.html b/docs/StageScaleMode.js.html index 156a13d6..dcb6582c 100644 --- a/docs/StageScaleMode.js.html +++ b/docs/StageScaleMode.js.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -1212,7 +1246,7 @@ Object.defineProperty(Phaser.StageScaleMode.prototype, "isLandscape", { Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/State.js.html b/docs/State.js.html index b20515cf..de4968e5 100644 --- a/docs/State.js.html +++ b/docs/State.js.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -607,7 +641,7 @@ Phaser.State.prototype.constructor = Phaser.State; Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/StateManager.js.html b/docs/StateManager.js.html index e3b8a73f..9cba01a8 100644 --- a/docs/StateManager.js.html +++ b/docs/StateManager.js.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -964,7 +998,7 @@ Phaser.StateManager.prototype.constructor = Phaser.StateManager; Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Text.js.html b/docs/Text.js.html index 9376f7f1..589d77e6 100644 --- a/docs/Text.js.html +++ b/docs/Text.js.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -737,7 +771,7 @@ Object.defineProperty(Phaser.Text.prototype, 'font', { Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Tile.js.html b/docs/Tile.js.html index 0dc8af7a..57038134 100644 --- a/docs/Tile.js.html +++ b/docs/Tile.js.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -729,7 +763,7 @@ Object.defineProperty(Phaser.Tile.prototype, "bottom", { Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/TileSprite.js.html b/docs/TileSprite.js.html index a9fdfd0d..ea50c502 100644 --- a/docs/TileSprite.js.html +++ b/docs/TileSprite.js.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -594,7 +628,7 @@ Object.defineProperty(Phaser.TileSprite.prototype, "inputEnabled", { Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Tilemap.js.html b/docs/Tilemap.js.html index ed75f137..d86b6e9c 100644 --- a/docs/Tilemap.js.html +++ b/docs/Tilemap.js.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -449,14 +483,49 @@ Phaser.Tilemap = function (game, key) { return; } + /** + * @property {number} width - The width of the map (in tiles). + */ this.width = data.width; + + /** + * @property {number} height - The height of the map (in tiles). + */ this.height = data.height; + + /** + * @property {number} tileWidth - The base width of the tiles in the map (in pixels). + */ this.tileWidth = data.tileWidth; + + /** + * @property {number} tileHeight - The base height of the tiles in the map (in pixels). + */ this.tileHeight = data.tileHeight; + + /** + * @property {string} orientation - The orientation of the map data (as specified in Tiled), usually 'orthogonal'. + */ this.orientation = data.orientation; + + /** + * @property {number} version - The version of the map data (as specified in Tiled, usually 1). + */ this.version = data.version; + + /** + * @property {object} properties - Map specific properties as specified in Tiled. + */ this.properties = data.properties; + + /** + * @property {number} widthInPixels - The width of the map in pixels based on width * tileWidth. + */ this.widthInPixels = data.widthInPixels; + + /** + * @property {number} heightInPixels - The height of the map in pixels based on height * tileHeight. + */ this.heightInPixels = data.heightInPixels; /** @@ -608,12 +677,13 @@ Phaser.Tilemap.prototype = { }, - // Region? Remove tile from map data? + /* createFromTiles: function (layer, tileIndex, key, frame, group) { if (typeof group === 'undefined') { group = this.game.world; } }, + */ /** * Creates a Sprite for every object matching the given gid in the map data. You can optionally specify the group that the Sprite will be created in. If none is @@ -621,7 +691,7 @@ Phaser.Tilemap.prototype = { * configure Sprite properties from within the map editor. For example giving an object a property if alpha: 0.5 in the map editor will duplicate that when the * Sprite is created. You could also give it a value like: body.velocity.x: 100 to set it moving automatically. * - * @method Phaser.Tileset#createFromObjects + * @method Phaser.Tilemap#createFromObjects * @param {string} name - The name of the Object Group to create Sprites from. * @param {number} gid - The layer array index value, or if a string is given the layer name, within the map data that this TilemapLayer represents. * @param {string} key - The Game.cache key of the image that this Sprite will use. @@ -666,8 +736,10 @@ Phaser.Tilemap.prototype = { /** * Creates a new TilemapLayer object. By default TilemapLayers are fixed to the camera. + * The `layer` parameter is important. If you've created your map in Tiled then you can get this by looking in Tiled and looking at the Layer name. + * Or you can open the JSON file it exports and look at the layers[].name value. Either way it must match. * - * @method Phaser.Tileset#createLayer + * @method Phaser.Tilemap#createLayer * @param {number|string} layer - The layer array index value, or if a string is given the layer name, within the map data that this TilemapLayer represents. * @param {number} [width] - The rendered width of the layer, should never be wider than Game.width. If not given it will be set to Game.width. * @param {number} [height] - The rendered height of the layer, should never be wider than Game.height. If not given it will be set to Game.height. @@ -702,7 +774,7 @@ Phaser.Tilemap.prototype = { /** * Gets the layer index based on the layers name. * - * @method Phaser.Tileset#getIndex + * @method Phaser.Tilemap#getIndex * @protected * @param {array} location - The local array to search. * @param {string} name - The name of the array element to get. @@ -725,7 +797,7 @@ Phaser.Tilemap.prototype = { /** * Gets the layer index based on its name. * - * @method Phaser.Tileset#getLayerIndex + * @method Phaser.Tilemap#getLayerIndex * @param {string} name - The name of the layer to get. * @return {number} The index of the layer in this tilemap, or null if not found. */ @@ -738,7 +810,7 @@ Phaser.Tilemap.prototype = { /** * Gets the tileset index based on its name. * - * @method Phaser.Tileset#getTilesetIndex + * @method Phaser.Tilemap#getTilesetIndex * @param {string} name - The name of the tileset to get. * @return {number} The index of the tileset in this tilemap, or null if not found. */ @@ -751,7 +823,7 @@ Phaser.Tilemap.prototype = { /** * Gets the image index based on its name. * - * @method Phaser.Tileset#getImageIndex + * @method Phaser.Tilemap#getImageIndex * @param {string} name - The name of the image to get. * @return {number} The index of the image in this tilemap, or null if not found. */ @@ -764,7 +836,7 @@ Phaser.Tilemap.prototype = { /** * Gets the object index based on its name. * - * @method Phaser.Tileset#getObjectIndex + * @method Phaser.Tilemap#getObjectIndex * @param {string} name - The name of the object to get. * @return {number} The index of the object in this tilemap, or null if not found. */ @@ -779,7 +851,7 @@ Phaser.Tilemap.prototype = { * If a callback is already set for the tile index it will be replaced. Set the callback to null to remove it. * If you want to set a callback for a tile at a specific location on the map then see setTileLocationCallback. * - * @method Phaser.Tileset#setTileIndexCallback + * @method Phaser.Tilemap#setTileIndexCallback * @param {number|array} indexes - Either a single tile index, or an array of tile indexes to have a collision callback set for. * @param {function} callback - The callback that will be invoked when the tile is collided with. * @param {object} callbackContext - The context under which the callback is called. @@ -810,7 +882,7 @@ Phaser.Tilemap.prototype = { * If a callback is already set for the tile index it will be replaced. Set the callback to null to remove it. * If you want to set a callback for a tile at a specific location on the map then see setTileLocationCallback. * - * @method Phaser.Tileset#setTileLocationCallback + * @method Phaser.Tilemap#setTileLocationCallback * @param {number} x - X position of the top left of the area to copy (given in tiles, not pixels) * @param {number} y - Y position of the top left of the area to copy (given in tiles, not pixels) * @param {number} width - The width of the area to copy (given in tiles, not pixels) @@ -841,7 +913,7 @@ Phaser.Tilemap.prototype = { * Sets collision the given tile or tiles. You can pass in either a single numeric index or an array of indexes: [ 2, 3, 15, 20]. * The `collides` parameter controls if collision will be enabled (true) or disabled (false). * - * @method Phaser.Tileset#setCollision + * @method Phaser.Tilemap#setCollision * @param {number|array} indexes - Either a single tile index, or an array of tile IDs to be checked for collision. * @param {boolean} [collides=true] - If true it will enable collision. If false it will clear collision. * @param {number|string|Phaser.TilemapLayer} [layer] - The layer to operate on. If not given will default to this.currentLayer. @@ -875,7 +947,7 @@ Phaser.Tilemap.prototype = { * Calling this with a start value of 10 and a stop value of 14 would set collision for tiles 10, 11, 12, 13 and 14. * The `collides` parameter controls if collision will be enabled (true) or disabled (false). * - * @method Phaser.Tileset#setCollisionBetween + * @method Phaser.Tilemap#setCollisionBetween * @param {number} start - The first index of the tile to be set for collision. * @param {number} stop - The last index of the tile to be set for collision. * @param {boolean} [collides=true] - If true it will enable collision. If false it will clear collision. @@ -906,7 +978,7 @@ Phaser.Tilemap.prototype = { * Sets collision on all tiles in the given layer, except for the IDs of those in the given array. * The `collides` parameter controls if collision will be enabled (true) or disabled (false). * - * @method Phaser.Tileset#setCollisionByExclusion + * @method Phaser.Tilemap#setCollisionByExclusion * @param {array} indexes - An array of the tile IDs to not be counted for collision. * @param {boolean} [collides=true] - If true it will enable collision. If false it will clear collision. * @param {number|string|Phaser.TilemapLayer} [layer] - The layer to operate on. If not given will default to this.currentLayer. @@ -935,7 +1007,7 @@ Phaser.Tilemap.prototype = { * Sets collision values on a tile in the set. * You shouldn't usually call this method directly, instead use setCollision, setCollisionBetween or setCollisionByExclusion. * - * @method Phaser.Tileset#setCollisionByIndex + * @method Phaser.Tilemap#setCollisionByIndex * @protected * @param {number} index - The index of the tile on the layer. * @param {boolean} [collides=true] - If true it will enable collision on the tile. If false it will clear collision values from the tile. @@ -978,7 +1050,7 @@ Phaser.Tilemap.prototype = { /** * Gets the TilemapLayer index as used in the setCollision calls. * - * @method Phaser.Tileset#getLayer + * @method Phaser.Tilemap#getLayer * @protected * @param {number|string|Phaser.TilemapLayer} layer - The layer to operate on. If not given will default to this.currentLayer. * @return {number} The TilemapLayer index. @@ -1009,7 +1081,7 @@ Phaser.Tilemap.prototype = { /** * Internal function. * - * @method Phaser.Tileset#calculateFaces + * @method Phaser.Tilemap#calculateFaces * @protected * @param {number} layer - The index of the TilemapLayer to operate on. */ @@ -1066,7 +1138,7 @@ Phaser.Tilemap.prototype = { * Gets the tile above the tile coordinates given. * Mostly used as an internal function by calculateFaces. * - * @method Phaser.Tileset#getTileAbove + * @method Phaser.Tilemap#getTileAbove * @param {number} layer - The local layer index to get the tile from. Can be determined by Tilemap.getLayer(). * @param {number} x - The x coordinate to get the tile from. In tiles, not pixels. * @param {number} y - The y coordinate to get the tile from. In tiles, not pixels. @@ -1086,7 +1158,7 @@ Phaser.Tilemap.prototype = { * Gets the tile below the tile coordinates given. * Mostly used as an internal function by calculateFaces. * - * @method Phaser.Tileset#getTileBelow + * @method Phaser.Tilemap#getTileBelow * @param {number} layer - The local layer index to get the tile from. Can be determined by Tilemap.getLayer(). * @param {number} x - The x coordinate to get the tile from. In tiles, not pixels. * @param {number} y - The y coordinate to get the tile from. In tiles, not pixels. @@ -1106,7 +1178,7 @@ Phaser.Tilemap.prototype = { * Gets the tile to the left of the tile coordinates given. * Mostly used as an internal function by calculateFaces. * - * @method Phaser.Tileset#getTileLeft + * @method Phaser.Tilemap#getTileLeft * @param {number} layer - The local layer index to get the tile from. Can be determined by Tilemap.getLayer(). * @param {number} x - The x coordinate to get the tile from. In tiles, not pixels. * @param {number} y - The y coordinate to get the tile from. In tiles, not pixels. @@ -1126,7 +1198,7 @@ Phaser.Tilemap.prototype = { * Gets the tile to the right of the tile coordinates given. * Mostly used as an internal function by calculateFaces. * - * @method Phaser.Tileset#getTileRight + * @method Phaser.Tilemap#getTileRight * @param {number} layer - The local layer index to get the tile from. Can be determined by Tilemap.getLayer(). * @param {number} x - The x coordinate to get the tile from. In tiles, not pixels. * @param {number} y - The y coordinate to get the tile from. In tiles, not pixels. @@ -1673,7 +1745,7 @@ Phaser.Tilemap.prototype.constructor = Phaser.Tilemap; Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/TilemapLayer.js.html b/docs/TilemapLayer.js.html index e92aa009..c16427e1 100644 --- a/docs/TilemapLayer.js.html +++ b/docs/TilemapLayer.js.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -1316,7 +1350,7 @@ Object.defineProperty(Phaser.TilemapLayer.prototype, "collisionHeight", { Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/TilemapParser.js.html b/docs/TilemapParser.js.html index 8bd6058b..feee6acd 100644 --- a/docs/TilemapParser.js.html +++ b/docs/TilemapParser.js.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -814,7 +848,7 @@ Phaser.TilemapParser = { Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Tileset.js.html b/docs/Tileset.js.html index 56d573a1..1fd15ec2 100644 --- a/docs/Tileset.js.html +++ b/docs/Tileset.js.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -592,7 +626,7 @@ Phaser.Tileset.prototype.constructor = Phaser.Tileset; Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Time.js.html b/docs/Time.js.html index 91ac8c29..9b78ae92 100644 --- a/docs/Time.js.html +++ b/docs/Time.js.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -783,7 +817,7 @@ Phaser.Time.prototype.constructor = Phaser.Time; Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Timer.js.html b/docs/Timer.js.html index fd8151d7..4f29b7fd 100644 --- a/docs/Timer.js.html +++ b/docs/Timer.js.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -662,7 +696,7 @@ Phaser.Timer.prototype = { { if (this.events[i] === event) { - this.events.splice(i, 1); + this.events[i].pendingDelete = true; return true; } } @@ -725,11 +759,26 @@ Phaser.Timer.prototype = { this._len = this.events.length; + this._i = 0; + + while (this._i < this._len) + { + if (this.events[this._i].pendingDelete) + { + this.events.splice(this._i, 1); + this._len--; + } + + this._i++; + } + + this._len = this.events.length; + if (this.running && this._now >= this.nextTick && this._len > 0) { this._i = 0; - while (this._i < this._len) + while (this._i < this._len && this.running) { if (this._now >= this.events[this._i].tick) { @@ -788,9 +837,12 @@ Phaser.Timer.prototype = { */ pause: function () { - this._pauseStarted = this.game.time.now; + if (this.running && !this.expired) + { + this._pauseStarted = this.game.time.now; - this.paused = true; + this.paused = true; + } }, @@ -800,17 +852,20 @@ Phaser.Timer.prototype = { */ resume: function () { - var pauseDuration = this.game.time.now - this._pauseStarted; - - for (var i = 0; i < this.events.length; i++) + if (this.running && !this.expired) { - this.events[i].tick += pauseDuration; + var pauseDuration = this.game.time.now - this._pauseStarted; + + for (var i = 0; i < this.events.length; i++) + { + this.events[i].tick += pauseDuration; + } + + this.nextTick += pauseDuration; + + this.paused = false; } - this.nextTick += pauseDuration; - - this.paused = false; - }, /** @@ -822,6 +877,7 @@ Phaser.Timer.prototype = { this.onComplete.removeAll(); this.running = false; this.events = []; + this._i = this._len; } @@ -923,7 +979,7 @@ Phaser.Timer.prototype.constructor = Phaser.Timer; Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/TimerEvent.js.html b/docs/TimerEvent.js.html index d0a9f1e5..41a84f91 100644 --- a/docs/TimerEvent.js.html +++ b/docs/TimerEvent.js.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -479,6 +513,12 @@ Phaser.TimerEvent = function (timer, delay, tick, repeatCount, loop, callback, c */ this.args = args; + /** + * @property {boolean} pendingDelete - A flag that controls if the TimerEvent is pending deletion. + * @protected + */ + this.pendingDelete = false; + }; Phaser.TimerEvent.prototype.constructor = Phaser.TimerEvent; @@ -503,7 +543,7 @@ Phaser.TimerEvent.prototype.constructor = Phaser.TimerEvent; Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Touch.js.html b/docs/Touch.js.html index 3c6bfc6b..e309954b 100644 --- a/docs/Touch.js.html +++ b/docs/Touch.js.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -807,7 +841,7 @@ Phaser.Touch.prototype.constructor = Phaser.Touch; Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Tween.js.html b/docs/Tween.js.html index 9b4e0de5..83f6136a 100644 --- a/docs/Tween.js.html +++ b/docs/Tween.js.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -1015,7 +1049,7 @@ Phaser.Tween.prototype.constructor = Phaser.Tween; Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/TweenManager.js.html b/docs/TweenManager.js.html index 07e47e17..a673e730 100644 --- a/docs/TweenManager.js.html +++ b/docs/TweenManager.js.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -640,7 +674,7 @@ Phaser.TweenManager.prototype.constructor = Phaser.TweenManager; Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Utils.js.html b/docs/Utils.js.html index abbfff1f..e0c1a76e 100644 --- a/docs/Utils.js.html +++ b/docs/Utils.js.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -614,12 +648,64 @@ Phaser.Utils = { }; -function HEXtoRGB(hex) { +/** + * Converts a hex color number to an [R, G, B] array + * + * @method hex2rgb + * @param hex {Number} + */ +PIXI.hex2rgb = function(hex) { return [(hex >> 16 & 0xFF) / 255, ( hex >> 8 & 0xFF) / 255, (hex & 0xFF)/ 255]; -} +}; -PIXI.hex2rgb = function hex2rgb(hex) { - return [(hex >> 16 & 0xFF) / 255, ( hex >> 8 & 0xFF) / 255, (hex & 0xFF)/ 255]; +/** + * Converts a color as an [R, G, B] array to a hex number + * + * @method rgb2hex + * @param rgb {Array} + */ +PIXI.rgb2hex = function(rgb) { + return ((rgb[0]*255 << 16) + (rgb[1]*255 << 8) + rgb[2]*255); +}; + +/** + * Checks whether the Canvas BlendModes are supported by the current browser + * + * @method canUseNewCanvasBlendModes + * @return {Boolean} whether they are supported + */ +PIXI.canUseNewCanvasBlendModes = function() +{ + var canvas = document.createElement('canvas'); + canvas.width = 1; + canvas.height = 1; + var context = canvas.getContext('2d'); + context.fillStyle = '#000'; + context.fillRect(0,0,1,1); + context.globalCompositeOperation = 'multiply'; + context.fillStyle = '#fff'; + context.fillRect(0,0,1,1); + return context.getImageData(0,0,1,1).data[0] === 0; +}; + +/** + * Given a number, this function returns the closest number that is a power of two + * this function is taken from Starling Framework as its pretty neat ;) + * + * @method getNextPowerOfTwo + * @param number {Number} + * @return {Number} the closest number that is a power of two + */ +PIXI.getNextPowerOfTwo = function(number) +{ + if (number > 0 && (number & (number - 1)) === 0) // see: http://goo.gl/D9kPj + return number; + else + { + var result = 1; + while (result < number) result <<= 1; + return result; + } }; /** @@ -689,7 +775,7 @@ if (!Array.isArray) { Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/World.js.html b/docs/World.js.html index dc04dbad..34124778 100644 --- a/docs/World.js.html +++ b/docs/World.js.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -471,38 +505,30 @@ 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._container; + this.camera.displayObject = this; this.game.camera = this.camera; + this.game.stage._stage.addChild(this); + } /** * This is called automatically after the plugins preUpdate and before the State.update. * Most objects have preUpdate methods and it's where initial movement, drawing and calculations are done. * -* @method Phaser.World#update +* @method Phaser.World#preUpdate */ Phaser.World.prototype.preUpdate = function () { - if (this.game.stage._stage.first._iNext) + this.currentRenderOrderID = 0; + + for (var i = 0, len = this.children.length; i < len; i++) { - var currentNode = this.game.stage._stage.first._iNext; - - do + if (this.children[i]['preUpdate']) { - // If preUpdate exists, and it returns false, skip PIXI child objects - if (currentNode['preUpdate'] && !currentNode.preUpdate()) - { - currentNode = currentNode.last._iNext; - } - else - { - currentNode = currentNode._iNext; - } - + this.children[i].preUpdate(); } - while (currentNode != this.game.stage._stage.last._iNext) } } @@ -515,26 +541,12 @@ Phaser.World.prototype.preUpdate = function () { */ Phaser.World.prototype.update = function () { - this.currentRenderOrderID = 0; - - if (this.game.stage._stage.first._iNext) + for (var i = 0, len = this.children.length; i < len; i++) { - var currentNode = this.game.stage._stage.first._iNext; - - do + if (this.children[i]['update']) { - // If update exists, and it returns false, skip PIXI child objects - if (currentNode['update'] && !currentNode.update()) - { - currentNode = currentNode.last._iNext; - } - else - { - currentNode = currentNode._iNext; - } - + this.children[i].update(); } - while (currentNode != this.game.stage._stage.last._iNext) } } @@ -555,40 +567,24 @@ Phaser.World.prototype.postUpdate = function () { this.camera.update(); - if (this.game.stage._stage.first._iNext) + for (var i = 0, len = this.children.length; i < len; i++) { - var currentNode = this.game.stage._stage.first._iNext; - - do + if (this.children[i]['postUpdate']) { - if (currentNode['postUpdate'] && currentNode !== this.camera.target) - { - currentNode.postUpdate(); - } - - currentNode = currentNode._iNext; + this.children[i].postUpdate(); } - while (currentNode != this.game.stage._stage.last._iNext) } } else { this.camera.update(); - if (this.game.stage._stage.first._iNext) + for (var i = 0, len = this.children.length; i < len; i++) { - var currentNode = this.game.stage._stage.first._iNext; - - do + if (this.children[i]['postUpdate']) { - if (currentNode['postUpdate']) - { - currentNode.postUpdate(); - } - - currentNode = currentNode._iNext; + this.children[i].postUpdate(); } - while (currentNode != this.game.stage._stage.last._iNext) } } @@ -744,21 +740,6 @@ Object.defineProperty(Phaser.World.prototype, "randomY", { }); -/** -* @name Phaser.World#visible -* @property {boolean} visible - Gets or sets the visible state of the World. -*/ -Object.defineProperty(Phaser.World.prototype, "visible", { - - get: function () { - return this._container.visible; - }, - - set: function (value) { - this._container.visible = value; - } - -}); @@ -780,7 +761,7 @@ Object.defineProperty(Phaser.World.prototype, "visible", { Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/classes.list.html b/docs/classes.list.html index 411a0665..d5fde758 100644 --- a/docs/classes.list.html +++ b/docs/classes.list.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -398,6 +402,36 @@ + + @@ -577,6 +611,9 @@
    Group
    +
    Image
    +
    +
    Input
    @@ -655,6 +692,9 @@
    RenderTexture
    +
    RenderTexture
    +
    +
    RequestAnimationFrame
    @@ -673,6 +713,9 @@
    Sprite
    +
    Sprite
    +
    +
    Stage
    @@ -774,7 +817,7 @@ Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:41 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/global.html b/docs/global.html index 36df3ad4..307c8d56 100644 --- a/docs/global.html +++ b/docs/global.html @@ -182,6 +182,10 @@ Group +
  • + Image +
  • +
  • Input
  • @@ -404,20 +408,24 @@ + + @@ -436,9 +470,9 @@

    Phaser Logo

    -

    Phaser 1.1.4

    +

    Phaser 1.2-dev

    Phaser is a fast, free and fun open source game framework for making desktop and mobile browser HTML5 games. It uses Pixi.js internally for fast 2D Canvas and WebGL rendering.

    -

    Version: 1.1.4 "Kandor" - Released: February 5th 2014

    +

    Version: 1.2 "Shienar" - Released: -in development-

    By Richard Davey, Photon Storm

    • View the Official Website
    • @@ -469,175 +503,44 @@

      There is a comprehensive How to Learn Phaser guide on the GameDevTuts+ site which is a great place to learn where to find tutorials, examples and support.

      There is also an un-official Getting Started Guide.

      Change Log

      -

      Version 1.1.4 - "Kandor" - February 5th 2014

      +

      Version 1.2 - "Shienar" - -in development-

      Significant API changes:

        -
      • Loader.tileset has been removed as it's no longer required, this was as part of the Tilemap system overhaul.
      • -
      • TilemapLayers are now created via the Tilemap object itself: map.createLayer(x, y, width, height, tileset, layer, group) and no longer via the GameObjectFactory.
      • -
      • Tilemap.createFromObjects can now turn a bunch of Tiled objects into Sprites in one single call, and copies across all properties as well.
      • -
      • Tween.onStartCallback and onCompleteCallback have been removed to avoid confusion. You should use the onStart, onLoop and onComplete events instead.
      • -
      • Button.forceOut default value has changed from true to false, so Buttons will revert to an Up state (if set) when pressed and released.
      • -
      • The way the collision process callback works has changed significantly and now works as originally intended.
      • -
      • The World level quadtree is no longer created, they are now built and ripped down each time you collide a Group, this helps collision accuracy.
      • -
      • A SAT system has been integrated for Body collision and separation.
      • -
      • Bodies are no longer added to a world quadtree, so have had all of their quadtree properties removed such as skipQuadtree, quadTreeIndex, etc.
      • -
      • Body.drag has been removed. Please use the new Body.linearDamping value instead (which is a number value, not a Point object)
      • -
      • Body.embedded and Body.wasTouching have been removed as they are no longer required.
      • -
      • Body.customSeparateX/Y have been removed as you should now use Body.customSeparateCallback.
      • -
      • Body.maxVelocity defaults have been removed from 10,000 to 2000.
      • -
      • Body.customSeparateCallback allows you to set your own callback when two Bodies need to separate rather than using the built-in method.
      • -
      • Body.collideCallback allows you to set a callback that is fired whenever the Body is hit on any of its active faces.
      • -
      • Body.allowCollision has been renamed to Body.checkCollision.
      • -
      • Body.rebound is a boolean that controls if a body will exchange velocity on collision. Set to false to allow it to be 'pushed' (see new examples).
      • -
      • Removed Body.deltaAbsX and deltaAbsY as they are no longer used internally.
      • -
      • Body.screenX and screenY moved to getters, no longer calculated every frame.
      • -
      • ArcadePhysics now has setBounds and setBoundsToWorld, and you can specify which walls are created or not (left, right, up, down)
      • -
      • Removed: Debug.renderSpriteTouching, Debug.renderLocalTransformInfo, Debug.renderWorldTransformInfo, Debug.renderSpriteCollision and Debug.dumpLinkedList.
      • -
      • Body.setSize has been removed. Please use Body.setCircle, setRectangle or setPolygon instead.
      • +
      • Upgraded to Pixi.js 1.4.4
      • +
      • Group now extends PIXI.DisplayObjectContainer, rather than owning a _container property, which makes life a whole lot easier re: nesting.
      • +
      • Removed Sprite.group property. You can use Sprite.parent for all similar needs now.
      • +
      • PIXI.Point is now aliased to Phaser.Point - saves on code duplication and works exactly the same.
      • +
      • PIXI.Rectangle is now aliased to Phaser.Rectangle - saves on code duplication and works exactly the same.
      • +
      • PIXI.Circle is now aliased to Phaser.Circle - saves on code duplication and works exactly the same.
      • +
      • Sprite.deltaX and deltaY swapped to functions: Sprite.deltaX() and Sprite.deltaY()
      • +
      • Sprite.crop() now takes a Phaser.Rectangle instead of explicit parameters.
      • +
      • PixiPatch no longer needed, all features that it patched are now native in Pixi :)
      • +
      • Removed: Sprite.offset, center, topLeft, topRight, bottomRight, bottomLeft and bounds as no longer needed internally. Use Sprite.getBounds() to derive them.
      • +
      • Button now extends Phaser.Image not Phaser.Sprite, all the same functionality as before remains, just no animations or physics body.

      New features:

        -
      • Phaser.Timer is now feature complete and fully documented. You can create Phaser.TimerEvents on a Timer and lots of new examples have been provided.
      • -
      • Gamepad API support has been added with lots of new examples (thanks Karl Macklin)
      • -
      • Phaser.Game constructor can now be passed a single object containing all of your game settings + Stage settings. Useful for advanced configurations.
      • -
      • The width/height given to Phaser.Game can now be percentages, i.e. "100%" will set the width to the maximum window innerWidth.
      • -
      • Added a stage.fullScreenScaleMode property to determine scaling when fullscreen (thanks oysterCrusher)
      • -
      • Added support for margin and spacing around a frame in Loader.spritesheet.
      • -
      • Added Device.vibration to check if the Vibration API is available or not.
      • -
      • Added Device.trident and Device.tridentVersion for testing IE11.
      • -
      • Added Device.silk for detecting a Kindle Fire and updated desktop OS check to exclude Kindles (thanks LuckieLordie)
      • -
      • TilemapLayers now have debug and debugAlpha values, this turns on the drawing of the collision edges (very handy for debugging, as the name implies!)
      • -
      • Tweens have a new event: onLoop.
      • -
      • You can now load any binary file via the Loader: game.load.binary(key, url, callback) - the optional callback allows for post-load processing before entering the Cache.
      • -
      • Group.set will let you deep set a new propery on a single child of the Group.
      • -
      • Stage.display property added. A direct reference to the root Pixi Stage object (very useful for RenderTexture manipulation)
      • -
      • Added Ejecta detection to Device (thanks endel)
      • -
      • Tweens can now work with relative + and - values. You can do: tween(sprite).to( { x: '+400' }) and it will add 400 to the current sprite.x value.
      • -
      • Buttons now properly use their upFrame if set.
      • -
      • InputHandler now has snapOffsetX and snapOffsetY properties so your snap grid doesn't have to be 0,0 aligned (thanks srmeier)
      • -
      • Loader.progressFloat contains the actual non-rounded progress value, where-as Loader.progress contains a rounded value. Use progressFloat if you've > 100 files to load.
      • -
      • Groups can now be added to other Groups as children via group.add() and group.addAt()
      • -
      • Groups now have an 'alive' property, which can be useful when iterating through child groups with functions like forEachAlive.
      • -
      • Added a new Project Template "Full Screen Mobile" which you can find in the resources folder. Contains html / css / layout needed for a deployed Phaser game.
      • -
      • Body.speed - the current speed of the body.
      • -
      • Body.angle - the current angle the Body is facing based on its velocity. This is not the same as the Sprite angle that may own the body.
      • -
      • Body.linearDamping - This now replaces Body.drag and provides for a much smoother damping (friction) experience.
      • -
      • Body.minBounceVelocity - If a Body has bounce set, this threshold controls if it should rebound or not. Use it to stop 'jittering' on bounds/tiles with super-low velocities.
      • -
      • QuadTree.populate - you can pass it a Group and it'll automatically insert all of the children ready for inspection.
      • -
      • Input.setMoveCallback allows you to set a callback that will be fired each time the activePointer receives a DOM move event.
      • -
      • Math.distancePow(x1,y1,x2,y2,power) returns the distance between two coordinates at the given power.
      • -
      • Physics.collide now supports the 2nd parameter as an array, for when you want to collide an object against a number of sprites that aren't all in the same Group.
      • -
      • Physics.overlap now supports the 2nd parameter as an array, for when you want to overlap test an object against a number of sprites that aren't all in the same Group.
      • -
      • Math.reverseAngle - reverses an angle (in radians).
      • -
      • Math.normalizeAngle - normalises an angle, now in radians only.
      • -
      • Math.normalizeLatitude - Normalizes a latitude to the [-90,90] range.
      • -
      • Math.normalizeLongitude - Normalizes a longitude to the [-180,180] range.
      • -
      • Phaser.Line added to the geometry classes, with full point on line/segment and intersection tests (see new examples)
      • -
      • Phaser.CANVAS_PX_ROUND is a boolean. If 'true' the Canvas renderer will Math.floor() all coordinates before drawImage, stopping pixel interpolation. Defaults to false.
      • -
      • Phaser.CANVAS_CLEAR_RECT is a boolean. If 'true' (the default) it will context.clearRect() every frame. If false this is skipped (useful if you know you don't need it)
      • -
      • Collision now works between Sprites positioned via sprite.x/y, sprite.body.x/y or sprite.body.velocity.
      • -
      • If you are tweening a sprite and still want physics collision, set sprite.body.moves = false otherwise it will fight against the tween motion.
      • -
      • Game.enableStep will enable core game loop stepping. When enabled you must call game.step() directly (perhaps via a DOM button?), very useful for debugging!
      • -
      • Game.disableStep turns core update loop stepping off.
      • -
      • Debug.renderPhysicsBody(body, color) is extremely useful for debugging the new physics bodies. Will draw the outline + points in the color given.
      • -
      • Debug.renderBodyInfo(sprite, x, y, color) will display lots of Sprite body data.
      • -
      • Sprite.events.onBeginContact will be fired when a Body makes contact with another Body. Once contact is over an onEndContact event will be dispatched.
      • +
      • Phaser.Image is a brand new display object perfect for logos, backgrounds, etc. You can scale, rotate, tint and blend and Image, but it has no animation, physics body or input events.
      • +
      • You can now use the hitArea property on Sprites and Image objects. hitArea can be a geometry object (Rectangle, Circle, Polygon, Ellipse) and is used in pointerOver checks.
      • +
      • InputManager.getLocalPosition(displayObject, pointer, output) will return the local coordinates of the specified displayObject and pointer.
      • +
      • InputManager.hitTest will test for pointer hits against a Sprite/Image, its hitArea (if set) or any of its children.

      New Examples:

      -
        -
      • Physics - Bounce by Patrick OReilly.
      • -
      • Physics - Bounce with gravity by Patrick OReilly.
      • -
      • Physics - Bounce accelerator (use the keyboard) by Patrick OReilly.
      • -
      • Physics - Bounce knock (use the keyboard) by Patrick OReilly.
      • -
      • Physics - Snake (use the keyboard to control the snake like creature) by Patrick OReilly and Richard Davey.
      • -
      • Physics - Launcher - Angry Birds style ball launcher demo by Patrick OReilly.
      • -
      • Physics - Launcher Follow - throw the sprite anywhere in the world by Patrick OReilly.
      • -
      • Physics - Launcher Follow World - an advanced version of the Launcher Follow example by Patrick OReilly.
      • -
      • Input - Touch Joystick example showing how to use the clay.io virtual game controller (thanks gabehollombe)
      • -
      • Games - Matching Pairs by Patrick OReilly.
      • -
      • Games - Simon Says by Patrick OReilly.
      • -
      • Games - Wabbits by Patrick OReilly.
      • -
      • Tweens - Example showing how to use the tween events, onStart, onLoop and onComplete.
      • -
      • Display - Pixi Render Texture. A Phaser conversion of the Pixi.js Render Texture example.
      • -
      • Input - 5 new examples showing how to use the Gamepad API (thanks Karl Macklin)
      • -
      • Animation - Group Creation, showing how to create animations across all Group children in one call.
      • -
      • Particles - Rain by Jens Anders Bakke.
      • -
      • Particles - Snow by Jens Anders Bakke.
      • -
      • Groups - Nested Groups - showing how to embed one Group into another Group.
      • -
      • Time - Lots of new examples showing how to use the updated Phaser.Timer class.
      • -

      Updates:

        -
      • Updated to latest Pixi.js dev branch build (pre 1.4 release)
      • -
      • When a Sprite is destroyed any active filters are removed at the same time.
      • -
      • Updated Pixi.js so that removing filters now works correctly without breaking the display list.
      • -
      • Phaser.Canvas.create updated so it can be given an ID as the 3rd parameter (can also be set via new Game configuration object).
      • -
      • Updated display/fullscreen example to reflect new full screen change.
      • -
      • Loads of updates to the TypeScript definitions files - games fully compile now and lots of missing classes added :) (thanks Niondir)
      • -
      • Removed 'null parent' check from Group constructor. Will parent to game.world only if parent value is undefined.
      • -
      • The tutorials have now been translated into Spanish - thanks feiss :)
      • -
      • separateY updated to re-implement the 'riding platforms' special condition (thanks cocoademon)
      • -
      • SoundManager.onSoundDecode now dispatches the key followed by the sound object, also now dispatched by the Cache when doing an auto-decode on load.
      • -
      • Switch method of using trimmed sprites to support scaling and rotation (thanks cocoademon)
      • -
      • Most of the GameObjectFactory functions now have a group parameter, so you can do: game.add.sprite(x, y, frame, frameName, group) rather than defaulting to the World group.
      • -
      • Group.countLiving and countDead used to return -1 if the Group was empty, but now return 0.
      • -
      • Text can now be fixedToCamera, updated world/fixed to camera example to show this.
      • -
      • ArcadePhysics.overlap and collide now recognise TileSprites in the collision checks.
      • -
      • Lots of documentation fixes in the Tween class.
      • -
      • Tweens fire an onLoop event if they are set to repeat. onComplete is now only fired for the final repeat (or never if the repeat is infinite)
      • -
      • Pointer used to un-pause a paused game every time it was clicked/touched (this avoided some rogue browser plugins). Now only happens if Stage.disableVisibilityChange is true.
      • -
      • Input doesn't set the cursor to default if it's already set to none.
      • -
      • You can now collide a group against itself. This will check all children against each other, but not themselves (thanks cocoademon)
      • -
      • RenderTexture.render / renderXY has a new parameter: renderHidden, a boolean which will allow you to render Sprites even if their visible is set to false.
      • -
      • Added in prototype.constructor definitions to every class (thanks darkoverlordofdata)
      • -
      • Group.destroy has a new parameter: destroyChildren (boolean) which will optionally call the destroy method of all Group children.
      • -
      • Button.clearFrames method has been added.
      • -
      • Device.quirksMode is a boolean that informs you if the page is in strict (false) or quirks (true) mode.
      • -
      • Canvas.getOffset now runs a strict/quirks check and uses document.documentElement when calculating scrollTop and scrollLeft to avoid Chrome console warnings.
      • -
      • The Time class now has its own Phaser.Timer which you can access through game.time.events. See the new Timer examples to show how to use them.
      • -
      • Added StateManager.getCurrentState to return the currently running State object (thanks Niondir)
      • -
      • Removed the console.log redirect from Utils as it was messing with Firefox.
      • -
      • Body.acceleration is now much smoother and less eratic at high speeds.
      • -
      • Removed ArcadePhysics binding to the QuadTree, so it can now be used independantly of the physics system.
      • -
      • Removed ArcadePhysics.preUpdate and postUpdate as neither are needed any more.
      • -
      • Body.bottom and Body.right are no longer rounded, so will give accurate sub-pixel values.
      • -
      • Fixed lots of documentation in the Emitter class.
      • -
      • The delta timer value used for physics calculations has had its cap limit modified from 1.0 to 0.05 in line with the core updates.
      • -
      • Phaser.Math.min enhanced so you can now pass in either an array of numbers or lots of numbers as parameters to get the lowest.
      • -
      • Phaser.Math.max added as the opposite of Math.min.
      • -
      • Phaser.Math.minProperty and maxProperty added. Like Math.min/max but can be given a property an an array or list of objects to inspect.
      • -
      • Added 'full' paramter to Body.reset, allowing you to control if motion or all data is reset or not.
      • -
      • Exposed Group.pivot and Sprite.pivot to allow you to directly set the pivot points for rotation.
      • -
      • Swapped to using the native and faster Array.isArray check.
      • -
      • Added callback context parameter to Tween.onUpdateCallback(callback, context) to avoid having to bind or create anonymous functions.
      • -
      • Updated TweenManager.removeAll so it flags all tweens as pendingDelete rather than nuking the array, to avoid tween callback array size errors (thanks DarkDev)
      • +
      • Debug.renderRectangle has a new parameter: filled. If true it renders as with fillRect, if false strokeRect.
      • +
      • Phaser.AnimationParser now sets the trimmed data directly for Pixi Texture frames. Tested across JSON Hash, JSON Data, Sprite Sheet and XML.
      • +
      • Game.add.renderTexture now has the addToCache parameter. If set the texture will be stored in Game.Cache and can be retrieved with Cache.getTexture(key).
      • +
      • Game.add.bitmapData now has the addToCache parameter. If set the texture will be stored in Game.Cache and can be retrieved with Cache.getBitmapData(key).
      • +
      • The InputManager now sets the canvas style cursor to 'inherit' instead of 'default'.

      Bug Fixes:

        -
      • Cache.getImageKeys returned __missing in the array, now excluded.
      • -
      • Fixed Group.scale so you can now scale a Group directly.
      • -
      • Removed World.scale as it was preventing Group.scale from working - you can still scale the world, but you'll need to factor in Input changes yourself.
      • -
      • Moved 'dirty' flag for Tilemap to a per-layer flag. Fixes #242
      • -
      • Group.length now returns the number of children in the Group regardless of their exists/alive state, or 0 if the Group has no children.
      • -
      • Switch Camera.setBoundsToWorld to match world.bounds instead of world (thanks cocoademon)
      • -
      • Fixed an issue where passing null as the Group parent wouldn't set it to game.world as it should have (thanks tito100)
      • -
      • Fixed Pixi bug (#425) incorrect width property for multi-line BitmapText (thanks jcd-as)
      • -
      • Tween.onStart is now called when the tween starts AFTER the delay value, if given (thanks stevenbouma)
      • -
      • Sprites that are fixedToCamera can now be input dragged regardless of world position (thanks RafaelOliveira)
      • -
      • RenderTexture now displays correctly in Canvas games.
      • -
      • Canvas.addToDOM is now more robust when applying the overflowHidden style.
      • -
      • Fixed Pixi.StripShader which should stop the weird TileSprite GPU issues some were reporting (thanks GoodboyDigital)
      • -
      • Patched desyrel.xml so it doesn't contain any zero width/height characters, as they broke Firefox 25.
      • -
      • Cache.addSound now implements a locked attribute (thanks haden)
      • -
      • Sound now checks for CocoonJS during playback to avoid readyState clash (thanks haden)
      • -
      • Buttons now clear previously set frames correctly if you call setFrames.
      • -
      • Sounds will now loop correctly if they are paused and resumed (thanks haden)
      • -
      • InputHandler.checkBoundsRect and checkBoundsSprite now take into account if the Sprite is fixedToCamera or not.
      • -
      • Removed the frame property from TileSprites as it cannot use them, it tiles the whole image only, not just a section of it.
      • -
      • Fixed WebGLRenderer updateGraphics bug (thanks theadam)
      • -
      • Removed duplicate Timer.create line (thanks hstolte)
      • -
      • Fixed issue with the camera being slightly out of sync with 'fixedToCamera' sprites.
      • -
      • 1px camera jitter issue fixed where map is same size, or smaller than the game size.
      • +
      • Explicitly paused Timer continues if you un-focus and focus the browser window (thanks georgiee)
      • +
      • Added TimerEvent.pendingDelete and checks in Timer.update, so that removing an event in a callback no longer throws an exception (thanks georgiee)
      • +
      • Fixed TypeScript defs on lines 1741-1748 (thanks wombatbuddy)
      • +
      • Previously if you used Sprite.crop() it would crop all Sprites using the same base image. It now takes a local copy of the texture data and crops just that.
      • +
      • Tilemap had the wrong @method signatures so most were missing from the docs.

      You can view the Change Log for all previous versions at https://github.com/photonstorm/phaser/changelog.md

      How to Build

      @@ -705,14 +608,6 @@ Sprites also have full Input support: click them, touch them, drag them around,

      FruitParty

      Road Map

      Here is what's on our road map for the coming months:

      -

      Version 1.1.5 ("Saldaea")

      -
        -
      • A fast turn-around point release that will focus on addressing any bugs that occured as a result of the large changes that took place in 1.1.4.
      • -
      -

      Version 1.2 ("Shienar")

      -
        -
      • Update to Pixi 1.4 - this newly released build has lots of internal changes and new features we want to take advantage of.
      • -

      Version 1.3 ("Tarabon")

      • Enhance the State Management, so you can perform non-destructive State swaps and persistence.
      • @@ -738,6 +633,8 @@ Sprites also have full Input support: click them, touch them, drag them around,
      • Look at HiDPI Canvas settings.
      • Multiple Camera support.
      +

      Nadion

      +

      Nadion is a set of powerful enhancements for Phaser that makes level building even easier. It includes features such as Trigger, Area, Alarms and Emitters, debug panels, state machines, parallax layer scrolling, 'developer mode' short-cuts and more.

      Contributing

      We now have a full Contributors Guide which goes into the process in more detail, but here are the headlines:

        @@ -778,7 +675,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 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:41 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/namespaces.list.html b/docs/namespaces.list.html index f5a3ebbe..d4f4332b 100644 --- a/docs/namespaces.list.html +++ b/docs/namespaces.list.html @@ -182,6 +182,10 @@ Group +
      • + Image +
      • +
      • Input
      • @@ -398,6 +402,36 @@
      + +
    @@ -577,6 +611,9 @@
    Group
    +
    Image
    +
    +
    Input
    @@ -655,6 +692,9 @@
    RenderTexture
    +
    RenderTexture
    +
    +
    RequestAnimationFrame
    @@ -673,6 +713,9 @@
    Sprite
    +
    Sprite
    +
    +
    Stage
    @@ -774,7 +817,7 @@ Documentation generated by JSDoc 3.3.0-dev - on Wed Feb 05 2014 06:28:24 GMT-0000 (GMT) using the DocStrap template. + on Sat Feb 08 2014 07:19:41 GMT-0000 (GMT) using the DocStrap template. diff --git a/src/tilemap/Tilemap.js b/src/tilemap/Tilemap.js index e9530a30..284845be 100644 --- a/src/tilemap/Tilemap.js +++ b/src/tilemap/Tilemap.js @@ -32,14 +32,49 @@ Phaser.Tilemap = function (game, key) { return; } + /** + * @property {number} width - The width of the map (in tiles). + */ this.width = data.width; + + /** + * @property {number} height - The height of the map (in tiles). + */ this.height = data.height; + + /** + * @property {number} tileWidth - The base width of the tiles in the map (in pixels). + */ this.tileWidth = data.tileWidth; + + /** + * @property {number} tileHeight - The base height of the tiles in the map (in pixels). + */ this.tileHeight = data.tileHeight; + + /** + * @property {string} orientation - The orientation of the map data (as specified in Tiled), usually 'orthogonal'. + */ this.orientation = data.orientation; + + /** + * @property {number} version - The version of the map data (as specified in Tiled, usually 1). + */ this.version = data.version; + + /** + * @property {object} properties - Map specific properties as specified in Tiled. + */ this.properties = data.properties; + + /** + * @property {number} widthInPixels - The width of the map in pixels based on width * tileWidth. + */ this.widthInPixels = data.widthInPixels; + + /** + * @property {number} heightInPixels - The height of the map in pixels based on height * tileHeight. + */ this.heightInPixels = data.heightInPixels; /** @@ -191,12 +226,13 @@ Phaser.Tilemap.prototype = { }, - // Region? Remove tile from map data? + /* createFromTiles: function (layer, tileIndex, key, frame, group) { if (typeof group === 'undefined') { group = this.game.world; } }, + */ /** * Creates a Sprite for every object matching the given gid in the map data. You can optionally specify the group that the Sprite will be created in. If none is @@ -204,7 +240,7 @@ Phaser.Tilemap.prototype = { * configure Sprite properties from within the map editor. For example giving an object a property if alpha: 0.5 in the map editor will duplicate that when the * Sprite is created. You could also give it a value like: body.velocity.x: 100 to set it moving automatically. * - * @method Phaser.Tileset#createFromObjects + * @method Phaser.Tilemap#createFromObjects * @param {string} name - The name of the Object Group to create Sprites from. * @param {number} gid - The layer array index value, or if a string is given the layer name, within the map data that this TilemapLayer represents. * @param {string} key - The Game.cache key of the image that this Sprite will use. @@ -249,8 +285,10 @@ Phaser.Tilemap.prototype = { /** * Creates a new TilemapLayer object. By default TilemapLayers are fixed to the camera. + * The `layer` parameter is important. If you've created your map in Tiled then you can get this by looking in Tiled and looking at the Layer name. + * Or you can open the JSON file it exports and look at the layers[].name value. Either way it must match. * - * @method Phaser.Tileset#createLayer + * @method Phaser.Tilemap#createLayer * @param {number|string} layer - The layer array index value, or if a string is given the layer name, within the map data that this TilemapLayer represents. * @param {number} [width] - The rendered width of the layer, should never be wider than Game.width. If not given it will be set to Game.width. * @param {number} [height] - The rendered height of the layer, should never be wider than Game.height. If not given it will be set to Game.height. @@ -285,7 +323,7 @@ Phaser.Tilemap.prototype = { /** * Gets the layer index based on the layers name. * - * @method Phaser.Tileset#getIndex + * @method Phaser.Tilemap#getIndex * @protected * @param {array} location - The local array to search. * @param {string} name - The name of the array element to get. @@ -308,7 +346,7 @@ Phaser.Tilemap.prototype = { /** * Gets the layer index based on its name. * - * @method Phaser.Tileset#getLayerIndex + * @method Phaser.Tilemap#getLayerIndex * @param {string} name - The name of the layer to get. * @return {number} The index of the layer in this tilemap, or null if not found. */ @@ -321,7 +359,7 @@ Phaser.Tilemap.prototype = { /** * Gets the tileset index based on its name. * - * @method Phaser.Tileset#getTilesetIndex + * @method Phaser.Tilemap#getTilesetIndex * @param {string} name - The name of the tileset to get. * @return {number} The index of the tileset in this tilemap, or null if not found. */ @@ -334,7 +372,7 @@ Phaser.Tilemap.prototype = { /** * Gets the image index based on its name. * - * @method Phaser.Tileset#getImageIndex + * @method Phaser.Tilemap#getImageIndex * @param {string} name - The name of the image to get. * @return {number} The index of the image in this tilemap, or null if not found. */ @@ -347,7 +385,7 @@ Phaser.Tilemap.prototype = { /** * Gets the object index based on its name. * - * @method Phaser.Tileset#getObjectIndex + * @method Phaser.Tilemap#getObjectIndex * @param {string} name - The name of the object to get. * @return {number} The index of the object in this tilemap, or null if not found. */ @@ -362,7 +400,7 @@ Phaser.Tilemap.prototype = { * If a callback is already set for the tile index it will be replaced. Set the callback to null to remove it. * If you want to set a callback for a tile at a specific location on the map then see setTileLocationCallback. * - * @method Phaser.Tileset#setTileIndexCallback + * @method Phaser.Tilemap#setTileIndexCallback * @param {number|array} indexes - Either a single tile index, or an array of tile indexes to have a collision callback set for. * @param {function} callback - The callback that will be invoked when the tile is collided with. * @param {object} callbackContext - The context under which the callback is called. @@ -393,7 +431,7 @@ Phaser.Tilemap.prototype = { * If a callback is already set for the tile index it will be replaced. Set the callback to null to remove it. * If you want to set a callback for a tile at a specific location on the map then see setTileLocationCallback. * - * @method Phaser.Tileset#setTileLocationCallback + * @method Phaser.Tilemap#setTileLocationCallback * @param {number} x - X position of the top left of the area to copy (given in tiles, not pixels) * @param {number} y - Y position of the top left of the area to copy (given in tiles, not pixels) * @param {number} width - The width of the area to copy (given in tiles, not pixels) @@ -424,7 +462,7 @@ Phaser.Tilemap.prototype = { * Sets collision the given tile or tiles. You can pass in either a single numeric index or an array of indexes: [ 2, 3, 15, 20]. * The `collides` parameter controls if collision will be enabled (true) or disabled (false). * - * @method Phaser.Tileset#setCollision + * @method Phaser.Tilemap#setCollision * @param {number|array} indexes - Either a single tile index, or an array of tile IDs to be checked for collision. * @param {boolean} [collides=true] - If true it will enable collision. If false it will clear collision. * @param {number|string|Phaser.TilemapLayer} [layer] - The layer to operate on. If not given will default to this.currentLayer. @@ -458,7 +496,7 @@ Phaser.Tilemap.prototype = { * Calling this with a start value of 10 and a stop value of 14 would set collision for tiles 10, 11, 12, 13 and 14. * The `collides` parameter controls if collision will be enabled (true) or disabled (false). * - * @method Phaser.Tileset#setCollisionBetween + * @method Phaser.Tilemap#setCollisionBetween * @param {number} start - The first index of the tile to be set for collision. * @param {number} stop - The last index of the tile to be set for collision. * @param {boolean} [collides=true] - If true it will enable collision. If false it will clear collision. @@ -489,7 +527,7 @@ Phaser.Tilemap.prototype = { * Sets collision on all tiles in the given layer, except for the IDs of those in the given array. * The `collides` parameter controls if collision will be enabled (true) or disabled (false). * - * @method Phaser.Tileset#setCollisionByExclusion + * @method Phaser.Tilemap#setCollisionByExclusion * @param {array} indexes - An array of the tile IDs to not be counted for collision. * @param {boolean} [collides=true] - If true it will enable collision. If false it will clear collision. * @param {number|string|Phaser.TilemapLayer} [layer] - The layer to operate on. If not given will default to this.currentLayer. @@ -518,7 +556,7 @@ Phaser.Tilemap.prototype = { * Sets collision values on a tile in the set. * You shouldn't usually call this method directly, instead use setCollision, setCollisionBetween or setCollisionByExclusion. * - * @method Phaser.Tileset#setCollisionByIndex + * @method Phaser.Tilemap#setCollisionByIndex * @protected * @param {number} index - The index of the tile on the layer. * @param {boolean} [collides=true] - If true it will enable collision on the tile. If false it will clear collision values from the tile. @@ -561,7 +599,7 @@ Phaser.Tilemap.prototype = { /** * Gets the TilemapLayer index as used in the setCollision calls. * - * @method Phaser.Tileset#getLayer + * @method Phaser.Tilemap#getLayer * @protected * @param {number|string|Phaser.TilemapLayer} layer - The layer to operate on. If not given will default to this.currentLayer. * @return {number} The TilemapLayer index. @@ -592,7 +630,7 @@ Phaser.Tilemap.prototype = { /** * Internal function. * - * @method Phaser.Tileset#calculateFaces + * @method Phaser.Tilemap#calculateFaces * @protected * @param {number} layer - The index of the TilemapLayer to operate on. */ @@ -649,7 +687,7 @@ Phaser.Tilemap.prototype = { * Gets the tile above the tile coordinates given. * Mostly used as an internal function by calculateFaces. * - * @method Phaser.Tileset#getTileAbove + * @method Phaser.Tilemap#getTileAbove * @param {number} layer - The local layer index to get the tile from. Can be determined by Tilemap.getLayer(). * @param {number} x - The x coordinate to get the tile from. In tiles, not pixels. * @param {number} y - The y coordinate to get the tile from. In tiles, not pixels. @@ -669,7 +707,7 @@ Phaser.Tilemap.prototype = { * Gets the tile below the tile coordinates given. * Mostly used as an internal function by calculateFaces. * - * @method Phaser.Tileset#getTileBelow + * @method Phaser.Tilemap#getTileBelow * @param {number} layer - The local layer index to get the tile from. Can be determined by Tilemap.getLayer(). * @param {number} x - The x coordinate to get the tile from. In tiles, not pixels. * @param {number} y - The y coordinate to get the tile from. In tiles, not pixels. @@ -689,7 +727,7 @@ Phaser.Tilemap.prototype = { * Gets the tile to the left of the tile coordinates given. * Mostly used as an internal function by calculateFaces. * - * @method Phaser.Tileset#getTileLeft + * @method Phaser.Tilemap#getTileLeft * @param {number} layer - The local layer index to get the tile from. Can be determined by Tilemap.getLayer(). * @param {number} x - The x coordinate to get the tile from. In tiles, not pixels. * @param {number} y - The y coordinate to get the tile from. In tiles, not pixels. @@ -709,7 +747,7 @@ Phaser.Tilemap.prototype = { * Gets the tile to the right of the tile coordinates given. * Mostly used as an internal function by calculateFaces. * - * @method Phaser.Tileset#getTileRight + * @method Phaser.Tilemap#getTileRight * @param {number} layer - The local layer index to get the tile from. Can be determined by Tilemap.getLayer(). * @param {number} x - The x coordinate to get the tile from. In tiles, not pixels. * @param {number} y - The y coordinate to get the tile from. In tiles, not pixels.